Revision 20
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/test/resources/README.txt | ||
---|---|---|
1 |
==== |
|
2 |
gvSIG. Desktop Geographic Information System. |
|
3 |
|
|
4 |
Copyright (C) 2007-2012 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 2 |
|
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 |
|
|
25 |
Put into this folder the resources needed by your test classes. |
|
26 |
|
|
27 |
This folder is added to the Tests classpath, so you can load any resources |
|
28 |
through the ClassLoader. |
|
29 |
|
|
30 |
By default, in this folder you can find an example of log4j configuration, |
|
31 |
prepared to log messages through the console, so logging works when you |
|
32 |
run your tests classes. |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 2 |
|
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 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.proj"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/test/java/org/gvsig/proj/jmapprojlib/DefaultCoordinateReferenceSystemManagerIT.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.jmapprojlib; |
|
24 |
|
|
25 |
import org.gvsig.proj.CoordinateReferenceSystemManager; |
|
26 |
import org.gvsig.proj.CoordinateReferenceSystemManagerIT; |
|
27 |
import org.gvsig.proj.proj4j.DefaultCoordinateReferenceSystemManager; |
|
28 |
|
|
29 |
/** |
|
30 |
* API acceptance tests for the {@link DefaultCoordinateReferenceSystemManager} implementation. |
|
31 |
* |
|
32 |
* @author gvSIG Team |
|
33 |
*/ |
|
34 |
public class DefaultCoordinateReferenceSystemManagerIT extends CoordinateReferenceSystemManagerIT { |
|
35 |
|
|
36 |
protected CoordinateReferenceSystemManager createProjectionManager() { |
|
37 |
return new DefaultCoordinateReferenceSystemManager(); |
|
38 |
} |
|
39 |
|
|
40 |
protected String getAuthorityName() { |
|
41 |
return "EPSG"; |
|
42 |
} |
|
43 |
|
|
44 |
protected String getCode() { |
|
45 |
return "23030"; |
|
46 |
} |
|
47 |
|
|
48 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/test/java/org/gvsig/proj/jmapprojlib/DefaultCoordinateReferenceSystemIT.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.jmapprojlib; |
|
24 |
|
|
25 |
import org.gvsig.proj.CoordinateReferenceSystemIT; |
|
26 |
import org.gvsig.proj.proj4j.DefaultCoordinateReferenceSystem; |
|
27 |
|
|
28 |
/** |
|
29 |
* API acceptance tests for the {@link DefaultCoordinateReferenceSystem} implementation. |
|
30 |
* |
|
31 |
* @author gvSIG Team |
|
32 |
*/ |
|
33 |
public class DefaultCoordinateReferenceSystemIT extends CoordinateReferenceSystemIT { |
|
34 |
|
|
35 |
protected String getAuthorityName() { |
|
36 |
return "EPSG"; |
|
37 |
} |
|
38 |
|
|
39 |
protected String getCode() { |
|
40 |
return "23030"; |
|
41 |
} |
|
42 |
|
|
43 |
protected String getCode2() { |
|
44 |
return "23031"; |
|
45 |
} |
|
46 |
|
|
47 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/test/java/org/gvsig/proj/jmapprojlib/DefaultCoordinateTransformationIT.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.jmapprojlib; |
|
24 |
|
|
25 |
import org.gvsig.proj.CoordinateTransformationIT; |
|
26 |
import org.gvsig.proj.CoordinateReferenceSystem; |
|
27 |
import org.gvsig.proj.CoordinateReferenceSystemLocator; |
|
28 |
import org.gvsig.proj.proj4j.DefaultCoordinateTransformation; |
|
29 |
|
|
30 |
/** |
|
31 |
* API acceptance tests for the {@link DefaultCoordinateTransformation} |
|
32 |
* implementation. |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
*/ |
|
36 |
public class DefaultCoordinateTransformationIT extends |
|
37 |
CoordinateTransformationIT { |
|
38 |
|
|
39 |
protected CoordinateReferenceSystem createSourceProjection() throws Exception { |
|
40 |
return CoordinateReferenceSystemLocator.getManager().getCoordinateReferenceSystem("EPSG", "23030"); |
|
41 |
} |
|
42 |
|
|
43 |
protected CoordinateReferenceSystem createTargetProjection() throws Exception { |
|
44 |
return CoordinateReferenceSystemLocator.getManager().getCoordinateReferenceSystem("EPSG", "23031"); |
|
45 |
} |
|
46 |
|
|
47 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.proj.proj4j.Proj4jCoordinateReferenceSystemLibrary |
|
2 |
org.gvsig.proj.proj4j.cts.Proj4jIProjectionLibrary |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/DefaultCoordinateReferenceSystemManager.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.proj4j; |
|
24 |
|
|
25 |
import java.io.BufferedReader; |
|
26 |
import java.io.IOException; |
|
27 |
import java.io.InputStream; |
|
28 |
import java.io.InputStreamReader; |
|
29 |
import java.io.StreamTokenizer; |
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.Arrays; |
|
32 |
import java.util.Collections; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import org.osgeo.proj4j.CRSFactory; |
|
36 |
import org.osgeo.proj4j.io.Proj4FileReader; |
|
37 |
import org.slf4j.Logger; |
|
38 |
import org.slf4j.LoggerFactory; |
|
39 |
|
|
40 |
import org.gvsig.proj.CoordinateReferenceSystem; |
|
41 |
import org.gvsig.proj.CoordinateReferenceSystemManager; |
|
42 |
import org.gvsig.proj.CoordinateReferenceSystemNotFoundException; |
|
43 |
import org.gvsig.tools.dynobject.DynObject; |
|
44 |
|
|
45 |
/** |
|
46 |
* Java Map CoordinateReferenceSystem Library based implementation. |
|
47 |
* |
|
48 |
* @author gvSIG Team |
|
49 |
*/ |
|
50 |
public class DefaultCoordinateReferenceSystemManager implements |
|
51 |
CoordinateReferenceSystemManager { |
|
52 |
|
|
53 |
private static final Logger LOG = LoggerFactory |
|
54 |
.getLogger(DefaultCoordinateReferenceSystemManager.class); |
|
55 |
|
|
56 |
private static final List AUTHORITIES = Collections.unmodifiableList(Arrays |
|
57 |
.asList(new String[] { "EPSG", "ESRI", "WORLD", "NAD83", "NAD27" })); |
|
58 |
|
|
59 |
private CRSFactory factory = new CRSFactory(); |
|
60 |
|
|
61 |
public List getAuthorityNames() { |
|
62 |
return AUTHORITIES; |
|
63 |
} |
|
64 |
|
|
65 |
public List getCodes(String authority) { |
|
66 |
String filename = "/nad/" + authority.toLowerCase(); |
|
67 |
InputStream inStr = Proj4FileReader.class.getResourceAsStream(filename); |
|
68 |
if (inStr == null) { |
|
69 |
throw new IllegalStateException("Unable to access CRS file: " |
|
70 |
+ filename); |
|
71 |
} |
|
72 |
BufferedReader reader = |
|
73 |
new BufferedReader(new InputStreamReader(inStr)); |
|
74 |
List codes; |
|
75 |
try { |
|
76 |
codes = Collections.unmodifiableList(readAuthorityCodes(reader)); |
|
77 |
} catch (IOException e) { |
|
78 |
throw new RuntimeException("Error reading the codes of authority: " |
|
79 |
+ authority, e); |
|
80 |
} finally { |
|
81 |
try { |
|
82 |
reader.close(); |
|
83 |
} catch (IOException e) { |
|
84 |
LOG.warn("Error closing BufferedReader on file " + filename, e); |
|
85 |
} |
|
86 |
} |
|
87 |
return codes; |
|
88 |
} |
|
89 |
|
|
90 |
private StreamTokenizer createTokenizer(BufferedReader reader) { |
|
91 |
StreamTokenizer t = new StreamTokenizer(reader); |
|
92 |
t.commentChar('#'); |
|
93 |
t.ordinaryChars('0', '9'); |
|
94 |
t.ordinaryChars('.', '.'); |
|
95 |
t.ordinaryChars('-', '-'); |
|
96 |
t.ordinaryChars('+', '+'); |
|
97 |
t.wordChars('0', '9'); |
|
98 |
t.wordChars('\'', '\''); |
|
99 |
t.wordChars('"', '"'); |
|
100 |
t.wordChars('_', '_'); |
|
101 |
t.wordChars('.', '.'); |
|
102 |
t.wordChars('-', '-'); |
|
103 |
t.wordChars('+', '+'); |
|
104 |
t.wordChars(',', ','); |
|
105 |
t.wordChars('@', '@'); |
|
106 |
return t; |
|
107 |
} |
|
108 |
|
|
109 |
private List readAuthorityCodes(BufferedReader reader) throws IOException { |
|
110 |
List codes = new ArrayList(); |
|
111 |
StreamTokenizer t = createTokenizer(reader); |
|
112 |
|
|
113 |
t.nextToken(); |
|
114 |
while (t.ttype == '<') { |
|
115 |
t.nextToken(); |
|
116 |
if (t.ttype != StreamTokenizer.TT_WORD) { |
|
117 |
throw new IOException(t.lineno() + ": Word expected after '<'"); |
|
118 |
} |
|
119 |
codes.add(t.sval); |
|
120 |
t.nextToken(); |
|
121 |
if (t.ttype != '>') |
|
122 |
throw new IOException(t.lineno() + ": '>' expected"); |
|
123 |
t.nextToken(); |
|
124 |
|
|
125 |
while (t.ttype != '<') { |
|
126 |
t.nextToken(); |
|
127 |
} |
|
128 |
t.nextToken(); |
|
129 |
if (t.ttype != '>') |
|
130 |
throw new IOException(t.lineno() + ": '<>' expected"); |
|
131 |
t.nextToken(); |
|
132 |
} |
|
133 |
return codes; |
|
134 |
} |
|
135 |
|
|
136 |
public CoordinateReferenceSystem getCoordinateReferenceSystem(String authority, String code) |
|
137 |
throws CoordinateReferenceSystemNotFoundException { |
|
138 |
String name = authority.concat(":").concat(code); |
|
139 |
return new DefaultCoordinateReferenceSystem(authority, code, |
|
140 |
factory.createFromName(name)); |
|
141 |
} |
|
142 |
|
|
143 |
public DynObject createParameters() { |
|
144 |
// Nothing to do, no parameters needed. |
|
145 |
return null; |
|
146 |
} |
|
147 |
|
|
148 |
public void initialize(DynObject parameters) { |
|
149 |
// Nothing to do |
|
150 |
} |
|
151 |
|
|
152 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 2 |
|
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 html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29 |
<head> |
|
30 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
31 |
<title>org.gvsig.proj package documentation</title> |
|
32 |
</head> |
|
33 |
<body> |
|
34 |
|
|
35 |
<p>Projection library API implementation based on the |
|
36 |
<a href="http://sourceforge.net/projects/jmapprojlib/">Java Map Projection Library</a>.</p> |
|
37 |
|
|
38 |
</body> |
|
39 |
</html> |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/DefaultCoordinateReferenceSystem.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.proj4j; |
|
24 |
|
|
25 |
import org.osgeo.proj4j.proj.LongLatProjection; |
|
26 |
|
|
27 |
import org.gvsig.proj.CoordinateReferenceSystem; |
|
28 |
import org.gvsig.proj.CoordinateTransformation; |
|
29 |
|
|
30 |
/** |
|
31 |
* Java Map CoordinateReferenceSystem Library based implementation. |
|
32 |
* |
|
33 |
* @author gvSIG Team |
|
34 |
*/ |
|
35 |
public class DefaultCoordinateReferenceSystem implements |
|
36 |
CoordinateReferenceSystem { |
|
37 |
|
|
38 |
private final org.osgeo.proj4j.CoordinateReferenceSystem crs; |
|
39 |
private final String authorityName; |
|
40 |
private final String code; |
|
41 |
|
|
42 |
/** |
|
43 |
* Constructor |
|
44 |
*/ |
|
45 |
public DefaultCoordinateReferenceSystem(String authorityName, String code, |
|
46 |
org.osgeo.proj4j.CoordinateReferenceSystem crs) { |
|
47 |
this.authorityName = authorityName; |
|
48 |
this.code = code; |
|
49 |
this.crs = crs; |
|
50 |
} |
|
51 |
|
|
52 |
public String getAuthorityName() { |
|
53 |
return authorityName; |
|
54 |
} |
|
55 |
|
|
56 |
public String getCode() { |
|
57 |
return code; |
|
58 |
} |
|
59 |
|
|
60 |
public String getReference() { |
|
61 |
return authorityName.concat(":").concat(code); |
|
62 |
} |
|
63 |
|
|
64 |
public String getDefinition() { |
|
65 |
return crs.getParameterString(); |
|
66 |
} |
|
67 |
|
|
68 |
public String getDescription() { |
|
69 |
return crs.getProjection().getPROJ4Description(); |
|
70 |
} |
|
71 |
|
|
72 |
public boolean isProjected() { |
|
73 |
return !(crs.getProjection() instanceof LongLatProjection); |
|
74 |
} |
|
75 |
|
|
76 |
public Object clone() throws CloneNotSupportedException { |
|
77 |
DefaultCoordinateReferenceSystem cloned = |
|
78 |
(DefaultCoordinateReferenceSystem) super.clone(); |
|
79 |
return cloned; |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* @return the crs |
|
84 |
*/ |
|
85 |
public org.osgeo.proj4j.CoordinateReferenceSystem getCRS() { |
|
86 |
return crs; |
|
87 |
} |
|
88 |
|
|
89 |
public org.osgeo.proj4j.CoordinateReferenceSystem getGeographicCRS() { |
|
90 |
return crs.createGeographic(); |
|
91 |
} |
|
92 |
|
|
93 |
public CoordinateTransformation getTransformation( |
|
94 |
CoordinateReferenceSystem target) { |
|
95 |
return new DefaultCoordinateTransformation(this, |
|
96 |
(DefaultCoordinateReferenceSystem) target); |
|
97 |
} |
|
98 |
|
|
99 |
// /** |
|
100 |
// * Transforms coordinates in lat/lon to this projection. |
|
101 |
// * |
|
102 |
// * @param pointxy |
|
103 |
// * coordinates to transform |
|
104 |
// */ |
|
105 |
// public void transform(double[] pointxy) { |
|
106 |
// jmprojection.transform(pointxy, 0, pointxy, 0, 1); |
|
107 |
// } |
|
108 |
// |
|
109 |
// /** |
|
110 |
// * Transforms coordinates in this projection to lat/lon. |
|
111 |
// * |
|
112 |
// * @param pointxy |
|
113 |
// * coordinates to transform |
|
114 |
// */ |
|
115 |
// public void inverseTransform(double[] pointxy) { |
|
116 |
// jmprojection.inverseTransform(pointxy, 0, pointxy, 0, 1); |
|
117 |
// } |
|
118 |
|
|
119 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/DefaultCoordinateTransformation.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.proj4j; |
|
24 |
|
|
25 |
import org.osgeo.proj4j.CoordinateTransform; |
|
26 |
import org.osgeo.proj4j.CoordinateTransformFactory; |
|
27 |
import org.osgeo.proj4j.ProjCoordinate; |
|
28 |
|
|
29 |
import org.gvsig.proj.CoordinateTransformation; |
|
30 |
import org.gvsig.proj.CoordinateReferenceSystem; |
|
31 |
|
|
32 |
/** |
|
33 |
* Java Map CoordinateReferenceSystem Library based implementation. |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
*/ |
|
37 |
public class DefaultCoordinateTransformation implements |
|
38 |
CoordinateTransformation { |
|
39 |
|
|
40 |
private final DefaultCoordinateReferenceSystem source; |
|
41 |
private final DefaultCoordinateReferenceSystem target; |
|
42 |
private final CoordinateTransform transform; |
|
43 |
|
|
44 |
/** |
|
45 |
* Creates a new {@link CoordinateTransformation} with the the source and |
|
46 |
* target projections. |
|
47 |
* |
|
48 |
* @param source |
|
49 |
* the projection to transform coordinates from |
|
50 |
* @param target |
|
51 |
* the projection to transform coordinates to |
|
52 |
*/ |
|
53 |
public DefaultCoordinateTransformation(DefaultCoordinateReferenceSystem source, |
|
54 |
DefaultCoordinateReferenceSystem target) { |
|
55 |
this.source = source; |
|
56 |
this.target = target; |
|
57 |
CoordinateTransformFactory factory = new CoordinateTransformFactory(); |
|
58 |
this.transform = |
|
59 |
factory.createTransform(source.getCRS(), target.getCRS()); |
|
60 |
} |
|
61 |
|
|
62 |
public CoordinateReferenceSystem getSourceProjection() { |
|
63 |
return source; |
|
64 |
} |
|
65 |
|
|
66 |
public CoordinateReferenceSystem getTargetProjection() { |
|
67 |
return target; |
|
68 |
} |
|
69 |
|
|
70 |
public void convert(double[] pointxy) { |
|
71 |
ProjCoordinate source = new ProjCoordinate(pointxy[0], pointxy[1]); |
|
72 |
ProjCoordinate result = new ProjCoordinate(); |
|
73 |
|
|
74 |
transform.transform(source, result); |
|
75 |
|
|
76 |
pointxy[0] = result.x; |
|
77 |
pointxy[1] = result.y; |
|
78 |
} |
|
79 |
|
|
80 |
public CoordinateTransformation getReverse() { |
|
81 |
return new DefaultCoordinateTransformation(target, source); |
|
82 |
} |
|
83 |
|
|
84 |
public Object clone() throws CloneNotSupportedException { |
|
85 |
return super.clone(); |
|
86 |
} |
|
87 |
|
|
88 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/Proj4jCoordinateReferenceSystemLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 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 2 |
|
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.gvsig.proj.proj4j; |
|
25 |
|
|
26 |
import org.gvsig.proj.CoordinateReferenceSystemLibrary; |
|
27 |
import org.gvsig.proj.CoordinateReferenceSystemLocator; |
|
28 |
import org.gvsig.tools.library.AbstractLibrary; |
|
29 |
import org.gvsig.tools.library.LibraryException; |
|
30 |
|
|
31 |
/** |
|
32 |
* Library for default implementation initialization and configuration. |
|
33 |
* |
|
34 |
* @author gvSIG team |
|
35 |
* @version $Id$ |
|
36 |
*/ |
|
37 |
public class Proj4jCoordinateReferenceSystemLibrary extends AbstractLibrary { |
|
38 |
|
|
39 |
public void doRegistration() { |
|
40 |
registerAsImplementationOf(CoordinateReferenceSystemLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
protected void doInitialize() throws LibraryException { |
|
44 |
CoordinateReferenceSystemLocator.registerManager(DefaultCoordinateReferenceSystemManager.class); |
|
45 |
} |
|
46 |
|
|
47 |
protected void doPostInitialize() throws LibraryException { |
|
48 |
// Do nothing |
|
49 |
} |
|
50 |
|
|
51 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/cts/DefaultIProjection.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.proj4j.cts; |
|
24 |
|
|
25 |
import java.awt.Color; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.geom.Point2D; |
|
28 |
import java.awt.geom.Rectangle2D; |
|
29 |
|
|
30 |
import org.cresques.cts.ICoordTrans; |
|
31 |
import org.cresques.cts.IDatum; |
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
import org.cresques.geo.ViewPortData; |
|
34 |
|
|
35 |
import org.gvsig.proj.CoordinateReferenceSystemLocator; |
|
36 |
import org.gvsig.proj.CoordinateReferenceSystemNotFoundException; |
|
37 |
import org.gvsig.proj.proj4j.DefaultCoordinateReferenceSystem; |
|
38 |
|
|
39 |
/** |
|
40 |
* Java Map CoordinateReferenceSystem Library based implementation. |
|
41 |
* |
|
42 |
* @author gvSIG Team |
|
43 |
*/ |
|
44 |
public class DefaultIProjection implements IProjection { |
|
45 |
|
|
46 |
private DefaultCoordinateReferenceSystem crs; |
|
47 |
|
|
48 |
/** |
|
49 |
* @param authorityName |
|
50 |
* @param code |
|
51 |
* @throws CoordinateReferenceSystemNotFoundException |
|
52 |
*/ |
|
53 |
public DefaultIProjection(String authorityName, String code) |
|
54 |
throws CoordinateReferenceSystemNotFoundException { |
|
55 |
this.crs = |
|
56 |
(DefaultCoordinateReferenceSystem) CoordinateReferenceSystemLocator |
|
57 |
.getManager().getCoordinateReferenceSystem(authorityName, code); |
|
58 |
} |
|
59 |
|
|
60 |
public IDatum getDatum() { |
|
61 |
throw new UnsupportedOperationException("Not implemented"); |
|
62 |
} |
|
63 |
|
|
64 |
public Point2D createPoint(double x, double y) { |
|
65 |
return new Point2D.Double(x, y); |
|
66 |
} |
|
67 |
|
|
68 |
public String getAbrev() { |
|
69 |
return getCoordinateReferenceSystem().getReference(); |
|
70 |
} |
|
71 |
|
|
72 |
public String getFullCode() { |
|
73 |
return getCoordinateReferenceSystem().getReference(); |
|
74 |
} |
|
75 |
|
|
76 |
public void drawGrid(Graphics2D g, ViewPortData vp) { |
|
77 |
throw new UnsupportedOperationException("Not implemented"); |
|
78 |
} |
|
79 |
|
|
80 |
public void setGridColor(Color gridColor) { |
|
81 |
throw new UnsupportedOperationException("Not implemented"); |
|
82 |
} |
|
83 |
|
|
84 |
public Color getGridColor() { |
|
85 |
throw new UnsupportedOperationException("Not implemented"); |
|
86 |
} |
|
87 |
|
|
88 |
public ICoordTrans getCT(IProjection dest) { |
|
89 |
return new DefaultICoordTrans(this, (DefaultIProjection) dest); |
|
90 |
} |
|
91 |
|
|
92 |
public Point2D toGeo(Point2D pt) { |
|
93 |
// DefaultProjection geographic = projection. |
|
94 |
|
|
95 |
throw new UnsupportedOperationException("Not implemented"); |
|
96 |
// double[] coords = new double[] { pt.getX(), pt.getY() }; |
|
97 |
// getProjection().inverseTransform(coords); |
|
98 |
// return new Point2D.Double(coords[0], coords[1]); |
|
99 |
} |
|
100 |
|
|
101 |
public Point2D fromGeo(Point2D gPt, Point2D mPt) { |
|
102 |
throw new UnsupportedOperationException("Not implemented"); |
|
103 |
// double[] coords = new double[] { gPt.getX(), gPt.getY() }; |
|
104 |
// getProjection().inverseTransform(coords); |
|
105 |
// mPt.setLocation(coords[0], coords[1]); |
|
106 |
// return mPt; |
|
107 |
} |
|
108 |
|
|
109 |
public double getScale(double minX, double maxX, double width, double dpi) { |
|
110 |
throw new UnsupportedOperationException("Not implemented"); |
|
111 |
} |
|
112 |
|
|
113 |
public Rectangle2D getExtent(Rectangle2D extent, double scale, |
|
114 |
double wImage, double hImage, double mapUnits, double distanceUnits, |
|
115 |
double dpi) { |
|
116 |
throw new UnsupportedOperationException("Not implemented"); |
|
117 |
} |
|
118 |
|
|
119 |
public boolean isProjected() { |
|
120 |
return getCoordinateReferenceSystem().isProjected(); |
|
121 |
} |
|
122 |
|
|
123 |
public Object clone() throws CloneNotSupportedException { |
|
124 |
DefaultIProjection cloned = (DefaultIProjection) super.clone(); |
|
125 |
cloned.crs = |
|
126 |
(DefaultCoordinateReferenceSystem) this |
|
127 |
.getCoordinateReferenceSystem().clone(); |
|
128 |
return cloned; |
|
129 |
} |
|
130 |
|
|
131 |
public DefaultCoordinateReferenceSystem getCoordinateReferenceSystem() { |
|
132 |
return crs; |
|
133 |
} |
|
134 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/cts/DefaultICoordTrans.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.proj4j.cts; |
|
24 |
|
|
25 |
import java.awt.geom.Point2D; |
|
26 |
import java.awt.geom.Rectangle2D; |
|
27 |
|
|
28 |
import org.cresques.cts.ICoordTrans; |
|
29 |
import org.cresques.cts.IProjection; |
|
30 |
|
|
31 |
import org.gvsig.proj.CoordinateTransformation; |
|
32 |
|
|
33 |
/** |
|
34 |
* Java Map CoordinateReferenceSystem Library based implementation. |
|
35 |
* |
|
36 |
* @author gvSIG Team |
|
37 |
*/ |
|
38 |
public class DefaultICoordTrans implements ICoordTrans { |
|
39 |
|
|
40 |
private final DefaultIProjection sourceIProjection; |
|
41 |
|
|
42 |
private final DefaultIProjection targetIProjection; |
|
43 |
|
|
44 |
private final CoordinateTransformation transformation; |
|
45 |
|
|
46 |
/** |
|
47 |
* @param source |
|
48 |
* @param target |
|
49 |
*/ |
|
50 |
public DefaultICoordTrans(DefaultIProjection source, |
|
51 |
DefaultIProjection target) { |
|
52 |
transformation = |
|
53 |
source.getCoordinateReferenceSystem().getTransformation( |
|
54 |
target.getCoordinateReferenceSystem()); |
|
55 |
this.sourceIProjection = source; |
|
56 |
this.targetIProjection = target; |
|
57 |
} |
|
58 |
|
|
59 |
public IProjection getPOrig() { |
|
60 |
return sourceIProjection; |
|
61 |
} |
|
62 |
|
|
63 |
public IProjection getPDest() { |
|
64 |
return targetIProjection; |
|
65 |
} |
|
66 |
|
|
67 |
public Point2D convert(Point2D ptOrig, Point2D ptDest) { |
|
68 |
double[] coords = new double[] { ptOrig.getX(), ptOrig.getY() }; |
|
69 |
transformation.convert(coords); |
|
70 |
ptDest.setLocation(coords[0], coords[1]); |
|
71 |
return ptDest; |
|
72 |
} |
|
73 |
|
|
74 |
public Rectangle2D convert(Rectangle2D rect) { |
|
75 |
double[] coords1 = new double[] { rect.getMinX(), rect.getMinY() }; |
|
76 |
double[] coords2 = new double[] { rect.getMaxX(), rect.getMaxY() }; |
|
77 |
|
|
78 |
transformation.convert(coords1); |
|
79 |
transformation.convert(coords2); |
|
80 |
|
|
81 |
Rectangle2D converted = new Rectangle2D.Double(); |
|
82 |
converted.setFrameFromDiagonal(coords1[0], coords1[1], coords2[0], |
|
83 |
coords2[1]); |
|
84 |
|
|
85 |
return converted; |
|
86 |
} |
|
87 |
|
|
88 |
public ICoordTrans getInverted() { |
|
89 |
return new DefaultICoordTrans(targetIProjection, sourceIProjection); |
|
90 |
} |
|
91 |
|
|
92 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/cts/DefaultICRSFactory.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.proj4j.cts; |
|
24 |
|
|
25 |
import org.cresques.cts.ICRSFactory; |
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
|
|
28 |
import org.gvsig.proj.CoordinateReferenceSystemNotFoundException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Java Map CoordinateReferenceSystem Library based implementation. |
|
32 |
* |
|
33 |
* @author gvSIG Team |
|
34 |
*/ |
|
35 |
public class DefaultICRSFactory implements ICRSFactory { |
|
36 |
|
|
37 |
public boolean doesRigurousTransformations() { |
|
38 |
return false; |
|
39 |
} |
|
40 |
|
|
41 |
public IProjection get(String name) { |
|
42 |
int pos = name.indexOf('-'); |
|
43 |
String authority = name.substring(0, pos); |
|
44 |
String code = name.substring(pos + 1); |
|
45 |
try { |
|
46 |
return new DefaultIProjection(authority, code); |
|
47 |
} catch (CoordinateReferenceSystemNotFoundException e) { |
|
48 |
throw new RuntimeException("Not found projection with definition: " |
|
49 |
+ name, e); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/src/main/java/org/gvsig/proj/proj4j/cts/Proj4jIProjectionLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 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 2 |
|
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.gvsig.proj.proj4j.cts; |
|
25 |
|
|
26 |
import org.cresques.ProjectionLibrary; |
|
27 |
|
|
28 |
import org.gvsig.fmap.crs.CRSFactory; |
|
29 |
import org.gvsig.tools.library.AbstractLibrary; |
|
30 |
import org.gvsig.tools.library.LibraryException; |
|
31 |
|
|
32 |
/** |
|
33 |
* Library for default implementation initialization and configuration. |
|
34 |
* |
|
35 |
* @author gvSIG team |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public class Proj4jIProjectionLibrary extends AbstractLibrary { |
|
39 |
|
|
40 |
public void doRegistration() { |
|
41 |
registerAsImplementationOf(ProjectionLibrary.class, 10); |
|
42 |
} |
|
43 |
|
|
44 |
protected void doInitialize() throws LibraryException { |
|
45 |
CRSFactory.cp = new DefaultICRSFactory(); |
|
46 |
} |
|
47 |
|
|
48 |
protected void doPostInitialize() throws LibraryException { |
|
49 |
// Do nothing |
|
50 |
} |
|
51 |
|
|
52 |
} |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/org.gvsig.proj.lib.proj4j/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.proj.lib.proj4j</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.proj.lib.proj4j</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.proj.lib</artifactId> |
|
11 |
<version>1.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
17 |
<version>2.0.1-SNAPSHOT</version> |
|
18 |
<type>pom</type> |
|
19 |
<scope>test</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
24 |
<scope>compile</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
29 |
<type>test-jar</type> |
|
30 |
<scope>test</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.projection</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.projection</artifactId> |
|
40 |
<classifier>cresques-impl</classifier> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.proj.lib.api</artifactId> |
|
56 |
<version>1.0.0-SNAPSHOT</version> |
|
57 |
<scope>compile</scope> |
|
58 |
</dependency> |
|
59 |
<dependency> |
|
60 |
<groupId>org.gvsig</groupId> |
|
61 |
<artifactId>org.gvsig.proj.lib.api</artifactId> |
|
62 |
<version>1.0.0-SNAPSHOT</version> |
|
63 |
<type>test-jar</type> |
|
64 |
<scope>test</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.osgeo</groupId> |
|
68 |
<artifactId>proj4j</artifactId> |
|
69 |
<version>0.1.0-SNAPSHOT</version> |
|
70 |
</dependency> |
|
71 |
</dependencies> |
|
72 |
</project> |
org.gvsig.proj/trunk/org.gvsig.proj/org.gvsig.proj.lib/pom.xml | ||
---|---|---|
49 | 49 |
|
50 | 50 |
<modules> |
51 | 51 |
<module>org.gvsig.proj.lib.api</module> |
52 |
<module>org.gvsig.proj.lib.jmapprojlib</module> |
|
52 |
<module>org.gvsig.proj.lib.jmapprojlib</module> |
|
53 |
<module>org.gvsig.proj.lib.proj4j</module> |
|
53 | 54 |
</modules> |
54 | 55 |
</project> |
Also available in: Unified diff