Making dateline handling work with ratio.

This commit is contained in:
ahocevar
2011-12-28 20:14:39 +01:00
parent 1ce59a207d
commit cfe25feecf
3 changed files with 8 additions and 2 deletions

View File

@@ -139,7 +139,9 @@ OpenLayers.Renderer = OpenLayers.Class({
setExtent: function(extent, resolutionChanged) {
this.extent = extent.clone();
if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
this.extent = extent.wrapDateLine(this.map.getMaxExtent());
var ratio = extent.getWidth() / this.map.getExtent().getWidth(),
extent = extent.scale(1 / ratio);
this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);
}
if (resolutionChanged) {
this.resolution = null;

View File

@@ -498,8 +498,9 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
var coordSysUnchanged = OpenLayers.Renderer.prototype.setExtent.apply(this, arguments);
var resolution = this.getResolution();
if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
coordSysUnchanged = this.featureDx === 0;
var rightOfDateLine,
ratio = extent.getWidth() / this.map.getExtent().getWidth(),
extent = extent.scale(1 / ratio),
world = this.map.getMaxExtent();
if (world.right > extent.left && world.right < extent.right) {
rightOfDateLine = true;

View File

@@ -614,6 +614,9 @@
getMaxExtent: function() {
return new OpenLayers.Bounds(-180,-90,180,90);
},
getExtent: function() {
return r.extent;
},
getResolution: function() {
return resolution;
},