Ticket #1963: BoundingXYVisitor.java.patch
| File BoundingXYVisitor.java.patch, 1.9 KB (added by , 17 years ago) |
|---|
-
src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
4 4 import org.openstreetmap.josm.Main; 5 5 import org.openstreetmap.josm.data.Bounds; 6 6 import org.openstreetmap.josm.data.coor.EastNorth; 7 import org.openstreetmap.josm.data.coor.LatLon; 7 8 import org.openstreetmap.josm.data.osm.Node; 8 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 9 10 import org.openstreetmap.josm.data.osm.Relation; … … 60 61 } 61 62 62 63 /** 63 * Enlarges the calculated bounding box by 0.00 01degrees.64 * Enlarges the calculated bounding box by 0.002 degrees. 64 65 * If the bounding box has not been set (<code>min</code> or <code>max</code> 65 66 * equal <code>null</code>) this method does not do anything. 66 67 * 67 68 * @param enlargeDegree 68 69 */ 69 70 public void enlargeBoundingBox() { 70 enlargeBoundingBox(0.00 01);71 enlargeBoundingBox(0.002); 71 72 } 72 73 73 74 /** … … 80 81 public void enlargeBoundingBox(double enlargeDegree) { 81 82 if (min == null || max == null) 82 83 return; 83 EastNorth en = new EastNorth(enlargeDegree, enlargeDegree); 84 min = new EastNorth(min.east() - en.east(), min.north() - en.north()); 85 max = new EastNorth(max.east() + en.east(), max.north() + en.north()); 84 LatLon minLatlon = Main.proj.eastNorth2latlon(min); 85 min = Main.proj.latlon2eastNorth(new LatLon(minLatlon.lat() - enlargeDegree, minLatlon.lon() - enlargeDegree)); 86 LatLon maxLatlon = Main.proj.eastNorth2latlon(max); 87 max = Main.proj.latlon2eastNorth(new LatLon(maxLatlon.lat() + enlargeDegree, maxLatlon.lon() + enlargeDegree)); 86 88 } 87 89 }
