MapProjection changes for revisions 10259:10796

Some changes in this commit seem to be the result of some "auto reformat" tool execution. The Java - GeoAPI - GeoTools import ordering is altered, imports used only in Javadoc are lost and the encoding of non-ASCII characters is broken. This change has been reverted, except for the removal of really unused imports which are kept removed.

The commit contains also information which can be removed, then re-added from the following sources:

The change which make the centralMeridian field non-final does not apply to Apache SIS because we do not store this information in this class anymore.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r10259:10796 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/MapProjection.java
Revision 10259Revision 10796
/*
 * Geotools 2 - OpenSource mapping toolkit
 * (C) 2003, Geotools Project Managment Committee (PMC)
 * (C) 2001, Institut de Recherche pour le Développement
 * (C) 1999, Fisheries and Oceans Canada
 *
 *    This library is free software; you can redistribute it and/or
/*
 * Geotools 2 - OpenSource mapping toolkit
 * (C) 2003, Geotools Project Managment Committee (PMC)
 * (C) 2001, Institut de Recherche pour le D�veloppement
 * (C) 1999, Fisheries and Oceans Canada
 *
 *    This library is free software; you can redistribute it and/or
import java.awt.geom.Point2D;
import java.io.Serializable;
import java.util.Collection;
import javax.units.Unit;
import javax.units.SI;
import javax.units.NonSI;

// OpenGIS dependencies
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransform2D;
import org.opengis.referencing.operation.TransformException;
import org.opengis.parameter.InvalidParameterValueException;
import org.opengis.parameter.InvalidParameterNameException;
import org.opengis.parameter.ParameterNotFoundException;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.parameter.ParameterValue;

// Geotools dependencies
import org.geotools.measure.Latitude;
import org.geotools.measure.Longitude;
import org.geotools.referencing.Identifier;
import org.geotools.referencing.operation.MathTransformProvider;
import org.geotools.referencing.operation.transform.AbstractMathTransform;
import org.geotools.metadata.citation.Citation;
import org.geotools.resources.cts.ResourceKeys;
import org.geotools.resources.cts.Resources;
import org.geotools.resources.XMath;


/**
import java.awt.geom.Point2D;
import java.io.Serializable;
import java.util.Collection;

import javax.units.NonSI;
import javax.units.SI;
import javax.units.Unit;

import org.geotools.measure.Latitude;
import org.geotools.measure.Longitude;
import org.geotools.metadata.citation.Citation;
import org.geotools.referencing.Identifier;
import org.geotools.referencing.operation.MathTransformProvider;
import org.geotools.referencing.operation.transform.AbstractMathTransform;
import org.geotools.resources.XMath;
import org.geotools.resources.cts.ResourceKeys;
import org.geotools.resources.cts.Resources;
import org.opengis.parameter.InvalidParameterValueException;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.ParameterNotFoundException;
import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransform2D;
import org.opengis.referencing.operation.TransformException;


/**
* WKT (Well Know Text) or XML (not yet implemented) are more appropriate.
*
* @version $Id$
* @author André Gosselin
* @author Martin Desruisseaux
* @author Rueben Schulz
*
* WKT (Well Know Text) or XML (not yet implemented) are more appropriate.
*
* @version $Id$
* @author Andr� Gosselin
* @author Martin Desruisseaux
* @author Rueben Schulz
*
protected final double excentricity;

/**
 * The square of excentricity: e² = (a²-b²)/a² where
 * <var>e</var> is the {@linkplain #excentricity excentricity},
 * <var>a</var> is the {@linkplain #semiMajor semi major} axis length and
 * <var>b</var> is the {@linkplain #semiMinor semi minor} axis length.
protected final double excentricity;

/**
 * The square of excentricity: e� = (a�-b�)/a� where
 * <var>e</var> is the {@linkplain #excentricity excentricity},
 * <var>a</var> is the {@linkplain #semiMajor semi major} axis length and
 * <var>b</var> is the {@linkplain #semiMinor semi minor} axis length.
/**
 * Central longitude in <u>radians</u>. Default value is 0, the Greenwich meridian.
 * This is called '<var>lambda0</var>' in Snyder.
 */
protected final double centralMeridian;

/**
 * Latitude of origin in <u>radians</u>. Default value is 0, the equator.
/**
 * Central longitude in <u>radians</u>. Default value is 0, the Greenwich meridian.
 * This is called '<var>lambda0</var>' in Snyder.
 *
 * <strong>Consider this field as final</strong>. It is not final only
 * because some classes need to modify it at construction time.
 */
protected double centralMeridian;

