- Timestamp:
- 2010-03-12T08:18:44+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r2907 r3119 35 35 public boolean fromServer; 36 36 37 public Collection<GpxTrack> tracks = new LinkedList<GpxTrack>();38 public Collection<GpxRoute> routes = new LinkedList<GpxRoute>();39 public Collection<WayPoint> waypoints = new LinkedList<WayPoint>();37 public final Collection<GpxTrack> tracks = new LinkedList<GpxTrack>(); 38 public final Collection<GpxRoute> routes = new LinkedList<GpxRoute>(); 39 public final Collection<WayPoint> waypoints = new LinkedList<WayPoint>(); 40 40 41 41 @SuppressWarnings("unchecked") -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r2907 r3119 21 21 Bounds getBounds(); 22 22 double length(); 23 /** 24 * 25 * @return Number of times this track has been changed. Always 0 for read-only tracks 26 */ 27 int getUpdateCount(); 23 28 24 29 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
r3083 r3119 15 15 Collection<WayPoint> getWayPoints(); 16 16 double length(); 17 17 /** 18 * 19 * @return Number of times this track has been changed. Always 0 for read-only segments 20 */ 21 int getUpdateCount(); 18 22 } -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java
r3083 r3119 73 73 return segments; 74 74 } 75 76 public int getUpdateCount() { 77 return 0; 78 } 75 79 } -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrackSegment.java
r3083 r3119 62 62 } 63 63 64 public int getUpdateCount() { 65 return 0; 66 } 67 64 68 } -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r3097 r3119 77 77 public class GpxLayer extends Layer { 78 78 public GpxData data; 79 private final GpxLayer me;80 79 protected static final double PHI = Math.toRadians(15); 81 80 private boolean computeCacheInSync; … … 86 85 private boolean isLocalFile; 87 86 87 private final List<GpxTrack> lastTracks = new ArrayList<GpxTrack>(); // List of tracks at last paint 88 private int lastUpdateCount; 89 88 90 private static class Markers { 89 91 public boolean timedMarkersOmitted = false; … … 94 96 super((String) d.attr.get("name")); 95 97 data = d; 96 me = this;97 98 computeCacheInSync = false; 98 99 } … … 207 208 208 209 MarkerLayer ml = new MarkerLayer(namedTrackPoints, tr("Named Trackpoints from {0}", getName()), 209 getAssociatedFile(), me);210 getAssociatedFile(), GpxLayer.this); 210 211 if (ml.data.size() > 0) { 211 212 Main.main.addLayer(ml); … … 282 283 } 283 284 MarkerLayer ml = new MarkerLayer(new GpxData(), tr("Audio markers from {0}", getName()) + names, 284 getAssociatedFile(), me);285 getAssociatedFile(), GpxLayer.this); 285 286 double firstStartTime = sel[0].lastModified() / 1000.0 /* ms -> seconds */ 286 287 - AudioUtil.getCalibratedDuration(sel[0]); … … 452 453 } 453 454 455 private int sumUpdateCount() { 456 int updateCount = 0; 457 for (GpxTrack track: data.tracks) { 458 updateCount += track.getUpdateCount(); 459 } 460 return updateCount; 461 } 462 463 @Override 464 public boolean isChanged() { 465 if (data.tracks.equals(lastTracks)) 466 return sumUpdateCount() != lastUpdateCount; 467 else 468 return true; 469 } 470 454 471 @Override 455 472 public void mergeFrom(Layer from) { … … 481 498 @Override 482 499 public void paint(Graphics2D g, MapView mv, Bounds box) { 500 lastUpdateCount = sumUpdateCount(); 501 lastTracks.clear(); 502 lastTracks.addAll(data.tracks); 483 503 484 504 /****************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.