Add support for reprojection of lonlats/bounds. (Closes #1213)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@5452 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-12-17 03:12:57 +00:00
parent 5884c02683
commit 428710e3af
4 changed files with 66 additions and 0 deletions
+23
View File
@@ -425,6 +425,29 @@ OpenLayers.Bounds = OpenLayers.Class({
return quadrant;
},
/**
* APIMethod: transform
* Transform the Bounds object from source to dest.
*
* Parameters:
* source - {<OpenLayers.Projection>} Source projection.
* dest - {<OpenLayers.Projection>} Destination projection.
*
* Returns:
* {<OpenLayers.Bounds>} Itself, for use in chaining operations.
*/
transform: function(source, dest) {
var ll = OpenLayers.Projection.transform(
{'x': this.left, 'y': this.bottom}, source, dest);
var ur = OpenLayers.Projection.transform(
{'x': this.right, 'y': this.top}, source, dest);
this.left = ll.x;
this.bottom = ll.y;
this.right = ur.x;
this.top = ur.y;
return this;
},
/**
* APIMethod: wrapDateLine
+19
View File
@@ -112,6 +112,25 @@ OpenLayers.LonLat = OpenLayers.Class({
}
return equals;
},
/**
* APIMethod: transform
* Transform the LonLat object from source to dest.
*
* Parameters:
* source - {<OpenLayers.Projection>} Source projection.
* dest - {<OpenLayers.Projection>} Destination projection.
*
* Returns:
* {<OpenLayers.LonLat>} Itself, for use in chaining operations.
*/
transform: function(source, dest) {
var point = OpenLayers.Projection.transform(
{'x': this.lon, 'y': this.lat}, source, dest);
this.lon = point.x;
this.lat = point.y;
return this;
},
/**
* APIMethod: wrapDateLine