From 1ee40cec0239e7ce5699df63b13e506a7e1fca5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 8 Oct 2011 00:06:28 +0200 Subject: [PATCH 1/7] IE<7 needs a reflow when the tiles are loaded --- lib/OpenLayers/Tile/Image.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index c3037256b6..7d6269c348 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -346,6 +346,23 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile.BackBufferable, { this.isLoading = false; this.events.triggerEvent("loadend"); + // IE<7 needs a reflow when the tiles are loaded because of the + // percentage based positioning. Otherwise nothing is shown + // until the user interacts with the map in some way. + if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 7) { + if (!this.layer || !this.layer.div) { + // nothing to do if the layer is destroyed already + return; + } + var span = document.createElement("span"); + span.style.display = "none"; + var layerDiv = this.layer.div; + layerDiv.appendChild(span); + window.setTimeout(function() { + span.parentNode === layerDiv && span.parentNode.removeChild(span); + }, 0); + } + if (this.layerAlphaHack === true) { img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + From 89388880b71ecb455ea76f171a6b7cc72c6be426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 8 Oct 2011 00:22:22 +0200 Subject: [PATCH 2/7] do not return too early from onImageLoad --- lib/OpenLayers/Tile/Image.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 7d6269c348..087693d79f 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -349,11 +349,8 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile.BackBufferable, { // IE<7 needs a reflow when the tiles are loaded because of the // percentage based positioning. Otherwise nothing is shown // until the user interacts with the map in some way. - if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 7) { - if (!this.layer || !this.layer.div) { - // nothing to do if the layer is destroyed already - return; - } + if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 7 && + this.layer && this.layer.div) { var span = document.createElement("span"); span.style.display = "none"; var layerDiv = this.layer.div; From 760d5a584cc363d2d724929d092a0975d3b27bd4 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Sun, 9 Oct 2011 15:53:12 +0200 Subject: [PATCH 3/7] Reverse QUERY_LAYERS order in GetFeatureInfo requests. r=bartvde (closes #3253) --- lib/OpenLayers/Control/WMSGetFeatureInfo.js | 2 +- tests/Control/WMSGetFeatureInfo.html | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Control/WMSGetFeatureInfo.js b/lib/OpenLayers/Control/WMSGetFeatureInfo.js index 9b89bae9db..82c37d6e69 100644 --- a/lib/OpenLayers/Control/WMSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMSGetFeatureInfo.js @@ -287,7 +287,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { var candidates = this.layers || this.map.layers; var layers = []; var layer, url; - for(var i=0, len=candidates.length; i= 0; --i) { layer = candidates[i]; if(layer instanceof OpenLayers.Layer.WMS && (!this.queryVisible || layer.getVisibility())) { diff --git a/tests/Control/WMSGetFeatureInfo.html b/tests/Control/WMSGetFeatureInfo.html index 8d63f788c4..9aa0283bb3 100644 --- a/tests/Control/WMSGetFeatureInfo.html +++ b/tests/Control/WMSGetFeatureInfo.html @@ -348,7 +348,7 @@ ); t.eq( log.options && log.options.params.STYLES.join(","), - "a,b,c,d,a,b,c,d,,,,,,,,", + ",,,,,,,,a,b,c,d,a,b,c,d", "Styles merged correctly" ); @@ -424,7 +424,7 @@ control.layerUrls = ["http://a.mirror/wms", "http://b.mirror/wms"]; control.getInfoForClick({xy: {x: 50, y: 50}}); t.eq(log.options && log.options.url, "http://host/wms", "some match, request issued"); - t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "a,b", "selected layers queried"); + t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "b,a", "selected layers queried"); // show that a layer can be matched if it has a urls array itself (first needs to be matched) log = {}; @@ -508,13 +508,13 @@ var _request = OpenLayers.Request.GET; OpenLayers.Request.GET = function(options) { count++; - if (count == 1) { + if (count == 2) { t.eq(options.params["INFO_FORMAT"], "application/vnd.ogc.gml", "Default info format of the control is used"); - t.eq(options.params["QUERY_LAYERS"].join(","), "a,c", "Layers should be grouped by service url"); - t.eq(options.url, "http://localhost/wms", "Correct url used for first request"); - } else if (count == 2) { + t.eq(options.params["QUERY_LAYERS"].join(","), "c,a", "Layers should be grouped by service url"); + t.eq(options.url, "http://localhost/wms", "Correct url used for second request"); + } else if (count == 1) { t.eq(options.params["INFO_FORMAT"], "text/xml", "Overridden info format is used instead of the control's infoFormat"); - t.eq(options.url, "http://myhost/wms", "Correct url used for second request"); + t.eq(options.url, "http://myhost/wms", "Correct url used for first request"); } }; click.activate(); From 64f111a30842874f3fd372475d01aa9ebac1d922 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Mon, 10 Oct 2011 08:24:24 +0200 Subject: [PATCH 4/7] add infoFormats to WMSCapabilities Format, r=ahocevar (closes #3539) --- lib/OpenLayers/Format/WMSCapabilities/v1.js | 3 +++ tests/Format/WMSCapabilities/v1_1_1.html | 3 ++- tests/Format/WMSCapabilities/v1_3_0.html | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1.js b/lib/OpenLayers/Format/WMSCapabilities/v1.js index 7283760ec1..dd3c498b6c 100644 --- a/lib/OpenLayers/Format/WMSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WMSCapabilities/v1.js @@ -112,6 +112,9 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class( if (layer.formats === undefined) { layer.formats = capability.request.getmap.formats; } + if (layer.infoFormats === undefined && capability.request.getfeatureinfo) { + layer.infoFormats = capability.request.getfeatureinfo.formats; + } var i, len; diff --git a/tests/Format/WMSCapabilities/v1_1_1.html b/tests/Format/WMSCapabilities/v1_1_1.html index cc0c784469..8309bd75ad 100644 --- a/tests/Format/WMSCapabilities/v1_1_1.html +++ b/tests/Format/WMSCapabilities/v1_1_1.html @@ -14,7 +14,7 @@ function test_read(t) { - t.plan(23); + t.plan(24); var xml = document.getElementById("gssample").firstChild.nodeValue; var doc = new OpenLayers.Format.XML().read(xml); @@ -80,6 +80,7 @@ t.eq(capability.layers.length, 22, "correct number of layers parsed"); var layer = capability.layers[2]; + t.eq(layer.infoFormats, ["text/plain", "text/html", "application/vnd.ogc.gml"], "infoFormats set on layer"); t.eq(layer.name, "tiger:tiger_roads", "[2] correct layer name"); t.eq(layer.prefix, "tiger", "[2] correct layer prefix"); t.eq(layer.title, "Manhattan (NY) roads", "[2] correct layer title"); diff --git a/tests/Format/WMSCapabilities/v1_3_0.html b/tests/Format/WMSCapabilities/v1_3_0.html index 9d7eecdac5..7120b8c1a4 100644 --- a/tests/Format/WMSCapabilities/v1_3_0.html +++ b/tests/Format/WMSCapabilities/v1_3_0.html @@ -14,7 +14,7 @@ function test_layers(t) { - t.plan(24); + t.plan(25); var xml = document.getElementById("ogcsample").firstChild.nodeValue; var doc = new OpenLayers.Format.XML().read(xml); @@ -40,7 +40,7 @@ t.eq(layers["Temperature"].srs, {"CRS:84": true}, "Inheritance of SRS handled correctly when redeclaring an inherited SRS"); - + t.eq(layers["Temperature"].infoFormats, ["text/xml", "text/plain", "text/html"], "infoFormats set correctly on layer"); var bbox = layers["ROADS_RIVERS"].bbox["EPSG:26986"]; t.eq(bbox.bbox, [189000, 834000, 285000, 962000], From b1ee9d1f95f755b895459146cf62938fa45bf02d Mon Sep 17 00:00:00 2001 From: fredj Date: Mon, 10 Oct 2011 16:26:23 +0200 Subject: [PATCH 5/7] fix APIProperty formating, thanks Denis Rykov --- lib/OpenLayers/Layer/PointTrack.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Layer/PointTrack.js b/lib/OpenLayers/Layer/PointTrack.js index 8e9e639b2d..62d831cac1 100644 --- a/lib/OpenLayers/Layer/PointTrack.js +++ b/lib/OpenLayers/Layer/PointTrack.js @@ -18,8 +18,8 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, { /** - * APIProperty: - * dataFrom - {} or + * APIProperty: dataFrom + * {} or * {} optional. If the lines * should get the data/attributes from one of the two points it is * composed of, which one should it be? @@ -27,8 +27,8 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, { dataFrom: null, /** - * APIProperty: - * styleFrom - {} or + * APIProperty: styleFrom + * {} or * {} optional. If the lines * should get the style from one of the two points it is composed of, * which one should it be? From c6e66a3c5c309da15468b5c8e16a02661c4f2634 Mon Sep 17 00:00:00 2001 From: tschaub Date: Tue, 11 Oct 2011 09:34:38 -0600 Subject: [PATCH 6/7] The getFeatureFromEvent now throws. An error is thrown if getFeatureFromEvent is called on a destroyed layer (see #7). --- tests/Layer/Vector.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/Layer/Vector.html b/tests/Layer/Vector.html index cc8c3fcf43..f449e151b0 100644 --- a/tests/Layer/Vector.html +++ b/tests/Layer/Vector.html @@ -575,7 +575,7 @@ } function test_Layer_Vector_destroy (t) { - t.plan(5); + t.plan(6); var options = {protocol: new OpenLayers.Protocol(), strategies: [new OpenLayers.Strategy(), new OpenLayers.Strategy()]} @@ -584,8 +584,14 @@ map.addLayer(layer); layer.destroy(); t.eq(layer.map, null, "layer.map is null after destroy"); - t.eq(layer.getFeatureFromEvent({'target':'map'}), null, - "getFeatureIdFromEvent doesn't cause an error when called on layer which has been destroyed."); + t.ok(!layer.renderer, "layer.renderer is falsey"); + var err; + try { + layer.getFeatureFromEvent({target: "map"}); + } catch (ex) { + err = ex; + } + t.ok(err, "Error thrown when calling getFeatureFromEvent on destroyed layer"); t.eq(layer.protocol, null, "layer.protocol is null after destroy"); t.eq(layer.strategies, null, "layer.strategies is null after destroy"); From fc5a0121e67835e54eac6bee49392183ad1fc152 Mon Sep 17 00:00:00 2001 From: tschaub Date: Tue, 11 Oct 2011 09:36:43 -0600 Subject: [PATCH 7/7] The getFeatureFromEvent method now throws (see #7). --- tests/Layer/PointTrack.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Layer/PointTrack.html b/tests/Layer/PointTrack.html index d889db27f3..95b8ced361 100644 --- a/tests/Layer/PointTrack.html +++ b/tests/Layer/PointTrack.html @@ -66,7 +66,7 @@ t.eq(layer.map.layers.length, 1, "layer added to the map successfully"); layer.destroy(); t.eq(layer.map, null, "layer.map is null after destroy"); - t.eq(layer.getFeatureFromEvent({'target':'map'}), null, "getFeatureIdFromEvent doesn't cause an error when called on layer which has been destroyed."); + t.ok(!layer.renderer, "layer.renderer is falsey after destroy"); }