Changeset 32365 in osm for applications/editors/josm/plugins
- Timestamp:
- 2016-06-23T00:20:45+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r32329 r32365 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.mapillary; 3 4 import static org.openstreetmap.josm.tools.I18n.marktr;5 import static org.openstreetmap.josm.tools.I18n.tr;6 3 7 4 import java.awt.AlphaComposite; … … 43 40 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 44 41 import org.openstreetmap.josm.gui.MapView; 45 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;46 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;47 42 import org.openstreetmap.josm.gui.NavigatableComponent; 48 43 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 50 45 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 51 46 import org.openstreetmap.josm.gui.layer.Layer; 47 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 48 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 52 49 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 53 50 import org.openstreetmap.josm.plugins.mapillary.cache.CacheUtils; … … 63 60 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 64 61 62 import static org.openstreetmap.josm.tools.I18n.marktr; 63 import static org.openstreetmap.josm.tools.I18n.tr; 64 65 65 /** 66 66 * This class represents the layer shown in JOSM. There can only exist one … … 71 71 */ 72 72 public final class MapillaryLayer extends AbstractModifiableLayer implements 73 DataSetListener, EditLayerChangeListener,LayerChangeListener {73 DataSetListener, ActiveLayerChangeListener { 74 74 75 75 /** Maximum distance for the red/blue lines. */ … … 108 108 if (Main.main != null && Main.map.mapView != null) { 109 109 setMode(new SelectMode()); 110 Main.map.mapView.addLayer(this); 111 MapView.addEditLayerChangeListener(this, false); 112 MapView.addLayerChangeListener(this); 110 Main.getLayerManager().addLayer(this); 111 Main.getLayerManager().addActiveLayerChangeListener(this, false); 113 112 if (Main.getLayerManager().getEditLayer() != null) 114 113 Main.getLayerManager().getEditLayer().data.addDataSetListener(this); … … 222 221 Main.map.mapView.removeMouseListener(this.mode); 223 222 Main.map.mapView.removeMouseMotionListener(this.mode); 224 Ma pView.removeEditLayerChangeListener(this);223 Main.getLayerManager().removeActiveLayerChangeListener(this); 225 224 if (Main.getLayerManager().getEditLayer() != null) 226 225 Main.getLayerManager().getEditLayer().data.removeDataSetListener(this); … … 498 497 499 498 @Override 500 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 501 if (oldLayer == null && newLayer != null) { 502 newLayer.data.addDataSetListener(this); 503 } else if (oldLayer != null && newLayer == null) { 504 oldLayer.data.removeDataSetListener(this); 499 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 500 if (Main.getLayerManager().getActiveLayer() == this) { 501 MapillaryUtils.updateHelpText(); 502 } 503 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getJoinMenu(), Main.getLayerManager().getActiveLayer() == this); 504 505 if (Main.getLayerManager().getEditLayer() != e.getPreviousEditLayer()) { 506 if (Main.getLayerManager().getEditLayer() != null) { 507 Main.getLayerManager().getEditLayer().data.addDataSetListener(this); 508 } 509 if (e.getPreviousEditLayer() != null) { 510 e.getPreviousEditLayer().data.removeDataSetListener(this); 511 } 505 512 } 506 513 } … … 550 557 @Override 551 558 public void visitBoundingBox(BoundingXYVisitor v) { 552 }553 554 @Override555 public void activeLayerChange(Layer oldLayer, Layer newLayer) {556 if (newLayer == this) {557 MapillaryUtils.updateHelpText();558 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getJoinMenu(), true);559 } else560 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getJoinMenu(), false);561 }562 563 @Override564 public void layerAdded(Layer newLayer) {565 // Do nothing, we're only interested in layer change, not addition566 }567 568 @Override569 public void layerRemoved(Layer oldLayer) {570 // Do nothing, we're only interested in layer change, not removal571 559 } 572 560
Note:
See TracChangeset
for help on using the changeset viewer.