public final class PixelTranslation extends Object implements Serializable
PixelOrientation
.Modifier and Type | Field and Description |
---|---|
double |
dx
The translation among the x axis relative to pixel center.
|
double |
dy
The translation among the y axis relative to pixel center.
|
PixelOrientation |
orientation
The pixel orientation for this translation.
|
Modifier and Type | Method and Description |
---|---|
static PixelOrientation |
getPixelOrientation(double dx,
double dy)
Returns the pixel orientation for the given offset, or
null if none. |
static PixelOrientation |
getPixelOrientation(PixelInCell anchor)
Returns the pixel orientation for the given
PixelInCell code. |
static double |
getPixelTranslation(PixelInCell anchor)
Returns the position relative to the pixel center.
|
static PixelTranslation |
getPixelTranslation(PixelOrientation anchor)
Returns the specified position relative to the pixel center.
|
String |
toString()
Returns a string representation of this pixel translation.
|
static MathTransform |
translate(MathTransform gridToCRS,
PixelInCell current,
PixelInCell expected)
Translates the specified math transform according the specified pixel orientations.
|
static MathTransform |
translate(MathTransform gridToCRS,
PixelOrientation current,
PixelOrientation expected,
int xDimension,
int yDimension)
Translates the specified math transform according the specified pixel orientations.
|
public final PixelOrientation orientation
public final double dx
public final double dy
public static PixelOrientation getPixelOrientation(PixelInCell anchor) throws IllegalArgumentException
PixelInCell
code.anchor
- The PixelInCell
code, or null
.null
if the argument was null.IllegalArgumentException
- if the given code is unknown.public static double getPixelTranslation(PixelInCell anchor)
Pixel in cell | offset |
---|---|
CELL_CENTER | 0.0 |
CELL_CORNER | -0.5 |
This method is typically used for n-dimensional grids, where the number of dimension is unknown.
anchor
- The "pixel in cell" value.public static PixelTranslation getPixelTranslation(PixelOrientation anchor) throws IllegalArgumentException
Pixel orientation | x | y |
---|---|---|
CENTER | 0.0 | 0.0 |
UPPER_LEFT | -0.5 | -0.5 |
UPPER_RIGHT | +0.5 | -0.5 |
LOWER_LEFT | -0.5 | +0.5 |
LOWER_RIGHT | +0.5 | +0.5 |
This method can be used for grid restricted to 2 dimensions.
anchor
- The pixel orientation.IllegalArgumentException
- if the specified orientation is unknown.public static PixelOrientation getPixelOrientation(double dx, double dy)
null
if none. This is the
reverse of getPixelTranslation(PixelOrientation)
.dx
- The translation along x axis.dy
- The translation along y axis.null
if none.public static MathTransform translate(MathTransform gridToCRS, PixelInCell current, PixelInCell expected)
gridToCRS
- A math transform from pixel coordinates to any CRS.current
- The pixel orientation of the given gridToCRS
transform.expected
- The pixel orientation of the desired transform.current
to expected
.public static MathTransform translate(MathTransform gridToCRS, PixelOrientation current, PixelOrientation expected, int xDimension, int yDimension)
gridToCRS
- A math transform from pixel coordinates to any CRS.current
- The pixel orientation of the given gridToCRS
transform.expected
- The pixel orientation of the desired transform.xDimension
- The dimension of x coordinates (pixel columns). Often 0.yDimension
- The dimension of y coordinates (pixel rows). Often 1.current
to expected
.Copyright © 1996–2019 Geotools. All rights reserved.