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

@@ -217,8 +217,25 @@ OpenLayers.Util.setOpacity = function(element, opacity) {
}
OpenLayers.Util.onImageLoad = function() {
this.style.backgroundColor = null;
this.style.display = "";
// The complex check here is to solve issues described in #480.
// Every time a map view changes, it increments the 'viewRequestID'
// property. As the requests for the images for the new map view are sent
// out, they are tagged with this unique viewRequestID.
//
// If an image has no viewRequestID property set, we display it regardless,
// but if it does have a viewRequestID property, we check that it matches
// the viewRequestID set on the map.
//
// If the viewRequestID on the map has changed, that means that the user
// has changed the map view since this specific request was sent out, and
// therefore this tile does not need to be displayed (so we do not execute
// this code that turns its display on).
//
if (!this.viewRequestID ||
(this.viewRequestID == this.map.viewRequestID)) {
this.style.backgroundColor = null;
this.style.display = "";
}
};
OpenLayers.Util.onImageLoadErrorColor = "pink";
@@ -377,17 +394,32 @@ OpenLayers.Util.applyDefaults = function (to, from) {
* @returns a concatenation of the properties of an object in
* http parameter notation.
* (ex. <i>"key1=value1&key2=value2&key3=value3"</i>)
* If a parameter is actually a list, that parameter will then
* be set to a comma-seperated list of values (foo,bar) instead
* of being URL escaped (foo%3Abar).
* @type String
*/
OpenLayers.Util.getParameterString = function(params) {
paramsArray = new Array();
for (var key in params) {
var value = params[key];
if ((value != null) && (typeof value != 'function')) {
paramsArray.push(encodeURIComponent(key) + "=" +
encodeURIComponent(value));
var value = params[key];
if ((value != null) && (typeof value != 'function')) {
var encodedValue;
if (typeof value == 'object' && value.constructor == Array) {
/* value is an array; encode items and separate with "," */
var encodedItemArray = new Array();
for (var itemIndex=0; itemIndex<value.length; itemIndex++) {
encodedItemArray.push(encodeURIComponent(value[itemIndex]));
}
encodedValue = encodedItemArray.join(",");
}
else {
/* value is a string; simply encode */
encodedValue = encodeURIComponent(value);
}
paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
}
}
return paramsArray.join("&");