OpenLayers. BoundsInstances 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. Possible use casebounds = new OpenLayers.Bounds(); bounds.extend(new OpenLayers.LonLat(4,5)); bounds.extend(new OpenLayers.LonLat(5,6)); bounds.toBBOX(); // returns 4,5,5,6
Summary | Instances of this class represent bounding boxes. | | | | | | | | | | | | | | Construct a new bounds object. | | | | Create a cloned instance of this bounds. | | Test a two bounds for equivalence. | | {String} String representation of bounds object. | | {Array} array of left, bottom, right, top | | | | {Float} The width of the bounds | | {Float} The height of the bounds (top minus bottom). | | | | | | | | | | Extend the bounds to include the point, lonlat, or bounds specified. | | | | | | | | | | | | | | | | Alternative constructor that builds a new OpenLayers.Bounds from a parameter string | | Alternative constructor that builds a new OpenLayers.Bounds from an array | | Alternative constructor that builds a new OpenLayers.Bounds from a size | | Get the opposite quadrant for a given quadrant string. |
OpenLayers. BoundsConstruct a new bounds object. Parametersleft | {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. |
cloneCreate a cloned instance of this bounds. Returns{OpenLayers.Bounds} A fresh copy of the bounds
equalsTest a two bounds for equivalence. ParametersReturns{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.
toStringReturns{String} String representation of bounds object. (ex.<i>”left-bottom=(5,42) right-top=(10,45)”</i>)
toArrayReturns{Array} array of left, bottom, right, top
toBBOXParametersdecimal | {Integer} How many significant digits in the bbox coords? Default is 6 |
Returns{String} Simple String representation of bounds object. (ex. <i>”5,42,10,45”</i>)
getWidthReturns{Float} The width of the bounds
getHeightReturns{Float} The height of the bounds (top minus bottom).
getCenterPixelgetCenterPixel:function() |
Returns{OpenLayers.Pixel} The center of the bounds in pixel space.
getCenterLonLatgetCenterLonLat:function() |
Returns{OpenLayers.LonLat} The center of the bounds in map space.
addParametersReturns{OpenLayers.Bounds} A new bounds whose coordinates are the same as this, but shifted by the passed-in x and y values.
extendExtend the bounds to include the point, lonlat, or bounds specified. Note, this function assumes that left < right and bottom < top. Parametersobject | {Object} Can be LonLat, Point, or Bounds |
containsLonLatcontainsLonLat:function( | ll, | | inclusive | ) |
|
Parametersll | {OpenLayers.LonLat} | inclusive | {Boolean} Whether or not to include the border. Default is true. |
Returns{Boolean} The passed-in lonlat is within this bounds.
containsPixelcontainsPixel:function( | px, | | inclusive | ) |
|
Parameterspx | {OpenLayers.Pixel} | inclusive | {Boolean} Whether or not to include the border. Default is true. |
Returns{Boolean} The passed-in pixel is within this bounds.
containscontains:function( | x, | | y, | | inclusive | ) |
|
Parametersx | {Float} | y | {Float} | inclusive | {Boolean} Whether or not to include the border. Default is true. |
Returns{Boolean} Whether or not the passed-in coordinates are within this bounds.
intersectsBoundsintersectsBounds:function( | bounds, | | inclusive | ) |
|
Parametersbounds | {OpenLayers.Bounds} | inclusive | {<Boolean>} Whether or not to include the border. Default is true. |
Returns{Boolean} The passed-in OpenLayers.Bounds object intersects this bounds. Simple math just check if either contains the other, allowing for partial.
containsBoundscontainsBounds: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. |
Returns{Boolean} The passed-in bounds object is contained within this bounds.
determineQuadrantdetermineQuadrant: function( | lonlat | ) |
|
ParametersReturns{String} The quadrant (“br” “tr” “tl” “bl”) of the bounds in which the coordinate lies.
wrapDateLinewrapDateLine: function( | maxExtent, | | options | ) |
|
ParametersmaxExtent | {OpenLayers.Bounds} | options | {Object} Some possible options are: | leftTolerance | {float} Allow for a margin of error with the ‘left’ value of this bound. Default is 0. | rightTolerance | {float} Allow for a margin of error with the ‘right’ value of this bound. Default is 0. |
Returns{OpenLayers.Bounds} A copy of this bounds, but wrapped around the “dateline” (as specified by the borders of maxExtent). Note that this function only returns a different bounds value if this bounds is entirely outside of the maxExtent. If this bounds straddles the dateline (is part in/part out of maxExtent), the returned bounds will be merely a copy of this one.
fromStringOpenLayers.Bounds.fromString = function( | str | ) |
|
Alternative constructor that builds a new OpenLayers.Bounds from a parameter string Parametersstr | {String}Comma-separated bounds string. (ex. <i>”5,42,10,45”</i>) |
Returns{OpenLayers.Bounds} New bounds object built from the passed-in String.
fromArrayOpenLayers.Bounds.fromArray = function( | bbox | ) |
|
Alternative constructor that builds a new OpenLayers.Bounds from an array Parametersbbox | {Array(Float)} Array of bounds values (ex. <i>[5,42,10,45]</i>) |
Returns{OpenLayers.Bounds} New bounds object built from the passed-in Array.
fromSizeOpenLayers.Bounds.fromSize = function( | size | ) |
|
Alternative constructor that builds a new OpenLayers.Bounds from a size ParametersReturns{OpenLayers.Bounds} New bounds object built from the passed-in size.
oppositeQuadrantOpenLayers.Bounds.oppositeQuadrant = function( | quadrant | ) |
|
Get the opposite quadrant for a given quadrant string. Parametersquadrant | {String} two character quadrant shortstring |
Returns{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.
|