remove deprecated Layer.WMS.Post from SLDSelect control, r=ahocevar (closes #2930)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10898 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Layer/WMS/Post.js
|
||||
* @requires OpenLayers/Layer/WMS.js
|
||||
* @requires OpenLayers/Handler/RegularPolygon.js
|
||||
* @requires OpenLayers/Handler/Polygon.js
|
||||
* @requires OpenLayers/Handler/Path.js
|
||||
@@ -119,7 +119,7 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
|
||||
* APIProperty: layerCache
|
||||
* {Object} Cache to use for storing references to the selection layers.
|
||||
* Normally each source layer will have exactly 1 selection layer of
|
||||
* type OpenLayers.Layer.WMS.Post. If not provided, layers will
|
||||
* type OpenLayers.Layer.WMS. If not provided, layers will
|
||||
* be cached on the prototype. Note that if <clearOnDeactivate> is
|
||||
* true, the layer will no longer be cached after deactivating the
|
||||
* control.
|
||||
@@ -158,7 +158,8 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
|
||||
click: this.select}, this.callbacks);
|
||||
this.handlerOptions = this.handlerOptions || {};
|
||||
this.layerOptions = OpenLayers.Util.applyDefaults(this.layerOptions, {
|
||||
displayInLayerSwitcher: false
|
||||
displayInLayerSwitcher: false,
|
||||
tileOptions: {maxGetUrlLength: 2048}
|
||||
});
|
||||
if (this.sketchStyle) {
|
||||
this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(
|
||||
@@ -207,14 +208,14 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
|
||||
* is performed.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.WMS.Post>} A WMS Post layer since SLD selections can
|
||||
* easily get quite long.
|
||||
* {<OpenLayers.Layer.WMS>} A WMS layer with maxGetUrlLength configured to 2048
|
||||
* since SLD selections can easily get quite long.
|
||||
*/
|
||||
createSelectionLayer: function(source) {
|
||||
// check if we already have a selection layer for the source layer
|
||||
var selectionLayer;
|
||||
if (!this.layerCache[source.id]) {
|
||||
selectionLayer = new OpenLayers.Layer.WMS.Post(source.name,
|
||||
selectionLayer = new OpenLayers.Layer.WMS(source.name,
|
||||
source.url, source.params,
|
||||
OpenLayers.Util.applyDefaults(
|
||||
this.layerOptions,
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
function test_select(t) {
|
||||
t.plan(8);
|
||||
t.plan(9);
|
||||
var parser = new OpenLayers.Format.WFSDescribeFeatureType();
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS('Foo', 'http://foo', {LAYERS: 'AAA64'});
|
||||
@@ -80,7 +80,8 @@
|
||||
control.select(geometry);
|
||||
control.events.unregister("selected", this, testEvent);
|
||||
t.eq(map.layers.length, 2, "Selection layer has been created and added to the map");
|
||||
t.eq(map.layers[1] instanceof OpenLayers.Layer.WMS.Post, true, "A WMS Post layer has been created as the selection layer");
|
||||
t.eq(map.layers[1] instanceof OpenLayers.Layer.WMS, true, "A WMS layer has been created as the selection layer");
|
||||
t.eq(map.layers[1].tileOptions.maxGetUrlLength, 2048, "Selection layer will automatically switch to HTTP Post if content gets longer than 2048");
|
||||
var expected_sld = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>AAA64</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:LineSymbolizer><sld:Stroke><sld:CssParameter name="stroke">#FF0000</sld:CssParameter><sld:CssParameter name="stroke-width">2</sld:CssParameter></sld:Stroke></sld:LineSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
|
||||
|
||||
t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");
|
||||
|
||||
Reference in New Issue
Block a user