Statistics
| Revision:

root / org.gvsig.jcrs / libJCRS / src / org / geotools / referencing / operation / projection / IdrAzimuthalEquidistant.java @ 38

History | View | Annotate | Download (15.6 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.referencing.operation.projection.IdrBonne.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.CylindricalProjection;
38
import org.opengis.referencing.operation.MathTransform;
39

    
40

    
41
public class IdrAzimuthalEquidistant extends MapProjection {
42
    protected final double latitudeOfCenter;
43
    protected final double longitudeOfCenter;
44
    protected IdrAzimuthalEquidistant(final ParameterValueGroup parameters) throws ParameterNotFoundException {
45
        super(parameters);
46
        final Collection expected = getParameterDescriptors().descriptors();
47
        if (expected.contains(Provider.LATITUDE_OF_CENTER)) {
48
                latitudeOfCenter = Math.abs(doubleValue(expected,
49
                                        Provider.LATITUDE_OF_CENTER, parameters));
50
            ensureLatitudeInRange(Provider.LATITUDE_OF_CENTER, latitudeOfCenter, false);
51
        } else {
52
            // standard parallel is the equator (Plate Carree or Equirectangular)
53
                latitudeOfCenter = Double.NaN;
54
        }
55
        if (expected.contains(Provider.LONGITUDE_OF_CENTER)) {
56
                longitudeOfCenter = Math.abs(doubleValue(expected,
57
                                        Provider.LONGITUDE_OF_CENTER, parameters));
58
            ensureLongitudeInRange(Provider.LONGITUDE_OF_CENTER, longitudeOfCenter, false);
59
        } else {
60
            // standard parallel is the equator (Plate Carree or Equirectangular)
61
                longitudeOfCenter = Double.NaN;
62
        }
63
    }
64

    
65
    /**
66
     * {@inheritDoc}
67
     */
68
    public ParameterDescriptorGroup getParameterDescriptors() {
69
        return Provider.PARAMETERS;
70
    }
71

    
72
    /**
73
     * {@inheritDoc}
74
     */
75
    public ParameterValueGroup getParameterValues() {
76
        final Collection expected = getParameterDescriptors().descriptors();
77
        final ParameterValueGroup values = super.getParameterValues();
78
        set(expected, Provider.LATITUDE_OF_CENTER,       values, latitudeOfCenter      );
79
        set(expected, Provider.LONGITUDE_OF_CENTER,      values, longitudeOfCenter       );
80
        return values;
81
    }
82

    
83
    /**
84
     * Transforms the specified (<var>&lambda;</var>,<var>&phi;</var>) coordinates
85
     * (units in radians) and stores the result in {@code ptDst} (linear distance
86
     * on a unit sphere).
87
     */
88
    protected Point2D transformNormalized(final double lambda, final double phi, Point2D ptDst)
89
            throws ProjectionException
90
    {
91
        return null;
92
    }
93

    
94
    /**
95
     * Transforms the specified (<var>x</var>,<var>y</var>) coordinate
96
     * and stores the result in {@code ptDst}.
97
     */
98
    protected Point2D inverseTransformNormalized(final double x, final double y, Point2D ptDst)
99
            throws ProjectionException
100
    {
101
        return null;
102
    }
103

    
104

    
105

    
106

    
107
    //////////////////////////////////////////////////////////////////////////////////////////
108
    //////////////////////////////////////////////////////////////////////////////////////////
109
    ////////                                                                          ////////
110
    ////////                                 PROVIDER                                 ////////
111
    ////////                                                                          ////////
112
    //////////////////////////////////////////////////////////////////////////////////////////
113
    //////////////////////////////////////////////////////////////////////////////////////////
114

    
115
    public static class Provider extends AbstractProvider {
116
        /**
117
         * The operation parameter descriptor for the {@linkPlain #latitudeOfOrigin
118
         * latitude of origin} parameter value. Valid values range is from -90 to 90.
119
         * Default value is 49.5.
120
         */
121
        public static final ParameterDescriptor LATITUDE_OF_CENTER = createDescriptor(
122
                new NamedIdentifier[] {
123
                    new NamedIdentifier(CitationImpl.OGC,     "latitude_of_center"),
124
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection center"),
125
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
126
                    new NamedIdentifier(CitationImpl.EPSG,    "Spherical latitude of origin"),
127
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of natural origin"),
128
                    new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLat")
129
                }, 0.0, -90, 90, NonSI.DEGREE_ANGLE);
130

    
131
        /**
132
         * The operation parameter descriptor for the {@linkPlain #centralMeridian central
133
         * meridian} parameter value. Valid values range is from -180 to 180. Default value
134
         * is 2450' (= 4250' from Ferro prime meridian).
135
         */
136
        public static final ParameterDescriptor LONGITUDE_OF_CENTER = createDescriptor(
137
                new NamedIdentifier[] {
138
                    new NamedIdentifier(CitationImpl.OGC,     "longitude_of_center"),
139
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of projection center"),
140
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of projection centre"),
141
                    new NamedIdentifier(CitationImpl.EPSG,    "Spherical longitude of origin"),
142
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of natural origin"),
143
                    new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLong")
144
                }, 0.0, -180, 180, NonSI.DEGREE_ANGLE);
145

    
146

    
147
        static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
148
            new NamedIdentifier(CitationImpl.OGC,     "Azimuthal_Equidistant"),
149
            new NamedIdentifier(CitationImpl.GEOTIFF, "AzimuthalEquidistant"),
150
            new NamedIdentifier(CitationImpl.EPSG,    "Azimuthal Equidistant"),
151
            new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
152
                },
153
                new ParameterDescriptor[] {
154
                    SEMI_MAJOR, SEMI_MINOR,
155
                    LATITUDE_OF_CENTER, LONGITUDE_OF_CENTER,
156
                    FALSE_EASTING, FALSE_NORTHING
157
                });
158

    
159
        /**
160
         * Constructs a new provider. 
161
         */
162
        public Provider() {
163
            super(PARAMETERS);
164
        }
165

    
166
        protected Provider(final ParameterDescriptorGroup params) {
167
            super(params);
168
        }
169

    
170
        /**
171
         * Returns the operation type for this map projection.
172
         */
173
        protected Class getOperationType() {
174
            return ConicProjection.class;
175
        }
176

    
177
        /**
178
         * Creates a transform from the specified group of parameter values.
179
         *
180
         * @param parameters The group of parameter values.
181
         * @return The created math transform.
182
         * @throws ParameterNotFoundException if a required parameter was not found.
183
         */
184
        public MathTransform createMathTransform(final ParameterValueGroup parameters)
185
                throws ParameterNotFoundException
186
        {
187
            return new IdrAzimuthalEquidistant(parameters);
188
        }
189
    }
