sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1678264 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing: crs/ cs/ operation/
Date Thu, 07 May 2015 21:37:24 GMT
Author: desruisseaux
Date: Thu May  7 21:37:23 2015
New Revision: 1678264

URL: http://svn.apache.org/r1678264
Log:
Referencing: add the missing 'forConvention(AxisConvention) method in DefaultDerivedCRS and
DefaultProjectedCRS.
This required additional checks for axis order in DefaultConversion and subclasses constructors.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConicProjection.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -383,6 +383,14 @@ public class DefaultCompoundCRS extends
     }
 
     /**
+     * Should never be invoked since we override {@link AbstractCRS#forConvention(AxesConvention)}.
+     */
+    @Override
+    final AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem
cs) {
+        throw new AssertionError();
+    }
+
+    /**
      * Compares this coordinate reference system with the specified object for equality.
      *
      * @param  object The object to compare to {@code this}.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -41,6 +41,7 @@ import org.opengis.referencing.operation
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
+import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.FormattableObject;
@@ -59,7 +60,7 @@ import org.apache.sis.util.Classes;
  * <p>A {@code DerivedCRS} instance may also implement one of the interfaces listed
below,
  * provided that the conditions in the right column are meet:</p>
  *
- * <table class="ogc">
+ * <table class="sis">
  *   <caption>Derived CRS types</caption>
  *   <tr><th>Type</th>                   <th>Conditions</th></tr>
  *   <tr><td>{@link GeodeticCRS}</td>    <td>Base CRS is also a {@code
GeodeticCRS} and is associated to the same type of coordinate system.</td></tr>
@@ -68,8 +69,7 @@ import org.apache.sis.util.Classes;
  *   <tr><td>{@link EngineeringCRS}</td> <td>Base CRS is also a {@code
GeodeticCRS}, {@code ProjectedCRS} or {@code EngineeringCRS}.</td></tr>
  * </table>
  *
- * Those specialized subclasses can be inferred automatically by
- * {@link DefaultFactory#createDerivedCRS(Map, CoordinateReferenceSystem, Conversion, CoordinateSystem)}.
+ * Those specialized subclasses can be inferred automatically by the {@link #create create(…)}
static method.
  * Alternatively, users can create their own {@code DefaultDerivedCRS} subclass implementing
the desired interface.
  *
  * <div class="section">Immutability and thread safety</div>
@@ -151,6 +151,8 @@ public class DefaultDerivedCRS extends A
      *         must match the target dimension of the {@code baseToDerived} transform.
      * @throws MismatchedDimensionException if the source and target dimension of {@code
baseToDerived}
      *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     *
+     * @see #create(Map, SingleCRS, Conversion, CoordinateSystem)
      */
     public DefaultDerivedCRS(final Map<String,?>    properties,
                              final SingleCRS        baseCRS,
@@ -177,22 +179,39 @@ public class DefaultDerivedCRS extends A
     }
 
     /**
-     * Creates a {@code DefaultDerivedCRS} or one of the internal sub-classes
-     * depending on the argument type.
+     * Creates a derived CRS from a defining conversion and a type inferred from the given
arguments.
+     * This method expects the same arguments and performs the same work than the
+     * {@linkplain #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem) above
constructor},
+     * except that the {@code DerivedCRS} instance returned by this method may additionally
implement
+     * the {@link GeodeticCRS}, {@link VerticalCRS}, {@link TemporalCRS} or {@link EngineeringCRS}
interface.
+     * See the class javadoc for more information.
+     *
+     * @param  properties The properties to be given to the new derived CRS object.
+     * @param  baseCRS Coordinate reference system to base the derived CRS on.
+     * @param  conversionFromBase The conversion from the base CRS to this derived CRS.
+     * @param  derivedCS The coordinate system for the derived CRS. The number of axes
+     *         must match the target dimension of the {@code baseToDerived} transform.
+     * @return The newly created derived CRS, potentially implementing an additional CRS
interface.
+     * @throws MismatchedDimensionException if the source and target dimension of {@code
baseToDerived}
+     *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     *
+     * @see #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem)
      */
