Author: desruisseaux
Date: Thu Jun 5 21:49:40 2014
New Revision: 1600775
URL: http://svn.apache.org/r1600775
Log:
Merge from the JDK8 branch.
Added:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DirectPositionView.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DirectPositionView.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Semaphores.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Semaphores.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/
- copied from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/
- copied from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform1D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform1D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform1D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform2D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform2D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect1D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect1D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect2D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransformDirect2D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform1D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform1D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform2D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform2D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform2D.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform2D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
- copied unchanged from r1600774,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/
- copied from r1600774,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Formulas.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/package-info.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/Affine.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IterationStrategy.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/branches/JDK7/pom.xml
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1599817-1600774
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -84,7 +84,7 @@ import org.apache.sis.metadata.iso.exten
* </ul>
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @since 0.4 (derived from geotk-2.0)
+ * @since 0.5 (derived from geotk-2.0)
* @version 0.4
* @module
*/
@@ -1174,6 +1174,32 @@ public class Formatter implements Locali
}
/**
+ * Delegates the formatting to another {@link FormattableObject}
implementation.
+ * Invoking this method is equivalent to first verifying the {@code other}
class,
+ * then delegating as below:
+ *
+ * {@preformat
+ * return other.formatTo(this);
+ * }
+ *
+ * This method is useful for {@code FormattableObject} which are wrapper
around another object.
+ * It allows to delegate the WKT formatting to the wrapped object.
+ *
+ * @param other The object to format with this formatter.
+ * @return The value returned by {@link
FormattableObject#formatTo(Formatter)}.
+ *
+ * @since 0.5
+ */
+ public String delegateTo(final Object other) throws
UnformattableObjectException {
+ ArgumentChecks.ensureNonNull("other", other);
+ if (other instanceof FormattableObject) {
+ return ((FormattableObject) other).formatTo(this);
+ }
+ throw new UnformattableObjectException(Errors.format(
+ Errors.Keys.IllegalClass_2, FormattableObject.class,
other.getClass()));
+ }
+
+ /**
* Returns the enclosing WKT element, or {@code null} if element being
formatted is the root.
* This method can be invoked by child elements having some aspects that
depend on the enclosing element.
*
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ISOMetadata.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -31,6 +31,7 @@ import org.apache.sis.xml.IdentifiedObje
import org.apache.sis.metadata.MetadataStandard;
import org.apache.sis.metadata.ModifiableMetadata;
import org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases;
+import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.CharSequences;
@@ -82,6 +83,21 @@ public class ISOMetadata extends Modifia
*/
protected ISOMetadata(final Object object) {
if (object instanceof IdentifiedObject) {
+ if (object instanceof ISOMetadata &&
Containers.isNullOrEmpty(((ISOMetadata) object).identifiers)) {
+ /*
+ * If the other object is an ISOMetadata instance, take a
look at its 'identifiers' collection
+ * before to invoke object.getIdentifiers() in order to avoid
unnecessary initialization of its
+ * backing collection. We do this optimization because the
vast majority of metadata objects do
+ * not have 'identifiers' collection.
+ *
+ * Actually this optimization is a little bit dangerous, since
users could override getIdentifiers()
+ * without invoking super.getIdentifiers(), in which case
their identifiers will not be copied.
+ * For safety, we will do this optimization only if the
implementation is an Apache SIS one.
+ */
+ if (object.getClass().getName().startsWith("org.apache.sis."))
{
+ return;
+ }
+ }
identifiers = copyCollection(((IdentifiedObject)
object).getIdentifiers(), Identifier.class);
}
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Formulas.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Formulas.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Formulas.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Formulas.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -95,8 +95,12 @@ public final class Formulas extends Stat
* @see
org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius()
*/
public static double getAuthalicRadius(final double a, final double b) {
- final double f = 1 - b/a;
- final double e = sqrt(2*f - f*f);
- return sqrt(0.5 * (a*a + b*b*atanh(e)/e));
+ if (a != b) {
+ final double f = 1 - b/a;
+ final double e = sqrt(2*f - f*f);
+ return sqrt(0.5 * (a*a + b*b*atanh(e)/e));
+ } else {
+ return a;
+ }
}
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/package-info.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/package-info.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/package-info.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -18,7 +18,7 @@
/**
* A set of helper classes for the SIS implementation.
*
- * <STRONG>Do not use!</STRONG>
+ * <strong>Do not use!</strong>
*
* This package is for internal use by SIS only. Classes in this package
* may change in incompatible ways in any future version without notice.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -533,7 +533,7 @@ public final class Matrices extends Stat
* @throws IllegalArgumentException if a value of {@code
selectedDimensions} is lower than 0
* or not smaller than {@code sourceDimensions}.
*
- * @see
org.apache.sis.referencing.operation.MathTransforms#dimensionFilter(int, int[])
+ * @see
org.apache.sis.referencing.operation.transform.MathTransforms#dimensionFilter(int,
int[])
*/
public static MatrixSIS createDimensionSelect(final int sourceDimensions,
final int[] selectedDimensions) {
final int numTargetDim = selectedDimensions.length;
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/Affine.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/Affine.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/Affine.java
(original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/Affine.java
Thu Jun 5 21:49:40 2014
@@ -21,7 +21,7 @@ import java.util.Collections;
import org.opengis.parameter.ParameterDescriptorGroup;
public abstract class Affine implements
org.opengis.referencing.operation.OperationMethod {
- public static Map<String,Object> IDENTIFICATION =
Collections.singletonMap(NAME_KEY, "Affine");
+ public static Map<String,Object> IDENTIFICATION =
Collections.<String,Object>singletonMap(NAME_KEY, "Affine");
public static ParameterDescriptorGroup PARAMETERS; // TODO
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -59,7 +59,19 @@ import static org.apache.sis.util.Argume
* <li>{@link #transform(double[], int, double[], int, boolean)}</li>
* </ul>
*
- * However more performance may be gained by overriding the other {@code
transform} method as well.
+ * 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 MathTransform} 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
MathTransform} instances can
+ * be shared by many objects and passed between threads without
synchronization.
+ *
+ * {@section Serialization}
+ * {@code MathTransform} 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 (IRD, Geomatys)
* @since 0.5 (derived from geotk-1.2)
@@ -105,7 +117,7 @@ public abstract class AbstractMathTransf
private transient int hashCode;
/**
- * Constructs a math transform.
+ * Constructor for subclasses.
*/
protected AbstractMathTransform() {
}
@@ -128,9 +140,12 @@ public abstract class AbstractMathTransf
/**
* Returns the parameter descriptors for this math transform, or {@code
null} if unknown.
+ *
+ * <span class="note"><b>Relationship with ISO 19111:</b>
* This method is similar to {@link OperationMethod#getParameters()},
except that typical
* {@link MathTransform} implementations return parameters in standard
units (usually
* {@linkplain SI#METRE metres} or {@linkplain NonSI#DEGREE_ANGLE decimal
degrees}).
+ * </span>
*
* @return The parameter descriptors for this math transform, or {@code
null}.
*
@@ -143,13 +158,16 @@ public abstract class AbstractMathTransf
/**
* Returns a copy of the parameter values for this math transform, or
{@code null} if unknown.
+ * Since this method returns a copy of the parameter values, any change to
a value will have no
+ * effect on this math transform.
+ *
+ * <span class="note"><b>Relationship with ISO 19111:</b>
* This method is similar to {@link SingleOperation#getParameterValues()},
except that typical
* {@link MathTransform} implementations return parameters in standard
units (usually
* {@linkplain SI#METRE metres} or {@linkplain NonSI#DEGREE_ANGLE decimal
degrees}).
+ * </span>
*
* @return A copy of the parameter values for this math transform, or
{@code null}.
- * Since this method returns a copy of the parameter values, any
change to
- * a value will have no effect on this math transform.
*
* @see SingleOperation#getParameterValues()
*/
@@ -269,7 +287,7 @@ public abstract class AbstractMathTransf
* the same. Computing those two information in a single step can help
to reduce redundant calculation.</li>
* </ul>
*
- * {@section Implementation note}
+ * {@section Note for implementors}
* The source and destination may overlap. Consequently, implementors must
read all source
* ordinate values before to start writing the transformed ordinates in
the destination array.
*
@@ -286,7 +304,7 @@ public abstract class AbstractMathTransf
*
* @see #derivative(DirectPosition)
* @see #transform(DirectPosition, DirectPosition)
- * @see
org.apache.sis.referencing.operation.MathTransforms#derivativeAndTransform(MathTransform,
double[], int, double[], int)
+ * @see MathTransforms#derivativeAndTransform(MathTransform, double[],
int, double[], int)
*/
public abstract Matrix transform(double[] srcPts, int srcOff, double[]
dstPts, int dstOff, boolean derivate)
throws TransformException;
@@ -295,17 +313,17 @@ public abstract class AbstractMathTransf
* Transforms a list of coordinate point ordinal values. This method is
provided for efficiently
* transforming many points. The supplied array of ordinal values will
contain packed ordinal values.
*
- * <div class="note"><b>Example:</b> if the source dimension is 3, then
the ordinates will be packed
- * in this order:
- * <blockquote>
+ * <div class="note"><b>Example:</b> if the source dimension is 3, then
the ordinates will be packed in this order:
*
(<var>x<sub>0</sub></var>,<var>y<sub>0</sub></var>,<var>z<sub>0</sub></var>,
- *
<var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>z<sub>1</sub></var> ...).
- * </blockquote></div>
+ *
<var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>z<sub>1</sub></var> …).
+ * </div>
*
* The default implementation invokes {@link #transform(double[], int,
double[], int, boolean)} in a loop,
* using an {@linkplain IterationStrategy iteration strategy} determined
from the arguments for iterating
* over the points.
*
+ * <div class="note"><b>Implementation note:</b> see {@link
IterationStrategy} javadoc for a method skeleton.</div>
+ *
* @param srcPts The array containing the source point coordinates.
* @param srcOff The offset to the first point to be transformed in the
source array.
* @param dstPts The array into which the transformed point coordinates
are returned.
@@ -415,6 +433,8 @@ public abstract class AbstractMathTransf
* Transforms a list of coordinate point ordinal values. The default
implementation delegates
* to {@link #transform(double[], int, double[], int, int)} using a
temporary array of doubles.
*
+ * <div class="note"><b>Implementation note:</b> see {@link
IterationStrategy} javadoc for a method skeleton.</div>
+ *
* @param srcPts The array containing the source point coordinates.
* @param srcOff The offset to the first point to be transformed in the
source array.
* @param dstPts The array into which the transformed point coordinates
are returned.
@@ -710,6 +730,9 @@ public abstract class AbstractMathTransf
* Returns the inverse transform of this object. The default
implementation returns
* {@code this} if this transform is an {@linkplain #isIdentity()
identity} transform,
* or throws an exception otherwise. Subclasses should override this
method.
+ *
+ * <div class="note"><b>Implementation note:</b> the {@link Inverse} inner
class can be used as
+ * a base for inverse transform implementations.</div>
*/
@Override
public MathTransform inverse() throws NoninvertibleTransformException {
@@ -886,8 +909,8 @@ public abstract class AbstractMathTransf
final Matrix m1 = t1.getMatrix();
if (m1 != null) {
final Matrix m2 = ((LinearTransform) t2).getMatrix();
- if (m1 instanceof org.apache.sis.util.LenientComparable) {
- return ((org.apache.sis.util.LenientComparable)
m1).equals(m2, mode);
+ if (m1 instanceof LenientComparable) {
+ return ((LenientComparable) m1).equals(m2, mode);
}
return Matrices.equals(m1, m2, mode);
}
@@ -901,7 +924,7 @@ public abstract class AbstractMathTransf
* The parameter group name is used as the math transform name.
*
* @param formatter The formatter to use.
- * @return The WKT element name, which is {@code "PARAM_MT"} in the
default implementation.
+ * @return The WKT element name, which is {@code "Param_MT"} in the
default implementation.
*/
@Override
public String formatTo(final Formatter formatter) {
@@ -910,7 +933,7 @@ public abstract class AbstractMathTransf
WKTUtilities.appendName(parameters.getDescriptor(), formatter,
null);
WKTUtilities.append(parameters, formatter);
}
- return "PARAM_MT";
+ return "Param_MT";
}
/**
@@ -928,14 +951,19 @@ public abstract class AbstractMathTransf
* @see AbstractMathTransform2D#beforeFormat(List, int, boolean)
* @see ConcatenatedTransform#getPseudoSteps()
*/
- int beforeFormat(List<Object> transforms, int index, boolean inverse) {
+ int beforeFormat(List<MathTransform> transforms, int index, boolean
inverse) {
return index;
}
/**
- * Default implementation for inverse math transform. This inner class is
the inverse of
- * the enclosing {@link AbstractMathTransform}. It is serializable only if
the enclosing
- * math transform is also serializable.
+ * Base class for implementations of inverse math transforms.
+ * This inner class is the inverse of the enclosing {@link
AbstractMathTransform}.
+ *
+ * {@section Serialization}
+ * Instances of this class are serializable only if the enclosing math
transform is also serializable.
+ * Serialized math transforms are not guaranteed to be compatible with
future SIS versions.
+ * Serialization, if allowed, 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-2.0)
@@ -1002,13 +1030,10 @@ public abstract class AbstractMathTransf
/**
* Returns the inverse of this math transform, which is the enclosing
math transform.
*
- * <div class="note"><b>API note:</b> this method is final because
some implementations assume
- * that the inverse of {@code this} is always {@code
AbstractMathTransform.this}.</div>
- *
* @return The enclosing math transform.
*/
@Override
- public final MathTransform inverse() {
+ public MathTransform inverse() {
return AbstractMathTransform.this;
}
@@ -1047,8 +1072,7 @@ public abstract class AbstractMathTransf
return true;
}
if (object != null && object.getClass() == getClass()) {
- final Inverse that = (Inverse) object;
- return AbstractMathTransform.this.equals(that.inverse(), mode);
+ return AbstractMathTransform.this.equals(((Inverse)
object).inverse(), mode);
} else {
return false;
}
@@ -1058,11 +1082,11 @@ public abstract class AbstractMathTransf
* Formats the inner part of a <cite>Well Known Text</cite> version 1
(WKT 1) element.
* If this inverse math transform has any parameter values, then this
method format the
* WKT as in the {@linkplain AbstractMathTransform#formatWKT
super-class method}.
- * Otherwise this method formats the math transform as an {@code
"INVERSE_MT"} entity.
+ * Otherwise this method formats the math transform as an {@code
"Inverse_MT"} entity.
*
* @param formatter The formatter to use.
- * @return The WKT element name, which is {@code "PARAM_MT"} or
- * {@code "INVERSE_MT"} in the default implementation.
+ * @return The WKT element name, which is {@code "Param_MT"} or
+ * {@code "Inverse_MT"} in the default implementation.
*/
@Override
public String formatTo(final Formatter formatter) {
@@ -1070,10 +1094,10 @@ public abstract class AbstractMathTransf
if (parameters != null) {
WKTUtilities.appendName(parameters.getDescriptor(), formatter,
null);
WKTUtilities.append(parameters, formatter);
- return "PARAM_MT";
+ return "Param_MT";
} else {
formatter.append((FormattableObject)
AbstractMathTransform.this);
- return "INVERSE_MT";
+ return "Inverse_MT";
}
}
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IterationStrategy.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IterationStrategy.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IterationStrategy.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IterationStrategy.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -19,45 +19,59 @@ package org.apache.sis.referencing.opera
/**
* Strategy for iterating over the point arrays given to
- * {@link AbstractMathTransform#transform(double[],int,double[],int,int)
transform} methods.
+ * {@link AbstractMathTransform#transform(double[], int, double[], int, int)
+ * AbstractMathTransform.transform(…)} methods.
* If the source and destination arrays are the same and the region of the
array to be written
* overlaps the region of the array to be read, it may be necessary to iterate
over the points
* in reverse order or to copy some points in a temporary array.
- * The {@link #suggest(int, int, int, int, int) suggest} method in this class
returns a strategy
+ * The {@link #suggest(int, int, int, int, int) suggest(…)} method in this
class returns a strategy
* suitable to the {@code transform} arguments.
*
- * <p>Implementation example:</p>
+ * {@section Usage}
+ * The following code gives a skeleton for a {@code AbstractMathTransform}
implementation
+ * capable to transform an array of {@code double} coordinates:
*
* {@preformat java
- * public void transform(double[] srcPts, int srcOff,
- * double[] dstPts, int dstOff, int numPts)
- * {
- * int srcInc = getSourceDimension();
- * int dstInc = getTargetDimension();
- * if (srcPts == dstPts) {
- * switch (IterationStrategy.suggest(srcOff, srcInc, dstOff,
dstInc, numPts)) {
- * case ASCENDING: {
- * break;
- * }
- * case DESCENDING: {
- * srcOff += (numPts-1) * srcInc; srcInc = -srcInc;
- * dstOff += (numPts-1) * dstInc; dstInc = -dstInc;
- * break;
- * }
- * default: {
- * srcPts = Arrays.copyOfRange(srcPts, srcOff, srcOff +
numPts*srcInc);
- * srcOff = 0;
- * break;
+ * public class MyTransform extends AbstractMathTransform {
+ * @Override
+ * public void transform(double[] srcPts, int srcOff,
+ * double[] dstPts, int dstOff, int numPts)
+ * {
+ * int srcInc = getSourceDimension();
+ * int dstInc = getTargetDimension();
+ * if (srcPts == dstPts) {
+ * switch (IterationStrategy.suggest(srcOff, srcInc, dstOff,
dstInc, numPts)) {
+ * case ASCENDING: {
+ * break;
+ * }
+ * case DESCENDING: {
+ * srcOff += (numPts-1) * srcInc; srcInc = -srcInc;
+ * dstOff += (numPts-1) * dstInc; dstInc = -dstInc;
+ * break;
+ * }
+ * default: {
+ * srcPts = Arrays.copyOfRange(srcPts, srcOff, srcOff
+ numPts*srcInc);
+ * srcOff = 0;
+ * break;
+ * }
* }
* }
- * }
- * while (--numPts >= 0) {
- * // TODO by the implementor here:
- * // 1. Read the coordinate starting at srcPts[srcOff].
- * // 2. Transform it.
- * // 3. Store the result starting at dstPts[dstOff].
- * srcOff += srcInc;
- * dstOff += dstInc;
+ * while (--numPts >= 0) {
+ * double x = srcPts[srcOff ];
+ * double y = srcPts[srcOff + 1];
+ * double z = srcPts[srcOff + 2];
+ * // Repeat as many time as needed for dimension of input
points.
+ *
+ * // Transform (x,y,z) here.
+ *
+ * dstPts[dstOff ] = x;
+ * dstPts[dstOff + 1] = y;
+ * dstPts[dstOff + 2] = z;
+ * // Repeat as many time as needed for dimension of output
points.
+ *
+ * srcOff += srcInc;
+ * dstOff += dstInc;
+ * }
* }
* }
* }
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -21,11 +21,14 @@ import org.opengis.referencing.operation
/**
- * A {@link MathTransform} which convert coordinates using only linear
equations.
- * Such transform can be represented by a {@linkplain #getMatrix() matrix}.
- * Those transforms are often affine, but not necessarily.
+ * A usually affine, or otherwise a projective transform, which convert
coordinates using only linear equations.
+ * A projective transform is capable of mapping an arbitrary quadrilateral
into another arbitrary quadrilateral,
+ * while preserving the straightness of lines. In the special case where the
transform is affine, the parallelism
+ * of lines in the source is preserved in the output.
+ *
+ * <p>Such a coordinate transformation can be represented by a matrix of
arbitrary size, which is given by the
+ * {@link #getMatrix()} method. The relationship between matrix size and
transform dimensions is as below:</p>
*
- * <p>Relationships:</p>
* <ul>
* <li>The {@linkplain Matrix#getNumCol() number of columns} in the matrix
is equal to
* the number of {@linkplain #getSourceDimensions() source dimensions}
plus 1</li>
@@ -33,26 +36,42 @@ import org.opengis.referencing.operation
* the number of {@linkplain #getTargetDimensions() target dimensions}
plus 1.</li>
* </ul>
*
+ * {@section Affine transform}
+ * In most cases the transform in affine. For such transforms, the last matrix
row contains only zero values
+ * except in the last column, which contains 1. For example a conversion from
projected coordinates (metres)
+ * to display coordinates (pixel) can be done as below:
+ *
+ * <center><p>
+ * <img src="../matrix/doc-files/AffineTransform.png" alt="Matrix
representation of an affine transform">
+ * </p></center>
+ *
+ * {@section Projective transform}
+ * If the last matrix row does not met the above constraints, then the
transform is not affine.
+ * 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>.
+ *
+ * <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>
+ *
+ * <blockquote>{@include formulas.html#ProjectiveTransform}</blockquote>
+ *
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.0)
* @version 0.4
* @module
*
- * @see org.apache.sis.referencing.operation.MathTransforms
+ * @see <a
href="http://mathworld.wolfram.com/AffineTransformation.html">Affine
transformation on MathWorld</a>
*/
public interface LinearTransform extends MathTransform {
/**
* 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.
- * For example if this transform converts projected coordinates (metres)
to display coordinates (pixel),
- * then the same conversions can be done by the returned matrix as below:
- *
- * <center><p>
- * <img src="../matrix/doc-files/AffineTransform.png" alt="Matrix
representation of an affine transform">
- * </p></center>
*
* @return The coefficients of this linear transform as a matrix.
+ *
+ * @see MathTransforms#getMatrix(MathTransform)
*/
Matrix getMatrix();
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -40,6 +40,8 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class, //
Expected to be last MatrixTestCase - see javadoc.
org.apache.sis.referencing.operation.matrix.MatricesTest.class,
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.internal.referencing.FormulasTest.class,
org.apache.sis.internal.referencing.VerticalDatumTypesTest.class,
@@ -60,6 +62,7 @@ import org.junit.BeforeClass;
org.apache.sis.parameter.ParameterFormatTest.class,
org.apache.sis.parameter.TensorParametersTest.class,
org.apache.sis.parameter.TensorValuesTest.class,
+
org.apache.sis.referencing.datum.BursaWolfParametersTest.class,
org.apache.sis.referencing.datum.TimeDependentBWPTest.class,
org.apache.sis.referencing.datum.DefaultEllipsoidTest.class,
Modified:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Thu Jun 5 21:49:40 2014
@@ -85,6 +85,11 @@ public final class Errors extends Indexe
public static final short CanNotComputeDerivative = 1;
/**
+ * Can not concatenate transforms “{0}” and “{1}”.
+ */
+ public static final short CanNotConcatenateTransforms_2 = 160;
+
+ /**
* Can not connect to “{0}”.
*/
public static final short CanNotConnectTo_1 = 2;
Modified:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Thu Jun 5 21:49:40 2014
@@ -27,6 +27,7 @@
AbstractType_1 = Type \u2018{0}\u2019 is abstract.
AmbiguousName_3 = Name \u201c{2}\u201d is ambiguous because
it can be understood as either \u201c{0}\u201d or \u201c{1}\u201d.
CanNotAddToExclusiveSet_2 = No element can be added to this set
because properties \u2018{0}\u2019 and \u2018{1}\u2019 are mutually exclusive.
+CanNotConcatenateTransforms_2 = Can not concatenate transforms
\u201c{0}\u201d and \u201c{1}\u201d.
CanNotConnectTo_1 = Can not connect to \u201c{0}\u201d.
CanNotConvertFromType_2 = Can not convert from type \u2018{0}\u2019
to type \u2018{1}\u2019.
CanNotConvertValue_2 = Can not convert value \u201c{0}\u201d to
type \u2018{1}\u2019.
Modified:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Thu Jun 5 21:49:40 2014
@@ -17,6 +17,7 @@
AbstractType_1 = Le type \u2018{0}\u2019 est abstrait.
AmbiguousName_3 = Le nom \u00ab\u202f{2}\u202f\u00bb est
ambigu\u00eb car il peut \u00eatre interpr\u00e9t\u00e9 comme
\u00ab\u202f{0}\u202f\u00bb ou \u00ab\u202f{1}\u202f\u00bb.
CanNotAddToExclusiveSet_2 = Aucun \u00e9l\u00e9ment ne peut \u00eatre
ajout\u00e9 \u00e0 cet ensemble car les propri\u00e9t\u00e9s \u2018{0}\u2019 et
\u2018{1}\u2019 sont mutuellement exclusives.
+CanNotConcatenateTransforms_2 = Les transformations
\u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb ne peuvent pas
\u00eatre combin\u00e9es.
CanNotConnectTo_1 = Ne peut pas se connecter \u00e0
\u00ab\u202f{0}\u202f\u00bb.
CanNotConvertFromType_2 = Ne peut pas convertir du type
\u2018{0}\u2019 vers le type \u2018{1}\u2019.
CanNotConvertValue_2 = La valeur \u00ab\u202f{0}\u202f\u00bb ne
peut pas \u00eatre convertie vers le type \u2018{1}\u2019.
Modified: sis/branches/JDK7/pom.xml
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/pom.xml?rev=1600775&r1=1600774&r2=1600775&view=diff
==============================================================================
--- sis/branches/JDK7/pom.xml (original)
+++ sis/branches/JDK7/pom.xml Thu Jun 5 21:49:40 2014
@@ -435,6 +435,7 @@ Apache SIS is a free software, Java lang
<source>${maven.compile.source}</source>
<target>${maven.compile.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
+ <useIncrementalCompilation>false</useIncrementalCompilation> <!--
https://jira.codehaus.org/browse/MCOMPILER-209 -->
</configuration>
</plugin>
@@ -591,7 +592,6 @@ Apache SIS is a free software, Java lang
-->
<additionalparam>
- -link http://www.geoapi.org/snapshot/javadoc/
-link http://www.geoapi.org/snapshot/pending/
</additionalparam>
@@ -632,7 +632,7 @@ Apache SIS is a free software, Java lang
</groups>
<!-- Internal packages to hide from javadoc. -->
-
<excludePackageNames>org.apache.sis.internal:org.apache.sis.util.resources:com</excludePackageNames>
+
<excludePackageNames>org.apache.sis.internal:org.apache.sis.util.resources:org.apache.sis.referencing.operation.provider:com</excludePackageNames>
<!-- Custom taglets, some of them implemented in Java. -->
<tags>