コード例 #1
0
        internal void UpdateColorSwatchAndLegend()
        {
            MapCore mapCore = GetMapCore();

            if (mapCore == null)
            {
                return;
            }
            Field field = GetField();

            if (ShowInColorSwatch)
            {
                foreach (CustomColor customColor3 in CustomColors)
                {
                    if (customColor3.VisibleInt)
                    {
                        SwatchColor swatchColor = mapCore.ColorSwatchPanel.Colors.Add("");
                        swatchColor.automaticallyAdded = true;
                        swatchColor.Color          = customColor3.Color;
                        swatchColor.SecondaryColor = customColor3.SecondaryColor;
                        swatchColor.GradientType   = customColor3.GradientType;
                        swatchColor.HatchStyle     = customColor3.HatchStyle;
                        if (field != null && field.IsNumeric())
                        {
                            swatchColor.FromValue = field.ConvertToDouble(field.Parse(customColor3.FromValueInt));
                            swatchColor.ToValue   = field.ConvertToDouble(field.Parse(customColor3.ToValueInt));
                        }
                        else
                        {
                            swatchColor.TextValue = customColor3.FromValueInt;
                        }
                    }
                }
            }
            if (!(ShowInLegend != string.Empty) || !(ShowInLegend != "(none)"))
            {
                return;
            }
            Legend legend = (Legend)mapCore.Legends.GetByName(ShowInLegend);

            if (legend == null)
            {
                return;
            }
            foreach (CustomColor customColor4 in CustomColors)
            {
                if (customColor4.VisibleInt)
                {
                    LegendItem legendItem = legend.Items.Add("");
                    legendItem.automaticallyAdded = true;
                    legendItem.ItemStyle          = LegendItemStyle.Shape;
                    legendItem.Color          = customColor4.Color;
                    legendItem.SecondaryColor = customColor4.SecondaryColor;
                    legendItem.GradientType   = customColor4.GradientType;
                    legendItem.HatchStyle     = customColor4.HatchStyle;
                    legendItem.Text           = GetLegendText(field, customColor4.FromValueInt, customColor4.ToValueInt);
                }
            }
        }
コード例 #2
0
        public LegendItem Add(string name)
        {
            LegendItem legendItem = new LegendItem();

            legendItem.Name = name;
            Add(legendItem);
            return(legendItem);
        }
コード例 #3
0
 internal void SetContainingLegend(Legend legend, LegendItem legendItem)
 {
     this.legend     = legend;
     this.legendItem = legendItem;
     if (this.legend != null)
     {
         margins.Common = this.legend.Common;
     }
 }
コード例 #4
0
        internal void UpdateLegend()
        {
            MapCore mapCore = GetMapCore();

            if (mapCore == null)
            {
                return;
            }
            Field field = GetField();

            if (!(ShowInLegend != string.Empty) || !(ShowInLegend != "(none)"))
            {
                return;
            }
            Legend legend = (Legend)mapCore.Legends.GetByName(ShowInLegend);

            if (legend == null)
            {
                return;
            }
            foreach (CustomWidth customWidth in CustomWidths)
            {
                if (customWidth.VisibleInt)
                {
                    LegendItem legendItem = legend.Items.Add("");
                    legendItem.automaticallyAdded = true;
                    legendItem.PathWidth          = (int)Math.Round(customWidth.Width);
                    legendItem.ItemStyle          = LegendItemStyle.Path;
                    legendItem.Text           = GetLegendText(field, customWidth.FromValueInt, customWidth.ToValueInt);
                    legendItem.PathLineStyle  = base.LineStyleInLegend;
                    legendItem.BorderColor    = BorderColorInLegend;
                    legendItem.BorderWidth    = base.BorderWidthInLegend;
                    legendItem.Color          = ColorInLegend;
                    legendItem.SecondaryColor = SecondaryColorInLegend;
                    legendItem.GradientType   = GradientTypeInLegend;
                    legendItem.HatchStyle     = HatchStyleInLegend;
                }
            }
        }
コード例 #5
0
 public int Add(LegendItem item)
 {
     return(base.List.Add(item));
 }
