Revision 8783 branches/v10+Piloto/libraries/libCq_CMS_praster/src/org/cresques/cts/gt2/CSDatum.java
CSDatum.java | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
3 | 3 |
* |
4 |
* Copyright (C) 2004-5.
|
|
4 |
* Copyright (C) 2004-6.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
23 | 23 |
*/ |
24 | 24 |
package org.cresques.cts.gt2; |
25 | 25 |
|
26 |
import java.util.Locale; |
|
27 |
|
|
26 | 28 |
import org.cresques.cts.IDatum; |
27 |
|
|
28 | 29 |
import org.geotools.cs.CoordinateSystemFactory; |
29 | 30 |
import org.geotools.cs.GeographicCoordinateSystem; |
30 | 31 |
import org.geotools.cs.HorizontalDatum; |
31 |
|
|
32 | 32 |
import org.opengis.referencing.FactoryException; |
33 | 33 |
|
34 |
import java.util.Locale; |
|
35 | 34 |
|
36 |
|
|
37 | 35 |
/** |
38 | 36 |
* Datum (y Ellipsoid) de GeoTools2. |
39 | 37 |
* |
... | ... | |
89 | 87 |
private static String line8 = "DATUM[\"La Canoa\"," + |
90 | 88 |
"SPHEROID[\"International 1924\",6378388,297,AUTHORITY[\"EPSG\",\"7022\"]]," + |
91 | 89 |
"TOWGS84[-270.933,115.599,-360.226,-5.266,-1.238,2.381,-5.109],AUTHORITY[\"EPSG\",\"6288\"]]"; |
90 |
private static String line9 = "GEOGCS[\"NTF (Paris)\","+ |
|
91 |
"DATUM[\"Nouvelle_Triangulation_Francaise_Paris\"," + |
|
92 |
"SPHEROID[\"Clarke 1880 (IGN)\",6378249.2,293.4660212936269,AUTHORITY[\"EPSG\",\"7011\"]]," + |
|
93 |
"TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY[\"EPSG\",\"8903\"]]"+ |
|
94 |
",PRIMEM[\"Paris\",2.33722917,AUTHORITY[\"EPSG\",\"8903\"]]," + |
|
95 |
"UNIT[\"grad\",0.01570796326794897,AUTHORITY[\"EPSG\",\"9105\"]]," + |
|
96 |
"AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST]," + |
|
97 |
"AUTHORITY[\"EPSG\",\"4807\"]]"; |
|
98 |
|
|
99 |
private static String line10 = "GEOGCS[\"RGF93\"," + |
|
100 |
"DATUM[\"Reseau Geodesique Francais 1993\"," + |
|
101 |
"SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]]," + |
|
102 |
"TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6171\"]],"+ |
|
103 |
"PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]]," + |
|
104 |
"UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]]," + |
|
105 |
"AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST]," + |
|
106 |
"AUTHORITY[\"EPSG\",\"4171\"]]"; |
|
107 |
private static String line11 = "GEOGCS[\"ETRS89\","+ |
|
108 |
"DATUM[\"European_Terrestrial_Reference_System_1989\","+ |
|
109 |
"SPHEROID[\"GRS 1980\",6378137,298.257222101,"+ |
|
110 |
"AUTHORITY[\"EPSG\",\"7019\"]],"+ |
|
111 |
"AUTHORITY[\"EPSG\",\"6258\"]],"+ |
|
112 |
"PRIMEM[\"Greenwich\",0,"+ |
|
113 |
"AUTHORITY[\"EPSG\",\"8901\"]],"+ |
|
114 |
"UNIT[\"degree\",0.01745329251994328,"+ |
|
115 |
"AUTHORITY[\"EPSG\",\"9122\"]],"+ |
|
116 |
"AUTHORITY[\"EPSG\",\"4258\"]]"; |
|
117 |
//," + |
|
118 |
//"TOWGS84[0,0,0,0,0,0,0] |
|
119 |
private static String line12 = |
|
120 |
"GEOGCS[\"Mars 2000\","+ |
|
121 |
"DATUM[\"D_Mars_2000\","+ |
|
122 |
"SPHEROID[\"Mars_2000_IAU_IAG\",3396190.0, 169.89444722361179],"+ |
|
123 |
"TOWGS84[0,0,0,0,0,0,0]],"+ |
|
124 |
"PRIMEM[\"Greenwich\",0],"+ |
|
125 |
"UNIT[\"Decimal_Degree\",0.0174532925199433]]"; |
|
126 |
|
|
92 | 127 |
public final static CSDatum wgs84 = new CSDatum(line1); |
93 | 128 |
public final static CSDatum ed50 = new CSDatum(line2); |
94 | 129 |
public final static CSDatum ntf = new CSDatum(line3); |
... | ... | |
97 | 132 |
public final static CSDatum nad83 = new CSDatum(line6); |
98 | 133 |
public final static CSDatum lomaQuintana = new CSDatum(line7); |
99 | 134 |
public final static CSDatum laCanoa = new CSDatum(line8); |
135 |
public static CSDatum etrs89 = null; |
|
136 |
public static CSDatum ntfParis = null; |
|
137 |
public static CSDatum posgar = null; |
|
138 |
public static CSDatum rgf93 = null; |
|
139 |
public static CSDatum mars = null; |
|
140 |
public static CSDatum moon = null; |
|
100 | 141 |
private String sGeo1 = "GEOGCS[\"WGS 84\","; |
101 | 142 |
private String sGeo2 = |
102 | 143 |
",PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]]," + |
... | ... | |
104 | 145 |
"AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST]," + |
105 | 146 |
"AUTHORITY[\"EPSG\",\"4326\"]]"; |
106 | 147 |
private HorizontalDatum datum = null; |
148 |
static { |
|
149 |
try { |
|
150 |
ntfParis = new CSDatum().fromWKT(line9); |
|
151 |
rgf93 = new CSDatum().fromWKT(line10); |
|
152 |
etrs89 = new CSDatum().fromWKT(line11); |
|
153 |
posgar = new CSDatum().fromWKT( |
|
154 |
"GEOGCS[\"POSGAR\","+ |
|
155 |
"DATUM[\"POSGAR\"," + |
|
156 |
"SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]]," + |
|
157 |
"TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6269\"]]"+ |
|
158 |
",PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]]," + |
|
159 |
"UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]]," + |
|
160 |
"AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST]," + |
|
161 |
"AUTHORITY[\"EPSG\",\"4172\"]]"); |
|
162 |
mars = new CSDatum().fromWKT(line12); |
|
163 |
moon = new CSDatum().fromWKT( |
|
164 |
"GEOGCS[\"Moon 2000\"," + |
|
165 |
"DATUM[\"D_Moon_2000\"," + |
|
166 |
"SPHEROID[\"Moon_2000_IAU_IAG\",1737400.0, 0.0]," + |
|
167 |
"TOWGS84[0,0,0,0,0,0,0]],"+ |
|
168 |
"PRIMEM[\"Greenwich\",0]," + |
|
169 |
"UNIT[\"Decimal_Degree\",0.0174532925199433]]"); |
|
170 |
} catch (FactoryException e) { |
|
171 |
// TODO Auto-generated catch block |
|
172 |
e.printStackTrace(); |
|
173 |
} |
|
174 |
} |
|
107 | 175 |
|
176 |
public CSDatum() { |
|
177 |
} |
|
178 |
|
|
179 |
public CSDatum(HorizontalDatum datum) { |
|
180 |
this.datum = datum; |
|
181 |
} |
|
182 |
|
|
108 | 183 |
public CSDatum(String sDatum) { |
109 | 184 |
try { |
110 |
datum = ((GeographicCoordinateSystem) CoordinateSystemFactory.getDefault() |
|
111 |
.createFromWKT(sGeo1 + |
|
112 |
sDatum + |
|
113 |
sGeo2)).getHorizontalDatum(); |
|
185 |
fromWKT(sGeo1 + sDatum + sGeo2); |
|
114 | 186 |
} catch (FactoryException e) { |
115 | 187 |
// TODO Bloque catch generado autom?ticamente |
116 | 188 |
e.printStackTrace(); |
117 | 189 |
} |
118 | 190 |
} |
191 |
|
|
192 |
public CSDatum fromWKT(String s) throws FactoryException { |
|
193 |
datum = ((GeographicCoordinateSystem) CoordinateSystemFactory.getDefault() |
|
194 |
.createFromWKT(s)).getHorizontalDatum(); |
|
195 |
return this; |
|
196 |
} |
|
119 | 197 |
|
120 | 198 |
public String getName(Locale loc) { |
121 | 199 |
return datum.getName().toString(); |
Also available in: Unified diff