- Timestamp:
- 2016-06-12T20:46:23+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/SelectCommand.java
r9989 r10364 38 38 @Override 39 39 public void undoCommand() { 40 Main. map.mapView.getEditLayer().data.setSelected(oldSelection);40 Main.getLayerManager().getEditLayer().data.setSelected(oldSelection); 41 41 } 42 42 43 43 @Override 44 44 public boolean executeCommand() { 45 oldSelection = Main. map.mapView.getEditLayer().data.getSelected();46 Main. map.mapView.getEditLayer().data.setSelected(newSelection);45 oldSelection = Main.getLayerManager().getEditLayer().data.getSelected(); 46 Main.getLayerManager().getEditLayer().data.setSelected(newSelection); 47 47 return true; 48 48 } -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r9371 r10364 62 62 @Override 63 63 public void undoCommand() { 64 if (Main.isDisplayingMapView() && !Main. map.mapView.hasLayer(getLayer())) {64 if (Main.isDisplayingMapView() && !Main.getLayerManager().containsLayer(getLayer())) { 65 65 Main.warn(tr("Layer ''{0}'' does not exist any more. Cannot remove conflict for object ''{1}''.", 66 66 getLayer().getName(), -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
r9371 r10364 71 71 72 72 if (Main.isDisplayingMapView()) { 73 if (!Main. map.mapView.hasLayer(getLayer())) {73 if (!Main.getLayerManager().containsLayer(getLayer())) { 74 74 Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more", 75 75 this.toString(), … … 79 79 } 80 80 81 Main. map.mapView.setActiveLayer(getLayer());81 Main.getLayerManager().setActiveLayer(getLayer()); 82 82 } 83 83 reconstituteConflicts(); -
trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
r9371 r10364 75 75 public void undoCommand() { 76 76 OsmDataLayer layer = getLayer(); 77 if (!Main. map.mapView.hasLayer(layer)) {77 if (!Main.getLayerManager().containsLayer(layer)) { 78 78 Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more", 79 79 this.toString(), … … 83 83 } 84 84 85 Main. map.mapView.setActiveLayer(layer);85 Main.getLayerManager().setActiveLayer(layer); 86 86 OsmDataLayer editLayer = Main.main.getEditLayer(); 87 87 -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r10300 r10364 127 127 MapView.addLayerChangeListener(this); 128 128 if (Main.isDisplayingMapView()) { 129 for (OsmDataLayer l: Main. map.mapView.getLayersOfType(OsmDataLayer.class)) {129 for (OsmDataLayer l: Main.getLayerManager().getLayersOfType(OsmDataLayer.class)) { 130 130 registerNewlayer(l); 131 131 } -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r10345 r10364 70 70 @Override 71 71 public void actionPerformed(ActionEvent e) { 72 Collection<ImageryLayer> layers = Main. map.mapView.getLayersOfType(ImageryLayer.class);72 Collection<ImageryLayer> layers = Main.getLayerManager().getLayersOfType(ImageryLayer.class); 73 73 if (layers.isEmpty()) { 74 74 setEnabled(false); -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r10340 r10364 417 417 public static void addEditLayerChangeListener(EditLayerChangeListener listener, boolean initialFire) { 418 418 if (listener != null) { 419 boolean doFire = initialFire && Main.isDisplayingMapView() && Main. map.mapView.getEditLayer() != null;419 boolean doFire = initialFire && Main.isDisplayingMapView() && Main.getLayerManager().getEditLayer() != null; 420 420 if (doFire) { 421 421 Main.getLayerManager().addAndFireActiveLayerChangeListener(new EditLayerChangeAdapter(listener)); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r10210 r10364 891 891 protected final <P extends OsmPrimitive> OsmDataLayer findLayerFor(P primitive) { 892 892 if (primitive != null) { 893 Iterable<OsmDataLayer> layers = Main. map.mapView.getLayersOfType(OsmDataLayer.class);893 Iterable<OsmDataLayer> layers = Main.getLayerManager().getLayersOfType(OsmDataLayer.class); 894 894 // Find layer with same dataset 895 895 for (OsmDataLayer layer : layers) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/DuplicateAction.java
r10346 r10364 57 57 58 58 List<String> layerNames = new ArrayList<>(); 59 for (Layer l: Main. map.mapView.getAllLayers()) {59 for (Layer l: Main.getLayerManager().getLayers()) { 60 60 layerNames.add(l.getName()); 61 61 } -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r10175 r10364 300 300 drawHelper.readPreferences(getName()); 301 301 drawHelper.drawAll(g, mv, visibleSegments); 302 if (Main. map.mapView.getActiveLayer() == this) {302 if (Main.getLayerManager().getActiveLayer() == this) { 303 303 drawHelper.drawColorBar(g, mv); 304 304 } -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r10181 r10364 171 171 long memoryBytesRequired = 50L * 1024L * 1024L; // assumed minimum JOSM memory footprint 172 172 if (Main.map != null && Main.map.mapView != null) { 173 for (Layer layer: Main. map.mapView.getAllLayers()) {173 for (Layer layer: Main.getLayerManager().getLayers()) { 174 174 memoryBytesRequired += layer.estimateMemoryUsage(); 175 175 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r10308 r10364 181 181 // If none, we'll zoom to the bounding box of the layer with the photos. 182 182 boolean boundingBoxedLayerFound = false; 183 for (Layer l: Main. map.mapView.getAllLayers()) {183 for (Layer l: Main.getLayerManager().getLayers()) { 184 184 if (l != yLayer) { 185 185 BoundingXYVisitor bbox = new BoundingXYVisitor(); … … 557 557 public void actionPerformed(ActionEvent arg0) { 558 558 // Construct the list of loaded GPX tracks 559 Collection<Layer> layerLst = Main. map.mapView.getAllLayers();559 Collection<Layer> layerLst = Main.getLayerManager().getLayers(); 560 560 GpxDataWrapper defaultItem = null; 561 561 for (Layer cur : layerLst) { -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r10173 r10364 784 784 private void clearOtherCurrentPhotos() { 785 785 for (GeoImageLayer layer: 786 Main. map.mapView.getLayersOfType(GeoImageLayer.class)) {786 Main.getLayerManager().getLayersOfType(GeoImageLayer.class)) { 787 787 if (layer != this) { 788 788 layer.clearCurrentPhoto(false); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
r10228 r10364 116 116 return null; 117 117 } 118 List<AbstractTileSourceLayer> targetLayers = Main. map.mapView.getLayersOfType(AbstractTileSourceLayer.class);118 List<AbstractTileSourceLayer> targetLayers = Main.getLayerManager().getLayersOfType(AbstractTileSourceLayer.class); 119 119 if (targetLayers.isEmpty()) { 120 120 if (!GraphicsEnvironment.isHeadless()) { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r10300 r10364 449 449 return; 450 450 Marker m = null; 451 Layer l = Main. map.mapView.getActiveLayer();451 Layer l = Main.getLayerManager().getActiveLayer(); 452 452 if (l != null) { 453 453 m = getAdjacentMarker(startMarker, next, l); 454 454 } 455 455 if (m == null) { 456 for (Layer layer : Main. map.mapView.getAllLayers()) {456 for (Layer layer : Main.getLayerManager().getLayers()) { 457 457 m = getAdjacentMarker(startMarker, next, layer); 458 458 if (m != null) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
r10179 r10364 70 70 71 71 private static boolean mapHasGpxorMarkerLayer() { 72 for (Layer layer : Main. map.mapView.getAllLayers()) {72 for (Layer layer : Main.getLayerManager().getLayers()) { 73 73 if (layer instanceof GpxLayer || layer instanceof MarkerLayer) { 74 74 return true; -
trunk/src/org/openstreetmap/josm/io/NoteImporter.java
r9797 r10364 38 38 try (InputStream is = Compression.getUncompressedFileInputStream(file)) { 39 39 final NoteLayer layer = loadLayer(is, file, file.getName(), progressMonitor); 40 if (Main.map == null || !Main. map.mapView.hasLayer(layer)) {40 if (Main.map == null || !Main.getLayerManager().containsLayer(layer)) { 41 41 GuiHelper.runInEDT(new Runnable() { 42 42 @Override … … 69 69 List<NoteLayer> noteLayers = null; 70 70 if (Main.map != null) { 71 noteLayers = Main. map.mapView.getLayersOfType(NoteLayer.class);71 noteLayers = Main.getLayerManager().getLayersOfType(NoteLayer.class); 72 72 } 73 73 final NoteLayer layer; -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r10212 r10364 249 249 * been disabled! */ 250 250 if (Main.isDisplayingMapView()) { 251 for (Layer l : Main. map.mapView.getLayersOfType(ImageryLayer.class)) {251 for (Layer l : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) { 252 252 if (((ImageryLayer) l).getInfo().isBlacklisted()) { 253 253 Main.info(tr("Removed layer {0} because it is not allowed by the configured API.", l.getName())); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
r10116 r10364 95 95 final ImageryInfo imgInfo = buildImageryInfo(); 96 96 if (Main.isDisplayingMapView()) { 97 for (ImageryLayer layer : Main. map.mapView.getLayersOfType(ImageryLayer.class)) {97 for (ImageryLayer layer : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) { 98 98 if (layer.getInfo().equals(imgInfo)) { 99 99 Main.info("Imagery layer already exists: "+imgInfo); -
trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java
r9983 r10364 44 44 public Collection<Layer> getDependencies() { 45 45 Layer gpxLayer = layer.fromLayer; 46 if (gpxLayer != null && Main. map.mapView.hasLayer(gpxLayer))46 if (gpxLayer != null && Main.getLayerManager().containsLayer(gpxLayer)) 47 47 return Collections.singleton(gpxLayer); 48 48 return Collections.emptySet(); -
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r10340 r10364 124 124 Main.main.createMapFrame(null, null); 125 125 } else { 126 for (Layer l: Main. map.mapView.getAllLayers()) {126 for (Layer l: Main.getLayerManager().getLayers()) { 127 127 Main.map.mapView.removeLayer(l); 128 128 } -
trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
r10188 r10364 47 47 @Test 48 48 public void testActionPerformedEnabled() { 49 assertTrue(Main. map.mapView.getLayersOfType(TMSLayer.class).isEmpty());49 assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty()); 50 50 new AddImageryLayerAction(new ImageryInfo("foo_tms", "http://bar", "tms", null, null)).actionPerformed(null); 51 List<TMSLayer> tmsLayers = Main. map.mapView.getLayersOfType(TMSLayer.class);51 List<TMSLayer> tmsLayers = Main.getLayerManager().getLayersOfType(TMSLayer.class); 52 52 assertEquals(1, tmsLayers.size()); 53 53 … … 55 55 new AddImageryLayerAction(new ImageryInfo("wms.openstreetmap.fr", "http://wms.openstreetmap.fr/wms?", 56 56 "wms_endpoint", null, null)).actionPerformed(null); 57 List<WMSLayer> wmsLayers = Main. map.mapView.getLayersOfType(WMSLayer.class);57 List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class); 58 58 assertEquals(1, wmsLayers.size()); 59 59 … … 69 69 @Test 70 70 public void testActionPerformedDisabled() { 71 assertTrue(Main. map.mapView.getLayersOfType(TMSLayer.class).isEmpty());71 assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty()); 72 72 new AddImageryLayerAction(new ImageryInfo()).actionPerformed(null); 73 assertTrue(Main. map.mapView.getLayersOfType(TMSLayer.class).isEmpty());73 assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty()); 74 74 } 75 75 } -
trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java
r9943 r10364 51 51 @Test 52 52 public void testExecuteUndoCommand() { 53 OsmDataLayer layer = Main. map.mapView.getEditLayer();53 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 54 54 Conflict<Node> conflict = new Conflict<>(new Node(), new Node()); 55 55 ConflictAddCommand cmd = new ConflictAddCommand(layer, conflict); … … 67 67 @Test 68 68 public void testGetDescriptionIcon() { 69 OsmDataLayer layer = Main. map.mapView.getEditLayer();69 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 70 70 Conflict<Node> conflict = new Conflict<>(new Node(), new Node()); 71 71 assertNotNull(new ConflictAddCommand(layer, conflict).getDescriptionIcon()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java
r9669 r10364 49 49 gpxLayer).run(); 50 50 assertEquals(2, Main.map.mapView.getNumLayers()); 51 GeoImageLayer layer = Main. map.mapView.getLayersOfType(GeoImageLayer.class).iterator().next();51 GeoImageLayer layer = Main.getLayerManager().getLayersOfType(GeoImageLayer.class).iterator().next(); 52 52 try { 53 53 assertEquals(gpxLayer, layer.getGpxLayer()); -
trunk/test/unit/org/openstreetmap/josm/io/NoteImporterTest.java
r10054 r10364 23 23 public void testTicket12531() { 24 24 if (Main.map != null) { 25 for (Layer l: Main. map.mapView.getAllLayers()) {25 for (Layer l: Main.getLayerManager().getLayers()) { 26 26 Main.map.mapView.removeLayer(l); 27 27 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
r9732 r10364 95 95 newHandler("https://localhost?url=" + Utils.encodeUrl(url)).handle(); 96 96 } finally { 97 for (OsmDataLayer layer : Main. map.mapView.getLayersOfType(OsmDataLayer.class)) {97 for (OsmDataLayer layer : Main.getLayerManager().getLayersOfType(OsmDataLayer.class)) { 98 98 Main.main.removeLayer(layer); 99 99 } -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java
r10218 r10364 139 139 public void testReadNotes() throws IOException, IllegalDataException { 140 140 if (Main.isDisplayingMapView()) { 141 for (NoteLayer nl : Main. map.mapView.getLayersOfType(NoteLayer.class)) {141 for (NoteLayer nl : Main.getLayerManager().getLayersOfType(NoteLayer.class)) { 142 142 Main.map.mapView.removeLayer(nl); 143 143 }
Note:
See TracChangeset
for help on using the changeset viewer.