Author: desruisseaux
Date: Tue Jun 24 15:46:03 2014
New Revision: 1605114
URL: http://svn.apache.org/r1605114
Log:
Merge from the JDK6 branch.
Added:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
- copied unchanged from r1605111,
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
- copied unchanged from r1605111,
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
- copied unchanged from r1605111,
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransferFunction.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java
- copied unchanged from r1605111,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java
- copied, changed from r1605111,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java
- copied, changed from r1605111,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java
Modified:
sis/trunk/ (props changed)
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1600998-1605107
Merged /sis/branches/JDK7:r1601000-1605109
Merged /sis/branches/JDK6:r1601003-1605111
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -811,7 +811,7 @@ public abstract class AbstractMathTransf
public final boolean equals(final Object object) {
final boolean eq = equals(object, ComparisonMode.STRICT);
// If objects are equal, then they must have the same hash code value.
- assert !eq || hashCode() == object.hashCode() : this;
+ assert !eq || computeHashCode() == ((AbstractMathTransform)
object).computeHashCode() : this;
return eq;
}
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConstantTransform1D.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -37,6 +37,16 @@ final class ConstantTransform1D extends
private static final long serialVersionUID = -1583675681650985947L;
/**
+ * A transform for the positive zero constant.
+ */
+ static final ConstantTransform1D ZERO = new ConstantTransform1D(0);
+
+ /**
+ * A transform for the one constant.
+ */
+ static final ConstantTransform1D ONE = new ConstantTransform1D(1);
+
+ /**
* Constructs a new constant transform.
*
* @param offset The {@code offset} term in the linear equation.
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -103,6 +103,8 @@ class LinearTransform1D extends Abstract
return IdentityTransform1D.INSTANCE;
}
if (scale == 0) {
+ if (offset == 0) return ConstantTransform1D.ZERO;
+ if (offset == 1) return ConstantTransform1D.ONE;
return new ConstantTransform1D(offset);
}
return new LinearTransform1D(scale, offset);
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -69,11 +69,15 @@ public class PassThroughTransform extend
/**
* Index of the first affected ordinate.
+ *
+ * @see #getModifiedCoordinates()
*/
final int firstAffectedOrdinate;
/**
* Number of unaffected ordinates after the affected ones.
+ *
+ * @see #getModifiedCoordinates()
*/
final int numTrailingOrdinates;
@@ -253,9 +257,16 @@ public class PassThroughTransform extend
* Returns the ordered sequence of positive integers defining the
positions in a source
* coordinate tuple of the coordinates affected by this pass-through
operation.
*
+ * <div class="note"><b>API note:</b> this method is final for now because
most of Apache SIS code do
+ * not use the {@code modifiedCoordinates} array. Instead, SIS uses the
{@code firstAffectedOrdinate}
+ * and {@code numTrailingOrdinates} information provided to the
constructor. Consequently overriding
+ * this method may be misleading since it would be ignored by SIS. We do
not want to make the "really
+ * used" fields public in order to keep the flexibility to replace them by
a {@code modifiedCoordinates}
+ * array in a future SIS version.</div>
+ *
* @return Indices of the modified source coordinates.
*/
- public int[] getModifiedCoordinates() {
+ public final int[] getModifiedCoordinates() {
final int[] index = new int[subTransform.getSourceDimensions()];
for (int i=0; i<index.length; i++) {
index[i] = i + firstAffectedOrdinate;
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PowerTransform1D.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -31,6 +31,11 @@ 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}
+ * Serialized instances of this class are not guaranteed to be compatible with
future SIS versions.
+ * Serialization should be used only for short term storage or RMI between
applications running the
+ * same SIS version.
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.5 (derived from geotk-3.17)
* @version 0.5
@@ -73,7 +78,7 @@ final class PowerTransform1D extends Abs
*/
public static MathTransform1D create(final double power) {
if (power == 1) return IdentityTransform1D.INSTANCE;
- if (power == 0) return new ConstantTransform1D(1);
+ if (power == 0) return ConstantTransform1D.ONE;
return new PowerTransform1D(power);
}
@@ -192,7 +197,7 @@ final class PowerTransform1D extends Abs
@Override
public boolean equals(final Object object, final ComparisonMode mode) {
if (object == this) {
- return true; // Slight optimization
+ return true; // Optimization for a common case.
}
if (super.equals(object, mode)) {
return Numerics.equals(power, ((PowerTransform1D) object).power);
Modified:
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -34,15 +34,18 @@
* In the 2D case, Apache SIS provides instances of the standard {@link
java.awt.geom.AffineTransform}
* class when possible.
*
- * <p>{@code MathTransform} usually performs conversions or transformations
from points given in a
+ * <p>This package does not include map projections, which are a special kind
of transforms defined
+ * in their own {@linkplain org.apache.sis.referencing.operation.projection
projection} package.</p>
+ *
+ * {@section Non-spatial coordinates}
+ * {@code MathTransform} usually performs conversions or transformations from
points given in a
* {@linkplain
org.apache.sis.referencing.operation.DefaultCoordinateOperation#getSourceCRS()
* source coordinate reference system} to coordinate values for the same
points in the
* {@linkplain
org.apache.sis.referencing.operation.DefaultCoordinateOperation#getTargetCRS()
* target coordinate reference system}. However the conversions are not
necessarily between CRS;
- * a {@code MathTransform} can also be used for converting the sample values
in a raster for example.</p>
- *
- * <p>This package does not include map projections, which are a special kind
of transforms defined
- * in their own {@linkplain org.apache.sis.referencing.operation.projection
projection} package.</p>
+ * a {@code MathTransform} can also be used for converting the sample values
in a raster for example.
+ * Such kind of transforms are named {@linkplain
org.apache.sis.referencing.operation.transform.TransferFunction
+ * transfer functions}.
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.5 (derived from geotk-1.2)
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbstractMathTransformTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -19,17 +19,16 @@ package org.apache.sis.referencing.opera
import java.util.Arrays;
import java.util.Random;
import org.opengis.referencing.operation.TransformException;
+import static java.lang.StrictMath.*;
+import static
org.apache.sis.referencing.operation.transform.AbstractMathTransform.MAXIMUM_FAILURES;
+import static
org.apache.sis.referencing.operation.transform.AbstractMathTransform.MAXIMUM_BUFFER_SIZE;
// Test imports
import org.junit.Test;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;
-
import static org.junit.Assert.*;
-import static java.lang.StrictMath.*;
-import static
org.apache.sis.referencing.operation.transform.AbstractMathTransform.MAXIMUM_FAILURES;
-import static
org.apache.sis.referencing.operation.transform.AbstractMathTransform.MAXIMUM_BUFFER_SIZE;
/**
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -19,12 +19,11 @@ package org.apache.sis.referencing.opera
import java.util.Random;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Longitude;
+import static java.lang.StrictMath.*;
// Test imports
import org.apache.sis.test.mock.GeodeticDatumMock;
-import static java.lang.StrictMath.*;
-
/**
* The domain of input coordinates.
@@ -144,7 +143,7 @@ public strictfp enum CoordinateDomain {
* Geographic input coordinates with angles in radians and only half of
the longitude range.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>)
order.
*/
- GEOGRAPHIC_RADIANS_HALF {
+ GEOGRAPHIC_RADIANS_HALF_λ {
@Override
double generate(final Random random, final int dimension) {
final double range;
@@ -249,7 +248,17 @@ public strictfp enum CoordinateDomain {
},
/**
- * Gaussian numbers: can be positives or negatives, mostly close to zero
but some
+ * Values in the -10 to 10 range.
+ */
+ RANGE_10 {
+ @Override
+ double generate(final Random random, final int dimension) {
+ return random.nextDouble() * 20 - 10;
+ }
+ },
+
+ /**
+ * Gaussian distribution. Numbers can be positives or negatives, mostly
close to zero but some
* numbers can be arbitrarily large.
*/
GAUSSIAN;
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -32,7 +32,10 @@ import org.apache.sis.test.DependsOn;
* @version 0.5
* @module
*/
-@DependsOn(ProjectiveTransformTest.class)
+@DependsOn({
+ CoordinateDomainTest.class,
+ ProjectiveTransformTest.class
+})
public final strictfp class CopyTransformTest extends MathTransformTestCase {
/**
* Generates random ordinates with approximatively 5% of NaN values in the
array.
Copied:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java
(from r1605111,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java)
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java&r1=1605111&r2=1605114&rev=1605114&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -27,11 +27,6 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;
import static org.opengis.test.Assert.*;
-// Branch-dependent imports
-import org.opengis.test.CalculationType;
-import org.opengis.test.ToleranceModifier;
-import org.opengis.test.ToleranceModifiers;
-
/**
* Tests the {@link ExponentialTransform1D} class. This test case will also
tests
@@ -71,9 +66,8 @@ public final strictfp class ExponentialT
*/
private void initialize(final MathTransform1D mt) {
transform = mt; // Must be set before
generateRandomCoordinates(…).
- tolerance = 1E-14;
- toleranceModifier = ToleranceModifier.RELATIVE;
- derivativeDeltas = new double[] {0.001};
+ tolerance = 1E-5; // Tolerance is much smaller on other
branches.
+// toleranceModifier = ToleranceModifier.RELATIVE; // Not available on
GeoAPI 3.0.
values =
generateRandomCoordinates(CoordinateDomain.RANGE_10, 0);
expected = new double[values.length];
}
@@ -87,7 +81,6 @@ public final strictfp class ExponentialT
assertFalse(transform.isIdentity());
validate();
verifyTransform(values, expected);
- verifyDerivative(2.5); // Test at a hard-coded point.
}
/**
@@ -148,13 +141,6 @@ public final strictfp class ExponentialT
for (int i=0; i<values.length; i++) {
expected[i] = C0 + C1 * (SCALE * pow(BASE, values[i]));
}
- /*
- * The inverse transforms in this test case have high rounding errors.
- * Those errors are low for values close to zero, and increase fast
for higher values.
- * We scale the default tolerance (1E-14) by 1E+8, which give us a
tolerance of 1E-6.
- */
- toleranceModifier = ToleranceModifiers.concatenate(toleranceModifier,
-
ToleranceModifiers.scale(EnumSet.of(CalculationType.INVERSE_TRANSFORM), 1E+8));
run(ConcatenatedTransformDirect1D.class);
}
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/IterationStrategyTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -19,15 +19,14 @@ package org.apache.sis.referencing.opera
import java.util.Arrays;
import java.util.Random;
import org.opengis.referencing.operation.TransformException;
+import static java.lang.StrictMath.*;
+import static
org.apache.sis.referencing.operation.transform.IterationStrategy.*;
// Test imports
import org.junit.Test;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOnMethod;
-
import static org.junit.Assert.*;
-import static java.lang.StrictMath.*;
-import static
org.apache.sis.referencing.operation.transform.IterationStrategy.*;
/**
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearTransformTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.apache.sis.test.DependsOn;
-
import static org.opengis.test.Assert.*;
// Branch-dependent imports
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryBase.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -29,6 +29,8 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.SingleOperation;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
+
+// Test imports
import org.apache.sis.metadata.iso.citation.HardCodedCitations;
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -18,7 +18,6 @@ package org.apache.sis.referencing.opera
import java.util.Random;
import java.io.IOException;
-import java.io.PrintStream;
import org.opengis.referencing.operation.Matrix;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransform1D;
@@ -31,20 +30,16 @@ import org.opengis.metadata.Identifier;
import org.apache.sis.parameter.Parameterized;
import org.apache.sis.util.Debug;
import org.apache.sis.util.Classes;
-import org.apache.sis.math.Statistics;
-import org.apache.sis.math.StatisticsFormat;
import org.apache.sis.io.TableAppender;
import org.apache.sis.io.wkt.Convention;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.internal.util.Numerics;
+import static java.lang.StrictMath.*;
// Test imports
import org.opengis.test.Validators;
import org.opengis.test.referencing.TransformTestCase;
-import org.apache.sis.test.TestCase;
import org.apache.sis.test.TestUtilities;
-
-import static java.lang.StrictMath.*;
import static org.apache.sis.test.ReferencingAssert.*;
// Branch-dependent imports
@@ -267,30 +262,9 @@ public abstract strictfp class MathTrans
final int numPts = ORDINATE_COUNT / dimension;
final Random random = TestUtilities.createRandomNumberGenerator();
final double[] coordinates = domain.generateRandomInput(random,
dimension, numPts);
- for (int i = Math.round(coordinates.length * propNaN); --i >= 0;) {
+ for (int i = round(coordinates.length * propNaN); --i >= 0;) {
coordinates[random.nextInt(coordinates.length)] = Double.NaN;
}
- if (TestCase.verbose) {
- final PrintStream out = out();
- out.print("Random input coordinates for ");
- out.print(domain); out.println(" domain:");
- final Statistics[] stats = new Statistics[dimension];
- for (int i=0; i<stats.length; i++) {
- stats[i] = new Statistics(null);
- }
- for (int i=0; i<coordinates.length; i++) {
- stats[i % dimension].accept(coordinates[i]);
- }
- final StatisticsFormat format = StatisticsFormat.getInstance();
- format.setBorderWidth(1);
- try {
- format.format(stats, out);
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- out.println();
- out.flush();
- }
return coordinates;
}
@@ -315,7 +289,7 @@ public abstract strictfp class MathTrans
*/
@Debug
protected final void printInternalWKT() {
- final TableAppender table = new TableAppender(out());
+ final TableAppender table = new TableAppender(System.out);
table.setMultiLinesCells(true);
table.appendHorizontalSeparator();
table.append("WKT of “").append(getName()).append('”').nextColumn();
@@ -339,12 +313,4 @@ public abstract strictfp class MathTrans
throw new AssertionError(e);
}
}
-
- /**
- * Where to write debugging information.
- */
- @Debug
- private static PrintStream out() {
- return System.out;
- }
}
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PassThroughTransformTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -29,9 +29,11 @@ import org.apache.sis.util.ArraysExt;
import org.junit.Test;
import org.apache.sis.test.TestUtilities;
import org.apache.sis.test.DependsOn;
-
import static org.junit.Assert.*;
+// Branch-dependent imports
+// (all imports removed)
+
/**
* Tests {@link PassThroughTransform}.
@@ -41,7 +43,11 @@ import static org.junit.Assert.*;
* @version 0.5
* @module
*/
-@DependsOn(LinearTransformTest.class)
+@DependsOn({
+ CoordinateDomainTest.class,
+ LinearTransformTest.class,
+ ExponentialTransform1DTest.class
+})
public final strictfp class PassThroughTransformTest extends
MathTransformTestCase {
/**
* The random number generator to be used in this test.
@@ -104,11 +110,10 @@ public final strictfp class PassThroughT
*
* @throws TransformException Should never happen.
*/
-// TODO
-// @Test
-// public void testPassthrough() throws TransformException {
-// runTest(ExponentialTransform1D.create(10, -2),
PassThroughTransform.class);
-// }
+ @Test
+ public void testPassthrough() throws TransformException {
+ runTest(ExponentialTransform1D.create(10, 2),
PassThroughTransform.class);
+ }
/**
* Tests a pass-through transform built using the given sub-transform.
@@ -161,10 +166,10 @@ public final strictfp class PassThroughT
* - passthrough data, to be given to the transform to be tested.
* - sub-transform data, which we will use internally for verifying
the pass-through work.
*/
- final int passthroughDim = transform.getSourceDimensions();
- final int subTransformDim = subTransform.getSourceDimensions();
- final int numPts = ORDINATE_COUNT / passthroughDim;
- final double[] passthroughData =
CoordinateDomain.GEOGRAPHIC.generateRandomInput(random, passthroughDim, numPts);
+ final int passthroughDim = transform.getSourceDimensions();
+ final int subTransformDim = subTransform.getSourceDimensions();
+ final int numPts = ORDINATE_COUNT / passthroughDim;
+ final double[] passthroughData =
CoordinateDomain.RANGE_10.generateRandomInput(random, passthroughDim, numPts);
final double[] subTransformData = new double[numPts * subTransformDim];
Arrays.fill(subTransformData, Double.NaN);
for (int i=0; i<numPts; i++) {
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -30,7 +30,6 @@ import org.apache.sis.test.DependsOn;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.After;
-
import static org.opengis.test.Assert.*;
// Branch-dependent imports
Copied:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java
(from r1605111,
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java)
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java&r1=1605111&r2=1605114&rev=1605114&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransferFunctionTest.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -24,7 +24,7 @@ import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.Assert.*;
/**
Modified:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1605114&r1=1605113&r2=1605114&view=diff
==============================================================================
---
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Tue Jun 24 15:46:03 2014
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.5
* @module
*/
@Suite.SuiteClasses({
@@ -40,12 +40,15 @@ 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.CoordinateDomainTest.class,
org.apache.sis.referencing.operation.transform.IterationStrategyTest.class,
org.apache.sis.referencing.operation.transform.AbstractMathTransformTest.class,
org.apache.sis.referencing.operation.transform.ProjectiveTransformTest.class,
org.apache.sis.referencing.operation.transform.LinearTransformTest.class,
+
org.apache.sis.referencing.operation.transform.ExponentialTransform1DTest.class,
org.apache.sis.referencing.operation.transform.CopyTransformTest.class,
org.apache.sis.referencing.operation.transform.PassThroughTransformTest.class,
+ org.apache.sis.referencing.operation.transform.TransferFunctionTest.class,
org.apache.sis.internal.referencing.FormulasTest.class,
org.apache.sis.internal.referencing.VerticalDatumTypesTest.class,