source: josm/trunk/src/org/openstreetmap/josm/data/projection/SwissGrid.java@ 4305

Last change on this file since 4305 was 4285, checked in by bastiK, 13 years ago

major projection rework

More modular structure, inspired by Proj.4.

There are almost no semantic changes to the projection algorithms. Mostly factors of 'a' and 180/PI have been moved from one place to the other. In UTM_France_DOM, the ellipsoid conversion for the first 3 projections has been changed from hayford <-> GRS80 to hayford <-> WGS84.

Some redundant algorithms have been removed. In particular:

  • UTM_France_DOM used to have its own Transverse Mercator implementation. It is different from the implementation in TransverseMercator.java as it has another series expansion. For EPSG::2975, there are numeric differences on centimeter scale. However, the new data fits better with Proj.4 output.
  • Also removed are alternate implementations of LambertConformalConic. (They are all quite similar, though.)
  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1//License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionListener;
7import java.util.Collection;
8import java.util.Collections;
9
10import javax.swing.Box;
11import javax.swing.JPanel;
12
13import org.openstreetmap.josm.data.Bounds;
14import org.openstreetmap.josm.data.coor.LatLon;
15import org.openstreetmap.josm.data.projection.datum.ThreeParameterDatum;
16import org.openstreetmap.josm.data.projection.proj.SwissObliqueMercator;
17import org.openstreetmap.josm.gui.widgets.HtmlPanel;
18import org.openstreetmap.josm.tools.GBC;
19
20/**
21 * SwissGrid CH1903 / L03, see http://de.wikipedia.org/wiki/Swiss_Grid.
22 *
23 * Actually, what we have here, is CH1903+ (EPSG:2056), but without
24 * the additional false easting of 2000km and false northing 1000 km.
25 *
26 * To get to CH1903, a shift file is required. So currently, there are errors
27 * up to 1.6m (depending on the location).
28 *
29 * This projection does not have any parameters, it only implements
30 * ProjectionSubPrefs to show a warning that the grid file correction is not done.
31 */
32public class SwissGrid extends AbstractProjection implements ProjectionSubPrefs {
33
34 public SwissGrid() {
35 ellps = Ellipsoid.Bessel1841;
36 datum = new ThreeParameterDatum("SwissGrid Datum", null, ellps, 674.374, 15.056, 405.346);
37 x_0 = 600000;
38 y_0 = 200000;
39 lon_0 = 7.0 + 26.0/60 + 22.50/3600;
40 double lat_0 = 46.0 + 57.0/60 + 8.66/3600;
41 proj = new SwissObliqueMercator(ellps, lat_0);
42 }
43
44 @Override
45 public String toString() {
46 return tr("Swiss Grid (Switzerland)");
47 }
48
49 @Override
50 public Integer getEpsgCode() {
51 return 21781;
52 }
53
54 @Override
55 public int hashCode() {
56 return getClass().getName().hashCode(); // we have no variables
57 }
58
59 @Override
60 public String getCacheDirectoryName() {
61 return "swissgrid";
62 }
63
64 @Override
65 public Bounds getWorldBoundsLatLon() {
66 return new Bounds(new LatLon(45.7, 5.7), new LatLon(47.9, 10.6));
67 }
68
69 @Override
70 public void setupPreferencePanel(JPanel p, ActionListener listener) {
71 p.add(new HtmlPanel("<i>CH1903 / LV03 (without local corrections)</i>"), GBC.eol().fill(GBC.HORIZONTAL));
72 p.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
73 }
74
75 @Override
76 public void setPreferences(Collection<String> args) {
77 }
78
79 @Override
80 public Collection<String> getPreferences(JPanel p) {
81 return Collections.singletonList("CH1903");
82 }
83
84 @Override
85 public String[] allCodes() {
86 return new String[] { "EPSG:21781" };
87 }
88
89 @Override
90 public Collection<String> getPreferencesFromCode(String code) {
91 if ("EPSG:21781".equals(code))
92 return Collections.singletonList("CH1903");
93 return null;
94 }
95}
Note: See TracBrowser for help on using the repository browser.