public abstract class MathTransformBuilder extends Object
Math transform builders create MathTransform
objects for transforming coordinates from
a source CRS (Coordinate Reference System) to a target CRS
using empirical parameters. Usually, one of those CRS is a geographic
or projected one with a well known relationship to the earth. The other
CRS is often an engineering or image one tied
to some ship. For example a remote sensing image before georectification may be
referenced by an image CRS.
The math transform from source CRS to target CRS is calculated byDesign note: It is technically possible to reference such remote sensing images with a CRS derived from the geographic or projected CRS, where the conversion from base is the math transform computed by this builder. Such approach is advantageous for coordinate operation factory implementations, since they can determine the operation just by inspection of the
DerivedCRS
instance. However this is conceptually incorrect sinceDerivedCRS
can be related to an other CRS only through conversions, which by definition are accurate up to rounding errors. The operations created by math transform builders are rather transformations, which can't be used forDerivedCRS
creation.
MathTransformBuilder
from a set of mapped positions in both CRS.
Subclasses must implement at least the getMinimumPointCount()
and computeMathTransform()
methods.
Modifier and Type  Field and Description 

protected MathTransformFactory 
mtFactory
The factory to use for creating
math transform instances. 
Constructor and Description 

MathTransformBuilder()
Creates a builder with the default factories.

MathTransformBuilder(Hints hints)
Creates a builder from the specified hints.

Modifier and Type  Method and Description 

protected abstract MathTransform 
computeMathTransform()
Calculates the math transform immediately.

Class<? extends CoordinateSystem> 
getCoordinateSystemType()
Returns the required coordinate system type.

int 
getDimension()

Statistics 
getErrorStatistics()
Returns statistics about the errors.

List<MappedPosition> 
getMappedPositions()
Returns the list of mapped positions.

MathTransform 
getMathTransform()
Returns the calculated math transform.

abstract int 
getMinimumPointCount()
Returns the minimum number of points required by this builder.

String 
getName()
Returns the name for the transformation to be created by this
builder.

CoordinateReferenceSystem 
getSourceCRS()
Returns the coordinate reference system for the
source points . 
DirectPosition[] 
getSourcePoints()
Returns the source points.

CoordinateReferenceSystem 
getTargetCRS()
Returns the coordinate reference system for the
target points . 
DirectPosition[] 
getTargetPoints()
Returns the target points.

Transformation 
getTransformation()
Returns the coordinate operation wrapping the calculated math
transform.

void 
printPoints(Writer out,
Locale locale)
Prints a table of all source and target points stored in this builder.

void 
setMappedPositions(List<MappedPosition> positions)
Set the list of mapped positions.

void 
setSourcePoints(DirectPosition... points)
Convenience method setting the source points in mapped
positions.

void 
setTargetPoints(DirectPosition... points)
Convenience method setting the target points in mapped
positions.

String 
toString()
Returns a string representation of this builder.

protected final MathTransformFactory mtFactory
math transform
instances.public MathTransformBuilder()
public MathTransformBuilder(Hints hints)
public String getName()
public abstract int getMinimumPointCount()
public int getDimension()
public List<MappedPosition> getMappedPositions()
public void setMappedPositions(List<MappedPosition> positions) throws IllegalArgumentException, MismatchedDimensionException, MismatchedReferenceSystemException
IllegalArgumentException
 if the list doesn't have the expected number of points.MismatchedDimensionException
 if some points doesn't have the expected number of dimensions.MismatchedReferenceSystemException
 if CRS is not the same for all points.public DirectPosition[] getSourcePoints()
public void setSourcePoints(DirectPosition... points) throws IllegalArgumentException, MismatchedDimensionException, MismatchedReferenceSystemException
points
 The source points.IllegalArgumentException
 if the list doesn't have the expected number of points.MismatchedDimensionException
 if some points doesn't have the expected number of dimensions.MismatchedReferenceSystemException
 if CRS is not the same for all points.public DirectPosition[] getTargetPoints()
public void setTargetPoints(DirectPosition... points) throws IllegalArgumentException, MismatchedDimensionException, MismatchedReferenceSystemException
points
 The target points.IllegalArgumentException
 if the list doesn't have the expected number of points.MismatchedDimensionException
 if some points doesn't have the expected number of dimensions.MismatchedReferenceSystemException
 if CRS is not the same for all points.public void printPoints(Writer out, Locale locale) throws IOException
out
 The output device where to print all points.locale
 The locale, or null
for the default.IOException
 if an error occured while printing.public CoordinateReferenceSystem getSourceCRS() throws FactoryException
source points
. This
method determines the CRS as below:
FactoryException
 if the CRS can't be created.public CoordinateReferenceSystem getTargetCRS() throws FactoryException
target points
. This
method determines the CRS as below:
FactoryException
 if the CRS can't be created.public Class<? extends CoordinateSystem> getCoordinateSystemType()
CoordinateSystem.class
, which means that every kind of coordinate system is legal. Some
subclasses will restrict to cartesian CS.public Statistics getErrorStatistics() throws FactoryException
MathTransformBuilder
, and the target points. Use
Statistics.rms()
for the Root Mean Squared error.FactoryException
 If the math transform can't be created or used.protected abstract MathTransform computeMathTransform() throws FactoryException
MappedPosition
.FactoryException
 if the math transform can't be created.public final MathTransform getMathTransform() throws FactoryException
MappedPosition
.FactoryException
 if the math transform can't be created.public Transformation getTransformation() throws FactoryException
FactoryException
Copyright © 1996–2022 Geotools. All rights reserved.