Statistics
| Revision:

root / branches / Mobile_Compatible_Hito_1 / libJCRS / src / org / geotools / referencing / operation / projection / IdrCassiniSoldner.java @ 21878

History | View | Annotate | Download (8.94 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.IdrKrovak.Provider;
11
import org.geotools.referencing.operation.projection.MapProjection.AbstractProvider;
12
import org.opengis.parameter.ParameterDescriptor;
13
import org.opengis.parameter.ParameterDescriptorGroup;
14
import org.opengis.parameter.ParameterNotFoundException;
15
import org.opengis.parameter.ParameterValueGroup;
16
import org.opengis.referencing.operation.CylindricalProjection;
17
import org.opengis.referencing.operation.MathTransform;
18

    
19

    
20
public class IdrCassiniSoldner extends MapProjection {
21

    
22
    private final double latitudeOfOrigin;
23

    
24
    protected IdrCassiniSoldner(ParameterValueGroup parameters) throws ParameterNotFoundException {
25
                super(parameters);
26
        final Collection expected = getParameterDescriptors().descriptors();
27
        if (expected.contains(Provider.LATITUDE_OF_ORIGIN)) {
28
                latitudeOfOrigin = Math.abs(doubleValue(expected,
29
                                        Provider.LATITUDE_OF_ORIGIN, parameters));
30
            ensureLatitudeInRange(Provider.LATITUDE_OF_ORIGIN, latitudeOfOrigin, false);
31
        } else {
32
            // standard parallel is the equator (Plate Carree or Equirectangular)
33
                latitudeOfOrigin = Double.NaN;
34
        }
35
                // TODO Auto-generated constructor stub
36
        }
37

    
38
        
39
        public ParameterDescriptorGroup getParameterDescriptors() {
40
                // TODO Auto-generated method stub
41
        return Provider.PARAMETERS;
42
        }
43

    
44
    public ParameterValueGroup getParameterValues() {
45
        final ParameterValueGroup values = super.getParameterValues();
46
        if (!Double.isNaN(latitudeOfOrigin)) {
47
            final Collection expected = getParameterDescriptors().descriptors();
48
            set(expected,Provider.LATITUDE_OF_ORIGIN, values, latitudeOfOrigin);
49
        }
50
        return values;
51
    }
52

    
53
        protected Point2D inverseTransformNormalized(double x, double y,
54
                        Point2D ptDst) throws ProjectionException {
55
                // TODO Auto-generated method stub
56
                return null;
57
        }
58

    
59
        protected Point2D transformNormalized(double x, double y, Point2D ptDst)
60
                        throws ProjectionException {
61
                // TODO Auto-generated method stub
62
                return null;
63
        }
64
        public static class Provider extends AbstractProvider {
65

    
66
        public static final ParameterDescriptor LATITUDE_OF_ORIGIN = createDescriptor(
67
                new NamedIdentifier[] {
68
                    new NamedIdentifier(CitationImpl.OGC,     "latitude_of_origin"),
69
                    new NamedIdentifier(CitationImpl.EPSG,    "CenterLat"),
70
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
71
                    new NamedIdentifier(CitationImpl.GEOTIFF, "NatOriginLat"),
72
                    new NamedIdentifier(CitationImpl.EPSG,    "FalseOriginLat"),
73
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of false origin"),                
74
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of natural origin"),
75
                    new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
76
                    new NamedIdentifier(CitationImpl.EPSG,    "ProjCenterLat")
77
                }, 0.0, -90.0, 90.0, NonSI.DEGREE_ANGLE);
78

    
79
        /**
80
         * The parameters group. Note the EPSG includes a "Latitude of natural origin" parameter instead
81
         * of "standard_parallel_1". I have sided with ESRI and Snyder in this case.
82
         */
83
        static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
84
                new NamedIdentifier(CitationImpl.OGC,      "Cassini_Soldner"),
85
                            new NamedIdentifier(CitationImpl.EPSG,     "Cassini-Soldner"),
86
                new NamedIdentifier(CitationImpl.EPSG,     "Peters (approximated by Gall Orthographic)"),
87
                new NamedIdentifier(CitationImpl.EPSG,     "9806"),
88
                            new NamedIdentifier(CitationImpl.EPSG,     "Cassini"),
89
                new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
90
//                new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
91
//                                    VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
92
            }, new ParameterDescriptor[] {
93
                SEMI_MAJOR,       SEMI_MINOR,
94
                CENTRAL_MERIDIAN, LATITUDE_OF_ORIGIN,
95
                FALSE_EASTING,    FALSE_NORTHING
96
            });
97

    
98
                /*String[] parameterName={"central_meridian"};
99
                projectionParameterList.add(count,parameterName);
100
                addProjectionParameter(count,"standard_parallel_1");
101
                addProjectionParameter(count,"false_easting");
102
                addProjectionParameter(count,"false_northing");*/
103

    
104
        /**
105
         * Constructs a new provider.
106
         */
107
        public Provider() {
108
            super(PARAMETERS);
109
        }
110

    
111
        protected Provider(final ParameterDescriptorGroup params) {
112
            super(params);
113
        }
114

    
115
        /**
116
         * Returns the operation type for this map projection.
117
         */
118
        protected Class getOperationType() {
119
                return CylindricalProjection.class;
120
        }
121

    
122
        /**
123
         * Creates a transform from the specified group of parameter values.
124
         *
125
         * @param  parameters The group of parameter values.
126
         * @return The created math transform.
127
         * @throws ParameterNotFoundException if a required parameter was not found.
128
         */
129
        public MathTransform createMathTransform(final ParameterValueGroup parameters)
130
                throws ParameterNotFoundException
131
        {
132
            return new IdrCassiniSoldner(parameters);
133
            //return null;
134
                //return new EquidistantCylindrical(parameters);
135
        }
136
    }
