adding OpenLayers.Bounds.fromArray() function and adaptor for fromString()
git-svn-id: http://svn.openlayers.org/trunk/openlayers@486 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+17
-4
@@ -470,12 +470,25 @@ OpenLayers.Bounds.prototype = {
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Bounds.fromString = function(str) {
|
OpenLayers.Bounds.fromString = function(str) {
|
||||||
var bounds = str.split(",");
|
var bounds = str.split(",");
|
||||||
return new OpenLayers.Bounds(parseFloat(bounds[0]),
|
return OpenLayers.Bounds.fromArray(bounds);
|
||||||
parseFloat(bounds[1]),
|
|
||||||
parseFloat(bounds[2]),
|
|
||||||
parseFloat(bounds[3]));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Alternative constructor that builds a new OpenLayers.Bounds
|
||||||
|
* from an array
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {Array} bbox Array of bounds values (ex. <i>[5,42,10,45]</i>)
|
||||||
|
*
|
||||||
|
* @returns New OpenLayers.Bounds object built from the passed-in Array.
|
||||||
|
* @type OpenLayers.Bounds
|
||||||
|
*/
|
||||||
|
OpenLayers.Bounds.fromArray = function(bbox) {
|
||||||
|
return new OpenLayers.Bounds(parseFloat(bbox[0]),
|
||||||
|
parseFloat(bbox[1]),
|
||||||
|
parseFloat(bbox[2]),
|
||||||
|
parseFloat(bbox[3]));
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} quadrant
|
* @param {String} quadrant
|
||||||
|
|||||||
Reference in New Issue
Block a user