[Users] Layer's Visibility and Tree Panel
Andreas Hocevar
ahocevar at opengeo.org
Wed Feb 24 00:15:29 CET 2010
Hi,
use measureLayer.setVisibility(true/false) instead of
measureLayer.display(true/false) to show/hide the layer, otherwise no
event will get fired and the TreeNode does not know.
Regards,
Andreas.
Vince Lotito wrote:
> 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
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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