root / branches / libProjection_v2_0_prep / libraries / libJCRS / src / org / geotools / referencing / operation / projection / IdrCylindricalEqualArea.java @ 27137
History | View | Annotate | Download (5.79 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.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.referencing.operation.projection.IdrEquidistantCylindrical.Provider; |
15 |
import org.geotools.resources.XMath; |
16 |
import org.geotools.resources.cts.ResourceKeys; |
17 |
import org.geotools.resources.cts.Resources; |
18 |
import org.opengis.parameter.ParameterDescriptor; |
19 |
import org.opengis.referencing.operation.CylindricalProjection; |
20 |
import org.opengis.referencing.operation.MathTransform; |
21 |
|
22 |
|
23 |
|
24 |
public class IdrCylindricalEqualArea extends MapProjection { |
25 |
|
26 |
private final double standardParallel; |
27 |
|
28 |
protected IdrCylindricalEqualArea(ParameterValueGroup parameters) throws ParameterNotFoundException { |
29 |
super(parameters);
|
30 |
final Collection expected = getParameterDescriptors().descriptors(); |
31 |
if (expected.contains(Provider.STANDARD_PARALLEL)) { |
32 |
standardParallel = Math.abs(doubleValue(expected,
|
33 |
Provider.STANDARD_PARALLEL, parameters));
|
34 |
ensureLatitudeInRange(Provider.STANDARD_PARALLEL, standardParallel, false); |
35 |
} else {
|
36 |
standardParallel = Double.NaN;
|
37 |
} |
38 |
} |
39 |
|
40 |
|
41 |
public ParameterDescriptorGroup getParameterDescriptors() {
|
42 |
return Provider.PARAMETERS; |
43 |
} |
44 |
|
45 |
public ParameterValueGroup getParameterValues() {
|
46 |
final ParameterValueGroup values = super.getParameterValues(); |
47 |
if (!Double.isNaN(standardParallel)) { |
48 |
final Collection expected = getParameterDescriptors().descriptors(); |
49 |
set(expected,Provider.STANDARD_PARALLEL, values, standardParallel);
|
50 |
} |
51 |
return values;
|
52 |
} |
53 |
|
54 |
|
55 |
protected Point2D inverseTransformNormalized(double x, double y, |
56 |
Point2D ptDst) throws ProjectionException { |
57 |
// TODO Auto-generated method stub
|
58 |
return null; |
59 |
} |
60 |
|
61 |
protected Point2D transformNormalized(double x, double y, Point2D ptDst) |
62 |
throws ProjectionException {
|
63 |
// TODO Auto-generated method stub
|
64 |
return null; |
65 |
} |
66 |
|
67 |
public static class Provider extends AbstractProvider { |
68 |
|
69 |
/**
|
70 |
* The operation parameter descriptor for the {@link #standardParallel standard parallel}
|
71 |
* parameter value. Valid values range is from -90 to 90. Default value is 0.
|
72 |
*/
|
73 |
public static final ParameterDescriptor STANDARD_PARALLEL = createDescriptor( |
74 |
new NamedIdentifier[] { |
75 |
new NamedIdentifier(CitationImpl.OGC, "standard_parallel_1"), |
76 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of 1st standard parallel"), |
77 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of natural origin"), |
78 |
new NamedIdentifier(CitationImpl.GEOTIFF, "StdParallel1") |
79 |
}, |
80 |
0, -90, 90, NonSI.DEGREE_ANGLE); |
81 |
|
82 |
/**
|
83 |
* The parameters group. Note the EPSG includes a "Latitude of natural origin" parameter instead
|
84 |
* of "standard_parallel_1". I have sided with ESRI and Snyder in this case.
|
85 |
*/
|
86 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
87 |
new NamedIdentifier(CitationImpl.OGC, "Cylindrical_Equal_Area"), |
88 |
new NamedIdentifier(CitationImpl.EPSG, "Cylindrical Equal Area"), |
89 |
new NamedIdentifier(CitationImpl.EPSG, "Normal Authalic Cylindrical (FME)"), |
90 |
new NamedIdentifier(CitationImpl.EPSG, "Lambert Cylindrical Equal Area"), |
91 |
new NamedIdentifier(CitationImpl.EPSG, "Behrmann (standard parallel = 30)"), |
92 |
new NamedIdentifier(CitationImpl.EPSG, "Lambert Cylindrical Equal Area (Spherical)"), |
93 |
new NamedIdentifier(CitationImpl.EPSG, "Gall Orthographic (standard parallel = 45)"), |
94 |
new NamedIdentifier(CitationImpl.EPSG, "Peters (approximated by Gall Orthographic)"), |
95 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR") |
96 |
//new NamedIdentifier(CitationImpl.EPSG, "9823")//,
|
97 |
// new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
|
98 |
// VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
|
99 |
}, new ParameterDescriptor[] { |
100 |
SEMI_MAJOR, SEMI_MINOR, |
101 |
CENTRAL_MERIDIAN, STANDARD_PARALLEL, |
102 |
FALSE_EASTING, FALSE_NORTHING |
103 |
}); |
104 |
|
105 |
/*String[] parameterName={"central_meridian"};
|
106 |
projectionParameterList.add(count,parameterName);
|
107 |
addProjectionParameter(count,"standard_parallel_1");
|
108 |
addProjectionParameter(count,"false_easting");
|
109 |
addProjectionParameter(count,"false_northing");*/
|
110 |
|
111 |
/**
|
112 |
* Constructs a new provider.
|
113 |
*/
|
114 |
public Provider() { |
115 |
super(PARAMETERS);
|
116 |
} |
117 |
|
118 |
/**
|
119 |
* Returns the operation type for this map projection.
|
120 |
*/
|
121 |
protected Class getOperationType() { |
122 |
return CylindricalProjection.class;
|
123 |
} |
124 |
|
125 |
/**
|
126 |
* Creates a transform from the specified group of parameter values.
|
127 |
*
|
128 |
* @param parameters The group of parameter values.
|
129 |
* @return The created math transform.
|
130 |
* @throws ParameterNotFoundException if a required parameter was not found.
|
131 |
*/
|
132 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
133 |
throws ParameterNotFoundException
|
134 |
{ |
135 |
return new IdrCylindricalEqualArea(parameters); |
136 |
} |
137 |
} |
138 |
|
139 |
} |