[Users] efficient way to group overlay layers in tree node

Andreas Hocevar ahocevar at opengeo.org
Wed Mar 14 16:49:49 CET 2012


Hi Karsten,

first of all, you shouldn't be using multiple layer stores, unless
your tree is not meant to be a tree representation of the layers of
your map.

If you only want overlays, you can use a gx_overlaylayercontainer
instead of a gx_layercontainer. Or if you want to use a custom filter,
your filter function would be

filter: function(record) {
    return record.getLayer().isBaseLayer === false;
}

Hope this helps,
Andreas.


On Wed, Mar 14, 2012 at 11:55 AM, karsten vennemann
<karsten at terragis.net> wrote:
> Hi All,
>
>
>
> Using geoext 1.1, what is the best way to filter (or create) a Tree node
> with non-baselayers (“overlay”) GIS layers and group them ?
>
>
>
> I have this node but am failing to only show non-baselayers . I even
> manually created a two stores store that holds the list of layers I would
> like to have in a tree node
>
>
>
>         var kartendaten_layer = new Array();
>
>         kartendaten_layer =
> [hintergrund,emptylayer,maske,waldbesitzer,waldbesitzer_jahr,waldbesitzer_tile,gemeinde_tile,landkreise_tile,regierungsbezirke_tile,flkgrenzenbayern_tile,annotation];
>
>
>
>         var schutzgebiete_layer = new Array();
>
>         schutzgebiete_layer =
> [nationalparke,vogelschutzgebiete,naturparke,landschaftsschutzgebiete,biosphaerenreservate,naturschutzgebiete,ffh_gebiete,ramsar_gebiete];
>
>
>
>
>
>         var kartendaten_layerstore = new GeoExt.data.LayerStore({
>
>             map: map,
>
>             layers: kartendaten_layer
>
>         });
>
>         var schutzgebiete_layerstore = new GeoExt.data.LayerStore({
>
>             map: map,
>
>             layers: schutzgebiete_layer
>
>         });
>
>
>
> but I still get either the base layers also listed in the node when using
> gx_layercontainer (see below, and could not cerate a correct filter get rid
> of base layers see the ??? below)
>
> how could I filter out baselayer e.g. ? Or even use my layer.options.Group
>  ?
>
>
>
> or strangely it is not honoring my list of layers and show all overlay layer
> when using gx_overlaylayercontainer
>
>>
> {nodeType: "gx_layercontainer",
>
>                                       text: 'Kartendaten',
>
>                                       layerStore: kartendaten_layerstore, //
> mapPanel.layers,
>
>                                       expanded: true,
>
>                                       loader: {
>
>                                                  filter: function(record) {
>
>                                                     ???
>
>                                             },
>
>                                           baseAttrs: {
>
>                                               uiProvider: "custom_ui"
>
>                                           },
>
>                                           createNode: function(attr) {
>
>                                               if
> (GeoExt.WMSLegend.supports(mapPanel.layers.getByLayer(attr.layer))){
>
>                                                  attr.component = {
>
>                                                      xtype: "gx_wmslegend",
>
>                                                      layerRecord:
> mapPanel.layers.getByLayer(attr.layer),
>
>                                                      showTitle: false,
>
>                                                      cls: "legend"
>
>                                                  };
>
>                                               }
>
>                                               return
> GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);
>
>                                           }
>
>                                       }
>
>                                 }, …
>
>
>
> Any suggestions how to make this work ?
>
> Cheers
>
> Karsten
>
>
>
> Karsten Vennemann
>
>
>
> Terra GIS Ltd
>
> 2119 Boyer Ave E
>
> Seattle, WA 98112
>
> USA
>
> tel ++ 206 905 1711
>
> fax ++ 925 905 1711
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list