Пример #1
0
 public void UpdateWmsLayer(sWmsLayer l)
 {
     // if (!l.Children.Any()) return;
     var enabled = new List<WmsLayer.LayerInfo>();
     foreach (sWmsLayer layerInfo in l.Children)
     {
         GetWmsLayers(layerInfo, ref enabled);
     }
     var wms = (WmsLayer)l.Layer;
     wms.Layers = enabled.Select(k => k.Name).ToArray();
     wms.Refresh();
 }
Пример #2
0
        public void ParseEsriLayers(Layer layer, ref sLayer parent, string relativePath, bool include = true)
        {
            try
            {
                if (layer is IIgnoreLayer) return;
                var nl = parent;
                if (include)
                {
                    var wmsLayer = layer as WmsLayer;
                    if (wmsLayer != null)
                    {
                        wmsLayer.Initialized -= w_Initialized;
                        wmsLayer.Initialized += w_Initialized;

                        var wms = new sWmsLayer
                        {
                            Layer = layer,
                            Title = layer.ID,
                            Parent = parent,
                            IsTabAvailable = layer is ITabLayer,
                            IsConfigAvailable = layer is ISettingsLayer
                        };
                        wms.BaseLayer = wms;
                        parent.Children.Add(wms);
                        wms.Path = relativePath + "\\" + wmsLayer.ID;
                        if (wmsLayer.LayerList.Count > 0)
                        {
                            foreach (var sl in wmsLayer.LayerList.OrderBy(l => l.Name))
                            {
                                ParseWmsLayers(layer, sl, ref wms);
                            }
                        }
                    }
                    else
                    {
                        nl = new sLayer
                        {
                            Layer = layer,
                            Title = layer.ID,
                            IsTabAvailable = layer is ITabLayer,
                            IsConfigAvailable = layer is ISettingsLayer,
                            IsService = layer is IStartStopLayer,
                            Parent = parent,
                            Path = relativePath + "\\" + layer.ID
                        };
                        var nl1 = nl;
                        layer.PropertyChanged += (s, f) =>
                        {
                            if (f.PropertyName == "Visible")
                                nl1.Visible = layer.Visible;
                        };
                        var onlineLayer = layer as IOnlineLayer;
                        if (onlineLayer != null)
                        {
                            nl.IsOnline = onlineLayer.IsOnline;
                            nl.IsShared = onlineLayer.IsShared;
                        }
                        parent.Children.Add(nl);
                    }
                }

                var gl = layer as GroupLayer;
                if (gl == null) return;
                foreach (var cl in gl.ChildLayers.OrderBy(l => l.ID))
                {
                    //sLayer sl = new sLayer() {Layer = cl};
                    //nl.Children.Add(sl);
                    ParseLayers(cl, ref nl, relativePath + "\\" + cl.ID);
                }

                var children = layer as ILayerWithMoreChildren;
                if (children != null)
                {
                    foreach (var cl in children.Children.OrderBy(l => l.ID))
                    {
                        //sLayer sl = new sLayer() {Layer = cl};
                        //nl.Children.Add(sl);
                        ParseLayers(cl, ref nl, relativePath + "\\" + cl.ID);
                    }
                }
                gl.ChildLayers.CollectionChanged -= MakeDirty;
                gl.ChildLayers.CollectionChanged += MakeDirty;
            }
            catch (Exception e)
            {
                LogCs.LogException("ParseLayer", e);
            }
        }
Пример #3
0
 public void GetWmsLayers(sWmsLayer li, ref List<WmsLayer.LayerInfo> enabled)
 {
     if (li.Children.Any())
     {
         foreach (var l in li.Children) GetWmsLayers((sWmsLayer)l, ref enabled);
     }
     else
     {
         if (li.Visible) enabled.Add(li.LayerInfo);
     }
 }
Пример #4
0
        public static void ParseWmsLayers(Layer layer, WmsLayer.LayerInfo layerinfo, ref sWmsLayer parent)
        {
            var wms = new sWmsLayer
            {
                Layer             = layer,
                Title             = layerinfo.Name,
                LayerInfo         = layerinfo,
                BaseLayer         = parent.BaseLayer,
                IsTabAvailable    = layer is ITabLayer,
                IsConfigAvailable = layer is ISettingsLayer
            };
            parent.Children.Add(wms);

            if (layerinfo.ChildLayers.Count <= 0) return;
            foreach (var sl in layerinfo.ChildLayers)
            {
                ParseWmsLayers(layer, sl, ref wms);
            }
        }