Changeset 9576 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-01-23T04:49:01+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r9230 r9576 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.HeadlessException; 7 import java.awt.Toolkit; 6 import java.awt.Dimension; 8 7 import java.util.HashMap; 9 8 import java.util.Map; … … 13 12 import org.openstreetmap.josm.data.coor.LatLon; 14 13 import org.openstreetmap.josm.data.projection.Ellipsoid; 14 import org.openstreetmap.josm.gui.util.GuiHelper; 15 15 16 16 public final class OsmUrlToBounds { … … 191 191 public static Bounds positionToBounds(final double lat, final double lon, final int zoom) { 192 192 int tileSizeInPixels = 256; 193 int height; 194 int width; 195 try { 196 height = Toolkit.getDefaultToolkit().getScreenSize().height; 197 width = Toolkit.getDefaultToolkit().getScreenSize().width; 198 if (Main.isDisplayingMapView()) { 199 height = Main.map.mapView.getHeight(); 200 width = Main.map.mapView.getWidth(); 201 } 202 } catch (HeadlessException he) { 203 // in headless mode, when running tests 204 height = 480; 205 width = 640; 193 Dimension screenSize = GuiHelper.getScreenSize(); 194 int height = screenSize.height; 195 int width = screenSize.width; 196 if (Main.isDisplayingMapView()) { 197 height = Main.map.mapView.getHeight(); 198 width = Main.map.mapView.getWidth(); 206 199 } 207 200 double scale = (1 << zoom) * tileSizeInPixels / (2 * Math.PI * Ellipsoid.WGS84.a); -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r9062 r9576 12 12 import java.awt.Point; 13 13 import java.awt.Rectangle; 14 import java.awt.Toolkit;15 14 import java.awt.Window; 16 15 import java.util.regex.Matcher; … … 20 19 21 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.gui.util.GuiHelper; 22 22 23 23 /** … … 468 468 */ 469 469 public static Rectangle getFullScreenInfo() { 470 return new Rectangle(new Point(0, 0), Toolkit.getDefaultToolkit().getScreenSize());470 return new Rectangle(new Point(0, 0), GuiHelper.getScreenSize()); 471 471 } 472 472
Note:
See TracChangeset
for help on using the changeset viewer.