Changeset 5548 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
- Timestamp:
- 2012-11-01T16:52:19+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r5546 r5548 27 27 import org.openstreetmap.josm.data.preferences.CollectionProperty; 28 28 import org.openstreetmap.josm.data.preferences.StringProperty; 29 import org.openstreetmap.josm.data.projection.BelgianLambert1972; 30 import org.openstreetmap.josm.data.projection.BelgianLambert2008; 31 import org.openstreetmap.josm.data.projection.Epsg3008; 32 import org.openstreetmap.josm.data.projection.Epsg4326; 33 import org.openstreetmap.josm.data.projection.Lambert93; 34 import org.openstreetmap.josm.data.projection.LambertEST; 35 import org.openstreetmap.josm.data.projection.Mercator; 29 import org.openstreetmap.josm.data.projection.CustomProjection; 36 30 import org.openstreetmap.josm.data.projection.Projection; 37 import org.openstreetmap.josm.data.projection.TransverseMercatorLV;38 31 import org.openstreetmap.josm.gui.NavigatableComponent; 39 32 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; … … 45 38 import org.openstreetmap.josm.tools.GBC; 46 39 40 /** 41 * Projection preferences. 42 * 43 * How to add new Projections: 44 * - Find EPSG code for the projection. 45 * - Look up the parameter string for Proj4, e.g. on http://spatialreference.org/ 46 * and add it to the file 'data/epsg' in JOSM trunk 47 * - Search for official references and verify the parameter values. These 48 * documents are often available in the local language only. 49 * - Use {@link #registerProjectionChoice()}, to make the entry known to JOSM. 50 * 51 * In case there is no EPSG code: 52 * - override {@link AbstractProjectionChoice#getProjection()} and provide 53 * a manual implementation of the projection. Use {@link CustomProjection} 54 * if possible. 55 */ 47 56 public class ProjectionPreference implements SubPreferenceSetting { 48 57 … … 56 65 private static Map<String, ProjectionChoice> projectionChoicesById = new HashMap<String, ProjectionChoice>(); 57 66 58 public static ProjectionChoice mercator = new SingleProjectionChoice("core:mercator", new Mercator()); 67 public static final ProjectionChoice wgs84; 68 public static final ProjectionChoice mercator; 69 public static final ProjectionChoice lambert; 59 70 static { 60 // global projections 61 registerProjectionChoice("core:wgs84", new Epsg4326()); 62 registerProjectionChoice(mercator); 71 72 /************************ 73 * Global projections. 74 */ 75 76 /** 77 * WGS84: Directly use latitude / longitude values as x/y. 78 */ 79 wgs84 = registerProjectionChoice(tr("WGS84 Geographic"), "core:wgs84", 4326, "epsg4326"); 80 81 /** 82 * Mercator Projection. 83 * 84 * The center of the mercator projection is always the 0 grad 85 * coordinate. 86 * 87 * See also USGS Bulletin 1532 88 * (http://egsc.usgs.gov/isb/pubs/factsheets/fs08799.html) 89 * initially EPSG used 3785 but that has been superseded by 3857, 90 * see http://www.epsg-registry.org/ 91 */ 92 mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 93 3857); 94 95 /** 96 * UTM. 97 */ 63 98 registerProjectionChoice(new UTMProjectionChoice()); 64 // regional - alphabetical order by country code 65 registerProjectionChoice("core:belambert1972", new BelgianLambert1972()); // BE 66 registerProjectionChoice("core:belambert2008", new BelgianLambert2008()); // BE 67 registerProjectionChoice(new SwissGridProjectionChoice()); // CH 68 registerProjectionChoice(new GaussKruegerProjectionChoice()); // DE 69 registerProjectionChoice("core:lambertest", new LambertEST()); // EE 70 registerProjectionChoice(new LambertProjectionChoice()); // FR 71 registerProjectionChoice("core:lambert93", new Lambert93()); // FR 72 registerProjectionChoice(new LambertCC9ZonesProjectionChoice()); // FR 73 registerProjectionChoice(new UTM_France_DOM_ProjectionChoice()); // FR 74 registerProjectionChoice("core:tmerclv", new TransverseMercatorLV()); // LV 75 registerProjectionChoice(new PuwgProjectionChoice()); // PL 76 registerProjectionChoice("core:sweref99", new Epsg3008()); // SE 99 100 /************************ 101 * Regional - alphabetical order by country code. 102 */ 103 104 /** 105 * Belgian Lambert 72 projection. 106 * 107 * As specified by the Belgian IGN in this document: 108 * http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf 109 * 110 * @author Don-vip 111 */ 112 registerProjectionChoice(tr("Belgian Lambert 1972"), "core:belgianLambert1972", 31370); // BE 113 /** 114 * Belgian Lambert 2008 projection. 115 * 116 * As specified by the Belgian IGN in this document: 117 * http://www.ngi.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf 118 * 119 * @author Don-vip 120 */ 121 registerProjectionChoice(tr("Belgian Lambert 2008"), "core:belgianLambert2008", 3812); // BE 122 123 /** 124 * SwissGrid CH1903 / L03, see http://de.wikipedia.org/wiki/Swiss_Grid. 125 * 126 * Actually, what we have here, is CH1903+ (EPSG:2056), but without 127 * the additional false easting of 2000km and false northing 1000 km. 128 * 129 * To get to CH1903, a shift file is required. So currently, there are errors 130 * up to 1.6m (depending on the location). 131 */ 132 registerProjectionChoice(new SwissGridProjectionChoice()); // CH 133 134 registerProjectionChoice(new GaussKruegerProjectionChoice()); // DE 135 136 /** 137 * Estonian Coordinate System of 1997. 138 * 139 * Thanks to Johan Montagnat and its geoconv java converter application 140 * (http://www.i3s.unice.fr/~johan/gps/ , published under GPL license) 141 * from which some code and constants have been reused here. 142 */ 143 registerProjectionChoice(tr("Lambert Zone (Estonia)"), "core:lambertest", 3301); // EE 144 145 /** 146 * Lambert conic conform 4 zones using the French geodetic system NTF. 147 * 148 * This newer version uses the grid translation NTF<->RGF93 provided by IGN for a submillimetric accuracy. 149 * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal) 150 * 151 * Source: http://professionnels.ign.fr/DISPLAY/000/526/700/5267002/transformation.pdf 152 * @author Pieren 153 */ 154 registerProjectionChoice(lambert = new LambertProjectionChoice()); // FR 155 /** 156 * Lambert 93 projection. 157 * 158 * As specified by the IGN in this document 159 * http://professionnels.ign.fr/DISPLAY/000/526/702/5267026/NTG_87.pdf 160 * @author Don-vip 161 */ 162 registerProjectionChoice(tr("Lambert 93 (France)"), "core:lambert93", 2154); // FR 163 /** 164 * Lambert Conic Conform 9 Zones projection. 165 * 166 * As specified by the IGN in this document 167 * http://professionnels.ign.fr/DISPLAY/000/526/700/5267002/transformation.pdf 168 * @author Pieren 169 */ 170 registerProjectionChoice(new LambertCC9ZonesProjectionChoice()); // FR 171 /** 172 * French departements in the Caribbean Sea and Indian Ocean. 173 * 174 * Using the UTM transvers Mercator projection and specific geodesic settings. 175 */ 176 registerProjectionChoice(new UTM_France_DOM_ProjectionChoice()); // FR 177 178 /** 179 * LKS-92/ Latvia TM projection. 180 * 181 * Based on data from spatialreference.org. 182 * http://spatialreference.org/ref/epsg/3059/ 183 * 184 * @author Viesturs Zarins 185 */ 186 registerProjectionChoice(tr("LKS-92 (Latvia TM)"), "core:tmerclv", 3059); // LV 187 188 /** 189 * PUWG 1992 and 2000 are the official cordinate systems in Poland. 190 * 191 * They use the same math as UTM only with different constants. 192 * 193 * @author steelman 194 */ 195 registerProjectionChoice(new PuwgProjectionChoice()); // PL 196 197 /** 198 * SWEREF99 13 30 projection. Based on data from spatialreference.org. 199 * http://spatialreference.org/ref/epsg/3008/ 200 * 201 * @author Hanno Hecker 202 */ 203 registerProjectionChoice(tr("SWEREF99 13 30 / EPSG:3008 (Sweden)"), "core:sweref99", 3008); // SE 204 205 /************************ 206 * Custom projection. 207 */ 77 208 registerProjectionChoice(new CustomProjectionChoice()); 78 209 } … … 83 214 } 84 215 85 public static void registerProjectionChoice(String id, Projection projection) { 86 registerProjectionChoice(new SingleProjectionChoice(id, projection)); 216 public static ProjectionChoice registerProjectionChoice(String name, String id, Integer epsg, String cacheDir) { 217 ProjectionChoice pc = new SingleProjectionChoice(name, id, "EPSG:"+epsg, cacheDir); 218 registerProjectionChoice(pc); 219 return pc; 220 } 221 222 private static ProjectionChoice registerProjectionChoice(String name, String id, Integer epsg) { 223 ProjectionChoice pc = new SingleProjectionChoice(name, id, "EPSG:"+epsg); 224 registerProjectionChoice(pc); 225 return pc; 87 226 } 88 227
Note:
See TracChangeset
for help on using the changeset viewer.
