root / org.gvsig.jcrs / libJCRS / src / org / geotools / referencing / operation / projection / IdrWinkelII.java @ 38
History | View | Annotate | Download (6.49 KB)
1 |
/*
|
---|---|
2 |
* Geotools2 - OpenSource mapping toolkit
|
3 |
* http://geotools.org
|
4 |
* (C) 2002-2005, Geotools Project Managment Committee (PMC)
|
5 |
*
|
6 |
* This library is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU Lesser General Public
|
8 |
* License as published by the Free Software Foundation;
|
9 |
* version 2.1 of the License.
|
10 |
*
|
11 |
* This library 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 GNU
|
14 |
* Lesser General Public License for more details.
|
15 |
*/
|
16 |
package org.geotools.referencing.operation.projection; |
17 |
|
18 |
// J2SE dependencies and extensions
|
19 |
import java.awt.geom.Point2D; |
20 |
import java.util.Collection; |
21 |
|
22 |
import javax.units.SI; |
23 |
import javax.units.NonSI; |
24 |
import javax.units.Unit; |
25 |
|
26 |
import org.geotools.metadata.iso.citation.CitationImpl; |
27 |
import org.geotools.referencing.NamedIdentifier; |
28 |
import org.geotools.resources.XMath; |
29 |
import org.geotools.resources.cts.ResourceKeys; |
30 |
import org.geotools.resources.cts.Resources; |
31 |
import org.opengis.parameter.ParameterDescriptor; |
32 |
import org.opengis.parameter.ParameterDescriptorGroup; |
33 |
import org.opengis.parameter.ParameterNotFoundException; |
34 |
import org.opengis.parameter.ParameterValueGroup; |
35 |
import org.opengis.referencing.operation.CylindricalProjection; |
36 |
import org.opengis.referencing.operation.MathTransform; |
37 |
|
38 |
|
39 |
public class IdrWinkelII extends MapProjection { |
40 |
protected final double standardParallel; |
41 |
protected IdrWinkelII(final ParameterValueGroup parameters) throws ParameterNotFoundException { |
42 |
super(parameters);
|
43 |
final Collection expected = getParameterDescriptors().descriptors(); |
44 |
if (expected.contains(Provider.STANDARD_PARALLEL)) { |
45 |
standardParallel = Math.abs(doubleValue(expected,
|
46 |
Provider.STANDARD_PARALLEL, parameters));
|
47 |
ensureLatitudeInRange(Provider.STANDARD_PARALLEL, standardParallel, false); |
48 |
} else {
|
49 |
// standard parallel is the equator (Plate Carree or Equirectangular)
|
50 |
standardParallel = Double.NaN;
|
51 |
} |
52 |
} |
53 |
|
54 |
/**
|
55 |
* {@inheritDoc}
|
56 |
*/
|
57 |
public ParameterDescriptorGroup getParameterDescriptors() {
|
58 |
return Provider.PARAMETERS; |
59 |
} |
60 |
|
61 |
/**
|
62 |
* {@inheritDoc}
|
63 |
*/
|
64 |
public ParameterValueGroup getParameterValues() {
|
65 |
final Collection expected = getParameterDescriptors().descriptors(); |
66 |
final ParameterValueGroup values = super.getParameterValues(); |
67 |
set(expected, Provider.STANDARD_PARALLEL, values, standardParallel );
|
68 |
return values;
|
69 |
} |
70 |
|
71 |
/**
|
72 |
* Transforms the specified (<var>λ</var>,<var>φ</var>) coordinates
|
73 |
* (units in radians) and stores the result in {@code ptDst} (linear distance
|
74 |
* on a unit sphere).
|
75 |
*/
|
76 |
protected Point2D transformNormalized(final double lambda, final double phi, Point2D ptDst) |
77 |
throws ProjectionException
|
78 |
{ |
79 |
return null; |
80 |
} |
81 |
|
82 |
/**
|
83 |
* Transforms the specified (<var>x</var>,<var>y</var>) coordinate
|
84 |
* and stores the result in {@code ptDst}.
|
85 |
*/
|
86 |
protected Point2D inverseTransformNormalized(final double x, final double y, Point2D ptDst) |
87 |
throws ProjectionException
|
88 |
{ |
89 |
return null; |
90 |
} |
91 |
|
92 |
|
93 |
|
94 |
|
95 |
//////////////////////////////////////////////////////////////////////////////////////////
|
96 |
//////////////////////////////////////////////////////////////////////////////////////////
|
97 |
//////// ////////
|
98 |
//////// PROVIDER ////////
|
99 |
//////// ////////
|
100 |
//////////////////////////////////////////////////////////////////////////////////////////
|
101 |
//////////////////////////////////////////////////////////////////////////////////////////
|
102 |
|
103 |
/**
|
104 |
* The {@link org.geotools.referencing.operation.MathTransformProvider}
|
105 |
* for an {@link IdrMillerCylindrical krovak} projection.
|
106 |
*
|
107 |
* @author jezekjan
|
108 |
*
|
109 |
* @see org.geotools.referencing.operation.DefaultMathTransformFactory
|
110 |
*/
|
111 |
public static class Provider extends AbstractProvider { |
112 |
/**
|
113 |
* The operation parameter descriptor for the {@link #standardParallel standard parallel}
|
114 |
* parameter value. Valid values range is from -90 to 90. Default value is 0.
|
115 |
*/
|
116 |
public static final ParameterDescriptor STANDARD_PARALLEL = createDescriptor( |
117 |
new NamedIdentifier[] { |
118 |
new NamedIdentifier(CitationImpl.OGC, "standard_parallel_1"), |
119 |
new NamedIdentifier(CitationImpl.EPSG, "Latitude of 1st standard parallel"), |
120 |
new NamedIdentifier(CitationImpl.GEOTIFF, "StdParallel1") |
121 |
}, |
122 |
0, -90, 90, NonSI.DEGREE_ANGLE); |
123 |
|
124 |
static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
125 |
new NamedIdentifier(CitationImpl.OGC, "Winkel_II"), |
126 |
new NamedIdentifier(CitationImpl.GEOTIFF, "Winkel II"), |
127 |
new NamedIdentifier(CitationImpl.EPSG, "Winkel II"), |
128 |
new NamedIdentifier(new CitationImpl("IDR"), "IDR")//, |
129 |
}, |
130 |
new ParameterDescriptor[] { |
131 |
SEMI_MAJOR, SEMI_MINOR, |
132 |
CENTRAL_MERIDIAN, STANDARD_PARALLEL, |
133 |
FALSE_EASTING, FALSE_NORTHING |
134 |
}); |
135 |
|
136 |
/**
|
137 |
* Constructs a new provider.
|
138 |
*/
|
139 |
public Provider() { |
140 |
super(PARAMETERS);
|
141 |
} |
142 |
|
143 |
/**
|
144 |
* Returns the operation type for this map projection.
|
145 |
*/
|
146 |
protected Class getOperationType() { |
147 |
return CylindricalProjection.class;
|
148 |
} |
149 |
|
150 |
/**
|
151 |
* Creates a transform from the specified group of parameter values.
|
152 |
*
|
153 |
* @param parameters The group of parameter values.
|
154 |
* @return The created math transform.
|
155 |
* @throws ParameterNotFoundException if a required parameter was not found.
|
156 |
*/
|
157 |
public MathTransform createMathTransform(final ParameterValueGroup parameters) |
158 |
throws ParameterNotFoundException
|
159 |
{ |
160 |
return new IdrWinkelII(parameters); |
161 |
} |
162 |
} |
163 |
|
164 |
} |