Changeset 5072 in josm for trunk/src/org/openstreetmap/josm/data/projection
- Timestamp:
- 2012-03-11T19:29:20+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/BelgianLambert1972.java
r5066 r5072 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.data.projection; 2 3 -
trunk/src/org/openstreetmap/josm/data/projection/BelgianLambert2008.java
r5066 r5072 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.data.projection; 2 3 -
trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
r5067 r5072 9 9 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 import java.util.List;12 import java.util.ArrayList;13 11 14 12 /** … … 127 125 public static Ellipsoid create_a_rf(double a, double rf) { 128 126 return create_a_f(a, 1.0 / rf); 127 } 128 129 @Override 130 public String toString() { 131 return "Ellipsoid{a="+a+", b="+b+"}"; 129 132 } 130 133 -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r5022 r5072 4 4 import java.util.ArrayList; 5 5 import java.util.Arrays; 6 import java.util.HashMap; 7 import java.util.Map; 6 8 7 9 import org.openstreetmap.josm.Main; 8 10 import org.openstreetmap.josm.data.coor.EastNorth; 9 11 import org.openstreetmap.josm.data.coor.LatLon; 12 import org.openstreetmap.josm.data.projection.datum.Datum; 13 import org.openstreetmap.josm.data.projection.datum.WGS84Datum; 14 import org.openstreetmap.josm.data.projection.proj.LambertConformalConic; 15 import org.openstreetmap.josm.data.projection.proj.Proj; 16 import org.openstreetmap.josm.data.projection.proj.SwissObliqueMercator; 17 import org.openstreetmap.josm.data.projection.proj.TransverseMercator; 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 10 19 11 20 /** … … 23 32 new Mercator(), 24 33 new UTM(), 25 // regional - alphabetical order by country name26 new GaussKrueger(),27 new BelgianLambert 1972(),28 new BelgianLambert2008(),29 new LambertEST(),30 new Lambert (),31 new Lambert 93(),32 new Lambert CC9Zones(),33 new UTM_France_DOM(),34 new TransverseMercatorLV(),35 new Puwg(),36 new Epsg3008(), // SWEREF99 13 3037 new SwissGrid(),34 // regional - alphabetical order by country code 35 new BelgianLambert1972(), // BE 36 new BelgianLambert2008(), // BE 37 new SwissGrid(), // CH 38 new GaussKrueger(), // DE 39 new LambertEST(), // EE 40 new Lambert(), // FR 41 new Lambert93(), // FR 42 new LambertCC9Zones(), // FR 43 new UTM_France_DOM(), // FR 44 new TransverseMercatorLV(), // LV 45 new Puwg(), // PL 46 new Epsg3008(), // SE 38 47 })); 48 49 static { 50 if (Main.pref.getBoolean("customprojection")) { 51 addProjection(new CustomProjection()); 52 } 53 } 39 54 40 55 public static ArrayList<Projection> getProjections() { … … 44 59 /** 45 60 * Adds a new projection to the list of known projections. 46 * 61 * 47 62 * For Plugins authors: make sure your plugin is an early plugin, i.e. put 48 63 * Plugin-Early=true in your Manifest. … … 52 67 } 53 68 54 static public EastNorth project(LatLon ll) {69 public static EastNorth project(LatLon ll) { 55 70 if (ll == null) return null; 56 71 return Main.getProjection().latlon2eastNorth(ll); 57 72 } 58 73 59 static public LatLon inverseProject(EastNorth en) {74 public static LatLon inverseProject(EastNorth en) { 60 75 if (en == null) return null; 61 76 return Main.getProjection().eastNorth2latlon(en); 62 77 } 78 79 /********************************* 80 * Registry for custom projection 81 * 82 * should be compatible to PROJ.4 83 */ 84 85 private static Map<String, Ellipsoid> ellipsoids = new HashMap<String, Ellipsoid>(); 86 private static Map<String, Class<? extends Proj>> projs = new HashMap<String, Class<? extends Proj>>(); 87 private static Map<String, Datum> datums = new HashMap<String, Datum>(); 88 89 static { 90 ellipsoids.put("intl", Ellipsoid.hayford); 91 ellipsoids.put("GRS80", Ellipsoid.GRS80); 92 ellipsoids.put("WGS84", Ellipsoid.WGS84); 93 ellipsoids.put("bessel", Ellipsoid.Bessel1841); 94 95 projs.put("merc", org.openstreetmap.josm.data.projection.proj.Mercator.class); 96 projs.put("lcc", LambertConformalConic.class); 97 projs.put("somerc", SwissObliqueMercator.class); 98 projs.put("tmerc", TransverseMercator.class); 99 100 datums.put("WGS84", WGS84Datum.INSTANCE); 101 } 102 103 public static Ellipsoid getEllipsoid(String id) { 104 return ellipsoids.get(id); 105 } 106 107 public static Proj getProjection(String id) { 108 Class<? extends Proj> projClass = projs.get(id); 109 if (projClass == null) return null; 110 Proj proj = null; 111 try { 112 proj = projClass.newInstance(); 113 } catch (InstantiationException e) { 114 throw new RuntimeException(e); 115 } catch (IllegalAccessException e) { 116 throw new RuntimeException(e); 117 } 118 return proj; 119 } 120 121 public static Datum getDatum(String id) { 122 return datums.get(id); 123 } 63 124 } -
trunk/src/org/openstreetmap/josm/data/projection/datum/CentricDatum.java
r4285 r5072 14 14 super(name, proj4Id, ellps); 15 15 } 16 16 17 17 @Override 18 18 public LatLon toWGS84(LatLon ll) { … … 24 24 return this.ellps.cart2LatLon(Ellipsoid.WGS84.latLon2Cart(ll)); 25 25 } 26 26 27 @Override 28 public String toString() { 29 return "CentricDatum{ellipsoid="+ellps+"}"; 30 } 27 31 }
Note:
See TracChangeset
for help on using the changeset viewer.