Changeset 12630 in josm for trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
- Timestamp:
- 2017-08-24T00:15:51+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r12620 r12630 29 29 import org.openstreetmap.josm.data.imagery.OffsetBookmark; 30 30 import org.openstreetmap.josm.gui.ExtendedDialog; 31 import org.openstreetmap.josm.gui.MainApplication; 32 import org.openstreetmap.josm.gui.MapFrame; 33 import org.openstreetmap.josm.gui.MapView; 31 34 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 32 35 import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings; … … 72 75 EastNorth curOff = old == null ? EastNorth.ZERO : old.getDisplacement(Main.getProjection()); 73 76 LatLon center; 74 if (Main .isDisplayingMapView()) {75 center = Main.getProjection().eastNorth2latlon(Main .map.mapView.getCenter());77 if (MainApplication.isDisplayingMapView()) { 78 center = Main.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter()); 76 79 } else { 77 80 center = LatLon.ZERO; … … 98 101 99 102 protected void addListeners() { 100 Main.map.mapView.addMouseListener(this); 101 Main.map.mapView.addMouseMotionListener(this); 103 MapView mapView = MainApplication.getMap().mapView; 104 mapView.addMouseListener(this); 105 mapView.addMouseMotionListener(this); 102 106 try { 103 107 Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK); … … 126 130 Logging.error(ex); 127 131 } 128 if (Main.isDisplayingMapView()) { 129 Main.map.mapView.removeMouseMotionListener(this); 130 Main.map.mapView.removeMouseListener(this); 132 if (MainApplication.isDisplayingMapView()) { 133 MapFrame map = MainApplication.getMap(); 134 map.mapView.removeMouseMotionListener(this); 135 map.mapView.removeMouseListener(this); 131 136 } 132 137 } … … 172 177 if (layer.isVisible()) { 173 178 requestFocusInMapView(); 174 prevEastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY()); 175 Main.map.mapView.setNewCursor(Cursor.MOVE_CURSOR, this); 179 MapView mapView = MainApplication.getMap().mapView; 180 prevEastNorth = mapView.getEastNorth(e.getX(), e.getY()); 181 mapView.setNewCursor(Cursor.MOVE_CURSOR, this); 176 182 } 177 183 } … … 180 186 public void mouseDragged(MouseEvent e) { 181 187 if (layer == null || prevEastNorth == null) return; 182 EastNorth eastNorth = Main .map.mapView.getEastNorth(e.getX(), e.getY());188 EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY()); 183 189 EastNorth d = tempOffset.getDisplacement().add(eastNorth).subtract(prevEastNorth); 184 190 tempOffset.setDisplacement(d); … … 192 198 @Override 193 199 public void mouseReleased(MouseEvent e) { 194 Main.map.mapView.repaint(); 195 Main.map.mapView.resetCursor(this); 200 MapView mapView = MainApplication.getMap().mapView; 201 mapView.repaint(); 202 mapView.resetCursor(this); 196 203 prevEastNorth = null; 197 204 } … … 199 206 @Override 200 207 public void actionPerformed(ActionEvent e) { 201 if (offsetDialog != null || layer == null || Main.map == null) 208 MapFrame map = MainApplication.getMap(); 209 if (offsetDialog != null || layer == null || map == null) 202 210 return; 203 oldMapMode = Main.map.mapMode;211 oldMapMode = map.mapMode; 204 212 super.actionPerformed(e); 205 213 } … … 266 274 } 267 275 updateOffsetIntl(); 268 if (Main .isDisplayingMapView()) {269 Main .map.repaint();276 if (MainApplication.isDisplayingMapView()) { 277 MainApplication.getMap().repaint(); 270 278 } 271 279 } … … 334 342 335 343 private void restoreMapModeState() { 336 if (Main.map == null) 344 MapFrame map = MainApplication.getMap(); 345 if (map == null) 337 346 return; 338 347 if (oldMapMode != null) { 339 Main.map.selectMapMode(oldMapMode);348 map.selectMapMode(oldMapMode); 340 349 oldMapMode = null; 341 350 } else { 342 Main.map.selectSelectTool(false);351 map.selectSelectTool(false); 343 352 } 344 353 }
Note:
See TracChangeset
for help on using the changeset viewer.