public class GridExtent
extends java.lang.Object
Constructor and Description |
---|
GridExtent() |
GridExtent(ISextanteLayer layer)
Creates a new grid extent using the extent of a layer
If it is a raster layer, it will also use its cellsize
|
Modifier and Type | Method and Description |
---|---|
void |
addExtent(GridExtent extent)
Modifies this extent to incorporate another one into its
boundaries
|
boolean |
contains(double x,
double y)
Returns true if the given point falls within the area covered
by this extent
|
boolean |
containsCell(int x,
int y)
Returns true if the cell is within the limits of this
grid extent
|
void |
enlargeOneCell()
Enlarges this grid extent one cell in each direction
|
boolean |
equals(GridExtent extent)
Returns true if this extent has them same characteristics as a given one
|
boolean |
fitsIn(GridExtent extent)
Returns true if the given extents matches the grid defined by this
grid extent (has same size and cell boundaries match)
|
java.awt.geom.Rectangle2D |
getAsRectangle2D()
Returns this extent as a Java Rectangle2D
|
double |
getCellSize()
Returns the cellsize of this extent
|
GridCell |
getGridCoordsFromWorldCoords(double x,
double y)
Converts a world coordinate to grid coordinates
|
GridCell |
getGridCoordsFromWorldCoords(java.awt.geom.Point2D pt)
Converts a world coordinate to grid coordinates
|
double |
getHeight()
Returns the real Y distance spanned by this extent
|
int |
getNX()
Returns the number of columns in the extent
|
int |
getNY()
Returns the number of rows in the extent
|
double |
getWidth()
Returns the real X distance spanned by this extent
|
java.awt.geom.Point2D |
getWorldCoordsFromGridCoords(GridCell cell)
/**
Converts a grid cell into a world coordinate representing
the center of that cell
|
java.awt.geom.Point2D |
getWorldCoordsFromGridCoords(int x,
int y)
Converts a grid cell into a world coordinate representing
the center of that cell
|
double |
getXMax()
Return the maximum x coordinate of the extent.
|
double |
getXMin()
Return the minimum x coordinate of the extent.
|
double |
getYMax()
Return the maximum y coordinate of the extent.
|
double |
getYMin()
Return the minimum x coordinateof the extent.
|
void |
setCellSize(double cellSize)
Sets a new cellsize for this extent
|
void |
setXRange(double dXMin,
double dXMax)
Sets a new range for X coordinates.
|
void |
setYRange(double dYMin,
double dYMax)
Sets a new range for Y coordinates.
|
java.lang.String |
toString() |
public GridExtent()
public GridExtent(ISextanteLayer layer)
layer
- a layerpublic void setXRange(double dXMin, double dXMax)
dXMin
- the minimum x coordinate of the extent.dXMax
- the maximum x coordinate of the extentpublic void setYRange(double dYMin, double dYMax)
dYMin
- the minimum Y coordinate of the extent.dYMax
- the maximum Y coordinate of the extentpublic double getCellSize()
public void setCellSize(double cellSize)
cellSize
- the new cellsizepublic int getNX()
public int getNY()
public double getXMin()
public double getXMax()
public double getYMin()
public double getYMax()
public double getWidth()
public double getHeight()
public boolean contains(double x, double y)
x
- the x coordinate of the pointy
- the y coordinate of the pointpublic boolean fitsIn(GridExtent extent)
extent
- public boolean equals(GridExtent extent)
extent
- public void addExtent(GridExtent extent)
extent
- the extent to addpublic GridCell getGridCoordsFromWorldCoords(java.awt.geom.Point2D pt)
pt
- a point in world coordinatespublic GridCell getGridCoordsFromWorldCoords(double x, double y)
x
- the x coordinate of the pointy
- the y coordinate of the pointpublic java.awt.geom.Point2D getWorldCoordsFromGridCoords(GridCell cell)
cell
- the cell to convertpublic java.awt.geom.Point2D getWorldCoordsFromGridCoords(int x, int y)
x
- the x coordinate (col) of the celly
- the y coordinate (row) of the cellpublic java.lang.String toString()
toString
in class java.lang.Object
public void enlargeOneCell()
public java.awt.geom.Rectangle2D getAsRectangle2D()
public boolean containsCell(int x, int y)
x
- the x coordinate (col) of the celly
- the y coordinate (row) of the cell