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 candidates = this.layers || this.map.layers;
|
||||||
var layers = [];
|
var layers = [];
|
||||||
var layer, url;
|
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];
|
layer = candidates[i];
|
||||||
if(layer instanceof OpenLayers.Layer.WMS &&
|
if(layer instanceof OpenLayers.Layer.WMS &&
|
||||||
(!this.queryVisible || layer.getVisibility())) {
|
(!this.queryVisible || layer.getVisibility())) {
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class(
|
|||||||
if (layer.formats === undefined) {
|
if (layer.formats === undefined) {
|
||||||
layer.formats = capability.request.getmap.formats;
|
layer.formats = capability.request.getmap.formats;
|
||||||
}
|
}
|
||||||
|
if (layer.infoFormats === undefined && capability.request.getfeatureinfo) {
|
||||||
|
layer.infoFormats = capability.request.getfeatureinfo.formats;
|
||||||
|
}
|
||||||
|
|
||||||
var i, len;
|
var i, len;
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, {
|
OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty:
|
* APIProperty: dataFrom
|
||||||
* dataFrom - {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
* {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
||||||
* {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
|
* {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
|
||||||
* should get the data/attributes from one of the two points it is
|
* should get the data/attributes from one of the two points it is
|
||||||
* composed of, which one should it be?
|
* composed of, which one should it be?
|
||||||
@@ -27,8 +27,8 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, {
|
|||||||
dataFrom: null,
|
dataFrom: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty:
|
* APIProperty: styleFrom
|
||||||
* styleFrom - {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
* {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
|
||||||
* {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
|
* {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
|
||||||
* should get the style from one of the two points it is composed of,
|
* should get the style from one of the two points it is composed of,
|
||||||
* which one should it be?
|
* which one should it be?
|
||||||
|
|||||||
@@ -346,6 +346,20 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile.BackBufferable, {
|
|||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.events.triggerEvent("loadend");
|
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) {
|
if (this.layerAlphaHack === true) {
|
||||||
img.style.filter =
|
img.style.filter =
|
||||||
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
|
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
|
||||||
|
|||||||
@@ -348,7 +348,7 @@
|
|||||||
);
|
);
|
||||||
t.eq(
|
t.eq(
|
||||||
log.options && log.options.params.STYLES.join(","),
|
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"
|
"Styles merged correctly"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@
|
|||||||
control.layerUrls = ["http://a.mirror/wms", "http://b.mirror/wms"];
|
control.layerUrls = ["http://a.mirror/wms", "http://b.mirror/wms"];
|
||||||
control.getInfoForClick({xy: {x: 50, y: 50}});
|
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.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)
|
// show that a layer can be matched if it has a urls array itself (first needs to be matched)
|
||||||
log = {};
|
log = {};
|
||||||
@@ -508,13 +508,13 @@
|
|||||||
var _request = OpenLayers.Request.GET;
|
var _request = OpenLayers.Request.GET;
|
||||||
OpenLayers.Request.GET = function(options) {
|
OpenLayers.Request.GET = function(options) {
|
||||||
count++;
|
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["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.params["QUERY_LAYERS"].join(","), "c,a", "Layers should be grouped by service url");
|
||||||
t.eq(options.url, "http://localhost/wms", "Correct url used for first request");
|
t.eq(options.url, "http://localhost/wms", "Correct url used for second request");
|
||||||
} else if (count == 2) {
|
} 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.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();
|
click.activate();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
function test_read(t) {
|
function test_read(t) {
|
||||||
|
|
||||||
t.plan(23);
|
t.plan(24);
|
||||||
|
|
||||||
var xml = document.getElementById("gssample").firstChild.nodeValue;
|
var xml = document.getElementById("gssample").firstChild.nodeValue;
|
||||||
var doc = new OpenLayers.Format.XML().read(xml);
|
var doc = new OpenLayers.Format.XML().read(xml);
|
||||||
@@ -80,6 +80,7 @@
|
|||||||
t.eq(capability.layers.length, 22, "correct number of layers parsed");
|
t.eq(capability.layers.length, 22, "correct number of layers parsed");
|
||||||
|
|
||||||
var layer = capability.layers[2];
|
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.name, "tiger:tiger_roads", "[2] correct layer name");
|
||||||
t.eq(layer.prefix, "tiger", "[2] correct layer prefix");
|
t.eq(layer.prefix, "tiger", "[2] correct layer prefix");
|
||||||
t.eq(layer.title, "Manhattan (NY) roads", "[2] correct layer title");
|
t.eq(layer.title, "Manhattan (NY) roads", "[2] correct layer title");
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
function test_layers(t) {
|
function test_layers(t) {
|
||||||
|
|
||||||
t.plan(24);
|
t.plan(25);
|
||||||
|
|
||||||
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
|
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
|
||||||
var doc = new OpenLayers.Format.XML().read(xml);
|
var doc = new OpenLayers.Format.XML().read(xml);
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
t.eq(layers["Temperature"].srs,
|
t.eq(layers["Temperature"].srs,
|
||||||
{"CRS:84": true},
|
{"CRS:84": true},
|
||||||
"Inheritance of SRS handled correctly when redeclaring an inherited SRS");
|
"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"];
|
var bbox = layers["ROADS_RIVERS"].bbox["EPSG:26986"];
|
||||||
t.eq(bbox.bbox,
|
t.eq(bbox.bbox,
|
||||||
[189000, 834000, 285000, 962000],
|
[189000, 834000, 285000, 962000],
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
t.eq(layer.map.layers.length, 1, "layer added to the map successfully");
|
t.eq(layer.map.layers.length, 1, "layer added to the map successfully");
|
||||||
layer.destroy();
|
layer.destroy();
|
||||||
t.eq(layer.map, null, "layer.map is null after 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) {
|
function test_Layer_Vector_destroy (t) {
|
||||||
t.plan(5);
|
t.plan(6);
|
||||||
|
|
||||||
var options = {protocol: new OpenLayers.Protocol(),
|
var options = {protocol: new OpenLayers.Protocol(),
|
||||||
strategies: [new OpenLayers.Strategy(), new OpenLayers.Strategy()]}
|
strategies: [new OpenLayers.Strategy(), new OpenLayers.Strategy()]}
|
||||||
@@ -584,8 +584,14 @@
|
|||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
layer.destroy();
|
layer.destroy();
|
||||||
t.eq(layer.map, null, "layer.map is null after destroy");
|
t.eq(layer.map, null, "layer.map is null after destroy");
|
||||||
t.eq(layer.getFeatureFromEvent({'target':'map'}), null,
|
t.ok(!layer.renderer, "layer.renderer is falsey");
|
||||||
"getFeatureIdFromEvent doesn't cause an error when called on layer which has been destroyed.");
|
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.protocol, null, "layer.protocol is null after destroy");
|
||||||
t.eq(layer.strategies, null, "layer.strategies is null after destroy");
|
t.eq(layer.strategies, null, "layer.strategies is null after destroy");
|
||||||
|
|||||||
Reference in New Issue
Block a user