With review from elem, and oversight from tschaub, rolling in

SphericalMercator changes. Note that this explicitly does *not* include 
r4182 , so as to keep changes to a single logical set: that should be
filed in a seperate bug if it can be reproduced against trunk after this
commit. Hooray for Tim, thanks for all the feedback, onward and upward!
(Closes #686)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4221 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-09-11 21:16:28 +00:00
parent d0aebc1a81
commit 0aba585bc0
13 changed files with 591 additions and 27 deletions
+26 -3
View File
@@ -57,6 +57,14 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
* {YahooMapType}
*/
type: null,
/**
* APIProperty: sphericalMercator
* {Boolean} Should the map act as a mercator-projected map? This will
* cause all interactions with the map to be in the actual map projection,
* which allows support for vector drawing, overlaying other maps, etc.
*/
sphericalMercator: false,
/**
* Constructor: OpenLayers.Layer.Yahoo
@@ -69,6 +77,10 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
arguments);
if(this.sphericalMercator) {
OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
this.initMercatorParameters();
}
},
/**
@@ -294,7 +306,9 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
* {Float} Longitude of the given MapObject LonLat
*/
getLongitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.Lon;
return this.sphericalMercator ?
this.forwardMercator(moLonLat.Lon, moLonLat.Lat).lon :
moLonLat.Lon;
},
/**
@@ -307,7 +321,9 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
* {Float} Latitude of the given MapObject LonLat
*/
getLatitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.Lat;
return this.sphericalMercator ?
this.forwardMercator(moLonLat.Lon, moLonLat.Lat).lat :
moLonLat.Lat;
},
/**
@@ -321,7 +337,14 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
* {Object} MapObject LonLat built from lon and lat params
*/
getMapObjectLonLatFromLonLat: function(lon, lat) {
return new YGeoPoint(lat, lon);
var yLatLong;
if(this.sphericalMercator) {
var lonlat = this.inverseMercator(lon, lat);
yLatLong = new YGeoPoint(lonlat.lat, lonlat.lon);
} else {
yLatLong = new YGeoPoint(lat, lon);
}
return yLatLong;
},
// Pixel