GeoExt

Table Of Contents

Previous topic

GeoExt.plugins.AttributeForm

Next topic

GeoExt.plugins.PrintPageField

GeoExt.plugins.PrintExtent

ptype
gx_printextent
class GeoExt.plugins.PrintExtent

Provides a way to show and modify the extents of print pages on the map. It uses a layer to render the page extent and handle features of print pages, and provides a control to modify them. Must be set as a plugin to a GeoExt.MapPanel.

Example Use

Sample code to create a MapPanel with a PrintExtent, and print it immediately:

var printExtent = new GeoExt.plugins.PrintExtent({
    printProvider: new GeoExt.data.PrintProvider({
        capabilities: printCapabilities
    })
});

var mapPanel = new GeoExt.MapPanel({
    border: false,
    renderTo: "div-id",
    layers: [new OpenLayers.Layer.WMS("Tasmania", "http://demo.opengeo.org/geoserver/wms",
        {layers: "topp:tasmania_state_boundaries"}, {singleTile: true})],
    center: [146.56, -41.56],
    zoom: 6,
    plugins: printExtent
});

printExtent.addPage();

// print the map
printExtent.print();

Config Options

Configuration properties.

layer
OpenLayers.Layer.Vector The layer used to render extent and handle features to. Optional, will be created if not provided.
pages

Array of GeoExt.data.PrintPage The pages that this plugin controls. Optional. If not provided, it will be created with one page that is completely contained within the visible map extent.

Note

All pages must use the same PrintProvider.

printProvider
GeoExt.data.PrintProvider The print provider this form is connected to. Optional if pages are provided.

Public Properties

Public properties.

PrintExtent.page
GeoExt.data.PrintPage The page currently set for transformation.
PrintExtent.pages
Array of GeoExt.data.PrintPage The pages that this component controls. Read-only.
PrintExtent.printProvider
GeoExt.data.PrintProvider The print provider this form is connected to. Read-only.

Public Methods

Public methods.

PrintExtent.addPage()
Parameter:pageGeoExt.data.PrintPage The page to add to this plugin. If not provided, a page that fits the current extent is created.
Returns:page :class:GeoExt.data.PrintPage

Adds a page to the list of pages that this plugin controls.

PrintExtent.hide()
Tear downs the plugin, removing the OpenLayers.Control.TransformFeature control and the OpenLayers.Layer.Vector layer.
PrintExtent.print()
Parameter:optionsObject Options to send to the PrintProvider’s print method. See GeoExt.data.PrintProvider :: print.

Prints all pages as shown on the map.

PrintExtent.removePage()
Parameter:pageGeoExt.data.PrintPage The page to remove from this plugin.

Removes a page from the list of pages that this plugin controls.

PrintExtent.selectPage()
Parameter:pageGeoExt.data.PrintPage The page to select

Selects the given page (ie. calls the setFeature on the modify feature control)

PrintExtent.show()
Sets up the plugin, initializing the OpenLayers.Layer.Vector layer and OpenLayers.Control.TransformFeature, and centering the first page if no pages were specified in the configuration.

Events

Events.

selectpage

Triggered when a page has been selected using the control

Listener arguments: * printPage - GeoExt.data.PrintPage this printPage