137
        public static class Provider_Hyperbolic extends Provider {
138
 
139
               public static final ParameterDescriptor LATITUDE_OF_ORIGIN = createDescriptor(
140
                        new NamedIdentifier[] {
141
                            new NamedIdentifier(CitationImpl.OGC,     "latitude_of_origin"),
142
                            new NamedIdentifier(CitationImpl.EPSG,    "CenterLat"),
143
                            new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
144
                            new NamedIdentifier(CitationImpl.GEOTIFF, "NatOriginLat"),
145
                            new NamedIdentifier(CitationImpl.EPSG,    "FalseOriginLat"),
146
                            new NamedIdentifier(CitationImpl.EPSG,    "Latitude of false origin"),                
147
                            new NamedIdentifier(CitationImpl.EPSG,    "Latitude of natural origin"),
148
                            new NamedIdentifier(CitationImpl.EPSG,    "Latitude of projection centre"),
149
                            new NamedIdentifier(CitationImpl.EPSG,    "ProjCenterLat")
150
                        }, 0.0, -90.0, 90.0, NonSI.DEGREE_ANGLE);
151

    
152
                /**
153
                 * The parameters group. Note the EPSG includes a "Latitude of natural origin" parameter instead
154
                 * of "standard_parallel_1". I have sided with ESRI and Snyder in this case.
155
                 */
156
                static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
157
                        new NamedIdentifier(CitationImpl.OGC,      "Hyperbolic Cassini-Soldner"),
158
                                    new NamedIdentifier(CitationImpl.EPSG,     "Hyperbolic_Cassini-Soldner"),
159
                        new NamedIdentifier(CitationImpl.EPSG,     "Cassini-Soldner (Hyperbolic)"),
160
                        new NamedIdentifier(CitationImpl.EPSG,     "Cassini-Soldner_(Hyperbolic)"),
161
                        new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
162
//                        new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
163
//                                            VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
164
                    }, new ParameterDescriptor[] {
165
                        SEMI_MAJOR,       SEMI_MINOR,
166
                        CENTRAL_MERIDIAN, LATITUDE_OF_ORIGIN,
167
                        FALSE_EASTING,    FALSE_NORTHING
168
                    });
169

    
170

    
171
                  /**
172
                 * Constructs a new provider.
173
                 */
174
                public Provider_Hyperbolic() {
175
                    super(PARAMETERS);
176
                }
177

    
178
                /**
179
                 * Returns the operation type for this map projection.
180
                 */
181
                protected Class getOperationType() {
182
                        return CylindricalProjection.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 null;
196
                        return new IdrCassiniSoldner(parameters);
197
                }
198
            }
199

    
200
}