Statistics
| Revision:

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

History | View | Annotate | Download (5.32 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 IdrGnomonic extends MapProjection {
20

    
21
    private final double latitudeOfOrigin;
22

    
23
    protected IdrGnomonic(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,      "Gnomonic"),
84
                            new NamedIdentifier(CitationImpl.EPSG,     "Gnomonic"),
85
                new NamedIdentifier(new CitationImpl("IDR"), "IDR")//,
86
//                new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
87
//                                    VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
88
            }, new ParameterDescriptor[] {
89
                SEMI_MAJOR,       SEMI_MINOR,
90
                CENTRAL_MERIDIAN, LATITUDE_OF_ORIGIN,
91
                FALSE_EASTING,    FALSE_NORTHING
92
            });
93

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

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

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

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

    
128
}