1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.data.projection;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.data.Bounds;
|
---|
7 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
8 | import org.openstreetmap.josm.data.projection.datum.WGS84Datum;
|
---|
9 | import org.openstreetmap.josm.data.projection.proj.ProjParameters;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Mercator Projection
|
---|
13 | *
|
---|
14 | * The center of the mercator projection is always the 0 grad
|
---|
15 | * coordinate.
|
---|
16 | *
|
---|
17 | * See also USGS Bulletin 1532
|
---|
18 | * (http://egsc.usgs.gov/isb/pubs/factsheets/fs08799.html)
|
---|
19 | *
|
---|
20 | * @author imi
|
---|
21 | */
|
---|
22 | public class Mercator extends AbstractProjection {
|
---|
23 |
|
---|
24 | public Mercator() {
|
---|
25 | ellps = Ellipsoid.WGS84;
|
---|
26 | datum = WGS84Datum.INSTANCE;
|
---|
27 | proj = new org.openstreetmap.josm.data.projection.proj.Mercator();
|
---|
28 | try {
|
---|
29 | proj.initialize(new ProjParameters());
|
---|
30 | } catch (ProjectionConfigurationException e) {
|
---|
31 | throw new RuntimeException(e);
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public String toString() {
|
---|
37 | return tr("Mercator");
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public Integer getEpsgCode() {
|
---|
42 | /* initially they used 3785 but that has been superseded,
|
---|
43 | * see http://www.epsg-registry.org/ */
|
---|
44 | return 3857;
|
---|
45 | }
|
---|
46 |
|
---|
47 | @Override
|
---|
48 | public int hashCode() {
|
---|
49 | return getClass().getName().hashCode(); // we have no variables
|
---|
50 | }
|
---|
51 |
|
---|
52 | @Override
|
---|
53 | public String getCacheDirectoryName() {
|
---|
54 | return "mercator";
|
---|
55 | }
|
---|
56 |
|
---|
57 | @Override
|
---|
58 | public Bounds getWorldBoundsLatLon()
|
---|
59 | {
|
---|
60 | return new Bounds(
|
---|
61 | new LatLon(-85.05112877980659, -180.0),
|
---|
62 | new LatLon(85.05112877980659, 180.0), false);
|
---|
63 | }
|
---|
64 |
|
---|
65 | }
|
---|