root / branches / libProjection_v2_0_prep / libraries / libJCRS / src / org / geotools / referencing / operation / projection / IdrLambertAzimuthalEqualArea.java @ 27137
History | View | Annotate | Download (8.77 KB)
1 | 27137 | cmartinez | /*
|
---|---|---|---|
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.referencing.operation.projection.IdrOrthographic.Provider; |
||
29 | import org.geotools.resources.XMath; |
||
30 | import org.geotools.resources.cts.ResourceKeys; |
||
31 | import org.geotools.resources.cts.Resources; |
||
32 | import org.opengis.parameter.ParameterDescriptor; |
||
33 | import org.opengis.parameter.ParameterDescriptorGroup; |
||
34 | import org.opengis.parameter.ParameterNotFoundException; |
||
35 | import org.opengis.parameter.ParameterValueGroup; |
||
36 | import org.opengis.referencing.operation.ConicProjection; |
||
37 | import org.opengis.referencing.operation.MathTransform; |
||
38 | |||
39 | |||
40 | public class IdrLambertAzimuthalEqualArea extends MapProjection { |
||
41 | protected final double latitudeOfCenter; |
||
42 | protected final double longitudeOfCenter; |
||
43 | protected IdrLambertAzimuthalEqualArea(final ParameterValueGroup parameters) throws ParameterNotFoundException { |
||
44 | super(parameters);
|
||
45 | final Collection expected = getParameterDescriptors().descriptors(); |
||
46 | if (expected.contains(Provider.LATITUDE_OF_CENTER)) { |
||
47 | latitudeOfCenter = Math.abs(doubleValue(expected,
|
||
48 | Provider.LATITUDE_OF_CENTER, parameters));
|
||
49 | ensureLatitudeInRange(Provider.LATITUDE_OF_CENTER, latitudeOfCenter, false); |
||
50 | } else {
|
||
51 | // standard parallel is the equator (Plate Carree or Equirectangular)
|
||
52 | latitudeOfCenter = Double.NaN;
|
||
53 | } |
||
54 | if (expected.contains(Provider.LONGITUDE_OF_CENTER)) { |
||
55 | longitudeOfCenter = Math.abs(doubleValue(expected,
|
||
56 | Provider.LONGITUDE_OF_CENTER, parameters));
|
||
57 | ensureLongitudeInRange(Provider.LONGITUDE_OF_CENTER, longitudeOfCenter, false); |
||
58 | } else {
|
||
59 | // standard parallel is the equator (Plate Carree or Equirectangular)
|
||
60 | longitudeOfCenter = Double.NaN;
|
||
61 | } |
||
62 | } |
||
63 | |||
64 | /**
|
||
65 | * {@inheritDoc}
|
||
66 | */
|
||
67 | public ParameterDescriptorGroup getParameterDescriptors() {
|
||
68 | return Provider.PARAMETERS; |
||
69 | } |
||
70 | |||
71 | /**
|
||
72 | * {@inheritDoc}
|
||
73 | */
|
||
74 | public ParameterValueGroup getParameterValues() {
|
||
75 | final Collection expected = getParameterDescriptors().descriptors(); |
||
76 | final ParameterValueGroup values = super.getParameterValues(); |
||
77 | set(expected, Provider.LATITUDE_OF_CENTER, values, latitudeOfCenter );
|
||
78 | set(expected, Provider.LONGITUDE_OF_CENTER, values, longitudeOfCenter );
|
||
79 | return values;
|
||
80 | } |
||
81 | |||
82 | /**
|
||
83 | * Transforms the specified (<var>λ</var>,<var>φ</var>) coordinates
|
||
84 | * (units in radians) and stores the result in {@code ptDst} (linear distance
|
||
85 | * on a unit sphere).
|
||
86 | */
|
||
87 | protected Point2D transformNormalized(final double lambda, final double phi, Point2D ptDst) |
||
88 | throws ProjectionException
|
||
89 | { |
||
90 | return null; |
||
91 | } |
||
92 | |||
93 | /**
|
||
94 | * Transforms the specified (<var>x</var>,<var>y</var>) coordinate
|
||
95 | * and stores the result in {@code ptDst}.
|
||
96 | */
|
||
97 | protected Point2D inverseTransformNormalized(final double x, final double y, Point2D ptDst) |
||
98 | throws ProjectionException
|
||
99 | { |
||
100 | return null; |
||
101 | } |
||
102 | |||
103 | |||
104 | |||
105 | |||
106 | //////////////////////////////////////////////////////////////////////////////////////////
|
||
107 | //////////////////////////////////////////////////////////////////////////////////////////
|
||
108 | //////// ////////
|
||
109 | //////// PROVIDER ////////
|
||
110 | //////// ////////
|
||
111 | //////////////////////////////////////////////////////////////////////////////////////////
|
||
112 | //////////////////////////////////////////////////////////////////////////////////////////
|
||
113 | |||
114 | /**
|
||
115 | * The {@link org.geotools.referencing.operation.MathTransformProvider}
|
||
116 | * for an {@link IdrLambertAzimuthalEqualArea krovak} projection.
|
||
117 | *
|
||
118 | * @author jezekjan
|
||
119 | *
|
||
120 | * @see org.geotools.referencing.operation.DefaultMathTransformFactory
|
||
121 | */
|
||
122 | public static class Provider extends AbstractProvider { |
||
123 | /**
|
||
124 | * The operation parameter descriptor for the {@linkPlain #latitudeOfOrigin
|
||
125 | * latitude of origin} parameter value. Valid values range is from -90 to 90.
|
||
126 | * Default value is 49.5.
|
||
127 | */
|
||
128 | public static final ParameterDescriptor LATITUDE_OF_CENTER = createDescriptor( |
||
129 | new NamedIdentifier[] { |
||
130 | new NamedIdentifier(CitationImpl.OGC, "latitude_of_center"), |
||
131 | new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection center"), |
||
132 | new NamedIdentifier(CitationImpl.EPSG, "Latitude of projection centre"), |
||
133 | new NamedIdentifier(CitationImpl.EPSG, "Spherical latitude of origin"), |
||
134 | new NamedIdentifier(CitationImpl.EPSG, "Latitude of natural origin"), |
||
135 | new NamedIdentifier(CitationImpl.EPSG, "Spherical_latitude_of_origin"), |
||
136 | new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLat") |
||
137 | }, 0.0, -90, 90, NonSI.DEGREE_ANGLE); |
||
138 | |||
139 | /**
|
||
140 | * The operation parameter descriptor for the {@linkPlain #centralMeridian central
|
||
141 | * meridian} parameter value. Valid values range is from -180 to 180. Default value
|
||
142 | * is 2450' (= 4250' from Ferro prime meridian).
|
||
143 | */
|
||
144 | public static final ParameterDescriptor LONGITUDE_OF_CENTER = createDescriptor( |
||
145 | new NamedIdentifier[] { |
||
146 | new NamedIdentifier(CitationImpl.OGC, "longitude_of_center"), |
||
147 | new NamedIdentifier(CitationImpl.EPSG, "Longitude of projection center"), |
||
148 | new NamedIdentifier(CitationImpl.EPSG, "Longitude of projection centre"), |
||
149 | new NamedIdentifier(CitationImpl.EPSG, "Spherical longitude of origin"), |
||
150 | new NamedIdentifier(CitationImpl.EPSG, "Longitude of natural origin"), |
||
151 | new NamedIdentifier(CitationImpl.EPSG, "Spherical_longitude_of_origin"), |
||
152 | new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLong") |
||
153 | }, 0.0, -180, 180, NonSI.DEGREE_ANGLE); |
||
154 | |||
155 | |||
156 | static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] { |
||
157 | new NamedIdentifier(CitationImpl.OGC, "Lambert_Azimuthal_Equal_Area"), |
||
158 | new NamedIdentifier(CitationImpl.GEOTIFF, "LambertAzimEqualArea"), |
||
159 | new NamedIdentifier(CitationImpl.EPSG, "Lambert Azimuthal Equal Area"), |
||
160 | new NamedIdentifier(CitationImpl.EPSG, "Lambert Azimuthal Equal Area (Spherical)"), |
||
161 | new NamedIdentifier(CitationImpl.EPSG, "Lambert_Azimuthal_Equal_Area_(Spherical)"), |
||
162 | new NamedIdentifier(CitationImpl.EPSG, "9820"), |
||
163 | new NamedIdentifier(new CitationImpl("IDR"), "IDR"), |
||
164 | }, |
||
165 | new ParameterDescriptor[] { |
||
166 | SEMI_MAJOR, SEMI_MINOR, |
||
167 | LATITUDE_OF_CENTER, LONGITUDE_OF_CENTER, |
||
168 | FALSE_EASTING, FALSE_NORTHING |
||
169 | }); |
||
170 | |||
171 | /**
|
||
172 | * Constructs a new provider.
|
||
173 | */
|
||
174 | public Provider() { |
||
175 | super(PARAMETERS);
|
||
176 | } |
||
177 | |||
178 | /**
|
||
179 | * Returns the operation type for this map projection.
|
||
180 | */
|
||
181 | protected Class getOperationType() { |
||
182 | return ConicProjection.class;
|
||
183 | } |
||
184 | |||
185 | /**
|
||
186 | * Creates a transform from the specified group of parameter values.
|
||
187 | *
|
||
188 | * @param parameters The group of parameter values.
|
||
189 | * @return The created math transform.
|
||
190 | * @throws ParameterNotFoundException if a required parameter was not found.
|
||
191 | */
|
||
192 | public MathTransform createMathTransform(final ParameterValueGroup parameters) |
||
193 | throws ParameterNotFoundException
|
||
194 | { |
||
195 | return new IdrLambertAzimuthalEqualArea(parameters); |
||
196 | } |
||
197 | } |
||
198 | |||
199 | } |