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

View File

@@ -7,6 +7,8 @@
* @requires OpenLayers/Layer/FixedZoomLevels.js
*
* Class: OpenLayers.Layer.MultiMap
* Note that MultiMap does not fully support the sphericalMercator
* option. See Ticket #953 for more details.
*
* Inherits:
* - <OpenLayers.Layers.EventPane>
@@ -69,6 +71,11 @@ OpenLayers.Layer.MultiMap = 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();
this.RESOLUTIONS.unshift(10);
}
},
/**
@@ -201,7 +208,9 @@ OpenLayers.Layer.MultiMap = 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;
},
/**
@@ -214,7 +223,9 @@ OpenLayers.Layer.MultiMap = 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;
},
/**
@@ -228,7 +239,14 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
* {Object} MapObject LonLat built from lon and lat params
*/
getMapObjectLonLatFromLonLat: function(lon, lat) {
return new MMLatLon(lat, lon);
var mmLatLon;
if(this.sphericalMercator) {
var lonlat = this.inverseMercator(lon, lat);
mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon);
} else {
mmLatLon = new MMLatLon(lat, lon);
}
return mmLatLon;
},
// Pixel