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:
@@ -14,7 +14,8 @@
|
||||
* - <OpenLayers.Layer.FixedZoomLevels>
|
||||
*/
|
||||
OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||
OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, {
|
||||
OpenLayers.Layer.EventPane,
|
||||
OpenLayers.Layer.FixedZoomLevels, {
|
||||
|
||||
/**
|
||||
* Constant: MIN_ZOOM_LEVEL
|
||||
@@ -58,6 +59,15 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||
*/
|
||||
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.VirtualEarth
|
||||
*
|
||||
@@ -69,6 +79,10 @@ OpenLayers.Layer.VirtualEarth = 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();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -214,7 +228,9 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||
* {Float} Longitude of the given MapObject LonLat
|
||||
*/
|
||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.Longitude;
|
||||
return this.sphericalMercator ?
|
||||
this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lon :
|
||||
moLonLat.Longitude;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -227,7 +243,9 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||
* {Float} Latitude of the given MapObject LonLat
|
||||
*/
|
||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.Latitude;
|
||||
return this.sphericalMercator ?
|
||||
this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lat :
|
||||
moLonLat.Latitude;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -241,7 +259,14 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||
* {Object} MapObject LonLat built from lon and lat params
|
||||
*/
|
||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||
return new VELatLong(lat, lon);
|
||||
var veLatLong;
|
||||
if(this.sphericalMercator) {
|
||||
var lonlat = this.inverseMercator(lon, lat);
|
||||
veLatLong = new VELatLong(lonlat.lat, lonlat.lon);
|
||||
} else {
|
||||
veLatLong = new VELatLong(lat, lon);
|
||||
}
|
||||
return veLatLong;
|
||||
},
|
||||
|
||||
// Pixel
|
||||
|
||||
Reference in New Issue
Block a user