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 anRasterLayoutwith no parameters set.RasterLayout(int minX, int minY, int width, int height) Constructs anRasterLayoutwith only the image dimension parameters set.RasterLayout(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight) Constructs anRasterLayoutwith all its parameters set.Constructs anRasterLayoutwith all its parameters set to equal those of a givenRenderedImage.RasterLayout(Rectangle bounds) -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a clone of theRasterLayoutas an Object.booleanTests if the specifiedObjectequals thisRasterLayout.intReturns the value of height if it is valid, and otherwise returns the value from the suppliedRenderedImage.intgetMinX()Returns the value ofminXif it is valid, and otherwise returns the value from the suppliedRenderedImage.intgetMinY()Returns the value ofminYif it is valid, and otherwise returns the value from the suppliedRenderedImage.intReturns the value oftileGridXOffsetif it is valid, and otherwise returns the value from the suppliedRenderedImage.intReturns the value oftileGridYOffsetif it is valid, and otherwise returns the value from the suppliedRenderedImage.intReturns the value of tileHeight if it is valid, and otherwise returns the value from the suppliedRenderedImage.intReturns the value oftileWidthif it is valid, and otherwise returns the value from the suppliedRenderedImage.intgetWidth()Returns the value ofwidthif it is valid, and otherwise returns the value from the suppliedRenderedImage.inthashCode()setHeight(int height) Sets height to the supplied value and marks it as valid.setMinX(int minX) SetsminXto the supplied value and marks it as valid.setMinY(int minY) SetsminYto the supplied value and marks it as valid.setTileGridXOffset(int tileGridXOffset) SetstileGridXOffsetto the supplied value and marks it as valid.setTileGridYOffset(int tileGridYOffset) SetstileGridYOffsetto 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) SetstileWidthto the supplied value and marks it as valid.setWidth(int width) Setswidthto 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 anRasterLayoutwith no parameters set. -
RasterLayout
public RasterLayout(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, int tileWidth, int tileHeight) Constructs anRasterLayoutwith all its parameters set. ThesampleModelandcolorModelparameters 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 anRasterLayoutwith 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 anRasterLayoutwith all its parameters set to equal those of a givenRenderedImage.- Parameters:
im- aRenderedImagewhose layout will be copied.
-
RasterLayout
-
-
Method Details
-
toRectangle
-
getMinX
public int getMinX()Returns the value ofminXif it is valid, and otherwise returns the value from the suppliedRenderedImage. IfminXis not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of minX.
-
setMinX
SetsminXto 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
RasterLayoutfollowing the change.
-
getMinY
public int getMinY()Returns the value ofminYif it is valid, and otherwise returns the value from the suppliedRenderedImage. IfminYis not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of minY.
-
setMinY
SetsminYto 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
RasterLayoutfollowing the change.
-
getWidth
public int getWidth()Returns the value ofwidthif it is valid, and otherwise returns the value from the suppliedRenderedImage. Ifwidthis not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of width.
-
setWidth
Setswidthto the supplied value and marks it as valid.- Parameters:
width- the width of the image, as an int.- Returns:
- a reference to this
RasterLayoutfollowing the change. - Throws:
IllegalArgumentException- ifwidthis 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
RasterLayoutfollowing the change. - Throws:
IllegalArgumentException- ifheightis non-positive.
-
getTileGridXOffset
public int getTileGridXOffset()Returns the value oftileGridXOffsetif it is valid, and otherwise returns the value from the suppliedRenderedImage. IftileGridXOffsetis not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileGridXOffset.
-
setTileGridXOffset
SetstileGridXOffsetto 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
RasterLayoutfollowing the change.
-
getTileGridYOffset
public int getTileGridYOffset()Returns the value oftileGridYOffsetif it is valid, and otherwise returns the value from the suppliedRenderedImage. IftileGridYOffsetis not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileGridYOffset.
-
setTileGridYOffset
SetstileGridYOffsetto 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
RasterLayoutfollowing the change.
-
getTileWidth
public int getTileWidth()Returns the value oftileWidthif it is valid, and otherwise returns the value from the suppliedRenderedImage. IftileWidthis not valid and fallback is null, 0 is returned.- Returns:
- the appropriate value of tileWidth.
-
setTileWidth
SetstileWidthto the supplied value and marks it as valid.- Parameters:
tileWidth- the width of a tile, as an int.- Returns:
- a reference to this
RasterLayoutfollowing the change. - Throws:
IllegalArgumentException- iftileWidthis 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
RasterLayoutfollowing the change. - Throws:
IllegalArgumentException- iftileHeightis non-positive.
-
toString
Returns a String containing the values of all valid fields. -
clone
Returns a clone of theRasterLayoutas an Object. -
equals
Tests if the specifiedObjectequals thisRasterLayout. -
hashCode
public int hashCode()
-