You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/03/31 23:07:48 UTC
svn commit: r1670479 [7/12] - in /sis/branches/JDK7: ./
application/sis-console/src/main/java/org/apache/sis/console/
application/sis-webapp/src/main/java/org/apache/sis/services/
core/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/ core...
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=1670479&r1=1670478&r2=1670479&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] Tue Mar 31 21:07:44 2015
@@ -36,16 +36,16 @@ import org.opengis.referencing.operation
* the number of {@linkplain #getTargetDimensions() target dimensions} plus 1.</li>
* </ul>
*
- * {@section Affine transform}
+ * <div class="section">Affine transform</div>
* 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>
+ * <center>
* <img src="../matrix/doc-files/AffineTransform.png" alt="Matrix representation of an affine transform">
- * </p></center>
+ * </center>
*
- * {@section Projective transform}
+ * <div class="section">Projective transform</div>
* 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}
@@ -53,15 +53,15 @@ import org.opengis.referencing.operation
* 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:
*
- * <center><p>{@include formulas.html#ProjectiveTransform}</p></center>
+ * <center>{@include formulas.html#ProjectiveTransform}</center>
*
- * {@section Instantiation}
+ * <div class="section">Instantiation</div>
* 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
- * @version 0.4
+ * @version 0.6
* @module
*
* @see org.apache.sis.referencing.operation.transform.MathTransforms#linear(Matrix)
@@ -71,6 +71,18 @@ import org.opengis.referencing.operation
*/
public interface LinearTransform extends MathTransform {
/**
+ * Returns {@code true} if this transform is affine.
+ * An affine transform preserves parallelism.
+ *
+ * @return {@code true} if this transform is affine.
+ *
+ * @see org.apache.sis.referencing.operation.matrix.MatrixSIS#isAffine()
+ *
+ * @since 0.6
+ */
+ boolean isAffine();
+
+ /**
* 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.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -47,7 +47,7 @@ import static java.lang.Double.doubleToR
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.6
* @module
*
* @see LogarithmicTransform1D
@@ -123,7 +123,7 @@ class LinearTransform1D extends Abstract
* depends on the matrix size. Only matrix elements different from their default value
* will be included in this group.
*
- * @return A copy of the parameter values for this math transform.
+ * @return The parameter values for this math transform.
*/
@Override
public ParameterValueGroup getParameterValues() {
@@ -165,6 +165,14 @@ class LinearTransform1D extends Abstract
}
/**
+ * Returns {@code true} since this transform is affine.
+ */
+ @Override
+ public boolean isAffine() {
+ return true;
+ }
+
+ /**
* Tests whether this transform does not move any points.
*
* <div class="note"><b>Note:</b> this method should always returns {@code false}, since
@@ -328,4 +336,13 @@ class LinearTransform1D extends Abstract
}
return false;
}
+
+ /**
+ * Returns a string representation of this transform as a matrix, for consistency with other
+ * {@link LinearTransform} implementations in Apache SIS.
+ */
+ @Override
+ public String toString() {
+ return Matrices.toString(getMatrix());
+ }
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -35,7 +35,7 @@ import org.apache.sis.util.ComparisonMod
*
* <blockquote>log<sub>base</sub>(<var>x</var>) = ln(<var>x</var>) / ln(base)</blockquote>
*
- * {@section Serialization}
+ * <div class="section">Serialization</div>
* 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.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransformProvider.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -22,6 +22,7 @@ import org.opengis.parameter.ParameterNo
import org.opengis.parameter.InvalidParameterNameException;
import org.opengis.parameter.InvalidParameterValueException;
import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
/**
@@ -40,7 +41,7 @@ import org.opengis.referencing.operation
* Alternative, one can also use a {@linkplain DefaultMathTransformFactory math transform factory}</p>
*
*
- * {@section How to add custom coordinate operations to Apache SIS}
+ * <div class="section">How to add custom coordinate operations to Apache SIS</div>
* {@link DefaultMathTransformFactory} can discover automatically new coordinate operations
* (including map projections) by scanning the classpath. To define a custom coordinate operation,
* one needs to define a <strong>thread-safe</strong> class implementing <strong>both</strong> this
@@ -58,7 +59,7 @@ import org.opengis.referencing.operation
* }
*
* @Override
- * public MathTransform createMathTransform(ParameterValueGroup values) {
+ * public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup parameters) {
* double semiMajor = values.parameter("semi_major").doubleValue(SI.METRE);
* double semiMinor = values.parameter("semi_minor").doubleValue(SI.METRE);
* // etc...
@@ -92,7 +93,7 @@ public interface MathTransformProvider {
* before to instantiate the transform:
*
* {@preformat java
- * public MathTransform createMathTransform(ParameterValueGroup values) {
+ * public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup parameters) {
* double semiMajor = values.parameter("semi_major").doubleValue(SI.METRE);
* double semiMinor = values.parameter("semi_minor").doubleValue(SI.METRE);
* // etc...
@@ -101,15 +102,23 @@ public interface MathTransformProvider {
* }
* </div>
*
- * @param values The group of parameter values.
- * @return The created math transform.
- * @throws InvalidParameterNameException if the values contains an unknown parameter.
+ * <div class="section">Purpose of the factory argument</div>
+ * Some math transforms may actually be implemented as a chain of operation steps, for example a
+ * {@linkplain DefaultMathTransformFactory#createConcatenatedTransform(MathTransform, MathTransform)
+ * concatenation} of {@linkplain DefaultMathTransformFactory#createAffineTransform affine transforms}
+ * with other kind of transforms. In such cases, implementors should use the given factory for creating
+ * the steps.
+ *
+ * @param factory The factory to use if this constructor needs to create other math transforms.
+ * @param parameters The parameter values that define the transform to create.
+ * @return The math transform created from the given parameters.
+ * @throws InvalidParameterNameException if the given parameter group contains an unknown parameter.
* @throws ParameterNotFoundException if a required parameter was not found.
* @throws InvalidParameterValueException if a parameter has an invalid value.
* @throws FactoryException if the math transform can not be created for some other reason
* (for example a required file was not found).
*/
- MathTransform createMathTransform(ParameterValueGroup values)
+ MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup parameters)
throws InvalidParameterNameException, ParameterNotFoundException,
InvalidParameterValueException, FactoryException;
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -32,12 +32,12 @@ import org.apache.sis.referencing.operat
* An immutable and thread-safe set containing the operation methods given by an {@link Iterable}.
* Initial iteration is synchronized on the given {@code Iterable} and the result is cached.
*
- * {@section Rational}
+ * <div class="section">Rational</div>
* We use this class instead than copying the {@link OperationMethod} instances in a {@link java.util.HashSet}
* in order to allow deferred {@code OperationMethod} instantiation, for example in the usual case where the
* iterable is a {@link java.util.ServiceLoader}: we do not invoke {@link Iterator#next()} before needed.
*
- * {@section Limitations}
+ * <div class="section">Limitations</div>
* The usual {@link Set} methods like {@code contains(Object)} are inefficient as they may require a traversal
* of all elements in this set.
*
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -48,11 +48,11 @@ import static org.apache.sis.util.Argume
* }
* </div>
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* {@code PassThroughTransform} is immutable and thread-safe if its {@linkplain #subTransform} is also
* immutable and thread-safe.
*
- * {@section Serialization}
+ * <div class="section">Serialization</div>
* 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.
*
@@ -610,19 +610,20 @@ public class PassThroughTransform extend
* Formats this transform as a <cite>Well Known Text</cite> version 1 (WKT 1) element.
*
* <div class="note"><b>Compatibility note:</b>
- * {@code PassThrough_MT} is defined in the WKT 1 specification only.</div>
+ * {@code PassThrough_MT} is defined in the WKT 1 specification only.
+ * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT 2,
+ * then this method silently uses the WKT 1 convention without raising an error
+ * (unless this {@code PassThroughTransform} can not be formatted as valid WKT 1 neither).</div>
*
* @param formatter The formatter to use.
* @return The WKT element name, which is {@code "PassThrough_MT"}.
*/
@Override
- public String formatTo(final Formatter formatter) {
+ protected String formatTo(final Formatter formatter) {
formatter.append(firstAffectedOrdinate);
if (numTrailingOrdinates != 0) {
formatter.append(numTrailingOrdinates);
formatter.setInvalidWKT(PassThroughTransform.class, null);
- } else if (formatter.getConvention().majorVersion() != 1) {
- formatter.setInvalidWKT(PassThroughTransform.class, null);
}
formatter.append(subTransform);
return "PassThrough_MT";
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -31,7 +31,7 @@ import org.apache.sis.util.ComparisonMod
* <p>Before to make this class public (if we do), we need to revisit the class name, define
* parameters and improve the {@link #concatenate(MathTransform, boolean)} method.</p>
*
- * {@section Serialization}
+ * <div class="section">Serialization</div>
* 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.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -19,18 +19,13 @@ package org.apache.sis.referencing.opera
import java.util.Arrays;
import java.io.Serializable;
import org.opengis.geometry.DirectPosition;
-import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.NoninvertibleTransformException;
-import org.apache.sis.util.ComparisonMode;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
-import org.apache.sis.internal.referencing.provider.Affine;
import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.resources.Errors;
/**
@@ -48,7 +43,7 @@ import org.apache.sis.util.resources.Err
*
* @see java.awt.geom.AffineTransform
*/
-class ProjectiveTransform extends AbstractMathTransform implements LinearTransform, ExtendedPrecisionMatrix,
+class ProjectiveTransform extends AbstractLinearTransform implements LinearTransform, ExtendedPrecisionMatrix,
Serializable // Not Cloneable, despite the clone() method.
{
/**
@@ -137,35 +132,6 @@ class ProjectiveTransform extends Abstra
}
/**
- * Returns a copy of the matrix given to the constructor.
- */
- @Override
- public final Matrix getMatrix() {
- return this;
- }
-
- /**
- * Returns the parameter descriptors for this math transform.
- *
- * @return {@inheritDoc}
- */
- @Override
- public ParameterDescriptorGroup getParameterDescriptors() {
- return Affine.getProvider(getSourceDimensions(), getTargetDimensions(), Matrices.isAffine(this)).getParameters();
- }
-
- /**
- * Returns the matrix elements as a group of parameters values. The number of parameters depends on the
- * matrix size. Only matrix elements different from their default value will be included in this group.
- *
- * @return A copy of the parameter values for this math transform.
- */
- @Override
- public ParameterValueGroup getParameterValues() {
- return Affine.parameters(this);
- }
-
- /**
* Returns a copy of matrix elements, including error terms if any.
*/
@Override
@@ -184,24 +150,6 @@ class ProjectiveTransform extends Abstra
}
/**
- * Unsupported operation, since this matrix is unmodifiable.
- */
- @Override
- public final void setElement(final int row, final int column, final double value) {
- throw new UnsupportedOperationException(Matrices.isAffine(this)
- ? Errors.format(Errors.Keys.UnmodifiableAffineTransform)
- : Errors.format(Errors.Keys.UnmodifiableObject_1, ProjectiveTransform.class));
- }
-
- /**
- * Returns a copy of the matrix that user can modify.
- */
- @Override
- public final Matrix clone() {
- return Matrices.copy(this);
- }
-
- /**
* Tests whether this transform does not move any points.
*
* <div class="note"><b>Note:</b> this method should always returns {@code false}, since
@@ -479,9 +427,7 @@ class ProjectiveTransform extends Abstra
* inverse = this;
* } else { ... }
*/
- MatrixSIS matrix = Matrices.copy(this);
- matrix = matrix.inverse();
- ProjectiveTransform inv = createInverse(matrix);
+ ProjectiveTransform inv = createInverse(Matrices.inverse(this));
inv.inverse = this;
inverse = inv;
}
@@ -507,25 +453,13 @@ class ProjectiveTransform extends Abstra
}
/**
- * {@inheritDoc}
- *
- * @return {@inheritDoc}
+ * Compares this math transform with an object which is known to be an instance of the same class.
*/
@Override
- public boolean equals(final Object object, final ComparisonMode mode) {
- if (object == this) { // Slight optimization
- return true;
- }
- if (mode != ComparisonMode.STRICT) {
- if (object instanceof LinearTransform) {
- return Matrices.equals(this, ((LinearTransform) object).getMatrix(), mode);
- }
- } else if (super.equals(object, mode)) {
- final ProjectiveTransform that = (ProjectiveTransform) object;
- return this.numRow == that.numRow &&
- this.numCol == that.numCol &&
- Arrays.equals(this.elt, that.elt);
- }
- return false;
+ protected boolean equalsSameClass(final Object object) {
+ final ProjectiveTransform that = (ProjectiveTransform) object;
+ return this.numRow == that.numRow &&
+ this.numCol == that.numCol &&
+ Arrays.equals(this.elt, that.elt);
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -43,13 +43,13 @@ import org.apache.sis.util.Debug;
* <td><var>y</var> = scale⋅base<sup><var>x</var></sup> + offset</td></tr>
* </table>
*
- * {@section Missing values}
+ * <div class="section">Missing values</div>
* This {@code TransferFunction} class handles only the continuous part of transfer functions.
* This class does <strong>not</strong> handle missing values other than {@code NaN}.
* For a more complete class with support for non-NaN missing values,
* see {@link org.apache.sis.coverage.grid.GridSampleDimension}.
*
- * {@section Serialization}
+ * <div class="section">Serialization</div>
* 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.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/formulas.html [UTF-8] Tue Mar 31 21:07:44 2015
@@ -113,5 +113,109 @@
</math>
</td></tr>
</table>
+
+
+
+
+ <h2>SwapAxes</h2>
+ <math display="block" alttext="MathML capable browser required">
+ <mfenced open="[" close="]">
+ <mtable>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>1</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>1</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>1</mn></mtd>
+ </mtr>
+ </mtable>
+ </mfenced>
+ </math>
+
+
+
+
+ <h2>NormalizeGeographic</h2>
+ <math display="block" alttext="MathML capable browser required">
+ <mfenced open="[" close="]">
+ <mtable>
+ <mtr>
+ <mtd><mi>π</mi><mo>/</mo><mn>180</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mo>-</mo><mo>(</mo><mi>π</mi><mo>/</mo><mn>180</mn><mo>)</mo> <mo>⋅</mo> <msub><mi>λ</mi><mn>0</mn></msub></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mi>π</mi><mo>/</mo><mn>180</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>1</mn></mtd>
+ </mtr>
+ </mtable>
+ </mfenced>
+ </math>
+
+
+
+
+ <h2>DeormalizeGeographic</h2>
+ <math display="block" alttext="MathML capable browser required">
+ <mfenced open="[" close="]">
+ <mtable>
+ <mtr>
+ <mtd><mi>180</mi><mo>/</mo><mn>π</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><msub><mi>λ</mi><mn>0</mn></msub></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mi>180</mi><mo>/</mo><mn>π</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>1</mn></mtd>
+ </mtr>
+ </mtable>
+ </mfenced>
+ </math>
+
+
+
+
+ <h2>DenormalizeCartesian</h2>
+ <math display="block" alttext="MathML capable browser required">
+ <mfenced open="[" close="]">
+ <mtable>
+ <mtr>
+ <mtd><mi>a</mi> <mo>⋅</mo> <msub><mi>k</mi><mn>0</mn></msub></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mi>FE</mi></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mi>a</mi> <mo>⋅</mo> <msub><mi>k</mi><mn>0</mn></msub></mtd>
+ <mtd><mi>FN</mi></mtd>
+ </mtr>
+ <mtr>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>0</mn></mtd>
+ <mtd><mn>1</mn></mtd>
+ </mtr>
+ </mtable>
+ </mfenced>
+ </math>
</body>
</html>
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -38,7 +38,7 @@
* in their own {@linkplain org.apache.sis.referencing.operation.projection projection} package.</p>
*
*
- * {@section Creating math transforms}
+ * <div class="section">Creating math transforms</div>
* {@code MathTransform} instances can be created either directly or indirectly.
* The recommended way is the indirect one: first
* {@linkplain org.apache.sis.referencing.CRS#findOperation find the coordinate operation}
@@ -49,7 +49,7 @@
* transform factory}.
*
*
- * {@section Non-spatial coordinates}
+ * <div class="section">Non-spatial coordinates</div>
* {@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
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -25,14 +25,14 @@
* as well as 4D, 5D, <i>etc</i>. An other less-frequently used kind of Reference System uses labels instead, as in
* postal address. This package is the root for both kinds, with an emphasis on the one for coordinates.</p>
*
- * {@section Fetching geodetic object instances}
+ * <div class="section">Fetching geodetic object instances</div>
* Geodetic objects can be instantiated either directly by specifying all information to a factory method
* or constructor, or indirectly by specifying the identifier of an entry in a database. In particular,
* the <a href="http://www.epsg.org">EPSG</a> database provides definitions for many geodetic objects,
* and Apache SIS provides convenience shortcuts for some of them in the
* {@link org.apache.sis.referencing.CommonCRS} enumerations.
*
- * {@section The EPSG database}
+ * <div class="section">The EPSG database</div>
* The EPSG geodetic parameter dataset is a structured database required to:
*
* <ul>
Modified: sis/branches/JDK7/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] Tue Mar 31 21:07:44 2015
@@ -1,3 +1,8 @@
# Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
+# Heavier classes (e.g. having more dependencies) or classes less likely to be used, should be last.
org.apache.sis.internal.referencing.provider.Affine
org.apache.sis.internal.referencing.provider.LongitudeRotation
+org.apache.sis.internal.referencing.provider.Mercator1SP
+org.apache.sis.internal.referencing.provider.Mercator2SP
+org.apache.sis.internal.referencing.provider.PseudoMercator
+org.apache.sis.internal.referencing.provider.MillerCylindrical
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -16,6 +16,7 @@
*/
package org.apache.sis.internal.referencing;
+import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -47,7 +48,7 @@ public final strictfp class FormulasTest
@Test
public void testPow3() {
for (int n=0; n<=8; n++) {
- assertEquals((int) Math.round(Math.pow(3, n)), Formulas.pow3(n));
+ assertEquals((int) StrictMath.round(StrictMath.pow(3, n)), Formulas.pow3(n));
}
}
@@ -70,10 +71,11 @@ public final strictfp class FormulasTest
* <li>Inverse flattening: 298.257222101</li>
* </ul>
*
- * Expected result is the radius of <cite>GRS 1980 Authalic Sphere</cite> (EPSG:7048).
+ * Expected result is the radius of <cite>GRS 1980 Authalic Sphere</cite> (EPSG:7048),
+ * which is 6371007 metres.
*/
@Test
public void testGetAuthalicRadius() {
- assertEquals(6371007, Formulas.getAuthalicRadius(6378137, 6356752), 0.5);
+ assertEquals(ReferencingServices.AUTHALIC_RADIUS, Formulas.getAuthalicRadius(6378137, 6356752), 0.5);
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -90,7 +90,7 @@ public final strictfp class OperationMet
}
/**
- * Tests {@link OperationMethods#checkDimensions(OperationMethod, MathTransform)}.
+ * Tests {@link OperationMethods#checkDimensions(OperationMethod, MathTransform, Map)}.
*/
@Test
public void testCheckDimensions() {
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/j2d/ShapeUtilitiesViewer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/j2d/ShapeUtilitiesViewer.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/j2d/ShapeUtilitiesViewer.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/j2d/ShapeUtilitiesViewer.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -157,7 +157,7 @@ final strictfp class ShapeUtilitiesViewe
break;
}
case COLINEAR_POINT: {
- final double distance = Math.hypot(x4, y4);
+ final double distance = StrictMath.hypot(x4, y4);
input.moveTo(x1, y1);
input.lineTo(x2, y2);
addPoint(input, x3, y3);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -47,7 +47,7 @@ public final strictfp class LongitudeRot
final LongitudeRotation provider = new LongitudeRotation();
ParameterValueGroup p = provider.getParameters().createValue();
p.parameter(LongitudeRotation.NAME).setValue(2.5969213, NonSI.GRADE); // Paris meridian
- final MathTransform mt = provider.createMathTransform(p);
+ final MathTransform mt = provider.createMathTransform(null, p);
/*
* Verify the full matrix. Note that the longitude offset is expected to be in degrees.
* This conversion from grad to degrees is specific to Apache SIS and may be revised in
@@ -74,6 +74,6 @@ public final strictfp class LongitudeRot
"Param_MT[“Affine”,\n" +
" Parameter[“num_row”, 3],\n" +
" Parameter[“num_col”, 3],\n" +
- " Parameter[“elt_0_2”, 2.33722917]]", provider.createMathTransform(p));
+ " Parameter[“elt_0_2”, 2.33722917]]", provider.createMathTransform(null, p));
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -16,11 +16,16 @@
*/
package org.apache.sis.internal.referencing.provider;
+import org.opengis.util.GenericName;
+import org.opengis.metadata.Identifier;
+import org.opengis.parameter.GeneralParameterDescriptor;
+import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.util.Constants;
+import org.apache.sis.test.ReferencingAssert;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.apache.sis.test.ReferencingAssert.*;
+import static org.junit.Assert.*;
/**
@@ -37,8 +42,8 @@ public final strictfp class MapProjectio
*/
@Test
public void testSemiAxes() {
- assertOgcIdentifierEquals(Constants.SEMI_MAJOR, MapProjection.SEMI_MAJOR.getName());
- assertOgcIdentifierEquals(Constants.SEMI_MINOR, MapProjection.SEMI_MINOR.getName());
+ assertOgcNameEquals(Constants.SEMI_MAJOR, MapProjection.SEMI_MAJOR);
+ assertOgcNameEquals(Constants.SEMI_MINOR, MapProjection.SEMI_MINOR);
}
/**
@@ -46,11 +51,68 @@ public final strictfp class MapProjectio
*/
@Test
public void testMercator1SP() {
- assertEpsgIdentifierEquals("Mercator (variant A)", new Mercator1SP().getName());
- assertEpsgIdentifierEquals("Latitude of natural origin", Mercator1SP.LATITUDE_OF_ORIGIN.getName());
- assertEpsgIdentifierEquals("Longitude of natural origin", Mercator1SP.CENTRAL_MERIDIAN .getName());
- assertEpsgIdentifierEquals("Scale factor at natural origin", Mercator1SP.SCALE_FACTOR .getName());
- assertEpsgIdentifierEquals("False easting", Mercator1SP.FALSE_EASTING .getName());
- assertEpsgIdentifierEquals("False northing", Mercator1SP.FALSE_NORTHING .getName());
+ assertEpsgNameEquals("Mercator (variant A)", Mercator1SP.PARAMETERS);
+ assertEpsgNameEquals("Latitude of natural origin", Mercator1SP.LATITUDE_OF_ORIGIN);
+ assertEpsgNameEquals("Longitude of natural origin", Mercator1SP.CENTRAL_MERIDIAN);
+ assertEpsgNameEquals("Scale factor at natural origin", Mercator1SP.SCALE_FACTOR);
+ assertEpsgNameEquals("False easting", Mercator1SP.FALSE_EASTING);
+ assertEpsgNameEquals("False northing", Mercator1SP.FALSE_NORTHING);
+
+ assertOgcAliasEquals("Mercator_1SP", Mercator1SP.PARAMETERS);
+ assertOgcAliasEquals("latitude_of_origin", Mercator1SP.LATITUDE_OF_ORIGIN);
+ assertOgcAliasEquals("central_meridian", Mercator1SP.CENTRAL_MERIDIAN);
+ assertOgcAliasEquals("scale_factor", Mercator1SP.SCALE_FACTOR);
+ assertOgcAliasEquals("false_easting", Mercator1SP.FALSE_EASTING);
+ assertOgcAliasEquals("false_northing", Mercator1SP.FALSE_NORTHING);
+ }
+
+ /**
+ * Verifies some {@link Mercator2SP} parameter descriptors.
+ */
+ @Test
+ public void testMercator2SP() {
+ assertEpsgNameEquals("Mercator (variant B)", Mercator2SP.PARAMETERS);
+ assertEpsgNameEquals("Latitude of 1st standard parallel", Mercator2SP.STANDARD_PARALLEL);
+ assertEpsgNameEquals("Latitude of natural origin", Mercator2SP.LATITUDE_OF_ORIGIN);
+ assertEpsgNameEquals("Longitude of natural origin", Mercator2SP.CENTRAL_MERIDIAN);
+ assertEpsgNameEquals("Scale factor at natural origin", Mercator2SP.SCALE_FACTOR);
+ assertEpsgNameEquals("False easting", Mercator2SP.FALSE_EASTING);
+ assertEpsgNameEquals("False northing", Mercator2SP.FALSE_NORTHING);
+
+ assertOgcAliasEquals("Mercator_2SP", Mercator2SP.PARAMETERS);
+ assertOgcAliasEquals("standard_parallel_1", Mercator2SP.STANDARD_PARALLEL);
+ assertOgcAliasEquals("latitude_of_origin", Mercator2SP.LATITUDE_OF_ORIGIN);
+ assertOgcAliasEquals("central_meridian", Mercator2SP.CENTRAL_MERIDIAN);
+ assertOgcAliasEquals("scale_factor", Mercator2SP.SCALE_FACTOR);
+ assertOgcAliasEquals("false_easting", Mercator2SP.FALSE_EASTING);
+ assertOgcAliasEquals("false_northing", Mercator2SP.FALSE_NORTHING);
+ }
+
+ /**
+ * Asserts that the primary name of the given parameter is the given name in the EPSG namespace.
+ */
+ private static void assertEpsgNameEquals(final String expected, final GeneralParameterDescriptor actual) {
+ ReferencingAssert.assertEpsgIdentifierEquals(expected, actual.getName());
+ }
+
+ /**
+ * Asserts that the primary name of the given parameter is the given name in the OGC namespace.
+ */
+ private static void assertOgcNameEquals(final String expected, final GeneralParameterDescriptor actual) {
+ ReferencingAssert.assertOgcIdentifierEquals(expected, actual.getName());
+ }
+
+ /**
+ * Asserts that the first alias (ignoring other EPSG alias)
+ * of the given parameter is the given name in the OGC namespace.
+ */
+ private static void assertOgcAliasEquals(final String expected, final GeneralParameterDescriptor actual) {
+ for (final GenericName alias : actual.getAlias()) {
+ if (alias instanceof Identifier && ((Identifier) alias).getAuthority() != Citations.OGP) {
+ ReferencingAssert.assertOgcIdentifierEquals(expected, (Identifier) alias);
+ return;
+ }
+ }
+ fail("OGC alias not found.");
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -57,7 +57,7 @@ public final strictfp class DefaultParam
* The very last parameter has a maximum number of occurrence of 2, which is illegal
* according ISO 19111 but nevertheless supported by Apache SIS.
*/
- static final DefaultParameterDescriptorGroup M1_M1_O1_O2;
+ public static final DefaultParameterDescriptorGroup M1_M1_O1_O2;
static {
final Class<Integer> type = Integer.class;
final Map<String,Object> properties = new HashMap<>(4);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -73,7 +73,7 @@ public final strictfp class ParameterBui
}
/**
- * Tests the "<cite>Mercator (variant A)</cite>" example given in Javadoc.
+ * Tests the <cite>"Mercator (variant A)"</cite> example given in Javadoc.
*/
@Test
@DependsOnMethod("testCreate")
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorParametersTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -302,7 +302,7 @@ public strictfp class TensorParametersTe
@Test
@DependsOnMethod("testGetAllDescriptors")
public void testMatrixConversion() {
- final int size = Math.min(6, TensorParameters.CACHE_SIZE);
+ final int size = StrictMath.min(6, TensorParameters.CACHE_SIZE);
final Random random = TestUtilities.createRandomNumberGenerator();
for (int numRow = 2; numRow <= size; numRow++) {
for (int numCol = 2; numCol <= size; numCol++) {
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -19,8 +19,10 @@ package org.apache.sis.referencing;
import org.opengis.util.NameSpace;
import org.opengis.util.LocalName;
import org.opengis.util.GenericName;
+import org.opengis.util.NameFactory;
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.Identifier;
+import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
@@ -29,7 +31,6 @@ import org.junit.Test;
import static org.junit.Assert.*;
import static org.opengis.referencing.IdentifiedObject.*;
import static org.apache.sis.metadata.iso.citation.HardCodedCitations.*;
-import static org.apache.sis.internal.system.DefaultFactories.SIS_NAMES;
/**
@@ -99,11 +100,13 @@ public final strictfp class BuilderTest
*/
@Test
public void testUnscopedName() {
+ final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
+
// Expected values to be used later in the test.
final String name = "Mercator (variant A)";
- final LocalName alias1 = SIS_NAMES.createLocalName(null, "Mercator (1SP)");
- final LocalName alias2 = SIS_NAMES.createLocalName(null, "Mercator_1SP");
- final LocalName alias3 = SIS_NAMES.createLocalName(null, "CT_Mercator");
+ final LocalName alias1 = factory.createLocalName(null, "Mercator (1SP)");
+ final LocalName alias2 = factory.createLocalName(null, "Mercator_1SP");
+ final LocalName alias3 = factory.createLocalName(null, "CT_Mercator");
assertEquals("Mercator (1SP)", alias1.toString());
assertEquals("Mercator_1SP", alias2.toString());
assertEquals("CT_Mercator", alias3.toString());
@@ -126,12 +129,13 @@ public final strictfp class BuilderTest
@Test
@DependsOnMethod({"testUnscopedName", "testSetCodeSpace"})
public void testScopedName() {
+ final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
+
// Expected values to be used later in the test.
final String name = "Mercator (variant A)";
- final GenericName alias1 = SIS_NAMES.createLocalName(scope("EPSG"), "Mercator (1SP)");
+ final GenericName alias1 = factory.createLocalName(scope(factory, "EPSG"), "Mercator (1SP)");
final GenericName alias2 = new NamedIdentifier(OGC, "Mercator_1SP");
final GenericName alias3 = new NamedIdentifier(GEOTIFF, "CT_Mercator");
- assertEquals("Mercator (variant A)", name .toString());
assertEquals("Mercator (1SP)", alias1.toString());
assertEquals("OGC:Mercator_1SP", alias2.toString());
assertEquals("GeoTIFF:CT_Mercator", alias3.toString());
@@ -153,8 +157,8 @@ public final strictfp class BuilderTest
/**
* Convenience method creating a namespace for {@link #testScopedName()} purpose.
*/
- private static NameSpace scope(final String codespace) {
- return SIS_NAMES.createNameSpace(SIS_NAMES.createLocalName(null, codespace), null);
+ private static NameSpace scope(final NameFactory factory, final String codespace) {
+ return factory.createNameSpace(factory.createLocalName(null, codespace), null);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/IdentifiedObjectsTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -17,6 +17,7 @@
package org.apache.sis.referencing;
import org.opengis.util.GenericName;
+import org.opengis.util.NameFactory;
import org.opengis.referencing.IdentifiedObject;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.test.mock.IdentifiedObjectMock;
@@ -41,7 +42,8 @@ public final strictfp class IdentifiedOb
*/
@Test
public void testIsHeuristicMatchForName() {
- final GenericName name = DefaultFactories.SIS_NAMES.createGenericName(null, "myScope", "myName");
+ final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
+ final GenericName name = factory.createGenericName(null, "myScope", "myName");
IdentifiedObjectMock object = new IdentifiedObjectMock("myCode ", name); // Intentional trailing space.
// Test the code.
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/NamedIdentifierTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -20,15 +20,16 @@ import java.util.Locale;
import org.opengis.util.InternationalString;
import org.opengis.util.NameSpace;
import org.opengis.util.GenericName;
+import org.opengis.util.NameFactory;
import org.opengis.metadata.Identifier;
import org.opengis.test.Validators;
+import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.util.iso.DefaultInternationalString;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.internal.system.DefaultFactories.SIS_NAMES;
import static org.apache.sis.metadata.iso.citation.HardCodedCitations.OGP;
import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
@@ -77,8 +78,9 @@ public final strictfp class NamedIdentif
*/
@Test
public void testCreateFromName() {
- final NameSpace scope = SIS_NAMES.createNameSpace(SIS_NAMES.createLocalName(null, "OGP"), null);
- final NamedIdentifier identifier = new NamedIdentifier(SIS_NAMES.createGenericName(scope, "EPSG", "4326"));
+ final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
+ final NameSpace scope = factory.createNameSpace(factory.createLocalName(null, "OGP"), null);
+ final NamedIdentifier identifier = new NamedIdentifier(factory.createGenericName(scope, "EPSG", "4326"));
Validators.validate((Identifier) identifier);
Validators.validate((GenericName) identifier);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -57,7 +57,7 @@ public final strictfp class DefaultGeoce
/**
* Tests WKT 2 formatting.
*
- * {@section Note on axis names}
+ * <div class="section">Note on axis names</div>
* ISO 19162 said: “For geodetic CRSs having a geocentric Cartesian coordinate system,
* the axis name should be omitted as it is given through the mandatory axis direction,
* but the axis abbreviation, respectively ‘X’, 'Y' and ‘Z’, shall be given.”
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -38,7 +38,7 @@ public final strictfp class HardCodedAxe
* Axis for geodetic longitudes in a {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#EAST East}
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
- * The ISO 19111 name is "<cite>geodetic longitude</cite>" and the abbreviation is "λ" (lambda).
+ * The ISO 19111 name is <cite>"geodetic longitude"</cite> and the abbreviation is "λ" (lambda).
*
* <p>This axis is usually part of a {@link #GEODETIC_LONGITUDE}, {@link #GEODETIC_LATITUDE},
* {@link #ELLIPSOIDAL_HEIGHT} set.</p>
@@ -53,7 +53,7 @@ public final strictfp class HardCodedAxe
* Axis for geodetic latitudes in a {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#NORTH North}
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
- * The ISO 19111 name is "<cite>geodetic latitude</cite>" and the abbreviation is "φ" (phi).
+ * The ISO 19111 name is <cite>"geodetic latitude"</cite> and the abbreviation is "φ" (phi).
*
* <p>This axis is usually part of a {@link #GEODETIC_LONGITUDE}, {@link #GEODETIC_LATITUDE},
* {@link #ELLIPSOIDAL_HEIGHT} set.</p>
@@ -98,7 +98,7 @@ public final strictfp class HardCodedAxe
* Axis for height values above the ellipsoid in a
* {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#UP up} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>ellipsoidal height</cite>" and the abbreviation is lower case "<var>h</var>".
+ * The ISO 19111 name is <cite>"ellipsoidal height"</cite> and the abbreviation is lower case <cite>"h"</cite>.
*
* <p>This axis is usually part of a {@link #GEODETIC_LONGITUDE}, {@link #GEODETIC_LATITUDE},
* {@link #ELLIPSOIDAL_HEIGHT} set.</p>
@@ -114,7 +114,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for height values measured from gravity.
* Increasing ordinates values go {@linkplain AxisDirection#UP up} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>gravity-related height</cite>" and the abbreviation is upper case "<var>H</var>".
+ * The ISO 19111 name is <cite>"gravity-related height"</cite> and the abbreviation is upper case <cite>"H"</cite>.
*
* @see #ALTITUDE
* @see #ELLIPSOIDAL_HEIGHT
@@ -133,7 +133,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for altitude values.
* Increasing ordinates values go {@linkplain AxisDirection#UP up} and units are {@linkplain SI#METRE metres}.
- * The abbreviation is lower case "<var>h</var>".
+ * The abbreviation is lower case <cite>"h"</cite>.
*
* <p>This axis is usually part of a {@link #GEODETIC_LONGITUDE}, {@link #GEODETIC_LATITUDE},
* {@link #ALTITUDE} tuple.</p>
@@ -149,7 +149,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for depth.
* Increasing ordinates values go {@linkplain AxisDirection#DOWN down} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>depth</cite>".
+ * The ISO 19111 name is <cite>"depth"</cite>.
*
* @see #ALTITUDE
* @see #ELLIPSOIDAL_HEIGHT
@@ -163,7 +163,7 @@ public final strictfp class HardCodedAxe
* Axis for radius in a {@linkplain org.apache.sis.referencing.crs.DefaultGeocentricCRS geocentric CRS}
* using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
* Increasing ordinates values go {@linkplain AxisDirection#UP up} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>geocentric radius</cite>" and the abbreviation is lower case "<var>r</var>".
+ * The ISO 19111 name is <cite>"geocentric radius"</cite> and the abbreviation is lower case <cite>"r"</cite>.
*
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -181,7 +181,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
* Increasing ordinates values go {@linkplain AxisDirection#EAST East}
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
- * The ISO 19111 name is "<cite>spherical longitude</cite>" and the abbreviation is "Ω" (omega).
+ * The ISO 19111 name is <cite>"spherical longitude"</cite> and the abbreviation is "Ω" (omega).
*
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -197,7 +197,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
* Increasing ordinates values go {@linkplain AxisDirection#NORTH North}
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
- * The ISO 19111 name is "<cite>spherical latitude</cite>" and the abbreviation is "Θ" (theta).
+ * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation is "Θ" (theta).
*
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -211,7 +211,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for <var>x</var> values in a {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian CS}.
* Increasing ordinates values go {@linkplain AxisDirection#EAST East} and units are {@linkplain SI#METRE metres}.
- * The abbreviation is lower case "<var>x</var>".
+ * The abbreviation is lower case <cite>"x"</cite>.
*
* <p>This axis is usually part of a {@link #X}, {@link #Y}, {@link #Z} set.</p>
*
@@ -227,7 +227,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for <var>y</var> values in a {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian CS}.
* Increasing ordinates values go {@linkplain AxisDirection#NORTH North} and units are {@linkplain SI#METRE metres}.
- * The abbreviation is lower case "<var>y</var>".
+ * The abbreviation is lower case <cite>"y"</cite>.
*
* <p>This axis is usually part of a {@link #X}, {@link #Y}, {@link #Z} set.</p>
*
@@ -243,7 +243,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for <var>z</var> values in a {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian CS}.
* Increasing ordinates values go {@linkplain AxisDirection#UP up} and units are {@linkplain SI#METRE metres}.
- * The abbreviation is lower case "<var>z</var>".
+ * The abbreviation is lower case <cite>"z"</cite>.
*
* <p>This axis is usually part of a {@link #X}, {@link #Y}, {@link #Z} set.</p>
*/
@@ -255,7 +255,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian CS}.
* Increasing ordinates values goes typically toward prime meridian, but the actual axis direction
* is {@link AxisDirection#GEOCENTRIC_X GEOCENTRIC_X}. The units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>Geocentric X</cite>" and the abbreviation is upper case "<var>X</var>".
+ * The ISO 19111 name is <cite>"Geocentric X"</cite> and the abbreviation is upper case <cite>"X"</cite>.
*
* <p>In legacy OGC 01-009 specification (still in use for WKT 1 format),
* the direction was {@link AxisDirection#OTHER OTHER}).</p>
@@ -270,7 +270,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian CS}.
* Increasing ordinates values goes typically toward East, but the actual axis direction is
* {@link AxisDirection#GEOCENTRIC_Y GEOCENTRIC_Y}. The units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>Geocentric Y</cite>" and the abbreviation is upper case "<var>Y</var>".
+ * The ISO 19111 name is <cite>"Geocentric Y"</cite> and the abbreviation is upper case <cite>"Y"</cite>.
*
* <p>In legacy OGC 01-009 specification (still in use for WKT 1 format),
* the direction was {@link AxisDirection#EAST EAST}).</p>
@@ -285,7 +285,7 @@ public final strictfp class HardCodedAxe
* using {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian CS}.
* Increasing ordinates values goes typically toward North, but the actual axis direction is
* {@link AxisDirection#GEOCENTRIC_Z GEOCENTRIC_Z}. The units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>Geocentric Z</cite>" and the abbreviation is upper case "<var>Z</var>".
+ * The ISO 19111 name is <cite>"Geocentric Z"</cite> and the abbreviation is upper case <cite>"Z"</cite>.
*
* <p>In legacy OGC 01-009 specification (still in use for WKT 1 format),
* the direction was {@link AxisDirection#NORTH NORTH}).</p>
@@ -298,7 +298,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for Easting values in a {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#EAST East} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>easting</cite>" and the abbreviation is upper case "<var>E</var>".
+ * The ISO 19111 name is <cite>"easting"</cite> and the abbreviation is upper case <cite>"E"</cite>.
*
* <p>This axis is usually part of a {@link #EASTING}, {@link #NORTHING} set.</p>
*
@@ -312,7 +312,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for Westing values in a {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#WEST West} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>westing</cite>" and the abbreviation is upper case "<var>W</var>".
+ * The ISO 19111 name is <cite>"westing"</cite> and the abbreviation is upper case <cite>"W"</cite>.
*
* @see #X
* @see #EASTING
@@ -324,7 +324,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for Northing values in a {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#NORTH North} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>northing</cite>" and the abbreviation is upper case "<var>N</var>".
+ * The ISO 19111 name is <cite>"northing"</cite> and the abbreviation is upper case <cite>"N"</cite>.
*
* <p>This axis is usually part of a {@link #EASTING}, {@link #NORTHING} set.</p>
*
@@ -338,7 +338,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for Southing values in a {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected CRS}.
* Increasing ordinates values go {@linkplain AxisDirection#SOUTH South} and units are {@linkplain SI#METRE metres}.
- * The ISO 19111 name is "<cite>southing</cite>" and the abbreviation is upper case "<var>S</var>".
+ * The ISO 19111 name is <cite>"southing"</cite> and the abbreviation is upper case <cite>"S"</cite>.
*
* @see #Y
* @see #NORTHING
@@ -362,7 +362,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for time values in a {@linkplain org.apache.sis.referencing.cs.DefaultTimeCS time CS}.
* Increasing time go toward {@linkplain AxisDirection#FUTURE future} and units are {@linkplain NonSI#DAY days}.
- * The abbreviation is lower case "<var>t</var>".
+ * The abbreviation is lower case <cite>"t"</cite>.
*/
public static final DefaultCoordinateSystemAxis TIME = create("Time", "t",
AxisDirection.FUTURE, NonSI.DAY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
@@ -370,7 +370,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for column indices in a {@linkplain org.opengis.coverage.grid.GridCoverage grid coverage}.
* Increasing values go toward {@linkplain AxisDirection#COLUMN_POSITIVE positive column number}.
- * The abbreviation is lower case "<var>i</var>".
+ * The abbreviation is lower case <cite>"i"</cite>.
*/
public static final DefaultCoordinateSystemAxis COLUMN = create("Column", "i",
AxisDirection.COLUMN_POSITIVE, Unit.ONE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
@@ -378,7 +378,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for row indices in a {@linkplain org.opengis.coverage.grid.GridCoverage grid coverage}.
* Increasing values go toward {@linkplain AxisDirection#ROW_POSITIVE positive row number}.
- * The abbreviation is lower case "<var>j</var>".
+ * The abbreviation is lower case <cite>"j"</cite>.
*/
public static final DefaultCoordinateSystemAxis ROW = create("Row", "j",
AxisDirection.ROW_POSITIVE, Unit.ONE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
@@ -386,7 +386,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for <var>x</var> values in a display device.
* Increasing values go toward {@linkplain AxisDirection#DISPLAY_RIGHT display right}.
- * The abbreviation is lower case "<var>x</var>".
+ * The abbreviation is lower case <cite>"x"</cite>.
*/
public static final DefaultCoordinateSystemAxis DISPLAY_X = create("x", "x",
AxisDirection.DISPLAY_RIGHT, Unit.ONE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
@@ -394,7 +394,7 @@ public final strictfp class HardCodedAxe
/**
* Axis for <var>y</var> values in a display device.
* Increasing values go toward {@linkplain AxisDirection#DISPLAY_DOWN display down}.
- * The abbreviation is lower case "<var>y</var>".
+ * The abbreviation is lower case <cite>"y"</cite>.
*/
public static final DefaultCoordinateSystemAxis DISPLAY_Y = create("y", "y",
AxisDirection.DISPLAY_DOWN, Unit.ONE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -183,7 +183,7 @@ public final strictfp class LinearTransf
final Matrix m = builder.create().getMatrix();
assertEquals("m₀₀", scale, m.getElement(0, 0), scaleTolerance);
assertEquals("m₀₁", offset, m.getElement(0, 1), translationTolerance);
- assertEquals("correlation", 1, Math.abs(builder.correlation()[0]), scaleTolerance);
+ assertEquals("correlation", 1, StrictMath.abs(builder.correlation()[0]), scaleTolerance);
}
/**
@@ -201,9 +201,9 @@ public final strictfp class LinearTransf
* Create an AffineTransform to use as the reference implementation.
*/
final AffineTransform ref = AffineTransform.getRotateInstance(
- rd.nextDouble() * (2 * Math.PI), // Rotation angle
- rd.nextDouble() * 30 - 12, // Center X
- rd.nextDouble() * 10 - 8); // Center Y
+ rd.nextDouble() * (2 * StrictMath.PI), // Rotation angle
+ rd.nextDouble() * 30 - 12, // Center X
+ rd.nextDouble() * 10 - 8); // Center Y
final DirectPosition2D[] sources = new DirectPosition2D[numPts];
final DirectPosition2D[] targets = new DirectPosition2D[numPts];
for (int i=0; i<numPts; i++) {
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -28,7 +28,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.6
* @module
*/
public final strictfp class GeneralMatrixTest extends MatrixTestCase {
@@ -93,4 +93,16 @@ public final strictfp class GeneralMatri
-2.2204460492503132E-17,
-2.5483615218035994E-18}, elements, STRICT);
}
+
+ /**
+ * Tests {@link MatrixSIS#concatenate(int, Number, Number)} using {@link AffineTranform}
+ * as a reference implementation.
+ *
+ * @since 0.6
+ */
+ @Test
+ public void testConcatenate() {
+ testConcatenate(new GeneralMatrix(3, 3, true, 1), true); // Double precision
+ testConcatenate(new GeneralMatrix(3, 3, true, 2), true); // Double-double precision
+ }
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -29,7 +29,7 @@ import static org.apache.sis.referencing
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.6
* @module
*/
@DependsOn(SolverTest.class)
@@ -100,4 +100,15 @@ public final strictfp class Matrix3Test
// Now the actual test.
assertEqualsElements(expected, SIZE, SIZE, A.solve(B), TOLERANCE);
}
+
+ /**
+ * Tests {@link MatrixSIS#concatenate(int, Number, Number)} using {@link AffineTranform}
+ * as a reference implementation.
+ *
+ * @since 0.6
+ */
+ @Test
+ public void testConcatenate() {
+ testConcatenate(new Matrix3(), true);
+ }
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -17,6 +17,7 @@
package org.apache.sis.referencing.operation.matrix;
import java.util.Random;
+import java.awt.geom.AffineTransform;
import Jama.Matrix;
import org.apache.sis.math.Statistics;
import org.apache.sis.internal.util.DoubleDouble;
@@ -45,7 +46,7 @@ import static org.apache.sis.test.Assert
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.6
* @module
*/
public abstract strictfp class MatrixTestCase extends TestCase {
@@ -73,7 +74,7 @@ public abstract strictfp class MatrixTes
* which is {@value}. Note that the matrix element values used in this class vary between 0 and 100,
* and the {@code StrictMath.ulp(100.0)} value is approximatively 1.4E-14.
*
- * {@section How this value is determined}
+ * <div class="section">How this value is determined</div>
* Experience (by looking at {@link #statistics}) shows that the differences are usually smaller than 1E-12.
* However when using non-determinist sequence of random values ({@link #DETERMINIST} sets to {@code false}),
* we do have from time-to-time a difference around 1E-9.
@@ -195,6 +196,29 @@ public abstract strictfp class MatrixTes
}
/**
+ * Asserts that an element from the given matrix is equals to the expected value, using a relative threshold.
+ */
+ private static void assertEqualsRelative(final String message, final double expected,
+ final MatrixSIS matrix, final int row, final int column)
+ {
+ assertEquals(message, expected, matrix.getElement(row, column), StrictMath.abs(expected) * 1E-12);
+ }
+
+ /**
+ * Returns the next random number as a value between approximatively -100 and 100
+ * with the guarantee to be different than zero. The values returned by this method
+ * are suitable for testing scale factors.
+ */
+ private double nextNonZeroRandom() {
+ double value = random.nextDouble() * 200 - 100;
+ value += StrictMath.copySign(0.001, value);
+ if (random.nextBoolean()) {
+ value = 1 / value;
+ }
+ return value;
+ }
+
+ /**
* Creates an array of the given length filled with random values. All random values are between 0 inclusive
* and 100 exclusive. This method never write negative values. Consequently, any strictly negative value set
* by the test method is guaranteed to be different than all original values in the returned array.
@@ -372,6 +396,71 @@ public abstract strictfp class MatrixTes
}
}
+ /**
+ * Tests {@link MatrixSIS#concatenate(int, Number, Number)} using {@link AffineTranform}
+ * as a reference implementation. This test can be run only with matrices of size 3×3.
+ * Consequently it is sub-classes responsibility to add a {@code testConcatenate()} method
+ * which invoke this method.
+ *
+ * @param matrix The matrix of size 3×3 to test.
+ * @param withShear {@code true} for including shear in the matrix to test.
+ * This value can be set to {@code false} if the subclass want to test a simpler case.
+ *
+ * @since 0.6
+ */
+ final void testConcatenate(final MatrixSIS matrix, final boolean withShear) {
+ initialize(4599164481916500056L);
+ final AffineTransform at = new AffineTransform();
+ if (withShear) {
+ at.shear(nextNonZeroRandom(), nextNonZeroRandom());
+ matrix.setElement(0, 1, at.getShearX());
+ matrix.setElement(1, 0, at.getShearY());
+ }
+ for (int i=0; i<100; i++) {
+ /*
+ * 1) For the first 30 iterations, test the result of applying only a scale.
+ * 2) For the next 30 iterations, test the result of applying only a translation.
+ * 3) For all remaining iterations, test combination of scale and translation.
+ */
+ final Number scale = (i >= 60 || i < 30) ? nextNonZeroRandom() : null;
+ final Number offset = (i >= 30) ? nextNonZeroRandom() : null;
+ /*
+ * Apply the scale and offset on the affine transform, which we use as the reference
+ * implementation. The scale and offset must be applied in the exact same order than
+ * the order documented in MatrixSIS.concatenate(…) javadoc.
+ */
+ final int srcDim = (i & 1);
+ if (offset != null) {
+ switch (srcDim) {
+ case 0: at.translate(offset.doubleValue(), 0); break;
+ case 1: at.translate(0, offset.doubleValue()); break;
+ }
+ }
+ if (scale != null) {
+ switch (srcDim) {
+ case 0: at.scale(scale.doubleValue(), 1); break;
+ case 1: at.scale(1, scale.doubleValue()); break;
+ }
+ }
+ /*
+ * Apply the operation and compare with our reference implementation.
+ */
+ matrix.concatenate(srcDim, scale, offset);
+ final String message = (offset == null) ? "After scale" :
+ (scale == null) ? "After translate" : "After scale and translate";
+ assertEqualsRelative(message, 0, matrix, 2, 0);
+ assertEqualsRelative(message, 0, matrix, 2, 1);
+ assertEqualsRelative(message, 1, matrix, 2, 2);
+ assertEqualsRelative(message, at.getTranslateX(), matrix, 0, 2);
+ assertEqualsRelative(message, at.getTranslateY(), matrix, 1, 2);
+ assertEqualsRelative(message, at.getScaleX(), matrix, 0, 0);
+ assertEqualsRelative(message, at.getScaleY(), matrix, 1, 1);
+ assertEqualsRelative(message, at.getShearX(), matrix, 0, 1);
+ assertEqualsRelative(message, at.getShearY(), matrix, 1, 0);
+ assertTrue("isAffine", matrix.isAffine());
+ }
+ }
+
/**
* Tests {@link MatrixSIS#multiply(Matrix)}.
*/
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/SolverTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/SolverTest.java?rev=1670479&r1=1670478&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/SolverTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/SolverTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -33,7 +33,7 @@ import static org.apache.sis.referencing
* Tests the {@link Solver} class using <a href="http://math.nist.gov/javanumerics/jama">JAMA</a>
* as the reference implementation.
*
- * {@section Cyclic dependency}
+ * <div class="section">Cyclic dependency</div>
* There is a cyclic test dependency since {@link GeneralMatrix} needs {@link Solver} for some operations,
* and conversely. To be more specific the dependency order is:
*
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java?rev=1670479&r1=1670477&r2=1670479&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NormalizedProjectionTest.java [UTF-8] Tue Mar 31 21:07:44 2015
@@ -30,6 +30,9 @@ import static java.lang.StrictMath.*;
import static org.apache.sis.internal.metadata.ReferencingServices.NAUTICAL_MILE;
import static org.junit.Assert.*;
+// Branch-dependent imports
+import static org.apache.sis.internal.jdk8.JDK8.nextDown;
+
/**
* Tests the {@link NormalizedProjection} class.