Changeset 32500 in osm for applications/editors/josm/plugins/splinex/src/org
- Timestamp:
- 2016-07-01T20:10:34+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/DrawSplineAction.java
r32013 r32500 30 30 import org.openstreetmap.josm.gui.MapFrame; 31 31 import org.openstreetmap.josm.gui.MapView; 32 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;33 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; 34 39 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 35 40 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 43 48 @SuppressWarnings("serial") 44 49 public class DrawSplineAction extends MapMode implements MapViewPaintable, KeyPressReleaseListener, ModifierListener, 45 LayerChangeListener {50 LayerChangeListener, ActiveLayerChangeListener { 46 51 private final Cursor cursorJoinNode; 47 52 private final Cursor cursorJoinWay; … … 65 70 cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode"); 66 71 cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway"); 67 MapView.addLayerChangeListener(this); 72 Main.getLayerManager().addLayerChangeListener(this); 73 Main.getLayerManager().addActiveLayerChangeListener(this); 68 74 readPreferences(); 69 75 } … … 387 393 @Override 388 394 protected void updateEnabledState() { 389 setEnabled(get EditLayer() != null);395 setEnabled(getLayerManager().getEditLayer() != null); 390 396 } 391 397 … … 402 408 if (splCached != null) 403 409 return splCached; 404 Layer l = Main.main.getEditLayer();410 Layer l = getLayerManager().getEditLayer(); 405 411 if (!(l instanceof OsmDataLayer)) 406 412 return null; … … 413 419 414 420 @Override 415 public void active LayerChange(Layer oldLayer, Layer newLayer) {416 splCached = layerSplines.get( newLayer);421 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 422 splCached = layerSplines.get(Main.getLayerManager().getActiveLayer()); 417 423 } 418 424 … … 420 426 421 427 @Override 422 public void layerAdded(Layer newLayer) { 423 } 424 425 @Override 426 public void layerRemoved(Layer oldLayer) { 427 layerSplines.remove(oldLayer); 428 public void layerOrderChanged(LayerOrderChangeEvent e) { 429 // Do nothing 430 } 431 432 @Override 433 public void layerAdded(LayerAddEvent e) { 434 // Do nothing 435 } 436 437 @Override 438 public void layerRemoving(LayerRemoveEvent e) { 439 layerSplines.remove(e.getRemovedLayer()); 428 440 splCached = null; 429 441 } … … 434 446 Spline spl = ph.getSpline(); 435 447 if (spl.nodeCount() == 3 && spl.isClosed() && ph.idx == 1) 436 return; // Don't allow to delete node when it results with 437 // two-node closed spline 448 return; // Don't allow to delete node when it results with two-node closed spline 438 449 Main.main.undoRedo.add(spl.new DeleteSplineNodeCommand(ph.idx)); 439 450 e.consume(); … … 448 459 @Override 449 460 public void doKeyReleased(KeyEvent e) { 450 // TODO Auto-generated method stub 451 461 // Do nothing 452 462 } 453 463 }
Note:
See TracChangeset
for help on using the changeset viewer.