|
deegree 2.1 (2007/11/08 09:57 build-328-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deegree.model.csct.ct.MathTransformFactory
public class 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.
Field Summary | |
---|---|
(package private) static WeakHashSet |
pool
A pool of math transform. |
Constructor Summary | |
---|---|
MathTransformFactory(MathTransformProvider[] providers)
Construct a factory using the specified providers. |
Method Summary | |
---|---|
MathTransform2D |
createAffineTransform(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(String classification,
javax.media.jai.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. |
String[] |
getAvailableTransforms()
Returns the classification names of every available transforms. |
static MathTransformFactory |
getDefault()
Returns the default math transform factory. |
MathTransformProvider |
getMathTransformProvider(String classification)
Returns the provider for the specified classification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final WeakHashSet pool
Constructor Detail |
---|
public MathTransformFactory(MathTransformProvider[] providers)
providers
- Method Detail |
---|
public static MathTransformFactory getDefault()
public MathTransform createIdentityTransform(int dimension)
dimension
- The source and target dimension.
public MathTransform2D createAffineTransform(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.
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(String classification, javax.media.jai.ParameterList parameters) throws 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.
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 NoSuchElementException, MissingParameterException
projection
- The projection.
NoSuchElementException
- if there is no transform for the specified projection.
MissingParameterException
- if a parameter was required but not found.public String[] getAvailableTransforms()
null
.public MathTransformProvider getMathTransformProvider(String classification) throws 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.
NoSuchElementException
- if there is no provider registered with the specified classification name.public MathTransformProvider getAffineTransformProvider(int numRow, int numCol) throws 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.
IllegalArgumentException
- if numRow
or numCol
is not a positive number.
|
deegree 2.1 (2007/11/08 09:57 build-328-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://deegree.sourceforge.net