Package org.opengis.test.referencing
Class AffineTransformTest
- Object
-
- TestCase
-
- TransformTestCase
-
- AffineTransformTest
-
public class AffineTransformTest extends TransformTestCase
Tests affine transforms from theorg.opengis.referencing.operationpackage. Math transform instances are created using the factory given at construction time.Usage example: in order to specify their factories and run the tests in a JUnit framework, implementors can define a subclass in their own test suite as in the example below:import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.opengis.test.referencing.AffineTransformTest; @RunWith(JUnit4.class) public class MyTest extends AffineTransformTest { public MyTest() { super(new MyMathTransformFactory()); } }- Since:
- 3.1
- See Also:
ParameterizedTransformTest,TestSuite
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisNonBidimensionalSpaceSupportedtrueifMathTransformFactory.createAffineTransform(Matrix)accepts matrixes of size different than 3×3.protected booleanisNonSquareMatrixSupportedtrueifMathTransformFactory.createAffineTransform(Matrix)accepts non-square matrixes.protected MatrixmatrixThe matrix of the math transform being tested.protected MathTransformFactorymtFactoryThe factory for creatingMathTransformobjects, ornullif none.-
Fields inherited from class TransformTestCase
derivativeDeltas, isDerivativeSupported, isDoubleToDoubleSupported, isDoubleToFloatSupported, isFloatToDoubleSupported, isFloatToFloatSupported, isInverseTransformSupported, isOverlappingArraySupported, tolerance, toleranceModifier, transform
-
Fields inherited from class TestCase
configurationTip, listener, units, validators
-
-
Constructor Summary
Constructors Constructor Description AffineTransformTest(MathTransformFactory factory)Creates a new test using the given factory.
-
Method Summary
Modifier and Type Method Description Configurationconfiguration()Returns information about the configuration of the test which has been run.static List<Factory[]>factories()Returns a default set of factories to use for running the tests.voidtestAxisSwapping2D()Tests a transform swapping the axes in a two-dimensional space.voidtestDimensionReduction()Tests a transform which reduce the number of dimensions from 4 to 2.voidtestGeneral()Tests using a combination of scale, rotation and translation in a two-dimensional space.voidtestGenericScale2D()Tests using a non-uniform scale factor of (3,4) in a two-dimensional space.voidtestIdentity1D()Tests using an identity transform in an one-dimensional space.voidtestIdentity2D()Tests using an identity transform in a two-dimensional space.voidtestIdentity3D()Tests using an identity transform in a three-dimensional space.voidtestRotation2D()Tests using an anticlockwise 30° rotation in a two-dimensional space.voidtestSouthOrientated2D()Tests using a 180° rotation in a two-dimensional space.voidtestTranslatation2D()Tests using a translation of (400000,-100000) metres in a two-dimensional space.voidtestUniformScale2D()Tests using a uniform scale factor of 0.3048 in a two-dimensional space.-
Methods inherited from class TransformTestCase
assertAllTestsEnabled, assertCoordinateEquals, assertCoordinateEquals, assertCoordinateEquals, assertCoordinateEquals, assertCoordinateEquals, assertCoordinateEquals, assertCoordinateEquals, assertCoordinateEquals, assertCoordinatesEqual, assertCoordinatesEqual, assertCoordinatesEqual, assertCoordinatesEqual, assertCoordinatesEqual, assertCoordinatesEqual, assertCoordinatesEqual, assertCoordinatesEqual, assertMatrixEquals, normalize, tolerance, verifyConsistency, verifyDerivative, verifyInDomain, verifyInverse, verifyInverse, verifyTransform
-
Methods inherited from class TestCase
factories, factories, getEnabledFlags
-
-
-
-
Field Detail
-
mtFactory
protected final MathTransformFactory mtFactory
The factory for creatingMathTransformobjects, ornullif none.
-
matrix
protected Matrix matrix
The matrix of the math transform being tested. This field is set, together with thetransformfield, after the execution of everytestFoo()method in this class.If this field is non-null before a test is run, then those parameters will be used directly. This allow implementors to alter the parameters before to run the test one more time.
-
isNonSquareMatrixSupported
protected boolean isNonSquareMatrixSupported
trueifMathTransformFactory.createAffineTransform(Matrix)accepts non-square matrixes. Transforms defined by non-square matrixes have a number of input dimensions different than the number of output dimensions.
-
isNonBidimensionalSpaceSupported
protected boolean isNonBidimensionalSpaceSupported
trueifMathTransformFactory.createAffineTransform(Matrix)accepts matrixes of size different than 3×3. Iffalse, then only matrixes of size 3×3 (i.e. affine transforms between two-dimensional spaces) will be tested.
-
-
Constructor Detail
-
AffineTransformTest
public AffineTransformTest(MathTransformFactory factory)
Creates a new test using the given factory. If the given factory isnull, then the tests will be skipped.- Parameters:
factory- factory for creatingMathTransforminstances.
-
-
Method Detail
-
factories
public static List<Factory[]> factories()
Returns a default set of factories to use for running the tests. Those factories are given in arguments to the constructor when this test class is instantiated directly by JUnit (for example as a suite element), instead than sub-classed by the implementor. The factories are fetched as documented in theTestCase.factories(Class[])javadoc.- Returns:
- the default set of arguments to be given to the
AffineTransformTestconstructor.
-
configuration
public Configuration configuration()
Returns information about the configuration of the test which has been run. This method returns a map containing:- All the entries defined in the parent class.
- All the following values associated to the
Configuration.Keyof the same name:
- Overrides:
configurationin classTransformTestCase- Returns:
- the configuration of the test being run, or an empty map if none. This method returns a modifiable map in order to allow subclasses to modify it.
- See Also:
ImplementationDetails.configuration(Factory[])
-
testIdentity1D
public void testIdentity1D() throws FactoryException, TransformException
Tests using an identity transform in an one-dimensional space. This test is executed only if theisNonBidimensionalSpaceSupportedflag is set totrue.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testIdentity2D
public void testIdentity2D() throws FactoryException, TransformException
Tests using an identity transform in a two-dimensional space.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testIdentity3D
public void testIdentity3D() throws FactoryException, TransformException
Tests using an identity transform in a three-dimensional space. This test is executed only if theisNonBidimensionalSpaceSupportedflag is set totrue.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testAxisSwapping2D
public void testAxisSwapping2D() throws FactoryException, TransformException
Tests a transform swapping the axes in a two-dimensional space.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testSouthOrientated2D
public void testSouthOrientated2D() throws FactoryException, TransformException
Tests using a 180° rotation in a two-dimensional space.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testTranslatation2D
public void testTranslatation2D() throws FactoryException, TransformException
Tests using a translation of (400000,-100000) metres in a two-dimensional space. This translation is the (False easting, False northing) parameter values of the OSGB 1936 / British National Grid projection.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testUniformScale2D
public void testUniformScale2D() throws FactoryException, TransformException
Tests using a uniform scale factor of 0.3048 in a two-dimensional space. This is the conversion factor from feet to metres.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testGenericScale2D
public void testGenericScale2D() throws FactoryException, TransformException
Tests using a non-uniform scale factor of (3,4) in a two-dimensional space.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testRotation2D
public void testRotation2D() throws FactoryException, TransformException
Tests using an anticlockwise 30° rotation in a two-dimensional space.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testGeneral
public void testGeneral() throws FactoryException, TransformException
Tests using a combination of scale, rotation and translation in a two-dimensional space.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
testDimensionReduction
public void testDimensionReduction() throws FactoryException, TransformException
Tests a transform which reduce the number of dimensions from 4 to 2. This test is executed only if theisNonSquareMatrixSupportedflag is set totrue.- Throws:
FactoryException- should never happen.TransformException- should never happen.
-
-