- Timestamp:
- 2011-08-22T13:47:35+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r2512 r4334 81 81 } else { 82 82 x.mergeFrom(layer); 83 Main.map.repaint(); 83 84 } 84 85 } -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r4332 r4334 112 112 private boolean isLocalFile; 113 113 // used by ChooseTrackVisibilityAction to determine which tracks to show/hide 114 private boolean[] trackVisibility ;114 private boolean[] trackVisibility = new boolean[0]; 115 115 116 116 private final List<GpxTrack> lastTracks = new ArrayList<GpxTrack>(); // List of tracks at last paint … … 126 126 data = d; 127 127 computeCacheInSync = false; 128 trackVisibility = new boolean[d.tracks.size()]; 129 for(int i=0; i < d.tracks.size(); i++) { 130 trackVisibility[i] = true; 131 } 128 ensureTrackVisibilityLength(); 132 129 } 133 130 … … 579 576 int velColor =(int) Math.round(colorModeDynamic ? ((vel-minval)*255/(maxval-minval)) 580 577 : (vel <= 0 ? 0 : vel / colorTracksTune * 255)); 581 trkPnt.customColoring = colors[ velColor > 255 ? 255 : velColor];578 trkPnt.customColoring = colors[Math.max(0, Math.min(velColor, 255))]; 582 579 } else { 583 580 trkPnt.customColoring = colors[255]; … … 622 619 WayPoint last = null; 623 620 int i = 0; 621 ensureTrackVisibilityLength(); 624 622 for (GpxTrack trk: data.tracks) { 625 623 // hide tracks that were de-selected in ChooseTrackVisibilityAction … … 857 855 public void setAssociatedFile(File file) { 858 856 data.storageFile = file; 857 } 858 859 /** ensures the trackVisibility array has the correct length without losing data. 860 * additional entries are initialized to true; 861 */ 862 final private void ensureTrackVisibilityLength() { 863 final int l = data.tracks.size(); 864 if(l == trackVisibility.length) 865 return; 866 final boolean[] back = trackVisibility.clone(); 867 final int m = Math.min(l, back.length); 868 trackVisibility = new boolean[l]; 869 for(int i=0; i < m; i++) { 870 trackVisibility[i] = back[i]; 871 } 872 for(int i=m; i < l; i++) { 873 trackVisibility[i] = true; 874 } 859 875 } 860 876
Note:
See TracChangeset
for help on using the changeset viewer.