public void UpdateLegend()
        {
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null)
            {
                Field field = this.GetField();
                if (this.ShowInLegend != string.Empty && this.ShowInLegend != "(none)")
                {
                    Legend legend = (Legend)mapCore.Legends.GetByName(this.ShowInLegend);
                    if (legend != null)
                    {
                        foreach (CustomWidth customWidth in this.CustomWidths)
                        {
                            if (customWidth.VisibleInt)
                            {
                                LegendItem legendItem = legend.Items.Add("");
                                legendItem.automaticallyAdded = true;
                                legendItem.PathWidth          = (int)Math.Round((double)customWidth.Width);
                                legendItem.ItemStyle          = LegendItemStyle.Path;
                                legendItem.Text           = base.GetLegendText(field, customWidth.FromValueInt, customWidth.ToValueInt);
                                legendItem.PathLineStyle  = base.LineStyleInLegend;
                                legendItem.BorderColor    = this.BorderColorInLegend;
                                legendItem.BorderWidth    = base.BorderWidthInLegend;
                                legendItem.Color          = this.ColorInLegend;
                                legendItem.SecondaryColor = this.SecondaryColorInLegend;
                                legendItem.GradientType   = this.GradientTypeInLegend;
                                legendItem.HatchStyle     = this.HatchStyleInLegend;
                            }
                        }
                    }
                }
            }
        }
        public LegendItem Add(string name)
        {
            LegendItem legendItem = new LegendItem();

            legendItem.Name = name;
            this.Add(legendItem);
            return(legendItem);
        }
        public void UpdateColorSwatchAndLegend()
        {
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null)
            {
                Field field = this.GetField();
                if (this.ShowInColorSwatch)
                {
                    foreach (CustomColor customColor3 in this.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 (this.ShowInLegend != string.Empty && this.ShowInLegend != "(none)")
                {
                    Legend legend = (Legend)mapCore.Legends.GetByName(this.ShowInLegend);
                    if (legend != null)
                    {
                        foreach (CustomColor customColor4 in this.CustomColors)
                        {
                            if (customColor4.VisibleInt)
                            {
                                LegendItem legendItem = legend.Items.Add("");
                                legendItem.automaticallyAdded = true;
                                legendItem.ItemStyle          = LegendItemStyle.Path;
                                legendItem.BorderColor        = customColor4.BorderColor;
                                legendItem.Color          = customColor4.Color;
                                legendItem.SecondaryColor = customColor4.SecondaryColor;
                                legendItem.GradientType   = customColor4.GradientType;
                                legendItem.HatchStyle     = customColor4.HatchStyle;
                                legendItem.Text           = base.GetLegendText(field, customColor4.FromValueInt, customColor4.ToValueInt);
                                legendItem.PathWidth      = this.WidthInLegend;
                                legendItem.PathLineStyle  = base.LineStyleInLegend;
                                legendItem.BorderWidth    = base.BorderWidthInLegend;
                            }
                        }
                    }
                }
            }
        }
 public void SetContainingLegend(Legend legend, LegendItem legendItem)
 {
     this.legend     = legend;
     this.legendItem = legendItem;
     if (this.legend != null)
     {
         this.margins.Common = this.legend.Common;
     }
 }
Beispiel #5
0
        public void UpdateColorSwatchAndLegend()
        {
            MapCore mapCore = base.GetMapCore();

            if (mapCore != null)
            {
                Field field = this.GetField();
                if (this.ShowInColorSwatch)
                {
                    foreach (PredefinedSymbol predefinedSymbol3 in this.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 (this.ShowInLegend != string.Empty && this.ShowInLegend != "(none)")
                {
                    Legend legend = (Legend)mapCore.Legends.GetByName(this.ShowInLegend);
                    if (legend != null)
                    {
                        foreach (PredefinedSymbol predefinedSymbol4 in this.PredefinedSymbols)
                        {
                            if (predefinedSymbol4.Visible)
                            {
                                LegendItem legendItem = legend.Items.Add("");
                                legendItem.automaticallyAdded = true;
                                legendItem.ShadowOffset       = predefinedSymbol4.ShadowOffset;
                                legendItem.Text = this.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          = (float)((predefinedSymbol4.Width < 0.0010000000474974513) ? 13.0 : predefinedSymbol4.Width);
                                    legendItem.MarkerHeight         = (float)((predefinedSymbol4.Height < 0.0010000000474974513) ? 13.0 : 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;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #6
0
 public LegendCellCollection(LegendItem legendItem, NamedElement parent, CommonElements common)
     : base(parent, common)
 {
     base.elementType = typeof(LegendCell);
     this.legendItem  = legendItem;
 }
 public int Add(LegendItem item)
 {
     return(base.List.Add(item));
 }
        public void Insert(int index, string image, string text)
        {
            LegendItem value = new LegendItem(text, Color.Empty, image);

            base.List.Insert(index, value);
        }
        public void Insert(int index, Color color, string text)
        {
            LegendItem value = new LegendItem(text, color, "");

            base.List.Insert(index, value);
        }