Giving fromArray and fromString a reverseAxisOrder option. r=erilem (closes #3014)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11035 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-01-17 09:18:21 +00:00
parent c8c8a74be7
commit 3795dbf490
2 changed files with 25 additions and 7 deletions

View File

@@ -615,14 +615,15 @@ OpenLayers.Bounds = OpenLayers.Class({
*
* Parameters:
* str - {String}Comma-separated bounds string. (ex. <i>"5,42,10,45"</i>)
* reverseAxisOrder - {Boolean} Does the string use reverse axis order?
*
* Returns:
* {<OpenLayers.Bounds>} New bounds object built from the
* passed-in String.
*/
OpenLayers.Bounds.fromString = function(str) {
OpenLayers.Bounds.fromString = function(str, reverseAxisOrder) {
var bounds = str.split(",");
return OpenLayers.Bounds.fromArray(bounds);
return OpenLayers.Bounds.fromArray(bounds, reverseAxisOrder);
};
/**
@@ -632,12 +633,18 @@ OpenLayers.Bounds.fromString = function(str) {
*
* Parameters:
* bbox - {Array(Float)} Array of bounds values (ex. <i>[5,42,10,45]</i>)
* reverseAxisOrder - {Boolean} Does the array use reverse axis order?
*
* Returns:
* {<OpenLayers.Bounds>} New bounds object built from the passed-in Array.
*/
OpenLayers.Bounds.fromArray = function(bbox) {
return new OpenLayers.Bounds(parseFloat(bbox[0]),
OpenLayers.Bounds.fromArray = function(bbox, reverseAxisOrder) {
return reverseAxisOrder === true ?
new OpenLayers.Bounds(parseFloat(bbox[1]),
parseFloat(bbox[0]),
parseFloat(bbox[3]),
parseFloat(bbox[2])) :
new OpenLayers.Bounds(parseFloat(bbox[0]),
parseFloat(bbox[1]),
parseFloat(bbox[2]),
parseFloat(bbox[3]));