|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deegree_impl.model.ct.MathTransformFactory
Creates math transforms. MathTransformFactory
is a low level
factory that is used to create MathTransform
objects. Many high
level GIS applications will never need to use a MathTransformFactory
directly; they can use a CoordinateTransformationFactory
instead.
However, the MathTransformFactory
class is specified here,
since it 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 MathTransformFactory
can create affine math
transforms. 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.
CT_MathTransformFactory
Nested Class Summary | |
private class |
MathTransformFactory.Export
Wrap a MathTransformFactory for use with OpenGIS. |
Field Summary | |
private static MathTransformFactory |
DEFAULT
The default math transform factory. |
(package private) static WeakHashSet |
pool
A pool of math transform. |
private MathTransformProvider[] |
providers
List of registered math transforms. |
Constructor Summary | |
MathTransformFactory(MathTransformProvider[] providers)
Construct a factory using the specified providers. |
Method Summary | |
private static boolean |
areInverse(MathTransform tr1,
MathTransform tr2)
Tests if one math transform is the inverse of the other. |
MathTransform2D |
createAffineTransform(java.awt.geom.AffineTransform matrix)
Creates an affine transform from a matrix. |
MathTransform |
createAffineTransform(Matrix matrix)
Creates an affine transform from a matrix. |
MathTransform |
createConcatenatedTransform(MathTransform tr1,
MathTransform tr2)
Creates a transform by concatenating two existing transforms. |
MathTransform |
createIdentityTransform(int dimension)
Creates an identity transform of the specified dimension. |
MathTransform |
createParameterizedTransform(Projection projection)
Convenience method for creating a transform from a projection. |
MathTransform |
createParameterizedTransform(java.lang.String classification,
ParameterList parameters)
Creates a transform from a classification name and parameters. |
MathTransform |
createPassThroughTransform(int firstAffectedOrdinate,
MathTransform subTransform,
int numTrailingOrdinates)
Creates a transform which passes through a subset of ordinates to another transform. |
MathTransform |
createSubMathTransform(int lower,
int upper,
MathTransform transform)
Creates a transform which retains only a portion of an other transform. |
MathTransformProvider |
getAffineTransformProvider(int numRow,
int numCol)
Create a provider for affine transforms of the specified dimension. |
java.lang.String[] |
getAvailableTransforms()
Returns the classification names of every available transforms. |
static MathTransformFactory |
getDefault()
Returns the default math transform factory. |
MathTransformProvider |
getMathTransformProvider(java.lang.String classification)
Returns the provider for the specified classification. |
private static Matrix |
getMatrix(MathTransform transform)
Returns the underlying matrix for the specified transform, or null if the matrix is unavailable. |
(package private) java.lang.Object |
toOpenGIS(java.lang.Object adapters)
Returns an OpenGIS interface for this transform factory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static MathTransformFactory DEFAULT
static final WeakHashSet pool
private final MathTransformProvider[] providers
Constructor Detail |
public MathTransformFactory(MathTransformProvider[] providers)
Method Detail |
public static MathTransformFactory getDefault()
public MathTransform createIdentityTransform(int dimension)
dimension
- The source and target dimension.
public MathTransform2D createAffineTransform(java.awt.geom.AffineTransform matrix)
matrix
- The matrix used to define the affine transform.
public MathTransform createAffineTransform(Matrix matrix)
matrix
- The matrix used to define the affine transform.
private static Matrix getMatrix(MathTransform transform)
null
if the matrix is unavailable.
private static boolean areInverse(MathTransform tr1, MathTransform tr2)
tr2
is an
instance of AbstractMathTransform.Inverse
.
public MathTransform createConcatenatedTransform(MathTransform tr1, MathTransform tr2)
tr1
- The first transform to apply to points.tr2
- The second transform to apply to points.
public MathTransform createPassThroughTransform(int firstAffectedOrdinate, MathTransform subTransform, int numTrailingOrdinates)
firstAffectedOrdinate
- Index of the first affected ordinate.subTransform
- The sub transform.numTrailingOrdinates
- Number of trailing ordinates to pass through.
Affected ordinates will range from firstAffectedOrdinate
inclusive to dimTarget-numTrailingOrdinates
exclusive.
Source: firstAffectedOrdinate + subTransform.getDimSource() + numTrailingOrdinates Target: firstAffectedOrdinate + subTransform.getDimTarget() + numTrailingOrdinates
public MathTransform createSubMathTransform(int lower, int upper, MathTransform transform)
createSubMathTransfom(...)
method makes it easier to optimize some common cases.
transform
- The transform.lower
- Index of the first ordinate to keep.upper
- Index of the first ordinate. Must be greater than lower
.public MathTransform createParameterizedTransform(java.lang.String classification, ParameterList parameters) throws java.util.NoSuchElementException, MissingParameterException
classification
- The classification name of the transform
(e.g. "Transverse_Mercator"). Leading and trailing spaces
are ignored, and comparaison is case-insensitive.parameters
- The parameter values in standard units.
java.util.NoSuchElementException
- if there is no transform for the specified classification.
MissingParameterException
- if a parameter was required but not found.public MathTransform createParameterizedTransform(Projection projection) throws java.util.NoSuchElementException, MissingParameterException
projection
- The projection.
java.util.NoSuchElementException
- if there is no transform for the specified projection.
MissingParameterException
- if a parameter was required but not found.public java.lang.String[] getAvailableTransforms()
public MathTransformProvider getMathTransformProvider(java.lang.String classification) throws java.util.NoSuchElementException
getMathTransformProvider("Transverse_Mercator").getParameterList()
),
or the transform name in a given locale (e.g.
getMathTransformProvider("Transverse_Mercator").getName(Locale#FRENCH
)
)
classification
- The classification name of the transform
(e.g. "Transverse_Mercator"). It should be one of the name
returned by getAvailableTransforms()
. Leading and
trailing spaces are ignored. Comparisons are case-insensitive.
java.util.NoSuchElementException
- if there is no provider registered
with the specified classification name.public MathTransformProvider getAffineTransformProvider(int numRow, int numCol) throws java.lang.IllegalArgumentException
numRow × numCol
.
Parameter | Description |
---|---|
Num_row | Number of rows in matrix |
Num_col | Number of columns in matrix |
elt_<r>_<c> | Element of matrix |
<r>
and <c>
should be substituted by printed decimal numbers. The values of r
should be from 0 to (num_row-1)
, and the values of c
should be from 0 to (num_col-1)
. Any undefined matrix elements
are assumed to be zero for (r!=c)
, and one for (r==c)
.
This corresponds to the identity transformation when the number of rows and columns
are the same. The number of columns corresponds to one more than the dimension of
the source coordinates and the number of rows corresponds to one more than the
dimension of target coordinates. The extra dimension in the matrix is used to
let the affine map do a translation.
numRow
- The number of matrix's rows.numCol
- The number of matrix's columns.
java.lang.IllegalArgumentException
- if numRow
or numCol
is not a positive number.final java.lang.Object toOpenGIS(java.lang.Object adapters)
Object
in order
to avoid too early class loading of OpenGIS interface.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |