Changeset 10318 in josm for trunk/src/org/openstreetmap/josm/actions/downloadtasks
- Timestamp:
- 2016-06-02T23:04:53+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/downloadtasks
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r10212 r10318 155 155 156 156 private GpxLayer findGpxMergeLayer() { 157 if (!Main.isDisplayingMapView())158 return null;159 157 boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false); 160 Layer active = Main. map.mapView.getActiveLayer();158 Layer active = Main.getLayerManager().getActiveLayer(); 161 159 if (active instanceof GpxLayer && (merge || ((GpxLayer) active).data.fromServer)) 162 160 return (GpxLayer) active; 163 for (GpxLayer l : Main. map.mapView.getLayersOfType(GpxLayer.class)) {161 for (GpxLayer l : Main.getLayerManager().getLayersOfType(GpxLayer.class)) { 164 162 if (merge || l.data.fromServer) 165 163 return l; … … 169 167 170 168 private MarkerLayer findMarkerMergeLayer(GpxLayer fromLayer) { 171 if (!Main.isDisplayingMapView()) 172 return null; 173 for (MarkerLayer l : Main.map.mapView.getLayersOfType(MarkerLayer.class)) { 169 for (MarkerLayer l : Main.getLayerManager().getLayersOfType(MarkerLayer.class)) { 174 170 if (fromLayer != null && l.fromLayer == fromLayer) 175 171 return l; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r10212 r10318 113 113 } 114 114 115 List<NoteLayer> noteLayers = null; 116 if (Main.map != null) { 117 noteLayers = Main.map.mapView.getLayersOfType(NoteLayer.class); 118 } 119 if (noteLayers != null && !noteLayers.isEmpty()) { 115 List<NoteLayer> noteLayers = Main.getLayerManager().getLayersOfType(NoteLayer.class); 116 if (!noteLayers.isEmpty()) { 120 117 noteLayers.get(0).getNoteData().addNotes(notesData); 121 118 } else { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r10315 r10318 20 20 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 21 21 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 22 import org.openstreetmap.josm.gui.layer.Layer;23 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 24 23 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 217 216 218 217 protected int getNumDataLayers() { 219 if (!Main.isDisplayingMapView()) return 0; 220 return Utils.filteredCollection(Main.map.mapView.getAllLayers(), OsmDataLayer.class).size(); 218 return Main.getLayerManager().getLayersOfType(OsmDataLayer.class).size(); 221 219 } 222 220 223 221 protected OsmDataLayer getFirstDataLayer() { 224 if (!Main.isDisplayingMapView()) return null; 225 Collection<Layer> layers = Main.map.mapView.getAllLayersAsList(); 226 for (Layer layer : layers) { 227 if (layer instanceof OsmDataLayer) 228 return (OsmDataLayer) layer; 229 } 230 return null; 222 return Utils.find(Main.getLayerManager().getLayers(), OsmDataLayer.class); 231 223 } 232 224 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r10250 r10318 73 73 Layer l = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null); 74 74 Main.main.addLayer(l); 75 Main. map.mapView.setActiveLayer(l);75 Main.getLayerManager().setActiveLayer(l); 76 76 } 77 77
Note:
See TracChangeset
for help on using the changeset viewer.