Statistics
| Revision:

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

History | View | Annotate | Download (5.5 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.CylindricalProjection;
16
import org.opengis.referencing.operation.MathTransform;
17

    
18

    
19
public class IdrFlatPolarQuartic extends MapProjection {
20

    
21
    private final double longitudeOfCenter;
22

    
23
    protected IdrFlatPolarQuartic(ParameterValueGroup parameters) throws ParameterNotFoundException {
24
                super(parameters);
25
        final Collection expected = getParameterDescriptors().descriptors();
26
        if (expected.contains(Provider.LONGITUDE_OF_CENTER)) {
27
                longitudeOfCenter = Math.abs(doubleValue(expected,
28
                                        Provider.LONGITUDE_OF_CENTER, parameters));
29
            ensureLatitudeInRange(Provider.LONGITUDE_OF_CENTER, longitudeOfCenter, false);
30
        } else {
31
            // standard parallel is the equator (Plate Carree or Equirectangular)
32
                longitudeOfCenter = 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(longitudeOfCenter)) {
46
            final Collection expected = getParameterDescriptors().descriptors();
47
            set(expected,Provider.LONGITUDE_OF_CENTER, values, longitudeOfCenter);
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 LONGITUDE_OF_CENTER = createDescriptor(
66
                new NamedIdentifier[] {
67
                    new NamedIdentifier(CitationImpl.OGC,     "longitude_of_center"),
68
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of origin"),
69
                    new NamedIdentifier(CitationImpl.EPSG,    "Longitude of false origin"),
70
                    new NamedIdentifier(CitationImpl.GEOTIFF, "ProjCenterLong"),
71
                    new NamedIdentifier(CitationImpl.EPSG,    "NatOriginLong"),
72
                    new NamedIdentifier(CitationImpl.EPSG,    "central_meridian"),                
73
                    new NamedIdentifier(CitationImpl.EPSG,    "CenterLong")
74
                }, 0.0, -360.0, 360.0, NonSI.DEGREE_ANGLE);
75

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

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

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

    
109
        /**
110
         * Returns the operation type for this map projection.
111
         */
112
        protected Class getOperationType() {
113
                return CylindricalProjection.class;
114
        }
115

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

    
130
}