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.EastNorth;
008    import org.openstreetmap.josm.data.coor.LatLon;
009    
010    /**
011     * Directly use latitude / longitude values as x/y.
012     *
013     * @author imi
014     */
015    public class Epsg4326 implements Projection {
016    
017        public EastNorth latlon2eastNorth(LatLon p) {
018            return new EastNorth(p.lon(), p.lat());
019        }
020    
021        public LatLon eastNorth2latlon(EastNorth p) {
022            return new LatLon(p.north(), p.east());
023        }
024    
025        @Override public String toString() {
026            return tr("WGS84 Geographic");
027        }
028    
029        public String toCode() {
030            return "EPSG:4326";
031        }
032    
033        @Override
034        public int hashCode() {
035            return getClass().getName().hashCode(); // we have no variables
036        }
037    
038        public String getCacheDirectoryName() {
039            return "epsg4326";
040        }
041    
042        public Bounds getWorldBoundsLatLon()
043        {
044            return new Bounds(
045                    new LatLon(-90.0, -180.0),
046                    new LatLon(90.0, 180.0), false);
047        }
048    
049        public double getDefaultZoomInPPD() {
050            // This will set the scale bar to about 100 km
051            return 0.009;
052        }
053    }