class Bounds extends java.lang.Object
A Bounds is an Envelope with a Projection.
Bounds b = new Bounds(1,2,3,4, new Projection("EPSG:2927"))
Type | Name and description |
---|---|
ReferencedEnvelope |
env The GeoTools' wrapped ReferencedEnvelope |
Projection |
proj |
Constructor and description |
---|
Bounds
(ReferencedEnvelope env) Create a new Bounds wrapping a ReferencedEnvelope. |
Bounds
(Envelope env) Create a new Bounds wrapping an Envelope. |
Bounds
(double minX, double minY, double maxX, double maxY) Create a new Bounds with minX, minY, maxX, and maxY coordinates. |
Bounds
(double minX, double minY, double maxX, double maxY, java.lang.Object proj) Create a new Bounds with minX, minY, maxX, and maxY coordinates and a Projection. |
Bounds
(Point point, double width, double height, boolean isOrigin) Create a new Bounds from a Point (which can either be the origin/lower left or center) and a width and height |
Type Params | Return Type | Name and description |
---|---|---|
|
java.lang.Object |
asType(java.lang.Class type) Override the asType method to convert Bounds to Geometry if the Class is Geometry |
|
boolean |
contains(Bounds other) Determine whether this Bounds contains the other Bounds |
|
boolean |
contains(Point point) Determine whether this Bounds contains the Point |
|
LineString |
createArc(double startAngle, double angleExtent, int numPoints, double rotation) Create a LineString arc based on this Bound's extent from the start angle (in radians) for the given angle extent (also in radians) with the given number of points and rotation. |
|
Polygon |
createArcPolygon(double startAngle, double angleExtent, int numPoints, double rotation) Create a Polygon arc based on this Bound's extent from the start angle (in radians) for the given angle extent (also in radians) with the given number of points and rotation. |
|
Polygon |
createEllipse(int numPoints, double rotation) Create an ellipse or circle based on this Bound's extent with the given number of points and rotation. |
|
Polygon |
createHexagon(boolean inverted) Create a hexagon based on this Bound's extent |
|
Polygon |
createRectangle(int numPoints, double rotation) Create a rectangle or square based on this Bound's extent with the given number of points and rotation. |
|
Polygon |
createSineStar(int numberOfArms, double armLengthRatio, int numPoints, double rotation) Create a sine star based on this Bound's extent with the given number of arms and arm length ratio with the given number of points and rotation. |
|
Polygon |
createSquircle(int numPoints, double rotation) Create a squircle based on this Bound's extent with the given number of points and rotation. |
|
Polygon |
createSuperCircle(double power, int numPoints, double rotation) Create a super circle based on this Bound's extent with the given number of points and rotation. |
|
MultiPolygon |
createTriangles() Create triangles to fill the Bounds |
|
Bounds |
ensureWidthAndHeight() Ensure that the Bounds has a width and height. |
|
boolean |
equals(java.lang.Object other) Determine whether this Bounds equals another Bounds |
|
Bounds |
expand(Bounds other) Expand this Bounds to include another Bounds |
|
Bounds |
expandBy(double distance) Expand the Bounds by the given distance in all directions |
|
Bounds |
fixAspectRatio(int w, int h) Fix the aspect ration of this Bounds based on the given width and height. |
|
static Bounds |
fromString(java.lang.String str) Create a Bounds from a String or return null |
|
void |
generateGrid(int columns, int rows, java.lang.String type, groovy.lang.Closure c) Generate a grid with the given number or rows and columns |
|
void |
generateGrid(double cellWidth, double cellHeight, java.lang.String type, groovy.lang.Closure c) Generate a grid with the given cell width and height |
|
double |
getArea() Get the area of this Bounds |
|
double |
getAspect() Get the ratio of width to height for this bounds. |
|
java.lang.Object |
getAt(int index) Get a value from this Bounds at the given index (minX = 0, minY = 1, maxX = 2, maxY = 3). |
|
java.util.List |
getCorners() Get the corners of the Bounds as a List of Points. |
|
Geometry |
getGeometry() Convert this Bounds into a Geometry object |
|
Geometry |
getGrid(int columns, int rows, java.lang.String type) Get a generated grid with the given number of the rows and column |
|
Geometry |
getGrid(double cellWidth, double cellHeight, java.lang.String type) Get a generated grid with the given cell width and height |
|
double |
getHeight() Get the height |
|
double |
getMaxX() Get the right/east most coordinate (maxX) |
|
double |
getMaxY() Get the top/north most coordinate (maxY) |
|
double |
getMinX() Get the left/west most coordinate (minX) |
|
double |
getMinY() Get the bottom/south most coordinate (minY) |
|
Polygon |
getPolygon() Convert this Bounds into a Polygon |
|
Projection |
getProj() Get the Projection (if any) or null |
|
double |
getWidth() Get the width |
|
int |
hashCode() Get the hash code for this Bounds |
|
Bounds |
intersection(Bounds other) Calculate the intersection between this Bounds and the other Bounds |
|
boolean |
intersects(Bounds other) Determine whether this Bounds intersects with the other Bounds |
|
boolean |
isEmpty() Get whether the Bounds is empty (width and height are zero) |
|
void |
quadTree(int start, int stop, groovy.lang.Closure closure) Calculate a quad tree for this Bounds between the start and stop levels. |
|
Bounds |
reproject(java.lang.Object proj) Reprojects the Bounds |
|
Bounds |
scale(double factor) Scales the current Bounds by a specific factor. |
|
void |
setProj(java.lang.Object projection) Set a Projection if the current Projection is not set or reproject if needed |
|
java.util.List<Bounds> |
tile(double res) Partitions the bounding box into a set of smaller bounding boxes. |
|
java.lang.String |
toString() The string representation |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
The GeoTools' wrapped ReferencedEnvelope
Create a new Bounds wrapping a ReferencedEnvelope.
ReferencedEnvelope e = new ReferencedEnvelope(1,3,2,4,null)
Bounds b = new Bounds(e)
env
- The ReferencedEnvelopeCreate a new Bounds wrapping an Envelope.
Envelope e = new Envelope(1,3,2,4)
Bounds b = new Bounds(e)
env
- The ReferencedEnvelopeCreate a new Bounds with minX, minY, maxX, and maxY coordinates.
Bounds b = new Bounds(1,2,3,4)
minX
- The left/west most coordinate (minX)minY
- the bottom/south most coordinate (minY)maxX
- The right/east most coordinate (maxX)maxY
- The top/north most coordinate (maxY)Create a new Bounds with minX, minY, maxX, and maxY coordinates and a Projection.
Bounds b = new Bounds(1,2,3,4, new Projection("EPSG:2927"))
Bounds b = new Bounds(1,2,3,4, "EPSG:2927")
minX
- The left/minX most coordinate (minX)minY
- the bottom/minY most coordinate (minY)maxX
- The right/maxX most coordinate (maxX)maxY
- The top/maxY most coordinate (maxY)proj
- The Projection can either be a Projection or a StringCreate a new Bounds from a Point (which can either be the origin/lower left or center) and a width and height
point
- The Point origin or centerwidth
- The widthheight
- The heightisOrigin
- Whether the Point is the origin (true) or the center (false)Override the asType method to convert Bounds to Geometry if the Class is Geometry
type
- The ClassDetermine whether this Bounds contains the other Bounds
other
- The other BoundsDetermine whether this Bounds contains the Point
point
- The PointCreate a LineString arc based on this Bound's extent from the start angle (in radians) for the given angle extent (also in radians) with the given number of points and rotation.
startAngle
- The start angle (in radians)angleExtent
- The extent of the angle (in radians)numPoints
- The number of pointsrotation
- The rotation angleCreate a Polygon arc based on this Bound's extent from the start angle (in radians) for the given angle extent (also in radians) with the given number of points and rotation.
startAngle
- The start angle (in radians)angleExtent
- The extent of the angle (in radians)numPoints
- The number of pointsrotation
- The rotation angleCreate an ellipse or circle based on this Bound's extent with the given number of points and rotation.
numPoints
- The number of pointsrotation
- The rotation angleCreate a hexagon based on this Bound's extent
inverted
- Whether the hexagon is inverted. If true then
the point is north/south, else point is east/westCreate a rectangle or square based on this Bound's extent with the given number of points and rotation.
numPoints
- The number of pointsrotation
- The rotation angleCreate a sine star based on this Bound's extent with the given number of arms and arm length ratio with the given number of points and rotation.
numberOfArms
- The number of armsarmLengthRatio
- The arm length rationumPoints
- The number of pointsrotation
- The rotation angleCreate a squircle based on this Bound's extent with the given number of points and rotation.
numPoints
- The number of pointsrotation
- The rotation angleCreate a super circle based on this Bound's extent with the given number of points and rotation.
power
- The positive powernumPoints
- The number of pointsrotation
- The rotation angleCreate triangles to fill the Bounds
Ensure that the Bounds has a width and height. Handle vertical and horizontal lines and points.
Determine whether this Bounds equals another Bounds
other
- The other BoundsExpand this Bounds to include another Bounds
other
- Another BoundsExpand the Bounds by the given distance in all directions
distance
- The distanceFix the aspect ration of this Bounds based on the given width and height.
w
- The image widthh
- The image heightCreate a Bounds from a String or return null
str
- The stringGenerate a grid with the given number or rows and columns
columns
- The number of columnsrows
- The number of rowstype
- The cell type (polygon, point, circle/ellipse, hexagon, hexagon-inv, triangle)c
- A Closure that is called with each Geometry cell with the geometry, the column, and the rowGenerate a grid with the given cell width and height
cellWidth
- The cell widthcellHeight
- The cell heighttype
- The cell type (polygon, point, circle/ellipse, hexagon, hexagon-inv, triangle)c
- A Closure that is called with each Geometry cell with the geometry, the column, and the rowGet the area of this Bounds
Get the ratio of width to height for this bounds.
Get a value from this Bounds at the given index (minX = 0, minY = 1, maxX = 2, maxY = 3).
Bounds b = new Bounds(1,2,3,4)
def w = b[0]
def (w,s,e,n) = b
Get the corners of the Bounds as a List of Points. The ordering is: [minX,minY],[minX, maxY],[maxX,maxY],[maxX,minY]
Convert this Bounds into a Geometry object
Get a generated grid with the given number of the rows and column
columns
- The number of columnsrows
- The number of rowstype
- The cell type (polygon, point, circle/ellipse, hexagon, hexagon-inv, triangle)Get a generated grid with the given cell width and height
cellWidth
- The cell widthcellHeight
- The cell heighttype
- The cell type (polygon, point, circle/ellipse, hexagon, hexagon-inv, triangle)Get the height
Get the right/east most coordinate (maxX)
Get the top/north most coordinate (maxY)
Get the left/west most coordinate (minX)
Get the bottom/south most coordinate (minY)
Convert this Bounds into a Polygon
Get the Projection (if any) or null
Get the width
Get the hash code for this Bounds
Calculate the intersection between this Bounds and the other Bounds
other
- The other BoundsDetermine whether this Bounds intersects with the other Bounds
other
- The other BoundsGet whether the Bounds is empty (width and height are zero)
Calculate a quad tree for this Bounds between the start and stop levels. The Closure is called for each new Bounds generated.
start
- The start levelstop
- The stop levelclosure
- The Closure called for each new BoundsReprojects the Bounds
proj
- A Projection or StringScales the current Bounds by a specific factor.
factor
- The scale factorSet a Projection if the current Projection is not set or reproject if needed
projection
- The new ProjectionPartitions the bounding box into a set of smaller bounding boxes.
res
- The resolution to tile at and should be in range 0-1.The string representation
Groovy Documentation