[Commits] r1919 - in core/trunk/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets
commits at geoext.org
commits at geoext.org
Mon Mar 1 13:14:47 CET 2010
Author: bartvde
Date: 2010-03-01 13:14:47 +0100 (Mon, 01 Mar 2010)
New Revision: 1919
Modified:
core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js
core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html
Log:
support SCALE parameter in GetLegendGraphic requests, r=elemoine (closes #161)
Modified: core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js 2010-02-28 03:11:45 UTC (rev 1918)
+++ core/trunk/geoext/lib/GeoExt/widgets/WMSLegend.js 2010-03-01 12:14:47 UTC (rev 1919)
@@ -47,6 +47,13 @@
*/
defaultStyleIsFirst: true,
+ /** api: config[useScaleParameter]
+ * ``Boolean``
+ * Should we use the optional SCALE parameter in the SLD WMS
+ * GetLegendGraphic request? Defaults to false.
+ */
+ useScaleParameter: false,
+
/** private: method[initComponent]
* Initializes the WMS legend. For group layers it will create multiple
* image box components.
@@ -99,7 +106,8 @@
STYLE: (styleName !== '') ? styleName: null,
STYLES: null,
SRS: null,
- FORMAT: this.imageFormat
+ FORMAT: this.imageFormat,
+ SCALE: (this.useScaleParameter === true) ? layer.map.getScale(): null
});
},
Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html 2010-02-28 03:11:45 UTC (rev 1918)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/WMSLegend.html 2010-03-01 12:14:47 UTC (rev 1919)
@@ -60,7 +60,7 @@
}
function test_legendurl(t) {
- t.plan(5);
+ t.plan(6);
var l, url, expectedUrl;
var mapPanel = loadMapPanel();
@@ -74,6 +74,18 @@
expectedUrl = "/ows?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&FORMAT=image%2Fgif&LAYER=a";
t.eq(url, expectedUrl, "GetLegendGraphic url is generated correctly");
l.destroy()
+
+ l = new GeoExt.WMSLegend({
+ renderTo: 'legendwms',
+ layerRecord: mapPanel.layers.getAt(0),
+ useScaleParameter: true
+ });
+ l.render();
+
+ url = l.items.get(1).url;
+ expectedUrl = "/ows?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&FORMAT=image%2Fgif&LAYER=a&SCALE=27683990.15625";
+ t.eq(url, expectedUrl, "GetLegendGraphic url is generated correctly");
+ l.destroy();
mapPanel.map.layers[0].params.STYLES = "bar";
mapPanel.layers.getAt(0).set("styles", [{
More information about the Commits
mailing list