Statistics
| Revision:

root / branches / F2 / libraries / libJCRS / src / org / geotools / referencing / operation / projection / Polyconic.java @ 12186

History | View | Annotate | Download (5.11 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.MapProjection.AbstractProvider;
11
import org.opengis.parameter.ParameterDescriptor;
12
import org.opengis.parameter.ParameterDescriptorGroup;
13
import org.opengis.parameter.ParameterNotFoundException;
14
import org.opengis.parameter.ParameterValueGroup;
15
import org.opengis.referencing.operation.ConicProjection;
16
import org.opengis.referencing.operation.MathTransform;
17

    
18

    
19
public class Polyconic extends MapProjection {
20

    
21
    private final double latitudeOfOrigin;
22

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

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

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

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

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

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

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

    
93
                /*String[] parameterName={"central_meridian"};
94
                projectionParameterList.add(count,parameterName);
95
                addProjectionParameter(count,"standard_parallel_1");
96
                addProjectionParameter(count,"false_easting");
97
                addProjectionParameter(count,"false_northing");*/
98

    
99
        /**
100
         * Constructs a new provider.
101
         */
102
        public Provider() {
103
            super(PARAMETERS);
104
        }
105

    
106
        /**
107
         * Returns the operation type for this map projection.
108
         */
109
        protected Class getOperationType() {
110
                return ConicProjection.class;
111
        }
112

    
113
        /**
114
         * Creates a transform from the specified group of parameter values.
115
         *
116
         * @param  parameters The group of parameter values.
117
         * @return The created math transform.
118
         * @throws ParameterNotFoundException if a required parameter was not found.
119
         */
120
        public MathTransform createMathTransform(final ParameterValueGroup parameters)
121
                throws ParameterNotFoundException
122
        {
123
            return new Polyconic(parameters);
124
        }
125
    }
126

    
127
}