Changeset 33547 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
- Timestamp:
- 2017-08-26T21:28:34+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
r33309 r33547 12 12 import org.openstreetmap.josm.data.imagery.OffsetBookmark; 13 13 import org.openstreetmap.josm.data.projection.Projection; 14 import org.openstreetmap.josm.gui.MainApplication; 14 15 import org.openstreetmap.josm.gui.MapView; 15 16 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; … … 36 37 */ 37 38 public static AbstractTileSourceLayer getTopImageryLayer() { 38 if ( Main.map == null || Main.map.mapView == null)39 if (!MainApplication.isDisplayingMapView()) 39 40 return null; 40 List<AbstractTileSourceLayer> layers = Main.getLayerManager().getLayersOfType(AbstractTileSourceLayer.class); 41 List<AbstractTileSourceLayer> layers = MainApplication.getLayerManager().getLayersOfType(AbstractTileSourceLayer.class); 41 42 for (AbstractTileSourceLayer layer : layers) { 42 43 String url = layer.getInfo().getUrl(); … … 54 55 public static LatLon getMapCenter() { 55 56 Projection proj = Main.getProjection(); 56 return Main.map == null || Main.map.mapView == null57 ? new LatLon(0, 0) : proj.eastNorth2latlon(Main .map.mapView.getCenter());57 return !MainApplication.isDisplayingMapView() 58 ? new LatLon(0, 0) : proj.eastNorth2latlon(MainApplication.getMap().mapView.getCenter()); 58 59 } 59 60 … … 67 68 public static LatLon getLayerOffset(AbstractTileSourceLayer layer, LatLon center) { 68 69 Projection proj = Main.getProjection(); 69 EastNorth offsetCenter = Main .map.mapView.getCenter();70 EastNorth offsetCenter = MainApplication.getMap().mapView.getCenter(); 70 71 EastNorth centerOffset = offsetCenter.add(-layer.getDisplaySettings().getDx(), 71 72 -layer.getDisplaySettings().getDy()); … … 121 122 122 123 public static int getCurrentZoom() { 123 if ( Main.map == null || Main.map.mapView == null) {124 if (!MainApplication.isDisplayingMapView()) { 124 125 return 1; 125 126 } 126 MapView mv = Main .map.mapView;127 MapView mv = MainApplication.getMap().mapView; 127 128 LatLon topLeft = mv.getLatLon(0, 0); 128 129 LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
Note:
See TracChangeset
for help on using the changeset viewer.
