cgxp.plugins.LayerTree

ptype
cgxp_layertree
class cgxp.plugins.LayerTree(config)

Example Use

Sample code showing how to add the LayerTree, ThemeChooser and ThemeSelector plugins to a gxp.Viewer:

new gxp.Viewer({
    portalConfig: {
        layout: "border",
        // by configuring items here, we don't need to configure portalItems
        // and save a wrapping container
        items: [{
            region: "north",
            contentEl: 'header-out'
        },
        {
            region: 'center',
            layout: 'border',
            id: 'center',
            tbar: [],
            items: [
                "app-map"
            ]
        },
        {
            id: "featuregrid-container",
            xtype: "panel",
            layout: "fit",
            region: "south",
            height: 160,
            split: true,
            collapseMode: "mini",
            hidden: true,
            bodyStyle: 'background-color: transparent;'
        },
        {
            layout: "accordion",
            id: "left-panel",
            region: "west",
            width: 300,
            minWidth: 300,
            split: true,
            collapseMode: "mini",
            border: false,
            defaults: {width: 300},
            items: [{
                xtype: "panel",
                title: OpenLayers.i18n("layertree"),
                id: 'layerpanel',
                layout: "vbox",
                layoutConfig: {
                    align: "stretch"
                }
            }]
        }]
    },
    tools: [{
        ptype: "cgxp_themeselector",
        outputTarget: "layerpanel",
        layerTreeId: "layertree",
        themes: THEMES,
        outputConfig: {
            layout: "fit",
            style: "padding: 3px 0 3px 3px;"
        }
    },
    {
        ptype: "cgxp_themefinder",
        outputTarget: "layerpanel",
        layerTreeId: "layertree",
        themes: THEMES,
        outputConfig: {
            layout: "fit",
            style: "padding: 3px;"
        }
    },
    {
        ptype: "cgxp_layertree",
        id: "layertree",
        events: EVENTS,
        outputConfig: {
            header: false,
            flex: 1,
            layout: "fit",
            autoScroll: true,
            themes: THEMES,
    % if permalink_themes:
            permalinkThemes: ${permalink_themes | n},
    % endif
            // default themes works only with theme groups
            defaultThemes: ["default_theme_to_load"],
            uniqueTheme: true,
            wmsURL: "${request.route_url('mapserverproxy')}"
        },
        outputTarget: "layerpanel"
    },
    ...
    ]
    ...
});

Config Options

Configuration properties.

events

Object An Observer used to send events.

outputConfig

Object Optional configuration for the output container. See CGXP.tree.Layertree.

showKMLIn2D

Boolean` Indicate if KML layers should be shown in the 2D map. Default is ``true.

showRestrictedContentWarning

Boolean Display a warning to the user if he is trying to load content that is only available when logged in. Default is false.

Events

Events.

loadtheme

Fired when a theme is loaded.

Table Of Contents

Previous topic

cgxp.plugins.Help

Next topic

cgxp.plugins.Legend

This Page

Fork me on GitHub