190
        public static class Provider_Modified extends Provider {
191
        /**
192
         * The operation parameter descriptor for the {@linkPlain #latitudeOfOrigin
193
         * latitude of origin} parameter value. Valid values range is from -90 to 90.
194
         * Default value is 49.5.
195
         */
196
        public static final ParameterDescriptor LATITUDE_OF_CENTER = createDescriptor(
197
                new NamedIdentifier[] {
198
                    new NamedIdentifier(CitationImpl.OGC,     "latitude_of_center"),
199
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection center"),
200
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
201
                    new NamedIdentifier(CitationImpl.EPSG,    "Spherical latitude of origin"),
202
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of natural origin"),
203
                    new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLat")
204
                }, 0.0, -90, 90, NonSI.DEGREE_ANGLE);
205

    
206
        /**
207
         * The operation parameter descriptor for the {@linkPlain #centralMeridian central
208
         * meridian} parameter value. Valid values range is from -180 to 180. Default value
209
         * is 2450' (= 4250' from Ferro prime meridian).
210
         */
211
        public static final ParameterDescriptor LONGITUDE_OF_CENTER = createDescriptor(
212
                new NamedIdentifier[] {
213
                    new NamedIdentifier(CitationImpl.OGC,     "longitude_of_center"),
214
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of projection center"),
215
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of projection centre"),
216
                    new NamedIdentifier(CitationImpl.EPSG,    "Spherical longitude of origin"),
217
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of natural origin"),
218
                    new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLong")
219
                }, 0.0, -180, 180, NonSI.DEGREE_ANGLE);
220

    
221

    
222
        static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
223
            new NamedIdentifier(CitationImpl.OGC,     "Modified_Azimuthal_Equidistant"),
224
            new NamedIdentifier(CitationImpl.GEOTIFF, "ModifiedAzimuthalEquidistant"),
225
            new NamedIdentifier(CitationImpl.EPSG,    "Modified Azimuthal Equidistant"),
226
            new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
227
                },
