source: josm/trunk/src/org/openstreetmap/josm/data/projection/Mercator.java @ 5241

Revision 5235, 1.7 KB checked in by bastiK, 9 days ago (diff)

no rounding for projection bounds, to avoid 42 being dispayed as 41.99999999999

  • Property svn:eol-style set to native
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
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.projection.datum.WGS84Datum;
9import 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 */
22public 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}
Note: See TracBrowser for help on using the repository browser.