Ticket #16706: 16706-improve.patch
| File 16706-improve.patch, 1.8 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
27 27 * @author imi 28 28 */ 29 29 public class BoundingXYVisitor implements OsmPrimitiveVisitor, PrimitiveVisitor { 30 30 private static final double ENLARGE = 0.0002; 31 31 private ProjectionBounds bounds; 32 32 33 33 @Override … … 144 144 * equal <code>null</code>) this method does not do anything. 145 145 */ 146 146 public void enlargeBoundingBox() { 147 final double enlarge = Config.getPref().getDouble("edit.zoom-enlarge-bbox", 0.001);147 final double enlarge = Config.getPref().getDouble("edit.zoom-enlarge-bbox", ENLARGE); 148 148 enlargeBoundingBox(enlarge, enlarge); 149 149 } 150 150 … … 187 187 final LatLon max = ProjectionRegistry.getProjection().eastNorth2latlon(bounds.getMax()); 188 188 final double deltaLat = max.lat() - min.lat(); 189 189 final double deltaLon = max.lon() - min.lon(); 190 // [0.001, 0.1] degree -> [0.001, 0.0] degree enlargement 191 final DoubleUnaryOperator enlargement = deg -> deg < 0.001 192 ? 0.001 193 : deg < 0.1 194 ? 0.001 - deg / 100 195 : 0.0; 190 final double enlarge = Config.getPref().getDouble("edit.zoom-enlarge-bbox", ENLARGE); 191 192 final DoubleUnaryOperator enlargement = deltaDegress -> { 193 if (deltaDegress < enlarge) 194 return enlarge; 195 if (deltaDegress < 0.1) 196 return enlarge - deltaDegress / 100; 197 return 0.0; 198 }; 196 199 enlargeBoundingBox(enlargement.applyAsDouble(deltaLon), enlargement.applyAsDouble(deltaLat)); 197 200 } 198 201
