-
diff --git a/CommandLine/src/CommandLine/CommandLine.java b/CommandLine/src/CommandLine/CommandLine.java
index 3bc73ff..5a760ef 100644
|
a
|
b
|
public class CommandLine extends Plugin {
|
| 368 | 368 | action = new DummyAction(currentMapFrame, this); |
| 369 | 369 | break; |
| 370 | 370 | case IMAGERYURL: |
| 371 | | Layer layer = Main.map.mapView.getActiveLayer(); |
| | 371 | Layer layer = Main.getLayerManager().getActiveLayer(); |
| 372 | 372 | if (layer != null) { |
| 373 | 373 | if (!(layer instanceof ImageryLayer)) { |
| 374 | | List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class); |
| | 374 | List<ImageryLayer> imageryLayers = Main.getLayerManager().getLayersOfType(ImageryLayer.class); |
| 375 | 375 | if (imageryLayers.size() == 1) { |
| 376 | 376 | layer = imageryLayers.get(0); |
| 377 | 377 | } |
| … |
… |
public class CommandLine extends Plugin {
|
| 388 | 388 | action = new DummyAction(currentMapFrame, this); |
| 389 | 389 | break; |
| 390 | 390 | case IMAGERYOFFSET: |
| 391 | | Layer olayer = Main.map.mapView.getActiveLayer(); |
| | 391 | Layer olayer = Main.getLayerManager().getActiveLayer(); |
| 392 | 392 | if (olayer != null) { |
| 393 | 393 | if (!(olayer instanceof ImageryLayer)) { |
| 394 | | List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class); |
| | 394 | List<ImageryLayer> imageryLayers = Main.getLayerManager().getLayersOfType(ImageryLayer.class); |
| 395 | 395 | if (imageryLayers.size() == 1) { |
| 396 | 396 | olayer = imageryLayers.get(0); |
| 397 | 397 | } |
| … |
… |
public class CommandLine extends Plugin {
|
| 596 | 596 | try (GpxWriter gpxWriter = new GpxWriter(printWriter)) { |
| 597 | 597 | GpxFilter gpxFilter = new GpxFilter(); |
| 598 | 598 | gpxFilter.initBboxFilter(bbox); |
| 599 | | List<GpxLayer> gpxLayers = Main.map.mapView.getLayersOfType(GpxLayer.class); |
| | 599 | List<GpxLayer> gpxLayers = Main.getLayerManager().getLayersOfType(GpxLayer.class); |
| 600 | 600 | for (GpxLayer gpxLayer : gpxLayers) { |
| 601 | 601 | gpxFilter.addGpxData(gpxLayer.data); |
| 602 | 602 | } |
-
diff --git a/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadOsmConnection.java b/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadOsmConnection.java
index e396af8..1e78cf1 100644
|
a
|
b
|
import org.openstreetmap.josm.gui.MapView;
|
| 10 | 10 | import org.openstreetmap.josm.gui.dialogs.LayerListDialog; |
| 11 | 11 | import org.openstreetmap.josm.gui.layer.GpxLayer; |
| 12 | 12 | import org.openstreetmap.josm.gui.layer.Layer; |
| | 13 | import org.openstreetmap.josm.gui.layer.MainLayerManager; |
| 13 | 14 | import org.openstreetmap.josm.io.OsmConnection; |
| 14 | 15 | import org.openstreetmap.josm.io.OsmTransferException; |
| 15 | 16 | import org.openstreetmap.josm.tools.HttpClient; |
| … |
… |
public class UploadOsmConnection extends OsmConnection {
|
| 48 | 49 | */ |
| 49 | 50 | GpxData autoSelectTrace() { |
| 50 | 51 | if (Main.map != null && Main.map.mapView != null) { |
| 51 | | MapView mv = Main.map.mapView; |
| | 52 | MainLayerManager lm = Main.getLayerManager(); |
| 52 | 53 | // List<Layer> allLayers = new ArrayList<Layer>(mv.getAllLayersAsList()); // modifiable |
| 53 | 54 | List<Layer> selectedLayers = LayerListDialog.getInstance().getModel().getSelectedLayers(); |
| 54 | | List<GpxLayer> gpxLayersRemaining = mv.getLayersOfType(GpxLayer.class); |
| | 55 | List<GpxLayer> gpxLayersRemaining = lm.getLayersOfType(GpxLayer.class); |
| 55 | 56 | gpxLayersRemaining.removeAll(selectedLayers); |
| 56 | 57 | GpxLayer traceLayer = null; |
| 57 | 58 | // find the first gpx layer inside selected layers |
| … |
… |
public class UploadOsmConnection extends OsmConnection {
|
| 67 | 68 | traceLayer = gpxLayersRemaining.get(0); |
| 68 | 69 | } |
| 69 | 70 | // active layer |
| 70 | | else if (mv.getActiveLayer() instanceof GpxLayer) { |
| 71 | | traceLayer = (GpxLayer) mv.getActiveLayer(); |
| | 71 | else if (lm.getActiveLayer() instanceof GpxLayer) { |
| | 72 | traceLayer = (GpxLayer) lm.getActiveLayer(); |
| 72 | 73 | } |
| 73 | 74 | } |
| 74 | 75 | |
| 75 | 76 | if (traceLayer != null) { |
| 76 | | GpxData data = traceLayer.data; |
| 77 | | return data; |
| | 77 | return traceLayer.data; |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
-
diff --git a/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java b/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java
index 8398071..00e12ab 100644
|
a
|
b
|
public class ElevationProfileDialog extends ToggleDialog implements LayerChangeL
|
| 195 | 195 | public void showNotify() { |
| 196 | 196 | MapView.addLayerChangeListener(this); |
| 197 | 197 | if (Main.isDisplayingMapView()) { |
| 198 | | Layer layer = Main.map.mapView.getActiveLayer(); |
| | 198 | Layer layer = Main.getLayerManager().getActiveLayer(); |
| 199 | 199 | if (layer instanceof GpxLayer) { |
| 200 | 200 | setActiveLayer((GpxLayer) layer); |
| 201 | 201 | } |
-
diff --git a/NanoLog/src/nanolog/GPXChooser.java b/NanoLog/src/nanolog/GPXChooser.java
index cded6dd..a9dc1c7 100644
|
a
|
b
|
public class GPXChooser extends JDialog {
|
| 18 | 18 | |
| 19 | 19 | public static GpxLayer topLayer() { |
| 20 | 20 | // return first found local layer |
| 21 | | for( Layer layer : Main.map.mapView.getAllLayers() ) { |
| | 21 | for( Layer layer : Main.getLayerManager().getLayers() ) { |
| 22 | 22 | if( layer instanceof GpxLayer && ((GpxLayer)layer).isLocalFile() ) |
| 23 | 23 | return (GpxLayer)layer; |
| 24 | 24 | } |
-
diff --git a/NanoLog/src/nanolog/NanoLogLayer.java b/NanoLog/src/nanolog/NanoLogLayer.java
index 36616d1..3592de7 100644
|
a
|
b
|
public class NanoLogLayer extends Layer implements JumpToMarkerActions.JumpToMar
|
| 297 | 297 | @Override |
| 298 | 298 | public void mousePressed( MouseEvent e ) { |
| 299 | 299 | int nearest = nearestEntry(e); |
| 300 | | if( nearest > 0 && Main.map.mapView.getActiveLayer() == NanoLogLayer.this ) { |
| | 300 | if( nearest > 0 && Main.getLayerManager().getActiveLayer() == NanoLogLayer.this ) { |
| 301 | 301 | dragging = nearest; |
| 302 | 302 | doDrag(e); |
| 303 | 303 | } |
-
diff --git a/NanoLog/src/nanolog/NanoLogPanel.java b/NanoLog/src/nanolog/NanoLogPanel.java
index 25247b1..a4e1e71 100644
|
a
|
b
|
public class NanoLogPanel extends ToggleDialog implements LayerChangeListener, N
|
| 36 | 36 | |
| 37 | 37 | public void updateMarkers() { |
| 38 | 38 | List<NanoLogEntry> entries = new ArrayList<>(); |
| 39 | | for( NanoLogLayer l : Main.map.mapView.getLayersOfType(NanoLogLayer.class) ) { |
| | 39 | for( NanoLogLayer l : Main.getLayerManager().getLayersOfType(NanoLogLayer.class) ) { |
| 40 | 40 | entries.addAll(l.getEntries()); |
| 41 | 41 | } |
| 42 | 42 | listModel.setEntries(entries); |
-
diff --git a/cadastre-fr/src/cadastre_fr/CadastreInterface.java b/cadastre-fr/src/cadastre_fr/CadastreInterface.java
index c48b7c9..f41b6e3 100644
|
a
|
b
|
public class CadastreInterface {
|
| 575 | 575 | |
| 576 | 576 | private static void checkLayerDuplicates(WMSLayer wmsLayer) throws DuplicateLayerException { |
| 577 | 577 | if (Main.map != null) { |
| 578 | | for (Layer l : Main.map.mapView.getAllLayers()) { |
| | 578 | for (Layer l : Main.getLayerManager().getLayers()) { |
| 579 | 579 | if (l instanceof WMSLayer && l.getName().equals(wmsLayer.getName()) && (!l.equals(wmsLayer))) { |
| 580 | 580 | Main.info("Try to grab into a new layer when "+wmsLayer.getName()+" is already opened."); |
| 581 | 581 | // remove the duplicated layer |
-
diff --git a/cadastre-fr/src/cadastre_fr/CadastrePlugin.java b/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
index c04dcec..cfb36bb 100644
|
a
|
b
|
public class CadastrePlugin extends Plugin {
|
| 455 | 455 | */ |
| 456 | 456 | public static void addWMSLayer(WMSLayer wmsLayer) { |
| 457 | 457 | if (Main.map != null && Main.map.mapView != null) { |
| 458 | | int wmsNewLayerPos = Main.map.mapView.getAllLayers().size(); |
| 459 | | for(Layer l : Main.map.mapView.getLayersOfType(WMSLayer.class)) { |
| | 458 | int wmsNewLayerPos = Main.getLayerManager().getLayers().size(); |
| | 459 | for(Layer l : Main.getLayerManager().getLayersOfType(WMSLayer.class)) { |
| 460 | 460 | int wmsPos = Main.map.mapView.getLayerPos(l); |
| 461 | 461 | if (wmsPos < wmsNewLayerPos) wmsNewLayerPos = wmsPos; |
| 462 | 462 | } |
-
diff --git a/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java b/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
index 7bea280..62453af 100644
|
a
|
b
|
|
| 1 | 1 | // License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others |
| 2 | 2 | package cadastre_fr; |
| 3 | 3 | |
| 4 | | import static org.openstreetmap.josm.tools.I18n.tr; |
| 5 | 4 | import static org.openstreetmap.josm.tools.I18n.marktr; |
| | 5 | import static org.openstreetmap.josm.tools.I18n.tr; |
| 6 | 6 | |
| 7 | 7 | import java.awt.event.ActionEvent; |
| 8 | 8 | import java.util.ArrayList; |
| … |
… |
import javax.swing.JOptionPane;
|
| 11 | 11 | |
| 12 | 12 | import org.openstreetmap.josm.Main; |
| 13 | 13 | import org.openstreetmap.josm.actions.JosmAction; |
| 14 | | import org.openstreetmap.josm.gui.layer.Layer; |
| 15 | 14 | |
| 16 | 15 | public class MenuActionGrabPlanImage extends JosmAction implements Runnable { |
| 17 | 16 | |
| … |
… |
public class MenuActionGrabPlanImage extends JosmAction implements Runnable {
|
| 35 | 34 | protected void updateEnabledState() { |
| 36 | 35 | if (wmsLayer == null || Main.map == null || Main.map.mapView == null) return; |
| 37 | 36 | if (!rasterImageGeoreferencer.isRunning()) return; |
| 38 | | for (Layer l : Main.map.mapView.getAllLayersAsList()) |
| 39 | | if (l == wmsLayer) |
| 40 | | return; |
| | 37 | if (Main.getLayerManager().containsLayer(wmsLayer)) |
| | 38 | return; |
| 41 | 39 | JOptionPane.showMessageDialog(Main.parent, tr("Georeferencing interrupted")); |
| 42 | 40 | rasterImageGeoreferencer.actionInterrupted(); |
| 43 | 41 | } |
| 44 | 42 | |
| 45 | | public void actionPerformed(ActionEvent ae) { |
| | 43 | @Override |
| | 44 | public void actionPerformed(ActionEvent ae) { |
| 46 | 45 | if (Main.map != null) { |
| 47 | 46 | if (CadastrePlugin.isCadastreProjection()) { |
| 48 | 47 | wmsLayer = new MenuActionNewLocation().addNewLayer(new ArrayList<WMSLayer>()); |
| … |
… |
public class MenuActionGrabPlanImage extends JosmAction implements Runnable {
|
| 57 | 56 | } |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | | public void run() { |
| | 59 | @Override |
| | 60 | public void run() { |
| 61 | 61 | // wait until plan image is fully loaded and joined into one single image |
| 62 | 62 | boolean loadedFromCache = downloadWMSPlanImage.waitFinished(); |
| 63 | 63 | if (loadedFromCache) { |
-
diff --git a/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java b/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java
index 7c4f214..f29fb34 100644
|
a
|
b
|
public class MenuActionLoadFromCache extends JosmAction {
|
| 68 | 68 | } |
| 69 | 69 | // check if the selected cache is not already displayed |
| 70 | 70 | if (Main.map != null) { |
| 71 | | for (Layer l : Main.map.mapView.getAllLayers()) { |
| | 71 | for (Layer l : Main.getLayerManager().getLayers()) { |
| 72 | 72 | if (l instanceof WMSLayer && l.getName().equals(location)) { |
| 73 | 73 | JOptionPane.showMessageDialog(Main.parent, tr("The location {0} is already on screen. Cache not loaded.", filename), tr("Error"), JOptionPane.ERROR_MESSAGE); |
| 74 | 74 | continue nextFile; |
-
diff --git a/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java b/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java
index 963e2f7..aa09278 100644
|
a
|
b
|
public class MenuActionNewLocation extends JosmAction {
|
| 105 | 105 | Main.pref.put("cadastrewms.codeCommune", codeCommune); |
| 106 | 106 | Main.pref.put("cadastrewms.codeDepartement", codeDepartement); |
| 107 | 107 | if (Main.map != null) { |
| 108 | | for (Layer l : Main.map.mapView.getAllLayers()) { |
| | 108 | for (Layer l : Main.getLayerManager().getLayers()) { |
| 109 | 109 | if (l instanceof WMSLayer && l.getName().equalsIgnoreCase(location)) { |
| 110 | 110 | return null; |
| 111 | 111 | } |
| … |
… |
public class MenuActionNewLocation extends JosmAction {
|
| 117 | 117 | wmsLayer.setDepartement(codeDepartement); |
| 118 | 118 | CadastrePlugin.addWMSLayer(wmsLayer); |
| 119 | 119 | Main.info("Add new layer with Location:" + inputTown.getText()); |
| 120 | | } else if (existingLayers != null && existingLayers.size() > 0 && Main.map.mapView.getActiveLayer() instanceof WMSLayer) { |
| 121 | | wmsLayer = (WMSLayer)Main.map.mapView.getActiveLayer(); |
| | 120 | } else if (existingLayers != null && existingLayers.size() > 0 && Main.getLayerManager().getActiveLayer() instanceof WMSLayer) { |
| | 121 | wmsLayer = (WMSLayer)Main.getLayerManager().getActiveLayer(); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | return wmsLayer; |
-
diff --git a/cadastre-fr/src/cadastre_fr/WMSAdjustAction.java b/cadastre-fr/src/cadastre_fr/WMSAdjustAction.java
index d400742..e2f817e 100644
|
a
|
b
|
public class WMSAdjustAction extends MapMode implements
|
| 40 | 40 | |
| 41 | 41 | @Override public void enterMode() { |
| 42 | 42 | if (Main.map != null) { |
| 43 | | if (Main.map.mapView.getActiveLayer() instanceof WMSLayer) { |
| 44 | | modifiedLayer = (WMSLayer)Main.map.mapView.getActiveLayer(); |
| | 43 | if (Main.getLayerManager().getActiveLayer() instanceof WMSLayer) { |
| | 44 | modifiedLayer = (WMSLayer)Main.getLayerManager().getActiveLayer(); |
| 45 | 45 | super.enterMode(); |
| 46 | 46 | Main.map.mapView.addMouseListener(this); |
| 47 | 47 | Main.map.mapView.addMouseMotionListener(this); |
-
diff --git a/cadastre-fr/src/cadastre_fr/WMSDownloadAction.java b/cadastre-fr/src/cadastre_fr/WMSDownloadAction.java
index c427c04..6700e9d 100644
|
a
|
b
|
public class WMSDownloadAction /*extends JosmAction */{
|
| 26 | 26 | // check if we already have a layer created. if not, create; if yes, reuse. |
| 27 | 27 | ArrayList<WMSLayer> existingWMSlayers = new ArrayList<>(); |
| 28 | 28 | if (Main.map != null) { |
| 29 | | Layer activeLayer = Main.map.mapView.getActiveLayer(); |
| | 29 | Layer activeLayer = Main.getLayerManager().getActiveLayer(); |
| 30 | 30 | if (activeLayer instanceof WMSLayer) |
| 31 | 31 | return (WMSLayer) activeLayer; |
| 32 | | for (Layer l : Main.map.mapView.getAllLayers()) { |
| | 32 | for (Layer l : Main.getLayerManager().getLayers()) { |
| 33 | 33 | if (l instanceof WMSLayer) { |
| 34 | 34 | existingWMSlayers.add((WMSLayer)l); |
| 35 | 35 | } |
-
diff --git a/cadastre-fr/src/cadastre_fr/WMSLayer.java b/cadastre-fr/src/cadastre_fr/WMSLayer.java
index 42a9be5..045a001 100644
|
a
|
b
|
public class WMSLayer extends Layer implements ImageObserver {
|
| 159 | 159 | grabThread.setCanceled(false); |
| 160 | 160 | grabThread.setGrabber(grabber); |
| 161 | 161 | // if it is the first layer, use the communeBBox as grab bbox (and not divided) |
| 162 | | if (Main.map.mapView.getAllLayers().size() == 1 ) { |
| | 162 | if (Main.getLayerManager().getLayers().size() == 1 ) { |
| 163 | 163 | final Bounds bounds = this.getCommuneBBox().toBounds(); |
| 164 | 164 | GuiHelper.runInEDTAndWait(new Runnable() { |
| 165 | 165 | @Override |
-
diff --git a/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java b/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java
index b19bf33..47ae8ac 100644
|
a
|
b
|
public class EditGpxMode extends MapMode implements LayerChangeListener {
|
| 159 | 159 | */ |
| 160 | 160 | private void updateLayer() { |
| 161 | 161 | |
| 162 | | List<EditGpxLayer> layers = Main.map.mapView.getLayersOfType(EditGpxLayer.class); |
| | 162 | List<EditGpxLayer> layers = Main.getLayerManager().getLayersOfType(EditGpxLayer.class); |
| 163 | 163 | currentEditLayer = layers.isEmpty()?null:layers.get(0); |
| 164 | 164 | |
| 165 | 165 | if(currentEditLayer == null) { |
| … |
… |
public class EditGpxMode extends MapMode implements LayerChangeListener {
|
| 178 | 178 | if (oldLayer instanceof EditGpxLayer) { |
| 179 | 179 | currentEditLayer = null; |
| 180 | 180 | if (Main.map.mapMode instanceof EditGpxMode) { |
| 181 | | if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) { |
| | 181 | if (Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer) { |
| 182 | 182 | Main.map.selectSelectTool(false); |
| 183 | 183 | } else { |
| 184 | 184 | Main.map.selectZoomTool(false); |
-
diff --git a/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java b/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java
index dced68c..e14d438 100644
|
a
|
b
|
class GPXLayerImportAction extends AbstractAction {
|
| 52 | 52 | DefaultListModel<GpxLayer> dModel = new DefaultListModel<>(); |
| 53 | 53 | |
| 54 | 54 | final JList<GpxLayer> layerList = new JList<>(dModel); |
| 55 | | Collection<Layer> data = Main.map.mapView.getAllLayers(); |
| | 55 | Collection<Layer> data = Main.getLayerManager().getLayers(); |
| 56 | 56 | int layerCnt = 0; |
| 57 | 57 | |
| 58 | 58 | for (Layer l : data){ |
-
diff --git a/gpsblam/src/org/openstreetmap/josm/plugins/gpsblam/GPSBlamInputData.java b/gpsblam/src/org/openstreetmap/josm/plugins/gpsblam/GPSBlamInputData.java
index c1d0748..f0ca6e3 100644
|
a
|
b
|
class GPSBlamInputData extends LinkedList<CachedLatLon> {
|
| 26 | 26 | // select a set of GPX points and count how many tracks they have come from, |
| 27 | 27 | // within given radius of line between given points |
| 28 | 28 | GPSBlamInputData(Point p1, Point p2, int radius) { |
| 29 | | Collection<Layer> layers = Main.map.mapView.getAllLayers(); |
| | 29 | Collection<Layer> layers = Main.getLayerManager().getLayers(); |
| 30 | 30 | for (Layer l : layers) { |
| 31 | 31 | if (l.isVisible() && l instanceof GpxLayer) { |
| 32 | 32 | for (GpxTrack track : ((GpxLayer)l).data.tracks) { |
-
diff --git a/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/actions/downloadtask/DownloadXmlBoundsTask.java b/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/actions/downloadtask/DownloadXmlBoundsTask.java
index 022af80..1acbcf5 100644
|
a
|
b
|
public class DownloadXmlBoundsTask extends DownloadOsmTask implements XmlBoundsC
|
| 72 | 72 | protected int getNumDataLayers() { |
| 73 | 73 | int count = 0; |
| 74 | 74 | if (!Main.isDisplayingMapView()) return 0; |
| 75 | | for (Layer layer : Main.map.mapView.getAllLayers()) { |
| | 75 | for (Layer layer : Main.getLayerManager().getLayers()) { |
| 76 | 76 | if (layer instanceof XmlBoundsLayer) { |
| 77 | 77 | count++; |
| 78 | 78 | } |
| … |
… |
public class DownloadXmlBoundsTask extends DownloadOsmTask implements XmlBoundsC
|
| 83 | 83 | @Override |
| 84 | 84 | protected OsmDataLayer getFirstDataLayer() { |
| 85 | 85 | if (!Main.isDisplayingMapView()) return null; |
| 86 | | for (Layer layer : Main.map.mapView.getAllLayersAsList()) { |
| | 86 | for (Layer layer : Main.getLayerManager().getLayers()) { |
| 87 | 87 | if (layer instanceof XmlBoundsLayer) |
| 88 | 88 | return (XmlBoundsLayer) layer; |
| 89 | 89 | } |
-
diff --git a/imagery_offset_db/src/iodb/ImageryOffsetTools.java b/imagery_offset_db/src/iodb/ImageryOffsetTools.java
index 28d3aeb..46a159c 100644
|
a
|
b
|
public class ImageryOffsetTools {
|
| 29 | 29 | public static ImageryLayer getTopImageryLayer() { |
| 30 | 30 | if( Main.map == null || Main.map.mapView == null ) |
| 31 | 31 | return null; |
| 32 | | List<ImageryLayer> layers = Main.map.mapView.getLayersOfType(ImageryLayer.class); |
| | 32 | List<ImageryLayer> layers = Main.getLayerManager().getLayersOfType(ImageryLayer.class); |
| 33 | 33 | for( ImageryLayer layer : layers ) { |
| 34 | 34 | String url = layer.getInfo().getUrl(); |
| 35 | 35 | if( layer.isVisible() && url != null && !url.contains("gps-") ) { |
-
diff --git a/imageryadjust/src/imageryadjust/ImageryAdjustMapMode.java b/imageryadjust/src/imageryadjust/ImageryAdjustMapMode.java
index a1defb6..aed80b3 100644
|
a
|
b
|
public class ImageryAdjustMapMode extends MapMode implements MouseListener, Mous
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | private List<? extends Layer> getVisibleLayers() { |
| 56 | | List<? extends Layer> all = new ArrayList<Layer>(Main.map.mapView.getLayersOfType(ImageryLayer.class)); |
| | 56 | List<? extends Layer> all = new ArrayList<Layer>(Main.getLayerManager().getLayersOfType(ImageryLayer.class)); |
| 57 | 57 | Iterator<? extends Layer> it = all.iterator(); |
| 58 | 58 | while (it.hasNext()) { |
| 59 | 59 | if (!it.next().isVisible()) it.remove(); |
| … |
… |
public class ImageryAdjustMapMode extends MapMode implements MouseListener, Mous
|
| 75 | 75 | warnNoImageryLayers(); |
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | | List<ImageryLayer> layers = Main.map.mapView.getLayersOfType(ImageryLayer.class); |
| | 78 | List<ImageryLayer> layers = Main.getLayerManager().getLayersOfType(ImageryLayer.class); |
| 79 | 79 | if (layers.size() == 1) { |
| 80 | 80 | adjustingLayer = layers.get(0); |
| 81 | 81 | } else { |
| … |
… |
public class ImageryAdjustMapMode extends MapMode implements MouseListener, Mous
|
| 158 | 158 | return false; |
| 159 | 159 | if (Main.map.mapView == null) |
| 160 | 160 | return false; |
| 161 | | return Main.map.mapView.getActiveLayer() == layer; |
| | 161 | return Main.getLayerManager().getActiveLayer() == layer; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | @Override |
| … |
… |
public class ImageryAdjustMapMode extends MapMode implements MouseListener, Mous
|
| 229 | 229 | protected boolean hasImageryLayersToAdjust() { |
| 230 | 230 | if (Main.map == null) return false; |
| 231 | 231 | if (Main.map.mapView == null) return false; |
| 232 | | boolean b = ! Main.map.mapView.getLayersOfType(ImageryLayer.class).isEmpty(); |
| | 232 | boolean b = ! Main.getLayerManager().getLayersOfType(ImageryLayer.class).isEmpty(); |
| 233 | 233 | return b; |
| 234 | 234 | } |
| 235 | 235 | |
-
diff --git a/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java b/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java
index 8845717..63af2b0 100644
|
a
|
b
|
public final class ImageEntries {
|
| 75 | 75 | this.locatedImages.clear(); |
| 76 | 76 | |
| 77 | 77 | if (null != Main.map && null != Main.map.mapView) { |
| 78 | | final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); |
| | 78 | final Collection<Layer> layerCollection = Main.getLayerManager().getLayers(); |
| 79 | 79 | final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]); |
| 80 | 80 | |
| 81 | 81 | for (int index = 0; index < layers.length; index++) { |
-
diff --git a/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java b/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java
index 753b410..4ac1d5e 100644
|
a
|
b
|
public final class ImageWayPointPlugin extends org.openstreetmap.josm.plugins.Pl
|
| 69 | 69 | // check to see whether there's already an ImageWayPointLayer |
| 70 | 70 | boolean foundImageWayPointLayer = false; |
| 71 | 71 | if (null != Main.map && null != Main.map.mapView) { |
| 72 | | final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); |
| | 72 | final Collection<Layer> layerCollection = Main.getLayerManager().getLayers(); |
| 73 | 73 | final Iterator<Layer> layerIterator = layerCollection.iterator(); |
| 74 | 74 | while (layerIterator.hasNext() && !foundImageWayPointLayer) { |
| 75 | 75 | if (layerIterator.next() instanceof ImageWayPointLayer) { |
-
diff --git a/irsrectify/src/irsrectify/IRSRectifyPlugin.java b/irsrectify/src/irsrectify/IRSRectifyPlugin.java
index 267c462..636e136 100644
|
a
|
b
|
public class IRSRectifyPlugin extends Plugin {
|
| 73 | 73 | data.data.addPrimitive(offset); |
| 74 | 74 | data.data.addPrimitive(way); |
| 75 | 75 | data.data.setSelected(way.getPrimitiveId()); |
| 76 | | frame.mapView.setActiveLayer(data); |
| | 76 | Main.getLayerManager().setActiveLayer(data); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | private ImageryLayer findImageryLayer() { |
| 80 | 80 | if( frame == null || frame.mapView == null ) |
| 81 | 81 | return null; |
| 82 | | for( Layer l : frame.mapView.getAllLayers() ) |
| | 82 | for( Layer l : Main.getLayerManager().getLayers() ) |
| 83 | 83 | if( l instanceof ImageryLayer ) |
| 84 | 84 | return (ImageryLayer)l; |
| 85 | 85 | return null; |
| … |
… |
public class IRSRectifyPlugin extends Plugin {
|
| 89 | 89 | if( frame == null || frame.mapView == null ) |
| 90 | 90 | return null; |
| 91 | 91 | |
| 92 | | OsmDataLayer l = frame.mapView.getEditLayer(); |
| | 92 | OsmDataLayer l = Main.getLayerManager().getEditLayer(); |
| 93 | 93 | if( isOffsetLayer(l) ) |
| 94 | 94 | return l; |
| 95 | 95 | |
| 96 | 96 | // try to find among all layers |
| 97 | | for( Layer layer : frame.mapView.getAllLayers() ) |
| | 97 | for( Layer layer : Main.getLayerManager().getLayers() ) |
| 98 | 98 | if( layer instanceof OsmDataLayer && isOffsetLayer((OsmDataLayer)layer) ) |
| 99 | 99 | return (OsmDataLayer) layer; |
| 100 | 100 | |
-
diff --git a/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java b/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java
index a58f2ad..d13d85e 100644
|
a
|
b
|
public class DigraphCreationTask extends PleaseWaitRunnable {
|
| 64 | 64 | OsmTransferException { |
| 65 | 65 | //Prüfen, ob der ausgewählte Layer ein OSMDataLayer ist |
| 66 | 66 | if (Main.map == null |
| 67 | | || !Main.map.isVisible() || !(Main.map.mapView.getActiveLayer() instanceof OsmDataLayer)) { |
| | 67 | || !Main.map.isVisible() || !(Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) { |
| 68 | 68 | JOptionPane.showMessageDialog(Main.parent, tr("this layer is no osm data layer")); |
| 69 | 69 | return; |
| 70 | 70 | } |
| … |
… |
public class DigraphCreationTask extends PleaseWaitRunnable {
|
| 83 | 83 | |
| 84 | 84 | OSMGraph graph = new OSMGraph(); |
| 85 | 85 | //Der vom Benutzer in JOSM ausgewählte, zur Zeit aktive Layer wird der PLugin-OSM-Layer |
| 86 | | plugin.setOsmlayer((OsmDataLayer)Main.map.mapView.getActiveLayer()); |
| | 86 | plugin.setOsmlayer((OsmDataLayer)Main.getLayerManager().getActiveLayer()); |
| 87 | 87 | Iterator<Node> it = Main.main.getCurrentDataSet().getNodes().iterator(); |
| 88 | 88 | while (it.hasNext()) { |
| 89 | 89 | graph.addNode(it.next()); |
| … |
… |
public class DigraphCreationTask extends PleaseWaitRunnable {
|
| 146 | 146 | plugin.setNormalMapMode(Main.map.mapMode); |
| 147 | 147 | Main.map.selectMapMode(plugin.getJcMapMode()); |
| 148 | 148 | Main.main.addLayer(plugin.getChannelDigraphLayer()); |
| 149 | | Main.map.mapView.setActiveLayer(plugin.getChannelDigraphLayer()); |
| | 149 | Main.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer()); |
| 150 | 150 | } |
| 151 | 151 | } |
-
diff --git a/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java b/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java
index a133220..5e4169d 100644
|
a
|
b
|
public class JunctionCheckTask extends PleaseWaitRunnable{
|
| 90 | 90 | for (int i = 0; i < jc.getSubJunction().size(); i++) { |
| 91 | 91 | plugin.getChannelDigraph().addJunctioncandidateChannel(jc.getSubJunction().get(i)); |
| 92 | 92 | } |
| 93 | | Main.map.mapView.setActiveLayer(plugin.getChannelDigraphLayer()); |
| | 93 | Main.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer()); |
| 94 | 94 | } |
| 95 | 95 | } |
-
diff --git a/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/util/RelationProducer.java b/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/util/RelationProducer.java
index 6bb8d89..e319a1d 100644
|
a
|
b
|
public class RelationProducer {
|
| 41 | 41 | .getId(), OsmPrimitiveType.WAY)); |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | | Main.map.mapView.setActiveLayer(plugin.getOsmlayer()); |
| | 44 | Main.getLayerManager().setActiveLayer(plugin.getOsmlayer()); |
| 45 | 45 | plugin.getOsmlayer().data.setSelected(ways); |
| 46 | 46 | |
| 47 | 47 | Relation jrelation = new Relation(); |
-
diff --git a/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java b/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java
index c7448a6..3ce056b 100644
|
a
|
b
|
public class MapdustPlugin extends Plugin implements LayerChangeListener,
|
| 362 | 362 | if (mapdustLayer != null && mapdustLayer.isVisible()) { |
| 363 | 363 | if (event.getButton() == MouseEvent.BUTTON1) { |
| 364 | 364 | if (event.getClickCount() == 2 && !event.isConsumed()) { |
| 365 | | if (Main.map.mapView.getActiveLayer() == getMapdustLayer()) { |
| | 365 | if (Main.getLayerManager().getActiveLayer() == getMapdustLayer()) { |
| 366 | 366 | /* show add bug dialog */ |
| 367 | 367 | MapdustBug bug = mapdustGUI.getSelectedBug(); |
| 368 | 368 | if (bug != null) { |
| … |
… |
public class MapdustPlugin extends Plugin implements LayerChangeListener,
|
| 619 | 619 | * <code>MapdustLayer</code> false otherwise |
| 620 | 620 | */ |
| 621 | 621 | private boolean containsMapdustLayer() { |
| 622 | | boolean contains = false; |
| 623 | | List<Layer> all = Main.map.mapView.getAllLayersAsList(); |
| 624 | | if (mapdustLayer != null && all.contains(mapdustLayer)) { |
| 625 | | contains = true; |
| 626 | | } |
| 627 | | return contains; |
| | 622 | return mapdustLayer != null && Main.getLayerManager().containsLayer(mapdustLayer); |
| 628 | 623 | } |
| 629 | 624 | |
| 630 | 625 | /** |
-
diff --git a/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java b/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
index 2671966..b23d77c 100644
|
a
|
b
|
public final class MapillaryLayer extends AbstractModifiableLayer implements
|
| 110 | 110 | Main.map.mapView.addLayer(this); |
| 111 | 111 | MapView.addEditLayerChangeListener(this, false); |
| 112 | 112 | MapView.addLayerChangeListener(this); |
| 113 | | if (Main.map.mapView.getEditLayer() != null) |
| 114 | | Main.map.mapView.getEditLayer().data.addDataSetListener(this); |
| | 113 | if (Main.getLayerManager().getEditLayer() != null) |
| | 114 | Main.getLayerManager().getEditLayer().data.addDataSetListener(this); |
| 115 | 115 | if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Automatic) |
| 116 | 116 | MapillaryDownloader.automaticDownload(); |
| 117 | 117 | if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Semiautomatic) |
| … |
… |
public final class MapillaryLayer extends AbstractModifiableLayer implements
|
| 222 | 222 | Main.map.mapView.removeMouseListener(this.mode); |
| 223 | 223 | Main.map.mapView.removeMouseMotionListener(this.mode); |
| 224 | 224 | MapView.removeEditLayerChangeListener(this); |
| 225 | | if (Main.map.mapView.getEditLayer() != null) |
| 226 | | Main.map.mapView.getEditLayer().data.removeDataSetListener(this); |
| | 225 | if (Main.getLayerManager().getEditLayer() != null) |
| | 226 | Main.getLayerManager().getEditLayer().data.removeDataSetListener(this); |
| 227 | 227 | clearInstance(); |
| 228 | 228 | super.destroy(); |
| 229 | 229 | } |
| … |
… |
public final class MapillaryLayer extends AbstractModifiableLayer implements
|
| 285 | 285 | @Override |
| 286 | 286 | public synchronized void paint(final Graphics2D g, final MapView mv, final Bounds box) { |
| 287 | 287 | g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
| 288 | | if (Main.map.mapView.getActiveLayer() == this) { |
| | 288 | if (Main.getLayerManager().getActiveLayer() == this) { |
| 289 | 289 | // paint remainder |
| 290 | 290 | g.setPaint(this.hatched); |
| 291 | 291 | g.fill(MapViewGeometryUtil.getNonDownloadedArea(mv, this.data.getBounds())); |
| … |
… |
public final class MapillaryLayer extends AbstractModifiableLayer implements
|
| 322 | 322 | if (selectedImage != null && selectedImage.getSequence() != null) { |
| 323 | 323 | selectedImageKey = selectedImage.getSequence().getKey(); |
| 324 | 324 | } |
| 325 | | g.setStroke(new BasicStroke(this == Main.map.mapView.getActiveLayer() ? 3 : 2)); |
| | 325 | g.setStroke(new BasicStroke(this == Main.getLayerManager().getActiveLayer() ? 3 : 2)); |
| 326 | 326 | for (MapillarySequence seq : getData().getSequences()) { |
| 327 | 327 | if (selectedImageKey != null && selectedImageKey.equals(seq.getKey())) { |
| 328 | 328 | g.setColor(Color.MAGENTA.brighter()); |
-
diff --git a/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java b/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
index e957b1d..add64d0 100644
|
a
|
b
|
public class MapillaryDownloadAction extends JosmAction {
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | // Successive calls to this action toggle the active layer between the OSM data layer and the mapillary layer |
| 50 | | Main.map.mapView.setActiveLayer( |
| 51 | | Main.map.mapView.getActiveLayer() == MapillaryLayer.getInstance() |
| 52 | | ? Main.map.mapView.getEditLayer() |
| | 50 | Main.getLayerManager().setActiveLayer( |
| | 51 | Main.getLayerManager().getActiveLayer() == MapillaryLayer.getInstance() |
| | 52 | ? Main.getLayerManager().getEditLayer() |
| 53 | 53 | : MapillaryLayer.getInstance() |
| 54 | 54 | ); |
| 55 | 55 | } |
-
diff --git a/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java b/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
index 06a8a5a..b3b22ee 100644
|
a
|
b
|
public final class MapillaryDownloader {
|
| 151 | 151 | */ |
| 152 | 152 | public static void automaticDownload() { |
| 153 | 153 | MapillaryLayer layer = MapillaryLayer.getInstance(); |
| 154 | | if (Main.map.mapView.getEditLayer() == null) |
| | 154 | if (Main.getLayerManager().getEditLayer() == null) |
| 155 | 155 | return; |
| 156 | 156 | if (isAreaTooBig()) { |
| 157 | 157 | tooBigErrorDialog(); |
| … |
… |
public final class MapillaryDownloader {
|
| 159 | 159 | } |
| 160 | 160 | if (getMode() != MODES.Automatic) |
| 161 | 161 | throw new IllegalStateException("Must be in automatic mode."); |
| 162 | | for (Bounds bounds : Main.map.mapView.getEditLayer().data |
| | 162 | for (Bounds bounds : Main.getLayerManager().getEditLayer().data |
| 163 | 163 | .getDataSourceBounds()) { |
| 164 | 164 | if (!layer.getData().getBounds().contains(bounds)) { |
| 165 | 165 | layer.getData().getBounds().add(bounds); |
| … |
… |
public final class MapillaryDownloader {
|
| 176 | 176 | */ |
| 177 | 177 | private static boolean isAreaTooBig() { |
| 178 | 178 | double area = 0; |
| 179 | | for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) { |
| | 179 | for (Bounds bounds : Main.getLayerManager().getEditLayer().data.getDataSourceBounds()) { |
| 180 | 180 | area += bounds.getArea(); |
| 181 | 181 | } |
| 182 | 182 | return area > MAX_AREA; |
-
diff --git a/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java b/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java
index 0ede5ef..ae672fb 100644
|
a
|
b
|
public class JoinMode extends AbstractMode {
|
| 70 | 70 | @Override |
| 71 | 71 | public void mouseMoved(MouseEvent e) { |
| 72 | 72 | this.lastPos = e; |
| 73 | | if (!(Main.map.mapView.getActiveLayer() instanceof MapillaryLayer)) |
| | 73 | if (!(Main.getLayerManager().getActiveLayer() instanceof MapillaryLayer)) |
| 74 | 74 | return; |
| 75 | 75 | MapillaryAbstractImage closestTemp = getClosest(e.getPoint()); |
| 76 | 76 | this.data.setHighlightedImage(closestTemp); |
-
diff --git a/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java b/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
index 8c9edd9..64285cb 100644
|
a
|
b
|
public class SelectMode extends AbstractMode {
|
| 51 | 51 | if (e.getButton() != MouseEvent.BUTTON1) |
| 52 | 52 | return; |
| 53 | 53 | MapillaryAbstractImage closest = getClosest(e.getPoint()); |
| 54 | | if (!(Main.map.mapView.getActiveLayer() instanceof MapillaryLayer) |
| | 54 | if (!(Main.getLayerManager().getActiveLayer() instanceof MapillaryLayer) |
| 55 | 55 | && closest != null && Main.map.mapMode == Main.map.mapModeSelect) { |
| 56 | 56 | this.lastClicked = this.closest; |
| 57 | 57 | this.data.setSelectedImage(closest); |
| 58 | 58 | return; |
| 59 | | } else if (Main.map.mapView.getActiveLayer() != MapillaryLayer |
| | 59 | } else if (Main.getLayerManager().getActiveLayer() != MapillaryLayer |
| 60 | 60 | .getInstance()) |
| 61 | 61 | return; |
| 62 | 62 | // Double click |
| … |
… |
public class SelectMode extends AbstractMode {
|
| 97 | 97 | |
| 98 | 98 | @Override |
| 99 | 99 | public void mouseDragged(MouseEvent e) { |
| 100 | | if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) { |
| | 100 | if (Main.getLayerManager().getActiveLayer() != MapillaryLayer.getInstance()) { |
| 101 | 101 | return; |
| 102 | 102 | } |
| 103 | 103 | |
| … |
… |
public class SelectMode extends AbstractMode {
|
| 155 | 155 | */ |
| 156 | 156 | @Override |
| 157 | 157 | public void mouseMoved(MouseEvent e) { |
| 158 | | if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer |
| | 158 | if (Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer |
| 159 | 159 | && Main.map.mapMode != Main.map.mapModeSelect) { |
| 160 | 160 | return; |
| 161 | 161 | } |
| … |
… |
public class SelectMode extends AbstractMode {
|
| 166 | 166 | MapillaryAbstractImage closestTemp = getClosest(e.getPoint()); |
| 167 | 167 | |
| 168 | 168 | if (closestTemp != null |
| 169 | | && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer |
| | 169 | && Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer |
| 170 | 170 | && !this.imageHighlighted) { |
| 171 | 171 | Main.map.mapMode.putValue("active", Boolean.FALSE); |
| 172 | 172 | this.imageHighlighted = true; |
| 173 | 173 | |
| 174 | 174 | } else if (closestTemp == null |
| 175 | | && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer |
| | 175 | && Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer |
| 176 | 176 | && this.imageHighlighted && this.nothingHighlighted) { |
| 177 | 177 | this.nothingHighlighted = false; |
| 178 | 178 | Main.map.mapMode.putValue("active", Boolean.TRUE); |
| 179 | 179 | |
| 180 | 180 | } else if (this.imageHighlighted && !this.nothingHighlighted |
| 181 | | && Main.map.mapView.getEditLayer().data != null |
| 182 | | && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) { |
| | 181 | && Main.getLayerManager().getEditLayer().data != null |
| | 182 | && Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer) { |
| 183 | 183 | |
| 184 | | for (OsmPrimitive primivitive : Main.map.mapView.getEditLayer().data |
| | 184 | for (OsmPrimitive primivitive : Main.getLayerManager().getEditLayer().data |
| 185 | 185 | .allPrimitives()) { |
| 186 | 186 | primivitive.setHighlighted(false); |
| 187 | 187 | } |
-
diff --git a/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java b/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
index be5afb7..0db4910 100644
|
a
|
b
|
public class MeasurementLayer extends Layer {
|
| 233 | 233 | public void actionPerformed(ActionEvent e) { |
| 234 | 234 | Box panel = Box.createVerticalBox(); |
| 235 | 235 | final JList<GpxLayer> layerList = new JList<>(model); |
| 236 | | Collection<Layer> data = Main.map.mapView.getAllLayers(); |
| | 236 | Collection<Layer> data = Main.getLayerManager().getLayers(); |
| 237 | 237 | Layer lastLayer = null; |
| 238 | 238 | int layerCnt = 0; |
| 239 | 239 | |
-
diff --git a/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java b/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java
index 6a27cd6..4a6d5f2 100644
|
a
|
b
|
public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeLis
|
| 91 | 91 | DataSet dataSet = new DataSet(); |
| 92 | 92 | final OdOsmDataLayer layer = new OdOsmDataLayer(this, dataSet, getName()+"/OSM"); |
| 93 | 93 | addOsmLayer(layer); |
| 94 | | Main.map.mapView.setActiveLayer(osmLayer); |
| | 94 | Main.getLayerManager().setActiveLayer(osmLayer); |
| 95 | 95 | if (oapiReq != null) { |
| 96 | 96 | OsmDownloader.downloadOapi(oapiReq); |
| 97 | 97 | // Overpass API does not allow to exclude tags :( |
| … |
… |
public class OdDataLayer extends OsmDataLayer implements OdLayer, LayerChangeLis
|
| 173 | 173 | public void makeDiff() { |
| 174 | 174 | final OdDiffLayer layer = new OdDiffLayer(this, getName()+"/Diff"); |
| 175 | 175 | addDiffLayer(layer); |
| 176 | | Main.map.mapView.setActiveLayer(diffLayer); |
| | 176 | Main.getLayerManager().setActiveLayer(diffLayer); |
| 177 | 177 | } |
| 178 | 178 | } |
-
diff --git a/photoadjust/src/org/openstreetmap/josm/plugins/photoadjust/PhotoAdjustMapMode.java b/photoadjust/src/org/openstreetmap/josm/plugins/photoadjust/PhotoAdjustMapMode.java
index 69b2697..aa0fcd5 100644
|
a
|
b
|
public class PhotoAdjustMapMode extends MapMode implements LayerChangeListener {
|
| 132 | 132 | // Activate the mode only if the current layer is not a |
| 133 | 133 | // GeoImageLayer. GeoImageLayer's are handled by the plug-in |
| 134 | 134 | // directly. |
| 135 | | if (! (Main.map.mapView.getActiveLayer() instanceof GeoImageLayer)) { |
| | 135 | if (! (Main.getLayerManager().getActiveLayer() instanceof GeoImageLayer)) { |
| 136 | 136 | activateMode(); |
| 137 | 137 | } |
| 138 | 138 | } |
| … |
… |
public class PhotoAdjustMapMode extends MapMode implements LayerChangeListener {
|
| 207 | 207 | */ |
| 208 | 208 | private boolean hasLayersToAdjust() { |
| 209 | 209 | if (Main.map == null || Main.map.mapView == null) return false; |
| 210 | | return ! Main.map.mapView.getLayersOfType(GeoImageLayer.class).isEmpty(); |
| | 210 | return ! Main.getLayerManager().getLayersOfType(GeoImageLayer.class).isEmpty(); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| … |
… |
public class PhotoAdjustMapMode extends MapMode implements LayerChangeListener {
|
| 216 | 216 | * @return list of visible GeoImageLayer's |
| 217 | 217 | */ |
| 218 | 218 | private List<GeoImageLayer> getVisibleGeoImageLayers() { |
| 219 | | List<GeoImageLayer> all = new ArrayList<>(Main.map.mapView.getLayersOfType(GeoImageLayer.class)); |
| | 219 | List<GeoImageLayer> all = new ArrayList<>(Main.getLayerManager().getLayersOfType(GeoImageLayer.class)); |
| 220 | 220 | Iterator<GeoImageLayer> it = all.iterator(); |
| 221 | 221 | while (it.hasNext()) { |
| 222 | 222 | if (!it.next().isVisible()) it.remove(); |
-
diff --git a/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java b/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
index 11ee943..40648e4 100644
|
a
|
b
|
public class PicLayerPlugin extends Plugin implements LayerChangeListener {
|
| 158 | 158 | new SavePictureCalibrationAction((PicLayerAbstract) arg0).actionPerformed(null); |
| 159 | 159 | } |
| 160 | 160 | // Why should I do all these checks now? |
| 161 | | boolean enable = Main.map != null && Main.map.mapView != null && Main.map.mapView.getAllLayers() != null && Main.map.mapView.getAllLayers().size() != 0; |
| | 161 | boolean enable = Main.map != null && Main.map.mapView != null && Main.getLayerManager().getLayers() != null && Main.getLayerManager().getLayers().size() != 0; |
| 162 | 162 | newLayerFromFileAction.setEnabled(enable); |
| 163 | 163 | newLayerFromClipboardAction.setEnabled(enable); |
| 164 | 164 | } |
-
diff --git a/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java b/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java
index 22a08e2..7fa86d4 100644
|
a
|
b
|
public abstract class GenericPicTransformAction extends MapMode implements Mouse
|
| 56 | 56 | @Override |
| 57 | 57 | public void mousePressed(MouseEvent e) { |
| 58 | 58 | // Start action |
| 59 | | if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) { |
| 60 | | currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer(); |
| | 59 | if ( Main.getLayerManager().getActiveLayer() instanceof PicLayerAbstract ) { |
| | 60 | currentLayer = (PicLayerAbstract)Main.getLayerManager().getActiveLayer(); |
| 61 | 61 | |
| 62 | 62 | if ( currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) { |
| 63 | 63 | requestFocusInMapView(); |
| … |
… |
public abstract class GenericPicTransformAction extends MapMode implements Mouse
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | protected void updateDrawPoints(boolean value) { |
| 101 | | Layer active = Main.map.mapView.getActiveLayer(); |
| | 101 | Layer active = Main.getLayerManager().getActiveLayer(); |
| 102 | 102 | if (active instanceof PicLayerAbstract) { |
| 103 | 103 | ((PicLayerAbstract)active).setDrawPoints(value); |
| 104 | 104 | } |
-
diff --git a/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java b/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java
index 0b94f8f..783af67 100644
|
a
|
b
|
public class NewLayerFromFileAction extends JosmAction {
|
| 118 | 118 | // The first loaded layer will be placed at the top of any other layer of the same class, |
| 119 | 119 | // or at the bottom of the stack if there is no such layer yet |
| 120 | 120 | // The next layers we load will be placed one after the other after this first layer |
| 121 | | int newLayerPos = Main.map.mapView.getAllLayers().size(); |
| 122 | | for(Layer l : Main.map.mapView.getLayersOfType(PicLayerAbstract.class)) { |
| | 121 | int newLayerPos = Main.getLayerManager().getLayers().size(); |
| | 122 | for(Layer l : Main.getLayerManager().getLayersOfType(PicLayerAbstract.class)) { |
| 123 | 123 | int pos = Main.map.mapView.getLayerPos(l); |
| 124 | 124 | if (pos < newLayerPos) newLayerPos = pos; |
| 125 | 125 | } |
-
diff --git a/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/RasterFiltersPlugin.java b/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/RasterFiltersPlugin.java
index 0f65426..3a2a23f 100644
|
a
|
b
|
public class RasterFiltersPlugin extends Plugin implements LayerChangeListener {
|
| 118 | 118 | action.removeFiltersDialog(dialog); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | | if (Main.map.mapView.getAllLayersAsList().size() == 0) { |
| | 121 | if (Main.getLayerManager().getLayers().size() == 0) { |
| 122 | 122 | |
| 123 | 123 | Container container = filterButton.getParent(); |
| 124 | 124 | if (container != null) |
-
diff --git a/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/actions/ShowLayerFiltersDialog.java b/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/actions/ShowLayerFiltersDialog.java
index 5cc303a..fe91082 100644
|
a
|
b
|
public final class ShowLayerFiltersDialog extends AbstractAction implements Laye
|
| 50 | 50 | @Override |
| 51 | 51 | public void actionPerformed(ActionEvent e) { |
| 52 | 52 | |
| 53 | | Layer layer = Main.map.mapView.getActiveLayer(); |
| | 53 | Layer layer = Main.getLayerManager().getActiveLayer(); |
| 54 | 54 | |
| 55 | 55 | if (layer instanceof ImageryLayer) { |
| 56 | 56 | for (FiltersDialog temp : dialogs) { |
-
diff --git a/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/model/FiltersManager.java b/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/model/FiltersManager.java
index b8c083e..10aa05a 100644
|
a
|
b
|
ActionListener, ItemListener {
|
| 130 | 130 | fp.setPreferredSize(new Dimension(300, fp.getNeededHeight())); |
| 131 | 131 | |
| 132 | 132 | filter.changeFilterState(filterState.encodeJson()); |
| 133 | | Main.map.mapView.getActiveLayer().setFilterStateChanged(); |
| | 133 | Main.getLayerManager().getActiveLayer().setFilterStateChanged(); |
| 134 | 134 | |
| 135 | 135 | fp.createBottomPanel(this); |
| 136 | 136 | |
| … |
… |
ActionListener, ItemListener {
|
| 154 | 154 | if (filtersMap.get(filterId) != null) |
| 155 | 155 | filtersMap.get(filterId).changeFilterState(filterState.encodeJson()); |
| 156 | 156 | |
| 157 | | if (Main.map.mapView.getActiveLayer() != null) { |
| 158 | | Main.map.mapView.getActiveLayer().setFilterStateChanged(); |
| | 157 | if (Main.getLayerManager().getActiveLayer() != null) { |
| | 158 | Main.getLayerManager().getActiveLayer().setFilterStateChanged(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | } |
| … |
… |
ActionListener, ItemListener {
|
| 238 | 238 | dialog.getAddButton().setEnabled(true); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | | Main.map.mapView.getActiveLayer().setFilterStateChanged(); |
| | 241 | Main.getLayerManager().getActiveLayer().setFilterStateChanged(); |
| 242 | 242 | |
| 243 | 243 | } |
| 244 | 244 | |
| … |
… |
ActionListener, ItemListener {
|
| 254 | 254 | UID filterId = filterPanel.getFilterId(); |
| 255 | 255 | disabledFilters.add(filtersMap.get(filterId)); |
| 256 | 256 | |
| 257 | | Main.map.mapView.getActiveLayer().setFilterStateChanged(); |
| | 257 | Main.getLayerManager().getActiveLayer().setFilterStateChanged(); |
| 258 | 258 | |
| 259 | 259 | } else { |
| 260 | 260 | |
| 261 | 261 | UID filterId = filterPanel.getFilterId(); |
| 262 | 262 | disabledFilters.remove(filtersMap.get(filterId)); |
| 263 | 263 | |
| 264 | | Main.map.mapView.getActiveLayer().setFilterStateChanged(); |
| | 264 | Main.getLayerManager().getActiveLayer().setFilterStateChanged(); |
| 265 | 265 | |
| 266 | 266 | } |
| 267 | 267 | } |
-
diff --git a/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java b/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java
index 83f8c27..ffac4fa 100644
|
a
|
b
|
public class RoutesPlugin extends Plugin implements LayerChangeListener {
|
| 78 | 78 | |
| 79 | 79 | private void checkLayers() { |
| 80 | 80 | if (Main.map != null && Main.map.mapView != null) { |
| 81 | | for (Layer layer:Main.map.mapView.getAllLayers()) { |
| | 81 | for (Layer layer:Main.getLayerManager().getLayers()) { |
| 82 | 82 | if (layer instanceof OsmDataLayer) { |
| 83 | 83 | if (!isShown) { |
| 84 | 84 | isShown = true; |
-
diff --git a/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java b/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java
index f0ac693..fba2b2d 100644
|
a
|
b
|
public class RoutingGraph {
|
| 349 | 349 | List<OsmEdge> path = new ArrayList<>(); |
| 350 | 350 | Graph<Node,OsmEdge> g; |
| 351 | 351 | double totalWeight = 0; |
| 352 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 352 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 353 | 353 | RoutingModel routingModel = layer.getRoutingModel(); |
| 354 | 354 | |
| 355 | 355 | if (graph == null || routingModel.getOnewayChanged()) |
-
diff --git a/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java b/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java
index ccb59d6..acdb4b5 100644
|
a
|
b
|
public class AddRouteNodeAction extends MapMode {
|
| 82 | 82 | if (e.getButton() == MouseEvent.BUTTON1) { |
| 83 | 83 | // Search for nearest highway node |
| 84 | 84 | Node node = null; |
| 85 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 86 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 85 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 86 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 87 | 87 | node = layer.getNearestHighwayNode(e.getPoint()); |
| 88 | 88 | if(node == null) { |
| 89 | 89 | logger.debug("no selected node"); |
-
diff --git a/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java b/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java
index 10a8d12..55aabd6 100644
|
a
|
b
|
public class MoveRouteNodeAction extends MapMode {
|
| 95 | 95 | @Override public void mousePressed(MouseEvent e) { |
| 96 | 96 | // If left button is pressed |
| 97 | 97 | if (e.getButton() == MouseEvent.BUTTON1) { |
| 98 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| | 98 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| 99 | 99 | requestFocusInMapView(); |
| 100 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 100 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 101 | 101 | RoutingModel routingModel = layer.getRoutingModel(); |
| 102 | 102 | // Search for the nearest node in the list |
| 103 | 103 | List<Node> nl = routingModel.getSelectedNodes(); |
| … |
… |
public class MoveRouteNodeAction extends MapMode {
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | private void searchAndReplaceNode(Point point) { |
| 131 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 132 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 131 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 132 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 133 | 133 | RoutingModel routingModel = layer.getRoutingModel(); |
| 134 | 134 | RoutingDialog routingDialog = RoutingPlugin.getInstance().getRoutingDialog(); |
| 135 | 135 | // Search for nearest highway node |
-
diff --git a/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java b/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java
index 0b4193a..50bb001 100644
|
a
|
b
|
public class RemoveRouteNodeAction extends MapMode {
|
| 83 | 83 | @Override public void mouseClicked(MouseEvent e) { |
| 84 | 84 | // If left button is clicked |
| 85 | 85 | if (e.getButton() == MouseEvent.BUTTON1) { |
| 86 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 87 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 86 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 87 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 88 | 88 | RoutingModel routingModel = layer.getRoutingModel(); |
| 89 | 89 | // Search for the nearest node in the list |
| 90 | 90 | List<Node> nl = routingModel.getSelectedNodes(); |
-
diff --git a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java
index 792d0b4..2782823 100644
|
a
|
b
|
public class RoutingDialog extends ToggleDialog {
|
| 130 | 130 | |
| 131 | 131 | public void refresh() { |
| 132 | 132 | clearNodes(); |
| 133 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 134 | | RoutingLayer routingLayer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 133 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 134 | RoutingLayer routingLayer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 135 | 135 | RoutingModel routingModel = routingLayer.getRoutingModel(); |
| 136 | 136 | for (Node n : routingModel.getSelectedNodes()) { |
| 137 | 137 | addNode(n); |
-
diff --git a/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java b/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java
index c4c24f7..9bd84cd 100644
|
a
|
b
|
public class RoutingMenu extends JMenu {
|
| 92 | 92 | rshorter.setSelected(true); |
| 93 | 93 | rshorter.addItemListener(new ItemListener() { |
| 94 | 94 | public void itemStateChanged(ItemEvent e) { |
| 95 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 96 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 95 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 96 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 97 | 97 | RoutingModel routingModel = layer.getRoutingModel(); |
| 98 | 98 | if (e.getStateChange()==ItemEvent.SELECTED) { |
| 99 | 99 | routingModel.routingGraph.setTypeRoute(RouteType.SHORTEST); |
| … |
… |
public class RoutingMenu extends JMenu {
|
| 121 | 121 | JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(tr("Ignore oneways")); |
| 122 | 122 | cbmi.addItemListener(new ItemListener() { |
| 123 | 123 | public void itemStateChanged(ItemEvent e) { |
| 124 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 125 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 124 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 125 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 126 | 126 | RoutingModel routingModel = layer.getRoutingModel(); |
| 127 | 127 | if (e.getStateChange()==ItemEvent.SELECTED) |
| 128 | 128 | routingModel.routingGraph.getRoutingProfile().setOnewayUse(false); |
| … |
… |
public class RoutingMenu extends JMenu {
|
| 141 | 141 | reverseMI = new JMenuItem(tr("Reverse route")); |
| 142 | 142 | reverseMI.addActionListener(new ActionListener() { |
| 143 | 143 | public void actionPerformed(ActionEvent e) { |
| 144 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 145 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 144 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 145 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 146 | 146 | RoutingModel routingModel = layer.getRoutingModel(); |
| 147 | 147 | routingModel.reverseNodes(); |
| 148 | 148 | Main.map.repaint(); |
| … |
… |
public class RoutingMenu extends JMenu {
|
| 154 | 154 | clearMI = new JMenuItem(tr("Clear route")); |
| 155 | 155 | clearMI.addActionListener(new ActionListener() { |
| 156 | 156 | public void actionPerformed(ActionEvent e) { |
| 157 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 158 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 157 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 158 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 159 | 159 | RoutingModel routingModel = layer.getRoutingModel(); |
| 160 | 160 | // Reset routing nodes and paths |
| 161 | 161 | routingModel.reset(); |
| … |
… |
public class RoutingMenu extends JMenu {
|
| 170 | 170 | regraphMI.addActionListener(new ActionListener() { |
| 171 | 171 | public void actionPerformed(ActionEvent e) { |
| 172 | 172 | |
| 173 | | if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { |
| 174 | | RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); |
| | 173 | if (Main.getLayerManager().getActiveLayer() instanceof RoutingLayer) { |
| | 174 | RoutingLayer layer = (RoutingLayer)Main.getLayerManager().getActiveLayer(); |
| 175 | 175 | RoutingModel routingModel = layer.getRoutingModel(); |
| 176 | 176 | routingModel.routingGraph.resetGraph(); |
| 177 | 177 | routingModel.routingGraph.createGraph(); |
-
diff --git a/sds/src/org/openstreetmap/hot/sds/SdsMenu.java b/sds/src/org/openstreetmap/hot/sds/SdsMenu.java
index c6cadca..5654b23 100644
|
a
|
b
|
public class SdsMenu extends JMenu implements LayerChangeListener {
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | void setEnabledState() { |
| 57 | | boolean en = (Main.map != null) && (Main.map.mapView != null) && (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer); |
| | 57 | boolean en = (Main.map != null) && (Main.map.mapView != null) && (Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer); |
| 58 | 58 | loadItem.setEnabled(en); |
| 59 | 59 | saveItem.setEnabled(en); |
| 60 | 60 | } |
-
diff --git a/sds/src/org/openstreetmap/hot/sds/SdsSaveAction.java b/sds/src/org/openstreetmap/hot/sds/SdsSaveAction.java
index 5ece685..f2691b3 100644
|
a
|
b
|
public class SdsSaveAction extends SdsDiskAccessAction {
|
| 36 | 36 | |
| 37 | 37 | public boolean doSave() { |
| 38 | 38 | Layer layer = null; |
| 39 | | if (Main.isDisplayingMapView() && (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer)) |
| 40 | | layer = Main.map.mapView.getActiveLayer(); |
| | 39 | if (Main.isDisplayingMapView() && (Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) |
| | 40 | layer = Main.getLayerManager().getActiveLayer(); |
| 41 | 41 | |
| 42 | 42 | if (layer == null) |
| 43 | 43 | return false; |
-
diff --git a/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java b/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java
index 832a140..ec2eda4 100644
|
a
|
b
|
public class SetWaypointAction extends AbstractSurveyorAction {
|
| 124 | 124 | */ |
| 125 | 125 | public GpxLayer getGpxLayer() { |
| 126 | 126 | if(liveGpsLayer == null) { |
| 127 | | Collection<Layer> layers = Main.map.mapView.getAllLayers(); |
| | 127 | Collection<Layer> layers = Main.getLayerManager().getLayers(); |
| 128 | 128 | for (Layer layer : layers) { |
| 129 | 129 | if(layer instanceof LiveGpsLayer) { |
| 130 | 130 | liveGpsLayer = (LiveGpsLayer) layer; |
-
diff --git a/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java b/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java
index 3277b97..63e22e4 100644
|
a
|
b
|
public class LayerUtil {
|
| 23 | 23 | public static <LayerType extends Layer> LayerType findGpsLayer(String layerName, Class<LayerType> layerType) { |
| 24 | 24 | Layer result = null; |
| 25 | 25 | if(Main.map != null && Main.map.mapView != null) { |
| 26 | | for(Layer layer : Main.map.mapView.getAllLayers()) { |
| | 26 | for(Layer layer : Main.getLayerManager().getLayers()) { |
| 27 | 27 | if(layerName.equals(layer.getName()) && layerType.isAssignableFrom(layer.getClass())) { |
| 28 | 28 | result = layer; |
| 29 | 29 | break; |
-
diff --git a/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java b/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java
index 264d923..617d4d6 100644
|
a
|
b
|
public class TurnRestrictionEditor extends JDialog implements NavigationControle
|
| 818 | 818 | |
| 819 | 819 | public void actionPerformed(ActionEvent e) { |
| 820 | 820 | if (Main.main.getActiveLayer() != getLayer()){ |
| 821 | | Main.map.mapView.setActiveLayer(getLayer()); |
| | 821 | Main.getLayerManager().setActiveLayer(getLayer()); |
| 822 | 822 | } |
| 823 | 823 | Relation tr = getTurnRestriction(); |
| 824 | 824 | if (tr == null || tr.getDataSet() == null) return; |
-
diff --git a/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/Engine.java b/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/Engine.java
index f33a04b..7889d6c 100644
|
a
|
b
|
class Engine {
|
| 17 | 17 | List<Marker> returnList = new ArrayList<>(); |
| 18 | 18 | if (gpxLayersExist()) { |
| 19 | 19 | //Loop over marker (waypoint) layers.. it could be more than one |
| 20 | | for (Iterator<MarkerLayer> it = Main.map.mapView.getLayersOfType(MarkerLayer.class).iterator(); it.hasNext();) { |
| | 20 | for (Iterator<MarkerLayer> it = Main.getLayerManager().getLayersOfType(MarkerLayer.class).iterator(); it.hasNext();) { |
| 21 | 21 | //loop over each marker (waypoint) |
| 22 | 22 | for (Iterator<Marker> markerIterator = it.next().data.iterator(); markerIterator.hasNext();) { |
| 23 | 23 | Marker marker = markerIterator.next(); |
| … |
… |
class Engine {
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | static boolean gpxLayersExist() { |
| 34 | | return Main.map != null && Main.map.mapView.hasLayers() && !Main.map.mapView.getLayersOfType(MarkerLayer.class).isEmpty(); |
| | 34 | return Main.map != null && Main.getLayerManager().containsLayers() && !Main.getLayerManager().getLayersOfType(MarkerLayer.class).isEmpty(); |
| 35 | 35 | } |
| 36 | 36 | } |