source: josm/trunk/src/org/openstreetmap/josm/actions/LassoModeAction.java@ 14273

Last change on this file since 14273 was 12630, checked in by Don-vip, 7 years ago

see #15182 - deprecate Main.map and Main.isDisplayingMapView(). Replacements: gui.MainApplication.getMap() / gui.MainApplication.isDisplayingMapView()

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.actions.mapmode.MapMode;
7import org.openstreetmap.josm.gui.MainApplication;
8import org.openstreetmap.josm.gui.MapFrame;
9import org.openstreetmap.josm.gui.layer.Layer;
10import org.openstreetmap.josm.tools.ImageProvider;
11
12/**
13 * Lasso selection mode: select objects within a hand-drawn region.
14 * @since 5152
15 */
16public class LassoModeAction extends MapMode {
17
18 /**
19 * Constructs a new {@code LassoModeAction}.
20 */
21 public LassoModeAction() {
22 super(tr("Lasso Mode"),
23 /* ICON(mapmode/) */ "rope",
24 tr("Lasso selection mode: select objects within a hand-drawn region"),
25 ImageProvider.getCursor("normal", "rope"));
26 }
27
28 @Override
29 public void enterMode() {
30 if (MainApplication.isDisplayingMapView()) {
31 MapFrame map = MainApplication.getMap();
32 map.mapModeSelect.setLassoMode(true);
33 map.mapModeSelect.enterMode();
34 }
35 super.enterMode();
36 }
37
38 @Override
39 public void exitMode() {
40 if (MainApplication.isDisplayingMapView()) {
41 MapFrame map = MainApplication.getMap();
42 map.mapModeSelect.setLassoMode(false);
43 map.mapModeSelect.exitMode();
44 }
45 super.exitMode();
46 }
47
48 @Override
49 public boolean layerIsSupported(Layer l) {
50 return MainApplication.getMap().mapModeSelect.layerIsSupported(l);
51 }
52}
Note: See TracBrowser for help on using the repository browser.