Changeset 33650 in osm for applications/editors
- Timestamp:
- 2017-09-22T01:43:52+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileGEO.java
r33649 r33650 8 8 9 9 import org.openstreetmap.josm.data.osm.DataSet; 10 import org.openstreetmap.josm.data.projection.Projection; 11 import org.openstreetmap.josm.data.projection.Projections; 10 12 import org.openstreetmap.josm.plugins.fr.cadastre.edigeo.EdigeoFileGEO.GeoBlock; 11 13 import org.openstreetmap.josm.plugins.fr.cadastre.edigeo.EdigeoFileTHF.ChildBlock; … … 64 66 } 65 67 throw new IllegalArgumentException(Integer.toString(code)); 68 } 69 } 70 71 interface Reference { 72 String getEpsgCode(); 73 } 74 75 enum CartesianReference implements Reference { 76 NTF("EPSG:4275"), 77 ED50("EPSG:4230"), 78 WGS72("EPSG:4322"), 79 WGS84("EPSG:4326"), 80 REUN47("EPSG:4626"), 81 MART38("EPSG:4625"), 82 GUAD48("EPSG:4622"), 83 CSG67("EPSG:4623"), 84 MAYO50("EPSG:4632"), 85 STPM50("EPSG:4638"); 86 87 final String epsg; 88 CartesianReference(String epsg) { 89 this.epsg = epsg; 90 } 91 92 @Override 93 public String getEpsgCode() { 94 return epsg; 95 } 96 } 97 98 enum GeographicReference implements Reference { 99 NTFG("EPSG:4275"), 100 NTFP("EPSG:4807"), 101 ED50G("EPSG:4230"), 102 WGS72G("EPSG:4322"), 103 WGS84G("EPSG:4326"), 104 REUN47GEO("EPSG:4626"), 105 MART38GEO("EPSG:4625"), 106 GUAD48GEO("EPSG:4622"), 107 CSG67GEO("EPSG:4623"), 108 MAYO50GEO("EPSG:4632"), 109 STPM50GEO("EPSG:4638"); 110 111 final String epsg; 112 GeographicReference(String epsg) { 113 this.epsg = epsg; 114 } 115 116 @Override 117 public String getEpsgCode() { 118 return epsg; 119 } 120 } 121 122 enum ProjectedReference implements Reference { 123 LAMB1("EPSG:27561"), 124 LAMB2("EPSG:27562"), 125 LAMB3("EPSG:27563"), 126 LAMB4("EPSG:27564"), 127 LAMB1C("EPSG:27571"), 128 LAMB2C("EPSG:27572"), 129 LAMB3C("EPSG:27573"), 130 LAMB4C("EPSG:27574"), 131 LAMBE("EPSG:27572"), 132 LAMB93("EPSG:2154"), 133 UTM30("EPSG:23030"), 134 UTM31("EPSG:23031"), 135 UTM32("EPSG:23032"), 136 UTM30W72("EPSG:32230"), 137 UTM31W72("EPSG:32231"), 138 UTM32W72("EPSG:32232"), 139 UTM30W84("EPSG:32630"), 140 UTM31W84("EPSG:32631"), 141 UTM32W84("EPSG:32632"), 142 REUN47GAUSSL("EPSG:3727"), 143 MART38UTM20("EPSG:2973"), 144 GUAD48UTM20("EPSG:2970"), 145 CSG67UTM21("EPSG:3312"), 146 CSG67UTM22("EPSG:2971"), 147 MAYO50UTM38S("EPSG:2980"), 148 STPM50UTM21("EPSG:2987"); 149 150 final String epsg; 151 ProjectedReference(String epsg) { 152 this.epsg = epsg; 153 } 154 155 @Override 156 public String getEpsgCode() { 157 return epsg; 66 158 } 67 159 } … … 139 231 return unit; 140 232 } 233 234 /** 235 * Returns the projection. 236 * @return the projection 237 */ 238 public final Projection getProjection() { 239 Reference ref; 240 switch (type.code) { 241 case "CAR": ref = CartesianReference.valueOf(code); break; 242 case "GEO": ref = GeographicReference.valueOf(code); break; 243 case "MAP": ref = ProjectedReference.valueOf(code); break; 244 default: throw new IllegalArgumentException(code); 245 } 246 return Projections.getProjectionByCode(ref.getEpsgCode()); 247 } 141 248 } 142 249 … … 159 266 return this; 160 267 } 268 269 /** 270 * Returns the coordinate reference system. 271 * @return the coordinate reference system 272 */ 273 public CoorReference getCoorReference() { 274 return blocks.getInstances(CoorReference.class).get(0); 275 } 161 276 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileVEC.java
r33649 r33650 13 13 import org.openstreetmap.josm.data.osm.DataSet; 14 14 import org.openstreetmap.josm.data.osm.Node; 15 import org.openstreetmap.josm.data.projection.Projection; 15 16 import org.openstreetmap.josm.plugins.fr.cadastre.edigeo.EdigeoFileSCD.McdObjectDef; 16 17 import org.openstreetmap.josm.plugins.fr.cadastre.edigeo.EdigeoFileSCD.McdPrimitiveDef; … … 322 323 public EdigeoFileVEC read(DataSet ds) throws IOException, ReflectiveOperationException { 323 324 super.read(ds); 325 Projection proj = lot.geo.getCoorReference().getProjection(); 324 326 for (NodeBlock nb : getNodes()) { 325 327 assert nb.getNumberOfAttributes() == 0; 326 328 assert nb.getNumberOfQualityIndicators() == 0; 327 Node n = new Node(nb.getCoordinate()); 329 lot.geo.toString(); 330 Node n = new Node(proj.eastNorth2latlon(nb.getCoordinate())); 328 331 ds.addPrimitive(n); 329 332 }
Note:
See TracChangeset
for help on using the changeset viewer.