/**
 * Latitude of origin in <u>radians</u>. Default value is 0, the equator.
*         <ul>
*           <li>"semi_major" (mandatory: no default)</li>
*           <li>"semi_minor" (mandatory: no default)</li>
*           <li>"central_meridian"   (default to 0°)</li>
*           <li>"latitude_of_origin" (default to 0°)</li>
*           <li>"scale_factor"       (default to 1 )</li>
*           <li>"false_easting"      (default to 0 )</li>
*           <li>"false_northing"     (default to 0 )</li>
*         <ul>
*           <li>"semi_major" (mandatory: no default)</li>
*           <li>"semi_minor" (mandatory: no default)</li>
*           <li>"central_meridian"   (default to 0�)</li>
*           <li>"latitude_of_origin" (default to 0�)</li>
*           <li>"scale_factor"       (default to 1 )</li>
*           <li>"false_easting"      (default to 0 )</li>
*           <li>"false_northing"     (default to 0 )</li>
/*
 * Makes sure that the longitude before conversion stay within +/- PI radians. As a
 * special case, we do not check the range if no rotation were applied on the longitude.
 * This is because the user may have a big area ranging from -180° to +180°. With the
 * slight rounding errors related to map projections, the 180° longitude may be slightly
 * over the limit. Rolling the longitude would changes its sign. For example a bounding
 * box from 30° to +180° would become 30° to -180°, which is probably not what the user
 * wanted.
 */
