Revision 12205 branches/F2/libraries/libJCRS/src/org/geotools/referencing/operation/projection/TransverseMercator.java

View differences:

TransverseMercator.java
28 28
import java.awt.geom.AffineTransform;
29 29
import java.awt.geom.Point2D;
30 30
import java.util.Collection;
31
import javax.units.Unit;
31 32

  
33
import javax.units.NonSI;
34

  
32 35
// OpenGIS dependencies
33 36
import org.opengis.metadata.Identifier;
34 37
import org.opengis.parameter.ParameterDescriptor;
......
41 44
// Geotools dependencies
42 45
import org.geotools.metadata.iso.citation.CitationImpl;
43 46
import org.geotools.referencing.NamedIdentifier;
47
import org.geotools.referencing.operation.projection.CassiniSoldner.Provider;
44 48
import org.geotools.referencing.operation.transform.ConcatenatedTransform;
45 49
import org.geotools.referencing.operation.transform.ProjectiveTransform;
46 50
//import org.geotools.resources.i18n.VocabularyKeys;
......
104 108
 * @author Rueben Schulz
105 109
 */
106 110
public class TransverseMercator extends MapProjection {
107
    /**
111

  
112
	private final double scaleFactorLocal;
113
	private final double initialLongitude;
114
	private final double zoneWidth;
115
	
116
	/**
108 117
     * A derived quantity of excentricity, computed by <code>e' = (a鲲-b)/b = es/(1-es)</code>
109 118
     * where <var>a</var> is the semi-major axis length and <var>b</bar> is the semi-minor axis
110 119
     * length.
......
184 193
        en3 = (t *= excentricitySquared) *  (C66 - excentricitySquared  * C68);
185 194
        en4 =   t * excentricitySquared  *  C88;
186 195
        ml0 = mlfn(latitudeOfOrigin, Math.sin(latitudeOfOrigin), Math.cos(latitudeOfOrigin));
196

  
197
        final Collection expected = getParameterDescriptors().descriptors();
198
        if (expected.contains(Provider_TransverseMercatorZonedGridSystem.INITIAL_LONGITUDE)) {
199
        	initialLongitude = Math.abs(doubleValue(expected,
200
        			Provider_TransverseMercatorZonedGridSystem.INITIAL_LONGITUDE, parameters));
201
            ensureLatitudeInRange(Provider_TransverseMercatorZonedGridSystem.INITIAL_LONGITUDE, initialLongitude, false);
202
        } else {
203
            // standard parallel is the equator (Plate Carree or Equirectangular)
204
        	initialLongitude = Double.NaN;
205
        }
206
        if (expected.contains(Provider_TransverseMercatorZonedGridSystem.ZONE_WIDTH)) {
207
        	zoneWidth = Math.abs(doubleValue(expected,
208
        			Provider_TransverseMercatorZonedGridSystem.ZONE_WIDTH, parameters));
209
            ensureLatitudeInRange(Provider_TransverseMercatorZonedGridSystem.ZONE_WIDTH, zoneWidth, false);
210
        } else {
211
            // standard parallel is the equator (Plate Carree or Equirectangular)
212
        	zoneWidth = Double.NaN;
213
        }
214
        if (expected.contains(Provider_TransverseMercatorZonedGridSystem.SCALE_FACTOR_LOCAL)) {
215
        	scaleFactorLocal = Math.abs(doubleValue(expected,
216
        			Provider_TransverseMercatorZonedGridSystem.SCALE_FACTOR_LOCAL, parameters));
217
            ensureLatitudeInRange(Provider_TransverseMercatorZonedGridSystem.SCALE_FACTOR_LOCAL, scaleFactorLocal, false);
218
        } else {
219
            // standard parallel is the equator (Plate Carree or Equirectangular)
220
        	scaleFactorLocal = Double.NaN;
221
        }
187 222
    }
188 223
    
189 224
    /**
......
708 743
            return ConcatenatedTransform.create(ProjectiveTransform.create(step), projection);
709 744
        }
710 745
    }
746
    public static class Provider_TransverseMercatorZonedGridSystem extends Provider {
747
        /**
748
         * Constructs a new provider.
749
         */
750
	       public static final ParameterDescriptor INITIAL_LONGITUDE = createDescriptor(
751
	                new NamedIdentifier[] {
752
	                    new NamedIdentifier(CitationImpl.OGC,     "Initial longitude"),
753
	                    new NamedIdentifier(CitationImpl.EPSG,    "Initial_longitude")
754
	                }, 0.0, -180.0, 180.0, NonSI.DEGREE_ANGLE);
755

  
756
	       public static final ParameterDescriptor ZONE_WIDTH = createDescriptor(
757
	                new NamedIdentifier[] {
758
	                    new NamedIdentifier(CitationImpl.OGC,     "Zone width"),
759
	                    new NamedIdentifier(CitationImpl.EPSG,    "Zone_width")
760
	                }, 0.0, 0.0, 12.0, NonSI.DEGREE_ANGLE);
761

  
762
	       public static final ParameterDescriptor SCALE_FACTOR_LOCAL = createDescriptor(
763
	                new NamedIdentifier[] {
764
	                    new NamedIdentifier(CitationImpl.OGC,      "scale_factor"),
765
	                    new NamedIdentifier(CitationImpl.EPSG,     "Scale factor on initial line"),
766
	                    new NamedIdentifier(CitationImpl.EPSG,    "Scale factor at natural origin"),
767
	                    new NamedIdentifier(CitationImpl.GEOTIFF, "ScaleAtNatOrigin"),
768
	                    new NamedIdentifier(CitationImpl.GEOTIFF, "ScaleAtCenter")
769
	                },
770
	                1, 0, Double.POSITIVE_INFINITY, Unit.ONE);
771

  
772
	       static final ParameterDescriptorGroup PARAMETERS = createDescriptorGroup(new NamedIdentifier[] {
773
                new NamedIdentifier(CitationImpl.OGC,      "Transverse_Mercator_Zoned_Grid_System"),
774
    			new NamedIdentifier(CitationImpl.EPSG,     "Transverse Mercator Zoned Grid System")
775
//                new NamedIdentifier(CitationImpl.GEOTOOLS, Vocabulary.formatInternational(
776
//                                    VocabularyKeys.EQUIDISTANT_CYLINDRICAL_PROJECTION))
777
            }, new ParameterDescriptor[] {
778
                SEMI_MAJOR,       SEMI_MINOR,
779
                CENTRAL_MERIDIAN,
780
                INITIAL_LONGITUDE, ZONE_WIDTH,
781
                LATITUDE_OF_ORIGIN, SCALE_FACTOR_LOCAL,
782
                FALSE_EASTING,    FALSE_NORTHING
783
            });
784

  
785
        public Provider_TransverseMercatorZonedGridSystem() {
786
            super(PARAMETERS);
787
        }
788
 
789
        protected Class getOperationType() {
790
        	return CylindricalProjection.class;
791
        }
792

  
793
        /**
794
         * Creates a transform from the specified group of parameter values.
795
         *
796
         * @param  parameters The group of parameter values.
797
         * @return The created math transform.
798
         * @throws ParameterNotFoundException if a required parameter was not found.
799
         */
800
        public MathTransform createMathTransform(final ParameterValueGroup parameters)
801
        throws ParameterNotFoundException
802
        {
803
		    //return null;
804
			return new CassiniSoldner(parameters);
805
		}
806
    }
711 807
}

Also available in: Unified diff