Tuesday, September 07, 2010

VE – add layer to List<T>, if it is not already, if it is loaded

Posted by david on 23. December 2008 18:51

//------------------------------------------------------------
    protected void UpdateLayerList()
    {                        
        // get the count of layers on the map       
        int layerCount = ScubaMap.GetShapeLayerCount();
        
        // check to see if the baselayer has loaded
        if (ScubaMap.GetShapeLayerByIndex(0).DataLoaded)
        {
            // if loaded, change the title to friendly.
            ScubaMap.GetShapeLayerByIndex(0).Title = "Base Layer";
        }        
        // iterate through the map layers, adding the layers to layerList
        for (int i = 0; i < layerCount; i++)
        {
            // First, check if the LayerList contains the current layer
            // if LayerList does not contain the layer, 
            if (!LayerList.Contains(ScubaMap.GetShapeLayerByIndex(i)))
            {                
                // Check to see if current layer is loaded; if yes, add to LayerList, if not 
                // do nothing, we'll get it the next time.
                if (ScubaMap.GetShapeLayerByIndex(i).DataLoaded)
                {
                    LayerList.Add(ScubaMap.GetShapeLayerByIndex(i));
                }
            }
        }
        // rebind
        Grid1.DataBind();       
    }

Add comment


 

biuquote
Loading