Merge branch 'master' of github.com:openlayers/openlayers into 3526
This commit is contained in:
@@ -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<len; ++i) {
|
||||
for(var i = candidates.length - 1; i >= 0; --i) {
|
||||
layer = candidates[i];
|
||||
if(layer instanceof OpenLayers.Layer.WMS &&
|
||||
(!this.queryVisible || layer.getVisibility())) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, {
|
||||
|
||||
/**
|
||||
* APIProperty:
|
||||
* dataFrom - {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
||||
* APIProperty: dataFrom
|
||||
* {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
||||
* {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} 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 - {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
||||
* APIProperty: styleFrom
|
||||
* {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
||||
* {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
|
||||
* should get the style from one of the two points it is composed of,
|
||||
* which one should it be?
|
||||
|
||||
@@ -346,6 +346,20 @@ 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 &&
|
||||
this.layer && this.layer.div) {
|
||||
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='" +
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user