Select to view content in your preferred language

User configuration to turn on specific layers

613
2
10-03-2012 03:04 PM
ChrisBradberry
Deactivated User
Hey,

Does anybody have any ideas on how to set up a system where the users can select which data sets that they want turned on as a default?  This is for an internal system, where the user name is available.  I am using Dominique's reorganize legend sample, and I would like it to turn on the layers according to each user when they log in.

Thanks, Chris
0 Kudos
2 Replies
LanceCrumbliss
Frequent Contributor
Hey,

Does anybody have any ideas on how to set up a system where the users can select which data sets that they want turned on as a default?  This is for an internal system, where the user name is available.  I am using Dominique's reorganize legend sample, and I would like it to turn on the layers according to each user when they log in.

Thanks, Chris


Store an array of integers (or List of Integers) that indicate which layers are visible.  You can store it in isolated storage, but that's only going to retrieve the list on the machine the user has used the app on previously.  for roaming, you can store the array/list on a networked server or database.

You then retrieve the list when the user logs into the app and have it apply the visible layers, depending on how your map is set up (is it multiple mapsevices, a single ArcGISDynamicMapServiceLayer, etc?).

Lance
0 Kudos
ChrisBradberry
Deactivated User
Thanks,

I want to have the user set up the layers by checking all the layers in the legend that they want to view, then hit a button that saves the configuration.  So far I have been able to save the visible layers, but that does not include the layers that are checked but not visible due to scale dependencies.  Do you know of a way to find the checked layers in the legend?

This is what I am using to find the visible
            
            foreach (LayerItemViewModel livm in _legend.LayerItems)
            {
                if (livm.Layer.ID == "VantageLayers")
                {
                    var subLayerItem = livm.LayerItems.FirstOrDefault();

                    for (int i = 0; i < subLayerItem.LayerItems.Count; i++)
                    {
                        if (subLayerItem.LayerItems.IsVisible)
                        {
                            sb.Append(subLayerItem.LayerItems.SubLayerID + Environment.NewLine);

                            sb.Append(subLayerItem.LayerItems.Label + Environment.NewLine);
                            
                        }
                    }
                    
                }                                      


Thanks, Chris
0 Kudos