Instances of this class represent bounding boxes. Data stored as left, bottom, right, top floats. All values are initialized to null, however, you should make sure you set them before using the bounds for anything.
bounds = new OpenSpace.MapBounds(); bounds.extend(new OpenSpace.MapPoint(40,50)); bounds.extend(new OpenSpace.MapPoint(50,60)); bounds.toBBOX(); // returns 40,50,50,60
| OpenSpace. | Instances of this class represent bounding boxes. |
| Properties | |
| srs | {Number} The spatial reference system |
| Constructor | |
| OpenSpace. | Construct a new map bounds object. |
| Functions | |
| clone | Create a cloned instance of this bounds. |
| equals | Test a two bounds for equivalence. |
| toString | {String} String representation of bounds object. |
| toArray | {Array} array of left, bottom, right, top |
| toBBOX | |
| getWidth | {Float} The width of the bounds |
| getHeight | {Float} The height of the bounds (top minus bottom). |
| getSize | {OpenSpace.MapSize} The size of the box. |
| getCenterLonLat | {OpenSpace.MapPoint} The center of the bounds in map space. |
| add | |
| extend | Extend the bounds to include the point, map point, or bounds specified. |
| containsLonLat | |
| contains | |
| intersectsBounds | |
| containsBounds | |
| determineQuadrant | |
| oppositeQuadrant | Get the opposite quadrant for a given quadrant string. |
Construct a new map bounds object.
| left | {Float} The left bounds of the box. Note that for width calculations, this is assumed to be less than the right value. |
| bottom | {Float} The bottom bounds of the box. Note that for height calculations, this is assumed to be more than the top value. |
| right | {Float} The right bounds. |
| top | {Float} The top bounds. |
clone:function()
Create a cloned instance of this bounds.
{OpenSpace.MapBounds} A fresh copy of the bounds
equals:function( bounds )
Test a two bounds for equivalence.
| bounds | {OpenSpace.MapBounds} |
{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.
{OpenSpace.MapPoint} The center of the bounds in map space.
add:function( x, y )
| x | {Float} |
| y | {Float} |
{OpenSpace.MapBounds} A new bounds whose coordinates are the same as this, but shifted by the passed-in x and y values.
containsLonLat:function( ll, inclusive )
| ll | {OpenSpace.MapPoint} |
| inclusive | {Boolean} Whether or not to include the border. Default is true. |
{Boolean} The passed-in lonlat is within this bounds.
intersectsBounds:function( bounds, inclusive )
| bounds | {<OpenLayers.Bounds>} |
| inclusive | {<Boolean>} Whether or not to include the border. Default is true. |
{Boolean} The passed-in OpenLayers.Bounds object intersects this bounds. Simple math just check if either contains the other, allowing for partial.
containsBounds:function( bounds, partial, inclusive )
| bounds | {<OpenLayers.Bounds>} |
| partial | {<Boolean>} If true, only part of passed-in bounds needs be within this bounds. If false, the entire passed-in bounds must be within. Default is false |
| inclusive | {<Boolean>} Whether or not to include the border. Default is true. |
{Boolean} The passed-in bounds object is contained within this bounds.
OpenSpace.MapBounds.oppositeQuadrant = function( quadrant )
Get the opposite quadrant for a given quadrant string.
| quadrant | {String} two character quadrant shortstring |
{String} The opposing quadrant (“br” “tr” “tl” “bl”). For Example, if you pass in “bl” it returns “tr”, if you pass in “br” it returns “tl”, etc.
Create a cloned instance of this bounds.
clone:function()
Test a two bounds for equivalence.
equals:function( bounds )
{String} String representation of bounds object.
toString:function()
{Array} array of left, bottom, right, top
toArray: function()
toBBOX:function( decimal )
{Float} The width of the bounds
getWidth:function()
{Float} The height of the bounds (top minus bottom).
getHeight:function()
{OpenSpace.MapSize} The size of the box.
getSize:function()
add:function( x, y )
Extend the bounds to include the point, map point, or bounds specified.
extend:function( object )
containsLonLat:function( ll, inclusive )
contains:function( x, y, inclusive )
intersectsBounds:function( bounds, inclusive )
containsBounds:function( bounds, partial, inclusive )
determineQuadrant: function( lonlat )
Get the opposite quadrant for a given quadrant string.
OpenSpace.MapBounds.oppositeQuadrant = function( quadrant )