-    static DefaultDerivedCRS create(final Map<String,?>    properties,
-                                    final SingleCRS        baseCRS,
-                                    final Conversion       conversionFromBase,
-                                    final CoordinateSystem derivedCS)
+    public static DefaultDerivedCRS create(final Map<String,?>    properties,
+                                           final SingleCRS        baseCRS,
+                                           final Conversion       conversionFromBase,
+                                           final CoordinateSystem derivedCS)
             throws MismatchedDimensionException
     {
-        switch (getType(baseCRS, derivedCS)) {
-            case WKTKeywords.GeodeticCRS:    return new Geodetic   (properties, (GeodeticCRS)
baseCRS, conversionFromBase, (EllipsoidalCS) derivedCS);
-            case WKTKeywords.VerticalCRS:    return new Vertical   (properties, (VerticalCRS)
baseCRS, conversionFromBase,    (VerticalCS) derivedCS);
-            case WKTKeywords.TimeCRS:        return new Temporal   (properties, (TemporalCRS)
baseCRS, conversionFromBase,        (TimeCS) derivedCS);
-            case WKTKeywords.EngineeringCRS: return new Engineering(properties,         
     baseCRS, conversionFromBase,                 derivedCS);
-            default: return new DefaultDerivedCRS(properties, baseCRS, conversionFromBase,
derivedCS);
+        if (baseCRS != null && derivedCS != null) {
+            switch (getType(baseCRS, derivedCS)) {
+                case WKTKeywords.GeodeticCRS:    return new Geodetic   (properties, (GeodeticCRS)
baseCRS, conversionFromBase, (EllipsoidalCS) derivedCS);
+                case WKTKeywords.VerticalCRS:    return new Vertical   (properties, (VerticalCRS)
baseCRS, conversionFromBase,    (VerticalCS) derivedCS);
+                case WKTKeywords.TimeCRS:        return new Temporal   (properties, (TemporalCRS)
baseCRS, conversionFromBase,        (TimeCS) derivedCS);
+                case WKTKeywords.EngineeringCRS: return new Engineering(properties,     
         baseCRS, conversionFromBase,                 derivedCS);
+            }
         }
+        return new DefaultDerivedCRS(properties, baseCRS, conversionFromBase, derivedCS);
     }
 
     /**
@@ -280,6 +299,25 @@ public class DefaultDerivedCRS extends A
     }
 
     /**
+     * {@inheritDoc}
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public DefaultDerivedCRS forConvention(final AxesConvention convention) {
+        return (DefaultDerivedCRS) super.forConvention(convention);
+    }
+
+    /**
+     * Returns a coordinate reference system of the same type than this CRS but with different
axes.
+     */
+    @Override
+    AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem
derivedCS) {
+        final Conversion conversionFromBase = super.getConversionFromBase();
+        return new DefaultDerivedCRS(properties, (SingleCRS) conversionFromBase.getSourceCRS(),
conversionFromBase, derivedCS);
+    }
+
+    /**
      * Compares this coordinate reference system with the specified object for equality.
      *
      * @param  object The object to compare to {@code this}.
@@ -430,6 +468,13 @@ public class DefaultDerivedCRS extends A
             return (EllipsoidalCS) super.getCoordinateSystem();
         }
 
+        /** Returns a coordinate reference system of the same type than this CRS but with
different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final
CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Geodetic(properties, (GeodeticCRS) conversionFromBase.getSourceCRS(),
+                    conversionFromBase, (EllipsoidalCS) derivedCS);
+        }
+
         /** Returns the WKT keyword for this derived CRS type.*/
         @Override String keyword() {
             return WKTKeywords.GeodeticCRS;
@@ -464,6 +509,13 @@ public class DefaultDerivedCRS extends A
             return (VerticalCS) super.getCoordinateSystem();
         }
 
