Package org.geotools.coverage.io
Class RasterLayout
Object
RasterLayout
- All Implemented Interfaces:
Cloneable
A class describing the desired layout of an
OpImage
.
The RasterLayout
class encapsulates three types of information about an image:
- The image bounds, comprising the min X and Y coordinates, image width, and image height;
- The tile grid layout, comprising the tile grid X and Y offsets, the tile width, and the tile height; and
Methods that modify the state of an RasterLayout
return a reference to 'this' following the change.
This allows multiple modifications to be made in a single expression. This provides a way of modifying an
RasterLayout
within a superclass constructor call.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anRasterLayout
with no parameters set.RasterLayout
(int minX, int minY, int width, int height) Constructs anRasterLayout
with only the image dimension parameters set.RasterLayout
(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight) Constructs anRasterLayout
with all its parameters set.Constructs anRasterLayout
with all its parameters set to equal those of a givenRenderedImage
.RasterLayout
(Rectangle bounds) -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of theRasterLayout
as an Object.boolean
Tests if the specifiedObject
equals thisRasterLayout
.int
Returns the value of height if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
getMinX()
Returns the value ofminX
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
getMinY()
Returns the value ofminY
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
Returns the value oftileGridXOffset
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
Returns the value oftileGridYOffset
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
Returns the value of tileHeight if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
Returns the value oftileWidth
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
getWidth()
Returns the value ofwidth
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
hashCode()
setHeight
(int height) Sets height to the supplied value and marks it as valid.setMinX
(int minX) SetsminX
to the supplied value and marks it as valid.setMinY
(int minY) SetsminY
to the supplied value and marks it as valid.setTileGridXOffset
(int tileGridXOffset) SetstileGridXOffset
to the supplied value and marks it as valid.setTileGridYOffset
(int tileGridYOffset) SetstileGridYOffset
to the supplied value and marks it as valid.setTileHeight
(int tileHeight) Sets tileHeight to the supplied value and marks it as valid.setTileWidth
(int tileWidth) SetstileWidth
to the supplied value and marks it as valid.setWidth
(int width) Setswidth
to the supplied value and marks it as valid.toString()
Returns a String containing the values of all valid fields.
-
Constructor Details
-
RasterLayout
public RasterLayout()Constructs anRasterLayout
with no parameters set. -
RasterLayout
public RasterLayout(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight) Constructs anRasterLayout
with all its parameters set. ThesampleModel
andcolorModel
parameters are ignored if null.- Parameters:
minX
- the image's minimum X coordinate.minY
- the image's minimum Y coordinate.width
- the image's width.height
- the image's height.tileGridXOffset
- the X coordinate of tile (0, 0).tileGridYOffset
- the Y coordinate of tile (0, 0).tileWidth
- the width of a tile.tileHeight
- the height of a tile.
-
RasterLayout
public RasterLayout(int minX, int minY, int width, int height) Constructs anRasterLayout
with only the image dimension parameters set.- Parameters:
minX
- the image's minimum X coordinate.minY
- the image's minimum Y coordinate.width
- the image's width.height
- the image's height.
-
RasterLayout
Constructs anRasterLayout
with all its parameters set to equal those of a givenRenderedImage
.- Parameters:
im
- aRenderedImage
whose layout will be copied.
-
RasterLayout
-
-
Method Details
-
toRectangle
-
getMinX
public int getMinX()Returns the value ofminX
if it is valid, and otherwise returns the value from the suppliedRenderedImage
. IfminX
is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of minX.
-
setMinX
SetsminX
to the supplied value and marks it as valid.- Parameters:
minX
- the minimum X coordinate of the image, as an int.- Returns:
- a reference to this
RasterLayout
following the change.
-
getMinY
public int getMinY()Returns the value ofminY
if it is valid, and otherwise returns the value from the suppliedRenderedImage
. IfminY
is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of minY.
-
setMinY
SetsminY
to the supplied value and marks it as valid.- Parameters:
minY
- the minimum Y coordinate of the image, as an int.- Returns:
- a reference to this
RasterLayout
following the change.
-
getWidth
public int getWidth()Returns the value ofwidth
if it is valid, and otherwise returns the value from the suppliedRenderedImage
. Ifwidth
is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of width.
-
setWidth
Setswidth
to the supplied value and marks it as valid.- Parameters:
width
- the width of the image, as an int.- Returns:
- a reference to this
RasterLayout
following the change. - Throws:
IllegalArgumentException
- ifwidth
is non-positive.
-
getHeight
public int getHeight()Returns the value of height if it is valid, and otherwise returns the value from the suppliedRenderedImage
. If height is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of height.
-
setHeight
Sets height to the supplied value and marks it as valid.- Parameters:
height
- the height of the image, as an int.- Returns:
- a reference to this
RasterLayout
following the change. - Throws:
IllegalArgumentException
- ifheight
is non-positive.
-
getTileGridXOffset
public int getTileGridXOffset()Returns the value oftileGridXOffset
if it is valid, and otherwise returns the value from the suppliedRenderedImage
. IftileGridXOffset
is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileGridXOffset.
-
setTileGridXOffset
SetstileGridXOffset
to the supplied value and marks it as valid.- Parameters:
tileGridXOffset
- the X coordinate of tile (0, 0), as an int.- Returns:
- a reference to this
RasterLayout
following the change.
-
getTileGridYOffset
public int getTileGridYOffset()Returns the value oftileGridYOffset
if it is valid, and otherwise returns the value from the suppliedRenderedImage
. IftileGridYOffset
is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileGridYOffset.
-
setTileGridYOffset
SetstileGridYOffset
to the supplied value and marks it as valid.- Parameters:
tileGridYOffset
- the Y coordinate of tile (0, 0), as an int.- Returns:
- a reference to this
RasterLayout
following the change.
-
getTileWidth
public int getTileWidth()Returns the value oftileWidth
if it is valid, and otherwise returns the value from the suppliedRenderedImage
. IftileWidth
is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileWidth.
-
setTileWidth
SetstileWidth
to the supplied value and marks it as valid.- Parameters:
tileWidth
- the width of a tile, as an int.- Returns:
- a reference to this
RasterLayout
following the change. - Throws:
IllegalArgumentException
- iftileWidth
is non-positive.
-
getTileHeight
public int getTileHeight()Returns the value of tileHeight if it is valid, and otherwise returns the value from the suppliedRenderedImage
. If tileHeight is not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileHeight.
-
setTileHeight
Sets tileHeight to the supplied value and marks it as valid.- Parameters:
tileHeight
- the height of a tile, as an int.- Returns:
- a reference to this
RasterLayout
following the change. - Throws:
IllegalArgumentException
- iftileHeight
is non-positive.
-
toString
Returns a String containing the values of all valid fields. -
clone
Returns a clone of theRasterLayout
as an Object. -
equals
Tests if the specifiedObject
equals thisRasterLayout
. -
hashCode
public int hashCode()
-