[Users] Layer Tree groups
antoniofacno
antoniofcano at gmail.com
Mon Nov 8 19:56:46 CET 2010
On 08/11/10 19:08, Matt Priour wrote:
> While the JSON editing function in
> http://api.geoext.org/1.0/examples/tree.js allows people to play with
> the example directly, it has also generated quite a bit of confusion.
> First, there is no need to write your child node configurations to
> JSON and then parse it back out of JSON.
> Second, do you actually want to show the layers from the WMS that make
> up your labores_2010 WMS Layer and give users the ability to turn
> them on/off independtly?
> If so, then you want to use a LayerParamLoader, if not then you want
> to use the regular OverlayLayerContainerLoader or a gx_layer node with
> no loader.
>
> Here is the code you would use for allowing individual selection of
> the different labores_2010 layers
> {
> nodeType: "gx_layer",
> text: "Labores 2010",
> layer: "labores_2010",
> isLeaf:false
> loader: {
> param: "LAYERS"
> }
> // creates subnodes for the layers in the LAYERS param. If we assign
> // a loader to a LayerNode and do not provide a loader class, a
> // LayerParamLoader will be assumed.
> }
>
> Here is the code you would use for a single node to turn on/off the
> labores_2010 layer
> {
> nodeType: "gx_layer",
> text: "Labores 2010",
> layer: "labores_2010",
> isLeaf: true,
> checked: true
> }
>
> Here is the code to use an OverlayLayerContainerLoader. This will
> create subnodes for each non-baseLayer that has
> 'displayInLayerSwitcher' == true (the default for the layer, unless
> you specifically set it false in the layer options). It will use each
> layer's name attribute as the text for the tree node.
> {
> nodeType:'gx_overlaylayercontainer',
> expanded:true,
> loader:{
> baseAttrs:{checked:true} //this gives the overlayer layers
> checkboxes
> }
> }
>
> Get rid of the OpenLayers.Format.JSON write & parse stuff and just use
> treeConfig object directly.
>
I think that I understand the JSON stuff, but the treeConfig object not
at all. Is that what I have to wrote?
var treeConfig = [
{
layer: "catastro",
nodeType: "gx_baselayercontainer",
},
{
nodeType: "gx_layer",
text: "Labores 2010",
layer: "labores_2010",
isLeaf:false
loader: {
param: "LAYERS"
}
} ];
I looking info for treeConfig Object but I don't find anything :(
A lot of thanks,
More information about the Users
mailing list