Revision 33009
tags/v2_0_0_Build_2008/libraries/libJCRS/src/es/idr/teledeteccion/connection/EpsgConnection.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha) |
|
34 |
* Campus Universitario s/n |
|
35 |
* 02071 Alabacete |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 967 599 200 |
|
39 |
*/ |
|
40 |
|
|
41 |
package es.idr.teledeteccion.connection; |
|
42 |
|
|
43 |
import java.io.BufferedReader; |
|
44 |
import java.io.File; |
|
45 |
import java.io.IOException; |
|
46 |
import java.io.InputStreamReader; |
|
47 |
import java.sql.Connection; |
|
48 |
import java.sql.ResultSet; |
|
49 |
import java.sql.SQLException; |
|
50 |
import java.sql.Statement; |
|
51 |
import java.util.logging.Logger; |
|
52 |
|
|
53 |
import org.geotools.referencing.factory.epsg.HSQLDataSource; |
|
54 |
import org.geotools.referencing.factory.iau2000.FactoryUsingHSQL; |
|
55 |
import org.hsqldb.jdbc.jdbcDataSource; |
|
56 |
|
|
57 |
/** |
|
58 |
* Clase para la conexi?n con la base de datos de hsqldb. |
|
59 |
* Establece el driver necesario, as? como la cadena de |
|
60 |
* conexi?n a la base de datos de la EPSG y la IAU2000 |
|
61 |
* |
|
62 |
* @author Jos? Luis G?mez Mart?nez (jolugomar@gmail.com) |
|
63 |
* |
|
64 |
*/ |
|
65 |
|
|
66 |
public class EpsgConnection extends jdbcDataSource { |
|
67 |
|
|
68 |
Connection connect; |
|
69 |
|
|
70 |
public EpsgConnection() { |
|
71 |
/* try { |
|
72 |
Class.forName("org.hsqldb.jdbcDriver"); |
|
73 |
} catch (ClassNotFoundException e) { |
|
74 |
e.printStackTrace(); |
|
75 |
}*/ |
|
76 |
} |
|
77 |
|
|
78 |
public void setConnectionEPSG() { |
|
79 |
HSQLDataSource ds = new HSQLDataSource(); |
|
80 |
|
|
81 |
try { |
|
82 |
connect = ds.getConnection(); |
|
83 |
} catch (SQLException e) { |
|
84 |
// TODO Auto-generated catch block |
|
85 |
e.printStackTrace(); |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Establece la conexi?n con la base de datos de la IAU2000 |
|
91 |
* |
|
92 |
*/ |
|
93 |
public void setConnectionIAU2000() { |
|
94 |
setDatabase("jdbc:hsqldb:file:gvSIG/extensiones/org.gvsig.crs.extension/iau2000"); |
|
95 |
setUser("sa"); |
|
96 |
try { |
|
97 |
connect = super.getConnection(); |
|
98 |
} catch (SQLException e) { |
|
99 |
// TODO Auto-generated catch block |
|
100 |
e.printStackTrace(); |
|
101 |
} |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Establece la conexi?n con la base de datos de ESRI |
|
106 |
* |
|
107 |
*/ |
|
108 |
public void setConnectionEsri() { |
|
109 |
setDatabase("jdbc:hsqldb:file:gvSIG/extensiones/org.gvsig.crs.extension/esri"); |
|
110 |
setUser("sa"); |
|
111 |
try { |
|
112 |
connect = super.getConnection(); |
|
113 |
} catch (SQLException e) { |
|
114 |
// TODO Auto-generated catch block |
|
115 |
e.printStackTrace(); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* Establece la conexi?n con la base de datos de USR |
|
121 |
* |
|
122 |
*/ |
|
123 |
public void setConnectionUsr() { |
|
124 |
setDatabase("jdbc:hsqldb:file:gvSIG/extensiones/org.gvsig.crs.extension/usr"); |
|
125 |
setUser("sa"); |
|
126 |
try { |
|
127 |
connect = super.getConnection(); |
|
128 |
} catch (SQLException e) { |
|
129 |
// TODO Auto-generated catch block |
|
130 |
e.printStackTrace(); |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
public Connection getConnection(){ |
|
135 |
return connect; |
|
136 |
} |
|
137 |
|
|
138 |
public void shutdown() throws SQLException { |
|
139 |
|
|
140 |
Statement st = connect.createStatement(); |
|
141 |
|
|
142 |
// db writes out to files and performs clean shuts down |
|
143 |
// otherwise there will be an unclean shutdown |
|
144 |
// when program ends |
|
145 |
st.execute("SHUTDOWN"); |
|
146 |
connect.close(); // if there are no other open connection |
|
147 |
} |
|
148 |
|
|
149 |
public synchronized void update(String expression) throws SQLException { |
|
150 |
|
|
151 |
Statement st = null; |
|
152 |
|
|
153 |
st = connect.createStatement(); // statements |
|
154 |
|
|
155 |
int i = st.executeUpdate(expression); // run the query |
|
156 |
|
|
157 |
if (i == -1) { |
|
158 |
System.out.println("db error : " + expression); |
|
159 |
} |
|
160 |
|
|
161 |
st.close(); |
|
162 |
} |
|
163 |
/* |
|
164 |
*//** |
|
165 |
* Establece la conexi?n con la base de datos de la EPSG |
|
166 |
* |
|
167 |
*//* |
|
168 |
public void setConnectionEPSG() { |
|
169 |
try { |
|
170 |
connect = DriverManager.getConnection("jdbc:hsqldb:file:gvSIG/extensiones/org.gvsig.crs.extension/db_epsg", "sa", ""); |
|
171 |
} catch (SQLException e1) { |
|
172 |
e1.printStackTrace(); |
|
173 |
} |
|
174 |
} |
|
175 |
|
|
176 |
*//** |
|
177 |
* Establece la conexi?n con la base de datos de la IAU2000 |
|
178 |
* |
|
179 |
*//* |
|
180 |
public void setConnectionIAU2000() { |
|
181 |
try { |
|
182 |
connect = DriverManager.getConnection("jdbc:hsqldb:file:gvSIG/extensiones/org.gvsig.crs.extension/db_iau2000", "sa", ""); |
|
183 |
} catch (SQLException e1) { |
|
184 |
e1.printStackTrace(); |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
*//** |
|
189 |
* Establece la conexi?n con la base de datos de ESRI |
|
190 |
* |
|
191 |
*//* |
|
192 |
public void setConnectionEsri() { |
|
193 |
try { |
|
194 |
connect = DriverManager.getConnection("jdbc:hsqldb:file:/home/jlgomez/gvSIGF2/_fwAndami/gvSIG/extensiones/org.gvsig.crs.extension/db_esri", "sa", ""); |
|
195 |
} catch (SQLException e1) { |
|
196 |
e1.printStackTrace(); |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
*//** |
|
201 |
* Establece la conexi?n con la base de datos de USR |
|
202 |
* |
|
203 |
*//* |
|
204 |
public void setConnectionUsr() { |
|
205 |
try { |
|
206 |
connect = DriverManager.getConnection("jdbc:hsqldb:file:gvSIG/extensiones/org.gvsig.crs.extension/db_usr", "sa", ""); |
|
207 |
} catch (SQLException e1) { |
|
208 |
e1.printStackTrace(); |
|
209 |
} |
|
210 |
} |
|
211 |
|
|
212 |
public Connection getConnection(){ |
|
213 |
return connect; |
|
214 |
} |
|
215 |
|
|
216 |
public void shutdown() throws SQLException { |
|
217 |
|
|
218 |
Statement st = connect.createStatement(); |
|
219 |
|
|
220 |
// db writes out to files and performs clean shuts down |
|
221 |
// otherwise there will be an unclean shutdown |
|
222 |
// when program ends |
|
223 |
st.execute("SHUTDOWN"); |
|
224 |
connect.close(); // if there are no other open connection |
|
225 |
}*/ |
|
226 |
|
|
227 |
/** |
|
228 |
* Returns {@code true} if the database contains data. This method returns {@code false} |
|
229 |
* if an empty EPSG database has been automatically created by HSQL and not yet populated. |
|
230 |
*/ |
|
231 |
private static boolean dataExists(final Connection connection) throws SQLException { |
|
232 |
final ResultSet tables = connection.getMetaData().getTables( |
|
233 |
null, null, "IAU2000_%", new String[] {"TABLE"}); |
|
234 |
final boolean exists = tables.next(); |
|
235 |
tables.close(); |
|
236 |
return exists; |
|
237 |
} |
|
238 |
} |
|
0 | 239 |
tags/v2_0_0_Build_2008/libraries/libJCRS/src/es/idr/teledeteccion/connection/Query.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha) |
|
34 |
* Campus Universitario s/n |
|
35 |
* 02071 Alabacete |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 967 599 200 |
|
39 |
*/ |
|
40 |
|
|
41 |
package es.idr.teledeteccion.connection; |
|
42 |
|
|
43 |
import java.io.Serializable; |
|
44 |
import java.sql.Connection; |
|
45 |
import java.sql.ResultSet; |
|
46 |
import java.sql.ResultSetMetaData; |
|
47 |
import java.sql.SQLException; |
|
48 |
import java.sql.Statement; |
|
49 |
|
|
50 |
/** |
|
51 |
* Clase para realizar las consultas a las bases de datos utilizadas |
|
52 |
* |
|
53 |
* @author Jos? Luis G?mez Mart?nez (jolugomar@gmail.com) |
|
54 |
* |
|
55 |
*/ |
|
56 |
public class Query implements Serializable{ |
|
57 |
|
|
58 |
/** |
|
59 |
* |
|
60 |
*/ |
|
61 |
private static final long serialVersionUID = 1L; |
|
62 |
|
|
63 |
/** |
|
64 |
* Acepta la sentencia y la conexi?n a la base de datos actual, |
|
65 |
* realiza una selecci?n y devuelve los datos en un ResultSet |
|
66 |
* @param sentence |
|
67 |
* @param conn |
|
68 |
* @return |
|
69 |
*/ |
|
70 |
public static synchronized ResultSet select(String sentence, Connection conn){ |
|
71 |
Statement st = null; |
|
72 |
ResultSet rs = null; |
|
73 |
|
|
74 |
try { |
|
75 |
st = conn.createStatement(); |
|
76 |
rs = st.executeQuery(sentence); |
|
77 |
st.close(); |
|
78 |
} catch (SQLException e) { |
|
79 |
e.printStackTrace(); |
|
80 |
} |
|
81 |
return rs; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
0 | 85 |
tags/v2_0_0_Build_2008/libraries/libJCRS/src/org/geotools/referencing/operation/projection/IdrRobinson.java | ||
---|---|---|
1 |
package org.geotools.referencing.operation.projection; |
|
2 |
|
|
3 |
import java.awt.geom.Point2D; |
|
4 |
import java.util.Collection; |
|
5 |
|
|
6 |
import javax.units.NonSI; |
|
7 |
|
|
8 |
import org.opengis.parameter.ParameterDescriptorGroup; |
|
9 |
import org.opengis.parameter.ParameterNotFoundException; |
|
10 |
import org.opengis.parameter.ParameterValueGroup; |
|
11 |
|
|
12 |
import org.geotools.metadata.iso.citation.CitationImpl; |
|
13 |
import org.geotools.referencing.NamedIdentifier; |
|
14 |
import org.geotools.resources.XMath; |
|
15 |
import org.geotools.resources.cts.ResourceKeys; |
|
16 |
import org.geotools.resources.cts.Resources; |
|
17 |
import org.opengis.parameter.ParameterDescriptor; |
|
18 |
import org.opengis.referencing.operation.Projection; |
|
19 |
import org.opengis.referencing.operation.MathTransform; |
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
public class IdrRobinson extends MapProjection { |
|
24 |
|
|
25 |
|
|
26 |
protected IdrRobinson(ParameterValueGroup parameters) throws ParameterNotFoundException { |
|
27 |
super(parameters); |
|
28 |
final Collection expected = getParameterDescriptors().descriptors(); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
public ParameterDescriptorGroup getParameterDescriptors() { |
|
33 |
return Provider.PARAMETERS; |
|
34 |
} |
|
35 |
|
|
36 |
public ParameterValueGroup getParameterValues() { |
|
37 |
final ParameterValueGroup values = super.getParameterValues(); |
|
38 |
return values; |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
protected Point2D inverseTransformNormalized(double x, double y, |
|
43 |
Point2D ptDst) throws ProjectionException { |
|
44 |
// TODO Auto-generated method stub |
|
45 |
return null; |
|
46 |
} |
|
47 |
|
|
48 |
protected Point2D transformNormalized(double x, double y, Point2D ptDst) |
|
49 |
throws ProjectionException { |
|
50 |
// TODO Auto-generated method stub |
|
51 |
return null; |
|
52 |
} |
|
53 |
|
|
54 |
public static class Provider extends AbstractProvider { |
|
55 |
|
|
56 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
|
57 |
new NamedIdentifier(CitationImpl.OGC, "Robinson"), |
|
58 |
new NamedIdentifier(CitationImpl.EPSG, "Robinson"), |
|
59 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR")//, |
|
60 |
//new NamedIdentifier(CitationImpl.EPSG, "9823")//, |
|
61 |
// new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational( |
|
62 |
// VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION)) |
|
63 |
}, new ParameterDescriptor[] { |
|
64 |
SEMI_MAJOR, SEMI_MINOR, |
|
65 |
CENTRAL_MERIDIAN, |
|
66 |
FALSE_EASTING, FALSE_NORTHING |
|
67 |
}); |
|
68 |
|
|
69 |
/*String[] parameterName={"central_meridian"}; |
|
70 |
projectionParameterList.add(count,parameterName); |
|
71 |
addProjectionParameter(count,"standard_parallel_1"); |
|
72 |
addProjectionParameter(count,"false_easting"); |
|
73 |
addProjectionParameter(count,"false_northing");*/ |
|
74 |
|
|
75 |
/** |
|
76 |
* Constructs a new provider. |
|
77 |
*/ |
|
78 |
public Provider() { |
|
79 |
super(PARAMETERS); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Returns the operation type for this map projection. |
|
84 |
*/ |
|
85 |
protected Class getOperationType() { |
|
86 |
return Projection.class; |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Creates a transform from the specified group of parameter values. |
|
91 |
* |
|
92 |
* @param parameters The group of parameter values. |
|
93 |
* @return The created math transform. |
|
94 |
* @throws ParameterNotFoundException if a required parameter was not found. |
|
95 |
*/ |
|
96 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
|
97 |
throws ParameterNotFoundException |
|
98 |
{ |
|
99 |
return new IdrRobinson(parameters); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
} |
|
0 | 104 |
tags/v2_0_0_Build_2008/libraries/libJCRS/src/org/geotools/referencing/operation/projection/IdrNewZealandMapGrid.java | ||
---|---|---|
1 |
/* |
|
2 |
* GeoTools - OpenSource mapping toolkit |
|
3 |
* http://geotools.org |
|
4 |
* |
|
5 |
* (C) 2005-2006, Geotools Project Managment Committee (PMC) |
|
6 |
* |
|
7 |
* This library is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU Lesser General Public |
|
9 |
* License as published by the Free Software Foundation; |
|
10 |
* version 2.1 of the License. |
|
11 |
* |
|
12 |
* This library is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
* Lesser General Public License for more details. |
|
16 |
*/ |
|
17 |
package org.geotools.referencing.operation.projection; |
|
18 |
|
|
19 |
// J2SE dependencies |
|
20 |
import java.awt.geom.Point2D; |
|
21 |
import java.util.Collection; |
|
22 |
import javax.units.NonSI; |
|
23 |
import javax.units.SI; |
|
24 |
import javax.units.Unit; |
|
25 |
|
|
26 |
import org.geotools.metadata.iso.citation.CitationImpl; |
|
27 |
import org.geotools.referencing.NamedIdentifier; |
|
28 |
import org.opengis.metadata.Identifier; |
|
29 |
import org.opengis.parameter.ParameterDescriptor; |
|
30 |
import org.opengis.parameter.ParameterDescriptorGroup; |
|
31 |
import org.opengis.parameter.ParameterNotFoundException; |
|
32 |
import org.opengis.parameter.ParameterValueGroup; |
|
33 |
import org.opengis.referencing.operation.MathTransform; |
|
34 |
import org.opengis.spatialschema.geometry.complex.Complex; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* Implementation of the NZMG (New Zealand Map Grid) projection. |
|
39 |
* <p> |
|
40 |
* This is an implementation of algorithm published by |
|
41 |
* <a href="http://www.govt.nz/record?recordid=28">Land Information New Zealand</a>. |
|
42 |
* The algorithm is documented <a href="http://www.linz.govt.nz/rcs/linz/6137/">here</a>. |
|
43 |
* |
|
44 |
* @since 2.2 |
|
45 |
* @source $URL: http://svn.geotools.org/geotools/tags/2.3.0/module/referencing/src/org/geotools/referencing/operation/projection/NewZealandMapGrid.java $ |
|
46 |
* @version $Id$ |
|
47 |
* @author Justin Deoliveira |
|
48 |
* @author Martin Desruisseaux |
|
49 |
* |
|
50 |
* @todo The algorithm uses complex numbers, which is not very well supported in Java. This |
|
51 |
* implementation uses {@linkplain Complex} as a support class. Various instances of |
|
52 |
* {@link Complex} are created once for ever at {@code NewZealandMapGrid} construction |
|
53 |
* time, in order to avoid creating up to 6 objects for every point to be projected. |
|
54 |
* The downside is that transformation methods must be synchronized. The cost should |
|
55 |
* be small for simple applications, but may become important for multi-thread applications. |
|
56 |
* Furthermore, those fields raise a slight serialization issue. |
|
57 |
* <p> |
|
58 |
* The most efficient fix in Java would be to expand inline all {@link Complex} operations |
|
59 |
* like {@link Complex#add add} (easy), {@link Complex#multiply multiply} (more tedious), |
|
60 |
* <cite>etc.</cite>, until we get a code using only {@code double} primitives on the stack |
|
61 |
* and no {@link Complex} objects on the heap (except the {@code A} and {@code B} constants). |
|
62 |
* But it would make the code significantly more complex and difficult to read. |
|
63 |
* <p> |
|
64 |
* An elegant fix would have been "lightweight objects" allocated on the stack (something |
|
65 |
* similar to {@code struct} in C#), if such thing existed in the Java language. |
|
66 |
*/ |
|
67 |
public class IdrNewZealandMapGrid extends MapProjection { |
|
68 |
/** |
|
69 |
* For compatibility with different versions during deserialization. |
|
70 |
*/ |
|
71 |
private static final long serialVersionUID = 8394817836243729133L; |
|
72 |
|
|
73 |
/** |
|
74 |
* Coefficients for forward and inverse projection. |
|
75 |
*/ |
|
76 |
/*private static final Complex[] A = { |
|
77 |
new Complex( 0.7557853228, 0.0 ), |
|
78 |
new Complex( 0.249204646, 0.003371507 ), |
|
79 |
new Complex( -0.001541739, 0.041058560 ), |
|
80 |
new Complex( -0.10162907, 0.01727609 ), |
|
81 |
new Complex( -0.26623489, -0.36249218 ), |
|
82 |
new Complex( -0.6870983, -1.1651967 ) |
|
83 |
};*/ |
|
84 |
|
|
85 |
/** |
|
86 |
* Coefficients for inverse projection. |
|
87 |
*/ |
|
88 |
/*private static final Complex[] B = { |
|
89 |
new Complex( 1.3231270439, 0.0 ), |
|
90 |
new Complex( -0.577245789, -0.007809598 ), |
|
91 |
new Complex( 0.508307513, -0.112208952 ), |
|
92 |
new Complex( -0.15094762, 0.18200602 ), |
|
93 |
new Complex( 1.01418179, 1.64497696 ), |
|
94 |
new Complex( 1.9660549, 2.5127645 ) |
|
95 |
};*/ |
|
96 |
|
|
97 |
/** |
|
98 |
* Coefficients for inverse projection. |
|
99 |
*/ |
|
100 |
private static final double[] TPHI = new double[] { |
|
101 |
1.5627014243, 0.5185406398, -0.03333098, -0.1052906, -0.0368594, 0.007317, |
|
102 |
0.01220, 0.00394, -0.0013 |
|
103 |
}; |
|
104 |
|
|
105 |
/** |
|
106 |
* Coefficients for forward projection. |
|
107 |
*/ |
|
108 |
private static final double[] TPSI = new double[] { |
|
109 |
0.6399175073, -0.1358797613, 0.063294409, -0.02526853, 0.0117879, |
|
110 |
-0.0055161, 0.0026906, -0.001333, 0.00067, -0.00034 |
|
111 |
}; |
|
112 |
|
|
113 |
/** |
|
114 |
* A temporary complex number used during transform calculation. Created once for |
|
115 |
* ever in order to avoid new object creation for every point to be transformed. |
|
116 |
*/ |
|
117 |
/*private transient final Complex theta = new Complex();*/ |
|
118 |
|
|
119 |
/** |
|
120 |
* An other temporary complex number created once for ever for the same reason than |
|
121 |
* {@link #theta}. This number is usually equals to some other complex number raised |
|
122 |
* to some power. |
|
123 |
*/ |
|
124 |
/*private transient final Complex power = new Complex();*/ |
|
125 |
|
|
126 |
/** |
|
127 |
* An other temporary complex number created once for ever for the same reason than |
|
128 |
* {@link #theta}. |
|
129 |
* |
|
130 |
* @todo Need to reassign those fields on deserialization. |
|
131 |
*/ |
|
132 |
|
|
133 |
/*private transient final Complex z=new Complex(), t=new Complex(), |
|
134 |
num=new Complex(), denom=new Complex();*/ |
|
135 |
|
|
136 |
/** |
|
137 |
* Constructs a new map projection with default parameter values. |
|
138 |
*/ |
|
139 |
protected IdrNewZealandMapGrid() { |
|
140 |
this((ParameterValueGroup) Provider.PARAMETERS.createValue()); |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* Constructs a new map projection from the supplied parameters. |
|
145 |
* |
|
146 |
* @param parameters The parameter values in standard units. |
|
147 |
* @throws ParameterNotFoundException if a mandatory parameter is missing. |
|
148 |
*/ |
|
149 |
protected IdrNewZealandMapGrid(final ParameterValueGroup parameters) |
|
150 |
throws ParameterNotFoundException |
|
151 |
{ |
|
152 |
super(parameters); |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* {@inheritDoc} |
|
157 |
*/ |
|
158 |
public ParameterDescriptorGroup getParameterDescriptors() { |
|
159 |
return Provider.PARAMETERS; |
|
160 |
} |
|
161 |
|
|
162 |
/** |
|
163 |
* Must be overrided because {@link Provider} uses instances of |
|
164 |
* {@link ModifiedParameterDescriptor}. This hack was needed because the New Zeland map |
|
165 |
* projection uses particular default values for parameters like "False Easting", etc. |
|
166 |
*/ |
|
167 |
/*final boolean isExpectedParameter(final Collection expected, final ParameterDescriptor param) { |
|
168 |
return ModifiedParameterDescriptor.contains(expected, param); |
|
169 |
}*/ |
|
170 |
|
|
171 |
/** |
|
172 |
* Transforms the specified (<var>x</var>,<var>y</var>) coordinate (units in radians) |
|
173 |
* and stores the result in {@code ptDst} (linear distance on a unit sphere). |
|
174 |
*/ |
|
175 |
protected synchronized Point2D transformNormalized(final double x, final double y, |
|
176 |
final Point2D ptDst) |
|
177 |
throws ProjectionException |
|
178 |
{ |
|
179 |
/* |
|
180 |
final double dphi = (y - latitudeOfOrigin) * (180/Math.PI * 3600E-5); |
|
181 |
double dphi_pow_i = dphi; |
|
182 |
double dpsi = 0; |
|
183 |
for (int i=0; i<TPSI.length; i++) { |
|
184 |
dpsi += (TPSI[i] * dphi_pow_i); |
|
185 |
dphi_pow_i *= dphi; |
|
186 |
} |
|
187 |
power.real = theta.real = dpsi; |
|
188 |
power.imag = theta.imag = x; |
|
189 |
z.multiply(A[0], power); |
|
190 |
for (int i=1; i<A.length; i++) { |
|
191 |
power.multiply(power, theta); |
|
192 |
z.addMultiply(z, A[i], power); |
|
193 |
} |
|
194 |
if (ptDst != null) { |
|
195 |
ptDst.setLocation(z.imag, z.real); |
|
196 |
return ptDst; |
|
197 |
} |
|
198 |
return new Point2D.Double(z.imag, z.real); |
|
199 |
*/ |
|
200 |
return new Point2D.Double(0.0, 0.0); |
|
201 |
} |
|
202 |
|
|
203 |
/** |
|
204 |
* Transforms the specified (<var>x</var>,<var>y</var>) coordinate |
|
205 |
* and stores the result in {@code ptDst}. |
|
206 |
*/ |
|
207 |
protected synchronized Point2D inverseTransformNormalized(final double x, final double y, |
|
208 |
final Point2D ptDst) |
|
209 |
throws ProjectionException |
|
210 |
{ |
|
211 |
/* |
|
212 |
power.real = z.real = y; |
|
213 |
power.imag = z.imag = x; |
|
214 |
theta.multiply(B[0], z); |
|
215 |
for (int j=1; j<B.length; j++) { |
|
216 |
power.multiply(power, z); |
|
217 |
theta.addMultiply(theta, B[j], power); |
|
218 |
} |
|
219 |
// increasing the number of iterations through this loop decreases |
|
220 |
// the error in the calculation, but 3 iterations gives 10-3 accuracy |
|
221 |
for (int j=0; j<3; j++) { |
|
222 |
power.power(theta, 2); |
|
223 |
num.addMultiply(z, A[1], power); |
|
224 |
for (int k=2; k<A.length; k++) { |
|
225 |
power.multiply(power, theta); |
|
226 |
t.multiply(A[k], power); |
|
227 |
t.multiply(t, k); |
|
228 |
num.add(num, t); |
|
229 |
} |
|
230 |
|
|
231 |
power.real = 1; |
|
232 |
power.imag = 0; |
|
233 |
denom.copy(A[0]); |
|
234 |
for (int k=1; k<A.length; k++) { |
|
235 |
power.multiply(power, theta); |
|
236 |
t.multiply(A[k], power); |
|
237 |
t.multiply(t, k+1); |
|
238 |
denom.add(denom, t); |
|
239 |
} |
|
240 |
theta.divide(num, denom); |
|
241 |
} |
|
242 |
|
|
243 |
final double dpsi = theta.real; |
|
244 |
double dpsi_pow_i = dpsi; |
|
245 |
double dphi = TPHI[0] * dpsi; |
|
246 |
for (int i=1; i<TPHI.length; i++) { |
|
247 |
dpsi_pow_i *= dpsi; |
|
248 |
dphi += (TPHI[i] * dpsi_pow_i); |
|
249 |
} |
|
250 |
|
|
251 |
dphi = dphi / (180/Math.PI * 3600E-5) + latitudeOfOrigin; |
|
252 |
if (ptDst != null) { |
|
253 |
ptDst.setLocation(theta.imag, dphi); |
|
254 |
return ptDst; |
|
255 |
} |
|
256 |
return new Point2D.Double(theta.imag, dphi); |
|
257 |
*/ |
|
258 |
return new Point2D.Double(0.0,0.0); |
|
259 |
} |
|
260 |
|
|
261 |
/** |
|
262 |
* The {@link org.geotools.referencing.operation.MathTransformProvider} for |
|
263 |
* {@linkplain IdrNewZealandMapGrid New Zealand Map Grid}. |
|
264 |
* |
|
265 |
* @since 2.2 |
|
266 |
* @version $Id$ |
|
267 |
* @author Justin Deoliveira |
|
268 |
*/ |
|
269 |
public static class Provider extends AbstractProvider { |
|
270 |
/** |
|
271 |
* For compatibility with different versions during deserialization. |
|
272 |
*/ |
|
273 |
private static final long serialVersionUID = -7716733400419275656L; |
|
274 |
|
|
275 |
|
|
276 |
/** |
|
277 |
* The operation parameter descriptor for the {@link #semiMajor semiMajor} parameter value. |
|
278 |
* Valid values range is from 0 to infinity. This parameter is mandatory. |
|
279 |
* |
|
280 |
* @todo Would like to start range from 0 <u>exclusive</u>. |
|
281 |
*/ |
|
282 |
public static final ParameterDescriptor SEMI_MAJOR_LOCAL = createDescriptor( |
|
283 |
new NamedIdentifier[] { |
|
284 |
new NamedIdentifier(CitationImpl.OGC, "semi_major"), |
|
285 |
new NamedIdentifier(CitationImpl.EPSG, "semi-major axis") //epsg does not specifically define this parameter |
|
286 |
}, |
|
287 |
6378388.0, 6378388.0, 6378388.0, SI.METER); |
|
288 |
|
|
289 |
/** |
|
290 |
* The operation parameter descriptor for the {@link #semiMinor semiMinor} parameter value. |
|
291 |
* Valid values range is from 0 to infinity. This parameter is mandatory. |
|
292 |
* |
|
293 |
* @todo Would like to start range from 0 <u>exclusive</u>. |
|
294 |
*/ |
|
295 |
public static final ParameterDescriptor SEMI_MINOR_LOCAL = createDescriptor( |
|
296 |
new NamedIdentifier[] { |
|
297 |
new NamedIdentifier(CitationImpl.OGC, "semi_minor"), |
|
298 |
new NamedIdentifier(CitationImpl.EPSG, "semi-minor axis") //epsg does not specifically define this parameter |
|
299 |
}, |
|
300 |
6378388.0*(1-1/297.0), 6378388.0*(1-1/297.0), 6378388.0*(1-1/297.0), SI.METER); |
|
301 |
|
|
302 |
/** |
|
303 |
* The operation parameter descriptor for the {@link #centralMeridian centralMeridian} |
|
304 |
* parameter value. Valid values range is from -180 to 180. Default value is 0. |
|
305 |
*/ |
|
306 |
public static final ParameterDescriptor CENTRAL_MERIDIAN_LOCAL = createDescriptor( |
|
307 |
new NamedIdentifier[] { |
|
308 |
new NamedIdentifier(CitationImpl.OGC, "central_meridian"), |
|
309 |
new NamedIdentifier(CitationImpl.EPSG, "Longitude of natural origin"), |
|
310 |
new NamedIdentifier(CitationImpl.EPSG, "Longitude of false origin"), |
|
311 |
new NamedIdentifier(CitationImpl.ESRI, "Longitude_Of_Origin"), |
|
312 |
new NamedIdentifier(CitationImpl.ESRI, "Longitude_Of_Center"), //ESRI uses this in orthographic (not to be confused with Longitude_Of_Center in oblique mercator) |
|
313 |
new NamedIdentifier(CitationImpl.GEOTIFF, "NatOriginLong") |
|
314 |
}, |
|
315 |
173.0, 173.0, 173.0, NonSI.DEGREE_ANGLE); |
|
316 |
|
|
317 |
/** |
|
318 |
* The operation parameter descriptor for the {@link #latitudeOfOrigin latitudeOfOrigin} |
|
319 |
* parameter value. Valid values range is from -90 to 90. Default value is 0. |
|
320 |
*/ |
|
321 |
public static final ParameterDescriptor LATITUDE_OF_ORIGIN_LOCAL = createDescriptor( |
|
322 |
new NamedIdentifier[] { |
|
323 |
new NamedIdentifier(CitationImpl.OGC, "latitude_of_origin"), |
|
324 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of false origin"), |
|
325 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of natural origin"), |
|
326 |
new NamedIdentifier(CitationImpl.ESRI, "Latitude_Of_Center"), //ESRI uses this in orthographic |
|
327 |
new NamedIdentifier(CitationImpl.GEOTIFF, "NatOriginLat") |
|
328 |
}, |
|
329 |
-41.0, -41.0, -41.0, NonSI.DEGREE_ANGLE); |
|
330 |
|
|
331 |
/** |
|
332 |
* The operation parameter descriptor for the {@link #falseEasting falseEasting} |
|
333 |
* parameter value. Valid values range is unrestricted. Default value is 0. |
|
334 |
*/ |
|
335 |
public static final ParameterDescriptor FALSE_EASTING_LOCAL = createDescriptor( |
|
336 |
new NamedIdentifier[] { |
|
337 |
new NamedIdentifier(CitationImpl.OGC, "false_easting"), |
|
338 |
new NamedIdentifier(CitationImpl.EPSG, "False easting"), |
|
339 |
new NamedIdentifier(CitationImpl.EPSG, "Easting at false origin"), |
|
340 |
new NamedIdentifier(CitationImpl.GEOTIFF, "FalseEasting") |
|
341 |
}, |
|
342 |
2510000.0, 2510000.0, 2510000.0, SI.METER); |
|
343 |
|
|
344 |
/** |
|
345 |
* The operation parameter descriptor for the {@link #falseNorthing falseNorthing} |
|
346 |
* parameter value. Valid values range is unrestricted. Default value is 0. |
|
347 |
*/ |
|
348 |
public static final ParameterDescriptor FALSE_NORTHING_LOCAL = createDescriptor( |
|
349 |
new NamedIdentifier[] { |
|
350 |
new NamedIdentifier(CitationImpl.OGC, "false_northing"), |
|
351 |
new NamedIdentifier(CitationImpl.EPSG, "False northing"), |
|
352 |
new NamedIdentifier(CitationImpl.EPSG, "Northing at false origin"), |
|
353 |
new NamedIdentifier(CitationImpl.GEOTIFF, "FalseNorthing") |
|
354 |
}, |
|
355 |
6023150.0, 6023150.0, 6023150.0, SI.METER); |
|
356 |
|
|
357 |
/** |
|
358 |
* The parameters group. |
|
359 |
*/ |
|
360 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new Identifier[] { |
|
361 |
new NamedIdentifier(CitationImpl.OGC, "New_Zealand_Map_Grid"), |
|
362 |
new NamedIdentifier(CitationImpl.EPSG, "New Zealand Map Grid"), |
|
363 |
new NamedIdentifier(CitationImpl.EPSG, "27200"), |
|
364 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR") |
|
365 |
}, |
|
366 |
new ParameterDescriptor[] { |
|
367 |
SEMI_MAJOR_LOCAL, SEMI_MINOR_LOCAL, |
|
368 |
LATITUDE_OF_ORIGIN_LOCAL, CENTRAL_MERIDIAN_LOCAL, |
|
369 |
FALSE_EASTING_LOCAL, FALSE_NORTHING_LOCAL |
|
370 |
}); |
|
371 |
/*new ParameterDescriptor[] { |
|
372 |
new ModifiedParameterDescriptor(SEMI_MAJOR_L, 6378388.0), |
|
373 |
new ModifiedParameterDescriptor(SEMI_MINOR, 6378388.0*(1-1/297.0)), |
|
374 |
new ModifiedParameterDescriptor(LATITUDE_OF_ORIGIN, -41.0), |
|
375 |
new ModifiedParameterDescriptor(CENTRAL_MERIDIAN, 173.0), |
|
376 |
new ModifiedParameterDescriptor(FALSE_EASTING, 2510000.0), |
|
377 |
new ModifiedParameterDescriptor(FALSE_NORTHING, 6023150.0)*/ |
|
378 |
|
|
379 |
|
|
380 |
/** |
|
381 |
* Constructs a new provider. |
|
382 |
*/ |
|
383 |
public Provider() { |
|
384 |
super(PARAMETERS); |
|
385 |
} |
|
386 |
|
|
387 |
/** |
|
388 |
* Creates a transform from the specified group of parameter values. This method doesn't |
|
389 |
* check for the spherical case, since the New Zealand Map Grid projection is used with |
|
390 |
* the International 1924 ellipsoid. |
|
391 |
* |
|
392 |
* @param parameters The group of parameter values. |
|
393 |
* @return The created math transform. |
|
394 |
* @throws ParameterNotFoundException if a required parameter was not found. |
|
395 |
*/ |
|
396 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
|
397 |
throws ParameterNotFoundException |
|
398 |
{ |
|
399 |
return new IdrNewZealandMapGrid(parameters); |
|
400 |
} |
|
401 |
} |
|
402 |
} |
|
0 | 403 |
tags/v2_0_0_Build_2008/libraries/libJCRS/src/org/geotools/referencing/operation/projection/IdrObliqueMercator.java | ||
---|---|---|
1 |
/* |
|
2 |
* Geotools - OpenSource mapping toolkit |
|
3 |
* (C) 2005, Geotools Project Managment Committee (PMC) |
|
4 |
* |
|
5 |
* This library is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU Lesser General Public |
|
7 |
* License as published by the Free Software Foundation; either |
|
8 |
* version 2.1 of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This library 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 GNU |
|
13 |
* Lesser General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU Lesser General Public |
|
16 |
* License along with this library; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 |
* |
|
19 |
* |
|
20 |
* This package contains formulas from the PROJ package of USGS. |
|
21 |
* USGS's work is fully acknowledged here. |
|
22 |
*/ |
|
23 |
/* |
|
24 |
** libproj -- library of cartographic projections |
|
25 |
** Some parts Copyright (c) 2003 Gerald I. Evenden |
|
26 |
** |
|
27 |
** Permission is hereby granted, free of charge, to any person obtaining |
|
28 |
** a copy of this software and associated documentation files (the |
|
29 |
** "Software"), to deal in the Software without restriction, including |
|
30 |
** without limitation the rights to use, copy, modify, merge, publish, |
|
31 |
** distribute, sublicense, and/or sell copies of the Software, and to |
|
32 |
** permit persons to whom the Software is furnished to do so, subject to |
|
33 |
** the following conditions: |
|
34 |
** |
|
35 |
** The above copyright notice and this permission notice shall be |
|
36 |
** included in all copies or substantial portions of the Software. |
|
37 |
** |
|
38 |
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
39 |
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
40 |
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
41 |
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
42 |
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
43 |
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
44 |
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
45 |
*/ |
|
46 |
package org.geotools.referencing.operation.projection; |
|
47 |
|
|
48 |
// J2SE dependencies and extensions |
|
49 |
import java.awt.geom.Point2D; |
|
50 |
import java.util.Collection; |
|
51 |
|
|
52 |
import javax.units.NonSI; |
|
53 |
import javax.units.SI; |
|
54 |
import javax.units.Unit; |
|
55 |
|
|
56 |
import org.geotools.metadata.iso.citation.CitationImpl; |
|
57 |
import org.geotools.referencing.NamedIdentifier; |
|
58 |
import org.geotools.referencing.operation.projection.IdrAzimuthalEquidistant.Provider; |
|
59 |
import org.geotools.resources.cts.ResourceKeys; |
|
60 |
import org.geotools.resources.cts.Resources; |
|
61 |
import org.opengis.parameter.ParameterDescriptor; |
|
62 |
import org.opengis.parameter.ParameterDescriptorGroup; |
|
63 |
import org.opengis.parameter.ParameterNotFoundException; |
|
64 |
import org.opengis.parameter.ParameterValueGroup; |
|
65 |
import org.opengis.referencing.operation.CylindricalProjection; |
|
66 |
import org.opengis.referencing.operation.MathTransform; |
|
67 |
|
|
68 |
|
|
69 |
/** |
|
70 |
* Oblique Mercator Projection. A conformal, oblique, cylindrical projection |
|
71 |
* with the cylinder touching the ellipsoid (or sphere) along a great circle |
|
72 |
* path (the central line). The Mercator and Transverse Mercator projections |
|
73 |
* can be thought of as special cases of the oblique mercator, where the central |
|
74 |
* line is along the equator or a meridian, respectively. The Oblique Mercator |
|
75 |
* projection has been used in Switzerland, Hungary, Madagascar, |
|
76 |
* Malaysia, Borneo and the panhandle of Alaska. |
|
77 |
* <br><br> |
|
78 |
* |
|
79 |
* The Oblique Mercator projection uses a (U,V) coordinate system, with the |
|
80 |
* U axis along the central line. During the forward projection, coordinates |
|
81 |
* from the ellipsoid are projected conformally to a sphere of constant total |
|
82 |
* curvature, called the 'aposphere', before being projected onto the plane. |
|
83 |
* The projection coordinates are further convented to a (X,Y) coordinate system |
|
84 |
* by rotating the calculated (u,v) coordinates to give output (x,y) coordinates. |
|
85 |
* The rotation value is usually the same as the projection azimuth (the angle, |
|
86 |
* east of north, of the central line), but some cases allow a separate |
|
87 |
* rotation parameter. |
|
88 |
* <br><br> |
|
89 |
* |
|
90 |
* There are two forms of the oblique mercator, differing in the origin of |
|
91 |
* their grid coordinates. The Hotine_Oblique_Mercator (EPSG code 9812) has grid |
|
92 |
* coordinates start at the intersection of the central line and the equator of the |
|
93 |
* aposphere. The Oblique_Mercator (EPSG code 9815) is the same, except the grid |
|
94 |
* coordinates begin at the central point (where the latitude of center and |
|
95 |
* central line intersect). ESRI separates these two case by appending |
|
96 |
* "Natural_Origin" (for the Hotine_Oblique_Mercator) and "Center" |
|
97 |
* (for the Obique_Mercator) to the projection names. |
|
98 |
* <br><br> |
|
99 |
* |
|
100 |
* Two different methods are used to specify the central line for the |
|
101 |
* oblique mercator: 1) a central point and an azimuth, |
|
102 |
* east of north, describing the central line and |
|
103 |
* 2) two points on the central line. The EPSG does not use the two point method, |
|
104 |
* while ESRI separates the two cases by putting "Azimuth" and "Two_Point" in |
|
105 |
* their projection names. Both cases use the point where the "latitude_of_center" |
|
106 |
* parameter crosses the central line as the projection's central point. |
|
107 |
* The central meridian is not a projection parameter, and is instead calculated |
|
108 |
* as the intersection between the central line and the equator of the aposphere. |
|
109 |
* <br><br> |
|
110 |
* |
|
111 |
* For the azimuth method, the central latitude cannot be +- 90.0 degrees |
|
112 |
* and the central line cannot be at a maximum or minimum latitude at the central point. |
|
113 |
* In the two point method, the latitude of the first and second points cannot be |
|
114 |
* equal. Also, the latitude of the first point and central point cannot be |
|
115 |
* +- 90.0 degrees. Furthermore, the latitude of the first point cannot be 0.0 and |
|
116 |
* the latitude of the second point cannot be - 90.0 degrees. A change of |
|
117 |
* 10^-7 radians can allow calculation at these special cases. Snyder's restriction |
|
118 |
* of the central latitude being 0.0 has been removed, since the equaitons appear |
|
119 |
* to work correctly in this case. |
|
120 |
* <br><br> |
|
121 |
* |
|
122 |
* Azimuth values of 0.0 and +- 90.0 degrees are allowed (and used in Hungary |
|
123 |
* and Switzerland), though these cases would usually use a Mercator or |
|
124 |
* Transverse Mercator projection instead. Azimuth values > 90 degrees cause |
|
125 |
* errors in the equations. |
|
126 |
* <br><br> |
|
127 |
* |
|
128 |
* The oblique mercator is also called the "Rectified Skew Orthomorphic" (RSO). |
|
129 |
* It appears is that the only difference from the oblique mercator is that |
|
130 |
* the RSO allows the rotation from the (U,V) to (X,Y) coordinate system to be different |
|
131 |
* from the azimuth. This separate parameter is called "rectified_grid_angle" (or |
|
132 |
* "XY_Plane_Rotation" by ESRI) and is also included in the EPSG's parameters |
|
133 |
* for the Oblique Mercator and Hotine Oblique Mercator. |
|
134 |
* The rotation parameter is optional in all the non-two point projections and will be |
|
135 |
* set to the azimuth if not specified. |
|
136 |
* <br><br> |
|
137 |
* |
|
138 |
* Projection cases and aliases implemented by the {@link IdrObliqueMercator} are: |
|
139 |
* <ul> |
|
140 |
* <li>Oblique_Mercator (EPSG code 9815) - grid coordinates begin at the central point, has "rectified_grid_angle" parameter.</li> |
|
141 |
* <li>Hotine_Oblique_Mercator_Azimuth_Center (ESRI) - grid coordinates begin at the central point.</li> |
|
142 |
* <li>Rectified_Skew_Orthomorphic_Center (ESRI) - grid coordinates begin at the central point, has "rectified_grid_angle" parameter.</li> |
|
143 |
* |
|
144 |
* <li>Hotine_Oblique_Mercator (EPSG code 9812) - grid coordinates begin at the interseciton of the central line and aposphere equator, has "rectified_grid_angle" parameter.</li> |
|
145 |
* <li>Hotine_Oblique_Mercator_Azimuth_Natural_Origin (ESRI) - grid coordinates begin at the interseciton of the central line and aposphere equator.</li> |
|
146 |
* <li>Rectified_Skew_Orthomorphic_Natural_Origin (ESRI) - grid coordinates begin at the interseciton of the central line and aposphere equator, has "rectified_grid_angle" parameter.</li> |
|
147 |
* |
|
148 |
* <li>Hotine_Oblique_Mercator_Two_Point_Center (ESRI) - grid coordinates begin at the central point.</li> |
|
149 |
* <li>Hotine_Oblique_Mercator_Two_Point_Natural_Origin (ESRI) - grid coordinates begin at the interseciton of the central line and aposphere equator.</li> |
|
150 |
* </ul> |
|
151 |
* |
|
152 |
* <strong>References:</strong> |
|
153 |
* <ul> |
|
154 |
* <li><code>libproj4</code> is available at |
|
155 |
* <A HREF="http://members.bellatlantic.net/~vze2hc4d/proj4/">libproj4 Miscellanea</A><br> |
|
156 |
* Relevent files are: <code>PJ_omerc.c</code>, <code>pj_tsfn.c</code>, |
|
157 |
* <code>pj_fwd.c</code>, <code>pj_inv.c</code> and <code>lib_proj.h</code></li> |
|
158 |
* <li> John P. Snyder (Map Projections - A Working Manual, |
|
159 |
* U.S. Geological Survey Professional Paper 1395, 1987)</li> |
|
160 |
* <li> "Coordinate Conversions and Transformations including Formulas", |
|
161 |
* EPSG Guidence Note Number 7 part 2, Version 24.</li> |
|
162 |
* <li>Gerald Evenden, 2004, <a href="http://members.verizon.net/~vze2hc4d/proj4/omerc.pdf"> |
|
163 |
* Documentation of revised Oblique Mercator</a></li> |
|
164 |
* </ul> |
|
165 |
* |
|
166 |
* @see <A HREF="http://mathworld.wolfram.com/MercatorProjection.html">Oblique Mercator projection on MathWorld</A> |
|
167 |
* @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/hotine_oblique_mercator.html">hotine_oblique_mercator on Remote Sensing</A> |
|
168 |
* @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/oblique_mercator.html">oblique_mercator on Remote Sensing</A> |
|
169 |
* |
|
170 |
* @version $Id$ |
|
171 |
* @author Rueben Schulz |
|
172 |
*/ |
|
173 |
public class IdrObliqueMercator extends MapProjection { |
|
174 |
|
|
175 |
private final double scaleFactorLocal; |
|
176 |
private final double falseEastingLocal; |
|
177 |
private final double falseNorthingLocal; |
|
178 |
|
|
179 |
/** |
|
180 |
* Latitude of the projection centre. This is similar to the |
|
181 |
* {@link #latitudeOfOrigin}, but the latitude of origin is the |
|
182 |
* Earth equator on aposphere for the oblique mercator. Needed |
|
183 |
* for WKT. |
|
184 |
*/ |
|
185 |
private final double latitudeOfCentre; |
|
186 |
|
|
187 |
/** |
|
188 |
* Longitude of the projection centre. This is <strong>NOT</strong> equal |
|
189 |
* to the {@link #centralMeridian}, which is the meridian where the |
|
190 |
* central line intersects the Earth equator on aposphere. Needed for |
|
191 |
* for non-two point WKT. |
|
192 |
*/ |
|
193 |
private final double longitudeOfCentre; |
|
194 |
|
|
195 |
/** |
|
196 |
* The azimuth of the central line passing throught the centre of the |
|
197 |
* projection, needed for for non-two point WKT. |
|
198 |
*/ |
|
199 |
private double alpha_c; |
|
200 |
|
|
201 |
/** |
|
202 |
* The rectified bearing of the central line, needed for non-two point WKT. Equals |
|
203 |
* {@link #alpha_c} if the "rectified_grid_angle" parameter value is not set. |
|
204 |
*/ |
|
205 |
private double rectGridAngle; |
|
206 |
|
|
207 |
/** |
|
208 |
* The latitude of the 1st point used to specify the central line, needed for two point |
|
209 |
* WKT. |
|
210 |
*/ |
|
211 |
private final double latitudeOf1stPoint; |
|
212 |
|
|
213 |
/** |
|
214 |
* The longitude of the 1st point used to specify the central line, needed for two point |
|
215 |
* WKT. |
|
216 |
*/ |
|
217 |
private final double longitudeOf1stPoint; |
|
218 |
|
|
219 |
/** |
|
220 |
* The latitude of the 2nd point used to specify the central line, needed for two point |
|
221 |
* WKT. |
|
222 |
*/ |
|
223 |
private final double latitudeOf2ndPoint; |
|
224 |
|
|
225 |
/** |
|
226 |
* The longitude of the 2nd point used to specify the central line, needed for two point |
|
227 |
* WKT. |
|
228 |
*/ |
|
229 |
private double longitudeOf2ndPoint; |
|
230 |
|
|
231 |
/** |
|
232 |
* Constants used in the transformation. |
|
233 |
*/ |
|
234 |
private double B, A, E; |
|
235 |
|
|
236 |
/** |
|
237 |
* Convenience values equal to {@link #A} / {@link #B}, |
|
238 |
* {@link #A}×{@link #B}, and {@link #B} / {@link #A}. |
|
239 |
*/ |
|
240 |
private final double ArB, AB, BrA; |
|
241 |
|
|
242 |
/** |
|
243 |
* v values when the input latitude is a pole. |
|
244 |
*/ |
|
245 |
private final double v_pole_n, v_pole_s; |
|
246 |
|
|
247 |
/** |
|
248 |
* Sine and Cosine values for gamma0 (the angle between the meridian |
|
249 |
* and central line at the intersection between the central line and |
|
250 |
* the Earth equator on aposphere). |
|
251 |
*/ |
|
252 |
private final double singamma0, cosgamma0; |
|
253 |
|
|
254 |
/** |
|
255 |
* Sine and Cosine values for the rotation between (U,V) and |
|
256 |
* (X,Y) coordinate systems |
|
257 |
*/ |
|
258 |
private final double sinrot, cosrot; |
|
259 |
|
|
260 |
/** |
|
261 |
* u value (in (U,V) coordinate system) of the central point. Used in the |
|
262 |
* oblique mercater case. The v value of the central point is 0.0. |
|
263 |
*/ |
|
264 |
private double u_c; |
|
265 |
|
|
266 |
/** |
|
267 |
* <code>true</code> if using two points on the central line to specify |
|
268 |
* the azimuth. |
|
269 |
*/ |
|
270 |
private final boolean twoPoint; |
|
271 |
|
|
272 |
/** |
|
273 |
* <code>true</code> for hotine oblique mercator, or <code>false</code> |
|
274 |
* for the oblique mercator case. |
|
275 |
*/ |
|
276 |
private final boolean hotine; |
|
277 |
|
|
278 |
/** |
|
279 |
* The {@link org.geotools.referencing.operation.MathTransformProvider} |
|
280 |
* for an {@link IdrObliqueMercator} projection. |
|
281 |
* |
|
282 |
* @see org.geotools.referencing.operation.DefaultMathTransformFactory |
|
283 |
* |
|
284 |
* @version $Id$ |
|
285 |
* @author Rueben Schulz |
|
286 |
*/ |
|
287 |
public static class Provider extends AbstractProvider { |
|
288 |
|
|
289 |
public static final ParameterDescriptor SCALE_FACTOR_LOCAL = createDescriptor( |
|
290 |
new NamedIdentifier[] { |
|
291 |
new NamedIdentifier(CitationImpl.OGC, "scale_factor"), |
|
292 |
new NamedIdentifier(CitationImpl.EPSG, "Scale factor on initial line"), |
|
293 |
new NamedIdentifier(CitationImpl.EPSG, "Scale factor at natural origin"), |
|
294 |
new NamedIdentifier(CitationImpl.GEOTIFF, "ScaleAtNatOrigin"), |
|
295 |
new NamedIdentifier(CitationImpl.GEOTIFF, "ScaleAtCenter") |
|
296 |
}, |
|
297 |
1, 0, Double.POSITIVE_INFINITY, Unit.ONE); |
|
298 |
|
|
299 |
public static final ParameterDescriptor FALSE_EASTING_LOCAL = createDescriptor( |
|
300 |
new NamedIdentifier[] { |
|
301 |
new NamedIdentifier(CitationImpl.OGC, "false_easting"), |
|
302 |
new NamedIdentifier(CitationImpl.EPSG, "False easting"), |
|
303 |
new NamedIdentifier(CitationImpl.EPSG, "Easting at projection centre"), |
|
304 |
new NamedIdentifier(CitationImpl.EPSG, "Easting at false origin"), |
|
305 |
new NamedIdentifier(CitationImpl.GEOTIFF, "FalseEasting") |
|
306 |
}, |
|
307 |
0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METER); |
|
308 |
|
|
309 |
public static final ParameterDescriptor FALSE_NORTHING_LOCAL = createDescriptor( |
|
310 |
new NamedIdentifier[] { |
|
311 |
new NamedIdentifier(CitationImpl.OGC, "false_northing"), |
|
312 |
new NamedIdentifier(CitationImpl.EPSG, "False northing"), |
|
313 |
new NamedIdentifier(CitationImpl.EPSG, "Northing at projection centre"), |
|
314 |
new NamedIdentifier(CitationImpl.EPSG, "Northing at false origin"), |
|
315 |
new NamedIdentifier(CitationImpl.GEOTIFF, "FalseNorthing") |
|
316 |
}, |
|
317 |
0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METER); |
|
318 |
|
|
319 |
|
|
320 |
/** |
|
321 |
* The operation parameter descriptor for the {@link #latitudeOfCentre} |
|
322 |
* parameter value. Valid values range is from -90 to 90. Default value is 0. |
|
323 |
*/ |
|
324 |
public static final ParameterDescriptor LAT_OF_CENTRE = createDescriptor( |
|
325 |
new NamedIdentifier[] { |
|
326 |
new NamedIdentifier(CitationImpl.OGC, "latitude_of_center"), |
|
327 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
|
328 |
new NamedIdentifier(CitationImpl.ESRI, "Latitude_Of_Center"), |
|
329 |
new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLat") |
|
330 |
}, |
|
331 |
0, -90, 90, NonSI.DEGREE_ANGLE); |
|
332 |
|
|
333 |
/** |
|
334 |
* The operation parameter descriptor for the {@link #longitudeOfCentre} |
|
335 |
* parameter value. Valid values range is from -180 to 180. Default value is 0. |
|
336 |
*/ |
|
337 |
public static final ParameterDescriptor LONG_OF_CENTRE = createDescriptor( |
|
338 |
new NamedIdentifier[] { |
|
339 |
new NamedIdentifier(CitationImpl.OGC, "longitude_of_center"), |
|
340 |
new NamedIdentifier(CitationImpl.EPSG, "Longitude of projection centre"), |
|
341 |
new NamedIdentifier(CitationImpl.ESRI, "Longitude_Of_Center"), |
|
342 |
new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLong") |
|
343 |
}, |
|
344 |
0, -180, 180, NonSI.DEGREE_ANGLE); |
|
345 |
|
|
346 |
/** |
|
347 |
* The operation parameter descriptor for the {@link #alpha_c} |
|
348 |
* parameter value. Valid values range is from -360 to -270, -90 to 90, |
|
349 |
* and 270 to 360 degrees. Default value is 0. |
|
350 |
*/ |
|
351 |
public static final ParameterDescriptor AZIMUTH = createDescriptor( |
|
352 |
new NamedIdentifier[] { |
|
353 |
new NamedIdentifier(CitationImpl.OGC, "azimuth"), |
|
354 |
new NamedIdentifier(CitationImpl.ESRI, "Azimuth"), |
|
355 |
new NamedIdentifier(CitationImpl.EPSG, "Azimuth of initial line"), |
|
356 |
new NamedIdentifier(CitationImpl.GEOTIFF, "AzimuthAngle") |
|
357 |
}, |
|
358 |
0, -360, 360, NonSI.DEGREE_ANGLE); |
|
359 |
|
|
360 |
/** |
|
361 |
* The operation parameter descriptor for the {@link #rectGridAngle} |
|
362 |
* parameter value. It is an optional parameter with valid values ranging |
|
363 |
* from -360 to 360. Default value is {@link #alpha_c}. |
|
364 |
*/ |
|
365 |
public static final ParameterDescriptor RECTIFIED_GRID_ANGLE = createOptionalDescriptor( |
|
366 |
new NamedIdentifier[] { |
|
367 |
new NamedIdentifier(CitationImpl.OGC, "rectified_grid_angle"), |
|
368 |
new NamedIdentifier(CitationImpl.EPSG, "Angle from Rectified to Skew Grid"), |
|
369 |
new NamedIdentifier(CitationImpl.ESRI, "XY_Plane_Rotation"), |
|
370 |
new NamedIdentifier(CitationImpl.GEOTIFF, "RectifiedGridAngle") |
|
371 |
}, |
|
372 |
-360, 360, NonSI.DEGREE_ANGLE); |
|
373 |
|
|
374 |
/** |
|
375 |
* The parameters group. |
|
376 |
*/ |
|
377 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
|
378 |
new NamedIdentifier(CitationImpl.OGC, "Oblique_Mercator"), |
|
379 |
new NamedIdentifier(CitationImpl.EPSG, "Oblique Mercator"), |
|
380 |
new NamedIdentifier(CitationImpl.EPSG, "9815"), |
|
381 |
new NamedIdentifier(CitationImpl.GEOTIFF, "CT_ObliqueMercator"), |
|
382 |
new NamedIdentifier(CitationImpl.ESRI, "Hotine_Oblique_Mercator_Azimuth_Center"), |
|
383 |
new NamedIdentifier(CitationImpl.ESRI, "Rectified_Skew_Orthomorphic_Center"), |
|
384 |
new NamedIdentifier(CitationImpl.GEOTOOLS, Resources.formatInternational( |
|
385 |
ResourceKeys.OBLIQUE_MERCATOR_PROJECTION)), |
|
386 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR") |
|
387 |
}, new ParameterDescriptor[] { |
|
388 |
SEMI_MAJOR, SEMI_MINOR, |
|
389 |
LONG_OF_CENTRE, LAT_OF_CENTRE, |
|
390 |
AZIMUTH, RECTIFIED_GRID_ANGLE, |
|
391 |
SCALE_FACTOR_LOCAL, |
|
392 |
FALSE_EASTING_LOCAL, FALSE_NORTHING_LOCAL |
|
393 |
}); |
|
394 |
|
|
395 |
/** |
|
396 |
* Constructs a new provider. |
|
397 |
*/ |
|
398 |
public Provider() { |
|
399 |
super(PARAMETERS); |
|
400 |
} |
|
401 |
|
|
402 |
/** |
|
403 |
* Constructs a new provider. |
|
404 |
*/ |
|
405 |
protected Provider(final ParameterDescriptorGroup params) { |
|
406 |
super(params); |
|
407 |
} |
|
408 |
|
|
409 |
/** |
|
410 |
* Returns the operation type for this map projection. |
|
411 |
*/ |
|
412 |
protected Class getOperationType() { |
|
413 |
return CylindricalProjection.class; |
|
414 |
} |
|
415 |
|
|
416 |
/** |
|
417 |
* Creates a transform from the specified group of parameter values. |
|
418 |
* |
|
419 |
* @param parameters The group of parameter values. |
|
420 |
* @return The created math transform. |
|
421 |
* @throws ParameterNotFoundException if a required parameter was not found. |
|
422 |
*/ |
|
423 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
|
424 |
throws ParameterNotFoundException |
|
425 |
{ |
|
426 |
final Collection descriptors = PARAMETERS.descriptors(); |
|
427 |
return new IdrObliqueMercator(parameters, descriptors, false, false); |
|
428 |
} |
|
429 |
} |
|
430 |
|
|
431 |
/** |
|
432 |
* The {@link org.geotools.referencing.operation.MathTransformProvider} |
|
433 |
* for a Hotine {@link IdrObliqueMercator} projection. |
|
434 |
* |
|
435 |
* @see org.geotools.referencing.operation.DefaultMathTransformFactory |
|
436 |
* |
|
437 |
* @version $Id$ |
|
438 |
* @author Rueben Schulz |
|
439 |
*/ |
|
440 |
public static final class Provider_Hotine extends Provider { |
|
441 |
/** |
|
442 |
* The parameters group. |
|
443 |
*/ |
|
444 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
|
445 |
new NamedIdentifier(CitationImpl.OGC, "Hotine_Oblique_Mercator"), |
|
446 |
new NamedIdentifier(CitationImpl.EPSG, "Hotine Oblique Mercator"), |
|
447 |
new NamedIdentifier(CitationImpl.EPSG, "9812"), |
|
448 |
new NamedIdentifier(CitationImpl.GEOTIFF, "CT_ObliqueMercator_Hotine"), |
|
449 |
new NamedIdentifier(CitationImpl.ESRI, "Hotine_Oblique_Mercator_Azimuth_Natural_Origin"), |
|
450 |
new NamedIdentifier(CitationImpl.ESRI, "Rectified_Skew_Orthomorphic_Natural_Origin"), |
|
451 |
new NamedIdentifier(CitationImpl.GEOTOOLS, Resources.formatInternational( |
|
452 |
ResourceKeys.OBLIQUE_MERCATOR_PROJECTION)), |
|
453 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR") |
|
454 |
}, new ParameterDescriptor[] { |
|
455 |
SEMI_MAJOR, SEMI_MINOR, |
|
456 |
LONG_OF_CENTRE, LAT_OF_CENTRE, |
|
457 |
AZIMUTH, RECTIFIED_GRID_ANGLE, |
|
458 |
SCALE_FACTOR_LOCAL, |
|
459 |
FALSE_EASTING_LOCAL, FALSE_NORTHING_LOCAL |
|
460 |
}); |
|
461 |
|
|
462 |
/** |
|
463 |
* Constructs a new provider. |
|
464 |
*/ |
|
465 |
public Provider_Hotine() { |
|
466 |
super(PARAMETERS); |
|
467 |
} |
|
468 |
|
|
469 |
/** |
|
470 |
* Returns the operation type for this map projection. |
|
471 |
*/ |
|
472 |
protected Class getOperationType() { |
|
473 |
return CylindricalProjection.class; |
|
474 |
} |
|
475 |
|
|
476 |
/** |
|
477 |
* Creates a transform from the specified group of parameter values. |
|
478 |
* |
|
479 |
* @param parameters The group of parameter values. |
|
480 |
* @return The created math transform. |
|
481 |
* @throws ParameterNotFoundException if a required parameter was not found. |
|
482 |
*/ |
|
483 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
|
484 |
throws ParameterNotFoundException |
|
485 |
{ |
|
486 |
final Collection descriptors = PARAMETERS.descriptors(); |
|
487 |
return new IdrObliqueMercator(parameters, descriptors, true, false); |
|
488 |
} |
|
489 |
} |
|
490 |
|
|
491 |
/** |
|
492 |
* The {@link org.geotools.referencing.operation.MathTransformProvider} |
|
493 |
* for a {@link IdrObliqueMercator} projection, specified with |
|
494 |
* two points on the central line (instead of a central point and azimuth). |
|
495 |
* |
|
496 |
* @see org.geotools.referencing.operation.DefaultMathTransformFactory |
|
497 |
* |
|
498 |
* @version $Id$ |
|
499 |
* @author Rueben Schulz |
|
500 |
*/ |
|
501 |
public static class Provider_TwoPoint extends Provider { |
|
502 |
/** |
|
503 |
* The operation parameter descriptor for the {@link #latitudeOfCentre} |
|
504 |
* parameter value. Valid values range is from -90 to 90. Default value is 0. |
|
505 |
*/ |
|
506 |
public static final ParameterDescriptor LAT_OF_CENTRE = createDescriptor( |
|
507 |
new NamedIdentifier[] { |
|
508 |
new NamedIdentifier(CitationImpl.OGC, "latitude_of_center"), |
|
509 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
|
510 |
new NamedIdentifier(CitationImpl.ESRI, "Latitude_Of_Center"), |
|
511 |
new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLat") |
|
512 |
}, |
|
513 |
0, -90, 90, NonSI.DEGREE_ANGLE); |
|
514 |
|
|
515 |
/** |
|
516 |
* The operation parameter descriptor for the {@link #latitudeOf1stPoint} |
|
517 |
* parameter value. Valid values range is from -90 to 90. Default value is 0. |
|
518 |
*/ |
|
519 |
public static final ParameterDescriptor LAT_OF_1ST_POINT = createDescriptor( |
|
520 |
new NamedIdentifier[] { |
|
521 |
new NamedIdentifier(CitationImpl.ESRI, "Latitude_Of_1st_Point") |
|
522 |
}, |
|
523 |
0, -90, 90, NonSI.DEGREE_ANGLE); |
|
524 |
|
|
525 |
/** |
|
526 |
* The operation parameter descriptor for the {@link #longitudeOf1stPoint} |
|
527 |
* parameter value. Valid values range is from -180 to 180. Default value is 0. |
|
528 |
*/ |
|
529 |
public static final ParameterDescriptor LONG_OF_1ST_POINT = createDescriptor( |
|
530 |
new NamedIdentifier[] { |
|
531 |
new NamedIdentifier(CitationImpl.ESRI, "Longitude_Of_1st_Point") |
|
532 |
}, |
|
533 |
0, -180, 180, NonSI.DEGREE_ANGLE); |
|
534 |
|
|
535 |
/** |
|
536 |
* The operation parameter descriptor for the {@link #latitudeOf2ndPoint} |
|
537 |
* parameter value. Valid values range is from -90 to 90. Default value is 0. |
|
538 |
*/ |
|
539 |
public static final ParameterDescriptor LAT_OF_2ND_POINT = createDescriptor( |
|
540 |
new NamedIdentifier[] { |
|
541 |
new NamedIdentifier(CitationImpl.ESRI, "Latitude_Of_2nd_Point") |
|
542 |
}, |
|
543 |
0, -90, 90, NonSI.DEGREE_ANGLE); |
|
544 |
|
|
545 |
/** |
|
546 |
* The operation parameter descriptor for the {@link #longitudeOf2ndPoint} |
|
547 |
* parameter value. Valid values range is from -180 to 180. Default value is 0. |
|
548 |
*/ |
|
549 |
public static final ParameterDescriptor LONG_OF_2ND_POINT = createDescriptor( |
|
550 |
new NamedIdentifier[] { |
|
551 |
new NamedIdentifier(CitationImpl.ESRI, "Longitude_Of_2nd_Point") |
|
552 |
}, |
|
553 |
0, -180, 180, NonSI.DEGREE_ANGLE); |
|
554 |
|
|
555 |
/** |
|
556 |
* The parameters group. |
|
557 |
*/ |
|
558 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
|
559 |
new NamedIdentifier(CitationImpl.ESRI, "Hotine_Oblique_Mercator_Two_Point_Center"), |
|
560 |
new NamedIdentifier(CitationImpl.GEOTOOLS, Resources.formatInternational( |
|
561 |
ResourceKeys.OBLIQUE_MERCATOR_PROJECTION)), |
|
562 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR") |
|
563 |
}, new ParameterDescriptor[] { |
|
564 |
SEMI_MAJOR, SEMI_MINOR, |
|
565 |
LAT_OF_1ST_POINT, LONG_OF_1ST_POINT, |
|
566 |
LAT_OF_2ND_POINT, LONG_OF_2ND_POINT, |
|
567 |
LAT_OF_CENTRE, SCALE_FACTOR_LOCAL, |
|
568 |
FALSE_EASTING_LOCAL, FALSE_NORTHING_LOCAL |
|
569 |
}); |
|
570 |
|
|
571 |
/** |
|
572 |
* Constructs a new provider. |
|
573 |
*/ |
|
574 |
public Provider_TwoPoint() { |
|
575 |
super(PARAMETERS); |
|
576 |
} |
|
577 |
|
|
578 |
/** |
|
579 |
* Constructs a new provider. |
|
580 |
*/ |
|
581 |
protected Provider_TwoPoint(final ParameterDescriptorGroup params) { |
|
582 |
super(params); |
|
583 |
} |
|
584 |
|
|
585 |
/** |
|
586 |
* Returns the operation type for this map projection. |
|
587 |
*/ |
|
588 |
protected Class getOperationType() { |
|
589 |
return CylindricalProjection.class; |
|
590 |
} |
|
591 |
|
|
592 |
/** |
|
593 |
* Creates a transform from the specified group of parameter values. |
|
594 |
* |
|
595 |
* @param parameters The group of parameter values. |
|
596 |
* @return The created math transform. |
|
597 |
* @throws ParameterNotFoundException if a required parameter was not found. |
|
598 |
*/ |
|
599 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
|
600 |
throws ParameterNotFoundException |
|
601 |
{ |
|
602 |
final Collection descriptors = PARAMETERS.descriptors(); |
|
603 |
return new IdrObliqueMercator(parameters, descriptors, false, true); |
Also available in: Unified diff