Pullups for 2.3:

svn merge svn.openlayers.org/trunk/openlayers/@2230 svn.openlayers.org/trunk/openlayers/@2233 svn.openlayers.org/branches/openlayers/2.3/
#480   Grid funkiness
#491   improper URL encoding of LAYERS list in WMS GetMap request
#500   layer.destroy() should remove itself from the map but not set new baselayer


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2234 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-02-16 21:10:02 +00:00
parent b7bf7d5436
commit 538302fa9b
6 changed files with 95 additions and 13 deletions

View File

@@ -77,6 +77,18 @@ OpenLayers.Map.prototype = {
/** @type int */
zoom: 0,
/** Used to store a unique identifier that changes when the map view
* changes. viewRequestID should be used when adding data asynchronously
* to the map: viewRequestID is incremented when you initiate your
* request (right now during changing of baselayers and changing of zooms).
* It is stored here in the map and also in the data that will be coming
* back asynchronously. Before displaying this data on request completion,
* we check that the viewRequestID of the data is still the same as that
* of the map. Fix for #480
*
* @type String */
viewRequestID: 0,
// Options
/** @type OpenLayers.Size */
@@ -201,7 +213,9 @@ OpenLayers.Map.prototype = {
destroy:function() {
if (this.layers != null) {
for(var i=0; i< this.layers.length; i++) {
this.layers[i].destroy();
//pass 'false' to destroy so that map wont try to set a new
// baselayer after each baselayer is removed
this.layers[i].destroy(false);
}
this.layers = null;
}
@@ -344,8 +358,13 @@ OpenLayers.Map.prototype = {
* its own personal list of popups, removing them from the map.
*
* @param {OpenLayers.Layer} layer
* @param {Boolean} setNewBaseLayer Default is true
*/
removeLayer: function(layer) {
removeLayer: function(layer, setNewBaseLayer) {
if (setNewBaseLayer == null) {
setNewBaseLayer = true;
}
if (layer.isFixed) {
this.viewPortDiv.removeChild(layer.div);
} else {
@@ -355,7 +374,7 @@ OpenLayers.Map.prototype = {
OpenLayers.Util.removeItem(this.layers, layer);
// if we removed the base layer, need to set a new one
if (this.baseLayer == layer) {
if (setNewBaseLayer && (this.baseLayer == layer)) {
this.baseLayer = null;
for(i=0; i < this.layers.length; i++) {
var iLayer = this.layers[i];
@@ -448,6 +467,11 @@ OpenLayers.Map.prototype = {
// set new baselayer and make it visible
this.baseLayer = newBaseLayer;
// Increment viewRequestID since the baseLayer is
// changing. This is used by tiles to check if they should
// draw themselves.
this.viewRequestID++;
this.baseLayer.setVisibility(true, noEvent);
//redraw all layers
@@ -743,6 +767,9 @@ OpenLayers.Map.prototype = {
for (var i = 0; i < this.popups.length; i++) {
this.popups[i].updatePosition();
}
// zoom level has changed, increment viewRequestID.
this.viewRequestID++;
}
var bounds = this.getExtent();