GeoExt.Popup¶
-
class
GeoExt.Popup(config)¶ Popups are a specialized Window that supports anchoring to a particular location in a MapPanel. When a popup is anchored to a location, that means that the popup will visibly point to the location on the map, and move accordingly when the map is panned or zoomed.
Example Use¶
Sample code to create a popup anchored to a feature:
var popup = new GeoExt.Popup({
title: "My Popup",
location: feature,
width: 200,
html: "<div>Popup content</div>",
collapsible: true
});
Config Options¶
Configuration properties in addition to those listed for Ext.Window.
-
ancCls StringCSS class name for the popup’s anchor.
-
anchored BooleanThe popup begins anchored to its location. Default istrue.
-
anchorPosition StringControls the anchor position for the popup. If set toauto, the anchor will be positioned on the top or the bottom of the window, minimizing map movement. Supported values arebottom-left,bottom-right,top-left,top-rightorauto. Defaults toauto.
-
autoLoad BooleanIf set to true, the capabilities will be loaded upon instance creation, andloadCapabilitiesdoes not need to be called manually. Setting this whencapabilitiesand nourlis provided has no effect. Default is false.
-
baseParams ObjectKey-value pairs of base params to be add to every request to the service. Optional.
-
capabilities ObjectCapabilities of the print service. Only required ifurlis not provided. This is the object returned by theinfo.jsonendpoint of the print service, and is usually obtained by including a script tag pointing to http://path/to/printservice/info.json?var=myvar in the head of the html document, making the capabilities accessible aswindow.myvar. This property should be used when no local print service or proxy is available, or when you do not listen for theloadcapabilitiesevents before creating components that require the PrintProvider’s capabilities to be available.
-
encoding StringThe encoding to set in the headers when requesting the print service. Prevent character encoding issues, especially when using IE. Default is retrieved from document charset or characterSet if existing orUTF-8if not.
-
location OpenLayers.Feature.VectororOpenLayers.LonLatorOpenLayers.PixelorOpenLayers.GeometryA location for this popup’s anchor.
-
map OpenLayers.MaporGeoExt.MapPanelThe map this popup will be anchored to (only required ifanchoredis set to true and the map cannot be derived from thelocation’s layer.
-
method StringEitherPOSTorGET(case-sensitive). Method to use when sending print requests to the servlet. If the print service is at the same origin as the application (or accessible via proxy), thenPOSTis recommended. UseGETwhen accessing a remote print service with no proxy available, but expect issues with character encoding and URLs exceeding the maximum length. Default isPOST.
-
panIn BooleanThe popup should pan the map so that the popup is fully in view when it is rendered. Default istrue.
-
popupCls StringCSS class name for the popup DOM elements. Default is “gx-popup”.
-
printProvider GeoExt.data.PrintProviderThe print provider to use with this plugin’s field. Not required if set on the owner container of the field.
-
timeout NumberTimeout of the POST Ajax request used for the print request (in milliseconds). Default of 30 seconds. Has no effect ifmethodis set toGET.
-
unpinnable BooleanThe popup should have a “unpin” tool that unanchors it from its location. Default istrue.
-
url StringBase url of the print service. Only required ifcapabilitiesis not provided. This is usually something like http://path/to/mapfish/print for Mapfish, and http://path/to/geoserver/pdf for GeoServer with the printing extension installed. This property requires that the print service is at the same origin as the application (or accessible via proxy).
Public Properties¶
Public properties in addition to those listed for Ext.Window.
-
Popup.customParams¶ ObjectKey-value pairs of custom data to be sent to the print service. Optional. This is e.g. useful for complex layout definitions on the server side that require additional parameters.
-
Popup.defaultOutputFormatName¶ Stringthe name of the default output format.
-
Popup.dpi¶ Ext.data.Recordthe record for the currently used resolution. Read-only, usesetDpito set the value.
-
Popup.dpis¶ Ext.data.JsonStoreread-only. A store representing the dpis available.Fields of records in this store:
- name -
Stringthe name of the dpi - value -
Floatthe dots per inch
- name -
-
Popup.layout¶ Ext.data.Recordthe record of the currently used layout. Read-only, usesetLayoutto set the value.
-
Popup.layouts¶ Ext.data.JsonStoreread-only. A store representing the layouts available.Fields of records in this store:
- name -
Stringthe name of the layout - size -
Objectwidth and height of the map in points - rotation -
Booleanindicates if rotation is supported
- name -
-
Popup.outputFormat¶ Ext.data.Recordthe record of the currently used output format. Read-only, usesetOutputFormatto set the value.
-
Popup.outputFormats¶ Ext.data.JsonStoreread-only. A store representing the output formats available.Fields of the output formats in this store:
- name -
Stringthe name of the output format
- name -
-
Popup.outputFormatsEnabled¶ Booleanread-only. Should outputFormats be populated and used? Default value is ‘False’
-
Popup.scales¶ Ext.data.JsonStoreread-only. A store representing the scales available.Fields of records in this store:
- name -
Stringthe name of the scale - value -
Floatthe scale denominator
- name -
Public Methods¶
Public methods in addition to those listed for Ext.Window.
-
Popup.loadCapabilities()¶ Loads the capabilities from the print service. If this instance is configured with either
capabilitiesor aurlandautoLoadset to true, then this method does not need to be called from the application.
-
Popup.print()¶ Parameters: - map –
GeoExt.MapPanelorOpenLayers.MapThe map to print. - pages –
ArrayofGeoExt.data.PrintPageorGeoExt.data.PrintPagepage(s) to print. - options –
Objectof additional options, see below.
Sends the print command to the print service and opens a new window with the resulting PDF.
Valid properties for the
optionsargument:legend-GeoExt.LegendPanelIf provided, the legend will be added to the print document. For the printed result to look like the LegendPanel, the following!legendsblock should be included in theitemsof your page layout in the print module’s configuration file:- !legends maxIconWidth: 0 maxIconHeight: 0 classIndentation: 0 layerSpace: 5 layerFontSize: 10overview-OpenLayers.Control.OverviewMapIf provided, the layers for the overview map in the printout will be taken from the OverviewMap control. If not provided, the print service will use the main map’s layers for the overview map. Applies only for layouts configured to print an overview map.
- map –
-
Popup.setDpi()¶ Parameters: dpi – Ext.data.Recordthe dpi record.Sets the dpi for this printProvider.
-
Popup.setLayout()¶ Parameters: layout – Ext.data.Recordthe record of the layout.Sets the layout for this printProvider.
-
Popup.setOutputFormat()¶ Parameters: outputFormat – Ext.data.Recordthe format record.Sets the output print format for this printProvider.
-
Popup.setSize()¶ Parameters: - w –
Integer - h –
Integer
Sets the size of the popup, taking into account the size of the anchor.
- w –
-
Popup.update()¶ Update rule titles and symbolizers.
Events¶
Events in addition to those listed for Ext.Window.
-
beforeencodelayer Triggered before a layer is encoded. This can be used to exclude layers from the printing, by having the listener return false.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - layer -
OpenLayers.Layerthe layer which is about to be encoded.
- printProvider -
-
beforeencodelegend Triggered before the legend is encoded. If the listener returns false, the default encoding based on GeoExt.LegendPanel will not be executed. This provides an option for application to get legend info from a custom component other than GeoExt.LegendPanel.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - jsonData -
ObjectThe data that will be sent to the print server. Can be used to populate jsonData.legends. - legend -
ObjectThe legend supplied in the options which were sent to the print function.
- printProvider -
-
beforeprint Triggered when the print method is called. TODO: rename this event to beforeencode
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - map -
OpenLayers.Mapthe map being printed - pages - Array of
GeoExt.data.PrintPagethe print pages being printed - options -
Objectthe options to the print command
- printProvider -
-
dpichange Triggered when the dpi value is changed.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - dpi -
Ext.data.Recordthe new dpi record
- printProvider -
-
encodelayer Triggered when a layer is encoded. This can be used to modify the encoded low-level layer object that will be sent to the print service.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - layer -
OpenLayers.Layerthe layer which is about to be encoded. - encodedLayer -
Objectthe encoded layer that will be sent to the print service.
- printProvider -
-
layoutchange Triggered when the layout is changed.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - layout -
Ext.data.Recordthe new layout
- printProvider -
-
loadcapabilities Triggered when the capabilities have finished loading. This event will only fire when
capabilitiesis not configured.Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - capabilities -
Objectthe capabilities
- printProvider -
-
outputformatchange Triggered when the outputFormat value is changed.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - outputFormat -
Ext.data.Recordthe new output format record
- printProvider -
-
print Triggered when the print document is opened.
Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - url -
Stringthe url of the print document
- printProvider -
-
printexception Triggered when using the
POSTmethod, when the print backend returns an exception.Listener arguments:
- printProvider -
GeoExt.data.PrintProviderthis PrintProvider - response -
Objectthe response object of the XHR
- printProvider -