Changeset 33258 in osm for applications/editors/josm
- Timestamp:
- 2017-04-17T02:17:09+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/gpsblam/src/org/openstreetmap/josm/plugins/gpsblam
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/gpsblam/src/org/openstreetmap/josm/plugins/gpsblam/GPSBlamMode.java
r33257 r33258 24 24 import org.openstreetmap.josm.Main; 25 25 import org.openstreetmap.josm.actions.mapmode.MapMode; 26 import org.openstreetmap.josm.gui.MapFrame;27 26 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 28 27 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; … … 33 32 34 33 Point pointPressed; 35 MapFrame frame;36 34 private Point oldP2; 37 35 int radius; … … 146 144 147 145 private void xorDrawBox(Point p1, Point p2, int radius){ 148 if ( frame!= null) {149 Graphics2D g = (Graphics2D) Main.map.mapView.getGraphics();146 if (Main.map != null) { 147 Graphics2D g = (Graphics2D) Main.map.mapView.getGraphics(); 150 148 g.setXORMode(Color.BLACK); 151 149 g.setColor(Color.WHITE); … … 188 186 189 187 private void paintBox(Point p2, int newRadius) { 190 if ( frame!= null) {188 if (Main.map != null) { 191 189 if (oldP2 != null) { 192 190 xorDrawBox(pointPressed, oldP2, radius); // clear old box … … 195 193 oldP2 = p2; 196 194 } 197 }198 199 public void setFrame(MapFrame mapFrame) {200 frame = mapFrame;201 195 } 202 196 … … 215 209 if (e.getRemovedLayer() instanceof GPSBlamLayer) { 216 210 currentBlamLayer = null; 217 if (Main.map.mapMode instanceof GPSBlamMode)211 if (Main.map.mapMode instanceof GPSBlamMode) 218 212 Main.map.selectSelectTool(false); 219 213 } -
applications/editors/josm/plugins/gpsblam/src/org/openstreetmap/josm/plugins/gpsblam/GPSBlamPlugin.java
r33257 r33258 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.gui.IconToggleButton; 8 7 import org.openstreetmap.josm.gui.MapFrame; … … 17 16 public class GPSBlamPlugin extends Plugin { 18 17 19 private final IconToggleButton btn;20 private final GPSBlamMode mode;21 22 18 /** 23 19 * Constructs a new {@code GPSBlamPlugin}. … … 26 22 public GPSBlamPlugin(PluginInformation info) { 27 23 super(info); 28 mode = new GPSBlamMode("gpsblam", tr("select gpx points and \"blam!\", find centre and direction of spread"));29 30 btn = new IconToggleButton(mode);31 btn.setVisible(true);32 24 } 33 25 34 26 @Override 35 27 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 36 mode.setFrame(newFrame); 37 if (oldFrame == null && newFrame != null && Main.map != null) { 38 Main.map.addMapMode(btn); 28 if (oldFrame == null && newFrame != null) { 29 GPSBlamMode mode = new GPSBlamMode("gpsblam", tr("select gpx points and \"blam!\", find centre and direction of spread")); 30 IconToggleButton btn = new IconToggleButton(mode); 31 btn.setVisible(true); 32 newFrame.addMapMode(btn); 39 33 } 40 34 }
Note:
See TracChangeset
for help on using the changeset viewer.