sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1782301 - in /sis/branches/JDK8: core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ core/sis-referencing/src/main/java/org/apache/sis/ref...
Date Thu, 09 Feb 2017 09:27:36 GMT
Author: desruisseaux
Date: Thu Feb  9 09:27:36 2017
New Revision: 1782301

URL: http://svn.apache.org/viewvc?rev=1782301&view=rev
Log:
Move the TransverseMercator static methods working on UTM zone into a new enumeration: Zoner.
Still internal API for now.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -250,7 +250,7 @@ public class GeodeticObjectBuilder exten
         ArgumentChecks.ensureBetween("latitude",   Latitude.MIN_VALUE,     Latitude.MAX_VALUE,
    latitude);
         ArgumentChecks.ensureBetween("longitude", -Formulas.LONGITUDE_MAX, Formulas.LONGITUDE_MAX,
longitude);
         setConversionMethod(TransverseMercator.NAME);
-        setConversionName(TransverseMercator.setParameters(parameters, isUTM, latitude, longitude));
+        setConversionName(TransverseMercator.Zoner.UTM.setParameters(parameters, isUTM, latitude,
longitude));
         return this;
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -25,7 +25,9 @@ import org.apache.sis.parameter.Paramete
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.referencing.operation.projection.NormalizedProjection;
+import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.math.MathFunctions;
 import org.apache.sis.measure.Units;
 
@@ -49,14 +51,6 @@ public final class TransverseMercator ex
     private static final long serialVersionUID = -3386587506686432398L;
 
     /**
-     * Width of a Universal Transverse Mercator (UTM) zone, in degrees.
-     *
-     * @see #zone(double)
-     * @see #centralMeridian(int)
-     */
-    private static final double ZONE_WIDTH = 6;
-
-    /**
      * The {@value} string, which is also the EPSG name for this projection.
      */
     public static final String NAME = "Transverse Mercator";
