001 // License: GPL. Copyright 2007 by Immanuel Scholz and others 002 package org.openstreetmap.josm.data.projection; 003 004 import static org.openstreetmap.josm.tools.I18n.tr; 005 006 import org.openstreetmap.josm.data.Bounds; 007 import org.openstreetmap.josm.data.coor.LatLon; 008 import org.openstreetmap.josm.data.projection.datum.WGS84Datum; 009 import org.openstreetmap.josm.data.projection.proj.ProjParameters; 010 011 /** 012 * Mercator Projection 013 * 014 * The center of the mercator projection is always the 0 grad 015 * coordinate. 016 * 017 * See also USGS Bulletin 1532 018 * (http://egsc.usgs.gov/isb/pubs/factsheets/fs08799.html) 019 * 020 * @author imi 021 */ 022 public class Mercator extends AbstractProjection { 023 024 public Mercator() { 025 ellps = Ellipsoid.WGS84; 026 datum = WGS84Datum.INSTANCE; 027 proj = new org.openstreetmap.josm.data.projection.proj.Mercator(); 028 try { 029 proj.initialize(new ProjParameters()); 030 } catch (ProjectionConfigurationException e) { 031 throw new RuntimeException(e); 032 } 033 } 034 035 @Override 036 public String toString() { 037 return tr("Mercator"); 038 } 039 040 @Override 041 public Integer getEpsgCode() { 042 /* initially they used 3785 but that has been superseded, 043 * see http://www.epsg-registry.org/ */ 044 return 3857; 045 } 046 047 @Override 048 public int hashCode() { 049 return getClass().getName().hashCode(); // we have no variables 050 } 051 052 @Override 053 public String getCacheDirectoryName() { 054 return "mercator"; 055 } 056 057 @Override 058 public Bounds getWorldBoundsLatLon() 059 { 060 return new Bounds( 061 new LatLon(-85.05112877980659, -180.0), 062 new LatLon(85.05112877980659, 180.0), false); 063 } 064 065 }