diff --git a/lib/OpenLayers/Control/SLDSelect.js b/lib/OpenLayers/Control/SLDSelect.js index d0667a20a3..5cd1a00e0b 100644 --- a/lib/OpenLayers/Control/SLDSelect.js +++ b/lib/OpenLayers/Control/SLDSelect.js @@ -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 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: - * {} A WMS Post layer since SLD selections can - * easily get quite long. + * {} 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, @@ -567,4 +568,4 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, { }, CLASS_NAME: "OpenLayers.Control.SLDSelect" -}); \ No newline at end of file +}); diff --git a/tests/Control/SLDSelect.html b/tests/Control/SLDSelect.html index 2221db797b..a11d6c632a 100644 --- a/tests/Control/SLDSelect.html +++ b/tests/Control/SLDSelect.html @@ -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 = 'AAA64defaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF00002'; t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");