root / branches / F2 / libraries / libJCRS / src / org / geotools / referencing / operation / projection / CassiniSoldner.java @ 12186
History | View | Annotate | Download (8.53 KB)
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.geotools.metadata.iso.citation.CitationImpl; |
9 |
import org.geotools.referencing.NamedIdentifier; |
10 |
import org.geotools.referencing.operation.projection.Krovak.Provider; |
11 |
import org.geotools.referencing.operation.projection.MapProjection.AbstractProvider; |
12 |
import org.opengis.parameter.ParameterDescriptor; |
13 |
import org.opengis.parameter.ParameterDescriptorGroup; |
14 |
import org.opengis.parameter.ParameterNotFoundException; |
15 |
import org.opengis.parameter.ParameterValueGroup; |
16 |
import org.opengis.referencing.operation.CylindricalProjection; |
17 |
import org.opengis.referencing.operation.MathTransform; |
18 |
|
19 |
|
20 |
public class CassiniSoldner extends MapProjection { |
21 |
|
22 |
private final double latitudeOfOrigin; |
23 |
|
24 |
protected CassiniSoldner(ParameterValueGroup parameters) throws ParameterNotFoundException { |
25 |
super(parameters);
|
26 |
final Collection expected = getParameterDescriptors().descriptors(); |
27 |
if (expected.contains(Provider.LATITUDE_OF_ORIGIN)) { |
28 |
latitudeOfOrigin = Math.abs(doubleValue(expected,
|
29 |
Provider.LATITUDE_OF_ORIGIN, parameters));
|
30 |
ensureLatitudeInRange(Provider.LATITUDE_OF_ORIGIN, latitudeOfOrigin, false); |
31 |
} else {
|
32 |
// standard parallel is the equator (Plate Carree or Equirectangular)
|
33 |
latitudeOfOrigin = Double.NaN;
|
34 |
} |
35 |
// TODO Auto-generated constructor stub
|
36 |
} |
37 |
|
38 |
|
39 |
public ParameterDescriptorGroup getParameterDescriptors() {
|
40 |
// TODO Auto-generated method stub
|
41 |
return Provider.PARAMETERS; |
42 |
} |
43 |
|
44 |
public ParameterValueGroup getParameterValues() {
|
45 |
final ParameterValueGroup values = super.getParameterValues(); |
46 |
if (!Double.isNaN(latitudeOfOrigin)) { |
47 |
final Collection expected = getParameterDescriptors().descriptors(); |
48 |
set(expected,Provider.LATITUDE_OF_ORIGIN, values, latitudeOfOrigin);
|
49 |
} |
50 |
return values;
|
51 |
} |
52 |
|
53 |
protected Point2D inverseTransformNormalized(double x, double y, |
54 |
Point2D ptDst) throws ProjectionException { |
55 |
// TODO Auto-generated method stub
|
56 |
return null; |
57 |
} |
58 |
|
59 |
protected Point2D transformNormalized(double x, double y, Point2D ptDst) |
60 |
throws ProjectionException {
|
61 |
// TODO Auto-generated method stub
|
62 |
return null; |
63 |
} |
64 |
public static class Provider extends AbstractProvider { |
65 |
|
66 |
public static final ParameterDescriptor LATITUDE_OF_ORIGIN = createDescriptor( |
67 |
new NamedIdentifier[] { |
68 |
new NamedIdentifier(CitationImpl.OGC, "latitude_of_origin"), |
69 |
new NamedIdentifier(CitationImpl.EPSG, "CenterLat"), |
70 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
71 |
new NamedIdentifier(CitationImpl.GEOTIFF, "NatOriginLat"), |
72 |
new NamedIdentifier(CitationImpl.EPSG, "FalseOriginLat"), |
73 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of false origin"), |
74 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of natural origin"), |
75 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
76 |
new NamedIdentifier(CitationImpl.EPSG, "ProjCenterLat") |
77 |
}, 0.0, -90.0, 90.0, NonSI.DEGREE_ANGLE); |
78 |
|
79 |
/**
|
80 |
* The parameters group. Note the EPSG includes a "Latitude of natural origin" parameter instead
|
81 |
* of "standard_parallel_1". I have sided with ESRI and Snyder in this case.
|
82 |
*/
|
83 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
84 |
new NamedIdentifier(CitationImpl.OGC, "Cassini_Soldner"), |
85 |
new NamedIdentifier(CitationImpl.EPSG, "Cassini-Soldner"), |
86 |
new NamedIdentifier(CitationImpl.EPSG, "Peters (approximated by Gall Orthographic)"), |
87 |
new NamedIdentifier(CitationImpl.EPSG, "9806")//, |
88 |
// new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
|
89 |
// VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
|
90 |
}, new ParameterDescriptor[] { |
91 |
SEMI_MAJOR, SEMI_MINOR, |
92 |
CENTRAL_MERIDIAN, LATITUDE_OF_ORIGIN, |
93 |
FALSE_EASTING, FALSE_NORTHING |
94 |
}); |
95 |
|
96 |
/*String[] parameterName={"central_meridian"};
|
97 |
projectionParameterList.add(count,parameterName);
|
98 |
addProjectionParameter(count,"standard_parallel_1");
|
99 |
addProjectionParameter(count,"false_easting");
|
100 |
addProjectionParameter(count,"false_northing");*/
|
101 |
|
102 |
/**
|
103 |
* Constructs a new provider.
|
104 |
*/
|
105 |
public Provider() { |
106 |
super(PARAMETERS);
|
107 |
} |
108 |
|
109 |
protected Provider(final ParameterDescriptorGroup params) { |
110 |
super(params);
|
111 |
} |
112 |
|
113 |
/**
|
114 |
* Returns the operation type for this map projection.
|
115 |
*/
|
116 |
protected Class getOperationType() { |
117 |
return CylindricalProjection.class;
|
118 |
} |
119 |
|
120 |
/**
|
121 |
* Creates a transform from the specified group of parameter values.
|
122 |
*
|
123 |
* @param parameters The group of parameter values.
|
124 |
* @return The created math transform.
|
125 |
* @throws ParameterNotFoundException if a required parameter was not found.
|
126 |
*/
|
127 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
128 |
throws ParameterNotFoundException
|
129 |
{ |
130 |
return new CassiniSoldner(parameters); |
131 |
//return null;
|
132 |
//return new EquidistantCylindrical(parameters);
|
133 |
} |
134 |
} |
135 |
public static class Provider_Hyperbolic extends Provider { |
136 |
|
137 |
public static final ParameterDescriptor LATITUDE_OF_ORIGIN = createDescriptor( |
138 |
new NamedIdentifier[] { |
139 |
new NamedIdentifier(CitationImpl.OGC, "latitude_of_origin"), |
140 |
new NamedIdentifier(CitationImpl.EPSG, "CenterLat"), |
141 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
142 |
new NamedIdentifier(CitationImpl.GEOTIFF, "NatOriginLat"), |
143 |
new NamedIdentifier(CitationImpl.EPSG, "FalseOriginLat"), |
144 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of false origin"), |
145 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of natural origin"), |
146 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
147 |
new NamedIdentifier(CitationImpl.EPSG, "ProjCenterLat") |
148 |
}, 0.0, -90.0, 90.0, NonSI.DEGREE_ANGLE); |
149 |
|
150 |
/**
|
151 |
* The parameters group. Note the EPSG includes a "Latitude of natural origin" parameter instead
|
152 |
* of "standard_parallel_1". I have sided with ESRI and Snyder in this case.
|
153 |
*/
|
154 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
155 |
new NamedIdentifier(CitationImpl.OGC, "Hyperbolic Cassini-Soldner"), |
156 |
new NamedIdentifier(CitationImpl.EPSG, "Hyperbolic_Cassini-Soldner"), |
157 |
new NamedIdentifier(CitationImpl.EPSG, "Cassini-Soldner (Hyperbolic)"), |
158 |
new NamedIdentifier(CitationImpl.EPSG, "Cassini-Soldner_(Hyperbolic)")//, |
159 |
// new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
|
160 |
// VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
|
161 |
}, new ParameterDescriptor[] { |
162 |
SEMI_MAJOR, SEMI_MINOR, |
163 |
CENTRAL_MERIDIAN, LATITUDE_OF_ORIGIN, |
164 |
FALSE_EASTING, FALSE_NORTHING |
165 |
}); |
166 |
|
167 |
|
168 |
/**
|
169 |
* Constructs a new provider.
|
170 |
*/
|
171 |
public Provider_Hyperbolic() {
|
172 |
super(PARAMETERS);
|
173 |
} |
174 |
|
175 |
/**
|
176 |
* Returns the operation type for this map projection.
|
177 |
*/
|
178 |
protected Class getOperationType() { |
179 |
return CylindricalProjection.class;
|
180 |
} |
181 |
|
182 |
/**
|
183 |
* Creates a transform from the specified group of parameter values.
|
184 |
*
|
185 |
* @param parameters The group of parameter values.
|
186 |
* @return The created math transform.
|
187 |
* @throws ParameterNotFoundException if a required parameter was not found.
|
188 |
*/
|
189 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
190 |
throws ParameterNotFoundException
|
191 |
{ |
192 |
//return null;
|
193 |
return new CassiniSoldner(parameters); |
194 |
} |
195 |
} |
196 |
|
197 |
} |