001: package org.geotools.referencing.operation.projection;
002:
003: import org.geotools.metadata.iso.citation.Citations;
004: import org.geotools.referencing.NamedIdentifier;
005: import org.opengis.parameter.ParameterDescriptor;
006: import org.opengis.parameter.ParameterDescriptorGroup;
007: import org.opengis.parameter.ParameterNotFoundException;
008: import org.opengis.parameter.ParameterValueGroup;
009: import org.opengis.referencing.operation.CylindricalProjection;
010: import org.opengis.referencing.operation.MathTransform;
011:
012: /**
013: * Mercator 1SP variation used by Google, which basically requires to accept lat/lon values
014: * as spherical coordinates, that is, avoiding to do any conversion from ellipsoid to the sphere.
015: * @author Andrea Aime
016: * @deprecated Since GeoTools 2.4.0 there is no need to use this custom projection anymore, use
017: * the WKT definition suggested in {@link http://jira.codehaus.org/browse/GEOT-1511}
018: * instead
019: */
020: public class Mercator1SPGoogle extends Mercator {
021:
022: /**
023: * Constructs a new map projection from the supplied parameters.
024: *
025: * @param parameters The parameter values in standard units.
026: * @throws ParameterNotFoundException if a mandatory parameter is missing.
027: */
028: protected Mercator1SPGoogle(final ParameterValueGroup parameters)
029: throws ParameterNotFoundException {
030: super (parameters);
031: }
032:
033: /**
034: * {@inheritDoc}
035: */
036: public ParameterDescriptorGroup getParameterDescriptors() {
037: return Provider.PARAMETERS;
038: }
039:
040: /**
041: * Provides the transform equations for the spherical case of the Mercator projection.
042: *
043: * @version $Id: Mercator1SPGoogle.java 8404 2008-02-14 13:53:51Z aaime $
044: * @author Martin Desruisseaux
045: * @author Rueben Schulz
046: */
047: private static final class Spherical extends Mercator.Spherical {
048: /**
049: * Constructs a new map projection from the suplied parameters.
050: *
051: * @param parameters The parameter values in standard units.
052: * @throws ParameterNotFoundException if a mandatory parameter is missing.
053: */
054: protected Spherical(final ParameterValueGroup parameters)
055: throws ParameterNotFoundException {
056: super (parameters);
057: }
058:
059: /**
060: * {@inheritDoc}
061: */
062: public ParameterDescriptorGroup getParameterDescriptors() {
063: return Provider.PARAMETERS;
064: }
065: }
066:
067: //////////////////////////////////////////////////////////////////////////////////////////
068: //////////////////////////////////////////////////////////////////////////////////////////
069: //////// ////////
070: //////// PROVIDERS ////////
071: //////// ////////
072: //////////////////////////////////////////////////////////////////////////////////////////
073: //////////////////////////////////////////////////////////////////////////////////////////
074:
075: /**
076: * The {@linkplain org.geotools.referencing.operation.MathTransformProvider math transform
077: * provider} for a {@linkplain Mercator1SP Mercator 1SP} projection (EPSG code 9804).
078: *
079: * @since 2.2
080: * @version $Id: Mercator1SPGoogle.java 8404 2008-02-14 13:53:51Z aaime $
081: * @author Martin Desruisseaux
082: * @author Rueben Schulz
083: *
084: * @see org.geotools.referencing.operation.DefaultMathTransformFactory
085: */
086: public static class Provider extends AbstractProvider {
087: /**
088: * The parameters group.
089: */
090: static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(
091: new NamedIdentifier[] {
092: new NamedIdentifier(Citations.OGC,
093: "Mercator_1SP_Google"),
094: new NamedIdentifier(Citations.GEOTOOLS,
095: "Mercator_1SP_Google") },
096: new ParameterDescriptor[] { SEMI_MAJOR, SEMI_MINOR,
097: LATITUDE_OF_ORIGIN, CENTRAL_MERIDIAN,
098: SCALE_FACTOR, FALSE_EASTING, FALSE_NORTHING });
099:
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: public 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: protected MathTransform createMathTransform(
122: final ParameterValueGroup parameters)
123: throws ParameterNotFoundException {
124: // make sure we assume a spherical reference
125: parameters.parameter("semi_minor").setValue(
126: parameters.parameter("semi_major").getValue());
127: return new Spherical(parameters);
128: }
129: }
130:
131: }
|