Pixels coordinates (usually (x,y) integer values inside the rectangle specified by the grid range) are expressed in some {@linkplain CoordinateReferenceSystem coordinate reference system} known at compiletime. This is often the case. For example the CRS attached to {@link BufferedImage}has always ( {@linkplain AxisDirection#COLUMN_POSITIVE column}, {@linkplain AxisDirection#ROW_POSITIVE row}) axis, with the origin (0,0) in the upper left corner, and row values increasing down.
"Real world" coordinates (inside the envelope) are expressed in arbitrary horizontal coordinate reference system. Axis directions may be ( {@linkplain AxisDirection#NORTH North}, {@linkplain AxisDirection#WEST West}), or ( {@linkplain AxisDirection#EAST East}, {@linkplain AxisDirection#NORTH North}), etc..
In such case (and assuming that the image's CRS has the same characteristics than the {@link BufferedImage}'s CRS described above):
{@link #setSwapXY swapXY} shall be set to {@code true} if the "real world" axisorder is ( {@linkplain AxisDirection#NORTH North}, {@linkplain AxisDirection#EAST East}) instead of ( {@linkplain AxisDirection#EAST East}, {@linkplain AxisDirection#NORTH North}). This axis swapping is necessary for mapping the ( {@linkplain AxisDirection#COLUMN_POSITIVE column}, {@linkplain AxisDirection#ROW_POSITIVE row}) axis order associated to the image CRS.
In addition, the "real world" axis directions shall be reversed (by invoking {@linkplain #reverseAxis reverseAxis}(dimension)
) if their direction is {@link AxisDirection#WEST WEST} (x axis) or {@link AxisDirection#NORTH NORTH}(y axis), in order to get them oriented toward the {@link AxisDirection#EAST EAST} or {@link AxisDirection#SOUTH SOUTH} direction respectively. The later may seemsunatural, but it reflects the fact that row values are increasing down in an {@link BufferedImage}'s CRS.
|
|
|
|
|
|