public class CoordinateTransforms extends Object
CoordinateTransform
objects for simple cases.Constructor and Description |
---|
CoordinateTransforms() |
Modifier and Type | Method and Description |
---|---|
static CoordinateTransform |
getTransform(Rectangle2D worldBounds,
Rectangle imageBounds)
Gets the transform which converts from
worldBounds to imageBounds . |
static CoordinateTransform |
getTransform(Rectangle2D worldBounds,
Rectangle imageBounds,
boolean reverseX,
boolean reverseY)
Gets the transform which converts from
worldBounds to imageBounds . |
static CoordinateTransform |
identity()
Creates an identity transform.
|
static CoordinateTransform |
scale(double xscale,
double yscale)
Creates a scaling transform.
|
static CoordinateTransform |
translation(double dx,
double dy)
Creates a translation transform.
|
static CoordinateTransform |
unitBounds(Rectangle imageBounds)
Creates a transform for working in the unit rectangle, ie. proportional
image coordinates where both X and Y ordinates vary from 0 to 1.
|
public static CoordinateTransform identity()
public static CoordinateTransform scale(double xscale, double yscale)
xscale
- scale on the X axisyscale
- scale on the Y axispublic static CoordinateTransform translation(double dx, double dy)
dx
- translation in the X directiondy
- translation in the Y directionpublic static CoordinateTransform unitBounds(Rectangle imageBounds)
imageBounds
- the image boundsIllegalArgumentException
- if imageBounds
is null
or emptypublic static CoordinateTransform getTransform(Rectangle2D worldBounds, Rectangle imageBounds)
worldBounds
to imageBounds
.
This method is a shortcut for getTransform(worldBounds, imageBounds, false, false)
.worldBounds
- the coordinate bounds in world (user-defined) unitsimageBounds
- the image boundsIllegalArgumentException
- if either argument is null
or emptypublic static CoordinateTransform getTransform(Rectangle2D worldBounds, Rectangle imageBounds, boolean reverseX, boolean reverseY)
worldBounds
to imageBounds
.
The two boolean
arguments provide the option of treating the world X and/or Y
axis direction as reversed in relation to the corresponding image axis direction.
Example: for an image representing a geographic area, aligned such that the image
Y-axis was parallel with the world north-south axis, then setting reverseY
to true
will result in correct transformation of world to image coordinates.
worldBounds
- the coordinate bounds in world (user-defined) unitsimageBounds
- the image boundsreverseX
- whether to treat the direction of the world X axis as reversed
in relation to the image X axisreverseY
- whether to treat the direction of the world Y axis as reversed
in relation to the image Y axisIllegalArgumentException
- if either argument is null
or emptyCopyright © 2006–2018 GeoSolutions. All rights reserved.