Package org.geotools.coverage.io
Class RasterLayout
- Object
-
- RasterLayout
-
- All Implemented Interfaces:
Cloneable
public class RasterLayout extends Object implements Cloneable
A class describing the desired layout of anOpImage
.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 anRasterLayout
within a superclass constructor call.
-
-
Constructor Summary
Constructors Constructor Description RasterLayout()
Constructs 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.RasterLayout(RenderedImage im)
Constructs anRasterLayout
with all its parameters set to equal those of a givenRenderedImage
.RasterLayout(Rectangle bounds)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Returns a clone of theRasterLayout
as an Object.boolean
equals(Object obj)
Tests if the specifiedObject
equals thisRasterLayout
.int
getHeight()
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
getTileGridXOffset()
Returns the value oftileGridXOffset
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
getTileGridYOffset()
Returns the value oftileGridYOffset
if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
getTileHeight()
Returns the value of tileHeight if it is valid, and otherwise returns the value from the suppliedRenderedImage
.int
getTileWidth()
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()
RasterLayout
setHeight(int height)
Sets height to the supplied value and marks it as valid.RasterLayout
setMinX(int minX)
SetsminX
to the supplied value and marks it as valid.RasterLayout
setMinY(int minY)
SetsminY
to the supplied value and marks it as valid.RasterLayout
setTileGridXOffset(int tileGridXOffset)
SetstileGridXOffset
to the supplied value and marks it as valid.RasterLayout
setTileGridYOffset(int tileGridYOffset)
SetstileGridYOffset
to the supplied value and marks it as valid.RasterLayout
setTileHeight(int tileHeight)
Sets tileHeight to the supplied value and marks it as valid.RasterLayout
setTileWidth(int tileWidth)
SetstileWidth
to the supplied value and marks it as valid.RasterLayout
setWidth(int width)
Setswidth
to the supplied value and marks it as valid.Rectangle
toRectangle()
String
toString()
Returns a String containing the values of all valid fields.
-
-
-
Constructor Detail
-
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
public RasterLayout(RenderedImage im)
Constructs anRasterLayout
with all its parameters set to equal those of a givenRenderedImage
.- Parameters:
im
- aRenderedImage
whose layout will be copied.
-
RasterLayout
public RasterLayout(Rectangle bounds)
-
-
Method Detail
-
toRectangle
public Rectangle 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
public RasterLayout setMinX(int minX)
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
public RasterLayout setMinY(int minY)
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
public RasterLayout setWidth(int width)
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
public RasterLayout setHeight(int height)
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
public RasterLayout setTileGridXOffset(int tileGridXOffset)
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
public RasterLayout setTileGridYOffset(int tileGridYOffset)
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
public RasterLayout setTileWidth(int tileWidth)
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
public RasterLayout setTileHeight(int tileHeight)
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
public String toString()
Returns a String containing the values of all valid fields.
-
clone
public Object clone()
Returns a clone of theRasterLayout
as an Object.
-
equals
public boolean equals(Object obj)
Tests if the specifiedObject
equals thisRasterLayout
.
-
-