001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: *
005: * (C) 2005-2006, Geotools Project Managment Committee (PMC)
006: * (C) 2003, Gerald I. Evenden
007: * (C) 2000, Frank Warmerdam
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * This package contains formulas from the PROJ package of USGS.
020: * USGS's work is fully acknowledged here. This derived work has
021: * been relicensed under LGPL with Frank Warmerdam's permission.
022: */
023: package org.geotools.referencing.operation.projection;
024:
025: // J2SE dependencies
026: import java.util.Collection;
027:
028: // OpenGIS dependencies
029: import org.opengis.parameter.ParameterValueGroup;
030: import org.opengis.parameter.ParameterDescriptor;
031: import org.opengis.parameter.ParameterDescriptorGroup;
032: import org.opengis.parameter.ParameterNotFoundException;
033: import org.opengis.referencing.operation.MathTransform;
034:
035: // Geotools dependencies
036: import org.geotools.referencing.NamedIdentifier;
037: import org.geotools.metadata.iso.citation.Citations;
038:
039: /**
040: * Hotine Oblique Mercator projection. It is similar to the {@link ObliqueMercator oblique mercator}
041: * projection, except that coordinates start at the intersection of the central line and the equator
042: * of the aposphere.
043: *
044: * @since 2.4
045: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/HotineObliqueMercator.java $
046: * @version $Id: HotineObliqueMercator.java 24563 2007-02-23 00:20:43Z desruisseaux $
047: * @author Rueben Schulz
048: */
049: public class HotineObliqueMercator extends ObliqueMercator {
050: /**
051: * Constructs a new map projection from the supplied parameters.
052: *
053: * @param parameters The parameter values in standard units.
054: * @throws ParameterNotFoundException if a mandatory parameter is missing.
055: *
056: * @todo Current implementation assumes a "azimuth" case. We may try to detect
057: * automatically the "two points" case in a future version if needed. Note
058: * that this limitation doesn't apply to projection created from the
059: * {@link Provider_TwoPoint}.
060: */
061: protected HotineObliqueMercator(final ParameterValueGroup parameters)
062: throws ParameterNotFoundException {
063: this (parameters, Provider.PARAMETERS.descriptors(), false);
064: }
065:
066: /**
067: * Constructs a new map projection from the supplied parameters.
068: *
069: * @param parameters The parameter values in standard units.
070: * @param expected The expected parameter descriptors.
071: * @param twoPoint {@code true} for the "two points" case, or {@code false} for the
072: * "azimuth" case. The former is used by ESRI but not EPSG.
073: * @throws ParameterNotFoundException if a mandatory parameter is missing.
074: */
075: HotineObliqueMercator(final ParameterValueGroup parameters,
076: final Collection expected, final boolean twoPoint)
077: throws ParameterNotFoundException {
078: // Fetch parameters
079: super (parameters, expected, twoPoint, true);
080: }
081:
082: /**
083: * {@inheritDoc}
084: */
085: public ParameterDescriptorGroup getParameterDescriptors() {
086: return (twoPoint) ? Provider_TwoPoint.PARAMETERS
087: : Provider.PARAMETERS;
088: }
089:
090: //////////////////////////////////////////////////////////////////////////////////////////
091: //////////////////////////////////////////////////////////////////////////////////////////
092: //////// ////////
093: //////// PROVIDERS ////////
094: //////// ////////
095: //////////////////////////////////////////////////////////////////////////////////////////
096: //////////////////////////////////////////////////////////////////////////////////////////
097:
098: /**
099: * The {@linkplain org.geotools.referencing.operation.MathTransformProvider math transform
100: * provider} for a {@linkplain HotineObliqueMercator Hotine Oblique Mercator} projection
101: * (EPSG code 9812).
102: *
103: * @since 2.4
104: * @version $Id: HotineObliqueMercator.java 24563 2007-02-23 00:20:43Z desruisseaux $
105: * @author Rueben Schulz
106: *
107: * @see org.geotools.referencing.operation.DefaultMathTransformFactory
108: */
109: public static final class Provider extends ObliqueMercator.Provider {
110: /**
111: * The parameters group.
112: */
113: static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(
114: new NamedIdentifier[] {
115: new NamedIdentifier(Citations.OGC,
116: "Hotine_Oblique_Mercator"),
117: new NamedIdentifier(Citations.EPSG,
118: "Hotine Oblique Mercator"),
119: new NamedIdentifier(Citations.EPSG, "9812"),
120: new NamedIdentifier(Citations.GEOTIFF,
121: "CT_ObliqueMercator_Hotine"),
122: new NamedIdentifier(Citations.ESRI,
123: "Hotine_Oblique_Mercator_Azimuth_Natural_Origin"),
124: new NamedIdentifier(Citations.ESRI,
125: "Rectified_Skew_Orthomorphic_Natural_Origin"),
126: new NamedIdentifier(Citations.GEOTOOLS, NAME) },
127: new ParameterDescriptor[] { SEMI_MAJOR, SEMI_MINOR,
128: LONGITUDE_OF_CENTRE, LATITUDE_OF_CENTRE,
129: AZIMUTH, RECTIFIED_GRID_ANGLE, SCALE_FACTOR,
130: FALSE_EASTING, FALSE_NORTHING });
131:
132: /**
133: * Constructs a new provider.
134: */
135: public Provider() {
136: super (PARAMETERS);
137: }
138:
139: /**
140: * Creates a transform from the specified group of parameter values.
141: *
142: * @param parameters The group of parameter values.
143: * @return The created math transform.
144: * @throws ParameterNotFoundException if a required parameter was not found.
145: */
146: protected MathTransform createMathTransform(
147: final ParameterValueGroup parameters)
148: throws ParameterNotFoundException {
149: final Collection descriptors = PARAMETERS.descriptors();
150: return new HotineObliqueMercator(parameters, descriptors,
151: false);
152: }
153: }
154:
155: /**
156: * The {@linkplain org.geotools.referencing.operation.MathTransformProvider math transform
157: * provider} for a {@linkplain HotineObliqueMercator Hotine Oblique Mercator} projection,
158: * specified with two points on the central line (instead of a central point and azimuth).
159: *
160: * @since 2.4
161: * @version $Id: HotineObliqueMercator.java 24563 2007-02-23 00:20:43Z desruisseaux $
162: * @author Rueben Schulz
163: *
164: * @see org.geotools.referencing.operation.DefaultMathTransformFactory
165: */
166: public static final class Provider_TwoPoint extends
167: ObliqueMercator.Provider_TwoPoint {
168: /**
169: * The parameters group.
170: */
171: static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(
172: new NamedIdentifier[] {
173: new NamedIdentifier(Citations.ESRI,
174: "Hotine_Oblique_Mercator_Two_Point_Natural_Origin"),
175: new NamedIdentifier(Citations.GEOTOOLS, NAME) },
176: new ParameterDescriptor[] { SEMI_MAJOR, SEMI_MINOR,
177: LAT_OF_1ST_POINT, LONG_OF_1ST_POINT,
178: LAT_OF_2ND_POINT, LONG_OF_2ND_POINT,
179: LATITUDE_OF_CENTRE, SCALE_FACTOR,
180: FALSE_EASTING, FALSE_NORTHING });
181:
182: /**
183: * Constructs a new provider.
184: */
185: public Provider_TwoPoint() {
186: super (PARAMETERS);
187: }
188:
189: /**
190: * Creates a transform from the specified group of parameter values.
191: *
192: * @param parameters The group of parameter values.
193: * @return The created math transform.
194: * @throws ParameterNotFoundException if a required parameter was not found.
195: */
196: protected MathTransform createMathTransform(
197: final ParameterValueGroup parameters)
198: throws ParameterNotFoundException {
199: final Collection descriptors = PARAMETERS.descriptors();
200: return new HotineObliqueMercator(parameters, descriptors,
201: true);
202: }
203: }
204: }
|