root / org.gvsig.jcrs / libJCRS / src-test / es / idr / crs / crsGT / CrsGTTest.java @ 38
History | View | Annotate | Download (5.83 KB)
1 |
package es.idr.crs.crsGT; |
---|---|
2 |
|
3 |
import org.cresques.cts.IProjection; |
4 |
import org.gvsig.crs.CrsException; |
5 |
import org.gvsig.crs.CrsGT; |
6 |
import org.gvsig.crs.ICrs; |
7 |
import org.gvsig.crs.Proj4; |
8 |
import org.gvsig.crs.repository.EpsgRepositoryGT; |
9 |
import org.gvsig.crs.repository.EsriRepositoryGT; |
10 |
import org.gvsig.crs.repository.Iau2000RepositoryGT; |
11 |
import org.gvsig.crs.repository.UsrRepositoryGT; |
12 |
|
13 |
public class CrsGTTest { |
14 |
|
15 |
public CrsGTTest() {
|
16 |
epsgTest(); |
17 |
esriTest(); |
18 |
iau2000Test(); |
19 |
usrTest(); |
20 |
} |
21 |
/**
|
22 |
* @param args
|
23 |
*/
|
24 |
public static void main(String[] args) { |
25 |
CrsGTTest g = new CrsGTTest();
|
26 |
} |
27 |
|
28 |
public void epsgTest() { |
29 |
EpsgRepositoryGT repo = new EpsgRepositoryGT();
|
30 |
IProjection crs=null;
|
31 |
crs = repo.getCrs("23030");
|
32 |
if (crs!=null){ |
33 |
System.out.println(crs.getAbrev());
|
34 |
System.out.println(((ICrs)crs).getCode());
|
35 |
System.out.println(((ICrs)crs).getWKT());
|
36 |
System.out.println(((ICrs)crs).getDatum().getEIFlattening());
|
37 |
System.out.println(((ICrs)crs).getDatum().getESemiMajorAxis());
|
38 |
System.out.println(((ICrs)crs).isProjected()+"\n\n"); |
39 |
|
40 |
System.out.println("----------- CrsWkt:--------------"); |
41 |
System.out.println(((ICrs)crs).getCrsWkt().getAuthority()[0]+":"+((ICrs)crs).getCrsWkt().getAuthority()[1]); |
42 |
System.out.println(((ICrs)crs).getCrsWkt().getName());
|
43 |
System.out.println(((ICrs)crs).getCrsWkt().getDatumName());
|
44 |
System.out.println(((ICrs)crs).getCrsWkt().getGeogcs());
|
45 |
System.out.println(((ICrs)crs).getCrsWkt().getProjcs());
|
46 |
System.out.println(((ICrs)crs).getCrsWkt().getProjection());
|
47 |
System.out.println(((ICrs)crs).getCrsWkt().getPrimen()[0]+" -- "+ ((ICrs)crs).getCrsWkt().getPrimen()[1]+"\n\n"); |
48 |
|
49 |
|
50 |
|
51 |
try {
|
52 |
Proj4 proj4 = new Proj4();
|
53 |
System.out.println(proj4.exportToProj4(((CrsGT)crs).getCrsGT()));
|
54 |
} catch (CrsException e) {
|
55 |
// TODO Auto-generated catch block
|
56 |
e.printStackTrace(); |
57 |
} |
58 |
|
59 |
} |
60 |
} |
61 |
|
62 |
public void esriTest() { |
63 |
EsriRepositoryGT repo = new EsriRepositoryGT();
|
64 |
IProjection crs=null;
|
65 |
crs = repo.getCrs("23030");
|
66 |
if (crs!=null){ |
67 |
System.out.println(crs.getAbrev());
|
68 |
System.out.println(((ICrs)crs).getCode());
|
69 |
System.out.println(((ICrs)crs).getWKT());
|
70 |
System.out.println(((ICrs)crs).getDatum().getEIFlattening());
|
71 |
System.out.println(((ICrs)crs).getDatum().getESemiMajorAxis());
|
72 |
System.out.println(((ICrs)crs).isProjected()+"\n\n"); |
73 |
|
74 |
System.out.println("----------- CrsWkt:--------------"); |
75 |
System.out.println(((ICrs)crs).getCrsWkt().getAuthority()[0]+":"+((ICrs)crs).getCrsWkt().getAuthority()[1]); |
76 |
System.out.println(((ICrs)crs).getCrsWkt().getName());
|
77 |
System.out.println(((ICrs)crs).getCrsWkt().getDatumName());
|
78 |
System.out.println(((ICrs)crs).getCrsWkt().getGeogcs());
|
79 |
System.out.println(((ICrs)crs).getCrsWkt().getProjcs());
|
80 |
System.out.println(((ICrs)crs).getCrsWkt().getProjection());
|
81 |
System.out.println(((ICrs)crs).getCrsWkt().getPrimen()[0]+" -- "+ ((ICrs)crs).getCrsWkt().getPrimen()[1]+"\n\n"); |
82 |
|
83 |
|
84 |
|
85 |
try {
|
86 |
Proj4 proj4 = new Proj4();
|
87 |
System.out.println(proj4.exportToProj4(((CrsGT)crs).getCrsGT()));
|
88 |
} catch (CrsException e) {
|
89 |
// TODO Auto-generated catch block
|
90 |
e.printStackTrace(); |
91 |
} |
92 |
|
93 |
} |
94 |
} |
95 |
|
96 |
public void iau2000Test() { |
97 |
Iau2000RepositoryGT repo = new Iau2000RepositoryGT();
|
98 |
IProjection crs=null;
|
99 |
crs = repo.getCrs("19900");
|
100 |
if (crs!=null){ |
101 |
System.out.println(crs.getAbrev());
|
102 |
System.out.println(((ICrs)crs).getCode());
|
103 |
System.out.println(((ICrs)crs).getWKT());
|
104 |
System.out.println(((ICrs)crs).getDatum().getEIFlattening());
|
105 |
System.out.println(((ICrs)crs).getDatum().getESemiMajorAxis());
|
106 |
System.out.println(((ICrs)crs).isProjected()+"\n\n"); |
107 |
|
108 |
System.out.println("----------- CrsWkt:--------------"); |
109 |
System.out.println(((ICrs)crs).getCrsWkt().getAuthority()[0]+":"+((ICrs)crs).getCrsWkt().getAuthority()[1]); |
110 |
System.out.println(((ICrs)crs).getCrsWkt().getName());
|
111 |
System.out.println(((ICrs)crs).getCrsWkt().getDatumName());
|
112 |
System.out.println(((ICrs)crs).getCrsWkt().getGeogcs());
|
113 |
System.out.println(((ICrs)crs).getCrsWkt().getProjcs());
|
114 |
System.out.println(((ICrs)crs).getCrsWkt().getProjection());
|
115 |
System.out.println(((ICrs)crs).getCrsWkt().getPrimen()[0]+" -- "+ ((ICrs)crs).getCrsWkt().getPrimen()[1]+"\n\n"); |
116 |
|
117 |
|
118 |
|
119 |
try {
|
120 |
Proj4 proj4 = new Proj4();
|
121 |
System.out.println(proj4.exportToProj4(((CrsGT)crs).getCrsGT()));
|
122 |
} catch (CrsException e) {
|
123 |
// TODO Auto-generated catch block
|
124 |
e.printStackTrace(); |
125 |
} |
126 |
|
127 |
} |
128 |
} |
129 |
|
130 |
public void usrTest() { |
131 |
UsrRepositoryGT repo = new UsrRepositoryGT();
|
132 |
IProjection crs=null;
|
133 |
crs = repo.getCrs("2000");
|
134 |
if (crs!=null){ |
135 |
System.out.println(crs.getAbrev());
|
136 |
System.out.println(((ICrs)crs).getCode());
|
137 |
System.out.println(((ICrs)crs).getWKT());
|
138 |
System.out.println(((ICrs)crs).getDatum().getEIFlattening());
|
139 |
System.out.println(((ICrs)crs).getDatum().getESemiMajorAxis());
|
140 |
System.out.println(((ICrs)crs).isProjected()+"\n\n"); |
141 |
|
142 |
System.out.println("----------- CrsWkt:--------------"); |
143 |
System.out.println(((ICrs)crs).getCrsWkt().getAuthority()[0]+":"+((ICrs)crs).getCrsWkt().getAuthority()[1]); |
144 |
System.out.println(((ICrs)crs).getCrsWkt().getName());
|
145 |
System.out.println(((ICrs)crs).getCrsWkt().getDatumName());
|
146 |
System.out.println(((ICrs)crs).getCrsWkt().getGeogcs());
|
147 |
System.out.println(((ICrs)crs).getCrsWkt().getProjcs());
|
148 |
System.out.println(((ICrs)crs).getCrsWkt().getProjection());
|
149 |
System.out.println(((ICrs)crs).getCrsWkt().getPrimen()[0]+" -- "+ ((ICrs)crs).getCrsWkt().getPrimen()[1]+"\n\n"); |
150 |
|
151 |
|
152 |
|
153 |
try {
|
154 |
Proj4 proj4 = new Proj4();
|
155 |
System.out.println(proj4.exportToProj4(((CrsGT)crs).getCrsGT()));
|
156 |
} catch (CrsException e) {
|
157 |
// TODO Auto-generated catch block
|
158 |
e.printStackTrace(); |
159 |
} |
160 |
|
161 |
} |
162 |
} |
163 |
|
164 |
} |