+        /** Returns a coordinate reference system of the same type than this CRS but with
different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final
CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Vertical(properties, (VerticalCRS) conversionFromBase.getSourceCRS(),
+                    conversionFromBase, (VerticalCS) derivedCS);
+        }
+
         /** Returns the WKT keyword for this derived CRS type.*/
         @Override String keyword() {
             return WKTKeywords.VerticalCRS;
@@ -498,6 +550,13 @@ public class DefaultDerivedCRS extends A
             return (TimeCS) super.getCoordinateSystem();
         }
 
+        /** Returns a coordinate reference system of the same type than this CRS but with
different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final
CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Temporal(properties, (TemporalCRS) conversionFromBase.getSourceCRS(),
+                    conversionFromBase, (TimeCS) derivedCS);
+        }
+
         /** Returns the WKT keyword for this derived CRS type.*/
         @Override String keyword() {
             return WKTKeywords.TimeCRS;
@@ -531,6 +590,12 @@ public class DefaultDerivedCRS extends A
             return (datum instanceof EngineeringDatum) ? (EngineeringDatum) datum : null;
         }
 
+        /** Returns a coordinate reference system of the same type than this CRS but with
different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final
CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Engineering(properties, (SingleCRS) conversionFromBase.getSourceCRS(),
conversionFromBase, derivedCS);
+        }
+
         /** Returns the WKT keyword for this derived CRS type.*/
         @Override String keyword() {
             return WKTKeywords.EngineeringCRS;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -36,6 +36,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.Projection;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
@@ -258,6 +259,25 @@ public class DefaultProjectedCRS extends
     }
 
     /**
+     * {@inheritDoc}
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public DefaultProjectedCRS forConvention(final AxesConvention convention) {
+        return (DefaultProjectedCRS) super.forConvention(convention);
+    }
+
+    /**
+     * Returns a coordinate reference system of the same type than this CRS but with different
axes.
+     */
+    @Override
+    final AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem
cs) {
+        final Projection conversion = super.getConversionFromBase();
+        return new DefaultProjectedCRS(properties, conversion.getSourceCRS(), conversion,
(CartesianCS) cs);
+    }
+
+    /**
      * Compares this coordinate reference system with the specified object for equality.
      *
      * @param  object The object to compare to {@code this}.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -209,14 +209,16 @@ public final class CoordinateSystems ext
 
     /**
      * Returns an affine transform between two coordinate systems.
-     * The two coordinate systems must implement the same GeoAPI coordinate system interface.
-     * For example if {@code sourceCRS} is a {@link org.opengis.referencing.cs.CartesianCS},
-     * then {@code targetCRS} must be a {@code CartesianCS} too.
      * Only units and axes order (e.g. transforming from
      * ({@linkplain AxisDirection#NORTH North}, {@linkplain AxisDirection#WEST West}) to
      * ({@linkplain AxisDirection#EAST East}, {@linkplain AxisDirection#NORTH North})
      * are taken in account by this method.
      *
+     * <div class="section">Conditions</div>
+     * The two coordinate systems must implement the same GeoAPI coordinate system interface.
+     * For example if {@code sourceCS} is a {@link org.opengis.referencing.cs.CartesianCS},
+     * then {@code targetCS} must be a {@code CartesianCS} too.
+     *
      * <div class="note"><b>Example:</b>
      * If coordinates in {@code sourceCS} are (<var>x</var>,<var>y</var>)
tuples in metres
      * and coordinates in {@code targetCS} are (<var>-y</var>,<var>x</var>)
tuples in centimetres,

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -23,13 +23,17 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.measure.converter.ConversionException;
+import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.quality.PositionalAccuracy;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.metadata.Identifier;
 import org.apache.sis.parameter.Parameterized;
 import org.opengis.parameter.ParameterDescriptorGroup;
@@ -43,10 +47,12 @@ import org.apache.sis.util.ComparisonMod
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.UnsupportedImplementationException;
+import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.operation.transform.PassThroughTransform;
 import org.apache.sis.internal.referencing.OperationMethods;
 import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.system.Semaphores;
@@ -169,23 +175,24 @@ public class AbstractCoordinateOperation
      */
     AbstractCoordinateOperation() {
         super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
-        sourceCRS = null;
-        targetCRS = null;
-        interpolationCRS = null;
-        operationVersion = null;
+        sourceCRS                   = null;
+        targetCRS                   = null;
+        interpolationCRS            = null;
+        operationVersion            = null;
         coordinateOperationAccuracy = null;
-        domainOfValidity = null;
-        scope = null;
-        transform = null;
+        domainOfValidity            = null;
+        scope                       = null;
+        transform                   = null;
     }
 
     /**
      * Constructs a new coordinate operation with the same values than the specified defining
conversion,
      * together with the specified source and target CRS. This constructor is used by {@link
DefaultConversion} only.
      */
