Exemple #1
0
        public int Add(string name, LegendCellType cellType, string text, ContentAlignment alignment)
        {
            LegendCell legendCell = new LegendCell(cellType, text, alignment);

            legendCell.Name = name;
            return(base.List.Add(legendCell));
        }
Exemple #2
0
 public void Remove(LegendCell cell)
 {
     if (cell != null)
     {
         base.List.Remove(cell);
     }
 }
        public LegendCell CreateNewCell()
        {
            LegendCell legendCell = new LegendCell();

            legendCell.CellType       = (LegendCellType)((this.ColumnType == LegendCellColumnType.Symbol) ? 1 : 0);
            legendCell.Text           = this.Text;
            legendCell.ToolTip        = this.ToolTip;
            legendCell.Href           = this.Href;
            legendCell.CellAttributes = this.CellColumnAttributes;
            legendCell.SymbolSize     = this.SeriesSymbolSize;
            legendCell.Alignment      = this.Alignment;
            legendCell.Margins        = new Margins(this.Margins.Top, this.Margins.Bottom, this.Margins.Left, this.Margins.Right);
            return(legendCell);
        }
Exemple #4
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;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #5
0
 public int Add(LegendCell cell)
 {
     return(base.List.Add(cell));
 }
Exemple #6
0
 public int IndexOf(LegendCell cell)
 {
     return(base.List.IndexOf(cell));
 }
Exemple #7
0
 public void Insert(int index, LegendCell cell)
 {
     base.List.Insert(index, cell);
 }
 public void AddAutomaticCells(Legend legend, SizeF singleWCharacterSize)
 {
     if (this.Cells.Count == 0)
     {
         this.clearTempCells = true;
         int        num        = this.Cells.Add(LegendCellType.Symbol, string.Empty, ContentAlignment.MiddleCenter);
         LegendCell legendCell = this.Cells[num];
         if (this.ItemStyle == LegendItemStyle.Symbol)
         {
             if (Symbol.IsXamlMarker(this.MarkerStyle))
             {
                 RectangleF rectangleF = Symbol.CalculateXamlMarkerBounds(this.MarkerStyle, PointF.Empty, this.MarkerWidth, this.MarkerHeight);
                 Size       empty      = Size.Empty;
                 empty.Width           = (int)Math.Round(100.0 * rectangleF.Width / singleWCharacterSize.Width);
                 empty.Height          = (int)Math.Round(100.0 * rectangleF.Height / singleWCharacterSize.Height);
                 legendCell.SymbolSize = empty;
             }
             else
             {
                 int width  = (int)Math.Round(100.0 * this.MarkerWidth / singleWCharacterSize.Width);
                 int height = (int)Math.Round(100.0 * this.MarkerHeight / singleWCharacterSize.Height);
                 legendCell.SymbolSize = new Size(width, height);
             }
         }
         else if (this.ItemStyle == LegendItemStyle.Path)
         {
             float num2 = (float)(100.0 * (float)this.PathWidth / singleWCharacterSize.Height);
             float num3 = (float)(100.0 * (float)this.BorderWidth / singleWCharacterSize.Height);
             float num4 = 9.1f;
             if (this.PathLineStyle == MapDashStyle.Dash)
             {
                 num4 = 8.9f;
             }
             else if (this.PathLineStyle == MapDashStyle.DashDot)
             {
                 num4 = 11.5f;
             }
             else if (this.PathLineStyle == MapDashStyle.DashDotDot)
             {
                 num4 = 9.1f;
             }
             else if (this.PathLineStyle == MapDashStyle.Dot)
             {
                 num4 = 9.1f;
             }
             if (this.PathWidth == 1)
             {
                 num4 = (float)(num4 * 3.0);
             }
             else if (this.PathWidth == 2)
             {
                 num4 = (float)(num4 * 2.0);
             }
             else if (this.PathWidth == 3)
             {
                 num4 = (float)(num4 * 1.5);
             }
             int width2 = (int)Math.Round((double)(num2 * num4));
             legendCell.SymbolSize = new Size(width2, (int)Math.Round(num2 + num3 * 2.0));
         }
         if (num < legend.CellColumns.Count)
         {
             LegendCellColumn legendCellColumn = legend.CellColumns[num];
             legendCell.ToolTip        = legendCellColumn.ToolTip;
             legendCell.Href           = legendCellColumn.Href;
             legendCell.CellAttributes = legendCellColumn.CellColumnAttributes;
         }
         num        = this.Cells.Add(LegendCellType.Text, "#LEGENDTEXT", ContentAlignment.MiddleLeft);
         legendCell = this.Cells[num];
         if (num < legend.CellColumns.Count)
         {
             LegendCellColumn legendCellColumn2 = legend.CellColumns[num];
             legendCell.ToolTip        = legendCellColumn2.ToolTip;
             legendCell.Href           = legendCellColumn2.Href;
             legendCell.CellAttributes = legendCellColumn2.CellColumnAttributes;
         }
     }
 }