sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1790568 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/java/org/apache/sis/referencing/operation/transform/ main/resources/META-INF/services/ test/java/org/apache/sis/internal...
Date Fri, 07 Apr 2017 15:10:31 GMT
Author: desruisseaux
Date: Fri Apr  7 15:10:31 2017
New Revision: 1790568

URL: http://svn.apache.org/viewvc?rev=1790568&view=rev
Log:
Implement operation methods for axis order reversal (EPSG:9843 and 9844).

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java
  (with props)
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.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

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java?rev=1790568&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java
[UTF-8] Fri Apr  7 15:10:31 2017
@@ -0,0 +1,102 @@
+/*
+ * 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.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.referencing.operation.Conversion;
+import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
+import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.referencing.operation.transform.MathTransforms;
+
+
+/**
+ * The provider for <cite>"axis order reversal (2D)"</cite> (EPSG:9843).
+ * This is a trivial operation that just swap the two axes.
+ * The inverse operation is this operation itself.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ */
+@XmlTransient
+public class AxisOrderReversal extends AbstractProvider {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = -663548119085488844L;
+
+    /**
+     * The group of all parameters expected by this coordinate operation (in this case, none).
+     */
+    private static final ParameterDescriptorGroup PARAMETERS = builder()
+            .addIdentifier("9843").addName("Axis order reversal (2D)").createGroup();
+
+    /**
+     * The unique instance, created when first needed.
+     */
+    private transient MathTransform transform;
+
+    /**
+     * Constructs a provider with default parameters.
+     */
+    public AxisOrderReversal() {
+        super(2, 2, PARAMETERS);
+    }
+
+    /**
+     * For {@link AxisOrderReversal3D} subclass only.
+     *
+     * @param dimensions  number of dimensions in the source and target CRS of this operation
method.
+     * @param parameters  description of parameters expected by this operation.
+     */
+    AxisOrderReversal(final int dimensions, final ParameterDescriptorGroup parameters) {
+        super(dimensions, dimensions, parameters);
+    }
+
+    /**
+     * Returns the operation type.
+     *
+     * @return interface implemented by all coordinate operations that use this method.
+     */
+    @Override
+    public final Class<Conversion> getOperationType() {
+        return Conversion.class;
+    }
+
+    /**
+     * Returns the transform.
+     *
+     * @param  factory  ignored (can be null).
+     * @param  values   ignored.
+     * @return the math transform.
+     */
+    @Override
+    public synchronized MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
values) {
+        if (transform == null) {
+            final MatrixSIS m = Matrices.createZero(getTargetDimensions() + 1, getSourceDimensions()
+ 1);
+            m.setElement(0, 1, 1);
+            m.setElement(1, 0, 1);
+            transform = MathTransforms.linear(m);
+        }
+        return transform;
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java?rev=1790568&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java
[UTF-8] Fri Apr  7 15:10:31 2017
@@ -0,0 +1,52 @@
+/*
+ * 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.parameter.ParameterDescriptorGroup;
+
+
+/**
+ * The provider for <cite>"axis order reversal (geographic3D horizontal)"</cite>
(EPSG:9844).
+ * This is a trivial operation that just swap the two first axes.
+ * The inverse operation is this operation itself.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ */
+@XmlTransient
+public final class AxisOrderReversal3D extends AxisOrderReversal {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = 7236499637763125168L;
+
+    /**
+     * The group of all parameters expected by this coordinate operation (in this case, none).
+     */
+    private static final ParameterDescriptorGroup PARAMETERS = builder()
+            .addIdentifier("9844").addName("Axis order reversal (geographic3D horizontal)").createGroup();
+
+    /**
+     * Constructs a provider with default parameters.
+     */
+    public AxisOrderReversal3D() {
+        super(3, PARAMETERS);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AxisOrderReversal3D.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/CopyTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java?rev=1790568&r1=1790567&r2=1790568&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
[UTF-8] Fri Apr  7 15:10:31 2017
@@ -329,7 +329,7 @@ final class CopyTransform extends Abstra
      * Creates the inverse transform of this object.
      */
     @Override
-    @SuppressWarnings("DoubleCheckedLocking")  // Okay since 'inverse' is volatile.
+    @SuppressWarnings("DoubleCheckedLocking")                                   // Okay since
'inverse' is volatile.
     public LinearTransform inverse() throws NoninvertibleTransformException {
         LinearTransform inv = inverse;
         if (inv == null) {
@@ -379,8 +379,8 @@ final class CopyTransform extends Abstra
                     }
                     /*
                      * At this point, we know that we can create the inverse transform.
-                     * If this transform is the identity transform (we should never happen,
-                     * but we are paranoiac), then the old and new arrays would be equal.
+                     * If this transform is the identity transform or an anti-diagonal matrix
except last row
+                     * (e.g. matrix used for swapping axis order), then the old and new arrays
would be equal.
                      */
                     CopyTransform copyInverse = this;
                     if (!Arrays.equals(reverse, indices)) {

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=1790568&r1=1790567&r2=1790568&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] Fri Apr  7 15:10:31 2017
@@ -1,6 +1,8 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 # Heavier classes (e.g. having more dependencies) or classes less likely to be used, should
be last.
 org.apache.sis.internal.referencing.provider.Affine
+org.apache.sis.internal.referencing.provider.AxisOrderReversal
+org.apache.sis.internal.referencing.provider.AxisOrderReversal3D
 org.apache.sis.internal.referencing.provider.Geographic3Dto2D
 org.apache.sis.internal.referencing.provider.Geographic2Dto3D
 org.apache.sis.internal.referencing.provider.GeographicOffsets

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=1790568&r1=1790567&r2=1790568&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] Fri Apr  7 15:10:31 2017
@@ -53,6 +53,8 @@ public final strictfp class ProvidersTes
     private static Class<?>[] methods() {
         return new Class<?>[] {
             Affine.class,
+            AxisOrderReversal.class,
+            AxisOrderReversal3D.class,
             GeographicOffsets.class,
             GeographicOffsets2D.class,
             VerticalOffset.class,



Mime
View raw message