Allow transforming geometries, lonlat, and bounds with strings.
This commit is contained in:
@@ -186,12 +186,19 @@ OpenLayers.Projection.addTransform = function(from, to, method) {
|
||||
* point - {object} A transformed coordinate. The original point is modified.
|
||||
*/
|
||||
OpenLayers.Projection.transform = function(point, source, dest) {
|
||||
if (source.proj && dest.proj) {
|
||||
point = Proj4js.transform(source.proj, dest.proj, point);
|
||||
} else if (source && dest &&
|
||||
OpenLayers.Projection.transforms[source.getCode()] &&
|
||||
OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]) {
|
||||
OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);
|
||||
if (source && dest) {
|
||||
if (!(source instanceof OpenLayers.Projection)) {
|
||||
source = new OpenLayers.Projection(source);
|
||||
}
|
||||
if (!(dest instanceof OpenLayers.Projection)) {
|
||||
dest = new OpenLayers.Projection(dest);
|
||||
}
|
||||
if (source.proj && dest.proj) {
|
||||
point = Proj4js.transform(source.proj, dest.proj, point);
|
||||
} else if (OpenLayers.Projection.transforms[source.getCode()] &&
|
||||
OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]) {
|
||||
OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);
|
||||
}
|
||||
}
|
||||
return point;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user