228
                new ParameterDescriptor[] {
229
                    SEMI_MAJOR, SEMI_MINOR,
230
                    LATITUDE_OF_CENTER, LONGITUDE_OF_CENTER,
231
                    FALSE_EASTING, FALSE_NORTHING
232
                });
233

    
234

    
235

    
236
                  /**
237
                 * Constructs a new provider.
238
                 */
239
                public Provider_Modified() {
240
                    super(PARAMETERS);
241
                }
242

    
243
                /**
244
                 * Returns the operation type for this map projection.
245
                 */
246
                protected Class getOperationType() {
247
                        return CylindricalProjection.class;
248
                }
249

    
250
                /**
251
                 * Creates a transform from the specified group of parameter values.
252
                 *
253
                 * @param  parameters The group of parameter values.
254
                 * @return The created math transform.
255
                 * @throws ParameterNotFoundException if a required parameter was not found.
256
                 */
257
                public MathTransform createMathTransform(final ParameterValueGroup parameters)
258
                        throws ParameterNotFoundException
259
                {
260
                    //return null;
261
                        return new IdrAzimuthalEquidistant(parameters);
262
                }
263
            }
264
        public static class Provider_Guam extends Provider {
265
        /**
266
         * The operation parameter descriptor for the {@linkPlain #latitudeOfOrigin
267
         * latitude of origin} parameter value. Valid values range is from -90 to 90.
268
         * Default value is 49.5.
269
         */
270
        public static final ParameterDescriptor LATITUDE_OF_CENTER = createDescriptor(
271
                new NamedIdentifier[] {
272
                    new NamedIdentifier(CitationImpl.OGC,     "latitude_of_center"),
273
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection center"),
274
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
275
                    new NamedIdentifier(CitationImpl.EPSG,    "Spherical latitude of origin"),
276
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of natural origin"),
277
                    new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLat")
278
                }, 0.0, -90, 90, NonSI.DEGREE_ANGLE);
279

    
280
        /**
281
         * The operation parameter descriptor for the {@linkPlain #centralMeridian central
282
         * meridian} parameter value. Valid values range is from -180 to 180. Default value
283
         * is 2450' (= 4250' from Ferro prime meridian).
284
         */
285
        public static final ParameterDescriptor LONGITUDE_OF_CENTER = createDescriptor(
286
                new NamedIdentifier[] {
287
                    new NamedIdentifier(CitationImpl.OGC,     "longitude_of_center"),
288
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of projection center"),
289
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of projection centre"),
290
                    new NamedIdentifier(CitationImpl.EPSG,    "Spherical longitude of origin"),
291
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of natural origin"),
292
                    new NamedIdentifier(CitationImpl.GEOTIFF, "CenterLong")
293
                }, 0.0, -180, 180, NonSI.DEGREE_ANGLE);
294

    
295

    
296
        static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
297
            new NamedIdentifier(CitationImpl.OGC,     "Guam Projection"),
298
            new NamedIdentifier(CitationImpl.EPSG,    "Guam"),
299
            new NamedIdentifier(CitationImpl.EPSG,    "Guam_Projection"),
300
            new NamedIdentifier(CitationImpl.EPSG,    "AzimuthalEquidistant_Guam"),
301
            new NamedIdentifier(CitationImpl.EPSG,    "Azimuthal Equidistant (Guam)"),
302
            new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
303
                },
304
                new ParameterDescriptor[] {
305
                    SEMI_MAJOR, SEMI_MINOR,
306
                    LATITUDE_OF_CENTER, LONGITUDE_OF_CENTER,
307
                    FALSE_EASTING, FALSE_NORTHING
308
                });
309

    
310

    
311

    
312
                  /**
313
                 * Constructs a new provider.
314
                 */
315
                public Provider_Guam() {
316
                    super(PARAMETERS);
317
                }
318

    
319
                /**
320
                 * Returns the operation type for this map projection.
321
                 */
322
                protected Class getOperationType() {
323
                        return CylindricalProjection.class;
324
                }
325

    
326
                /**
327
                 * Creates a transform from the specified group of parameter values.
328
                 *
329
                 * @param  parameters The group of parameter values.
330
                 * @return The created math transform.
331
                 * @throws ParameterNotFoundException if a required parameter was not found.
332
                 */
333
                public MathTransform createMathTransform(final ParameterValueGroup parameters)
334
                        throws ParameterNotFoundException
335
                {
336
                    //return null;
337
                        return new IdrAzimuthalEquidistant(parameters);
338
                }
339
            }
340

    
341
}