001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: *
005: * (C) 2005-2006, Geotools Project Managment Committee (PMC)
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.referencing.operation.projection;
018:
019: // OpenGIS dependencies
020: import org.opengis.parameter.ParameterDescriptor;
021: import org.opengis.parameter.ParameterDescriptorGroup;
022: import org.opengis.parameter.ParameterNotFoundException;
023: import org.opengis.parameter.ParameterValueGroup;
024: import org.opengis.referencing.operation.CylindricalProjection;
025: import org.opengis.referencing.operation.MathTransform;
026:
027: // Geotools dependencies
028: import org.geotools.metadata.iso.citation.Citations;
029: import org.geotools.referencing.NamedIdentifier;
030: import org.geotools.resources.i18n.VocabularyKeys;
031: import org.geotools.resources.i18n.Vocabulary;
032:
033: /**
034: * Mercator Cylindrical 2SP Projection.
035: *
036: * @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/mercator_2sp.html">"Mercator 2SP" on RemoteSensing.org</A>
037: *
038: * @since 2.2
039: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/Mercator2SP.java $
040: * @version $Id: Mercator2SP.java 25697 2007-05-31 14:26:35Z desruisseaux $
041: * @author Martin Desruisseaux
042: * @author Rueben Schulz
043: */
044: public class Mercator2SP extends Mercator {
045: /**
046: * Constructs a new map projection from the supplied parameters.
047: *
048: * @param parameters The parameter values in standard units.
049: * @throws ParameterNotFoundException if a mandatory parameter is missing.
050: */
051: protected Mercator2SP(final ParameterValueGroup parameters)
052: throws ParameterNotFoundException {
053: super (parameters);
054: }
055:
056: /**
057: * {@inheritDoc}
058: */
059: public ParameterDescriptorGroup getParameterDescriptors() {
060: return Provider.PARAMETERS;
061: }
062:
063: /**
064: * Provides the transform equations for the spherical case of the Mercator projection.
065: *
066: * @version $Id: Mercator2SP.java 25697 2007-05-31 14:26:35Z desruisseaux $
067: * @author Martin Desruisseaux
068: * @author Rueben Schulz
069: */
070: private static final class Spherical extends Mercator.Spherical {
071: /**
072: * Constructs a new map projection from the suplied parameters.
073: *
074: * @param parameters The parameter values in standard units.
075: * @throws ParameterNotFoundException if a mandatory parameter is missing.
076: */
077: protected Spherical(final ParameterValueGroup parameters)
078: throws ParameterNotFoundException {
079: super (parameters);
080: }
081:
082: /**
083: * {@inheritDoc}
084: */
085: public ParameterDescriptorGroup getParameterDescriptors() {
086: return Provider.PARAMETERS;
087: }
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 Mercator2SP Mercator 2SP} projection (EPSG code 9805).
101: *
102: * @version $Id: Mercator2SP.java 25697 2007-05-31 14:26:35Z desruisseaux $
103: * @author Martin Desruisseaux
104: * @author Rueben Schulz
105: *
106: * @see org.geotools.referencing.operation.DefaultMathTransformFactory
107: */
108: public static class Provider extends AbstractProvider {
109: /**
110: * The parameters group.
111: */
112: static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(
113: new NamedIdentifier[] {
114: new NamedIdentifier(Citations.OGC,
115: "Mercator_2SP"),
116: new NamedIdentifier(Citations.EPSG,
117: "Mercator (2SP)"),
118: new NamedIdentifier(Citations.EPSG, "9805"),
119: new NamedIdentifier(Citations.GEOTIFF,
120: "CT_Mercator"),
121: new NamedIdentifier(Citations.ESRI, "Mercator"),
122: new NamedIdentifier(
123: Citations.GEOTOOLS,
124: Vocabulary
125: .formatInternational(VocabularyKeys.CYLINDRICAL_MERCATOR_PROJECTION)) },
126: new ParameterDescriptor[] { SEMI_MAJOR, SEMI_MINOR,
127: STANDARD_PARALLEL_1, LATITUDE_OF_ORIGIN,
128: CENTRAL_MERIDIAN, FALSE_EASTING, FALSE_NORTHING });
129:
130: /**
131: * Constructs a new provider.
132: */
133: public Provider() {
134: super (PARAMETERS);
135: }
136:
137: /**
138: * Returns the operation type for this map projection.
139: */
140: public Class getOperationType() {
141: return CylindricalProjection.class;
142: }
143:
144: /**
145: * Creates a transform from the specified group of parameter values.
146: *
147: * @param parameters The group of parameter values.
148: * @return The created math transform.
149: * @throws ParameterNotFoundException if a required parameter was not found.
150: */
151: protected MathTransform createMathTransform(
152: final ParameterValueGroup parameters)
153: throws ParameterNotFoundException {
154: if (isSpherical(parameters)) {
155: return new Spherical(parameters);
156: } else {
157: return new Mercator2SP(parameters);
158: }
159: }
160: }
161: }
|