[Commits] r1903 - in core/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Tue Feb 16 13:28:28 CET 2010
Author: bartvde
Date: 2010-02-16 13:28:28 +0100 (Tue, 16 Feb 2010)
New Revision: 1903
Modified:
core/trunk/geoext/lib/GeoExt/data/PrintProvider.js
core/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html
Log:
add support for overviewLayers in PrintProvider, r=ahocevar (closes #221)
Modified: core/trunk/geoext/lib/GeoExt/data/PrintProvider.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/PrintProvider.js 2010-02-16 10:57:11 UTC (rev 1902)
+++ core/trunk/geoext/lib/GeoExt/data/PrintProvider.js 2010-02-16 12:28:28 UTC (rev 1903)
@@ -299,6 +299,10 @@
* maxIconHeight: 0
* classIndentation: 0
*
+ * * ``overview`` - :class:`OpenLayers.Control.OverviewMap` If provided,
+ * the layers for the overview map in the print will be taken from the
+ * OverviewMap control. If not provided, the print service will use the
+ * layers in the main map for the overview map as well.
*/
print: function(map, pages, options) {
if(map instanceof GeoExt.MapPanel) {
@@ -337,6 +341,15 @@
}, this);
jsonData.pages = encodedPages;
+ if (options.overview) {
+ var encodedOverviewLayers = [];
+ Ext.each(options.overview.layers, function(layer) {
+ var enc = this.encodeLayer(layer);
+ enc && encodedOverviewLayers.push(enc);
+ }, this);
+ jsonData.overviewLayers = encodedOverviewLayers;
+ }
+
if(options.legend) {
var encodedLegends = [];
options.legend.items.each(function(cmp) {
Modified: core/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html 2010-02-16 10:57:11 UTC (rev 1902)
+++ core/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html 2010-02-16 12:28:28 UTC (rev 1903)
@@ -151,6 +151,11 @@
renderTo: "legend",
layerStore: layerStore
});
+
+ // an overview control to test the overviewLayers encoder
+ var overview = new OpenLayers.Control.OverviewMap({layers: [
+ new OpenLayers.Layer.WMS("foo", "http://foo", {layers: 'mylayer'})]});
+ map.addControl(overview);
var origRequest = Ext.Ajax.request;
Ext.Ajax.request = function(req) {
@@ -162,10 +167,11 @@
});
window.open = _open;
}
- printProvider.print(map, [printPage], {legend: legend});
+ printProvider.print(map, [printPage], {overview: overview, legend: legend});
Ext.Ajax.request = origRequest;
- var expect = {"units":"degrees","srs":"EPSG:4326","layout":"A4 portrait","dpi":75,"layers":[{"baseURL":"http://demo.opengeo.org/geoserver/wms","opacity":1,"singleTile":false,"type":"WMS","layers":["topp:tasmania_state_boundaries","topp:tasmania_water_bodies"],"format":"image/gif","styles":[""],"customParams":{"VENDORFOO":"bar"}},{"baseURL":"http://c0.labs.metacarta.com/wms-c/cache/","opacity":1,"singleTile":false,"type":"TileCache","layer":"basic","maxExtent":[-180,-90,180,90],"tileSize":[256,256],"extension":"png","resolutions":[0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.000021457672119140625]},{"type":"Image","baseURL":"http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif","opacity":1,"extent":[-180,-88.759,180,88.759],"pixelSize":[580,288],"name":"image"},{"type":"Vector","styles":{"1":{"fillColor":"#ee9900","fillOpacity":0.4,"hoverFillColor":"white","hoverFillOpacity":0.8,"strokeColor":"#ee9900","strokeOpacity":1,"strokeWidth":1,"strokeLinecap":"round","strokeDashstyle":"solid","hoverStrokeColor":"red","hoverStrokeOpacity":1,"hoverStrokeWidth":0.2,"pointRadius":6,"hoverPointRadius":1,"hoverPointUnit":"%","pointerEvents":"visiblePainted","cursor":"inherit"}},"styleProperty":"_gx_style","geoJson":{"type":"FeatureCollection","features":[{"type":"Feature","id":"f1","properties":{"_gx_style":1},"geometry":{"type":"Point","coordinates":[1,2]}}]},"name":"vector","opacity":1}],"pages":[{"mapTitle":"foo","comment":"bar","center":[1,2],"scale":4000000,"rotation":0}],"customParam":"foo","legends":[{"name":"tilecache","classes":[{"name":"","icon":"http://trac.geoext.org/chrome/site/img/GeoExt.png"}]},{"name":"wms","classes":[{"name":"","icons":["http://demo.opengeo.org/geoserver/wms?FORMAT=image%2Fgif&VENDORFOO=bar&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=topp%3Atasmania_state_boundaries","http://demo.opengeo.org/geoserver/wms?FORMAT=image%2Fgif&VENDORFOO=bar&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=topp%3Atasmania_water_bodies"]}]}]};
+ var expect = {"units":"degrees","srs":"EPSG:4326","layout":"A4 portrait","dpi":75,"layers":[{"baseURL":"http://demo.opengeo.org/geoserver/wms","opacity":1,"singleTile":false,"type":"WMS","layers":["topp:tasmania_state_boundaries","topp:tasmania_water_bodies"],"format":"image/gif","styles":[""],"customParams":{"VENDORFOO":"bar"}},{"baseURL":"http://c0.labs.metacarta.com/wms-c/cache/","opacity":1,"singleTile":false,"type":"TileCache","layer":"basic","maxExtent":[-180,-90,180,90],"tileSize":[256,256],"extension":"png","resolutions":[0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.000021457672119140625]},{"type":"Image","baseURL":"http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif","opacity":1,"extent":[-180,-88.759,180,88.759],"pixelSize":[580,288],"name":"image"},{"type":"Vector","styles":{"1":{"fillColor":"#ee9900","fillOpacity":0.4,"hoverFillColor":"white","hoverFillOpacity":0.8,"strokeColor":"#ee9900","strokeOpacity":1,"strokeWidth":1,"strokeLinecap":"round","strokeDashstyle":"solid","hoverStrokeColor":"red","hoverStrokeOpacity":1,"hoverStrokeWidth":0.2,"pointRadius":6,"hoverPointRadius":1,"hoverPointUnit":"%","pointerEvents":"visiblePainted","cursor":"inherit"}},"styleProperty":"_gx_style","geoJson":{"type":"FeatureCollection","features":[{"type":"Feature","id":"f1","properties":{"_gx_style":1},"geometry":{"type":"Point","coordinates":[1,2]}}]},"name":"vector","opacity":1}],"pages":[{"mapTitle":"foo","comment":"bar","center":[1,2],"scale":4000000,"rotation":0}],"customParam":"foo","legends":[{"name":"tilecache","classes":[{"name":"","icon":"http://trac.geoext.org/chrome/site/img/GeoExt.png"}]},{"name":"wms","classes":[{"name":"","icons":["http://demo.opengeo.org/geoserver/wms?FORMAT=image%2Fgif&VENDORFOO=bar&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=topp%3Atasmania_state_boundaries","http://demo.opengeo.org/geoserver/wms?FORMAT=image%2Fgif&VENDORFOO=bar&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=topp%3Atasmania_water_bodies"]}]}],"overviewLayers":[{"baseURL":"http://foo/","format":"image/jpeg",layers:["mylayer"],"opacity":1,"singleTile":false,styles:[""],type:"WMS"}]
+};
t.eq(log.request.jsonData, expect, "Request with encoded layers and legend is correct.");
More information about the Commits
mailing list