Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/GeoExt/examples/print-form.js @ 76

Revision 76, 4.1 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1 /**
2 * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
3 *
4 * Published under the BSD license.
5 * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
6 * of the license.
7 */
8
9/** api: example[print-form]
10 *  Print Configuration with a Form
11 *  -------------------------------
12 *  Use form field plugins to control print output.
13 */
14
15var mapPanel, printPage;
16
17Ext.onReady(function() {
18    // The printProvider that connects us to the print service
19    var printProvider = new GeoExt.data.PrintProvider({
20        method: "GET", // "POST" recommended for production use
21        capabilities: printCapabilities, // from the info.json script in the html
22        customParams: {
23            mapTitle: "Printing Demo"
24        }
25    });
26    // Our print page. Stores scale, center and rotation and gives us a page
27    // extent feature that we can add to a layer.
28    printPage = new GeoExt.data.PrintPage({
29        printProvider: printProvider
30    });
31    // A layer to display the print page extent
32    var pageLayer = new OpenLayers.Layer.Vector();
33    pageLayer.addFeatures(printPage.feature);
34
35    // The map we want to print
36    mapPanel = new GeoExt.MapPanel({
37        region: "center",
38        map: {
39            eventListeners: {
40                // recenter/resize page extent after pan/zoom
41                "moveend": function(){ printPage.fit(this, {mode: "screen"}); }
42            }
43        },
44        layers: [
45            new OpenLayers.Layer.WMS("Tasmania", "http://demo.opengeo.org/geoserver/wms",
46                {layers: "topp:tasmania_state_boundaries"}, {singleTile: true}),
47            pageLayer
48        ],
49        center: [146.56, -41.56],
50        zoom: 6
51    });
52    // The form with fields controlling the print output
53    var formPanel = new Ext.form.FormPanel({
54        region: "west",
55        width: 150,
56        bodyStyle: "padding:5px",
57        labelAlign: "top",
58        defaults: {anchor: "100%"},
59        items: [{
60            xtype: "textarea",
61            name: "comment",
62            value: "",
63            fieldLabel: "Comment",
64            plugins: new GeoExt.plugins.PrintPageField({
65                printPage: printPage
66            })
67        }, {
68            xtype: "combo",
69            store: printProvider.layouts,
70            displayField: "name",
71            fieldLabel: "Layout",
72            typeAhead: true,
73            mode: "local",
74            triggerAction: "all",
75            plugins: new GeoExt.plugins.PrintProviderField({
76                printProvider: printProvider
77            })
78        }, {
79            xtype: "combo",
80            store: printProvider.dpis,
81            displayField: "name",
82            fieldLabel: "Resolution",
83            tpl: '<tpl for="."><div class="x-combo-list-item">{name} dpi</div></tpl>',
84            typeAhead: true,
85            mode: "local",
86            triggerAction: "all",
87            plugins: new GeoExt.plugins.PrintProviderField({
88                printProvider: printProvider
89            }),
90            // the plugin will work even if we modify a combo value
91            setValue: function(v) {
92                v = parseInt(v) + " dpi";
93                Ext.form.ComboBox.prototype.setValue.apply(this, arguments);
94            }
95        }, {
96            xtype: "combo",
97            store: printProvider.scales,
98            displayField: "name",
99            fieldLabel: "Scale",
100            typeAhead: true,
101            mode: "local",
102            triggerAction: "all",
103            plugins: new GeoExt.plugins.PrintPageField({
104                printPage: printPage
105            })
106        }, {
107            xtype: "textfield",
108            name: "rotation",
109            fieldLabel: "Rotation",
110            plugins: new GeoExt.plugins.PrintPageField({
111                printPage: printPage
112            })
113        }],
114        buttons: [{
115            text: "Create PDF",
116            handler: function() {
117                printProvider.print(mapPanel, printPage);
118            }
119        }]
120    });
121     
122    // The main panel
123    new Ext.Panel({
124        renderTo: "content",
125        layout: "border",
126        width: 700,
127        height: 420,
128        items: [mapPanel, formPanel]
129    });
130});
Note: See TracBrowser for help on using the repository browser.