Changeset 14628 in josm for trunk/src/org/openstreetmap/josm/data/ProjectionBounds.java
- Timestamp:
- 2019-01-03T20:06:44+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/ProjectionBounds.java
r12818 r14628 192 192 return !Utils.equalsEpsilon(minEast, maxEast) || !Utils.equalsEpsilon(minNorth, maxNorth); 193 193 } 194 195 /** 196 * Computes the scale of this bounds with respect to the given width/height. 197 * @param width the width 198 * @param height the height 199 * @return the computed scale 200 */ 201 public double getScale(final int width, final int height) { 202 // -20 to leave some border 203 int w = width - 20; 204 if (w < 20) { 205 w = 20; 206 } 207 int h = height - 20; 208 if (h < 20) { 209 h = 20; 210 } 211 212 double scaleX = getDeltaEast() / w; 213 double scaleY = getDeltaNorth() / h; 214 return Math.max(scaleX, scaleY); 215 } 216 217 private double getDeltaNorth() { 218 return maxNorth - minNorth; 219 } 220 221 private double getDeltaEast() { 222 return maxEast - minEast; 223 } 194 224 }
Note:
See TracChangeset
for help on using the changeset viewer.