001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.referencing.factory.wms;
017:
018: // OpenGIS dependencies
019: import org.opengis.parameter.ParameterValueGroup;
020:
021: /**
022: * Auto Universal Transverse Mercator ({@code AUTO:42001}).
023: * In the notation below, "<code>${var}</code>" denotes a reference to the value of a variable
024: * "{@code var}". The variables "{@code lat0}" and "{@code lon0}" are the central point of the
025: * projection appearing in the CRS parameter of the map request. The coordinate operation method
026: * uses ellipsoidal formulas.
027: *
028: * <pre>
029: * PROJCS["WGS 84 / Auto UTM",
030: * GEOGCS["WGS 84",
031: * DATUM["WGS_1984",
032: * SPHEROID["WGS_1984", 6378137, 298.257223563]],
033: * PRIMEM["Greenwich", 0],
034: * UNIT["Decimal_Degree", 0.0174532925199433]],
035: * PROJECTION["Transverse_Mercator"],
036: * PARAMETER["Latitude_of_Origin", 0],
037: * PARAMETER["Central_Meridian", ${central_meridian}],
038: * PARAMETER["False_Easting", 500000],
039: * PARAMETER["False_Northing", ${false_northing}],
040: * PARAMETER["Scale_Factor", 0.9996],
041: * UNIT["Meter", 1]]
042: * </pre>
043: *
044: * Where:
045: *
046: * <pre>
047: * ${zone} = min( floor( (${lon0} + 180.0) / 6.0 ) + 1, 60 )
048: * ${central_meridian} = -183.0 + ${zone} * 6.0
049: * ${false_northing} = (${lat0} >= 0.0) ? 0.0 : 10000000.0
050: * </pre>
051: *
052: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/referencing/factory/wms/Auto42001.java $
053: * @version $Id: Auto42001.java 20874 2006-08-07 10:00:01Z jgarnett $
054: * @author Jody Garnett
055: * @author Rueben Schulz
056: * @author Martin Desruisseaux
057: */
058: final class Auto42001 extends Factlet {
059: /**
060: * A shared (thread-safe) instance.
061: */
062: public static final Auto42001 DEFAULT = new Auto42001();
063:
064: /**
065: * Do not allows instantiation except the {@link #DEFAULT} constant.
066: */
067: private Auto42001() {
068: }
069:
070: /**
071: * {@inheritDoc}
072: */
073: public int code() {
074: return 42001;
075: }
076:
077: /**
078: * {@inheritDoc}
079: */
080: public String getName() {
081: return "WGS 84 / Auto UTM";
082: }
083:
084: /**
085: * {@inheritDoc}
086: */
087: public String getClassification() {
088: return "Transverse_Mercator";
089: }
090:
091: /**
092: * {@inheritDoc}
093: */
094: protected void setProjectionParameters(
095: final ParameterValueGroup parameters, final Code code) {
096: final double zone = Math.min(Math
097: .floor((code.longitude + 180.0) / 6.0) + 1, 60);
098: final double centralMeridian = -183.0 + zone * 6.0;
099: final double falseNorthing = code.latitude >= 0.0 ? 0.0
100: : 10000000.0;
101:
102: parameters.parameter("latitude_of_origin").setValue(0.0);
103: parameters.parameter("central_meridian").setValue(
104: centralMeridian);
105: parameters.parameter("false_easting").setValue(500000.0);
106: parameters.parameter("false_northing").setValue(falseNorthing);
107: parameters.parameter("scale_factor").setValue(0.9996);
108: }
109: }
|