Example #1
0
 /// <summary>
 /// Recursive method for checking whether a layername exists
 /// </summary>
 /// <param name="layer">layer</param>
 /// <param name="name">name of style</param>
 /// <returns>True of style exists</returns>
 private static bool StyleExists(Client.WmsServerLayer layer, string name)
 {
     if (layer.Style.Any(style => name == style.Name))
     {
         return(true);
     }
     return(layer.ChildLayers.Any(childlayer => StyleExists(childlayer, name)));
 }
Example #2
0
        /// <summary>
        /// Recursive method for adding all WMS layers to layer list
        /// Skips "top level" layer if addFirstLayer is false
        /// </summary>
        /// <param name="wmsServerLayer"></param>
        /// <param name="addFirstLayer"></param>
        /// <returns></returns>
        public void AddChildLayers(Client.WmsServerLayer wmsServerLayer, bool addFirstLayer)
        {
            if (addFirstLayer)
            {
                AddLayer(wmsServerLayer.Name);
            }

            foreach (Client.WmsServerLayer childlayer in wmsServerLayer.ChildLayers)
            {
                AddChildLayers(childlayer, true);
            }
        }
Example #3
0
        /// <summary>
        /// Gets all the boundingboxes from the Client.WmsServerLayer
        /// </summary>
        /// <returns>List of all spatial referenced boundingboxes</returns>
        private List <SpatialReferencedBoundingBox> getBoundingBoxes(Client.WmsServerLayer layer)
        {
            List <SpatialReferencedBoundingBox> box = new List <SpatialReferencedBoundingBox>();

            box.AddRange(layer.SRIDBoundingBoxes);
            if (layer.ChildLayers.Length > 0)
            {
                for (int i = 0; i < layer.ChildLayers.Length; i++)
                {
                    box.AddRange(getBoundingBoxes(layer.ChildLayers[i]));
                }
            }
            return(box);
        }
Example #4
0
 /// <summary>
 /// Recursive method for checking whether a layername exists
 /// </summary>
 /// <param name="layer"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 private bool LayerExists(Client.WmsServerLayer layer, string name)
 {
     if (name == layer.Name)
     {
         return(true);
     }
     foreach (Client.WmsServerLayer childlayer in layer.ChildLayers)
     {
         if (LayerExists(childlayer, name))
         {
             return(true);
         }
     }
     return(false);
 }
Example #5
0
        /// <summary>
        /// Recursive method for adding all WMS layers to layer list
        /// Skips "top level" layer if addFirstLayer is false
        /// </summary>
        /// <param name="layer"></param>
        /// <param name="addFirstLayer"></param>
        /// <returns></returns>
        public void AddChildLayers(Client.WmsServerLayer layer, bool addFirstLayer)
        {
            if (addFirstLayer)
            {
                this.AddLayer(layer.Name);
            }
            else
            {
                addFirstLayer = true;
            }


            foreach (Client.WmsServerLayer childlayer in layer.ChildLayers)
            {
                AddChildLayers(childlayer, addFirstLayer);
            }
        }
Example #6
0
 /// <summary>
 /// Recursive method for checking whether a layername exists
 /// </summary>
 /// <param name="layer">layer</param>
 /// <param name="name">name of style</param>
 /// <returns>True of style exists</returns>
 private bool StyleExists(Client.WmsServerLayer layer, string name)
 {
     foreach (Client.WmsLayerStyle style in layer.Style)
     {
         if (name == style.Name)
         {
             return(true);
         }
     }
     foreach (Client.WmsServerLayer childlayer in layer.ChildLayers)
     {
         if (StyleExists(childlayer, name))
         {
             return(true);
         }
     }
     return(false);
 }
Example #7
0
    /// <summary>
    /// Recursive function for retriving layer names
    /// </summary>
    /// <param name="layer"></param>
    /// <param name="layWms"></param>
    private void PrintLayers(Client.WmsServerLayer layer, WmsLayer layWms)
    {
        litLayers.Text += "<li>" + layer.Name;
        if (layWms.LayerList.Contains(layer.Name))
        {
            litLayers.Text += " (Enabled)";
        }
        litLayers.Text += "</li>";

        if (layer.ChildLayers != null && layer.ChildLayers.Length > 0)
        {
            litLayers.Text += "<ul>";
            foreach (Client.WmsServerLayer childlayer in layer.ChildLayers)
            {
                PrintLayers(childlayer, layWms);
            }
            litLayers.Text += "</ul>";
        }
    }
Example #8
0
 /// <summary>
 /// Recursive method for checking whether a layername exists
 /// </summary>
 /// <param name="wmsServerLayer">The WMS Server layer</param>
 /// <param name="name">The name of the desired layer</param>
 /// <returns></returns>
 private static bool LayerExists(Client.WmsServerLayer wmsServerLayer, string name)
 {
     return(name == wmsServerLayer.Name || wmsServerLayer.ChildLayers.Any(childlayer => LayerExists(childlayer, name)));
 }