Extension of Ext TreePanel to show a tree that can control OpenLayers layers.
| mapfish. | Extension of Ext TreePanel to show a tree that can control OpenLayers layers. |
| Constructor | |
| mapfish. | |
| Properties | |
| separator | {String} the separator character to use in between layer name and sublayer. |
| model | {Array(Object)} Hierarchical structure to build the tree. |
| showWmsLegend | {Boolean} This is only used when no model is specified (when the model is automatically extracted from the map layers). |
| ascending | If true and using automatic model, the layers in the tree will show the bottom OpenLayer layer on top and the top OpenLayer layer on the bottom. |
| Functions | |
| setNodeChecked | Sets the checked status on a node. |
{Array(Object)} Hierarchical structure to build the tree. Here’s an example:
[
{
text: 'Background layers',
expanded: true,
children: [
{
text: 'OpenLayers WMS',
icon: 'http://www.openlayers.org/favicon.ico',
layerNames: ['OpenLayers WMS'],
checked: true
},
{
text: 'OpenAerialMap WMS',
layerNames: ['OpenAerialMap'],
checked: false
}
]
},
{
text: 'Overlay layers',
checked: false,
children: [
{
text: 'OpenStreetMap WMS',
icon: 'http://www.openstreetmap.org/favicon.ico',
layerNames: ['OpenStreetMap'],
checked: false
}
]
}
];Each node can contain the following properties: text: {String} The label to show in the tree checked: {Boolean} checkbox status. If this property is not set (undefined), no checkbox is drawn. It is important to note that the checkbox status takes precedence over the state defined in the OL layer. icon: {String} Optional image URL to show as an icon. expanded: {Boolean} True of this node should be expanded at startup. Default is to have node collapsed. layerNames: {Array(String)} Array of OpenLayer layer names to associate with this node. If you are using a layer which can use sublayers (WMS or Mapserver), it is possible to use a specific syntax: <OL layer name> + separator + <sublayer identifier>. The default separator is “:”, which can be changed in the LayerTree.separator property if it conflicts. For instance: MyWMS:roads
Other properties are passed to Ext. For instance the “cls” property can be used to set a specific class on the node.
setNodeChecked: function( nodeOrId, checked, fireEvent )
Sets the checked status on a node.
| nodeOrId | {String} node id or {Ext.data.Node} to set the checked status. |
| checked | {Boolean} checked status to set. If not set, this method toggles the current checkbox state. |
| fireEvent | {Boolean} whether to fire the ‘checkchange’ event or not (which updates the tree). Defaults to true. |
Sets the checked status on a node.
setNodeChecked: function( nodeOrId, checked, fireEvent )