source: josm/trunk/src/org/openstreetmap/josm/data/projection/Epsg3008.java@ 4225

Last change on this file since 4225 was 3692, checked in by bastiK, 13 years ago

applied #5681 (patch by Hanno Hecker) - fix to SWEREF99 / EPSG:3008 projection

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.data.Bounds;
7import org.openstreetmap.josm.data.coor.LatLon;
8import org.openstreetmap.josm.data.coor.EastNorth;
9
10/**
11 * SWEREF99 13 30 projection. Based on data from spatialreference.org.
12 * http://spatialreference.org/ref/epsg/3008/
13 *
14 * @author Hanno Hecker, based on the TransverseMercatorLV.java by Viesturs Zarins
15 */
16public class Epsg3008 extends TransverseMercator {
17
18 private final static double UTMScaleFactor = 1.0;
19 private double UTMCentralMeridianRad;
20 private double offsetEastMeters = 150000;
21 private double offsetNorthMeters = 0;
22
23 public Epsg3008()
24 {
25 UTMCentralMeridianRad = Math.toRadians(13.5);
26 }
27
28 @Override public String toString() {
29 return tr("SWEREF99 13 30 / EPSG:3008 (Sweden)");
30 }
31
32 private int epsgCode() {
33 return 3008;
34 }
35
36 @Override
37 public String toCode() {
38 return "EPSG:"+ epsgCode();
39 }
40
41 @Override
42 public int hashCode() {
43 return toCode().hashCode();
44 }
45
46 public String getCacheDirectoryName() {
47 return "epsg"+ epsgCode();
48 }
49
50 @Override
51 public Bounds getWorldBoundsLatLon() {
52 return new Bounds(
53 new LatLon(55.2, 12.1), // new LatLon(-90.0, -180.0),
54 new LatLon(62.26, 14.65)); // new LatLon(90.0, 180.0));
55 }
56
57 @Override
58 public EastNorth latlon2eastNorth(LatLon p) {
59 EastNorth a = mapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridianRad);
60 return new EastNorth(a.east() * UTMScaleFactor + offsetEastMeters, a.north() * UTMScaleFactor + offsetNorthMeters);
61 }
62
63 @Override
64 public LatLon eastNorth2latlon(EastNorth p) {
65 return mapXYToLatLon((p.east() - offsetEastMeters)/UTMScaleFactor, (p.north() - offsetNorthMeters)/UTMScaleFactor, UTMCentralMeridianRad);
66 }
67
68}
Note: See TracBrowser for help on using the repository browser.