Changeset 9628 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-25T12:36:19+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r9608 r9628 55 55 protected String cacheDir; 56 56 protected Bounds bounds; 57 private double metersPerUnit = 1; 57 private double metersPerUnit; 58 private double metersPerUnitNoDegrees; 58 59 private String axis = "enu"; // default axis orientation is East, North, Up 59 60 … … 286 287 this.code = s; 287 288 } 289 boolean defaultUnits = true; 288 290 s = parameters.get(Param.units.key); 289 291 if (s != null) { … … 291 293 if (UNITS_TO_METERS.containsKey(s)) { 292 294 this.metersPerUnit = UNITS_TO_METERS.get(s); 295 this.metersPerUnitNoDegrees = this.metersPerUnit; 296 defaultUnits = false; 293 297 } else { 294 298 Main.warn("No metersPerUnit found for: " + s); … … 298 302 if (s != null) { 299 303 this.metersPerUnit = parseDouble(s, Param.to_meter.key); 304 this.metersPerUnitNoDegrees = this.metersPerUnit; 305 defaultUnits = false; 306 } 307 if (defaultUnits) { 308 this.metersPerUnit = proj.isGeographic() ? METER_PER_UNIT_DEGREE : 1; 309 this.metersPerUnitNoDegrees = 1; 300 310 } 301 311 s = parameters.get(Param.axis.key); … … 700 710 return metersPerUnit; 701 711 } 712 713 /** 714 * Like {@link #getMetersPerUnit()}, but has default value 1 for a 715 * geographic CRS. I.e. by default, degrees are not converted to meters, 716 * but left alone (similar to proj.4 behavior). 717 * @return 718 */ 719 public double getMetersPerUnitProj() { 720 return metersPerUnitNoDegrees; 721 } 702 722 703 723 @Override -
trunk/src/org/openstreetmap/josm/data/projection/Projection.java
r9419 r9628 96 96 * Get the number of meters per unit of this projection. This more 97 97 * defines the scale of the map, than real conversion of unit to meters 98 * as this value is more less correct only along great circles.98 * as this value is more less correct only along certain lines of true scale. 99 99 * 100 100 * Used by WMTS to properly scale tiles 101 101 * @return meters per unit of projection 102 *103 102 */ 104 103 double getMetersPerUnit(); -
trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java
r9573 r9628 99 99 } 100 100 101 @Override 102 public boolean isGeographic() { 103 return false; 104 } 105 101 106 /** 102 107 * Calculates the meridian distance. This is the distance along the central -
trunk/src/org/openstreetmap/josm/data/projection/proj/DoubleStereographic.java
r9124 r9628 29 29 * Sec. 1.3.7.1 Oblique and Equatorial Stereographic, http://www.epsg.org/GuidanceNotes 30 30 */ 31 public class DoubleStereographic implementsProj {31 public class DoubleStereographic extends AbstractProj { 32 32 33 33 private Ellipsoid ellps; 34 private double e;35 34 private double n; 36 35 private double c; … … 52 51 @Override 53 52 public void initialize(ProjParameters params) throws ProjectionConfigurationException { 53 super.initialize(params); 54 54 if (params.lat0 == null) 55 55 throw new ProjectionConfigurationException(tr("Parameter ''{0}'' required.", "lat_0")); 56 56 ellps = params.ellps; 57 e = ellps.e;58 57 initialize(params.lat0); 59 58 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/LonLat.java
r9124 r9628 43 43 return new Bounds(-90, -180, 90, 180, false); 44 44 } 45 46 @Override 47 public boolean isGeographic() { 48 return true; 49 } 45 50 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/Proj.java
r9132 r9628 82 82 */ 83 83 Bounds getAlgorithmBounds(); 84 85 /** 86 * Return true, if a geographic coordinate reference system is represented. 87 * 88 * I.e. if it returns latitude/longitude values rather than Cartesian 89 * east/north coordinates on a flat surface. 90 * @return true, if it is geographic 91 */ 92 boolean isGeographic(); 84 93 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/SwissObliqueMercator.java
r9579 r9628 34 34 * this formula (rigorous formulas)</a>. 35 35 */ 36 public class SwissObliqueMercator implementsProj {36 public class SwissObliqueMercator extends AbstractProj { 37 37 38 38 // CHECKSTYLE.ON: LineLength … … 49 49 @Override 50 50 public void initialize(ProjParameters params) throws ProjectionConfigurationException { 51 super.initialize(params); 51 52 if (params.lat0 == null) 52 53 throw new ProjectionConfigurationException(tr("Parameter ''{0}'' required.", "lat_0"));
Note:
See TracChangeset
for help on using the changeset viewer.