| 1 | //License: GPL. For details, see LICENSE file. |
|---|
| 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.ThreeParameterDatum; |
|---|
| 9 | import org.openstreetmap.josm.data.projection.proj.ProjParameters; |
|---|
| 10 | import org.openstreetmap.josm.data.projection.proj.SwissObliqueMercator; |
|---|
| 11 | |
|---|
| 12 | /** |
|---|
| 13 | * SwissGrid CH1903 / L03, see http://de.wikipedia.org/wiki/Swiss_Grid. |
|---|
| 14 | * |
|---|
| 15 | * Actually, what we have here, is CH1903+ (EPSG:2056), but without |
|---|
| 16 | * the additional false easting of 2000km and false northing 1000 km. |
|---|
| 17 | * |
|---|
| 18 | * To get to CH1903, a shift file is required. So currently, there are errors |
|---|
| 19 | * up to 1.6m (depending on the location). |
|---|
| 20 | * |
|---|
| 21 | * This projection does not have any parameters, it only implements |
|---|
| 22 | * ProjectionSubPrefs to show a warning that the grid file correction is not done. |
|---|
| 23 | */ |
|---|
| 24 | public class SwissGrid extends AbstractProjection { |
|---|
| 25 | |
|---|
| 26 | public SwissGrid() { |
|---|
| 27 | ellps = Ellipsoid.Bessel1841; |
|---|
| 28 | datum = new ThreeParameterDatum("SwissGrid Datum", null, ellps, 674.374, 15.056, 405.346); |
|---|
| 29 | x_0 = 600000; |
|---|
| 30 | y_0 = 200000; |
|---|
| 31 | lon_0 = 7.0 + 26.0/60 + 22.50/3600; |
|---|
| 32 | proj = new SwissObliqueMercator(); |
|---|
| 33 | try { |
|---|
| 34 | proj.initialize(new ProjParameters() {{ |
|---|
| 35 | ellps = SwissGrid.this.ellps; |
|---|
| 36 | lat_0 = 46.0 + 57.0/60 + 8.66/3600; |
|---|
| 37 | }}); |
|---|
| 38 | } catch (ProjectionConfigurationException e) { |
|---|
| 39 | throw new RuntimeException(e); |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | @Override |
|---|
| 44 | public String toString() { |
|---|
| 45 | return tr("Swiss Grid (Switzerland)"); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | @Override |
|---|
| 49 | public Integer getEpsgCode() { |
|---|
| 50 | return 21781; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | @Override |
|---|
| 54 | public int hashCode() { |
|---|
| 55 | return getClass().getName().hashCode(); // we have no variables |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | @Override |
|---|
| 59 | public String getCacheDirectoryName() { |
|---|
| 60 | return "swissgrid"; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | @Override |
|---|
| 64 | public Bounds getWorldBoundsLatLon() { |
|---|
| 65 | return new Bounds(new LatLon(45.7, 5.7), new LatLon(47.9, 10.6), false); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | } |
|---|