-    AbstractCoordinateOperation(final CoordinateOperation       definition,
+    AbstractCoordinateOperation(final CoordinateOperation definition,
                                 final CoordinateReferenceSystem sourceCRS,
-                                final CoordinateReferenceSystem targetCRS)
+                                final CoordinateReferenceSystem targetCRS,
+                                final MathTransformFactory factory)
     {
         super(definition);
         this.sourceCRS                   = sourceCRS;
@@ -195,11 +202,50 @@ public class AbstractCoordinateOperation
         this.coordinateOperationAccuracy = definition.getCoordinateOperationAccuracy();
         this.domainOfValidity            = definition.getDomainOfValidity();
         this.scope                       = definition.getScope();
-        this.transform                   = definition.getMathTransform();
+        MathTransform mt = definition.getMathTransform();
+        mt = swapAndScaleAxes(mt, sourceCRS, definition.getSourceCRS(), true,  factory);
+        mt = swapAndScaleAxes(mt, definition.getTargetCRS(), targetCRS, false, factory);
+        transform = mt;
         checkDimensions();
     }
 
     /**
+     * Concatenates to the given transform the operation needed for swapping and scaling
the axes.
+     * The two coordinate systems must implement the same GeoAPI coordinate system interface.
+     * For example if {@code sourceCRS} uses a {@code CartesianCS}, then {@code targetCRS}
must use
+     * a {@code CartesianCS} too.
+     *
+     * @param transform The transform to which to concatenate axis changes.
+     * @param sourceCRS The first CRS of the pair for which to check for axes changes.
+     * @param targetCRS The second CRS of the pair for which to check for axes changes.
+     * @param isSource  {@code true} for pre-concatenating the changes, or {@code false}
for post-concatenating.
+     * @param factory   The factory to use if some axis changes are needed, or {@code null}
for the default.
+     */
+    private static MathTransform swapAndScaleAxes(MathTransform transform,
+            final CoordinateReferenceSystem sourceCRS,
+            final CoordinateReferenceSystem targetCRS,
+            final boolean isSource, MathTransformFactory factory)
+    {
+        if (sourceCRS != null && targetCRS != null && sourceCRS != targetCRS)
try {
+            final Matrix m = CoordinateSystems.swapAndScaleAxes(sourceCRS.getCoordinateSystem(),
+                                                                targetCRS.getCoordinateSystem());
+            if (!m.isIdentity()) {
+                if (factory == null) {
+                    factory = DefaultFactories.forBuildin(MathTransformFactory.class);
+                }
+                final MathTransform s = factory.createAffineTransform(m);
+                transform = factory.createConcatenatedTransform(isSource ? s : transform,
+                                                                isSource ? transform : s);
+            }
+        } catch (ConversionException | FactoryException e) {
+            throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2,
+                    (isSource ? "sourceCRS" : "targetCRS"),
+                    (isSource ?  sourceCRS  :  targetCRS).getName()), e);
+        }
+        return transform;
+    }
+
+    /**
      * Creates a coordinate operation from the given properties.
      * The properties given in argument follow the same rules than for the
      * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -26,6 +26,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.SingleOperation;
 import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.parameter.Parameterized;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
@@ -113,11 +114,12 @@ class AbstractSingleOperation extends Ab
      * specified source and target CRS. While the source operation can be an arbitrary one,
it is
      * typically a defining conversion.
      */