ptDst = transformNormalized(centralMeridian!=0 ?
/*
 * Makes sure that the longitude before conversion stay within +/- PI radians. As a
 * special case, we do not check the range if no rotation were applied on the longitude.
 * This is because the user may have a big area ranging from -180� to +180�. With the
 * slight rounding errors related to map projections, the 180� longitude may be slightly
 * over the limit. Rolling the longitude would changes its sign. For example a bounding
 * box from 30� to +180� would become 30� to -180�, which is probably not what the user
 * wanted.
 */
ptDst = transformNormalized(centralMeridian!=0 ?
    throws ProjectionException
{
    /*
     * Vérifie s'il faudra parcourir le tableau en sens inverse.
     * Ce sera le cas si les tableaux source et destination se
     * chevauchent et que la destination est après la source.
     */
    final boolean reverse = (src==dest && srcOffset<dstOffset &&
                             srcOffset+(2*numPts) > dstOffset);
    throws ProjectionException
{
    /*
     * V�rifie s'il faudra parcourir le tableau en sens inverse.
     * Ce sera le cas si les tableaux source et destination se
     * chevauchent et que la destination est apr�s la source.
     */
    final boolean reverse = (src==dest && srcOffset<dstOffset &&
                             srcOffset+(2*numPts) > dstOffset);
/*
 * Makes sure that the longitude after conversion stay within +/- PI radians. As a
 * special case, we do not check the range if no rotation were applied on the longitude.
 * This is because the user may have a big area ranging from -180° to +180°. With the
 * slight rounding errors related to map projections, the 180° longitude may be slightly
 * over the limit. Rolling the longitude would changes its sign. For example a bounding
 * box from 30° to +180° would become 30° to -180°, which is probably not what the user
 * wanted.
 */
final double x = Math.toDegrees(centralMeridian!=0 ?
/*
 * Makes sure that the longitude after conversion stay within +/- PI radians. As a
 * special case, we do not check the range if no rotation were applied on the longitude.
 * This is because the user may have a big area ranging from -180� to +180�. With the
 * slight rounding errors related to map projections, the 180� longitude may be slightly
 * over the limit. Rolling the longitude would changes its sign. For example a bounding
 * box from 30� to +180� would become 30� to -180�, which is probably not what the user
 * wanted.
 */
final double x = Math.toDegrees(centralMeridian!=0 ?
        throws TransformException
{
    /*
     * Vérifie s'il faudra parcourir le tableau en sens inverse.
     * Ce sera le cas si les tableaux source et destination se
     * chevauchent et que la destination est après la source.
     */
    final boolean reverse = (src==dest && srcOffset<dstOffset &&
                             srcOffset+(2*numPts) > dstOffset);
        throws TransformException
{
    /*
     * V�rifie s'il faudra parcourir le tableau en sens inverse.
     * Ce sera le cas si les tableaux source et destination se
     * chevauchent et que la destination est apr�s la source.
     */
    final boolean reverse = (src==dest && srcOffset<dstOffset &&
                             srcOffset+(2*numPts) > dstOffset);
}

/**
 * Compute function <code>f(s,c,e²) = c/sqrt(1 - s²&times;e²)</code> needed for the true scale
 * latitude (Snyder 14-15), where <var>s</var> and <var>c</var> are the sine and cosine of
 * the true scale latitude, and <var>e²</var> is the {@linkplain #excentricitySquared
 * eccentricity squared}.
 */
final double msfn(final double s, final double c) {
}

/**
 * Compute function <code>f(s,c,e�) = c/sqrt(1 - s�&times;e�)</code> needed for the true scale
 * latitude (Snyder 14-15), where <var>s</var> and <var>c</var> are the sine and cosine of
 * the true scale latitude, and <var>e�</var> is the {@linkplain #excentricitySquared
 * eccentricity squared}.
 */
final double msfn(final double s, final double c) {
}

/**
 * Compute function (15-9) from Snyder equivalent to negative of function (7-7).
 */
final double tsfn(final double phi, double sinphi) {
    sinphi *= excentricity;
}

/**
 * Compute function (15-9) and (9-13) from Snyder.
 * Equivalent to negative of function (7-7).
 */
final double tsfn(final double phi, double sinphi) {
    sinphi *= excentricity;
/**
 * The operation parameter descriptor for the {@link #centralMeridian centralMeridian}
 * parameter value. Valid values range is from -180 to 180°. Default value is 0.
 */
public static final ParameterDescriptor CENTRAL_MERIDIAN = createDescriptor(
        new Identifier[] {
/**
 * The operation parameter descriptor for the {@link #centralMeridian centralMeridian}
 * parameter value. Valid values range is from -180 to 180�. Default value is 0.
 */
public static final ParameterDescriptor CENTRAL_MERIDIAN = createDescriptor(
        new Identifier[] {
    new Identifier(Citation.OPEN_GIS, "central_meridian"),
    new Identifier(Citation.EPSG,     "Longitude of natural origin"),
    new Identifier(Citation.EPSG,     "Longitude of false origin"),
    new Identifier(Citation.ESRI,     "Longitude_Of_Center"),
    new Identifier(Citation.ESRI,     "Longitude_Of_Origin"),
    new Identifier(Citation.GEOTIFF,  "NatOriginLong")
},
0, -180, 180, NonSI.DEGREE_ANGLE);
    new Identifier(Citation.OPEN_GIS, "central_meridian"),
    new Identifier(Citation.EPSG,     "Longitude of natural origin"),
    new Identifier(Citation.EPSG,     "Longitude of false origin"),
    new Identifier(Citation.ESRI,     "Longitude_Of_Origin"),
    new Identifier(Citation.ESRI,     "Longitude_Of_Center"),  //ESRI uses this in orthographic (not to be confused with Longitude_Of_Center in oblique mercator)
    new Identifier(Citation.GEOTIFF,  "NatOriginLong")
},
0, -180, 180, NonSI.DEGREE_ANGLE);
/**
 * The operation parameter descriptor for the {@link #latitudeOfOrigin latitudeOfOrigin}
 * parameter value. Valid values range is from -90 to 90°. Default value is 0.
 */
public static final ParameterDescriptor LATITUDE_OF_ORIGIN = createDescriptor(
        new Identifier[] {
/**
 * The operation parameter descriptor for the {@link #latitudeOfOrigin latitudeOfOrigin}
 * parameter value. Valid values range is from -90 to 90�. Default value is 0.
 */
public static final ParameterDescriptor LATITUDE_OF_ORIGIN = createDescriptor(
        new Identifier[] {
    new Identifier(Citation.OPEN_GIS, "latitude_of_origin"),
    new Identifier(Citation.EPSG,     "Latitude of false origin"),
    new Identifier(Citation.EPSG,     "Latitude of natural origin"),
    new Identifier(Citation.ESRI,     "Latitude_Of_Center"),
    new Identifier(Citation.GEOTIFF,  "NatOriginLat")
},
0, -90, 90, NonSI.DEGREE_ANGLE);
    new Identifier(Citation.OPEN_GIS, "latitude_of_origin"),
    new Identifier(Citation.EPSG,     "Latitude of false origin"),
    new Identifier(Citation.EPSG,     "Latitude of natural origin"),
    new Identifier(Citation.ESRI,     "Latitude_Of_Center"),  //ESRI uses this in orthographic
    new Identifier(Citation.GEOTIFF,  "NatOriginLat")
},
0, -90, 90, NonSI.DEGREE_ANGLE);
new Identifier[] {
    new Identifier(Citation.OPEN_GIS, "scale_factor"),
    new Identifier(Citation.EPSG,     "Scale factor at natural origin"),
    new Identifier(Citation.GEOTIFF,  "ScaleAtNatOrigin")
},
1, 0, Double.POSITIVE_INFINITY, Unit.ONE);
new Identifier[] {
    new Identifier(Citation.OPEN_GIS, "scale_factor"),
    new Identifier(Citation.EPSG,     "Scale factor at natural origin"),
    new Identifier(Citation.GEOTIFF,  "ScaleAtNatOrigin"),
    new Identifier(Citation.GEOTIFF,  "ScaleAtCenter")
},
1, 0, Double.POSITIVE_INFINITY, Unit.ONE);