Author: desruisseaux
Date: Wed Feb 8 12:49:26 2017
New Revision: 1782155
URL: http://svn.apache.org/viewvc?rev=1782155&view=rev
Log:
Implement Transverse Mercator Zoned Grid System (EPSG:9824)
https://issues.apache.org/jira/browse/SIS-220
Added:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java
(with props)
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
(with props)
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java
(with props)
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
Added:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java?rev=1782155&view=auto
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java
(added)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing.provider;
+
+import javax.xml.bind.annotation.XmlTransient;
+import org.opengis.util.FactoryException;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterNotFoundException;
+import org.opengis.referencing.operation.Projection;
+import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
+import org.apache.sis.measure.Units;
+import org.apache.sis.measure.Longitude;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.parameter.ParameterBuilder;
+import org.apache.sis.referencing.operation.projection.ZonedGridSystem;
+
+
+/**
+ * The provider for <cite>"Transverse Mercator Zoned Grid System"</cite>
projection (EPSG:9824).
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+@XmlTransient
+public final class ZonedTransverseMercator extends AbstractProvider {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 4555131921419380461L;
+
+ /**
+ * The operation parameter descriptor for the <cite>Initial
longitude</cite> (λ₁) parameter value.
+ */
+ public static final ParameterDescriptor<Double> INITIAL_LONGITUDE;
+
+ /**
+ * The operation parameter descriptor for the <cite>Zone width</cite> (W)
parameter value.
+ */
+ public static final ParameterDescriptor<Double> ZONE_WIDTH;
+
+ /**
+ * The group of all parameters expected by this coordinate operation.
+ */
+ static final ParameterDescriptorGroup PARAMETERS;
+ static {
+ final ParameterBuilder builder = builder();
+ INITIAL_LONGITUDE = builder.addIdentifier("8830").addName("Initial
longitude")
+ .createBounded(Longitude.MIN_VALUE, Longitude.MAX_VALUE,
Longitude.MIN_VALUE, Units.DEGREE);
+
+ ZONE_WIDTH = builder.addIdentifier("8831").addName("Zone width")
+ .createStrictlyPositive(6, Units.DEGREE);
+
+ PARAMETERS = builder
+ .addIdentifier("9824")
+ .addName("Transverse Mercator Zoned Grid System")
+ .createGroupForMapProjection(
+ TransverseMercator.LATITUDE_OF_ORIGIN,
+ INITIAL_LONGITUDE,
+ ZONE_WIDTH,
+ TransverseMercator.SCALE_FACTOR,
+ TransverseMercator.FALSE_EASTING,
+ TransverseMercator.FALSE_NORTHING);
+ }
+
+ /**
+ * Constructs a new provider.
+ */
+ public ZonedTransverseMercator() {
+ super(2, 2, PARAMETERS);
+ }
+
+ /**
+ * Returns the operation type for this projection. We do not classify this
operation as a cylindrical projection
+ * for now because of the discontinuities between zones. But we may
revisit that choice in any future SIS version.
+ *
+ * @return {@code Projection.class} or a sub-type.
+ */
+ @Override
+ public Class<? extends Projection> getOperationType() {
+ return Projection.class;
+ }
+
+ /**
+ * Creates a map projection from the specified group of parameter values.
+ *
+ * @param factory the factory to use for creating and concatenating
the (de)normalization transforms.
+ * @param parameters the group of parameter values.
+ * @return the map projection created from the given parameter values.
+ * @throws ParameterNotFoundException if a required parameter was not
found.
+ * @throws FactoryException if the map projection can not be created.
+ */
+ @Override
+ public final MathTransform createMathTransform(final MathTransformFactory
factory, final ParameterValueGroup parameters)
+ throws ParameterNotFoundException, FactoryException
+ {
+ return new ZonedGridSystem(this, Parameters.castOrWrap(parameters),
factory);
+ }
+}
Propchange:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ZonedTransverseMercator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -720,8 +720,7 @@ public abstract class NormalizedProjecti
/**
* Default constructor.
*/
- public Inverse() {
- NormalizedProjection.this.super();
+ Inverse() {
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -107,7 +107,6 @@ public class TransverseMercator extends
* Work around for RFE #4093999 in Sun's bug database
* ("Relax constraint on placement of this()/super() call in
constructors").
*/
- @SuppressWarnings("fallthrough")
@Workaround(library="JDK", version="1.7")
private static Initializer initializer(final OperationMethod method, final
Parameters parameters) {
final boolean isSouth = identMatch(method, "(?i).*\\bSouth\\b.*",
TransverseMercatorSouth.IDENTIFIER);
@@ -126,11 +125,10 @@ public class TransverseMercator extends
}
/**
- * Work around for RFE #4093999 in Sun's bug database
- * ("Relax constraint on placement of this()/super() call in
constructors").
+ * Creates a new Transverse Mercator projection from the given initializer.
+ * This constructor is used also by {@link ZonedGridSystem}.
*/
- @Workaround(library="JDK", version="1.7")
- private TransverseMercator(final Initializer initializer) {
+ TransverseMercator(final Initializer initializer) {
super(initializer);
final double φ0 =
toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
/*
@@ -185,7 +183,7 @@ public class TransverseMercator extends
*
* Denormalization
* - Scale x and y by B.
- * - Subtract M0 to the northing.
+ * - Subtract M₀ to the northing.
* - Multiply by the scale factor (done by the super-class
constructor).
* - Add false easting and false northing (done by the super-class
constructor).
*/
Added:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java?rev=1782155&view=auto
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
(added)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.operation.projection;
+
+import java.util.EnumMap;
+import java.io.Serializable;
+import org.opengis.util.FactoryException;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.TransformException;
+import org.opengis.referencing.operation.Matrix;
+import org.opengis.referencing.operation.MathTransform2D;
+import org.opengis.referencing.operation.MathTransformFactory;
+import org.opengis.referencing.operation.NoninvertibleTransformException;
+import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
+import org.apache.sis.referencing.operation.transform.AbstractMathTransform2D;
+import org.apache.sis.referencing.operation.transform.ContextualParameters;
+import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.measure.Longitude;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.internal.util.Numerics;
+
+import static java.lang.Math.floor;
+import static
org.apache.sis.internal.referencing.provider.TransverseMercator.*;
+import static
org.apache.sis.internal.referencing.provider.ZonedTransverseMercator.*;
+import org.opengis.parameter.ParameterValueGroup;
+
+
+/**
+ * <cite>Transverse Mercator Zoned Grid System</cite> projection (EPSG codes
9824).
+ * This projection is valid for all the world in a given hemisphere, except
the poles.
+ * The Earth is divided into zones, usually 6° width. The zone number is
determined
+ * automatically from the longitude and is prefixed to the Easting value.
+ *
+ * <p>This map projection is not suitable for geometric calculations like
distances and angles,
+ * since there is discontinuities (gaps) between zones. Actually this
operation is not handled
+ * as a map projection by Apache SIS, as can been seen from the different
class hierarchy.</p>
+ *
+ * <div class="note"><b>Note:</b>
+ * current implementation can only be backed by the Transverse Mercator
projection,
+ * but future versions could apply to some other projections if needed.</div>
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+public class ZonedGridSystem extends AbstractMathTransform2D implements
Serializable {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = -7219325241026170925L;
+
+ /**
+ * The 360° range of longitude values.
+ */
+ private static final double RANGE = Longitude.MAX_VALUE -
Longitude.MIN_VALUE;
+
+ /**
+ * The zone multiplication factor for encoding the zone in the easting.
+ * This scale factor assumes that the projection results are in metres.
+ */
+ private static final double ZONE_SCALE = 1E6;
+
+ /**
+ * Westernmost longitude of the first zone.
+ */
+ final double initialLongitude;
+
+ /**
+ * Width of each Transverse Mercator zone, in the same units than
longitude values.
+ * This is usually 6°.
+ */
+ final double zoneWidth;
+
+ /**
+ * The projection that performs the actual work before we add the zone
number.
+ */
+ final AbstractMathTransform projection;
+
+ /**
+ * The inverse of this map projection.
+ */
+ private final MathTransform2D inverse;
+
+ /**
+ * Creates a Zoned Grid System from the given parameters.
+ * The {@code method} argument can be the description of one of the
following:
+ *
+ * <ul>
+ * <li><cite>"Transverse Mercator Zoned Grid System"</cite>.</li>
+ * </ul>
+ *
+ * Contrarily to other map projections in this package, there is no {@code
createMapProjection(MathTransformFactory)}
+ * method in this class. Instead, the factory must be specified at this
{@code ZonedGridSystem} construction time.
+ *
+ * @param method description of the projection parameters.
+ * @param parameters the parameter values of the projection to create.
+ * @param factory the factory to use for creating the transform.
+ * @throws FactoryException if an error occurred while creating a
transform.
+ */
+ public ZonedGridSystem(final OperationMethod method, final Parameters
parameters, final MathTransformFactory factory)
+ throws FactoryException
+ {
+ final EnumMap<NormalizedProjection.ParameterRole,
ParameterDescriptor<Double>> roles =
+ new EnumMap<>(NormalizedProjection.ParameterRole.class);
+ roles.put(NormalizedProjection.ParameterRole.SCALE_FACTOR,
SCALE_FACTOR);
+ roles.put(NormalizedProjection.ParameterRole.FALSE_EASTING,
FALSE_EASTING);
+ roles.put(NormalizedProjection.ParameterRole.FALSE_NORTHING,
FALSE_NORTHING);
+ final Initializer initializer = new Initializer(method, parameters,
roles, (byte) 0);
+ initialLongitude = initializer.getAndStore(INITIAL_LONGITUDE);
+ zoneWidth = initializer.getAndStore(ZONE_WIDTH);
+ final MatrixSIS normalize =
initializer.context.getMatrix(ContextualParameters.MatrixRole.NORMALIZATION);
+ normalize.convertBefore(0, null, zoneWidth / -2);
+ projection = (AbstractMathTransform) new
TransverseMercator(initializer).createMapProjection(factory);
+ inverse = new Inverse();
+ }
+
+
+ /**
+ * Returns the parameter values of this zoned grid system projection.
+ *
+ * @return the internal parameter values for this zoned grid system
projection.
+ */
+ @Override
+ public ParameterValueGroup getParameterValues() {
+ return projection.getParameterValues();
+ }
+
+ /**
+ * Converts the specified (λ,φ) coordinate and stores the result in {@code
dstPts}.
+ * In addition, opportunistically computes the projection derivative if
{@code derivate} is {@code true}.
+ * Note that the derivative does not contain zone prefix.
+ *
+ * @return the matrix of the projection derivative at the given source
position,
+ * or {@code null} if the {@code derivate} argument is {@code
false}.
+ * @throws TransformException if the coordinate can not be converted.
+ */
+ @Override
+ public Matrix transform(final double[] srcPts, final int srcOff,
+ final double[] dstPts, final int dstOff,
+ final boolean derivate) throws TransformException
+ {
+ double λ = srcPts[srcOff] - initialLongitude;
+ double φ = srcPts[srcOff+1];
+ λ -= RANGE * floor(λ / RANGE);
+ final double zone = floor(λ / zoneWidth);
+ λ -= (zone * zoneWidth);
+ dstPts[dstOff ] = λ;
+ dstPts[dstOff+1] = φ;
+ final Matrix derivative = projection.transform(dstPts, dstOff, dstPts,
dstOff, derivate);
+ dstPts[dstOff] += (zone + 1) * ZONE_SCALE;
+ return derivative;
+ }
+
+ /**
+ * Returns the inverse of this map projection.
+ *
+ * @return the inverse of this map projection.
+ */
+ @Override
+ public MathTransform2D inverse() {
+ return inverse;
+ }
+
+ /**
+ * Inverse of a zoned grid system.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+ private final class Inverse extends AbstractMathTransform2D.Inverse {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 1900563285661407519L;
+
+ /**
+ * The projection that performs the actual work after we removed the
zone number.
+ */
+ private final AbstractMathTransform inverseProjection;
+
+ /**
+ * Default constructor.
+ */
+ Inverse() throws FactoryException {
+ try {
+ inverseProjection = (AbstractMathTransform)
projection.inverse();
+ } catch (NoninvertibleTransformException e) {
+ throw new FactoryException(e); // Should not
happen.
+ }
+ }
+
+ /**
+ * Inverse transforms the specified {@code srcPts} and stores the
result in {@code dstPts}.
+ * If the derivative has been requested, then this method will
delegate the derivative
+ * calculation to the enclosing class and inverts the resulting matrix.
+ */
+ @Override
+ public Matrix transform(final double[] srcPts, final int srcOff,
+ final double[] dstPts, final int dstOff,
+ final boolean derivate) throws
TransformException
+ {
+ double x = srcPts[srcOff ];
+ double y = srcPts[srcOff+1];
+ double zone = floor(x / ZONE_SCALE) - 1;
+ x -= (zone + 1) * ZONE_SCALE;
+ dstPts[dstOff ] = x;
+ dstPts[dstOff+1] = y;
+ final Matrix derivative = inverseProjection.transform(dstPts,
dstOff, dstPts, dstOff, derivate);
+ dstPts[dstOff] += zone * zoneWidth + initialLongitude;
+ return derivative;
+ }
+ }
+
+ /**
+ * Computes a hash code value for this {@code ZonedGridSystem}.
+ *
+ * @return the hash code value.
+ */
+ @Override
+ protected int computeHashCode() {
+ final long c = Double.doubleToLongBits(initialLongitude) +
31*Double.doubleToLongBits(zoneWidth);
+ return (super.computeHashCode() ^ Numerics.hashCode(c)) + 37 *
projection.hashCode();
+ }
+
+ /**
+ * Compares the given object with this transform for equivalence.
+ * If this method returns {@code true}, then for any given identical
source position,
+ * the two compared map projections shall compute the same target position.
+ *
+ * @param object the object to compare with this map projection for
equivalence.
+ * @param mode the strictness level of the comparison. Default to
{@link ComparisonMode#STRICT}.
+ * @return {@code true} if the given object is equivalent to this map
projection.
+ */
+ @Override
+ public boolean equals(final Object object, final ComparisonMode mode) {
+ if (object == this) {
+ return true;
+ }
+ if (super.equals(object, mode)) {
+ final ZonedGridSystem that = (ZonedGridSystem) object;
+ return Numerics.equals(initialLongitude, that.initialLongitude) &&
+ Numerics.equals(zoneWidth, that.zoneWidth) &&
+ projection.equals(that.projection, mode);
+ }
+ return false;
+ }
+}
Propchange:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ZonedGridSystem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -176,7 +176,6 @@ public abstract class AbstractMathTransf
* Constructs an inverse math transform.
*/
protected Inverse() {
- AbstractMathTransform1D.this.super();
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -339,7 +339,6 @@ public abstract class AbstractMathTransf
* Constructs an inverse math transform.
*/
protected Inverse() {
- AbstractMathTransform2D.this.super();
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -43,6 +43,7 @@ org.apache.sis.internal.referencing.prov
org.apache.sis.internal.referencing.provider.PolarStereographicNorth
org.apache.sis.internal.referencing.provider.PolarStereographicSouth
org.apache.sis.internal.referencing.provider.ObliqueStereographic
+org.apache.sis.internal.referencing.provider.ZonedTransverseMercator
org.apache.sis.internal.referencing.provider.NTv2
org.apache.sis.internal.referencing.provider.NADCON
org.apache.sis.internal.referencing.provider.FranceGeocentricInterpolation
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -95,6 +95,7 @@ public final strictfp class ProvidersTes
PolarStereographicNorth.class,
PolarStereographicSouth.class,
ObliqueStereographic.class,
+ ZonedTransverseMercator.class,
NTv2.class,
NADCON.class,
FranceGeocentricInterpolation.class,
Added:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java?rev=1782155&view=auto
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java
(added)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.operation.projection;
+
+import org.opengis.util.FactoryException;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.referencing.operation.TransformException;
+import org.apache.sis.referencing.operation.transform.MathTransformFactoryMock;
+import org.apache.sis.internal.referencing.provider.ZonedTransverseMercator;
+import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.parameter.Parameterized;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.measure.Units;
+import org.apache.sis.test.DependsOn;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link ZonedGridSystem} class.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.8
+ * @version 0.8
+ * @module
+ */
+@DependsOn(TransverseMercatorTest.class)
+public final strictfp class ZonedGridSystemTest extends MapProjectionTestCase {
+ /**
+ * Creates a new instance of {@link ZonedGridSystem}.
+ *
+ * @param ellipse {@code false} for a sphere, or {@code true} for WGS84
ellipsoid.
+ */
+ private void createProjection(final boolean ellipse) throws
FactoryException {
+ final ZonedTransverseMercator method = new ZonedTransverseMercator();
+ final Parameters values = parameters(method, ellipse);
+ values.parameter(Constants.SCALE_FACTOR) .setValue(0.9996, Units.UNITY
);
+ values.parameter(Constants.FALSE_EASTING).setValue(500000, Units.METRE
);
+ values.parameter("Initial longitude") .setValue( -180,
Units.DEGREE);
+ values.parameter("Zone width") .setValue( 6,
Units.DEGREE);
+ transform = new
MathTransformFactoryMock(method).createParameterizedTransform(values);
+ tolerance = Formulas.LINEAR_TOLERANCE;
+ validate();
+ }
+
+ /**
+ * Tests converting a point using the <cite>Transverse Mercator Zoned Grid
System</cite> projection.
+ *
+ * @throws FactoryException if an error occurred while creating the map
projection.
+ * @throws TransformException if an error occurred while transforming a
coordinate.
+ */
+ @Test
+ public void testUTM() throws FactoryException, TransformException {
+ createProjection(true);
+ /*
+ * Verify parameters.
+ */
+ final ParameterValueGroup values = ((Parameterized)
transform).getParameterValues();
+ assertEquals(0.9996, values.parameter(Constants.SCALE_FACTOR)
.doubleValue(Units.UNITY ), 0);
+ assertEquals(500000,
values.parameter(Constants.FALSE_EASTING).doubleValue(Units.METRE ), 0);
+ assertEquals( -180, values.parameter("Initial longitude")
.doubleValue(Units.DEGREE), 0);
+ assertEquals( 6, values.parameter("Zone width")
.doubleValue(Units.DEGREE), 0);
+ /*
+ * Tests projection of CN Tower coordinate, which is in UTM zone 17.
+ */
+ verifyTransform(new double[] {
+ -79 - (23 - 13.70/60)/60, // 79°23′13.70″W
+ 43 + (38 + 33.24/60)/60 // 43°38′33.24″N
+ }, new double[] {
+ 17630698.19, 4833450.51
+ });
+ }
+}
Propchange:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ZonedGridSystemTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1782155&r1=1782154&r2=1782155&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Wed Feb 8 12:49:26 2017
@@ -162,6 +162,7 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.projection.MercatorTest.class,
org.apache.sis.referencing.operation.projection.LambertConicConformalTest.class,
org.apache.sis.referencing.operation.projection.TransverseMercatorTest.class,
+ org.apache.sis.referencing.operation.projection.ZonedGridSystemTest.class,
org.apache.sis.referencing.operation.projection.PolarStereographicTest.class,
org.apache.sis.referencing.operation.projection.ObliqueStereographicTest.class,
org.apache.sis.referencing.operation.projection.CylindricalEqualAreaTest.class,