Changeset 32443 in osm for applications/editors/josm/plugins/ElevationProfile/src/org
- Timestamp:
- 2016-06-29T21:05:34+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfilePlugin.java
r32315 r32443 65 65 if(currentLayer == null){ 66 66 currentLayer = new ElevationProfileLayer(tr("Elevation Profile")); 67 Main. main.addLayer(currentLayer);67 Main.getLayerManager().addLayer(currentLayer); 68 68 } 69 69 return currentLayer; -
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/actions/AddElevationLayerAction.java
r32315 r32443 14 14 15 15 /** 16 * 16 * 17 17 */ 18 18 private static final long serialVersionUID = -745642875640041385L; … … 27 27 if (currentLayer == null) { 28 28 currentLayer = new ElevationGridLayer(tr("Elevation Grid")); // TODO: Better name 29 Main. main.addLayer(currentLayer);29 Main.getLayerManager().addLayer(currentLayer); 30 30 } 31 31 } -
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java
r32329 r32443 28 28 import org.openstreetmap.josm.data.SystemOfMeasurement; 29 29 import org.openstreetmap.josm.data.gpx.GpxData; 30 import org.openstreetmap.josm.gui.MapView;31 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;32 30 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 33 31 import org.openstreetmap.josm.gui.layer.GpxLayer; 34 32 import org.openstreetmap.josm.gui.layer.Layer; 33 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 34 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; 35 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 36 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 37 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 38 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 35 39 import org.openstreetmap.josm.plugins.elevation.ElevationHelper; 36 40 import org.openstreetmap.josm.plugins.elevation.IElevationModel; … … 45 49 * connection between layer and elevation profile. 46 50 */ 47 public class ElevationProfileDialog extends ToggleDialog implements LayerChangeListener, ComponentListener {51 public class ElevationProfileDialog extends ToggleDialog implements LayerChangeListener, ActiveLayerChangeListener, ComponentListener { 48 52 49 53 private static final String EMPTY_DATA_STRING = "-"; … … 194 198 @Override 195 199 public void showNotify() { 196 MapView.addLayerChangeListener(this); 200 Main.getLayerManager().addLayerChangeListener(this); 201 Main.getLayerManager().addActiveLayerChangeListener(this); 197 202 if (Main.isDisplayingMapView()) { 198 203 Layer layer = Main.getLayerManager().getActiveLayer(); … … 205 210 @Override 206 211 public void hideNotify() { 207 MapView.removeLayerChangeListener(this); 212 Main.getLayerManager().removeActiveLayerChangeListener(this); 213 Main.getLayerManager().removeLayerChangeListener(this); 208 214 } 209 215 … … 348 354 349 355 @Override 350 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 356 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 357 Layer newLayer = Main.getLayerManager().getActiveLayer(); 351 358 if (newLayer instanceof GpxLayer) { 352 359 setActiveLayer((GpxLayer) newLayer); … … 366 373 } 367 374 368 ElevationModel em = layerMap.get(newLayer);369 setModel(em);370 371 } 372 373 @Override374 public void layerAdded(Layer newLayer) {375 setModel(layerMap.get(newLayer)); 376 } 377 } 378 379 @Override 380 public void layerAdded(LayerAddEvent e) { 381 Layer newLayer = e.getAddedLayer(); 375 382 if (newLayer instanceof GpxLayer) { 376 383 GpxLayer gpxLayer = (GpxLayer) newLayer; … … 380 387 381 388 @Override 382 public void layerRemoved(Layer oldLayer) { 389 public void layerRemoving(LayerRemoveEvent e) { 390 Layer oldLayer = e.getRemovedLayer(); 383 391 if (layerMap.containsKey(oldLayer)) { 384 392 layerMap.remove(oldLayer); … … 394 402 395 403 @Override 404 public void layerOrderChanged(LayerOrderChangeEvent e) { 405 } 406 407 @Override 396 408 public void componentHidden(ComponentEvent e) { 397 409 }
Note:
See TracChangeset
for help on using the changeset viewer.