- Timestamp:
- 2016-01-09T22:33:40+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r9240 r9370 44 44 45 45 /** 46 * Class to handle projections46 * Class to manage projections. 47 47 * 48 * Use this class to query available projection or register new projections 49 * from a plugin. 48 50 */ 49 51 public final class Projections { … … 157 159 } 158 160 161 /** 162 * Convert from lat/lon to easting/northing using the current projection. 163 * 164 * @param ll the geographical point to convert (in WGS84 lat/lon) 165 * @return the corresponding east/north coordinates 166 */ 159 167 public static EastNorth project(LatLon ll) { 160 168 if (ll == null) return null; … … 162 170 } 163 171 172 /** 173 * Convert from easting/norting to lat/lon using the current projection. 174 * 175 * @param en the geographical point to convert (in projected coordinates) 176 * @return the corresponding lat/lon (WGS84) 177 */ 164 178 public static LatLon inverseProject(EastNorth en) { 165 179 if (en == null) return null; … … 184 198 } 185 199 200 /** 201 * Get a base projection by id. 202 * 203 * @param id the id, for example "lonlat" or "tmerc" 204 * @return the corresponding base projection if the id is known, null otherwise 205 */ 186 206 public static Proj getBaseProjection(String id) { 187 207 ProjFactory fac = projs.get(id); … … 190 210 } 191 211 212 /** 213 * Get an ellipsoid by id. 214 * 215 * @param id the id, for example "bessel" or "WGS84" 216 * @return the corresponding ellipsoid if the id is known, null otherwise 217 */ 192 218 public static Ellipsoid getEllipsoid(String id) { 193 219 return ellipsoids.get(id); 194 220 } 195 221 222 /** 223 * Get a geodetic datum by id. 224 * 225 * @param id the id, for example "potsdam" or "WGS84" 226 * @return the corresponding datum if the id is known, null otherwise 227 */ 196 228 public static Datum getDatum(String id) { 197 229 return datums.get(id); 198 230 } 199 231 232 /** 233 * Get a NTV2 grid database by id. 234 * @param id the id 235 * @return the corresponding NTV2 grid if the id is known, null otherwise 236 */ 200 237 public static NTV2GridShiftFileWrapper getNTV2Grid(String id) { 201 238 return nadgrids.get(id); … … 203 240 204 241 /** 205 * Get the projection definition string for the given id.206 * @param id the id242 * Get the projection definition string for the given code. 243 * @param code the code 207 244 * @return the string that can be processed by #{link CustomProjection}. 208 * Null, if the idisn't supported.209 */ 210 public static String getInit(String id) {211 ProjectionDefinition pd = inits.get( id.toUpperCase(Locale.ENGLISH));245 * Null, if the code isn't supported. 246 */ 247 public static String getInit(String code) { 248 ProjectionDefinition pd = inits.get(code.toUpperCase(Locale.ENGLISH)); 212 249 if (pd == null) return null; 213 250 return pd.definition; … … 260 297 } 261 298 299 /** 300 * Get a projection by code. 301 * @param code the code, e.g. "EPSG:2026" 302 * @return the corresponding projection, if the code is known, null otherwise 303 */ 262 304 public static Projection getProjectionByCode(String code) { 263 305 Projection proj = projectionsByCode_cache.get(code); … … 293 335 } 294 336 337 /** 338 * Get a list of ids of all registered base projections. 339 * 340 * @return all registered base projection ids 341 * @see #getBaseProjection(java.lang.String) 342 */ 343 public static Collection<String> getAllBaseProjectionIds() { 344 return projs.keySet(); 345 } 346 295 347 private static String listKeys(Map<String, ?> map) { 296 348 List<String> keys = new ArrayList<>(map.keySet());
Note:
See TracChangeset
for help on using the changeset viewer.