|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFactory
ReferencingFactory
DefaultMathTransformFactory
@ThreadSafe public class DefaultMathTransformFactory
Low level factory for creating math transforms. Many high
level GIS applications will never need to use this factory directly; they can use a
coordinate operation factory instead. However,
the MathTransformFactory interface can be used directly by applications that wish
to transform other types of coordinates (e.g. color coordinates, or image pixel coordinates).
A math transform is an object that actually does the work of
applying formulae to coordinate values. The math transform does not know or care how the
coordinates relate to positions in the real world. This lack of semantics makes implementing
MathTransformFactory significantly easier than it would be otherwise. For example the
affine transform applies a matrix to the coordinates without knowing how what it is doing
relates to the real world. So if the matrix scales Z values by a factor of 1000,
then it could be converting meters into millimeters, or it could be converting kilometers
into meters.
Because math transforms have low semantic value (but high mathematical value), programmers
who do not have much knowledge of how GIS applications use coordinate systems, or how those
coordinate systems relate to the real world can implement MathTransformFactory. The
low semantic content of math transforms also means that they will be useful in applications
that have nothing to do with GIS coordinates. For example, a math transform could be used to
map color coordinates between different color spaces, such as converting (red, green, blue)
colors into (hue, light, saturation) colors.
Since a math transform does not know what its source and target coordinate systems mean, it is not necessary or desirable for a math transform object to keep information on its source and target coordinate systems.
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Factory |
|---|
Factory.Availability, Factory.Organizer |
| Field Summary |
|---|
| Fields inherited from class ReferencingFactory |
|---|
LOGGER |
| Fields inherited from class Factory |
|---|
EMPTY_HINTS, hints |
| Constructor Summary | |
|---|---|
DefaultMathTransformFactory()
Constructs a default math transform factory. |
|
| Method Summary | |
|---|---|
MathTransform |
createAffineTransform(Matrix matrix)
Creates an affine transform from a matrix. |
MathTransform |
createBaseToDerived(CoordinateReferenceSystem baseCRS,
MathTransform projection,
CoordinateSystem derivedCS)
Creates a transform from a base CRS to a derived CS. |
MathTransform |
createBaseToDerived(CoordinateReferenceSystem baseCRS,
ParameterValueGroup parameters,
CoordinateSystem derivedCS)
Creates a parameterized transform from a base CRS to a derived CS. |
MathTransform |
createConcatenatedTransform(MathTransform transform1,
MathTransform transform2)
Creates a transform by concatenating two existing transforms. |
MathTransform |
createFromWKT(String text)
Creates a math transform object from a Well Known Text (WKT). |
MathTransform |
createFromXML(String xml)
Creates a math transform object from a XML string. |
MathTransform |
createParameterizedTransform(ParameterValueGroup parameters)
Creates a transform from a group of parameters. |
MathTransform |
createPassThroughTransform(int firstAffectedOrdinate,
MathTransform subTransform,
int numTrailingOrdinates)
Creates a transform which passes through a subset of ordinates to another transform. |
Set<OperationMethod> |
getAvailableMethods(Class<? extends SingleOperation> type)
Returns a set of available methods for math transforms. |
ParameterValueGroup |
getDefaultParameters(String method)
Returns the default parameter values for a math transform using the given method. |
OperationMethod |
getLastMethodUsed()
Returns the operation method used for the latest call to createParameterizedTransform
in the currently running thread. |
OperationMethod |
getOperationMethod(String name)
Returns the operation method for the specified name. |
Citation |
getVendor()
Returns the vendor responsible for creating this factory implementation. |
void |
scanForPlugins()
Scans for factory plug-ins on the application class path. |
| Methods inherited from class ReferencingFactory |
|---|
ensureNonNull |
| Methods inherited from class Factory |
|---|
availability, dispose, equals, getImplementationHints, hasCompatibleHints, hashCode, setOrdering, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultMathTransformFactory()
math transform factory.
| Method Detail |
|---|
public Citation getVendor()
getVendor in interface FactorygetVendor in class ReferencingFactoryCitations.GEOTOOLKITpublic Set<OperationMethod> getAvailableMethods(Class<? extends SingleOperation> type)
getDefaultParameters(java.lang.String) method in this factory.
The set of available methods is implementation dependent.
getAvailableMethods in interface MathTransformFactorytype - SingleOperation.class for fetching all operation methods,
or Projection.class for fetching only map projection
methods.
getDefaultParameters(java.lang.String),
createParameterizedTransform(org.opengis.parameter.ParameterValueGroup)public OperationMethod getLastMethodUsed()
createParameterizedTransform
in the currently running thread. Returns null if not applicable.
getLastMethodUsed in interface MathTransformFactorycreateParameterizedTransform(org.opengis.parameter.ParameterValueGroup)
public OperationMethod getOperationMethod(String name)
throws NoSuchIdentifierException
name - The case insensitive identifier code
of the operation method to search for (e.g. "Transverse_Mercator").
NoSuchIdentifierException - if there is no operation method registered for the
specified name.
public ParameterValueGroup getDefaultParameters(String method)
throws NoSuchIdentifierException
getAvailableMethods() method. A typical example is
"Transverse_Mercator").
This method creates new parameter instances at every call. It is intended to be modified
by the user before to be passed to createParameterizedTransform(parameters).
getDefaultParameters in interface MathTransformFactorymethod - The case insensitive name of the method to search for.
NoSuchIdentifierException - if there is no transform registered for the specified
method.getAvailableMethods(),
createParameterizedTransform(org.opengis.parameter.ParameterValueGroup),
AbstractMathTransform.getParameterValues()
public MathTransform createBaseToDerived(CoordinateReferenceSystem baseCRS,
ParameterValueGroup parameters,
CoordinateSystem derivedCS)
throws NoSuchIdentifierException,
FactoryException
"semi_major" and "semi_minor" parameters are
not explicitly specified, they will be inferred from the ellipsoid
and added to parameters. In addition, this method performs axis switch as needed.
The operation method used can be obtained by a call to
getLastMethodUsed().
createBaseToDerived in interface MathTransformFactorybaseCRS - The source coordinate reference system.parameters - The parameter values for the transform.derivedCS - the target coordinate system.
NoSuchIdentifierException - if there is no transform registered for the method.
FactoryException - if the object creation failed. This exception is thrown
if some required parameter has not been supplied, or has illegal value.
public MathTransform createBaseToDerived(CoordinateReferenceSystem baseCRS,
MathTransform projection,
CoordinateSystem derivedCS)
throws FactoryException
baseCRS - The source coordinate reference system.projection - The "raw" base to derived transform.derivedCS - the target coordinate system.
FactoryException - if the object creation failed. This exception is thrown
if some required parameter has not been supplied, or has illegal value.
public MathTransform createParameterizedTransform(ParameterValueGroup parameters)
throws NoSuchIdentifierException,
FactoryException
ParameterValueGroup p = factory.getDefaultParameters("Transverse_Mercator");
p.parameter("semi_major").setValue(6378137.000);
p.parameter("semi_minor").setValue(6356752.314);
MathTransform mt = factory.createParameterizedTransform(p);
createParameterizedTransform in interface MathTransformFactoryparameters - The parameter values.
NoSuchIdentifierException - if there is no transform registered for the method.
FactoryException - if the object creation failed. This exception is thrown
if some required parameter has not been supplied, or has illegal value.getDefaultParameters(java.lang.String),
getAvailableMethods(),
getLastMethodUsed()
public MathTransform createAffineTransform(Matrix matrix)
throws FactoryException
M,
and output dimension is N, then the matrix will have size [N+1][M+1]. The
+1 in the matrix dimensions allows the matrix to do a shift, as well as a rotation. The
[M][j] element of the matrix will be the j'th ordinate of the moved origin. The
[i][N] element of the matrix will be 0 for i less than M, and 1
for i equals M.
createAffineTransform in interface MathTransformFactorymatrix - The matrix used to define the affine transform.
FactoryException - if the object creation failed.
public MathTransform createConcatenatedTransform(MathTransform transform1,
MathTransform transform2)
throws FactoryException
The dimension of the output space of the first transform must match the dimension of the input space in the second transform. In order to concatenate more than two transforms, use this method repeatedly.
createConcatenatedTransform in interface MathTransformFactorytransform1 - The first transform to apply to points.transform2 - The second transform to apply to points.
FactoryException - if the object creation failed.
public MathTransform createPassThroughTransform(int firstAffectedOrdinate,
MathTransform subTransform,
int numTrailingOrdinates)
throws FactoryException
The resulting transform will have the following dimensions:
Source: firstAffectedOrdinate + subTransform.getSourceDimensions() + numTrailingOrdinates Target: firstAffectedOrdinate + subTransform.getTargetDimensions() + numTrailingOrdinates
createPassThroughTransform in interface MathTransformFactoryfirstAffectedOrdinate - The lowest index of the affected ordinates.subTransform - Transform to use for affected ordinates.numTrailingOrdinates - Number of trailing ordinates to pass through.
Affected ordinates will range from firstAffectedOrdinate
inclusive to dimTarget-numTrailingOrdinates exclusive.
FactoryException - if the object creation failed.
public MathTransform createFromXML(String xml)
throws FactoryException
createFromXML in interface MathTransformFactoryxml - Math transform encoded in XML format.
FactoryException - if the object creation failed.
public MathTransform createFromWKT(String text)
throws FactoryException
createFromWKT in interface MathTransformFactorytext - Math transform encoded in Well-Known Text format.
null).
FactoryException - if the Well-Known Text can't be parsed,
or if the math transform creation failed from some other reason.public void scanForPlugins()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||