Author: desruisseaux
Date: Fri Jun 6 21:12:13 2014
New Revision: 1601013
URL: http://svn.apache.org/r1601013
Log:
Merge from the JDK6 branch.
Added:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
- copied unchanged from r1601002,
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
- copied unchanged from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
- copied unchanged from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
- copied, changed from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
- copied unchanged from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
- copied, changed from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
- copied, changed from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
- copied, changed from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
Modified:
sis/trunk/ (props changed)
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
(contents, props changed)
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1600775-1600997
Merged /sis/branches/JDK7:r1600776-1600999
Merged /sis/branches/JDK6:r1600778-1601002
Modified:
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] (original)
+++
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -144,7 +144,7 @@ public abstract class AbstractFeature im
* }
*
* <div class="note"><b>Note:</b> This method is useful for storing
non-default {@code Attribute} or
- * {@code Association} implementations in this feature. When default
implementations are sufficient,
+ * {@code FeatureAssociation} implementations in this feature. When
default implementations are sufficient,
* the {@link #setPropertyValue(String, Object)} method is preferred.</div>
*
* <div class="warning"><b>Warning:</b> In a future SIS version, the
argument may be changed
@@ -237,11 +237,11 @@ public abstract class AbstractFeature im
*
* <table class="sis">
* <caption>Class of returned value</caption>
- * <tr><th>Property type</th> <th>max. occurs</th> <th>Method
invoked</th> <th>Return type</th></tr>
- * <tr><td>{@link AttributeType}</td> <td>0 or 1</td> <td>{@link
Attribute#getValue()}</td> <td>{@link Object}</td></tr>
- * <tr><td>{@code AttributeType}</td> <td>2 or more</td> <td>{@link
Attribute#getValues()}</td> <td>{@code Collection<?>}</td></tr>
- * <tr><td>{@link AssociationRole}</td> <td>0 or 1</td> <td>{@link
Association#getValue()}</td> <td>{@link Feature}</td></tr>
- * <tr><td>{@code AssociationRole}</td> <td>2 or more</td> <td>{@link
Association#getValues()}</td> <td>{@code Collection<Feature>}</td></tr>
+ * <tr><th>Property type</th> <th>max. occurs</th> <th>Method
invoked</th> <th>Return type</th></tr>
+ * <tr><td>{@link AttributeType}</td> <td>0 or 1</td> <td>{@link
Attribute#getValue()}</td> <td>{@link Object}</td></tr>
+ * <tr><td>{@code AttributeType}</td> <td>2 or more</td> <td>{@link
Attribute#getValues()}</td> <td>{@code Collection<?>}</td></tr>
+ * <tr><td>{@link AssociationRole}</td> <td>0 or 1</td> <td>{@link
FeatureAssociation#getValue()}</td> <td>{@link Feature}</td></tr>
+ * <tr><td>{@code AssociationRole}</td> <td>2 or more</td> <td>{@link
FeatureAssociation#getValues()}</td> <td>{@code Collection<Feature>}</td></tr>
* </table>
*
* <div class="note"><b>Note:</b> “max. occurs” is the {@linkplain
DefaultAttributeType#getMaximumOccurs() maximum
Propchange:
sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
------------------------------------------------------------------------------
Merged
/sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java:r1598750-1601002
Merged
/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java:r1598745-1600997
Merged
/sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java:r1598749-1600999
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -39,6 +39,18 @@ import static org.apache.sis.util.Argume
* <li>{@link #derivative(double)}</li>
* </ul>
*
+ * {@section Immutability and thread safety}
+ * All Apache SIS implementations of {@code MathTransform1D} are immutable and
thread-safe.
+ * It is highly recommended that third-party implementations be immutable and
thread-safe too.
+ * This means that unless otherwise noted in the javadoc, {@code
MathTransform1D} instances can
+ * be shared by many objects and passed between threads without
synchronization.
+ *
+ * {@section Serialization}
+ * {@code MathTransform1D} may or may not be serializable, at implementation
choices.
+ * Most Apache SIS implementations are serializable, but the serialized
objects are not guaranteed to be compatible
+ * with future SIS versions. Serialization should be used only for short term
storage or RMI between applications
+ * running the same SIS version.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.5 (derived from geotk-3.17)
* @version 0.5
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -47,6 +47,18 @@ import org.apache.sis.util.resources.Err
*
* However more performance may be gained by overriding the other {@code
transform} methods as well.
*
+ * {@section Immutability and thread safety}
+ * All Apache SIS implementations of {@code MathTransform2D} are immutable and
thread-safe.
+ * It is highly recommended that third-party implementations be immutable and
thread-safe too.
+ * This means that unless otherwise noted in the javadoc, {@code
MathTransform2D} instances can
+ * be shared by many objects and passed between threads without
synchronization.
+ *
+ * {@section Serialization}
+ * {@code MathTransform2D} may or may not be serializable, at implementation
choices.
+ * Most Apache SIS implementations are serializable, but the serialized
objects are not guaranteed to be compatible
+ * with future SIS versions. Serialization should be used only for short term
storage or RMI between applications
+ * running the same SIS version.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.5 (derived from geotk-2.0)
* @version 0.5
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -50,17 +50,21 @@ import org.opengis.referencing.operation
* A <cite>projective</cite> transform can be used as a generalization of
affine transforms.
* In such case the computation performed by SIS is similar to {@code
PerspectiveTransform}
* in <cite>Java Advanced Imaging</cite>.
+ * For example a square matrix of size 4×4 is used for transforming
three-dimensional coordinates.
+ * The transformed points {@code (x',y',z')} are computed as below:
*
- * <p>For example a square matrix of size 4×4 is used for transforming
three-dimensional coordinates.
- * The transformed points {@code (x',y',z')} are computed as below:</p>
+ * <center><p>{@include formulas.html#ProjectiveTransform}</p></center>
*
- * <blockquote>{@include formulas.html#ProjectiveTransform}</blockquote>
+ * {@section Instantiation}
+ * The easiest way to instantiate a {@code LinearTransform} is to use the
{@link MathTransforms#linear(Matrix)}
+ * convenience method.
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*
+ * @see java.awt.geom.AffineTransform
* @see <a
href="http://mathworld.wolfram.com/AffineTransformation.html">Affine
transformation on MathWorld</a>
*/
public interface LinearTransform extends MathTransform {
@@ -68,6 +72,7 @@ public interface LinearTransform extends
* Returns the coefficients of this linear transform as a matrix.
* Converting a coordinate with this {@code MathTransform} is equivalent
to multiplying the
* returned matrix by a vector containing the ordinate values with an
additional 1 in the last row.
+ * See {@link LinearTransform} class Javadoc for more details.
*
* @return The coefficients of this linear transform as a matrix.
*
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -38,9 +38,23 @@ import static org.apache.sis.util.Argume
* Transform which passes through a subset of ordinates to another transform.
* This allows transforms to operate on a subset of ordinates.
*
- * <span class="note"><b>Example:</b> giving (<var>latitude</var>,
<var>longitude</var>, <var>height</var>) coordinates,
+ * <div class="note"><b>Example:</b> giving (<var>latitude</var>,
<var>longitude</var>, <var>height</var>) coordinates,
* {@code PassThroughTransform} can convert the height values from feet to
meters without affecting the latitude and
- * longitude values.</span>
+ * longitude values. Such transform can be built as below:
+ *
+ * {@preformat java
+ * MathTransform feetToMetres = MathTransforms.linear(0.3048, 0); //
One-dimensional conversion.
+ * MathTransform tr = PassThroughTransform.create(2, feetToMetres, 0); //
Three-dimensional conversion.
+ * }
+ * </div>
+ *
+ * {@section Immutability and thread safety}
+ * {@code PassThroughTransform} is immutable and thread-safe if its
{@linkplain #subTransform} is also
+ * immutable and thread-safe.
+ *
+ * {@section Serialization}
+ * Serialized instances of this class are not guaranteed to be compatible with
future SIS versions.
+ * Serialization should be used only for short term storage or RMI between
applications running the same SIS version.
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.5 (derived from geotk-1.2)
@@ -60,16 +74,14 @@ public class PassThroughTransform extend
/**
* Number of unaffected ordinates after the affected ones.
- * Always 0 when used through the strict OpenGIS API.
*/
final int numTrailingOrdinates;
/**
- * The sub transform.
- *
- * @see #getSubTransform()
+ * The sub-transform to apply on the {@linkplain #getModifiedCoordinates()
modified coordinates}.
+ * This is often the sub-transform specified at construction time, but not
necessarily.
*/
- final MathTransform subTransform;
+ protected final MathTransform subTransform;
/**
* The inverse transform. This field will be computed only when needed,
@@ -78,10 +90,13 @@ public class PassThroughTransform extend
PassThroughTransform inverse;
/**
- * Creates a pass through transform.
+ * Constructor for sub-classes.
+ * Users should invoke the static {@link #create(int, MathTransform, int)}
factory method instead,
+ * since the most optimal pass-through transform for the given {@code
subTransform} is not necessarily
+ * a {@code PassThroughTransform} instance.
*
* @param firstAffectedOrdinate Index of the first affected ordinate.
- * @param subTransform The sub transform.
+ * @param subTransform The sub-transform to apply on modified
coordinates.
* @param numTrailingOrdinates Number of trailing ordinates to pass
through.
*
* @see #create(int, MathTransform, int)
@@ -117,9 +132,9 @@ public class PassThroughTransform extend
* {@code dimTarget - numTrailingOrdinates} exclusive.
*
* @param firstAffectedOrdinate Index of the first affected ordinate.
- * @param subTransform The sub transform.
+ * @param subTransform The sub-transform to apply on modified
coordinates.
* @param numTrailingOrdinates Number of trailing ordinates to pass
through.
- * @return A pass through transform.
+ * @return A pass-through transform, not necessarily a {@code
PassThroughTransform} instance.
*/
public static MathTransform create(final int firstAffectedOrdinate,
final MathTransform subTransform,
@@ -213,31 +228,8 @@ public class PassThroughTransform extend
}
/**
- * Returns the sub transform.
- *
- * @return The sub transform.
- */
- public final MathTransform getSubTransform() {
- return subTransform;
- }
-
- /**
- * Ordered sequence of positive integers defining the positions in a
coordinate
- * tuple of the coordinates affected by this pass-through transform. The
returned
- * index are for source coordinates.
- *
- * @return The modified coordinates.
- */
- public final int[] getModifiedCoordinates() {
- final int[] index = new int[subTransform.getSourceDimensions()];
- for (int i=0; i<index.length; i++) {
- index[i] = i + firstAffectedOrdinate;
- }
- return index;
- }
-
- /**
- * Gets the dimension of input points.
+ * Gets the dimension of input points. This the source dimension of the
+ * {@linkplain #subTransform sub-transform} plus the number of
pass-through dimensions.
*
* @return {@inheritDoc}
*/
@@ -247,7 +239,8 @@ public class PassThroughTransform extend
}
/**
- * Gets the dimension of output points.
+ * Gets the dimension of output points. This the target dimension of the
+ * {@linkplain #subTransform sub-transform} plus the number of
pass-through dimensions.
*
* @return {@inheritDoc}
*/
@@ -257,7 +250,22 @@ public class PassThroughTransform extend
}
/**
- * Tests whether this transform does not move any points.
+ * Returns the ordered sequence of positive integers defining the
positions in a source
+ * coordinate tuple of the coordinates affected by this pass-through
operation.
+ *
+ * @return Indices of the modified source coordinates.
+ */
+ public int[] getModifiedCoordinates() {
+ final int[] index = new int[subTransform.getSourceDimensions()];
+ for (int i=0; i<index.length; i++) {
+ index[i] = i + firstAffectedOrdinate;
+ }
+ return index;
+ }
+
+ /**
+ * Tests whether this transform does not move any points. A {@code
PassThroughTransform}
+ * is identity if the {@linkplain #subTransform sub-transform} is also
identity.
*
* @return {@inheritDoc}
*/
@@ -291,7 +299,7 @@ public class PassThroughTransform extend
/**
* Transforms many coordinates in a list of ordinal values.
*
- * @throws TransformException If the {@linkplain #getSubTransform()
sub-transform} failed.
+ * @throws TransformException If the {@linkplain #subTransform
sub-transform} failed.
*/
@Override
public void transform(double[] srcPts, int srcOff, final double[] dstPts,
int dstOff, int numPts)
@@ -337,7 +345,7 @@ public class PassThroughTransform extend
/**
* Transforms many coordinates in a list of ordinal values.
*
- * @throws TransformException If the {@linkplain #getSubTransform()
sub-transform} failed.
+ * @throws TransformException If the {@linkplain #subTransform
sub-transform} failed.
*/
@Override
public void transform(float[] srcPts, int srcOff, final float[] dstPts,
int dstOff, int numPts)
@@ -383,7 +391,7 @@ public class PassThroughTransform extend
/**
* Transforms many coordinates in a list of ordinal values.
*
- * @throws TransformException If the {@linkplain #getSubTransform()
sub-transform} failed.
+ * @throws TransformException If the {@linkplain #subTransform
sub-transform} failed.
*/
@Override
public void transform(final double[] srcPts, int srcOff, final float[]
dstPts, int dstOff, int numPts)
@@ -407,7 +415,7 @@ public class PassThroughTransform extend
/**
* Transforms many coordinates in a list of ordinal values.
*
- * @throws TransformException If the {@linkplain #getSubTransform()
sub-transform} failed.
+ * @throws TransformException If the {@linkplain #subTransform
sub-transform} failed.
*/
@Override
public void transform(final float[] srcPts, int srcOff, final double[]
dstPts, int dstOff, int numPts)
@@ -432,7 +440,7 @@ public class PassThroughTransform extend
* Gets the derivative of this transform at a point.
*
* @return {@inheritDoc}
- * @throws TransformException If the {@linkplain #getSubTransform()
sub-transform} failed.
+ * @throws TransformException If the {@linkplain #subTransform
sub-transform} failed.
*/
@Override
public Matrix derivative(final DirectPosition point) throws
TransformException {
@@ -448,7 +456,7 @@ public class PassThroughTransform extend
}
/**
- * Creates a pass through transform from a matrix. This method is invoked
when the
+ * Creates a pass-through transform from a matrix. This method is invoked
when the
* sub-transform can be expressed as a matrix. It is also invoked for
computing the
* matrix returned by {@link #derivative}.
*
@@ -534,7 +542,7 @@ public class PassThroughTransform extend
* Creates the inverse transform of this object.
*
* @return {@inheritDoc}
- * @throws NoninvertibleTransformException If the {@linkplain
#getSubTransform() sub-transform} is not invertible.
+ * @throws NoninvertibleTransformException If the {@linkplain
#subTransform sub-transform} is not invertible.
*/
@Override
public synchronized MathTransform inverse() throws
NoninvertibleTransformException {
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -16,13 +16,30 @@
*/
/**
- * {@code MathTransform} implementations for conversions or transformations of
multi-dimensional coordinate points.
- * A {@code MathTransform} usually performs conversions or transformations
from points given in a
+ * Conversions or transformations of multi-dimensional coordinate points.
+ * {@link org.opengis.referencing.operation.MathTransform} provides a single
API for
+ * coordinate conversions or transformations, including map projections.
+ * Each {@code MathTransform} instances can:
+ *
+ * <ul>
+ * <li>transform a single point,</li>
+ * <li>transform efficiently an array of coordinates,</li>
+ * <li>transform a Java2D {@link java.awt.Shape} ({@link
org.opengis.referencing.operation.MathTransform2D} only),</li>
+ * <li>compute the transform derivative at a location (for advanced
users),</li>
+ * <li>be concatenated in a conversion or transformation chain.</li>
+ * </ul>
+ *
+ * {@code MathTransform} are truly <var>n</var>-dimensional, but specialized
implementations
+ * for 1D and 2D cases are provided for performance reasons or for
inter-operability with Java2D.
+ * In the 2D case, Apache SIS provides instances of the standard {@link
java.awt.geom.AffineTransform}
+ * class when possible.
+ *
+ * <p>{@code MathTransform} usually performs conversions or transformations
from points given in a
* {@linkplain
org.apache.sis.referencing.operation.DefaultCoordinateOperation#getSourceCRS()
* source coordinate reference system} to coordinate values for the same
points in the
* {@linkplain
org.apache.sis.referencing.operation.DefaultCoordinateOperation#getTargetCRS()
* target coordinate reference system}. However the conversions are not
necessarily between CRS;
- * a {@code MathTransform} can also be used for converting the sample values
in a raster for example.
+ * a {@code MathTransform} can also be used for converting the sample values
in a raster for example.</p>
*
* <p>This package does not include map projections, which are a special kind
of transforms defined
* in their own {@linkplain org.apache.sis.referencing.operation.projection
projection} package.</p>
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -19,10 +19,12 @@ package org.apache.sis.referencing.opera
import java.util.Arrays;
import java.util.Random;
import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.TestCase;
+
+// Test imports
import org.junit.Test;
+import org.apache.sis.test.TestCase;
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.DependsOnMethod;
import static org.junit.Assert.*;
import static java.lang.StrictMath.*;
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -19,9 +19,11 @@ package org.apache.sis.referencing.opera
import java.util.Arrays;
import java.util.Random;
import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.TestCase;
+
+// Test imports
import org.junit.Test;
+import org.apache.sis.test.TestCase;
+import org.apache.sis.test.DependsOnMethod;
import static org.junit.Assert.*;
import static java.lang.StrictMath.*;
Copied:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
(from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java)
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java&r1=1601002&r2=1601013&rev=1601013&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -29,6 +29,9 @@ import org.apache.sis.test.DependsOn;
import static org.opengis.test.Assert.*;
+// Branch-dependent imports
+import org.junit.Ignore;
+
/**
* Tests various implementation of the {@link LinearTransform} interface by
inheriting the tests defined
@@ -70,6 +73,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testIdentity1D() throws FactoryException, TransformException {
super.testIdentity1D();
assertInstanceOf("Unexpected implementation.",
IdentityTransform1D.class, transform);
@@ -83,6 +87,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testIdentity2D() throws FactoryException, TransformException {
super.testIdentity2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -96,6 +101,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testIdentity3D() throws FactoryException, TransformException {
super.testIdentity3D();
assertInstanceOf("Unexpected implementation.",
IdentityTransform.class, transform);
@@ -109,6 +115,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testAxisSwapping2D() throws FactoryException,
TransformException {
super.testAxisSwapping2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -122,6 +129,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testSouthOrientated2D() throws FactoryException,
TransformException {
super.testSouthOrientated2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -135,6 +143,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testTranslatation2D() throws FactoryException,
TransformException {
super.testTranslatation2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -148,6 +157,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testUniformScale2D() throws FactoryException,
TransformException {
super.testUniformScale2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -161,6 +171,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testGenericScale2D() throws FactoryException,
TransformException {
super.testGenericScale2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -174,6 +185,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testRotation2D() throws FactoryException, TransformException {
super.testRotation2D();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -187,6 +199,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testGeneral() throws FactoryException, TransformException {
super.testGeneral();
assertInstanceOf("Unexpected implementation.",
AffineTransform2D.class, transform);
@@ -200,6 +213,7 @@ public final strictfp class LinearTransf
*/
@Test
@Override
+ @Ignore(MESSAGE)
public void testDimensionReduction() throws FactoryException,
TransformException {
super.testDimensionReduction();
assertInstanceOf("Unexpected implementation.",
ProjectiveTransform.class, transform);
Copied:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
(from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java)
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java&r1=1601002&r2=1601013&rev=1601013&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -40,8 +40,6 @@ import org.apache.sis.internal.util.Nume
// Test imports
import org.opengis.test.Validators;
-import org.opengis.test.CalculationType;
-import org.opengis.test.ToleranceModifier;
import org.opengis.test.referencing.TransformTestCase;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.TestUtilities;
@@ -107,55 +105,6 @@ public abstract strictfp class MathTrans
* Creates a new test case.
*/
protected MathTransformTestCase() {
- /*
- * Use 'zTolerance' threshold instead of 'tolerance' when comparing
vertical coordinate values.
- */
- toleranceModifier = new ToleranceModifier() {
- @Override
- public void adjust(final double[] tolerance, final DirectPosition
coordinate, final CalculationType mode) {
- if (mode != CalculationType.IDENTITY) {
- final int i = forComparison(zDimension, mode);
- if (i >= 0 && i < tolerance.length) {
- tolerance[i] = zTolerance;
- }
- }
- }
- };
- }
-
- /**
- * Returns the value to use from the {@link #λDimension} or {@link
zDimension} for the
- * given comparison mode, or -1 if none.
- */
- @SuppressWarnings("fallthrough")
- static int forComparison(final int[] config, final CalculationType mode) {
- if (config != null) {
- switch (mode) {
- case INVERSE_TRANSFORM: if (config.length >= 2) return
config[1]; // Intentional fallthrough.
- case DIRECT_TRANSFORM: if (config.length >= 1) return
config[0];
- }
- }
- return -1;
- }
-
- /**
- * Invoked by all {@code assertCoordinateEqual(…)} methods before two
positions are compared.
- * The SIS implementation ensures that longitude values are contained in
the ±180° range,
- * applying 360° shifts if needed.
- *
- * @param expected The expected ordinate value provided by the test case.
- * @param actual The ordinate value computed by the {@linkplain
#transform transform} being tested.
- * @param mode Indicates if the coordinates being compared are the
result of a direct
- * or inverse transform, or if strict equality is
requested.
- */
- @Override
- protected final void normalize(final DirectPosition expected, final
DirectPosition actual, final CalculationType mode) {
- final int i = forComparison(λDimension, mode);
- if (i >= 0) {
- double e;
- e = expected.getOrdinate(i); e -= 360*floor(e/360);
expected.setOrdinate(i, e);
- e = actual.getOrdinate(i); e -= 360*floor(e/360);
actual.setOrdinate(i, e);
- }
}
/**
Copied:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
(from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java)
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java&r1=1601002&r2=1601013&rev=1601013&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -27,8 +27,6 @@ import org.apache.sis.util.ArraysExt;
// Test imports
import org.junit.Test;
-import org.opengis.test.CalculationType;
-import org.opengis.test.ToleranceModifier;
import org.apache.sis.test.TestUtilities;
import org.apache.sis.test.DependsOn;
@@ -188,36 +186,24 @@ public final strictfp class PassThroughT
/*
* Now process to the transform and compares the results with the
expected ones.
*/
- tolerance = 0; // Results should be strictly identical because
we used the same inputs.
- toleranceModifier = null;
+ tolerance = 0; // Results should be strictly identical because we used
the same inputs.
final double[] transformedData = new double[expectedData.length];
transform.transform(passthroughData, 0, transformedData, 0, numPts);
assertCoordinatesEqual("Direct transform.", passthroughDim,
- expectedData, 0, transformedData, 0, numPts,
CalculationType.DIRECT_TRANSFORM);
+ expectedData, 0, transformedData, 0, numPts, false);
/*
* Test inverse transform.
*/
- tolerance = 1E-8;
- toleranceModifier = ToleranceModifier.RELATIVE;
+ tolerance = 1E-8;
Arrays.fill(transformedData, Double.NaN);
transform.inverse().transform(expectedData, 0, transformedData, 0,
numPts);
assertCoordinatesEqual("Inverse transform.", passthroughDim,
- passthroughData, 0, transformedData, 0, numPts,
CalculationType.INVERSE_TRANSFORM);
+ passthroughData, 0, transformedData, 0, numPts, false);
/*
* Verify the consistency between different 'transform(…)' methods.
*/
final float[] sourceAsFloat = Numerics.copyAsFloats(passthroughData);
final float[] targetAsFloat = verifyConsistency(sourceAsFloat);
assertEquals("Unexpected length of transformed array.",
expectedData.length, targetAsFloat.length);
- /*
- * We use a relatively high tolerance threshold because result are
- * computed using inputs stored as float values.
- */
- if (transform instanceof LinearTransform) {
- tolerance = 1E-4;
- toleranceModifier = ToleranceModifier.RELATIVE;
- assertCoordinatesEqual("A transformed value is wrong.",
passthroughDim,
- expectedData, 0, targetAsFloat, 0, numPts,
CalculationType.DIRECT_TRANSFORM);
- }
}
}
Copied:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
(from r1601002,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java)
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java&r1=1601002&r2=1601013&rev=1601013&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -25,7 +25,6 @@ import org.apache.sis.referencing.operat
import org.apache.sis.parameter.Parameterized;
// Test imports
-import org.opengis.test.referencing.AffineTransformTest;
import org.opengis.test.Validators;
import org.apache.sis.test.DependsOn;
import org.junit.runner.RunWith;
@@ -34,6 +33,13 @@ import org.junit.After;
import static org.opengis.test.Assert.*;
+// Branch-dependent imports
+import org.junit.Test;
+import org.junit.Ignore;
+import org.opengis.util.FactoryException;
+import org.opengis.referencing.operation.TransformException;
+import org.opengis.test.referencing.TransformTestCase;
+
/**
* Tests the {@link ProjectiveTransform} class by inheriting the tests defined
in GeoAPI conformance module.
@@ -48,19 +54,29 @@ import static org.opengis.test.Assert.*;
*/
@RunWith(JUnit4.class)
@DependsOn(AbstractMathTransformTest.class)
-public strictfp class ProjectiveTransformTest extends AffineTransformTest {
+public strictfp class ProjectiveTransformTest extends TransformTestCase {
+ /**
+ * The factory to use for creating linear transforms.
+ */
+ private final MathTransformFactory mtFactory;
+
+ /**
+ * The matrix for the tested transform.
+ */
+ private Matrix matrix;
+
/**
* For {@link LinearTransformTest} constructor only.
*/
ProjectiveTransformTest(final MathTransformFactory factory) {
- super(factory);
+ mtFactory = factory;
}
/**
* Creates a new test suite.
*/
public ProjectiveTransformTest() {
- super(new MathTransformFactoryBase() {
+ this(new MathTransformFactoryBase() {
@Override
public ProjectiveTransform createAffineTransform(final Matrix
matrix) {
if (matrix.getNumRow() == 3 && matrix.getNumCol() == 3) {
@@ -73,7 +89,10 @@ public strictfp class ProjectiveTransfor
}
/*
- * Inherit all the tests from GeoAPI:
+ * GeoAPI 3.1 defines the following tests. However since those tests are
not available
+ * in GeoAPI 3.0, we put empty placeholder. For running the real test, see
for example
+ * the JDK6 branch of Apache SIS.
+ *
* - testIdentity1D()
* - testIdentity2D()
* - testIdentity3D()
@@ -87,6 +106,64 @@ public strictfp class ProjectiveTransfor
* - testDimensionReduction()
*/
+ static final String MESSAGE = "This test is not available in GeoAPI 3.0. "
+ + "See Apache SIS JDK6, JDK7 or JDK8 branch for the actual tests.";
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testIdentity1D() throws FactoryException, TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testIdentity2D() throws FactoryException, TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testIdentity3D() throws FactoryException, TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testAxisSwapping2D() throws FactoryException,
TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testSouthOrientated2D() throws FactoryException,
TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testTranslatation2D() throws FactoryException,
TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testUniformScale2D() throws FactoryException,
TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testGenericScale2D() throws FactoryException,
TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testRotation2D() throws FactoryException, TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testGeneral() throws FactoryException, TransformException {
+ }
+
+ @Test
+ @Ignore(MESSAGE)
+ public void testDimensionReduction() throws FactoryException,
TransformException {
+ }
+
/**
* {@code true} if {@link #ensureImplementRightInterface()} should skip
its check for a transform
* of the given dimension. {@code ProjectiveTransformTest} needs to skip
the case for dimension 1
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1601013&r1=1601012&r2=1601013&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Fri Jun 6 21:12:13 2014
@@ -42,6 +42,10 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.matrix.AffineTransforms2DTest.class,
org.apache.sis.referencing.operation.transform.IterationStrategyTest.class,
org.apache.sis.referencing.operation.transform.AbstractMathTransformTest.class,
+
org.apache.sis.referencing.operation.transform.ProjectiveTransformTest.class,
+ org.apache.sis.referencing.operation.transform.LinearTransformTest.class,
+ org.apache.sis.referencing.operation.transform.CopyTransformTest.class,
+
org.apache.sis.referencing.operation.transform.PassThroughTransformTest.class,
org.apache.sis.internal.referencing.FormulasTest.class,
org.apache.sis.internal.referencing.VerticalDatumTypesTest.class,