Changeset 1797 in josm
- Timestamp:
- 2009-07-16T00:41:38+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r1750 r1797 61 61 if (Main.map != null) { 62 62 BoundingXYVisitor bbox = getBoundingBox(); 63 if (bbox != null ) {63 if (bbox != null && bbox.getBounds() != null) { 64 64 Main.map.mapView.recalculateCenterScale(bbox); 65 65 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r1764 r1797 321 321 */ 322 322 public void recalculateCenterScale(BoundingXYVisitor box) { 323 if (box == null) {323 if (box == null) { 324 324 box = new BoundingXYVisitor(); 325 325 } 326 if (box.getBounds() == null) {326 if (box.getBounds() == null) { 327 327 box.visit(getProjection().getWorldBounds()); 328 328 } 329 if (!box.hasExtend()) {329 if (!box.hasExtend()) { 330 330 box.enlargeBoundingBox(); 331 331 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r1728 r1797 138 138 */ 139 139 public Point getPoint(EastNorth p) { 140 if (null == p)140 if (null == p) 141 141 return new Point(); 142 142 double x = (p.east()-center.east())/scale + getWidth()/2; … … 146 146 147 147 public Point getPoint(LatLon latlon) { 148 if (latlon == null)148 if (latlon == null) 149 149 return new Point(); 150 else if (latlon instanceof CachedLatLon)150 else if (latlon instanceof CachedLatLon) 151 151 return getPoint(((CachedLatLon)latlon).getEastNorth()); 152 152 else … … 165 165 /* TODO: check that newCenter is really inside visible world and that scale is correct, don't allow zooming out to much */ 166 166 boolean rep = false; 167 if(!newCenter.equals(center)) 168 { 167 if (!newCenter.equals(center)) { 169 168 EastNorth oldCenter = center; 170 169 center = newCenter; … … 172 171 firePropertyChange("center", oldCenter, newCenter); 173 172 } 174 if(scale != newScale) 175 { 173 if (scale != newScale) { 176 174 double oldScale = scale; 177 175 scale = newScale; … … 188 186 189 187 public void zoomTo(LatLon newCenter) { 190 if (newCenter instanceof CachedLatLon)188 if (newCenter instanceof CachedLatLon) 191 189 zoomTo(((CachedLatLon)newCenter).getEastNorth(), scale); 192 190 else -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r1740 r1797 8 8 9 9 public class OsmUrlToBounds { 10 10 11 public static Bounds parse(String url) { 11 12 int i = url.indexOf('?'); … … 56 57 } 57 58 58 static public int getZoom(Bounds b) 59 { 59 static public int getZoom(Bounds b) { 60 60 // convert to mercator (for calculation of zoom only) 61 61 double latMin = Math.log(Math.tan(Math.PI/4.0+b.min.lat()/180.0*Math.PI/2.0))*180.0/Math.PI; … … 72 72 } 73 73 74 static public String getURL(Bounds b) 75 { 74 static public String getURL(Bounds b) { 76 75 return getURL(b.getCenter(), getZoom(b)); 77 76 } 78 77 79 static public String getURL(LatLon pos, int zoom) 80 { 78 static public String getURL(LatLon pos, int zoom) { 81 79 // Truncate lat and lon to something more sensible 82 80 int decimals = (int) Math.pow(10, (zoom / 3));
Note:
See TracChangeset
for help on using the changeset viewer.