Changeset 1646 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2009-06-06T21:39:12+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r1638 r1646 175 175 namedTrackPoints.waypoints.add(point); 176 176 177 MarkerLayer ml = new MarkerLayer(namedTrackPoints, tr("Named Trackpoints from {0}", name), associatedFile, me);177 MarkerLayer ml = new MarkerLayer(namedTrackPoints, tr("Named Trackpoints from {0}", name), getAssociatedFile(), me); 178 178 if (ml.data.size() > 0) { 179 179 Main.main.addLayer(ml); … … 203 203 Main.pref.put("markers.lastaudiodirectory", fc.getCurrentDirectory().getAbsolutePath()); 204 204 205 MarkerLayer ml = new MarkerLayer(new GpxData(), tr("Audio markers from {0}", name), associatedFile, me);205 MarkerLayer ml = new MarkerLayer(new GpxData(), tr("Audio markers from {0}", name), getAssociatedFile(), me); 206 206 File sel[] = fc.getSelectedFiles(); 207 207 if(sel != null) { … … 270 270 new JMenuItem(new ConvertToDataLayerAction()), 271 271 new JSeparator(), 272 new JMenuItem(new RenameLayerAction( associatedFile, this)),272 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 273 273 new JSeparator(), 274 274 new JMenuItem(new LayerListPopup.InfoAction(this))}; … … 287 287 new JMenuItem(new DownloadAlongTrackAction()), 288 288 new JSeparator(), 289 new JMenuItem(new RenameLayerAction( associatedFile, this)),289 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 290 290 new JSeparator(), 291 291 new JMenuItem(new LayerListPopup.InfoAction(this))}; … … 680 680 } 681 681 Main.main.addLayer(new OsmDataLayer(ds, tr("Converted from: {0}", GpxLayer.this.name), 682 data.storageFile));682 getAssociatedFile())); 683 683 Main.main.removeLayer(GpxLayer.this); 684 684 } 685 685 } 686 687 public File getAssociatedFile() { return data.storageFile; } 688 public void setAssociatedFile(File file) { data.storageFile = file; } 686 689 687 690 /** … … 932 935 double duration = AudioUtil.getCalibratedDuration(wavFile); 933 936 double startTime = lastModified - duration; 934 startTime = firstStartTime + (startTime - firstStartTime) / 937 startTime = firstStartTime + (startTime - firstStartTime) / 935 938 Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */); 936 939 WayPoint w1 = null; … … 949 952 if (w2 != null) break; 950 953 } 951 } 954 } 952 955 953 956 if (w1 == null || w2 == null) { … … 964 967 wayPointFromTimeStamp.attr.put("name", name); 965 968 waypoints.add(wayPointFromTimeStamp); 966 } 967 } 968 969 } 970 } 971 969 972 // (e) analyse audio for spoken markers here, in due course 970 973 … … 1013 1016 name, uri, ml, w.time, offset); 1014 1017 /* timeFromAudio intended for future use to shift markers of this type on synchronization */ 1015 if (w == wayPointFromTimeStamp) { 1016 am.timeFromAudio = true; 1018 if (w == wayPointFromTimeStamp) { 1019 am.timeFromAudio = true; 1017 1020 } 1018 1021 ml.data.add(am); -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r1508 r1646 65 65 * If a file is associated with this layer, this variable should be set to it. 66 66 */ 67 p ublicFile associatedFile;67 private File associatedFile; 68 68 69 69 /** … … 120 120 */ 121 121 public void destroy() {} 122 123 public File getAssociatedFile() { return associatedFile; } 124 public void setAssociatedFile(File file) { associatedFile = file; } 122 125 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r1640 r1646 152 152 super(name); 153 153 this.data = data; 154 this. associatedFile = associatedFile;154 this.setAssociatedFile(associatedFile); 155 155 } 156 156 … … 217 217 tool += undeletedSize(data.ways)+" "+trn("way", "ways", undeletedSize(data.ways)); 218 218 if (data.version != null) tool += ", " + tr("version {0}", data.version); 219 if (associatedFile != null) 220 tool = "<html>"+tool+"<br>"+associatedFile.getPath()+"</html>"; 219 File f = getAssociatedFile(); 220 if (f != null) 221 tool = "<html>"+tool+"<br>"+f.getPath()+"</html>"; 221 222 return tool; 222 223 } … … 307 308 308 309 // update the modified flag 309 if (associatedFile != null && processed != null && !dataAdded) 310 boolean b = (getAssociatedFile() != null && processed != null); 311 if (b && !dataAdded) 310 312 return; // do nothing when uploading non-harmful changes. 311 313 312 314 // modified if server changed the data (esp. the id). 313 uploadedModified = associatedFile != null && processed != null&& dataAdded;315 uploadedModified = b && dataAdded; 314 316 setModified(uploadedModified); 315 317 } … … 378 380 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 379 381 new JSeparator(), 380 new JMenuItem(new RenameLayerAction( associatedFile, this)),382 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 381 383 new JSeparator(), 382 384 new JMenuItem(new LayerListPopup.InfoAction(this))}; … … 391 393 new JMenuItem(new ConvertToGpxLayerAction()), 392 394 new JSeparator(), 393 new JMenuItem(new RenameLayerAction( associatedFile, this)),395 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 394 396 new JSeparator(), 395 397 new JMenuItem(new LayerListPopup.InfoAction(this))}; … … 454 456 455 457 public GpxData toGpxData() { 456 return toGpxData(data, associatedFile);458 return toGpxData(data, getAssociatedFile()); 457 459 } 458 460 -
trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r1589 r1646 107 107 super(name); 108 108 this.fromServer = fromServer; 109 this.associatedFile = associatedFile;109 setAssociatedFile(associatedFile); 110 110 this.data = data; 111 111 Main.pref.listener.add(this); … … 151 151 String tool = data.size()+" "+trn("track", "tracks", data.size()) 152 152 +" "+points+" "+trn("point", "points", points); 153 if (associatedFile != null) 154 tool = "<html>"+tool+"<br>"+associatedFile.getPath()+"</html>"; 153 File f = getAssociatedFile(); 154 if (f != null) 155 tool = "<html>"+tool+"<br>"+f.getPath()+"</html>"; 155 156 return tool; 156 157 } … … 242 243 new JMenuItem(new ConvertToDataLayerAction()), 243 244 new JSeparator(), 244 new JMenuItem(new RenameLayerAction( associatedFile, this)),245 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 245 246 new JSeparator(), 246 247 new JMenuItem(new LayerListPopup.InfoAction(this))}; … … 254 255 new JMenuItem(new ConvertToDataLayerAction()), 255 256 new JSeparator(), 256 new JMenuItem(new RenameLayerAction( associatedFile, this)),257 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 257 258 new JSeparator(), 258 259 new JMenuItem(new LayerListPopup.InfoAction(this))}; -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r1601 r1646 71 71 72 72 super(name); 73 this. associatedFile = associatedFile;73 this.setAssociatedFile(associatedFile); 74 74 this.data = new ArrayList<Marker>(); 75 75 this.fromLayer = fromLayer; … … 258 258 components.add (moveaudio); 259 259 } 260 components.add(new JMenuItem(new RenameLayerAction( associatedFile, this)));260 components.add(new JMenuItem(new RenameLayerAction(getAssociatedFile(), this))); 261 261 components.add(new JSeparator()); 262 262 components.add(new JMenuItem(new LayerListPopup.InfoAction(this)));
Note:
See TracChangeset
for help on using the changeset viewer.