[Users] Layer Tree groups
antoniofacno
antoniofcano at gmail.com
Mon Nov 8 22:21:40 CET 2010
My friend, we are really really near and I'm starting to understand the
way this works.
Now I've got a little problem. The root not appear expanded and If I
click over it the Firefox tell me this:
Error: this.node.layer.getVisibility is not a function
Archivo de origen:
http://ao.getcloud.info/GeoExt/lib/GeoExt/widgets/tree/LayerNode.js
Línea: 30
My Layer definitions are:
var lindes = new OpenLayers.Layer.WMS(
"Lindes",
"http://getcloud.info:8080/geoserver/wms",
{
layers: "lindes",
format: "image/png",
transparent:true
},
{
isBaseLayer: true,
singleTile: true,
visibility: true
}
);
var catastro = new OpenLayers.Layer.WMS(
"Base",
"http://getcloud.info:8080/geoserver/wms",
{
layers: "ao:Catastro",
format: "image/png",
transparent:true
},
{
isBaseLayer: true,
singleTile: true,
visibility: true
}
);
var labores_2010 = new OpenLayers.Layer.WMS(
"Labores 2010",
"http://getcloud.info:8080/geoserver/wms",
{
layers: [
"tratamiento_2010",
"rulo_2010",
"varetas_2010",
"desbrozar_2010",
"soplar_2010"
],
format: "image/png",
transparent:true
}, {
isBaseLayer: false,
buffer: 0,
singleTile: true,
visibility: true
}
);
layer = [catastro, lindes, labores_2010];
A lot of thanks,
On 08/11/10 20:39, Matt Priour wrote:
> Getting closer...
> var treeConfig = [ ... ] (THIS is the treeConfig object I was
> referencing; I was talking about your local treeConfig variable)
>
> here is what you want:
>
> var treeConfig = [
> {
> //layer: "catastro", - Don't put a layer here. It will
> just be ignored. The visible layer is determined by the order they are
> added to the map
> nodeType: "gx_baselayercontainer",
> expanded:true,
> text: "My Base Layers Title" //OPTIONAL - if you don't
> give it a text attribute then it will use a default value for the text
> of the base layers parent node
> },
> {
> nodeType: "gx_layer",
> text: "Labores 2010",
> layer: "labores_2010",
> isLeaf:false
> loader: {
> param: "LAYERS"
> }
> } ];
>
> tree = new Ext.tree.TreePanel({
> border: true,
> region: "west",
> title: "Capas",
> width: 200,
> split: true,
> collapsible: true,
> root: {
> nodeType: "async",
> children: treeConfig
> }
> });
>
> Matt Priour
> Kestrel Computer Consulting
>
>
> --------------------------------------------------
> From: "antoniofacno" <antoniofcano at gmail.com>
> Sent: Monday, November 08, 2010 12:56 PM
> To: <users at geoext.org>
> Subject: Re: [Users] Layer Tree groups
>
>> 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,
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>
More information about the Users
mailing list