root / org.gvsig.jcrs / libJCRS / src / org / geotools / referencing / operation / projection / IdrEckertV.java @ 38
History | View | Annotate | Download (5.19 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.MapProjection.AbstractProvider; |
11 |
import org.opengis.parameter.ParameterDescriptor; |
12 |
import org.opengis.parameter.ParameterDescriptorGroup; |
13 |
import org.opengis.parameter.ParameterNotFoundException; |
14 |
import org.opengis.parameter.ParameterValueGroup; |
15 |
import org.opengis.referencing.operation.CylindricalProjection; |
16 |
import org.opengis.referencing.operation.MathTransform; |
17 |
|
18 |
|
19 |
public class IdrEckertV extends MapProjection { |
20 |
|
21 |
private final double longitudeOfCenter; |
22 |
|
23 |
protected IdrEckertV(ParameterValueGroup parameters) throws ParameterNotFoundException { |
24 |
super(parameters);
|
25 |
final Collection expected = getParameterDescriptors().descriptors(); |
26 |
if (expected.contains(Provider.LONGITUDE_OF_CENTER)) { |
27 |
longitudeOfCenter = Math.abs(doubleValue(expected,
|
28 |
Provider.LONGITUDE_OF_CENTER, parameters));
|
29 |
ensureLatitudeInRange(Provider.LONGITUDE_OF_CENTER, longitudeOfCenter, false); |
30 |
} else {
|
31 |
// standard parallel is the equator (Plate Carree or Equirectangular)
|
32 |
longitudeOfCenter = Double.NaN;
|
33 |
} |
34 |
// TODO Auto-generated constructor stub
|
35 |
} |
36 |
|
37 |
|
38 |
public ParameterDescriptorGroup getParameterDescriptors() {
|
39 |
// TODO Auto-generated method stub
|
40 |
return Provider.PARAMETERS; |
41 |
} |
42 |
|
43 |
public ParameterValueGroup getParameterValues() {
|
44 |
final ParameterValueGroup values = super.getParameterValues(); |
45 |
if (!Double.isNaN(longitudeOfCenter)) { |
46 |
final Collection expected = getParameterDescriptors().descriptors(); |
47 |
set(expected,Provider.LONGITUDE_OF_CENTER, values, longitudeOfCenter);
|
48 |
} |
49 |
return values;
|
50 |
} |
51 |
|
52 |
protected Point2D inverseTransformNormalized(double x, double y, |
53 |
Point2D ptDst) throws ProjectionException { |
54 |
// TODO Auto-generated method stub
|
55 |
return null; |
56 |
} |
57 |
|
58 |
protected Point2D transformNormalized(double x, double y, Point2D ptDst) |
59 |
throws ProjectionException {
|
60 |
// TODO Auto-generated method stub
|
61 |
return null; |
62 |
} |
63 |
public static class Provider extends AbstractProvider { |
64 |
|
65 |
public static final ParameterDescriptor LONGITUDE_OF_CENTER = createDescriptor( |
66 |
new NamedIdentifier[] { |
67 |
new NamedIdentifier(CitationImpl.OGC, "longitude_of_center"), |
68 |
new NamedIdentifier(CitationImpl.EPSG, "Longitude of origin"), |
69 |
new NamedIdentifier(CitationImpl.EPSG, "Longitude of false origin"), |
70 |
new NamedIdentifier(CitationImpl.GEOTIFF, "ProjCenterLong"), |
71 |
new NamedIdentifier(CitationImpl.EPSG, "NatOriginLong"), |
72 |
new NamedIdentifier(CitationImpl.EPSG, "central_meridian"), |
73 |
new NamedIdentifier(CitationImpl.EPSG, "CenterLong") |
74 |
}, 0.0, -360.0, 360.0, NonSI.DEGREE_ANGLE); |
75 |
|
76 |
/**
|
77 |
* The parameters group. Note the EPSG includes a "Latitude of natural origin" parameter instead
|
78 |
* of "standard_parallel_1". I have sided with ESRI and Snyder in this case.
|
79 |
*/
|
80 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
81 |
new NamedIdentifier(CitationImpl.OGC, "Eckert V"), |
82 |
new NamedIdentifier(CitationImpl.EPSG, "Eckert-V"), |
83 |
new NamedIdentifier(CitationImpl.EPSG, "Eckert_V"), |
84 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR")//, |
85 |
// new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
|
86 |
// VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
|
87 |
}, new ParameterDescriptor[] { |
88 |
SEMI_MAJOR, SEMI_MINOR, |
89 |
LONGITUDE_OF_CENTER, |
90 |
FALSE_EASTING, FALSE_NORTHING |
91 |
}); |
92 |
|
93 |
/*String[] parameterName={"central_meridian"};
|
94 |
projectionParameterList.add(count,parameterName);
|
95 |
addProjectionParameter(count,"standard_parallel_1");
|
96 |
addProjectionParameter(count,"false_easting");
|
97 |
addProjectionParameter(count,"false_northing");*/
|
98 |
|
99 |
/**
|
100 |
* Constructs a new provider.
|
101 |
*/
|
102 |
public Provider() { |
103 |
super(PARAMETERS);
|
104 |
} |
105 |
|
106 |
/**
|
107 |
* Returns the operation type for this map projection.
|
108 |
*/
|
109 |
protected Class getOperationType() { |
110 |
return CylindricalProjection.class;
|
111 |
} |
112 |
|
113 |
/**
|
114 |
* Creates a transform from the specified group of parameter values.
|
115 |
*
|
116 |
* @param parameters The group of parameter values.
|
117 |
* @return The created math transform.
|
118 |
* @throws ParameterNotFoundException if a required parameter was not found.
|
119 |
*/
|
120 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
121 |
throws ParameterNotFoundException
|
122 |
{ |
123 |
return new IdrEckertV(parameters); |
124 |
} |
125 |
} |
126 |
|
127 |
} |