-    AbstractSingleOperation(final SingleOperation           definition,
+    AbstractSingleOperation(final SingleOperation definition,
                             final CoordinateReferenceSystem sourceCRS,
-                            final CoordinateReferenceSystem targetCRS)
+                            final CoordinateReferenceSystem targetCRS,
+                            final MathTransformFactory factory)
     {
-        super(definition, sourceCRS, targetCRS);
+        super(definition, sourceCRS, targetCRS, factory);
         method = definition.getMethod();
         parameters = (definition instanceof AbstractSingleOperation) ?
                 ((AbstractSingleOperation) definition).parameters : definition.getParameterValues();

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConicProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConicProjection.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConicProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConicProjection.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -19,6 +19,7 @@ package org.apache.sis.referencing.opera
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.ConicProjection;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
 
@@ -48,12 +49,14 @@ final class DefaultConicProjection exten
      * @param definition The defining conversion.
      * @param sourceCRS  The source CRS.
      * @param targetCRS  The target CRS.
+     * @param factory    The factory to use if some axis changes are needed, or {@code null}
for the default.
      */
-    DefaultConicProjection(final Conversion                definition,
+    DefaultConicProjection(final Conversion definition,
                            final CoordinateReferenceSystem sourceCRS,
-                           final CoordinateReferenceSystem targetCRS)
+                           final CoordinateReferenceSystem targetCRS,
+                           final MathTransformFactory factory)
     {
-        super(definition, sourceCRS, targetCRS);
+        super(definition, sourceCRS, targetCRS, factory);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -23,6 +23,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.util.ArgumentChecks;
 
 
@@ -155,12 +156,14 @@ public class DefaultConversion extends A
      * @param definition The defining conversion.
      * @param sourceCRS  The source CRS.
      * @param targetCRS  The target CRS.
+     * @param factory    The factory to use if some axis changes are needed, or {@code null}
for the default.
      */
-    DefaultConversion(final Conversion                definition,
+    DefaultConversion(final Conversion definition,
                       final CoordinateReferenceSystem sourceCRS,
-                      final CoordinateReferenceSystem targetCRS)
+                      final CoordinateReferenceSystem targetCRS,
+                      final MathTransformFactory factory)
     {
-        super(definition, sourceCRS, targetCRS);
+        super(definition, sourceCRS, targetCRS, factory);
     }
 
     /**
@@ -255,6 +258,6 @@ public class DefaultConversion extends A
         ArgumentChecks.ensureNonNull("baseType",  baseType);
         ArgumentChecks.ensureNonNull("sourceCRS", sourceCRS);
         ArgumentChecks.ensureNonNull("targetCRS", targetCRS);
-        return SubTypes.create(baseType, this, sourceCRS, targetCRS);
+        return SubTypes.create(baseType, this, sourceCRS, targetCRS, null);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -19,6 +19,7 @@ package org.apache.sis.referencing.opera
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.CylindricalProjection;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
 
@@ -48,12 +49,14 @@ final class DefaultCylindricalProjection
      * @param definition The defining conversion.
      * @param sourceCRS  The source CRS.
      * @param targetCRS  The target CRS.
+     * @param factory    The factory to use if some axis changes are needed, or {@code null}
for the default.
      */
-    DefaultCylindricalProjection(final Conversion                definition,
+    DefaultCylindricalProjection(final Conversion definition,
                                  final CoordinateReferenceSystem sourceCRS,
-                                 final CoordinateReferenceSystem targetCRS)
+                                 final CoordinateReferenceSystem targetCRS,
+                                 final MathTransformFactory factory)
     {
-        super(definition, sourceCRS, targetCRS);
+        super(definition, sourceCRS, targetCRS, factory);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPlanarProjection.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -19,6 +19,7 @@ package org.apache.sis.referencing.opera
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.PlanarProjection;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
 
@@ -48,12 +49,14 @@ final class DefaultPlanarProjection exte
      * @param definition The defining conversion.
      * @param sourceCRS  The source CRS.
      * @param targetCRS  The target CRS.
+     * @param factory    The factory to use if some axis changes are needed, or {@code null}
for the default.
      */
-    DefaultPlanarProjection(final Conversion                definition,
+    DefaultPlanarProjection(final Conversion definition,
                             final CoordinateReferenceSystem sourceCRS,
-                            final CoordinateReferenceSystem targetCRS)
+                            final CoordinateReferenceSystem targetCRS,
+                            final MathTransformFactory factory)
     {
-        super(definition, sourceCRS, targetCRS);
+        super(definition, sourceCRS, targetCRS, factory);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultProjection.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -19,6 +19,7 @@ package org.apache.sis.referencing.opera
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.Projection;
+import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -63,12 +64,14 @@ class DefaultProjection extends DefaultC
      * @param definition The defining conversion.
      * @param sourceCRS  The source CRS.
      * @param targetCRS  The target CRS.
+     * @param factory    The factory to use if some axis changes are needed, or {@code null}
for the default.
      */
-    DefaultProjection(final Conversion                definition,
+    DefaultProjection(final Conversion definition,
                       final CoordinateReferenceSystem sourceCRS,
-                      final CoordinateReferenceSystem targetCRS)
+                      final CoordinateReferenceSystem targetCRS,
+                      final MathTransformFactory factory)
     {
-        super(definition, sourceCRS, targetCRS);
+        super(definition, sourceCRS, targetCRS, factory);
         ArgumentChecks.ensureCanCast("sourceCRS", GeographicCRS.class, sourceCRS);
         ArgumentChecks.ensureCanCast("targetCRS", ProjectedCRS .class, targetCRS);
     }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java?rev=1678264&r1=1678263&r2=1678264&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
[UTF-8] Thu May  7 21:37:23 2015
@@ -119,13 +119,15 @@ final class SubTypes {
      * @param  definition The defining conversion.
      * @param  sourceCRS  The source CRS.
      * @param  targetCRS  The target CRS.
+     * @param  factory    The factory to use if some axis changes are needed, or {@code null}
for the default.
      * @return The conversion of the given type between the given CRS.
      * @throws ClassCastException if a contradiction is found between the given {@code baseType},
      *         the defining {@linkplain DefaultConversion#getInterface() conversion type}
and
      *         the {@linkplain DefaultOperationMethod#getOperationType() method operation
type}.
      */
     static <T extends Conversion> T create(final Class<T> baseType, final Conversion
definition,
-            final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS)
+            final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS,
+            final MathTransformFactory factory)
     {
         Class<? extends T> type = baseType;
         if (definition instanceof AbstractIdentifiedObject) {
@@ -143,15 +145,15 @@ final class SubTypes {
         }
         final Conversion conversion;
         if (CylindricalProjection.class.isAssignableFrom(type)) {
-            conversion = new DefaultCylindricalProjection(definition, sourceCRS, targetCRS);
+            conversion = new DefaultCylindricalProjection(definition, sourceCRS, targetCRS,
factory);
         } else if (ConicProjection.class.isAssignableFrom(type)) {
-            conversion = new DefaultConicProjection(definition, sourceCRS, targetCRS);
+            conversion = new DefaultConicProjection(definition, sourceCRS, targetCRS, factory);
         } else if (PlanarProjection.class.isAssignableFrom(type)) {
-            conversion = new DefaultPlanarProjection(definition, sourceCRS, targetCRS);
+            conversion = new DefaultPlanarProjection(definition, sourceCRS, targetCRS, factory);
         } else if (Projection.class.isAssignableFrom(type)) {
-            conversion = new DefaultProjection(definition, sourceCRS, targetCRS);
+            conversion = new DefaultProjection(definition, sourceCRS, targetCRS, factory);
         } else {
-            conversion = new DefaultConversion(definition, sourceCRS, targetCRS);
+            conversion = new DefaultConversion(definition, sourceCRS, targetCRS, factory);
         }
         return type.cast(conversion);
     }



Mime
View raw message