Statistics
| Revision:

root / branches / libProjection_v2_0_prep / libraries / libJCRS / src / org / geotools / referencing / operation / projection / IdrMillerCylindrical.java @ 27137

History | View | Annotate | Download (8.21 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 IdrMillerCylindrical extends MapProjection {
40
    protected final double latitudeOfCenter;
41
    protected final double longitudeOfCenter;
42
    protected IdrMillerCylindrical(final ParameterValueGroup parameters) throws ParameterNotFoundException {
43
        super(parameters);
44
        final Collection expected = getParameterDescriptors().descriptors();
45
        if (expected.contains(Provider.LATITUDE_OF_CENTER)) {
46
                latitudeOfCenter = Math.abs(doubleValue(expected,
47
                                        Provider.LATITUDE_OF_CENTER, parameters));
48
            ensureLatitudeInRange(Provider.LATITUDE_OF_CENTER, latitudeOfCenter, false);
49
        } else {
50
            // standard parallel is the equator (Plate Carree or Equirectangular)
51
                latitudeOfCenter = Double.NaN;
52
        }
53
        if (expected.contains(Provider.LONGITUDE_OF_CENTER)) {
54
                longitudeOfCenter = Math.abs(doubleValue(expected,
55
                                        Provider.LONGITUDE_OF_CENTER, parameters));
56
            ensureLongitudeInRange(Provider.LONGITUDE_OF_CENTER, longitudeOfCenter, false);
57
        } else {
58
            // standard parallel is the equator (Plate Carree or Equirectangular)
59
                longitudeOfCenter = Double.NaN;
60
        }
61
    }
62

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

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

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

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

    
102

    
103

    
104

    
105
    //////////////////////////////////////////////////////////////////////////////////////////
106
    //////////////////////////////////////////////////////////////////////////////////////////
107
    ////////                                                                          ////////
108
    ////////                                 PROVIDER                                 ////////
109
    ////////                                                                          ////////
110
    //////////////////////////////////////////////////////////////////////////////////////////
111
    //////////////////////////////////////////////////////////////////////////////////////////
112

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

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

    
152

    
153
        static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
154
            new NamedIdentifier(CitationImpl.OGC,     "Miller_Cylindrical"),
155
            new NamedIdentifier(CitationImpl.GEOTIFF, "MillerCylindrical"),
156
            new NamedIdentifier(CitationImpl.EPSG,    "Miller Cylindrical"),
157
            new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
158
                },
159
                new ParameterDescriptor[] {
160
                    SEMI_MAJOR, SEMI_MINOR,
161
                    LATITUDE_OF_CENTER, LONGITUDE_OF_CENTER,
162
                    FALSE_EASTING, FALSE_NORTHING
163
                });
164

    
165
        /**
166
         * Constructs a new provider. 
167
         */
168
        public Provider() {
169
            super(PARAMETERS);
170
        }
171

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

    
179
        /**
180
         * Creates a transform from the specified group of parameter values.
181
         *
182
         * @param parameters The group of parameter values.
183
         * @return The created math transform.
184
         * @throws ParameterNotFoundException if a required parameter was not found.
185
         */
186
        public MathTransform createMathTransform(final ParameterValueGroup parameters)
187
                throws ParameterNotFoundException
188
        {
189
            return new IdrMillerCylindrical(parameters);
190
        }
191
    }
192

    
193
}