Changeset 746 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-08-05T02:14:58+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r731 r746 84 84 for (OsmPrimitive osm : sel) 85 85 osm.visit(v); 86 // special case to zoom nicely to one single node 87 if (v.min != null && v.max != null && v.min.north() == v.max.north() && v.min.east() == v.max.east()) { 88 EastNorth en = Main.proj.latlon2eastNorth(new LatLon(0.001, 0.001)); 89 v.min = new EastNorth(v.min.east()-en.east(), v.min.north()-en.north()); 90 v.max = new EastNorth(v.max.east()+en.east(), v.max.north()+en.north()); 91 } 86 // increase bbox by 0.001 degrees on each side. this is required 87 // especially if the bbox contains one single node, but helpful 88 // in most other cases as well. 89 // if (v.min != null && v.max != null && v.min.north() == v.max.north() && v.min.east() == v.max.east()) { 90 EastNorth en = Main.proj.latlon2eastNorth(new LatLon(0.001, 0.001)); 91 v.min = new EastNorth(v.min.east()-en.east(), v.min.north()-en.north()); 92 v.max = new EastNorth(v.max.east()+en.east(), v.max.north()+en.north()); 92 93 } 93 94 return v; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r726 r746 58 58 59 59 public void download(DownloadAction action, double minlat, double minlon, double maxlat, double maxlon) { 60 // Swap min and max if user has specified them the wrong way round 61 // (easy to do if you are crossing 0, for example) 62 if (minlat > maxlat) { 63 double t = minlat; minlat = maxlat; maxlat = t; 64 } 65 if (minlon > maxlon) { 66 double t = minlon; minlon = maxlon; maxlon = t; 67 } 60 // Swap min and max if user has specified them the wrong way round 61 // (easy to do if you are crossing 0, for example) 62 // FIXME should perhaps be done in download dialog? 63 if (minlat > maxlat) { 64 double t = minlat; minlat = maxlat; maxlat = t; 65 } 66 if (minlon > maxlon) { 67 double t = minlon; minlon = maxlon; maxlon = t; 68 } 68 69 69 Task task = new Task(action .dialog == null || action.dialog.newLayer.isSelected(), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon));70 Task task = new Task(action != null && (action.dialog == null || action.dialog.newLayer.isSelected()), new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon)); 70 71 Main.worker.execute(task); 71 72 } -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r655 r746 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 2 package org.openstreetmap.josm.data; 3 4 import java.awt.geom.Rectangle2D; 5 import java.awt.geom.RectangularShape; 3 6 4 7 import org.openstreetmap.josm.data.coor.LatLon; … … 66 69 return true; 67 70 } 71 72 /** 73 * Returns the lat/lon bounding box as an object of type Rectangle2D.Double 74 * @return 75 */ 76 public Rectangle2D.Double asRect() { 77 return new Rectangle2D.Double(min.lon(), min.lat(), max.lon()-min.lon(), max.lat()-min.lat()); 78 } 79 68 80 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r655 r746 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import java.awt.Polygon; 5 import java.awt.Shape; 6 import java.awt.geom.Area; 4 7 import java.util.Arrays; 5 8 import java.util.Collection; … … 204 207 return ds; 205 208 } 209 210 /** 211 * Returns the total area of downloaded data (the "yellow rectangles"). 212 * @return Area object encompassing downloaded data. 213 */ 214 public Area getDataSourceArea() 215 { 216 Area a = new Area(); 217 for (DataSource source : dataSources) { 218 // create area from data bounds 219 a.add(new Area(source.bounds.asRect())); 220 } 221 return a; 222 223 } 206 224 }
Note:
See TracChangeset
for help on using the changeset viewer.