- Timestamp:
- 05/02/08 15:04:09 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bbtracker/trunk/src/org/bbtracker/mobile/TrackManager.java
r184 r197 51 51 private int state; 52 52 53 // true if no new points are recorded in TRACKING state. 54 private boolean paused; 55 53 56 protected LocationProvider provider; 54 57 … … 77 80 trackInterrupted = false; 78 81 } 82 boolean currentPointChanged; 79 83 if (track != null) { 80 final int pointCount = track.getPointCount(); 81 if (currentPointIndex == pointCount - 1) { 82 // activate the new point only, when the last point is currently selected. 83 currentPointIndex = pointCount; 84 currentPoint = location; 84 currentPointChanged = false; 85 if (!paused) { 86 final int pointCount = track.getPointCount(); 87 if (currentPointIndex == pointCount - 1) { 88 // activate the new point only, when the last point is currently selected. 89 currentPointIndex = pointCount; 90 currentPoint = location; 91 currentPointChanged = true; 92 } 93 if (newSegment) { 94 track.newSegment(); 95 } 96 boundsChanged = track.addPoint(location); 85 97 } 86 boundsChanged = track.addPoint(location);87 98 } else { 88 99 currentPoint = location; 100 currentPointChanged = true; 89 101 } 90 fireNewPoint(currentPoint, boundsChanged, newSegment); 91 fireCurrentPointChanged(); 92 providerStateChanged(provider, provider.getState()); 102 fireNewPoint(location, boundsChanged, newSegment); 103 if (currentPointChanged) { 104 fireCurrentPointChanged(); 105 } 93 106 } else { 94 107 fireNewPoint(null, false, false); … … 97 110 98 111 public void providerStateChanged(final LocationProvider provider, final int newState) { 99 // TODO Auto-generated method stub 100 112 // noop 101 113 } 102 114 }; … … 182 194 } 183 195 return changed; 196 } 197 198 public void pauseTracking() { 199 if (state != STATE_TRACKING) { 200 throw new IllegalStateException("Not in tracking state! Can't pause tracking!"); 201 } 202 paused = true; 203 final int pc = track.getPointCount(); 204 if (track != null && pc > 0) { 205 final TrackPoint p = track.getPoint(pc - 1); 206 if (p.getName() == null) { 207 p.setName("paused"); 208 } 209 } 210 } 211 212 public void continueTracking() { 213 if (state != STATE_TRACKING) { 214 throw new IllegalStateException("Not in tracking state! Can't continue tracking!"); 215 } 216 trackInterrupted = true; 217 paused = false; 218 } 219 220 public boolean isPaused() { 221 return paused; 184 222 } 185 223 … … 224 262 track = new Track(name); 225 263 state = STATE_TRACKING; 264 paused = false; 226 265 227 266 currentPointIndex = -1;
Note: See TracChangeset
for help on using the changeset viewer.