コード例 #6
0
        internal void UpdateColorSwatchAndLegend()
        {
            MapCore mapCore = GetMapCore();

            if (mapCore == null)
            {
                return;
            }
            Field field = GetField();

            if (ShowInColorSwatch)
            {
                foreach (PredefinedSymbol predefinedSymbol3 in PredefinedSymbols)
                {
                    if (predefinedSymbol3.Visible)
                    {
                        SwatchColor swatchColor = mapCore.ColorSwatchPanel.Colors.Add("");
                        swatchColor.automaticallyAdded = true;
                        swatchColor.Color          = predefinedSymbol3.Color;
                        swatchColor.SecondaryColor = predefinedSymbol3.SecondaryColor;
                        swatchColor.GradientType   = predefinedSymbol3.GradientType;
                        swatchColor.HatchStyle     = predefinedSymbol3.HatchStyle;
                        if (field != null && field.IsNumeric())
                        {
                            swatchColor.FromValue = field.ConvertToDouble(field.Parse(predefinedSymbol3.FromValueInt));
                            swatchColor.ToValue   = field.ConvertToDouble(field.Parse(predefinedSymbol3.ToValueInt));
                        }
                        else
                        {
                            swatchColor.TextValue = predefinedSymbol3.FromValueInt;
                        }
                    }
                }
            }
            if (!(ShowInLegend != string.Empty) || !(ShowInLegend != "(none)"))
            {
                return;
            }
            Legend legend = (Legend)mapCore.Legends.GetByName(ShowInLegend);

            if (legend == null)
            {
                return;
            }
            foreach (PredefinedSymbol predefinedSymbol4 in PredefinedSymbols)
            {
                if (predefinedSymbol4.Visible)
                {
                    LegendItem legendItem = legend.Items.Add("");
                    legendItem.automaticallyAdded = true;
                    legendItem.ShadowOffset       = predefinedSymbol4.ShadowOffset;
                    legendItem.Text = GetLegendText(field, predefinedSymbol4.FromValueInt, predefinedSymbol4.ToValueInt);
                    if (!string.IsNullOrEmpty(predefinedSymbol4.Image))
                    {
                        LegendCell legendCell = new LegendCell(LegendCellType.Image, predefinedSymbol4.Image);
                        legendCell.ImageTranspColor = predefinedSymbol4.ImageTransColor;
                        legendCell.Margins.Top      = 15;
                        legendCell.Margins.Bottom   = 15;
                        LegendCell cell = new LegendCell(LegendCellType.Text, "#LEGENDTEXT", ContentAlignment.MiddleLeft);
                        legendItem.Cells.Add(legendCell);
                        legendItem.Cells.Add(cell);
                    }
                    else
                    {
                        legendItem.ItemStyle            = LegendItemStyle.Symbol;
                        legendItem.MarkerStyle          = predefinedSymbol4.MarkerStyle;
                        legendItem.MarkerColor          = predefinedSymbol4.Color;
                        legendItem.MarkerWidth          = ((predefinedSymbol4.Width < 0.001f) ? 13f : predefinedSymbol4.Width);
                        legendItem.MarkerHeight         = ((predefinedSymbol4.Height < 0.001f) ? 13f : predefinedSymbol4.Height);
                        legendItem.MarkerGradientType   = predefinedSymbol4.GradientType;
                        legendItem.MarkerHatchStyle     = predefinedSymbol4.HatchStyle;
                        legendItem.MarkerSecondaryColor = predefinedSymbol4.SecondaryColor;
                        legendItem.MarkerBorderColor    = predefinedSymbol4.BorderColor;
                        legendItem.MarkerBorderWidth    = predefinedSymbol4.BorderWidth;
                        legendItem.MarkerBorderStyle    = predefinedSymbol4.BorderStyle;
                    }
                }
            }
        }
コード例 #7
0
        public void Insert(int index, string image, string text)
        {
            LegendItem value = new LegendItem(text, Color.Empty, image);

            base.List.Insert(index, value);
        }
コード例 #8
0
        public void Insert(int index, Color color, string text)
        {
            LegendItem value = new LegendItem(text, color, "");

            base.List.Insert(index, value);
        }
コード例 #9
0
 internal LegendCellCollection(LegendItem legendItem, NamedElement parent, CommonElements common)
     : base(parent, common)
 {
     elementType     = typeof(LegendCell);
     this.legendItem = legendItem;
 }