ZOO.Bounds¶
Instances of this class represent bounding boxes.
Properties¶
NAME | DESCRIPTION |
---|---|
left | {Number} Minimum horizontal coordinate. |
bottom | {Number} Minimum vertical coordinate. |
right | {Number} Maximum horizontal coordinate. |
top | {Number} Maximum vertical coordinate. |
Functions¶
NAME | DESCRIPTION |
---|---|
ZOO.Bounds | Construct a new bounds object. |
clone | Create a cloned instance of this bounds. |
equals | Test a two bounds for equivalence. |
toString | {String} String representation of bounds object. |
toBBOX | |
toGeometry | Create a new polygon geometry based on this bounds. |
getWidth | {Float} The width of the bounds |
getHeight | {Float} The height of the bounds (top minus bottom) |
add | |
extend | Extend the bounds to include the point, lonlat, or bounds specified. |
intersectsBounds | Determine whether the target bounds intersects this bounds. |
containsBounds | Determine whether the target bounds is contained within this bounds. |
Properties
- left
{Number}
Minimum horizontal coordinate.
- bottom
{Number}
Minimum vertical coordinate.
- right
{Number}
Maximum horizontal coordinate.
- top
{Number}
Maximum vertical coordinate.
Functions
- ZOO.Bounds
Construct a new bounds object.
Parameters
left {Number}
The left bounds of the box. Note that for width calculations, this is assumed to be less than the right value.bottom {Number}
The bottom bounds of the box. Note that for height calculations, this is assumed to be more than the top value.right {Number}
The right bounds.top {Number}
The top bounds.
- clone
clone:function()
Create a cloned instance of this bounds.
Returns
{ZOO.Bounds} A fresh copy of the bounds
- equals
equals:function(bounds)
Test a two bounds for equivalence.
Parameters
bounds {ZOO.Bounds}
Returns
{Boolean}
The passed-in bounds object has the same left, right, top, bottom components as this. Note that if bounds passed in is null, returns false.
- toString
toString:function()
Returns
{String}
String representation of bounds object. (ex. <i>”left-bottom=(5,42) right-top=(10,45)”</i>)
- toBBOX
toBBOX:function(decimal)
Parameters
decimal {Integer}
How many significant digits in the bbox coords? Default is 6Returns
{String}
Simple String representation of bounds object. (ex. <i>”5,42,10,45”</i>)
- toGeometry
toGeometry: function()
Create a new polygon geometry based on this bounds.
Returns
{ZOO.Geometry.Polygon} A new polygon with the coordinates of this bounds.
- getWidth
getWidth:function()
Returns
{Float}
The width of the bounds
- getHeight
getHeight:function()
Returns
{Float}
The height of the bounds (top minus bottom).
- add
add:function(x,y)
Parameters
x {Float}
y {Float}
Returns
{ZOO.Bounds} A new bounds whose coordinates are the same as this, but shifted by the passed-in x and y values.
- extend
extend:function(object)
Extend the bounds to include the point, lonlat, or bounds specified. Note, this function assumes that left < right and bottom < top.
Parameters
object {Object}
Can be Point, or Bounds.
- intersectsBounds
intersectsBounds:function(bounds,inclusive)
Determine whether the target bounds intersects this bounds. Bounds are considered intersecting if any of their edges intersect or if one bounds contains the other.
Parameters
bounds
{ZOO.Bounds} The target bounds.inclusive {Boolean}
Treat coincident borders as intersecting. Default is true. If false, bounds that do not overlap but only touch at the border will not be considered as intersecting.Returns
{Boolean}
The passed-in bounds object intersects this bounds.
- containsBounds
containsBounds:function(bounds,partial,inclusive)
Determine whether the target bounds is contained within this bounds.
Parameters
bounds
{ZOO.Bounds} The target bounds.partial {Boolean}
If any of the target corners is within this bounds consider the bounds contained. Default is false. If true, the entire target bounds must be contained within this bounds.inclusive {Boolean}
Treat shared edges as contained. Default is true.Returns
{Boolean}
The passed-in bounds object is contained within this bounds.