.. _api-zoo-bounds: ZOO.Bounds ========== Instances of this class represent bounding boxes. Properties ---------- .. list-table:: :widths: 30 50 :header-rows: 1 * - NAME - DESCRIPTION * - :ref:`left ` - {Number} Minimum horizontal coordinate. * - :ref:`bottom ` - {Number} Minimum vertical coordinate. * - :ref:`right ` - {Number} Maximum horizontal coordinate. * - :ref:`top ` - {Number} Maximum vertical coordinate. Functions --------- .. list-table:: :widths: 20 50 :header-rows: 1 * - NAME - DESCRIPTION * - :ref:`ZOO.Bounds ` - Construct a new bounds object. * - :ref:`clone ` - Create a cloned instance of this bounds. * - :ref:`equals ` - Test a two bounds for equivalence. * - :ref:`toString ` - {String} String representation of bounds object. * - :ref:`toBBOX ` - * - :ref:`toGeometry ` - Create a new polygon geometry based on this bounds. * - :ref:`getWidth ` - {Float} The width of the bounds * - :ref:`getHeight ` - {Float} The height of the bounds (top minus bottom) * - :ref:`add ` - * - :ref:`extend ` - Extend the bounds to include the point, lonlat, or bounds specified. * - :ref:`intersectsBounds ` - Determine whether the target bounds intersects this bounds. * - :ref:`containsBounds ` - Determine whether the target bounds is contained within this bounds. **Properties** .. _left: left ``{Number}`` Minimum horizontal coordinate. .. _bottom: bottom ``{Number}`` Minimum vertical coordinate. .. _right: right ``{Number}`` Maximum horizontal coordinate. .. _top: top ``{Number}`` Maximum vertical coordinate. **Functions** .. _ZOO.Bounds: 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 :: clone:function() Create a cloned instance of this bounds. *Returns* :ref:`{ZOO.Bounds} ` A fresh copy of the bounds .. _equals: 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 :: toString:function() *Returns* ``{String}`` String representation of bounds object. (ex. *"left-bottom=(5,42) right-top=(10,45)"*) .. _toBBOX: toBBOX :: toBBOX:function(decimal) *Parameters* ``decimal {Integer}`` How many significant digits in the bbox coords? Default is 6 *Returns* ``{String}`` Simple String representation of bounds object. (ex. *"5,42,10,45"*) .. _toGeometry: toGeometry :: toGeometry: function() Create a new polygon geometry based on this bounds. *Returns* :ref:`{ZOO.Geometry.Polygon} ` A new polygon with the coordinates of this bounds. .. _getWidth: getWidth :: getWidth:function() *Returns* ``{Float}`` The width of the bounds .. _getHeight: getHeight :: getHeight:function() *Returns* ``{Float}`` The height of the bounds (top minus bottom). .. _add: add :: add:function(x,y) *Parameters* | ``x {Float}`` | ``y {Float}`` *Returns* :ref:`{ZOO.Bounds} ` A new bounds whose coordinates are the same as this, but shifted by the passed-in x and y values. .. _extend: 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 :: 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`` :ref:`{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 :: containsBounds:function(bounds,partial,inclusive) Determine whether the target bounds is contained within this bounds. *Parameters* | ``bounds`` :ref:`{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.