sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1688826 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/test/resources/META-INF/services/
Date Thu, 02 Jul 2015 13:35:13 GMT
Author: desruisseaux
Date: Thu Jul  2 13:35:12 2015
New Revision: 1688826

URL: http://svn.apache.org/r1688826
Log:
WKT 2: fixed the parsing of "Derived Engineering CRS from Geodetic CRS base" when the Geodetic
CRS is three-dimensional.
Added a TopocentricConversionMock for allowing us to run the GeoAPI tests.

Added:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java
      - copied, changed from r1688778, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
      - copied, changed from r1688778, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
    sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1688826&r1=1688825&r2=1688826&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] Thu Jul  2 13:35:12 2015
@@ -340,14 +340,14 @@ final class GeodeticObjectParser extends
             throws ParseException
     {
         CoordinateReferenceSystem crs;
-        if ((crs = parseGeodeticCRS    (FIRST, element, null )) == null &&
-            (crs = parseProjectedCRS   (FIRST, element, false)) == null &&
-            (crs = parseVerticalCRS    (FIRST, element, false)) == null &&
-            (crs = parseTimeCRS        (FIRST, element, false)) == null &&
-            (crs = parseEngineeringCRS (FIRST, element, false)) == null &&
-            (crs = parseImageCRS       (FIRST, element))        == null &&
-            (crs = parseCompoundCRS    (FIRST, element))        == null &&
-            (crs = parseFittedCS       (FIRST, element))        == null)
+        if ((crs = parseGeodeticCRS    (FIRST, element, 2, null)) == null &&
+            (crs = parseProjectedCRS   (FIRST, element, false))   == null &&
+            (crs = parseVerticalCRS    (FIRST, element, false))   == null &&
+            (crs = parseTimeCRS        (FIRST, element, false))   == null &&
+            (crs = parseEngineeringCRS (FIRST, element, false))   == null &&
+            (crs = parseImageCRS       (FIRST, element))          == null &&
+            (crs = parseCompoundCRS    (FIRST, element))          == null &&
+            (crs = parseFittedCS       (FIRST, element))          == null)
         {
             if (mandatory) {
                 throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
@@ -552,6 +552,20 @@ final class GeodeticObjectParser extends
     }
 
     /**
+     * Returns the given unit as a linear unit, or {@code null} if it is not linear.
+     */
+    private static Unit<Length> toLinear(final Unit<?> unit) {
+        return Units.isLinear(unit) ? unit.asType(Length.class) : null;
+    }
+
+    /**
+     * Returns the given unit as an angular unit, or {@code null} if it is not angular.
+     */
+    private static Unit<Angle> toAngular(final Unit<?> unit) {
+        return Units.isAngular(unit) ? unit.asType(Angle.class) : null;
+    }
+
+    /**
      * Parses an optional {@code "UNIT"} element of a known dimension.
      * This element has the following pattern:
      *
@@ -639,7 +653,13 @@ final class GeodeticObjectParser extends
         axisOrder.clear();
         final boolean is3D = (dimension >= 3);
         Map<String,Object> csProperties = null;
-        { // For keeping the 'element' variable local to this block, for reducing the risk
of accidental reuse.
+        /*
+         * Parse the CS[<type>, <dimension>] element.  This is specific to the
WKT 2 format.
+         * In principle the CS element is mandatory, but the Apache SIS parser is lenient
on
+         * this aspect:  if the CS element is not present, we will compute the same defaults
+         * than what we do for WKT 1.
+         */
+        if (!isWKT1) {
             final Element element = parent.pullElement(OPTIONAL, WKTKeywords.CS);
             if (element != null) {
                 final String expected = type;
@@ -739,6 +759,7 @@ final class GeodeticObjectParser extends
                     nx = AxisNames.GEODETIC_LONGITUDE; x = "λ";
                     ny = AxisNames.GEODETIC_LATITUDE;  y = "φ";
                     if (dimension >= 3) {
+                        direction = AxisDirection.UP;
                         z    = "h";
                         nz   = AxisNames.ELLIPSOIDAL_HEIGHT;
                         unit = SI.METRE;
@@ -1125,6 +1146,19 @@ final class GeodeticObjectParser extends
     }
 
     /**
+     * Returns the number of source dimensions of the given operation method, or 2 if unspecified.
+     */
+    private static int getSourceDimensions(final OperationMethod method) {
+        if (method != null) {
+            final Integer dimension = method.getSourceDimensions();
+            if (dimension != null) {
+                return dimension;
+            }
+        }
+        return 2;
+    }
+
+    /**
      * Parses a {@code "Method"} (WKT 2) element, followed by parameter values. The syntax
is given by
      * <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#62">WKT 2
specification §9.3</a>.
      *
@@ -1407,7 +1441,7 @@ final class GeodeticObjectParser extends
      * @return The {@code "EngineeringCRS"} element as an {@link EngineeringCRS} object.
      * @throws ParseException if the {@code "EngineeringCRS"} element can not be parsed.
      */
-    private EngineeringCRS parseEngineeringCRS(final int mode, final Element parent, final
boolean isBaseCRS)
+    private SingleCRS parseEngineeringCRS(final int mode, final Element parent, final boolean
isBaseCRS)
             throws ParseException
     {
         final Element element = parent.pullElement(mode,
@@ -1418,13 +1452,43 @@ final class GeodeticObjectParser extends
         if (element == null) {
             return null;
         }
-        final boolean          isWKT1 = element.getKeywordIndex() == 2;  // Index of "Local_CS"
above.
-        final String           name   = element.pullString("name");
-        final EngineeringDatum datum  = parseEngineeringDatum(MANDATORY, element, isWKT1);
-        final Unit<?>          unit   = parseUnit(element);
+        final boolean isWKT1 = element.getKeywordIndex() == 2;  // Index of "Local_CS" above.
+        final String  name   = element.pullString("name");
+        final Unit<?> unit   = parseUnit(element);
+        /*
+         * An EngineeringCRS can be either a "normal" one (with a non-null datum), or a DerivedCRS.
+         * In the later case, the datum is null and we have instead DerivingConversion element
from a base CRS.
+         */
+        EngineeringDatum datum    = null;
+        SingleCRS        baseCRS  = null;
+        Conversion       fromBase = null;
+        if (!isWKT1 && !isBaseCRS) {
+            fromBase = parseDerivingConversion(OPTIONAL, element, WKTKeywords.DerivingConversion,
null, null);
+            if (fromBase != null) {
+                /*
+                 * The order of base types below is arbitrary. But no matter their type,
+                 * they must be optional except the last one which should be mandatory.
+                 * The last one determines the error message to be reported if we find none.
+                 */
+                baseCRS = parseEngineeringCRS(OPTIONAL, element, true);
+                if (baseCRS == null) {
+                    baseCRS = parseGeodeticCRS(OPTIONAL, element, getSourceDimensions(fromBase.getMethod()),
WKTKeywords.ellipsoidal);
+                    if (baseCRS == null) {
+                        baseCRS = parseProjectedCRS(MANDATORY, element, true);
+                    }
+                }
+            }
+        }
+        if (baseCRS == null) {  // The most usual case.
+            datum = parseEngineeringDatum(MANDATORY, element, isWKT1);
+        }
         try {
             final CoordinateSystem cs = parseCoordinateSystem(element, null, 1, isWKT1, unit,
datum);
-            return crsFactory.createEngineeringCRS(parseMetadataAndClose(element, name, datum),
datum, cs);
+            final Map<String,?> properties = parseMetadataAndClose(element, name, datum);
+            if (baseCRS != null) {
+                return crsFactory.createDerivedCRS(properties, baseCRS, fromBase, cs);
+            }
+            return crsFactory.createEngineeringCRS(properties, datum, cs);
         } catch (FactoryException exception) {
             throw element.parseFailed(exception);
         }
@@ -1476,17 +1540,20 @@ final class GeodeticObjectParser extends
      *     GEOCCS["<name>", <datum>, <prime meridian>, <linear unit>
{,<axis> ,<axis> ,<axis>} {,<authority>}]
      * }
      *
-     * @param  mode   {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
-     * @param  parent The parent element.
-     * @param  csType The default coordinate system type, or {@code null} if unknown.
-     *                Should be non-null only when parsing a {@link GeneralDerivedCRS#getBaseCRS()}
component.
+     * @param  mode      {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}.
+     * @param  parent    The parent element.
+     * @param  dimension The minimal number of dimensions (usually 2).
+     * @param  csType    The default coordinate system type, or {@code null} if unknown.
+     *                   Should be non-null only when parsing a {@link GeneralDerivedCRS#getBaseCRS()}
component.
      * @return The {@code "GeodeticCRS"} element as a {@link GeographicCRS} or {@link GeocentricCRS}
object.
      * @throws ParseException if the {@code "GeodeticCRS"} element can not be parsed.
      *
      * @see org.apache.sis.referencing.crs.DefaultGeographicCRS#formatTo(Formatter)
      * @see org.apache.sis.referencing.crs.DefaultGeocentricCRS#formatTo(Formatter)
      */
-    private SingleCRS parseGeodeticCRS(final int mode, final Element parent, String csType)
throws ParseException {
+    private SingleCRS parseGeodeticCRS(final int mode, final Element parent, int dimension,
String csType)
+            throws ParseException
+    {
         final Element element = parent.pullElement(mode,
                 (csType != null) ? new String[] {WKTKeywords.BaseGeodCRS,    // [0]  WKT
2 in ProjectedCRS or DerivedCRS
                                                  WKTKeywords.GeogCS}         // [1]  WKT
1 in ProjectedCRS
@@ -1500,13 +1567,11 @@ final class GeodeticObjectParser extends
         final boolean     isWKT1;
         final Unit<Angle> angularUnit;
               Unit<?>     defaultUnit;
-        final int         dimension;
         switch (element.getKeywordIndex()) {
             default: {      // WKT2 element.
                 isWKT1      = false;
                 defaultUnit = parseUnit(element);
                 angularUnit = Units.isAngular(defaultUnit) ? defaultUnit.asType(Angle.class)
: NonSI.DEGREE_ANGLE;
-                dimension   = 2;
                 if (defaultUnit == null) {
                     /*
                      * A UNIT[…] is mandatory either in the CoordinateSystem as a whole
(defaultUnit != null),
@@ -1546,9 +1611,9 @@ final class GeodeticObjectParser extends
         SingleCRS     baseCRS  = null;
         Conversion    fromBase = null;
         if (!isWKT1 && csType == null) {
-            fromBase = parseDerivingConversion(OPTIONAL, element, WKTKeywords.DerivingConversion,
null, angularUnit);
+            fromBase = parseDerivingConversion(OPTIONAL, element, WKTKeywords.DerivingConversion,
toLinear(defaultUnit), angularUnit);
             if (fromBase != null) {
-                baseCRS = parseGeodeticCRS(MANDATORY, element, WKTKeywords.ellipsoidal);
+                baseCRS = parseGeodeticCRS(MANDATORY, element, getSourceDimensions(fromBase.getMethod()),
WKTKeywords.ellipsoidal);
             }
         }
         if (baseCRS == null) {
@@ -1621,9 +1686,7 @@ final class GeodeticObjectParser extends
         SingleCRS     baseCRS  = null;
         Conversion    fromBase = null;
         if (!isWKT1 && !isBaseCRS) {
-            @SuppressWarnings("unchecked")
-            final Unit<Length> linearUnit = Units.isLinear(unit) ? (Unit<Length>)
unit : null;
-            fromBase = parseDerivingConversion(OPTIONAL, element, WKTKeywords.DerivingConversion,
linearUnit, null);
+            fromBase = parseDerivingConversion(OPTIONAL, element, WKTKeywords.DerivingConversion,
toLinear(unit), null);
             if (fromBase != null) {
                 baseCRS = parseVerticalCRS(MANDATORY, element, true);
             }
@@ -1747,7 +1810,7 @@ final class GeodeticObjectParser extends
         }
         final boolean   isWKT1 = element.getKeywordIndex() == 2;  // Index of "ProjCS" above.
         final String    name   = element.pullString("name");
-        final SingleCRS geoCRS = parseGeodeticCRS(MANDATORY, element, WKTKeywords.ellipsoidal);
+        final SingleCRS geoCRS = parseGeodeticCRS(MANDATORY, element, 2, WKTKeywords.ellipsoidal);
         if (!(geoCRS instanceof GeographicCRS)) {
             throw new LocalizedParseException(errorLocale, Errors.Keys.IllegalCRSType_1,
                     new Object[] {geoCRS.getClass()}, element.offset);

Copied: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java
(from r1688778, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java?p2=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java&r1=1688778&r2=1688826&rev=1688826&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java
[UTF-8] Thu Jul  2 13:35:12 2015
@@ -16,24 +16,21 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
-import javax.measure.unit.NonSI;
-import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
-import org.apache.sis.parameter.ParameterBuilder;
 
 
 /**
- * The provider for <cite>"Pole rotation"</cite> conversion.
+ * Base class of mock provider for coordinate operations not yet implemented in Apache SIS.
+ * This is used for operations needed for executing some Well Known Text (WKT) parsing tests
+ * in the {@link org.apache.sis.io.wkt.WKTParserTest} class, without doing any real coordinate
+ * operations with the parsed objects.
  *
- * This conversion is not yet implemented in Apache SIS, but we need to at least accept the
parameters
- * for a Well Known Text (WKT) parsing test in the {@link org.apache.sis.io.wkt.WKTParserTest}
class.
- *
- * <p>This class may be promoted to a real operation if we implement the formulas in
a future Apache SIS version.</p>
+ * <p>Subclasses may be promoted to a real operation if we implement their formulas
in a future Apache SIS version.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
@@ -41,26 +38,15 @@ import org.apache.sis.parameter.Paramete
  * @module
  */
 @SuppressWarnings("serial")
-public final strictfp class PoleRotationMock extends AbstractProvider {
-    /**
-     * The group of all parameters expected by this coordinate operation.
-     */
-    private static final ParameterDescriptorGroup PARAMETERS;
-    static {
-        final ParameterBuilder builder = new ParameterBuilder().setRequired(true);
-        final ParameterDescriptor<?>[] parameters = {
-            createLatitude (builder.addName("Latitude of rotated pole"), true),
-            createLongitude(builder.addName("Longitude of rotated pole")),
-                            builder.addName("Axis rotation").create(Double.NaN, NonSI.DEGREE_ANGLE)
-        };
-        PARAMETERS = builder.addName("Pole rotation").createGroup(parameters);
-    }
-
+abstract strictfp class MockProvider extends AbstractProvider {
     /**
-     * Creates a new <cite>"Pole rotation"</cite> operation method.
+     * Creates a new mock provider.
      */
-    public PoleRotationMock() {
-        super(2, 2, PARAMETERS);
+    MockProvider(final int sourceDimension,
+                 final int targetDimension,
+                 final ParameterDescriptorGroup parameters)
+    {
+        super(sourceDimension, targetDimension, parameters);
     }
 
     /**
@@ -71,18 +57,14 @@ public final strictfp class PoleRotation
      * @return A dummy math transform.
      */
     @Override
-    public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
parameters) {
-        return new Unimplemented();
-    }
-
-    /**
-     * Dummy value returned by {@link PoleRotationMock#createMathTransform(MathTransformFactory,
ParameterValueGroup)}.
-     */
-    private static final class Unimplemented extends AbstractMathTransform {
-        @Override public int getSourceDimensions() {return 2;}
-        @Override public int getTargetDimensions() {return 2;}
-        @Override public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int
dstOff, boolean derivate) {
-            throw new UnsupportedOperationException();
-        }
+    public final MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
parameters) {
+        return new AbstractMathTransform() {
+            @Override public int getSourceDimensions() {return MockProvider.this.getSourceDimensions();}
+            @Override public int getTargetDimensions() {return MockProvider.this.getTargetDimensions();}
+            @Override
+            public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff,
boolean derivate) {
+                throw new UnsupportedOperationException();
+            }
+        };
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java?rev=1688826&r1=1688825&r2=1688826&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
[UTF-8] Thu Jul  2 13:35:12 2015
@@ -19,11 +19,6 @@ package org.apache.sis.internal.referenc
 import javax.measure.unit.NonSI;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.referencing.operation.Matrix;
-import org.opengis.referencing.operation.MathTransform;
-import org.opengis.referencing.operation.MathTransformFactory;
-import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
 import org.apache.sis.parameter.ParameterBuilder;
 
 
@@ -41,7 +36,7 @@ import org.apache.sis.parameter.Paramete
  * @module
  */
 @SuppressWarnings("serial")
-public final strictfp class PoleRotationMock extends AbstractProvider {
+public final strictfp class PoleRotationMock extends MockProvider {
     /**
      * The group of all parameters expected by this coordinate operation.
      */
@@ -62,27 +57,4 @@ public final strictfp class PoleRotation
     public PoleRotationMock() {
         super(2, 2, PARAMETERS);
     }
-
-    /**
-     * Not yet supported.
-     *
-     * @param  factory    Ignored.
-     * @param  parameters Ignored.
-     * @return A dummy math transform.
-     */
-    @Override
-    public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
parameters) {
-        return new Unimplemented();
-    }
-
-    /**
-     * Dummy value returned by {@link PoleRotationMock#createMathTransform(MathTransformFactory,
ParameterValueGroup)}.
-     */
-    private static final class Unimplemented extends AbstractMathTransform {
-        @Override public int getSourceDimensions() {return 2;}
-        @Override public int getTargetDimensions() {return 2;}
-        @Override public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int
dstOff, boolean derivate) {
-            throw new UnsupportedOperationException();
-        }
-    }
 }

Copied: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
(from r1688778, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java?p2=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java&r1=1688778&r2=1688826&rev=1688826&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
[UTF-8] Thu Jul  2 13:35:12 2015
@@ -16,19 +16,14 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
-import javax.measure.unit.NonSI;
+import javax.measure.unit.SI;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.referencing.operation.Matrix;
-import org.opengis.referencing.operation.MathTransform;
-import org.opengis.referencing.operation.MathTransformFactory;
-import org.apache.sis.referencing.operation.transform.AbstractMathTransform;
 import org.apache.sis.parameter.ParameterBuilder;
 
 
 /**
- * The provider for <cite>"Pole rotation"</cite> conversion.
+ * The provider for <cite>"Geographic/topocentric conversions"</cite> conversion
(EPSG:9837).
  *
  * This conversion is not yet implemented in Apache SIS, but we need to at least accept the
parameters
  * for a Well Known Text (WKT) parsing test in the {@link org.apache.sis.io.wkt.WKTParserTest}
class.
@@ -41,48 +36,28 @@ import org.apache.sis.parameter.Paramete
  * @module
  */
 @SuppressWarnings("serial")
-public final strictfp class PoleRotationMock extends AbstractProvider {
+public final strictfp class TopocentricConversionMock extends MockProvider {
     /**
      * The group of all parameters expected by this coordinate operation.
      */
     private static final ParameterDescriptorGroup PARAMETERS;
     static {
-        final ParameterBuilder builder = new ParameterBuilder().setRequired(true);
+        final ParameterBuilder builder = builder();
         final ParameterDescriptor<?>[] parameters = {
-            createLatitude (builder.addName("Latitude of rotated pole"), true),
-            createLongitude(builder.addName("Longitude of rotated pole")),
-                            builder.addName("Axis rotation").create(Double.NaN, NonSI.DEGREE_ANGLE)
+            createLatitude (builder.addIdentifier("8834").addName("Latitude of topocentric
origin"), true),
+            createLongitude(builder.addIdentifier("8835").addName("Longitude of topocentric
origin")),
+                            builder.addIdentifier("8836").addName("Ellipsoidal height of
topocentric origin").create(Double.NaN, SI.METRE)
         };
-        PARAMETERS = builder.addName("Pole rotation").createGroup(parameters);
+        PARAMETERS = builder
+                .addIdentifier("9837")
+                .addName("Geographic/topocentric conversions")
+                .createGroup(parameters);
     }
 
     /**
      * Creates a new <cite>"Pole rotation"</cite> operation method.
      */
-    public PoleRotationMock() {
-        super(2, 2, PARAMETERS);
-    }
-
-    /**
-     * Not yet supported.
-     *
-     * @param  factory    Ignored.
-     * @param  parameters Ignored.
-     * @return A dummy math transform.
-     */
-    @Override
-    public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
parameters) {
-        return new Unimplemented();
-    }
-
-    /**
-     * Dummy value returned by {@link PoleRotationMock#createMathTransform(MathTransformFactory,
ParameterValueGroup)}.
-     */
-    private static final class Unimplemented extends AbstractMathTransform {
-        @Override public int getSourceDimensions() {return 2;}
-        @Override public int getTargetDimensions() {return 2;}
-        @Override public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int
dstOff, boolean derivate) {
-            throw new UnsupportedOperationException();
-        }
+    public TopocentricConversionMock() {
+        super(3, 3, PARAMETERS);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1688826&r1=1688825&r2=1688826&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] Thu Jul  2 13:35:12 2015
@@ -1,2 +1,3 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 org.apache.sis.internal.referencing.provider.PoleRotationMock
+org.apache.sis.internal.referencing.provider.TopocentricConversionMock



Mime
View raw message