Changeset 5235 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2012-05-12T19:11:58+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Bounds.java
r4580 r5235 43 43 } 44 44 45 public Bounds(LatLon min, LatLon max, boolean roundToOsmPrecision) { 46 this(min.lat(), min.lon(), max.lat(), max.lon(), roundToOsmPrecision); 47 } 48 45 49 public Bounds(LatLon b) { 50 this(b, true); 51 } 52 53 public Bounds(LatLon b, boolean roundToOsmPrecision) { 46 54 // Do not call this(b, b) to avoid GPX performance issue (see #7028) until roundToOsmPrecision() is improved 47 this.minLat = LatLon.roundToOsmPrecision(b.lat()); 48 this.minLon = LatLon.roundToOsmPrecision(b.lon()); 55 if (roundToOsmPrecision) { 56 this.minLat = LatLon.roundToOsmPrecision(b.lat()); 57 this.minLon = LatLon.roundToOsmPrecision(b.lon()); 58 } else { 59 this.minLat = b.lat(); 60 this.minLon = b.lon(); 61 } 49 62 this.maxLat = this.minLat; 50 63 this.maxLon = this.minLon; … … 52 65 53 66 public Bounds(double minlat, double minlon, double maxlat, double maxlon) { 54 this.minLat = LatLon.roundToOsmPrecision(minlat); 55 this.minLon = LatLon.roundToOsmPrecision(minlon); 56 this.maxLat = LatLon.roundToOsmPrecision(maxlat); 57 this.maxLon = LatLon.roundToOsmPrecision(maxlon); 67 this(minlat, minlon, maxlat, maxlon, true); 68 } 69 70 public Bounds(double minlat, double minlon, double maxlat, double maxlon, boolean roundToOsmPrecision) { 71 if (roundToOsmPrecision) { 72 this.minLat = LatLon.roundToOsmPrecision(minlat); 73 this.minLon = LatLon.roundToOsmPrecision(minlon); 74 this.maxLat = LatLon.roundToOsmPrecision(maxlat); 75 this.maxLon = LatLon.roundToOsmPrecision(maxlon); 76 } else { 77 this.minLat = minlat; 78 this.minLon = minlon; 79 this.maxLat = maxlat; 80 this.maxLon = maxlon; 81 } 58 82 } 59 83 60 84 public Bounds(double [] coords) { 85 this(coords, true); 86 } 87 88 public Bounds(double [] coords, boolean roundToOsmPrecision) { 61 89 CheckParameterUtil.ensureParameterNotNull(coords, "coords"); 62 90 if (coords.length != 4) 63 91 throw new IllegalArgumentException(MessageFormat.format("Expected array of length 4, got {0}", coords.length)); 64 this.minLat = LatLon.roundToOsmPrecision(coords[0]); 65 this.minLon = LatLon.roundToOsmPrecision(coords[1]); 66 this.maxLat = LatLon.roundToOsmPrecision(coords[2]); 67 this.maxLon = LatLon.roundToOsmPrecision(coords[3]); 92 if (roundToOsmPrecision) { 93 this.minLat = LatLon.roundToOsmPrecision(coords[0]); 94 this.minLon = LatLon.roundToOsmPrecision(coords[1]); 95 this.maxLat = LatLon.roundToOsmPrecision(coords[2]); 96 this.maxLon = LatLon.roundToOsmPrecision(coords[3]); 97 } else { 98 this.minLat = coords[0]; 99 this.minLon = coords[1]; 100 this.maxLat = coords[2]; 101 this.maxLon = coords[3]; 102 } 68 103 } 69 104 … … 73 108 74 109 public Bounds(String asString, String separator, ParseMethod parseMethod) throws IllegalArgumentException { 110 this(asString, separator, parseMethod, true); 111 } 112 113 public Bounds(String asString, String separator, ParseMethod parseMethod, boolean roundToOsmPrecision) throws IllegalArgumentException { 75 114 CheckParameterUtil.ensureParameterNotNull(asString, "asString"); 76 115 String[] components = asString.split(separator); … … 88 127 switch (parseMethod) { 89 128 case LEFT_BOTTOM_RIGHT_TOP: 90 this.minLat = initLat(values[1] );91 this.minLon = initLon(values[0] );92 this.maxLat = initLat(values[3] );93 this.maxLon = initLon(values[2] );129 this.minLat = initLat(values[1], roundToOsmPrecision); 130 this.minLon = initLon(values[0], roundToOsmPrecision); 131 this.maxLat = initLat(values[3], roundToOsmPrecision); 132 this.maxLon = initLon(values[2], roundToOsmPrecision); 94 133 break; 95 134 case MINLAT_MINLON_MAXLAT_MAXLON: 96 135 default: 97 this.minLat = initLat(values[0] );98 this.minLon = initLon(values[1] );99 this.maxLat = initLat(values[2] );100 this.maxLon = initLon(values[3] );101 } 102 } 103 104 protected static double initLat(double value ) {136 this.minLat = initLat(values[0], roundToOsmPrecision); 137 this.minLon = initLon(values[1], roundToOsmPrecision); 138 this.maxLat = initLat(values[2], roundToOsmPrecision); 139 this.maxLon = initLon(values[3], roundToOsmPrecision); 140 } 141 } 142 143 protected static double initLat(double value, boolean roundToOsmPrecision) { 105 144 if (!LatLon.isValidLat(value)) 106 145 throw new IllegalArgumentException(tr("Illegal latitude value ''{0}''", value)); 107 return LatLon.roundToOsmPrecision(value);108 } 109 110 protected static double initLon(double value ) {146 return roundToOsmPrecision ? LatLon.roundToOsmPrecision(value) : value; 147 } 148 149 protected static double initLon(double value, boolean roundToOsmPrecision) { 111 150 if (!LatLon.isValidLon(value)) 112 151 throw new IllegalArgumentException(tr("Illegal longitude value ''{0}''", value)); 113 return LatLon.roundToOsmPrecision(value);152 return roundToOsmPrecision ? LatLon.roundToOsmPrecision(value) : value; 114 153 } 115 154 -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r4869 r5235 45 45 // a comma separated list of coordinates. 46 46 cDdFormatter = (DecimalFormat) NumberFormat.getInstance(Locale.UK); 47 cDdFormatter.applyPattern("###0.0 000000");47 cDdFormatter.applyPattern("###0.0######"); 48 48 } 49 49 -
trunk/src/org/openstreetmap/josm/data/projection/BelgianLambert1972.java
r5072 r5235 47 47 return new Bounds( 48 48 new LatLon(49.51, 2.54), 49 new LatLon(51.50, 6.40) );49 new LatLon(51.50, 6.40), false); 50 50 } 51 51 -
trunk/src/org/openstreetmap/josm/data/projection/BelgianLambert2008.java
r5072 r5235 46 46 return new Bounds( 47 47 new LatLon(49.51, 2.54), 48 new LatLon(51.50, 6.40) );48 new LatLon(51.50, 6.40), false); 49 49 } 50 50 -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r5234 r5235 343 343 parseAngle(numStr[0], "minlon (+bounds)"), 344 344 parseAngle(numStr[3], "maxlat (+bounds)"), 345 parseAngle(numStr[2], "maxlon (+bounds)") );345 parseAngle(numStr[2], "maxlon (+bounds)"), false); 346 346 } 347 347 -
trunk/src/org/openstreetmap/josm/data/projection/Epsg3008.java
r5066 r5235 54 54 public Bounds getWorldBoundsLatLon() { 55 55 return new Bounds( 56 new LatLon(55.2, 12.1), // new LatLon(-90.0, -180.0),57 new LatLon(62.26, 14.65) ); // new LatLon(90.0, 180.0));56 new LatLon(55.2, 12.1), 57 new LatLon(62.26, 14.65), false); 58 58 } 59 59 -
trunk/src/org/openstreetmap/josm/data/projection/Epsg4326.java
r2516 r5235 44 44 return new Bounds( 45 45 new LatLon(-90.0, -180.0), 46 new LatLon(90.0, 180.0) );46 new LatLon(90.0, 180.0), false); 47 47 } 48 48 -
trunk/src/org/openstreetmap/josm/data/projection/GaussKrueger.java
r5234 r5235 17 17 18 18 private static Bounds[] bounds = { 19 new Bounds(new LatLon(-5, 3.5), new LatLon(85, 8.5) ),20 new Bounds(new LatLon(-5, 6.5), new LatLon(85, 11.5) ),21 new Bounds(new LatLon(-5, 9.5), new LatLon(85, 14.5) ),22 new Bounds(new LatLon(-5, 12.5), new LatLon(85, 17.5) ),19 new Bounds(new LatLon(-5, 3.5), new LatLon(85, 8.5), false), 20 new Bounds(new LatLon(-5, 6.5), new LatLon(85, 11.5), false), 21 new Bounds(new LatLon(-5, 9.5), new LatLon(85, 14.5), false), 22 new Bounds(new LatLon(-5, 12.5), new LatLon(85, 17.5), false), 23 23 }; 24 24 -
trunk/src/org/openstreetmap/josm/data/projection/Lambert.java
r5234 r5235 143 143 Bounds b= new Bounds( 144 144 new LatLon(Math.max(zoneLimitsDegree[layoutZone][1] - cMaxOverlappingZonesDegree, Math.toDegrees(cMinLatZone1Radian)), Math.toDegrees(cMinLonZonesRadian)), 145 new LatLon(Math.min(zoneLimitsDegree[layoutZone][0] + cMaxOverlappingZonesDegree, Math.toDegrees(cMaxLatZone1Radian)), Math.toDegrees(cMaxLonZonesRadian))); 145 new LatLon(Math.min(zoneLimitsDegree[layoutZone][0] + cMaxOverlappingZonesDegree, Math.toDegrees(cMaxLatZone1Radian)), Math.toDegrees(cMaxLonZonesRadian)), 146 false); 146 147 return b; 147 148 } -
trunk/src/org/openstreetmap/josm/data/projection/Lambert93.java
r5066 r5235 45 45 return new Bounds( 46 46 new LatLon(41.0, -5.5), 47 new LatLon(51.0, 10.2) );47 new LatLon(51.0, 10.2), false); 48 48 } 49 49 -
trunk/src/org/openstreetmap/josm/data/projection/LambertCC9Zones.java
r5234 r5235 90 90 return new Bounds( 91 91 new LatLon(Math.max(medLatZone - 1.0 - cMaxOverlappingZones, cMinLatZonesDegree), -5.5), 92 new LatLon(Math.min(medLatZone + 1.0 + cMaxOverlappingZones, Math.toDegrees(cMaxLatZonesRadian)), 10.2)); 92 new LatLon(Math.min(medLatZone + 1.0 + cMaxOverlappingZones, Math.toDegrees(cMaxLatZonesRadian)), 10.2), 93 false); 93 94 } 94 95 -
trunk/src/org/openstreetmap/josm/data/projection/LambertEST.java
r5066 r5235 63 63 return new Bounds( 64 64 new LatLon(56.05, 21.64), 65 new LatLon(61.13, 28.58) );65 new LatLon(61.13, 28.58), false); 66 66 } 67 67 -
trunk/src/org/openstreetmap/josm/data/projection/Mercator.java
r5066 r5235 60 60 return new Bounds( 61 61 new LatLon(-85.05112877980659, -180.0), 62 new LatLon(85.05112877980659, 180.0) );62 new LatLon(85.05112877980659, 180.0), false); 63 63 } 64 64 -
trunk/src/org/openstreetmap/josm/data/projection/Puwg.java
r5234 r5235 121 121 return new Bounds( 122 122 new LatLon(49.00, 14.12), 123 new LatLon(54.84, 24.15) );123 new LatLon(54.84, 24.15), false); 124 124 } 125 125 … … 164 164 return new Bounds( 165 165 new LatLon(49.00, (3 * getZone()) - 1.5), 166 new LatLon(54.84, (3 * getZone()) + 1.5) );166 new LatLon(54.84, (3 * getZone()) + 1.5), false); 167 167 } 168 168 -
trunk/src/org/openstreetmap/josm/data/projection/SwissGrid.java
r5234 r5235 63 63 @Override 64 64 public Bounds getWorldBoundsLatLon() { 65 return new Bounds(new LatLon(45.7, 5.7), new LatLon(47.9, 10.6) );65 return new Bounds(new LatLon(45.7, 5.7), new LatLon(47.9, 10.6), false); 66 66 } 67 67 -
trunk/src/org/openstreetmap/josm/data/projection/TransverseMercatorLV.java
r5066 r5235 56 56 return new Bounds( 57 57 new LatLon(-90.0, -180.0), 58 new LatLon(90.0, 180.0) );58 new LatLon(90.0, 180.0), false); 59 59 } 60 60 } -
trunk/src/org/openstreetmap/josm/data/projection/UTM.java
r5234 r5235 100 100 return new Bounds( 101 101 new LatLon(-5.0, getUtmCentralMeridianDeg(getzone())-5.0), 102 new LatLon(85.0, getUtmCentralMeridianDeg(getzone())+5.0) );102 new LatLon(85.0, getUtmCentralMeridianDeg(getzone())+5.0), false); 103 103 else 104 104 return new Bounds( 105 105 new LatLon(-85.0, getUtmCentralMeridianDeg(getzone())-5.0), 106 new LatLon(5.0, getUtmCentralMeridianDeg(getzone())+5.0) );106 new LatLon(5.0, getUtmCentralMeridianDeg(getzone())+5.0), false); 107 107 } 108 108 -
trunk/src/org/openstreetmap/josm/data/projection/UTM_France_DOM.java
r5234 r5235 19 19 public class UTM_France_DOM extends AbstractProjection { 20 20 21 private final static Bounds FortMarigotBounds = new Bounds( new LatLon(17.6,-63.25), new LatLon(18.5,-62.5) );22 private final static Bounds SainteAnneBounds = new Bounds( new LatLon(15.8,-61.9), new LatLon(16.6,-60.9) );23 private final static Bounds MartiniqueBounds = new Bounds( new LatLon(14.25,-61.25), new LatLon(15.025,-60.725) );24 private final static Bounds ReunionBounds = new Bounds( new LatLon(-25.92,37.58), new LatLon(-10.6, 58.27) );25 private final static Bounds GuyaneBounds = new Bounds( new LatLon(2.16 , -54.0), new LatLon(9.06 , -49.62) );21 private final static Bounds FortMarigotBounds = new Bounds( new LatLon(17.6,-63.25), new LatLon(18.5,-62.5), false); 22 private final static Bounds SainteAnneBounds = new Bounds( new LatLon(15.8,-61.9), new LatLon(16.6,-60.9), false); 23 private final static Bounds MartiniqueBounds = new Bounds( new LatLon(14.25,-61.25), new LatLon(15.025,-60.725), false); 24 private final static Bounds ReunionBounds = new Bounds( new LatLon(-25.92,37.58), new LatLon(-10.6, 58.27), false); 25 private final static Bounds GuyaneBounds = new Bounds( new LatLon(2.16 , -54.0), new LatLon(9.06 , -49.62), false); 26 26 private final static Bounds[] utmBounds = { FortMarigotBounds, SainteAnneBounds, MartiniqueBounds, ReunionBounds, GuyaneBounds }; 27 27 -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r5234 r5235 198 198 Bounds b = proj.getWorldBoundsLatLon(); 199 199 CoordinateFormat cf = CoordinateFormat.getDefaultFormat(); 200 bounds.setText(b.getMin().l atToString(cf)+"; "+b.getMin().lonToString(cf)+" : "+b.getMax().latToString(cf)+"; "+b.getMax().lonToString(cf));200 bounds.setText(b.getMin().lonToString(cf)+", "+b.getMin().latToString(cf)+" : "+b.getMax().lonToString(cf)+", "+b.getMax().latToString(cf)); 201 201 boolean showCode = true; 202 202 if (pc instanceof SubPrefsOptions) {
Note:
See TracChangeset
for help on using the changeset viewer.