Revision 46826
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/test/java/org/cresques/cts/AllTests.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.cts; |
|
25 |
|
|
26 |
import junit.framework.Test; |
|
27 |
import junit.framework.TestSuite; |
|
28 |
|
|
29 |
public class AllTests { |
|
30 |
|
|
31 |
public static Test suite() { |
|
32 |
TestSuite suite = new TestSuite("Test for org.cresques.cts"); |
|
33 |
//$JUnit-BEGIN$ |
|
34 |
|
|
35 |
//$JUnit-END$ |
|
36 |
return suite; |
|
37 |
} |
|
38 |
|
|
39 |
} |
|
0 | 40 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 3 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
30 |
|
|
31 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
32 |
<layout class="org.apache.log4j.PatternLayout"> |
|
33 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
34 |
</layout> |
|
35 |
</appender> |
|
36 |
|
|
37 |
<category name="org.gvsig.tools"> |
|
38 |
<priority value="DEBUG" /> |
|
39 |
</category> |
|
40 |
<category name="org.cresques"> |
|
41 |
<priority value="DEBUG" /> |
|
42 |
</category> |
|
43 |
<category name="org.gvsig.fmap.crs"> |
|
44 |
<priority value="DEBUG" /> |
|
45 |
</category> |
|
46 |
|
|
47 |
<root> |
|
48 |
<priority value="INFO" /> |
|
49 |
<appender-ref ref="CONSOLE" /> |
|
50 |
</root> |
|
51 |
</log4j:configuration> |
|
0 | 52 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/CresquesCtsLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl; |
|
25 |
|
|
26 |
import org.cresques.ProjectionLibrary; |
|
27 |
import org.cresques.impl.cts.ProjectionPool; |
|
28 |
|
|
29 |
import org.gvsig.fmap.crs.CRSFactory; |
|
30 |
import org.gvsig.tools.library.AbstractLibrary; |
|
31 |
import org.gvsig.tools.library.LibraryException; |
|
32 |
|
|
33 |
public class CresquesCtsLibrary extends AbstractLibrary { |
|
34 |
|
|
35 |
public void doRegistration() { |
|
36 |
registerAsImplementationOf(ProjectionLibrary.class,1); |
|
37 |
} |
|
38 |
|
|
39 |
protected void doInitialize() throws LibraryException { |
|
40 |
CRSFactory.registerCRSFactory( new ProjectionPool()); |
|
41 |
} |
|
42 |
|
|
43 |
protected void doPostInitialize() throws LibraryException { |
|
44 |
// Nothing to do |
|
45 |
} |
|
46 |
} |
|
0 | 47 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/wkt/WKT.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl.cts.wkt; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
|
|
28 |
/** |
|
29 |
* Generates a WKT from CRS parameters. |
|
30 |
* as, for example in |
|
31 |
* "GEOGCS[\"ETRS89\","+ |
|
32 |
"DATUM[\"European_Terrestrial_Reference_System_1989\","+ |
|
33 |
"SPHEROID[\"GRS 1980\",6378137,298.257222101,"+ |
|
34 |
"AUTHORITY[\"EPSG\",\"7019\"]],"+ |
|
35 |
"AUTHORITY[\"EPSG\",\"6258\"]," + |
|
36 |
"TOWGS84[0,0,0,0,0,0,0]],"+ |
|
37 |
"PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"+ |
|
38 |
"UNIT[\"degree\",0.01745329251994328, AUTHORITY[\"EPSG\",\"9122\"]],"+ |
|
39 |
"AUTHORITY[\"EPSG\",\"4258\"]]"; |
|
40 |
|
|
41 |
* @author Luis W. Sevilla <sevilla_lui@gva.es> |
|
42 |
* |
|
43 |
*/ |
|
44 |
public abstract class WKT { |
|
45 |
|
|
46 |
static class Authority { |
|
47 |
String name; |
|
48 |
String code; |
|
49 |
public Authority(String n, String c) { |
|
50 |
name = n; |
|
51 |
code = c; |
|
52 |
} |
|
53 |
public String toWKT() { |
|
54 |
return "AUTHORITY[\""+name+"\",\""+code+"\"]"; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
static class Parameter { |
|
59 |
protected String name; |
|
60 |
private String value; |
|
61 |
protected Authority authority; // optional |
|
62 |
|
|
63 |
public Parameter(String n) { |
|
64 |
name = n; |
|
65 |
} |
|
66 |
|
|
67 |
public Parameter(String n, String v) { |
|
68 |
name = n; |
|
69 |
value = v; |
|
70 |
} |
|
71 |
public Parameter(String n, Authority a) { |
|
72 |
name = n; |
|
73 |
authority = a; |
|
74 |
} |
|
75 |
|
|
76 |
public String toWKT() { |
|
77 |
String txt = "PARAMETER[\""+name+"\","+value; |
|
78 |
if (authority != null) |
|
79 |
txt += ","+authority.toWKT(); |
|
80 |
return txt + "]"; |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
static class Spheroid { |
|
85 |
String name; |
|
86 |
double semiMajor; |
|
87 |
double inverseFlattening; |
|
88 |
Authority authority = null; // optional |
|
89 |
|
|
90 |
public Spheroid(String n, double s, double f) { |
|
91 |
name = n; |
|
92 |
semiMajor = s; |
|
93 |
inverseFlattening = f; |
|
94 |
} |
|
95 |
public Spheroid(String n, double s, double f, Authority a) { |
|
96 |
name = n; |
|
97 |
semiMajor = s; |
|
98 |
inverseFlattening = f; |
|
99 |
authority = a; |
|
100 |
} |
|
101 |
public String toWKT() { |
|
102 |
String txt = "SPHEROID[\""+name+"\","+ |
|
103 |
semiMajor+","+inverseFlattening; |
|
104 |
if (authority != null) |
|
105 |
txt += ","+authority.toWKT(); |
|
106 |
return txt + "]"; |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 |
static class ToWGS84 { |
|
111 |
double dx = 0; |
|
112 |
double dy = 0; |
|
113 |
double dz = 0; |
|
114 |
double ex = 0; |
|
115 |
double ey = 0; |
|
116 |
double ez = 0; |
|
117 |
double ppm = 0; |
|
118 |
public ToWGS84() { |
|
119 |
} |
|
120 |
public ToWGS84(double dx, double dy, double dz, double ex, double ey, double ez, double ppm) { |
|
121 |
this.dx = dx; |
|
122 |
this.dy = dy; |
|
123 |
this.dz = dz; |
|
124 |
this.ex = ex; |
|
125 |
this.ey = ey; |
|
126 |
this.ez = ez; |
|
127 |
this.ppm = ppm; |
|
128 |
} |
|
129 |
public String toWKT() { |
|
130 |
return "TOWGS84["+dx+","+dy+","+dz+","+ex+","+ey+","+ez+","+ppm+"]"; |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
static class Datum { |
|
135 |
String name; |
|
136 |
Spheroid spheroid; |
|
137 |
ToWGS84 towgs84 = new ToWGS84(); // optional |
|
138 |
Authority authority; // optional |
|
139 |
public Datum(String n, Spheroid s) { |
|
140 |
init (n, s, new ToWGS84(), null); |
|
141 |
} |
|
142 |
public Datum(String n, Spheroid s, ToWGS84 t) { |
|
143 |
init (n, s, t, null); |
|
144 |
} |
|
145 |
public Datum(String n, Spheroid s, Authority a) { |
|
146 |
init (n, s, new ToWGS84(), a); |
|
147 |
} |
|
148 |
public Datum(String n, Spheroid s, ToWGS84 t, Authority a) { |
|
149 |
init (n, s, t, a); |
|
150 |
} |
|
151 |
private void init(String n, Spheroid s, |
|
152 |
ToWGS84 t, Authority a) { |
|
153 |
name = n; |
|
154 |
spheroid = s; |
|
155 |
towgs84 = t; |
|
156 |
authority = a; |
|
157 |
} |
|
158 |
public String toWKT() { |
|
159 |
String txt = "DATUM[\""+name+"\","+spheroid.toWKT(); |
|
160 |
if (towgs84 != null) |
|
161 |
txt += ","+towgs84.toWKT(); |
|
162 |
if (authority != null) |
|
163 |
txt += ","+authority.toWKT(); |
|
164 |
return txt+"]"; |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
static class PrimeM { |
|
169 |
String name; |
|
170 |
double longitude; |
|
171 |
Authority authority = null; // optional |
|
172 |
|
|
173 |
public PrimeM(String n, double l) { |
|
174 |
name = n; |
|
175 |
longitude = l; |
|
176 |
} |
|
177 |
|
|
178 |
public PrimeM(String n, double l, Authority a) { |
|
179 |
name = n; |
|
180 |
longitude = l; |
|
181 |
authority = a; |
|
182 |
} |
|
183 |
|
|
184 |
public String toWKT() { |
|
185 |
String txt = "PRIMEM[\""+name+"\","+longitude; |
|
186 |
if (authority != null) |
|
187 |
txt += ","+authority.toWKT(); |
|
188 |
return txt + "]"; |
|
189 |
} |
|
190 |
} |
|
191 |
|
|
192 |
static class Unit { |
|
193 |
String name; |
|
194 |
double conversionFactor; |
|
195 |
Authority authority; // optional |
|
196 |
|
|
197 |
public Unit(String n, double l) { |
|
198 |
name = n; |
|
199 |
conversionFactor = l; |
|
200 |
} |
|
201 |
|
|
202 |
public Unit(String n, double l, Authority a) { |
|
203 |
name = n; |
|
204 |
conversionFactor = l; |
|
205 |
authority = a; |
|
206 |
} |
|
207 |
|
|
208 |
public String toWKT() { |
|
209 |
String txt = "UNIT[\""+name+"\","+conversionFactor; |
|
210 |
if (authority != null) |
|
211 |
txt += ","+authority.toWKT(); |
|
212 |
return txt + "]"; |
|
213 |
} |
|
214 |
} |
|
215 |
|
|
216 |
static class Orientation { |
|
217 |
public final static int NORTH = 0; |
|
218 |
public final static int SOUTH = 1; |
|
219 |
public final static int EAST = 2; |
|
220 |
public final static int WEST = 3; |
|
221 |
public final static int UP = 4; |
|
222 |
public final static int DOWN = 5; |
|
223 |
public final static int OTHER = 6; |
|
224 |
protected final String [] txt = { |
|
225 |
"NORTH","SOUTH","EAST","WEST","UP","DOWN","OTHER" |
|
226 |
}; |
|
227 |
protected int to = -1; |
|
228 |
|
|
229 |
public Orientation(int to) { |
|
230 |
this.to = to; |
|
231 |
} |
|
232 |
} |
|
233 |
|
|
234 |
static class Axis extends Orientation { |
|
235 |
String name; |
|
236 |
|
|
237 |
public Axis(String name, int to) { |
|
238 |
super(to); |
|
239 |
this.name = name; |
|
240 |
} |
|
241 |
|
|
242 |
public String toWKT() { |
|
243 |
return "AXIS[\""+name+"\","+txt[to]+ "]"; |
|
244 |
} |
|
245 |
} |
|
246 |
|
|
247 |
static class TwinAxes { |
|
248 |
Axis axe1; |
|
249 |
Axis axe2; |
|
250 |
|
|
251 |
public TwinAxes(Axis a1, Axis a2) { |
|
252 |
axe1 = a1; |
|
253 |
axe2 = a2; |
|
254 |
} |
|
255 |
|
|
256 |
public String toWKT() { |
|
257 |
return axe1.toWKT()+","+axe2.toWKT(); |
|
258 |
} |
|
259 |
|
|
260 |
} |
|
261 |
|
|
262 |
static class GeogCS extends WKT { |
|
263 |
String name; |
|
264 |
Datum datum; |
|
265 |
PrimeM primeMeridian; |
|
266 |
Unit unit; |
|
267 |
TwinAxes axes = null; // optional |
|
268 |
Authority authority = null; // optional |
|
269 |
|
|
270 |
public GeogCS(String n, Datum d, PrimeM p, Unit u) { |
|
271 |
init(n, d, p, u, null, null); |
|
272 |
} |
|
273 |
|
|
274 |
public GeogCS(String n, Datum d, PrimeM p, Unit u, |
|
275 |
Authority a) { |
|
276 |
init(n, d, p, u, null, a); |
|
277 |
} |
|
278 |
|
|
279 |
public GeogCS(String n, Datum d, PrimeM p, Unit u, |
|
280 |
TwinAxes t) { |
|
281 |
init(n, d, p, u, t, null); |
|
282 |
} |
|
283 |
|
|
284 |
public GeogCS(String n, Datum d, PrimeM p, Unit u, |
|
285 |
TwinAxes t, Authority a) { |
|
286 |
init(n, d, p, u, t, a); |
|
287 |
} |
|
288 |
|
|
289 |
private void init(String n, Datum d, PrimeM p, Unit u, |
|
290 |
TwinAxes t, Authority a) { |
|
291 |
name = n; |
|
292 |
datum = d; |
|
293 |
primeMeridian = p; |
|
294 |
unit = u; |
|
295 |
axes = t; |
|
296 |
authority = a; |
|
297 |
} |
|
298 |
|
|
299 |
public String toWKT() { |
|
300 |
String txt = "GEOGCS[\""+name+"\","+datum.toWKT()+ |
|
301 |
","+primeMeridian.toWKT()+","+unit.toWKT(); |
|
302 |
if (axes != null) |
|
303 |
txt += ","+axes.toWKT(); |
|
304 |
if (authority != null) |
|
305 |
txt += ","+authority.toWKT(); |
|
306 |
return txt+"]"; |
|
307 |
} |
|
308 |
} |
|
309 |
|
|
310 |
static class Projection extends Parameter { |
|
311 |
public Projection(String n) { |
|
312 |
super(n); |
|
313 |
} |
|
314 |
|
|
315 |
public Projection(String n, Authority a) { |
|
316 |
super(n,a); |
|
317 |
} |
|
318 |
|
|
319 |
public String toWKT() { |
|
320 |
String txt = "PROJECTION[\""+name+"\""; |
|
321 |
if (authority != null) |
|
322 |
txt += ","+authority.toWKT(); |
|
323 |
return txt + "]"; |
|
324 |
} |
|
325 |
} |
|
326 |
|
|
327 |
static class ProjCS extends Parameter { |
|
328 |
GeogCS geogcs; |
|
329 |
Projection proj; |
|
330 |
ArrayList params = new ArrayList(); |
|
331 |
Unit unit; |
|
332 |
TwinAxes axes = null; // optional |
|
333 |
|
|
334 |
public ProjCS(String n, GeogCS cs, Projection prj, Unit u ) { |
|
335 |
super(n); |
|
336 |
Parameter [] p = {}; |
|
337 |
init(n, cs, prj, p, u, null); |
|
338 |
} |
|
339 |
|
|
340 |
public ProjCS(String n, GeogCS cs, Projection prj, |
|
341 |
Parameter [] p, Unit u ) { |
|
342 |
super(n); |
|
343 |
init(n, cs, prj, p, u, null); |
|
344 |
} |
|
345 |
|
|
346 |
public ProjCS(String n, GeogCS cs, Projection prj, |
|
347 |
Unit u, TwinAxes t, Authority a ) { |
|
348 |
super(n, a); |
|
349 |
Parameter [] p = {}; |
|
350 |
init(n, cs, prj, p, u, t); |
|
351 |
} |
|
352 |
|
|
353 |
public ProjCS(String n, GeogCS cs, Projection prj, |
|
354 |
Parameter [] p, Unit u, TwinAxes t, Authority a ) { |
|
355 |
super(n, a); |
|
356 |
init(n, cs, prj, p, u, t); |
|
357 |
} |
|
358 |
|
|
359 |
private void init(String n, GeogCS cs, Projection prj, |
|
360 |
Parameter [] p, Unit u, TwinAxes t) { |
|
361 |
geogcs = cs; |
|
362 |
proj = prj; |
|
363 |
for (int i=0; i<p.length; i++) |
|
364 |
params.add(p[i]); |
|
365 |
unit = u; |
|
366 |
axes = t; |
|
367 |
} |
|
368 |
|
|
369 |
public void add(Parameter p) { |
|
370 |
params.add(p); |
|
371 |
} |
|
372 |
|
|
373 |
public String toWKT() { |
|
374 |
String txt = "PROJCS[\""+name+"\","+geogcs.toWKT()+ |
|
375 |
","+proj.toWKT(); |
|
376 |
for (int i=0; i<params.size();i++) |
|
377 |
txt += ","+((Parameter)params.get(i)).toWKT(); |
|
378 |
txt += ","+unit.toWKT(); |
|
379 |
if (axes != null) |
|
380 |
txt += ","+axes.toWKT(); |
|
381 |
if (authority != null) |
|
382 |
txt += ","+authority.toWKT(); |
|
383 |
return txt+"]"; |
|
384 |
} |
|
385 |
} |
|
386 |
|
|
387 |
abstract public String toWKT(); |
|
388 |
} |
|
0 | 389 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/ProjectionPool.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl.cts; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.Iterator; |
|
28 |
import java.util.Map; |
|
29 |
import java.util.TreeMap; |
|
30 |
|
|
31 |
import org.cresques.cts.ICRSFactory; |
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
import org.cresques.impl.cts.gt2.CSDatum; |
|
34 |
import org.cresques.impl.cts.gt2.CSGaussPt; |
|
35 |
import org.cresques.impl.cts.gt2.CSLambertCC; |
|
36 |
import org.cresques.impl.cts.gt2.CSMercator; |
|
37 |
import org.cresques.impl.cts.gt2.CSUTM; |
|
38 |
import org.cresques.impl.cts.gt2.CoordSys; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* Pool de proyeccions (cs+datum) conocidas. |
|
43 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
44 |
*/ |
|
45 |
public class ProjectionPool implements ICRSFactory { |
|
46 |
static TreeMap data = null; |
|
47 |
|
|
48 |
static { |
|
49 |
CoordSys cs = null; |
|
50 |
data = new TreeMap(); |
|
51 |
|
|
52 |
cs = (new CSUTM(CSDatum.wgs84, 30)).toGeo(); |
|
53 |
cs.setAbrev("EPSG:4326"); // WGS84 (World Geodesic Datum) |
|
54 |
data.put(cs.getAbrev(), cs); |
|
55 |
data.put("CRS:84", cs); // CRS:84 = EPSG:4326 |
|
56 |
|
|
57 |
cs = (new CSUTM(CSDatum.ed50, 30)).toGeo(); |
|
58 |
cs.setAbrev("EPSG:4230"); // Datum Europeu Internacional ED50 |
|
59 |
data.put(cs.getAbrev(), cs); |
|
60 |
|
|
61 |
cs = (new CSUTM(CSDatum.d73, 30)).toGeo(); |
|
62 |
cs.setAbrev("EPSG:4274"); // Datum 73 de Lisboa |
|
63 |
data.put(cs.getAbrev(), cs); |
|
64 |
|
|
65 |
cs = (new CSUTM(CSDatum.nad27, 30)).toGeo(); |
|
66 |
cs.setAbrev("EPSG:4267"); // NAD 27 |
|
67 |
data.put(cs.getAbrev(), cs); |
|
68 |
|
|
69 |
cs = (new CSUTM(CSDatum.nad83, 30)).toGeo(); |
|
70 |
cs.setAbrev("EPSG:4269"); // NAD 83 |
|
71 |
data.put(cs.getAbrev(), cs); |
|
72 |
|
|
73 |
cs = (new CSUTM(CSDatum.lomaQuintana, 30)).toGeo(); |
|
74 |
cs.setAbrev("EPSG:4288"); // PSAD 56 'Loma Quintana' |
|
75 |
data.put(cs.getAbrev(), cs); |
|
76 |
|
|
77 |
cs = (new CSUTM(CSDatum.laCanoa, 30)).toGeo(); |
|
78 |
cs.setAbrev("EPSG:4247"); // PSAD 56 'Loma Quintana' |
|
79 |
data.put(cs.getAbrev(), cs); |
|
80 |
|
|
81 |
cs = (new CSUTM(CSDatum.ntfParis, 30)).toGeo(); |
|
82 |
cs.setAbrev("EPSG:4807"); // NTF Paris |
|
83 |
data.put(cs.getAbrev(), cs); |
|
84 |
|
|
85 |
cs = (new CSUTM(CSDatum.etrs89, 30)).toGeo(); |
|
86 |
cs.setAbrev("EPSG:4258"); // ETRS 89 |
|
87 |
data.put(cs.getAbrev(), cs); |
|
88 |
for (int i = 1; i <= 60; i++) { |
|
89 |
String huso = Integer.toString(i); |
|
90 |
|
|
91 |
if (i < 10) { |
|
92 |
huso = "0" + huso; |
|
93 |
} |
|
94 |
|
|
95 |
cs = new CSUTM(CSDatum.wgs84, i); |
|
96 |
cs.setAbrev("EPSG:326" + huso); |
|
97 |
data.put(cs.getAbrev(), cs); |
|
98 |
|
|
99 |
cs = new CSUTM(CSDatum.ed50, i); |
|
100 |
cs.setAbrev("EPSG:230" + huso); |
|
101 |
data.put(cs.getAbrev(), cs); |
|
102 |
if (i>2 && i<=23) { |
|
103 |
cs = new CSUTM(CSDatum.nad27, i); |
|
104 |
cs.setAbrev("EPSG:267" + huso); |
|
105 |
data.put(cs.getAbrev(), cs); |
|
106 |
|
|
107 |
cs = new CSUTM(CSDatum.nad83, i); |
|
108 |
cs.setAbrev("EPSG:269" + huso); |
|
109 |
data.put(cs.getAbrev(), cs); |
|
110 |
} |
|
111 |
if (i>27 && i<39) { |
|
112 |
cs = new CSUTM(CSDatum.etrs89, i); |
|
113 |
cs.setAbrev("EPSG:258" + huso); |
|
114 |
data.put(cs.getAbrev(), cs); |
|
115 |
} |
|
116 |
} |
|
117 |
|
|
118 |
cs = CSGaussPt.hgd73; |
|
119 |
cs.setAbrev("EPSG:27492"); // Projec??o Gauss do Datum 73 de Lisboa (no EPSG found) |
|
120 |
data.put(cs.getAbrev(), cs); |
|
121 |
|
|
122 |
cs = new CSUTM(CSDatum.d73, 29); |
|
123 |
cs.setAbrev("EPSG:27429"); // Projec??o Gauss do Datum 73 de Lisboa (no EPSG found) |
|
124 |
data.put(cs.getAbrev(), cs); |
|
125 |
|
|
126 |
for (int i = 18; i <= 21; i++) { |
|
127 |
String huso = Integer.toString(i); |
|
128 |
|
|
129 |
if (i < 10) { |
|
130 |
huso = "0" + huso; |
|
131 |
} |
|
132 |
|
|
133 |
cs = new CSUTM(CSDatum.laCanoa, i); |
|
134 |
cs.setAbrev("EPSG:247" + huso); |
|
135 |
data.put(cs.getAbrev(), cs); |
|
136 |
} |
|
137 |
|
|
138 |
for (int i = 16; i <= 22; i++) { |
|
139 |
String huso = Integer.toString(i); |
|
140 |
// Psad56 Ecuador |
|
141 |
cs = new CSUTM(CSDatum.lomaQuintana, i); |
|
142 |
cs.setAbrev("EPSG:288" + huso); |
|
143 |
data.put(cs.getAbrev(), cs); |
|
144 |
cs = new CSUTM(CSDatum.lomaQuintana, i, "S"); |
|
145 |
cs.setAbrev("EPSG:288" + (i+60) ); |
|
146 |
data.put(cs.getAbrev(), cs); |
|
147 |
} |
|
148 |
|
|
149 |
// cs = new CSLambertCC(CSDatum.nad27, -105D, 49D, 49D, 77D, 0, 0); |
|
150 |
// cs.setAbrev("LCCCan"); |
|
151 |
// data.put(cs.getAbrev(), cs); |
|
152 |
/* Para el server WMS de canad?: |
|
153 |
* EPSG:42101 |
|
154 |
* EPSG:42304 |
|
155 |
* EPSG:4269 |
|
156 |
*/ |
|
157 |
/* |
|
158 |
* 42101,PROJCS["WGS 84 / LCC Canada", |
|
159 |
* GEOGCS["WGS 84",DATUM["WGS_1984", |
|
160 |
* SPHEROID["WGS_1984",6378137,298.257223563]], |
|
161 |
* PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]], |
|
162 |
* |
|
163 |
* PROJECTION["Lambert_Conformal_Conic_2SP"], |
|
164 |
* PARAMETER["central_meridian",-95.0], |
|
165 |
* PARAMETER["latitude_of_origin",0], |
|
166 |
* PARAMETER["standard_parallel_1",49.0], |
|
167 |
* PARAMETER["standard_parallel_2",77.0], |
|
168 |
* PARAMETER["false_easting",0.0], |
|
169 |
* PARAMETER["false_northing",-8000000.0], |
|
170 |
* UNIT["Meter",1],AUTHORITY["EPSG","42101"]] |
|
171 |
*/ |
|
172 |
cs = new CSLambertCC(CSDatum.wgs84, -95, 0, 49, 77, 0, -8000000.0); |
|
173 |
cs.setAbrev("EPSG:42101"); |
|
174 |
data.put(cs.getAbrev(), cs); |
|
175 |
|
|
176 |
/* 42304,PROJCS["NAD83 / NRCan LCC Canada", |
|
177 |
* GEOGCS["NAD83",DATUM["North_American_Datum_1983", |
|
178 |
* SPHEROID["GRS_1980",6378137,298.257222101]], |
|
179 |
* PRIMEM["Greenwich",0], |
|
180 |
* UNIT["Decimal_Degree",0.0174532925199433]], |
|
181 |
* |
|
182 |
* PROJECTION["Lambert_Conformal_Conic_2SP"], |
|
183 |
* PARAMETER["central_meridian",-95.0], |
|
184 |
* PARAMETER["latitude_of_origin",49.0], |
|
185 |
* PARAMETER["standard_parallel_1",49.0], |
|
186 |
* PARAMETER["standard_parallel_2",77.0], |
|
187 |
* PARAMETER["false_easting",0.0], |
|
188 |
* PARAMETER["false_northing",0.0], |
|
189 |
* UNIT["Meter",1],AUTHORITY["EPSG","42304"]] |
|
190 |
*/ |
|
191 |
cs = new CSLambertCC(CSDatum.nad83, -95, 49, 49, 77, 0, 0); |
|
192 |
cs.setAbrev("EPSG:42304"); |
|
193 |
data.put(cs.getAbrev(), cs); |
|
194 |
|
|
195 |
/* |
|
196 |
* EPSG:26915 - NAD83 / UTM zone 15N |
|
197 |
* EPSG:31466 - Gau?-Kr?ger band 2 |
|
198 |
* EPSG:31467 - Gau?-Kr?ger band 3 |
|
199 |
* EPSG:4314 - DHDN |
|
200 |
*/ |
|
201 |
/* |
|
202 |
* 27572=PROJCS["NTF (Paris) / Lambert zone II", |
|
203 |
GEOGCS["NTF (Paris)", |
|
204 |
DATUM["Nouvelle_Triangulation_Francaise_Paris", |
|
205 |
SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269, |
|
206 |
AUTHORITY["EPSG","7011"]], |
|
207 |
TOWGS84[-168,-60,320,0,0,0,0], |
|
208 |
AUTHORITY["EPSG","6807"]], |
|
209 |
PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]], |
|
210 |
UNIT["grad",0.01570796326794897,AUTHORITY["EPSG","9105"]], |
|
211 |
AUTHORITY["EPSG","4807"]], |
|
212 |
PROJECTION["Lambert_Conformal_Conic_1SP"], |
|
213 |
PARAMETER["latitude_of_origin",52], |
|
214 |
PARAMETER["central_meridian",0], |
|
215 |
PARAMETER["scale_factor",0.99987742], |
|
216 |
PARAMETER["false_easting",600000], |
|
217 |
PARAMETER["false_northing",2200000], |
|
218 |
UNIT["metre",1,AUTHORITY["EPSG","9001"]], |
|
219 |
AUTHORITY["EPSG","27572"]] |
|
220 |
*/ |
|
221 |
|
|
222 |
cs = new CSLambertCC(CSDatum.ntfParis, 0, 46.79999999999995, 0.99987742, 600000, 2200000); |
|
223 |
cs.setAbrev("EPSG:27572"); |
|
224 |
data.put(cs.getAbrev(), cs); |
|
225 |
|
|
226 |
cs = new CSLambertCC(CSDatum.ntfParis, 0, 52, 0.99987742, 600000, 2200000); |
|
227 |
cs.setAbrev("EPSG:27582"); |
|
228 |
data.put(cs.getAbrev(), cs); |
|
229 |
/* |
|
230 |
* # RGF93 |
|
231 |
* <4171> +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs <> |
|
232 |
* # RGF93 / Lambert-93 |
|
233 |
*/ |
|
234 |
cs = (new CSUTM(CSDatum.rgf93, 30)).toGeo(); |
|
235 |
cs.setAbrev("EPSG:4171"); // NTF Paris |
|
236 |
data.put(cs.getAbrev(), cs); |
|
237 |
/* |
|
238 |
* <2154> +proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 |
|
239 |
* +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 |
|
240 |
* +units=m +no_defs <> |
|
241 |
*/ |
|
242 |
cs = new CSLambertCC(CSDatum.rgf93, 3.0, 46.5, 49.0, 44.0, 700000.0, 6600000.0); |
|
243 |
cs.setAbrev("EPSG:2154"); |
|
244 |
data.put(cs.getAbrev(), cs); |
|
245 |
|
|
246 |
cs = new CSMercator(CSDatum.wgs84); |
|
247 |
cs.setAbrev("EPSG:54004"); |
|
248 |
data.put(cs.getAbrev(), cs); |
|
249 |
cs.setAbrev("EPSG:9804"); |
|
250 |
data.put(cs.getAbrev(), cs); |
|
251 |
|
|
252 |
// Lo que faltaba: ?planetas! |
|
253 |
cs = (new CSUTM(CSDatum.moon, 30)).toGeo(); |
|
254 |
cs.setAbrev("IAU2000:30100"); // Moon |
|
255 |
data.put(cs.getAbrev(), cs); |
|
256 |
|
|
257 |
cs = (new CSUTM(CSDatum.mars, 30)).toGeo(); |
|
258 |
cs.setAbrev("IAU2000:49900"); // Mars |
|
259 |
data.put(cs.getAbrev(), cs); |
|
260 |
|
|
261 |
/* |
|
262 |
* CRSs argentinos. |
|
263 |
* coordenadas geograficas |
|
264 |
PosGAr 4172 |
|
265 |
PosGAr98 4190 |
|
266 |
|
|
267 |
coordenadas proyectadas |
|
268 |
POSGAR 94/Argentina 1 22191 |
|
269 |
POSGAR 94/Argentina 2 22192 |
|
270 |
POSGAR 94/Argentina 3 22193 |
|
271 |
POSGAR 94/Argentina 4 22194 |
|
272 |
POSGAR 94/Argentina 5 22195 |
|
273 |
POSGAR 94/Argentina 6 22196 |
|
274 |
POSGAR 94/Argentina 7 22197 |
|
275 |
|
|
276 |
POSGAR 98/Argentina 1 22181 |
|
277 |
POSGAR 98/Argentina 2 22182 |
|
278 |
POSGAR 98/Argentina 3 22183 |
|
279 |
POSGAR 98/Argentina 4 22184 |
|
280 |
POSGAR 98/Argentina 5 22185 |
|
281 |
POSGAR 98/Argentina 6 22186 |
|
282 |
POSGAR 98/Argentina 7 22187 |
|
283 |
|
|
284 |
4221 GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] |
|
285 |
|
|
286 |
22191 EPSG 22191 PROJCS["Argentina_Zone_1",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-72],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-72 +k=1.000000 +x_0=1500000 +y_0=0 +ellps=intl +units=m |
|
287 |
22192 EPSG 22192 PROJCS["Argentina_Zone_2",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",2500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-69],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-69 +k=1.000000 +x_0=2500000 +y_0=0 +ellps=intl +units=m |
|
288 |
22193 EPSG 22193 PROJCS["Argentina_Zone_3",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",3500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-66],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-66 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=intl +units=m |
|
289 |
22194 EPSG 22194 PROJCS["Argentina_Zone_4",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",4500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-63],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-63 +k=1.000000 +x_0=4500000 +y_0=0 +ellps=intl +units=m |
|
290 |
22195 EPSG 22195 PROJCS["Argentina_Zone_5",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",5500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-60],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-60 +k=1.000000 +x_0=5500000 +y_0=0 +ellps=intl +units=m |
|
291 |
22196 EPSG 22196 PROJCS["Argentina_Zone_6",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",6500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-57],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-57 +k=1.000000 +x_0=6500000 +y_0=0 +ellps=intl +units=m |
|
292 |
22197 EPSG 22197 PROJCS["Argentina_Zone_7",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",7500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-54],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]] +proj=tmerc +lat_0=-90 +lon_0=-54 +k=1.000000 +x_0=7500000 +y_0=0 +ellps=intl +units=m |
|
293 |
|
|
294 |
*/ |
|
295 |
cs = new CoordSys(CSDatum.posgar); |
|
296 |
cs.setAbrev("EPSG:4172"); // Posgar |
|
297 |
data.put(cs.getAbrev(), cs); |
|
298 |
|
|
299 |
cs = new CoordSys( |
|
300 |
"GEOGCS[\"GCS_Campo_Inchauspe\"," + |
|
301 |
"DATUM[\"D_Campo_Inchauspe\"," + |
|
302 |
"SPHEROID[\"International_1924\",6378388,297],"+ |
|
303 |
"TOWGS84[0,0,0,0,0,0,0]]," + |
|
304 |
"PRIMEM[\"Greenwich\",0]," + |
|
305 |
"UNIT[\"Degree\",0.017453292519943295]]"); |
|
306 |
cs.setAbrev("EPSG:4221"); // Campo Inchauspe |
|
307 |
data.put(cs.getAbrev(), cs); |
|
308 |
|
|
309 |
for (int i=1; i<=7; i++) { |
|
310 |
cs = new CoordSys( |
|
311 |
"PROJCS[\"Argentina_Zone_"+i+"\"," + |
|
312 |
"GEOGCS[\"GCS_Campo_Inchauspe\"," + |
|
313 |
"DATUM[\"D_Campo_Inchauspe\"," + |
|
314 |
"SPHEROID[\"International_1924\",6378388,297],"+ |
|
315 |
"TOWGS84[0,0,0,0,0,0,0]]," + |
|
316 |
"PRIMEM[\"Greenwich\",0]," + |
|
317 |
"UNIT[\"Degree\",0.017453292519943295]]," + |
|
318 |
"PROJECTION[\"Transverse_Mercator\"]," + |
|
319 |
"PARAMETER[\"False_Easting\",1500000]," + |
|
320 |
"PARAMETER[\"False_Northing\",0]," + |
|
321 |
"PARAMETER[\"Central_Meridian\","+(-75+3*i)+"]," + |
|
322 |
"PARAMETER[\"Scale_Factor\",1]," + |
|
323 |
"PARAMETER[\"Latitude_Of_Origin\",-90]," + |
|
324 |
"UNIT[\"Meter\",1]]"); |
|
325 |
cs.setAbrev("EPSG:2219"+i); // Posgar |
|
326 |
data.put(cs.getAbrev(), cs); |
|
327 |
} |
|
328 |
|
|
329 |
/* |
|
330 |
* pendiente de a?adir: |
|
331 |
* |
|
332 |
* EPSG 3003: Montemario / Italy Zone 1 - Pendiente de a?adir |
|
333 |
* EPSG 4149: CH1903 - Pendiente de a?adir |
|
334 |
* Ecuador: |
|
335 |
* PSAD56, Geo, UTM 16/17S,16/17N |
|
336 |
*/ |
|
337 |
} |
|
338 |
|
|
339 |
/** |
|
340 |
* Mete una nueva proyeccion en la Pool. |
|
341 |
* @param name abreviatura de la proyecccion (i.e. EPSG:23030) |
|
342 |
* @param proj Proyeccion |
|
343 |
*/ |
|
344 |
public static void add(String name, IProjection proj) { |
|
345 |
data.put(name, proj); |
|
346 |
} |
|
347 |
|
|
348 |
/** |
|
349 |
* Devuelve una proyeccion a partir de una cadena. |
|
350 |
* @param name abreviatura de la proyecccion (i.e. EPSG:23030) |
|
351 |
* @return Proyeccion si existe |
|
352 |
*/ |
|
353 |
public IProjection get(String name) { |
|
354 |
IProjection proj = null; |
|
355 |
|
|
356 |
if (ProjectionPool.data.containsKey(name)) { |
|
357 |
proj = (IProjection) ProjectionPool.data.get(name); |
|
358 |
} else { |
|
359 |
// Consultation to remote EPSG database |
|
360 |
// if (right) |
|
361 |
// buil new IProjection from GML |
|
362 |
// else |
|
363 |
System.err.println("ProjectionPool: Key '" + name + "' not set."); |
|
364 |
} |
|
365 |
|
|
366 |
return proj; |
|
367 |
} |
|
368 |
|
|
369 |
public static Iterator iterator() { |
|
370 |
ArrayList projs = new ArrayList(); |
|
371 |
|
|
372 |
Iterator iter = data.entrySet().iterator(); |
|
373 |
|
|
374 |
while (iter.hasNext()) { |
|
375 |
projs.add(((Map.Entry) iter.next()).getValue()); |
|
376 |
} |
|
377 |
|
|
378 |
return projs.iterator(); |
|
379 |
} |
|
380 |
|
|
381 |
public boolean doesRigurousTransformations() { |
|
382 |
return false; |
|
383 |
} |
|
384 |
|
|
385 |
/* (non-Javadoc) |
|
386 |
* @see org.cresques.cts.ICRSFactory#get(java.lang.String, java.lang.String) |
|
387 |
*/ |
|
388 |
@Override |
|
389 |
public IProjection get(String format, String value) { |
|
390 |
// TODO Auto-generated method stub |
|
391 |
return null; |
|
392 |
} |
|
393 |
} |
|
0 | 394 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CoordSys.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl.cts.gt2; |
|
25 |
|
|
26 |
import java.awt.Color; |
|
27 |
import java.awt.Graphics2D; |
|
28 |
import java.awt.geom.Point2D; |
|
29 |
import java.awt.geom.Rectangle2D; |
|
30 |
|
|
31 |
import org.cresques.cts.ICoordTrans; |
|
32 |
import org.cresques.cts.IDatum; |
|
33 |
import org.cresques.cts.IProjection; |
|
34 |
import org.cresques.geo.ViewPortData; |
|
35 |
import org.geotools.cs.CoordinateSystem; |
|
36 |
import org.geotools.cs.CoordinateSystemFactory; |
|
37 |
import org.geotools.cs.GeographicCoordinateSystem; |
|
38 |
import org.geotools.cs.ProjectedCoordinateSystem; |
|
39 |
import org.opengis.referencing.FactoryException; |
|
40 |
|
|
41 |
import org.gvsig.fmap.crs.CRSFactory; |
|
42 |
|
|
43 |
|
|
44 |
/** |
|
45 |
* Sistema de Coordenadas (Proyecci?n). |
|
46 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
47 |
*/ |
|
48 |
public class CoordSys implements IProjection { |
|
49 |
private static final Color basicGridColor = new Color(64, 64, 64, 128); |
|
50 |
protected CoordinateSystemFactory csFactory = CoordinateSystemFactory.getDefault(); |
|
51 |
protected CSDatum datum = null; |
|
52 |
protected GeographicCoordinateSystem geogCS = null; |
|
53 |
protected ProjectedCoordinateSystem projCS = null; |
|
54 |
protected String abrev = ""; |
|
55 |
Color gridColor = basicGridColor; |
|
56 |
|
|
57 |
public CoordSys(CSDatum datum) { |
|
58 |
this.datum = datum; |
|
59 |
this.geogCS = new GeographicCoordinateSystem(datum.getName(null), datum.getDatum()); |
|
60 |
} |
|
61 |
|
|
62 |
public CoordSys(String wkt) { |
|
63 |
try { |
|
64 |
//((GeographicCoordinateSystem) |
|
65 |
CoordinateSystem cs = CoordinateSystemFactory.getDefault().createFromWKT(wkt); |
|
66 |
// ).getHorizontalDatum(); |
|
67 |
if (cs instanceof GeographicCoordinateSystem) |
|
68 |
geogCS = (GeographicCoordinateSystem) cs; |
|
69 |
if (cs instanceof ProjectedCoordinateSystem) { |
|
70 |
projCS = (ProjectedCoordinateSystem) cs; |
|
71 |
geogCS = projCS.getGeographicCoordinateSystem(); |
|
72 |
} |
|
73 |
datum = new CSDatum(geogCS.getHorizontalDatum()); |
|
74 |
} catch (FactoryException e) { |
|
75 |
// TODO Auto-generated catch block |
|
76 |
e.printStackTrace(); |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Crea un nuevo CoordSys geogr?fico a partir de uno proyectado. |
|
82 |
* Si el actual es geogr?fico retorna el mismo. |
|
83 |
* @return |
|
84 |
*/ |
|
85 |
public CoordSys toGeo() { |
|
86 |
CoordSys coordSys = new CoordSys((CSDatum) getDatum()); |
|
87 |
|
|
88 |
if (geogCS != null) { |
|
89 |
coordSys.geogCS = this.geogCS; |
|
90 |
} else { |
|
91 |
coordSys.geogCS = projCS.getGeographicCoordinateSystem(); |
|
92 |
} |
|
93 |
|
|
94 |
return coordSys; |
|
95 |
} |
|
96 |
|
|
97 |
public IDatum getDatum() { |
|
98 |
return datum; |
|
99 |
} |
|
100 |
|
|
101 |
public CoordinateSystem getCS() { |
|
102 |
if (projCS != null) { |
|
103 |
return projCS; |
|
104 |
} |
|
105 |
|
|
106 |
return geogCS; |
|
107 |
} |
|
108 |
|
|
109 |
public CoordinateSystem getGeogCS() { |
|
110 |
if (geogCS != null) { |
|
111 |
return geogCS; |
|
112 |
} |
|
113 |
|
|
114 |
return projCS.getGeographicCoordinateSystem(); |
|
115 |
} |
|
116 |
|
|
117 |
/* (no Javadoc) |
|
118 |
* @see org.cresques.cts.IProjection#createPoint(double, double) |
|
119 |
*/ |
|
120 |
public Point2D createPoint(double x, double y) { |
|
121 |
return new Point2D.Double(x, y); |
|
122 |
} |
|
123 |
|
|
124 |
public String toString() { |
|
125 |
if (projCS != null) { |
|
126 |
return projCS.toString(); |
|
127 |
} |
|
128 |
|
|
129 |
return geogCS.toString(); |
|
130 |
} |
|
131 |
|
|
132 |
public void setAbrev(String abrev) { |
|
133 |
this.abrev = abrev; |
|
134 |
} |
|
135 |
|
|
136 |
public String getAbrev() { |
|
137 |
return abrev; |
|
138 |
} |
|
139 |
|
|
140 |
/* (no Javadoc) |
|
141 |
* @see org.cresques.cts.IProjection#drawGrid(java.awt.Graphics2D, org.cresques.geo.ViewPortData) |
|
142 |
*/ |
|
143 |
public void drawGrid(Graphics2D g, ViewPortData vp) { |
|
144 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
145 |
} |
|
146 |
|
|
147 |
public void setGridColor(Color c) { |
|
148 |
gridColor = c; |
|
149 |
} |
|
150 |
|
|
151 |
public Color getGridColor() { |
|
152 |
return gridColor; |
|
153 |
} |
|
154 |
|
|
155 |
/* (no Javadoc) |
|
156 |
* @see org.cresques.cts.IProjection#toGeo(java.awt.geom.Point2D) |
|
157 |
*/ |
|
158 |
public Point2D toGeo(Point2D pt) { |
|
159 |
//TODO VCN Esto si no lo comento no me trasforma el punto en coordenadas geogr?ficas. |
|
160 |
// if (getGeogCS() == geogCS) { |
|
161 |
// return pt; |
|
162 |
// } else { |
|
163 |
CoordTrans ct = new CoordTrans(this, toGeo()); |
|
164 |
|
|
165 |
return ct.convert(pt, null); |
|
166 |
// } |
|
167 |
} |
|
168 |
|
|
169 |
/* (no Javadoc) |
|
170 |
* @see org.cresques.cts.IProjection#fromGeo(java.awt.geom.Point2D, java.awt.geom.Point2D) |
|
171 |
*/ |
|
172 |
public Point2D fromGeo(Point2D gPt, Point2D mPt) { |
|
173 |
// TODO Ap?ndice de m?todo generado autom?ticamente |
|
174 |
return null; |
|
175 |
} |
|
176 |
|
|
177 |
public double getScale(double minX, double maxX, double w, double dpi) { |
|
178 |
double scale = 0D; |
|
179 |
|
|
180 |
if (projCS == null) { // Es geogr?fico; calcula la escala. |
|
181 |
scale = ((maxX - minX) * // grados |
|
182 |
|
|
183 |
// 1852.0 metros x minuto de meridiano |
|
184 |
(dpi / 2.54 * 100.0 * 1852.0 * 60.0)) / // px / metro |
|
185 |
w; // pixels |
|
186 |
} |
|
187 |
|
|
188 |
return scale; |
|
189 |
} |
|
190 |
public Rectangle2D getExtent(Rectangle2D extent,double scale,double wImage,double hImage,double mapUnits,double distanceUnits,double dpi) { |
|
191 |
double w =0; |
|
192 |
double h =0; |
|
193 |
double wExtent =0; |
|
194 |
double hExtent =0; |
|
195 |
if (projCS!=null) { |
|
196 |
w = ((wImage / dpi) * 2.54); |
|
197 |
h = ((hImage / dpi) * 2.54); |
|
198 |
wExtent =w * scale*distanceUnits/ mapUnits; |
|
199 |
hExtent =h * scale*distanceUnits/ mapUnits; |
|
200 |
|
|
201 |
}else { |
|
202 |
w = ((wImage / dpi) * 2.54); |
|
203 |
h = ((hImage / dpi) * 2.54); |
|
204 |
wExtent =(w*scale*distanceUnits)/ (mapUnits*1852.0*60.0); |
|
205 |
hExtent =(h*scale*distanceUnits)/ (mapUnits*1852.0*60.0); |
|
206 |
} |
|
207 |
double xExtent = extent.getCenterX() - wExtent/2; |
|
208 |
double yExtent = extent.getCenterY() - hExtent/2; |
|
209 |
Rectangle2D rec=new Rectangle2D.Double(xExtent,yExtent,wExtent,hExtent); |
|
210 |
return rec; |
|
211 |
} |
|
212 |
public boolean isProjected() { |
|
213 |
return projCS != null; |
|
214 |
} |
|
215 |
|
|
216 |
public ICoordTrans getCT(IProjection dest) { |
|
217 |
return new CoordTrans(this, (CoordSys) dest); |
|
218 |
} |
|
219 |
|
|
220 |
public String getFullCode() { |
|
221 |
return getAbrev(); |
|
222 |
} |
|
223 |
|
|
224 |
public Object clone() throws CloneNotSupportedException { |
|
225 |
return CRSFactory.getCRS( this.getFullCode() ); |
|
226 |
} |
|
227 |
|
|
228 |
/* (non-Javadoc) |
|
229 |
* @see org.cresques.cts.IProjection#export(java.lang.String) |
|
230 |
*/ |
|
231 |
@Override |
|
232 |
public String export(String format) { |
|
233 |
// TODO Auto-generated method stub |
|
234 |
return null; |
|
235 |
} |
|
236 |
|
|
237 |
} |
|
0 | 238 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CSUTM.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl.cts.gt2; |
|
25 |
|
|
26 |
import org.cresques.cts.UTM; |
|
27 |
import org.geotools.cs.AxisInfo; |
|
28 |
import org.geotools.cs.Projection; |
|
29 |
import org.geotools.units.Unit; |
|
30 |
import org.gvsig.fmap.crs.CRSFactory; |
|
31 |
import org.opengis.referencing.FactoryException; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
36 |
*/ |
|
37 |
public class CSUTM extends CoordSys implements UTM { |
|
38 |
public CSUTM(CSDatum datum, int zone) { |
|
39 |
super(datum); |
|
40 |
init(datum, zone, "N"); |
|
41 |
} |
|
42 |
|
|
43 |
public CSUTM(CSDatum datum, int zone, String ns) { |
|
44 |
super(datum); |
|
45 |
init(datum, zone, ns); |
|
46 |
} |
|
47 |
|
|
48 |
public void init(CSDatum datum, int zone, String ns) { |
|
49 |
Unit linearUnit = Unit.METRE; |
|
50 |
|
|
51 |
javax.media.jai.ParameterList params = csFactory.createProjectionParameterList("Transverse_Mercator"); |
|
52 |
params.setParameter("semi_major", |
|
53 |
datum.getDatum().getEllipsoid().getSemiMajorAxis()); |
|
54 |
params.setParameter("semi_minor", |
|
55 |
datum.getDatum().getEllipsoid().getSemiMinorAxis()); |
|
56 |
params.setParameter("central_meridian", (double) ((zone * 6) - 183)); |
|
57 |
params.setParameter("latitude_of_origin", 0.0); |
|
58 |
params.setParameter("scale_factor", 0.9996); |
|
59 |
params.setParameter("false_easting", 500000.0); |
|
60 |
if (ns.toUpperCase().compareTo("S") == 0) |
|
61 |
params.setParameter("false_northing", 10000000.0); |
|
62 |
else |
|
63 |
params.setParameter("false_northing", 0.0); |
|
64 |
|
|
65 |
try { |
|
66 |
Projection projection = csFactory.createProjection("UTM" + zone, |
|
67 |
"Transverse_Mercator", |
|
68 |
params); |
|
69 |
projCS = csFactory.createProjectedCoordinateSystem(projection.getName() |
|
70 |
.toString(), |
|
71 |
geogCS, |
|
72 |
projection, |
|
73 |
linearUnit, |
|
74 |
AxisInfo.X, |
|
75 |
AxisInfo.Y); |
|
76 |
} catch (FactoryException e) { |
|
77 |
// TODO Bloque catch generado autom?ticamente |
|
78 |
e.printStackTrace(); |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
public double getScale(double minX, double maxX, double w, double dpi) { |
|
83 |
double scale = super.getScale(minX, maxX, w, dpi); |
|
84 |
|
|
85 |
if (projCS != null) { // Es geogr?fico; calcula la escala. |
|
86 |
scale = ((maxX - minX) * // metros |
|
87 |
(dpi / 2.54 * 100.0)) / // px / metro |
|
88 |
w; // pixels |
|
89 |
} |
|
90 |
|
|
91 |
return scale; |
|
92 |
} |
|
93 |
|
|
94 |
public String toString() { |
|
95 |
return projCS.toString(); |
|
96 |
} |
|
97 |
|
|
98 |
public Object clone() throws CloneNotSupportedException { |
|
99 |
return CRSFactory.getCRS( this.getFullCode() ); |
|
100 |
} |
|
101 |
|
|
102 |
} |
|
0 | 103 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CSGaussPt.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl.cts.gt2; |
|
25 |
|
|
26 |
import org.geotools.cs.AxisInfo; |
|
27 |
import org.geotools.cs.GeographicCoordinateSystem; |
|
28 |
import org.geotools.cs.Projection; |
|
29 |
|
|
30 |
import org.geotools.measure.Angle; |
|
31 |
|
|
32 |
import org.geotools.units.Unit; |
|
33 |
|
|
34 |
import org.opengis.referencing.FactoryException; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class CSGaussPt extends CoordSys { |
|
42 |
public static CSGaussPt hgd73 = new CSGaussPt(CSDatum.d73); |
|
43 |
|
|
44 |
public CSGaussPt(CSDatum datum) { |
|
45 |
super(datum); |
|
46 |
geogCS = new GeographicCoordinateSystem(datum.getName(null), |
|
47 |
datum.getDatum()); |
|
48 |
|
|
49 |
Unit linearUnit = Unit.METRE; |
|
50 |
|
|
51 |
javax.media.jai.ParameterList params = csFactory.createProjectionParameterList("Oblique_Stereographic"); |
|
52 |
params.setParameter("semi_major", |
|
53 |
datum.getDatum().getEllipsoid().getSemiMajorAxis()); |
|
54 |
params.setParameter("semi_minor", |
|
55 |
datum.getDatum().getEllipsoid().getSemiMinorAxis()); |
|
56 |
params.setParameter("central_meridian", |
|
57 |
(new Angle("8?07'54.862\"W")).degrees()); |
|
58 |
|
|
59 |
//params.setParameter("longitude_of_origin", (new Angle("8?07'54.862\"")).degrees()); |
|
60 |
params.setParameter("latitude_of_origin", |
|
61 |
(new Angle("39?40'N")).degrees()); |
|
62 |
params.setParameter("scale_factor", 1.0); |
|
63 |
params.setParameter("false_easting", 0D); //180598D); |
|
64 |
params.setParameter("false_northing", 0D); //-86990D); |
|
65 |
|
|
66 |
try { |
|
67 |
Projection projection = csFactory.createProjection("GAUSS", |
|
68 |
"Oblique_Stereographic", |
|
69 |
params); |
|
70 |
projCS = csFactory.createProjectedCoordinateSystem(projection.getName() |
|
71 |
.toString(), |
|
72 |
geogCS, |
|
73 |
projection, |
|
74 |
linearUnit, |
|
75 |
AxisInfo.X, |
|
76 |
AxisInfo.Y); |
|
77 |
} catch (FactoryException e) { |
|
78 |
// TODO Bloque catch generado autom?ticamente |
|
79 |
e.printStackTrace(); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
public String toString() { |
|
84 |
return projCS.toString(); |
|
85 |
} |
|
86 |
} |
|
0 | 87 |
tags/org.gvsig.desktop-2.0.402/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CoordTrans.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.impl.cts.gt2; |
|
25 |
|
|
26 |
import java.awt.geom.Point2D; |
|
27 |
import java.awt.geom.Rectangle2D; |
|
28 |
|
|
29 |
import org.cresques.cts.ICoordTrans; |
|
30 |
import org.cresques.cts.IProjection; |
|
31 |
import org.geotools.ct.CannotCreateTransformException; |
|
32 |
import org.geotools.ct.CoordinateTransformation; |
|
33 |
import org.geotools.ct.CoordinateTransformationFactory; |
|
34 |
import org.geotools.ct.MathTransform; |
|
35 |
import org.geotools.pt.CoordinatePoint; |
|
36 |
import org.opengis.referencing.operation.TransformException; |
|
37 |
|
|
38 |
|
|
39 |
//import org.geotools.pt.MismatchedDimensionException; |
|
40 |
|
|
41 |
/** |
|
42 |
* Transforma coordenadas entre dos sistemas |
|
43 |
* @see org.creques.cts.CoordSys |
|
44 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
45 |
*/ |
|
46 |
class CoordTrans implements ICoordTrans { |
|
47 |
private CoordinateTransformationFactory trFactory = CoordinateTransformationFactory.getDefault(); |
|
48 |
private CoordinateTransformation tr = null; |
|
49 |
private MathTransform mt = null; |
|
50 |
private MathTransform mt2 = null; |
|
51 |
private MathTransform mt3 = null; |
|
52 |
private MathTransform mtDatum = null; |
|
53 |
private CoordSys from = null; |
|
54 |
private CoordSys to = null; |
|
55 |
|
|
56 |
private ICoordTrans invertedCT = null; |
|
57 |
|
|
58 |
public CoordTrans(CoordSys from, CoordSys to) { |
|
59 |
this.from = from; |
|
60 |
this.to = to; |
|
61 |
|
|
62 |
// Si los dos CoordSys son proyectados, entonces hay |
|
63 |
// que hacer dos transformaciones (pasar por geogr?ficas) |
|
64 |
// Si hay cambio de datum son 3 las transformaciones |
|
65 |
try { |
Also available in: Unified diff