[Users] Layer's Visibility and Tree Panel

Vince Lotito vince at vvl.com
Tue Feb 23 23:06:01 CET 2010


I am trying to synchronize the visibility of a vector layer where I persist measurement sketch.  So during the create of the measure control I am display the layer as follows:

    // create the line measure tool
    var lineMeasure = new OpenLayers.Control.Measure(
            OpenLayers.Handler.Path, {
                persist: false,
                geodesic: true,
                displaySystem: "english",
                callbacks: {
                    create: function() {
                         measureLayer.display(true);     // forcing the layer to display
                        }
            },
                handlerOptions: {
                        layerOptions: {styleMap: styleMap}
                }
            }
    );

I have a tree panel with the layers as follows:

var tree = new Ext.tree.TreePanel({
        border: true,
        region: "north",
        title: "RPD Layers",
        width: 200,
        minSize: 150,
        split: true,
        collapsible: true,
        autoScroll: true,
        loader: new Ext.tree.TreeLoader({
            applyLoader: false,
        }),
        root: {
            nodeType: "async",
            children :[{
                                    nodeType: "gx_baselayercontainer"
                            }, {
                                    nodeType: "gx_overlaylayercontainer",
                                    expanded: true,
                                    loader: {
                                         filter: function(record) {
                                                  if ( (record.get("layer").name.indexOf("Measure") == 0) ||
                                                       (record.get("layer").name.indexOf("Property") == 0) ||
                                                       (record.get("layer").name.indexOf("RPD") == 0) ||
                                                       (record.get("layer").name.indexOf("Open") == 0)) {
                                                       return false;
                                                  }
                                                  return true;
                                                }
                                    }
                            }, {
                                    nodeType: "gx_layercontainer",
                                    text: "Graphics",
                                    expanded: true,
                                    loader: {
                                         filter: function(record) {
                                                if ( (record.get("layer").name.indexOf("Measure") == 0) ||
                                                     (record.get("layer").name.indexOf("Property") == 0)) {
                                                      return true;
                                                }
                                                return false;

                                        }
                                    }
                }]

        },
        rootVisible: false,
        lines: false
    });

How can I synchronize the tree child node's (for the vector layer) check box with the visibility if the layer in the map panel?

Vince

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100223/00ff6c54/attachment-0001.htm 


More information about the Users mailing list