[348] | 1 | .. _api-zoo-bounds: |
---|
| 2 | |
---|
| 3 | ZOO.Bounds |
---|
| 4 | ========== |
---|
| 5 | |
---|
| 6 | Instances of this class represent bounding boxes. |
---|
| 7 | |
---|
| 8 | Properties |
---|
| 9 | ---------- |
---|
| 10 | |
---|
| 11 | .. list-table:: |
---|
| 12 | :widths: 30 50 |
---|
| 13 | :header-rows: 1 |
---|
| 14 | |
---|
| 15 | * - NAME |
---|
| 16 | - DESCRIPTION |
---|
| 17 | * - :ref:`left <left>` |
---|
| 18 | - {Number} Minimum horizontal coordinate. |
---|
| 19 | * - :ref:`bottom <bottom>` |
---|
| 20 | - {Number} Minimum vertical coordinate. |
---|
| 21 | * - :ref:`right <right>` |
---|
| 22 | - {Number} Maximum horizontal coordinate. |
---|
| 23 | * - :ref:`top <top>` |
---|
| 24 | - {Number} Maximum vertical coordinate. |
---|
| 25 | |
---|
| 26 | Functions |
---|
| 27 | --------- |
---|
| 28 | |
---|
| 29 | .. list-table:: |
---|
| 30 | :widths: 20 50 |
---|
| 31 | :header-rows: 1 |
---|
| 32 | |
---|
| 33 | * - NAME |
---|
| 34 | - DESCRIPTION |
---|
| 35 | * - :ref:`ZOO.Bounds <ZOO.Bounds>` |
---|
| 36 | - Construct a new bounds object. |
---|
| 37 | * - :ref:`clone <clone>` |
---|
| 38 | - Create a cloned instance of this bounds. |
---|
| 39 | * - :ref:`equals <equals>` |
---|
| 40 | - Test a two bounds for equivalence. |
---|
| 41 | * - :ref:`toString <toString>` |
---|
| 42 | - {String} String representation of bounds object. |
---|
| 43 | * - :ref:`toBBOX <toBBOX>` |
---|
| 44 | - |
---|
| 45 | * - :ref:`toGeometry <toGeometry>` |
---|
| 46 | - Create a new polygon geometry based on this bounds. |
---|
| 47 | * - :ref:`getWidth <getWidth>` |
---|
| 48 | - {Float} The width of the bounds |
---|
| 49 | * - :ref:`getHeight <getHeight>` |
---|
| 50 | - {Float} The height of the bounds (top minus bottom) |
---|
| 51 | * - :ref:`add <add>` |
---|
| 52 | - |
---|
| 53 | * - :ref:`extend <extend>` |
---|
| 54 | - Extend the bounds to include the point, lonlat, or bounds specified. |
---|
| 55 | * - :ref:`intersectsBounds <intersectsBounds>` |
---|
| 56 | - Determine whether the target bounds intersects this bounds. |
---|
| 57 | * - :ref:`containsBounds <containsBounds>` |
---|
| 58 | - Determine whether the target bounds is contained within this bounds. |
---|
| 59 | |
---|
| 60 | **Properties** |
---|
| 61 | |
---|
| 62 | .. _left: |
---|
| 63 | |
---|
| 64 | left |
---|
| 65 | ``{Number}`` Minimum horizontal coordinate. |
---|
| 66 | |
---|
| 67 | .. _bottom: |
---|
| 68 | |
---|
| 69 | bottom |
---|
| 70 | ``{Number}`` Minimum vertical coordinate. |
---|
| 71 | |
---|
| 72 | .. _right: |
---|
| 73 | |
---|
| 74 | right |
---|
| 75 | ``{Number}`` Maximum horizontal coordinate. |
---|
| 76 | |
---|
| 77 | .. _top: |
---|
| 78 | |
---|
| 79 | top |
---|
| 80 | ``{Number}`` Maximum vertical coordinate. |
---|
| 81 | |
---|
| 82 | **Functions** |
---|
| 83 | |
---|
| 84 | .. _ZOO.Bounds: |
---|
| 85 | |
---|
| 86 | ZOO.Bounds |
---|
| 87 | Construct a new bounds object. |
---|
| 88 | |
---|
| 89 | *Parameters* |
---|
| 90 | |
---|
| 91 | | ``left {Number}`` The left bounds of the box. Note that for width calculations, this is assumed to be less than the right value. |
---|
| 92 | | ``bottom {Number}`` The bottom bounds of the box. Note that for height calculations, this is assumed to be more than the top value. |
---|
| 93 | | ``right {Number}`` The right bounds. |
---|
| 94 | | ``top {Number}`` The top bounds. |
---|
| 95 | |
---|
| 96 | .. _clone: |
---|
| 97 | |
---|
| 98 | clone |
---|
| 99 | :: |
---|
| 100 | |
---|
| 101 | clone:function() |
---|
| 102 | |
---|
| 103 | Create a cloned instance of this bounds. |
---|
| 104 | |
---|
| 105 | *Returns* |
---|
| 106 | |
---|
| 107 | :ref:`{ZOO.Bounds} <api-zoo-bounds>` A fresh copy of the bounds |
---|
| 108 | |
---|
| 109 | .. _equals: |
---|
| 110 | |
---|
| 111 | equals |
---|
| 112 | :: |
---|
| 113 | |
---|
| 114 | equals:function(bounds) |
---|
| 115 | |
---|
| 116 | Test a two bounds for equivalence. |
---|
| 117 | |
---|
| 118 | *Parameters* |
---|
| 119 | |
---|
| 120 | | ``bounds {ZOO.Bounds}`` |
---|
| 121 | |
---|
| 122 | *Returns* |
---|
| 123 | |
---|
| 124 | ``{Boolean}`` The passed-in bounds object has the same left, right, top, bottom components as this. Note |
---|
| 125 | that if bounds passed in is null, returns false. |
---|
| 126 | |
---|
| 127 | .. _toString: |
---|
| 128 | |
---|
| 129 | toString |
---|
| 130 | :: |
---|
| 131 | |
---|
| 132 | toString:function() |
---|
| 133 | |
---|
| 134 | *Returns* |
---|
| 135 | |
---|
| 136 | ``{String}`` String representation of bounds object. (ex. *<i>"left-bottom=(5,42) right-top=(10,45)"</i>*) |
---|
| 137 | |
---|
| 138 | .. _toBBOX: |
---|
| 139 | |
---|
| 140 | toBBOX |
---|
| 141 | :: |
---|
| 142 | |
---|
| 143 | toBBOX:function(decimal) |
---|
| 144 | |
---|
| 145 | *Parameters* |
---|
| 146 | |
---|
| 147 | ``decimal {Integer}`` How many significant digits in the bbox coords? Default is 6 |
---|
| 148 | |
---|
| 149 | *Returns* |
---|
| 150 | |
---|
| 151 | ``{String}`` Simple String representation of bounds object. (ex. *<i>"5,42,10,45"</i>*) |
---|
| 152 | |
---|
| 153 | .. _toGeometry: |
---|
| 154 | |
---|
| 155 | toGeometry |
---|
| 156 | :: |
---|
| 157 | |
---|
| 158 | toGeometry: function() |
---|
| 159 | |
---|
| 160 | Create a new polygon geometry based on this bounds. |
---|
| 161 | |
---|
| 162 | *Returns* |
---|
| 163 | |
---|
| 164 | :ref:`{ZOO.Geometry.Polygon} <api-zoo-geometry-polygon>` A new polygon with the coordinates of this bounds. |
---|
| 165 | |
---|
| 166 | .. _getWidth: |
---|
| 167 | |
---|
| 168 | getWidth |
---|
| 169 | :: |
---|
| 170 | |
---|
| 171 | getWidth:function() |
---|
| 172 | |
---|
| 173 | *Returns* |
---|
| 174 | |
---|
| 175 | ``{Float}`` The width of the bounds |
---|
| 176 | |
---|
| 177 | .. _getHeight: |
---|
| 178 | |
---|
| 179 | getHeight |
---|
| 180 | :: |
---|
| 181 | |
---|
| 182 | getHeight:function() |
---|
| 183 | |
---|
| 184 | *Returns* |
---|
| 185 | |
---|
| 186 | ``{Float}`` The height of the bounds (top minus bottom). |
---|
| 187 | |
---|
| 188 | .. _add: |
---|
| 189 | |
---|
| 190 | add |
---|
| 191 | :: |
---|
| 192 | |
---|
| 193 | add:function(x,y) |
---|
| 194 | |
---|
| 195 | *Parameters* |
---|
| 196 | |
---|
| 197 | | ``x {Float}`` |
---|
| 198 | | ``y {Float}`` |
---|
| 199 | |
---|
| 200 | *Returns* |
---|
| 201 | |
---|
| 202 | :ref:`{ZOO.Bounds} <api-zoo-bounds>` A new bounds whose coordinates are the same as this, but shifted by the passed-in x and y values. |
---|
| 203 | |
---|
| 204 | .. _extend: |
---|
| 205 | |
---|
| 206 | extend |
---|
| 207 | :: |
---|
| 208 | |
---|
| 209 | extend:function(object) |
---|
| 210 | |
---|
| 211 | Extend the bounds to include the point, lonlat, or bounds specified. Note, this function assumes that left |
---|
| 212 | < right and bottom < top. |
---|
| 213 | |
---|
| 214 | *Parameters* |
---|
| 215 | |
---|
| 216 | ``object {Object}`` Can be Point, or Bounds. |
---|
| 217 | |
---|
| 218 | .. _intersectsBounds: |
---|
| 219 | |
---|
| 220 | intersectsBounds |
---|
| 221 | :: |
---|
| 222 | |
---|
| 223 | intersectsBounds:function(bounds,inclusive) |
---|
| 224 | |
---|
| 225 | Determine whether the target bounds intersects this bounds. Bounds are considered intersecting if any |
---|
| 226 | of their edges intersect or if one bounds contains the other. |
---|
| 227 | |
---|
| 228 | *Parameters* |
---|
| 229 | |
---|
| 230 | | ``bounds`` :ref:`{ZOO.Bounds} <api-zoo-bounds>` The target bounds. |
---|
| 231 | | ``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. |
---|
| 232 | |
---|
| 233 | *Returns* |
---|
| 234 | |
---|
| 235 | ``{Boolean}`` The passed-in bounds object intersects this bounds. |
---|
| 236 | |
---|
| 237 | .. _containsBounds: |
---|
| 238 | |
---|
| 239 | containsBounds |
---|
| 240 | :: |
---|
| 241 | |
---|
| 242 | containsBounds:function(bounds,partial,inclusive) |
---|
| 243 | |
---|
| 244 | Determine whether the target bounds is contained within this bounds. |
---|
| 245 | |
---|
| 246 | *Parameters* |
---|
| 247 | |
---|
| 248 | | ``bounds`` :ref:`{ZOO.Bounds} <api-zoo-bounds>` The target bounds. |
---|
| 249 | | ``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. |
---|
| 250 | | ``inclusive {Boolean}`` Treat shared edges as contained. Default is true. |
---|
| 251 | |
---|
| 252 | *Returns* |
---|
| 253 | |
---|
[170] | 254 | ``{Boolean}`` The passed-in bounds object is contained within this bounds. |
---|