001 //License: GPL. For details, see LICENSE file. 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.ThreeParameterDatum; 009 import org.openstreetmap.josm.data.projection.proj.ProjParameters; 010 import org.openstreetmap.josm.data.projection.proj.SwissObliqueMercator; 011 012 /** 013 * SwissGrid CH1903 / L03, see http://de.wikipedia.org/wiki/Swiss_Grid. 014 * 015 * Actually, what we have here, is CH1903+ (EPSG:2056), but without 016 * the additional false easting of 2000km and false northing 1000 km. 017 * 018 * To get to CH1903, a shift file is required. So currently, there are errors 019 * up to 1.6m (depending on the location). 020 * 021 * This projection does not have any parameters, it only implements 022 * ProjectionSubPrefs to show a warning that the grid file correction is not done. 023 */ 024 public class SwissGrid extends AbstractProjection { 025 026 public SwissGrid() { 027 ellps = Ellipsoid.Bessel1841; 028 datum = new ThreeParameterDatum("SwissGrid Datum", null, ellps, 674.374, 15.056, 405.346); 029 x_0 = 600000; 030 y_0 = 200000; 031 lon_0 = 7.0 + 26.0/60 + 22.50/3600; 032 proj = new SwissObliqueMercator(); 033 try { 034 proj.initialize(new ProjParameters() {{ 035 ellps = SwissGrid.this.ellps; 036 lat_0 = 46.0 + 57.0/60 + 8.66/3600; 037 }}); 038 } catch (ProjectionConfigurationException e) { 039 throw new RuntimeException(e); 040 } 041 } 042 043 @Override 044 public String toString() { 045 return tr("Swiss Grid (Switzerland)"); 046 } 047 048 @Override 049 public Integer getEpsgCode() { 050 return 21781; 051 } 052 053 @Override 054 public int hashCode() { 055 return getClass().getName().hashCode(); // we have no variables 056 } 057 058 @Override 059 public String getCacheDirectoryName() { 060 return "swissgrid"; 061 } 062 063 @Override 064 public Bounds getWorldBoundsLatLon() { 065 return new Bounds(new LatLon(45.7, 5.7), new LatLon(47.9, 10.6), false); 066 } 067 068 }