public override ILegendItem Create(ILegendSettings settings, object item)
        {
            if (item == null)
                throw new ArgumentNullException("item");

            if (!(item is LayerGroup))
                throw new ArgumentException("Not of valid type", "item");

            var layerGroup = (LayerGroup) item;

            var res = new LayerGroupLegendItem
            {
                Label = layerGroup.LayerName,
                LabelFont = settings.ItemFont,
                LabelBrush = settings.ForeColor,
                Item = item
            };

            var lrs = new Layer[layerGroup.Layers.Count];
            layerGroup.Layers.CopyTo(lrs, 0);
            Array.Reverse(lrs);
            foreach (var layer in lrs)
            {
                var lif = Factory[layer];
                if (lif != null)
                {
                    var nli = lif.Create(settings, layer);
                    nli.Parent = res;
                    res.SubItems.Add(nli);
                }
            }

            return res;
        }
コード例 #2
0
        public override ILegendItem Create(ILegendSettings settings, object item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (!(item is LayerGroup))
            {
                throw new ArgumentException("Not of valid type", "item");
            }

            var layerGroup = (LayerGroup)item;

            var res = new LayerGroupLegendItem
            {
                Label      = layerGroup.LayerName,
                LabelFont  = settings.ItemFont,
                LabelBrush = settings.ForeColor,
                Item       = item
            };

            var lrs = new Layer[layerGroup.Layers.Count];

            layerGroup.Layers.CopyTo(lrs, 0);
            Array.Reverse(lrs);
            foreach (var layer in lrs)
            {
                var lif = Factory[layer];
                if (lif != null)
                {
                    var nli = lif.Create(settings, layer);
                    nli.Parent = res;
                    res.SubItems.Add(nli);
                }
            }

            return(res);
        }