1 | |
---|
2 | .. currentmodule:: GeoExt.plugins |
---|
3 | |
---|
4 | :class:`GeoExt.plugins.PrintExtent` |
---|
5 | ================================================================================ |
---|
6 | |
---|
7 | |
---|
8 | .. cssclass:: meta |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | ptype |
---|
15 | ``gx_printextent`` |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | .. class:: PrintExtent |
---|
20 | |
---|
21 | Provides a way to show and modify the extents of print pages on the map. It |
---|
22 | uses a layer to render the page extent and handle features of print pages, |
---|
23 | and provides a control to modify them. Must be set as a plugin to a |
---|
24 | :class:`GeoExt.MapPanel`. |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | Example Use |
---|
29 | ----------- |
---|
30 | |
---|
31 | Sample code to create a MapPanel with a PrintExtent, and print it |
---|
32 | immediately: |
---|
33 | |
---|
34 | .. code-block:: javascript |
---|
35 | |
---|
36 | var printExtent = new GeoExt.plugins.PrintExtent({ |
---|
37 | printProvider: new GeoExt.data.PrintProvider({ |
---|
38 | capabilities: printCapabilities |
---|
39 | }) |
---|
40 | }); |
---|
41 | |
---|
42 | var mapPanel = new GeoExt.MapPanel({ |
---|
43 | border: false, |
---|
44 | renderTo: "div-id", |
---|
45 | layers: [new OpenLayers.Layer.WMS("Tasmania", "http://demo.opengeo.org/geoserver/wms", |
---|
46 | {layers: "topp:tasmania_state_boundaries"}, {singleTile: true})], |
---|
47 | center: [146.56, -41.56], |
---|
48 | zoom: 6, |
---|
49 | plugins: printExtent |
---|
50 | }); |
---|
51 | |
---|
52 | printExtent.addPage(); |
---|
53 | |
---|
54 | // print the map |
---|
55 | printExtent.print(); |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | Config Options |
---|
61 | -------------- |
---|
62 | |
---|
63 | Configuration properties. |
---|
64 | |
---|
65 | |
---|
66 | .. describe:: layer |
---|
67 | |
---|
68 | ``OpenLayers.Layer.Vector`` The layer used to render extent and handle |
---|
69 | features to. Optional, will be created if not provided. |
---|
70 | |
---|
71 | .. describe:: pages |
---|
72 | |
---|
73 | Array of :class:`GeoExt.data.PrintPage` The pages that this plugin |
---|
74 | controls. Optional. If not provided, it will be created with one page |
---|
75 | that is completely contained within the visible map extent. |
---|
76 | |
---|
77 | .. note:: All pages must use the same PrintProvider. |
---|
78 | |
---|
79 | .. describe:: printProvider |
---|
80 | |
---|
81 | :class:`GeoExt.data.PrintProvider` The print provider this form |
---|
82 | is connected to. Optional if pages are provided. |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | Public Properties |
---|
88 | ----------------- |
---|
89 | |
---|
90 | Public properties. |
---|
91 | |
---|
92 | |
---|
93 | .. attribute:: PrintExtent.page |
---|
94 | |
---|
95 | :class:`GeoExt.data.PrintPage` The page currently set for |
---|
96 | transformation. |
---|
97 | |
---|
98 | .. attribute:: PrintExtent.pages |
---|
99 | |
---|
100 | Array of :class:`GeoExt.data.PrintPage` The pages that this component |
---|
101 | controls. Read-only. |
---|
102 | |
---|
103 | .. attribute:: PrintExtent.printProvider |
---|
104 | |
---|
105 | :class:`GeoExt.data.PrintProvider` The print provider this form |
---|
106 | is connected to. Read-only. |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | Public Methods |
---|
112 | -------------- |
---|
113 | |
---|
114 | Public methods. |
---|
115 | |
---|
116 | |
---|
117 | .. method:: PrintExtent.addPage |
---|
118 | |
---|
119 | :param page: :class:`GeoExt.data.PrintPage` The page to add |
---|
120 | to this plugin. If not provided, a page that fits the current |
---|
121 | extent is created. |
---|
122 | :return: page :class:``GeoExt.data.PrintPage`` |
---|
123 | |
---|
124 | Adds a page to the list of pages that this plugin controls. |
---|
125 | |
---|
126 | .. method:: PrintExtent.hide |
---|
127 | |
---|
128 | Tear downs the plugin, removing the |
---|
129 | ``OpenLayers.Control.TransformFeature`` control and |
---|
130 | the ``OpenLayers.Layer.Vector`` layer. |
---|
131 | |
---|
132 | .. method:: PrintExtent.print |
---|
133 | |
---|
134 | :param options: ``Object`` Options to send to the PrintProvider's |
---|
135 | print method. See :class:`GeoExt.data.PrintProvider` :: ``print``. |
---|
136 | |
---|
137 | Prints all pages as shown on the map. |
---|
138 | |
---|
139 | .. method:: PrintExtent.removePage |
---|
140 | |
---|
141 | :param page: :class:`GeoExt.data.PrintPage` The page to remove |
---|
142 | from this plugin. |
---|
143 | |
---|
144 | Removes a page from the list of pages that this plugin controls. |
---|
145 | |
---|
146 | .. method:: PrintExtent.selectPage |
---|
147 | |
---|
148 | :param page: :class:`GeoExt.data.PrintPage` The page to select |
---|
149 | |
---|
150 | Selects the given page (ie. calls the setFeature on the modify feature |
---|
151 | control) |
---|
152 | |
---|
153 | .. method:: PrintExtent.show |
---|
154 | |
---|
155 | Sets up the plugin, initializing the ``OpenLayers.Layer.Vector`` |
---|
156 | layer and ``OpenLayers.Control.TransformFeature``, and centering |
---|
157 | the first page if no pages were specified in the configuration. |
---|
158 | |
---|
159 | |
---|
160 | |
---|
161 | |
---|
162 | Events |
---|
163 | ------ |
---|
164 | |
---|
165 | Events. |
---|
166 | |
---|
167 | |
---|
168 | .. describe:: selectpage |
---|
169 | |
---|
170 | Triggered when a page has been selected using the control |
---|
171 | |
---|
172 | Listener arguments: |
---|
173 | * printPage - :class:`GeoExt.data.PrintPage` this printPage |
---|
174 | |
---|
175 | |
---|
176 | |
---|