@@ -138,79 +132,182 @@ public final class TransverseMercator ex
     }
 
     /**
-     * Sets the parameter values for a Transverse Mercator projection and returns a suggested
conversion name.
-     *
-     * <blockquote><table class="sis">
-     *   <caption>Transverse Mercator parameters</caption>
-     *   <tr><th>Parameter name</th>                 <th>Value</th></tr>
-     *   <tr><td>Latitude of natural origin</td>     <td>Given latitude,
or 0° if UTM projection</td></tr>
-     *   <tr><td>Longitude of natural origin</td>    <td>Given longitude,
optionally snapped to a UTM central meridian</td></tr>
-     *   <tr><td>Scale factor at natural origin</td> <td>0.9996</td></tr>
-     *   <tr><td>False easting</td>                  <td>500000 metres</td></tr>
-     *   <tr><td>False northing</td>                 <td>0 (North
hemisphere) or 10000000 (South hemisphere) metres</td></tr>
-     * </table></blockquote>
-     *
-     * @param  group      the parameters for which to set the values.
-     * @param  isUTM      {@code true} for Universal Transverse Mercator (UTM) projection.
-     * @param  latitude   the latitude in the center of the desired projection.
-     * @param  longitude  the longitude in the center of the desired projection.
-     * @return a name like <cite>"Transverse Mercator"</cite> or <cite>"UTM
zone 10N"</cite>,
-     *         depending on the arguments given to this method.
+     * Computes zone numbers and central meridian.
      *
-     * @since 0.7
-     */
-    public static String setParameters(final ParameterValueGroup group,
-            final boolean isUTM, double latitude, double longitude)
-    {
-        final boolean isSouth = MathFunctions.isNegative(latitude);
-        int zone = zone(longitude);
-        if (isUTM) {
-            latitude = 0;
-            longitude = centralMeridian(zone);
-        } else if (longitude != centralMeridian(zone)) {
-            zone = 0;
+     * @author  Martin Desruisseaux (Geomatys)
+     * @since   0.8
+     * @version 0.8
+     * @module
+     */
+    public static enum Zoner {
+        /**
+         * Computes zones for the Universal Transverse Mercator (UTM) projections.
+         *
+         * <blockquote><table class="sis">
+         *   <caption>Universal Transverse Mercator parameters</caption>
+         *   <tr><th>Parameter name</th>                 <th>Value</th></tr>
+         *   <tr><td>Latitude of natural origin</td>     <td>0°</td></tr>
+         *   <tr><td>Longitude of natural origin</td>    <td>Given
longitude snapped to a UTM central meridian</td></tr>
+         *   <tr><td>Scale factor at natural origin</td> <td>0.9996</td></tr>
+         *   <tr><td>False easting</td>                  <td>500000
metres</td></tr>
+         *   <tr><td>False northing</td>                 <td>0 (North
hemisphere) or 10000000 (South hemisphere) metres</td></tr>
+         * </table></blockquote>
+         */
+        UTM(Longitude.MIN_VALUE, 6, 0.9996, 500000, 10000000),
+
+        /**
+         * Computes zones for the Modified Transverse Mercator (MTM) projections.
+         * This projection is in used in Canada only.
+         *
+         * <blockquote><table class="sis">
+         *   <caption>Modified Transverse Mercator parameters</caption>
+         *   <tr><th>Parameter name</th>                 <th>Value</th></tr>
+         *   <tr><td>Latitude of natural origin</td>     <td>0°</td></tr>
+         *   <tr><td>Longitude of natural origin</td>    <td>Given
longitude snapped to a MTM central meridian</td></tr>
+         *   <tr><td>Scale factor at natural origin</td> <td>0.9999</td></tr>
+         *   <tr><td>False easting</td>                  <td>304800
metres</td></tr>
+         *   <tr><td>False northing</td>                 <td>0 metres</td></tr>
+         * </table></blockquote>
+         */
+        MTM(-51.5, -3, 0.9999, 304800, Double.NaN);
+
+        /**
+         * Longitude of the beginning of zone 1. This is the westmost longitude if {@link
#width} is positive,
+         * or the eastmost longitude if {@code width} is negative.
+         */
+        private final double origin;
+
+        /**
+         * Width of a zone, in degrees of longitude.
+         * Positive if zone numbers are increasing eastward, or negative if increasing westwards.
+         *
+         * @see #zone(double)
+         * @see #centralMeridian(int)
+         */
+        private final double width;
+
+        /**
+         * The scale factor of UTM projections.
+         */
+        private final double scale;
+
+        /**
+         * The false easting of UTM projections, in metres.
+         */
+        private final double easting;
+
+        /**
+         * The false northing in South hemisphere of UTM projection, in metres.
+         */
+        private final double northing;
+
+        /**
+         * Creates a new instance for computing zones using the given parameters.
+         */
+        private Zoner(final double origin, final double width, final double scale, final
double easting, final double northing) {
+            this.origin   = origin;
+            this.width    = width;
+            this.scale    = scale;
+            this.easting  = easting;
+            this.northing = northing;
         }
-        String name = NAME;
-        if (zone != 0) {
-            name = "UTM zone " + zone + (isSouth ? 'S' : 'N');
+
+        /**
+         * Sets the parameter values for a Transverse Mercator projection and returns a suggested
conversion name.
+         *
+         * <blockquote><table class="sis">
+         *   <caption>Transverse Mercator parameters</caption>
+         *   <tr><th>Parameter name</th>                 <th>Value</th></tr>
+         *   <tr><td>Latitude of natural origin</td>     <td>Given
latitude, or 0° if zoned projection</td></tr>
+         *   <tr><td>Longitude of natural origin</td>    <td>Given
longitude, optionally snapped to a zone central meridian</td></tr>
+         *   <tr><td>Scale factor at natural origin</td> <td>0.9996</td></tr>
+         *   <tr><td>False easting</td>                  <td>500000
metres</td></tr>
+         *   <tr><td>False northing</td>                 <td>0 (North
hemisphere) or 10000000 (South hemisphere) metres</td></tr>
+         * </table></blockquote>
+         *
+         * @param  group      the parameters for which to set the values.
+         * @param  zoned      {@code true} for snapping the given latitude/longitude to a
zone.
+         * @param  latitude   the latitude in the center of the desired projection.
+         * @param  longitude  the longitude in the center of the desired projection.
+         * @return a name like <cite>"Transverse Mercator"</cite> or <cite>"UTM
zone 10N"</cite>,
+         *         depending on the arguments given to this method.
+         */
+        public String setParameters(final ParameterValueGroup group,
+                final boolean zoned, double latitude, double longitude)
+        {
+            final boolean isSouth = MathFunctions.isNegative(latitude);
+            int zone = zone(longitude);
+            if (zoned) {
+                latitude = 0;
+                longitude = centralMeridian(zone);
+            } else if (longitude != centralMeridian(zone)) {
+                zone = 0;
+            }
+            String name = NAME;
+            if (zone != 0) {
+                name = name() + " zone " + zone + (isSouth ? 'S' : 'N');
+            }
+            group.parameter(Constants.LATITUDE_OF_ORIGIN).setValue(latitude,  Units.DEGREE);
+            group.parameter(Constants.CENTRAL_MERIDIAN)  .setValue(longitude, Units.DEGREE);
+            group.parameter(Constants.SCALE_FACTOR)      .setValue(scale,     Units.UNITY);
+            group.parameter(Constants.FALSE_EASTING)     .setValue(easting,   Units.METRE);
+            group.parameter(Constants.FALSE_NORTHING)    .setValue(isSouth ? northing : 0,
Units.METRE);
+            return name;
         }
-        group.parameter(Constants.LATITUDE_OF_ORIGIN).setValue(latitude,  Units.DEGREE);
-        group.parameter(Constants.CENTRAL_MERIDIAN)  .setValue(longitude, Units.DEGREE);
-        group.parameter(Constants.SCALE_FACTOR)      .setValue(0.9996, Units.UNITY);
-        group.parameter(Constants.FALSE_EASTING)     .setValue(500000, Units.METRE);
-        group.parameter(Constants.FALSE_NORTHING)    .setValue(isSouth ? 10000000 : 0, Units.METRE);
-        return name;
-    }
 
-    /**
-     * Computes the UTM zone from a meridian in the zone.
-     *
-     * @param  longitude  a meridian inside the desired zone, in degrees relative to Greenwich.
-     *                    Positive longitudes are toward east, and negative longitudes toward
west.
-     * @return the UTM zone number numbered from 1 to 60 inclusive, or 0 if the given central
meridian was NaN.
-     *
-     * @since 0.7
-     */
-    public static int zone(double longitude) {
-        /*
-         * Casts to int are equivalent to Math.floor(double) for positive values, which is
guaranteed
-         * to be the case here since we normalize the central meridian to the [MIN_VALUE
… MAX_VALUE] range.
-         */
-        double z = (longitude - Longitude.MIN_VALUE) / ZONE_WIDTH;                      
   // Zone number with fractional part.
-        z -= Math.floor(z / ((Longitude.MAX_VALUE - Longitude.MIN_VALUE) / ZONE_WIDTH)) 
   // Roll in the [0 … 60) range.
-                          * ((Longitude.MAX_VALUE - Longitude.MIN_VALUE) / ZONE_WIDTH);
-        return (int) (z + 1);   // Cast only after addition in order to handle NaN as documented.
-    }
+        /**
+         * If the given parameter values are those of an UTM projection, returns the zone
number (negative if South).
+         * Otherwise returns 0. It is caller's responsibility to verify that the operation
method is {@value #NAME}.
+         *
+         * @param  group  the Transverse Mercator projection parameters.
+         * @return UTM zone number (positive if North, negative if South),
+         *         or 0 if the given parameters are not for a UTM projection.
+         */
+        public int zone(final ParameterValueGroup group) {
+            if (Numerics.epsilonEqual(group.parameter(Constants.SCALE_FACTOR)      .doubleValue(Units.UNITY),
scale,   Numerics.COMPARISON_THRESHOLD) &&
+                Numerics.epsilonEqual(group.parameter(Constants.FALSE_EASTING)     .doubleValue(Units.METRE),
easting, Formulas.LINEAR_TOLERANCE) &&
+                Numerics.epsilonEqual(group.parameter(Constants.LATITUDE_OF_ORIGIN).doubleValue(Units.DEGREE),
     0, Formulas.ANGULAR_TOLERANCE))
+            {
+                double v = group.parameter(Constants.FALSE_NORTHING).doubleValue(Units.METRE);
+                final boolean isNorth = Numerics.epsilonEqual(v, 0, Formulas.LINEAR_TOLERANCE);
+                if (isNorth || Numerics.epsilonEqual(v, northing, Formulas.LINEAR_TOLERANCE))
{
+                    v = group.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(Units.DEGREE);
+                    int zone = zone(v);
+                    if (Numerics.epsilonEqual(centralMeridian(zone), v, Formulas.ANGULAR_TOLERANCE))
{
+                        if (!isNorth) zone = -zone;
+                        return zone;
+                    }
+                }
+            }
+            return 0;
+        }
 
-    /**
-     * Computes the central meridian of a given UTM zone.
-     *
-     * @param  zone  the UTM zone as a number in the [1 … 60] range.
-     * @return the central meridian of the given UTM zone.
-     *
-     * @since 0.7
-     */
-    public static double centralMeridian(final int zone) {
-        return (zone - 0.5) * ZONE_WIDTH + Longitude.MIN_VALUE;
+        /**
+         * Computes the UTM zone from a meridian in the zone.
+         *
+         * @param  longitude  a meridian inside the desired zone, in degrees relative to
Greenwich.
+         *                    Positive longitudes are toward east, and negative longitudes
toward west.
+         * @return the UTM zone number numbered from 1 to 60 inclusive, or 0 if the given
central meridian was NaN.
+         */
+        public int zone(double longitude) {
+            /*
+             * Casts to int are equivalent to Math.floor(double) for positive values, which
is guaranteed
+             * to be the case here since we normalize the central meridian to the [MIN_VALUE
… MAX_VALUE] range.
+             */
+            double z = (longitude - origin) / width;                                    
 // Zone number with fractional part.
+            z -= Math.floor(z / ((Longitude.MAX_VALUE - Longitude.MIN_VALUE) / width))  
 // Roll in the [0 … 60) range.
+                              * ((Longitude.MAX_VALUE - Longitude.MIN_VALUE) / width);
+            return (int) (z + 1);   // Cast only after addition in order to handle NaN as
documented.
+        }
+
+        /**
+         * Computes the central meridian of a given UTM zone.
+         *
+         * @param  zone  the UTM zone as a number in the [1 … 60] range.
+         * @return the central meridian of the given UTM zone.
+         */
+        public double centralMeridian(final int zone) {
+            return (zone - 0.5) * width + origin;
+        }
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractReferenceSystem.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -17,6 +17,7 @@
 package org.apache.sis.referencing;
 
 import java.util.Map;
+import java.util.Objects;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -34,9 +35,6 @@ import org.apache.sis.internal.metadata.
 import static org.apache.sis.util.Utilities.deepEquals;
 import static org.apache.sis.util.collection.Containers.property;
 
-// Branch-dependent imports
-import java.util.Objects;
-
 
 /**
  * Description of a spatial and temporal reference system used by a dataset.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -927,7 +927,7 @@ public enum CommonCRS {
         ArgumentChecks.ensureBetween("latitude",   Latitude.MIN_VALUE,     Latitude.MAX_VALUE,
    latitude);
         ArgumentChecks.ensureBetween("longitude", -Formulas.LONGITUDE_MAX, Formulas.LONGITUDE_MAX,
longitude);
         final boolean isSouth = MathFunctions.isNegative(latitude);
-        final int zone = TransverseMercator.zone(longitude);
+        final int zone = TransverseMercator.Zoner.UTM.zone(longitude);
         final Integer key = isSouth ? -zone : zone;
         ProjectedCRS crs;
         synchronized (cachedUTM) {

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -252,7 +252,7 @@ final class EPSGFactoryFallback extends
                     } else {
                         continue;
                     }
-                    return crs.UTM(latitude, TransverseMercator.centralMeridian(zone));
+                    return crs.UTM(latitude, TransverseMercator.Zoner.UTM.centralMeridian(zone));
                 }
             }
             if ((kind & (DATUM | CRS)) != 0) {

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -148,7 +148,7 @@ final class StandardDefinitions {
             throw new IllegalStateException(e);     // Should not happen with SIS implementation.
         }
         final ParameterValueGroup parameters = method.getParameters().createValue();
-        String name = TransverseMercator.setParameters(parameters, true, latitude, longitude);
+        String name = TransverseMercator.Zoner.UTM.setParameters(parameters, true, latitude,
longitude);
         final DefaultConversion conversion = new DefaultConversion(properties(0, name, null,
false), method, null, parameters);
 
         name = baseCRS.getName().getCode() + " / " + name;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -60,8 +60,7 @@ import org.apache.sis.util.resources.Err
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.iso.SimpleInternationalString;
 
-import static org.apache.sis.internal.referencing.provider.TransverseMercator.zone;
-import static org.apache.sis.internal.referencing.provider.TransverseMercator.centralMeridian;
+import static org.apache.sis.internal.referencing.provider.TransverseMercator.Zoner.UTM;
 
 
 /**
@@ -588,10 +587,10 @@ public class CommonAuthorityFactory exte
              * 42005: WGS 84 / Auto Mollweide         —   defined by "Central_Meridian"
only.
              */
             case 42001: isUTM  = true; break;
-            case 42002: isUTM  = (latitude == 0) && (centralMeridian(zone(longitude))
== longitude); break;
-            case 42003: method = "Orthographic";       param = Constants.LATITUDE_OF_ORIGIN;
        break;
-            case 42004: method = "Equirectangular";    param = Constants.STANDARD_PARALLEL_1;
       break;
-            case 42005: method = "Mollweide";                                           
            break;
+            case 42002: isUTM  = (latitude == 0) && (UTM.centralMeridian(UTM.zone(longitude))
== longitude); break;
+            case 42003: method = "Orthographic";       param = Constants.LATITUDE_OF_ORIGIN;
 break;
+            case 42004: method = "Equirectangular";    param = Constants.STANDARD_PARALLEL_1;
break;
+            case 42005: method = "Mollweide";                                           
     break;
             default: throw noSuchAuthorityCode(String.valueOf(projection), code, null);
         }
         /*

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -26,13 +26,13 @@ import static org.junit.Assert.*;
 
 
 /**
- * Tests {@link TransverseMercator} static methods.
+ * Tests {@link TransverseMercator} {@code Zoner} enumeration.
  * This class is about projection parameters only. For test about the Transverse Mercator
calculation,
  * see {@link org.apache.sis.referencing.operation.projection.TransverseMercatorTest} instead.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final strictfp class TransverseMercatorTest extends TestCase {
@@ -41,9 +41,9 @@ public final strictfp class TransverseMe
      */
     @Test
     public void testZone() {
-        assertEquals(1,  TransverseMercator.zone(-180));
-        assertEquals(10, TransverseMercator.zone(-123));
-        assertEquals(60, TransverseMercator.zone(179.9));
+        assertEquals(1,  TransverseMercator.Zoner.UTM.zone(-180));
+        assertEquals(10, TransverseMercator.Zoner.UTM.zone(-123));
+        assertEquals(60, TransverseMercator.Zoner.UTM.zone(179.9));
     }
 
     /**
@@ -51,9 +51,9 @@ public final strictfp class TransverseMe
      */
     @Test
     public void testCentralMeridian() {
-        assertEquals(-177, TransverseMercator.centralMeridian( 1), STRICT);
-        assertEquals(-123, TransverseMercator.centralMeridian(10), STRICT);
-        assertEquals( 177, TransverseMercator.centralMeridian(60), STRICT);
+        assertEquals(-177, TransverseMercator.Zoner.UTM.centralMeridian( 1), STRICT);
+        assertEquals(-123, TransverseMercator.Zoner.UTM.centralMeridian(10), STRICT);
+        assertEquals( 177, TransverseMercator.Zoner.UTM.centralMeridian(60), STRICT);
     }
 
     /**
@@ -66,15 +66,15 @@ public final strictfp class TransverseMe
     })
     public void testCreate() {
         final ParameterValueGroup p = TransverseMercator.PARAMETERS.createValue();
-        assertEquals("UTM zone 10N", TransverseMercator.setParameters(p, true, 0, -122));
+        assertEquals("UTM zone 10N", TransverseMercator.Zoner.UTM.setParameters(p, true,
0, -122));
         assertEquals(Constants.CENTRAL_MERIDIAN, -123, p.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(),
STRICT);
         assertEquals(Constants.FALSE_NORTHING, 0, p.parameter(Constants.FALSE_NORTHING).doubleValue(),
STRICT);
 
-        assertEquals("Transverse Mercator", TransverseMercator.setParameters(p, false, 0,
-122));
+        assertEquals("Transverse Mercator", TransverseMercator.Zoner.UTM.setParameters(p,
false, 0, -122));
         assertEquals(Constants.CENTRAL_MERIDIAN, -122, p.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(),
STRICT);
         assertEquals(Constants.FALSE_NORTHING, 0, p.parameter(Constants.FALSE_NORTHING).doubleValue(),
STRICT);
 
-        assertEquals("UTM zone 10S", TransverseMercator.setParameters(p, false, -0.0, -123));
+        assertEquals("UTM zone 10S", TransverseMercator.Zoner.UTM.setParameters(p, false,
-0.0, -123));
         assertEquals(Constants.CENTRAL_MERIDIAN, -123, p.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(),
STRICT);
         assertEquals(Constants.FALSE_NORTHING, 10000000, p.parameter(Constants.FALSE_NORTHING).doubleValue(),
STRICT);
     }

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1782301&r1=1782300&r2=1782301&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
[UTF-8] Thu Feb  9 09:27:36 2017
@@ -904,7 +904,7 @@ final class LandsatReader {
          */
         if (datum != null) {
             if (utmZone > 0) {
-                metadata.add(datum.UTM(1, TransverseMercator.centralMeridian(utmZone)));
+                metadata.add(datum.UTM(1, TransverseMercator.Zoner.UTM.centralMeridian(utmZone)));
             }
             if (projection != null) {
                 final double sp = projection.parameter(Constants.STANDARD_PARALLEL_1).doubleValue();



Mime
View raw message