Exemplo n.º 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));
        }
Exemplo n.º 2
0
 public void Remove(LegendCell cell)
 {
     if (cell != null)
     {
         base.List.Remove(cell);
     }
 }
Exemplo n.º 3
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;
                    }
                }
            }
        }
Exemplo n.º 4
0
        internal void AddAutomaticCells(Legend legend, SizeF singleWCharacterSize)
        {
            if (Cells.Count != 0)
            {
                return;
            }
            clearTempCells = true;
            int        num        = Cells.Add(LegendCellType.Symbol, string.Empty, ContentAlignment.MiddleCenter);
            LegendCell legendCell = Cells[num];

            if (ItemStyle == LegendItemStyle.Symbol)
            {
                if (Symbol.IsXamlMarker(MarkerStyle))
                {
                    RectangleF rectangleF = Symbol.CalculateXamlMarkerBounds(MarkerStyle, PointF.Empty, MarkerWidth, MarkerHeight);
                    Size       empty      = Size.Empty;
                    empty.Width           = (int)Math.Round(100f * rectangleF.Width / singleWCharacterSize.Width);
                    empty.Height          = (int)Math.Round(100f * rectangleF.Height / singleWCharacterSize.Height);
                    legendCell.SymbolSize = empty;
                }
                else
                {
                    int width  = (int)Math.Round(100f * MarkerWidth / singleWCharacterSize.Width);
                    int height = (int)Math.Round(100f * MarkerHeight / singleWCharacterSize.Height);
                    legendCell.SymbolSize = new Size(width, height);
                }
            }
            else if (ItemStyle == LegendItemStyle.Path)
            {
                float num2 = 100f * (float)PathWidth / singleWCharacterSize.Height;
                float num3 = 100f * (float)BorderWidth / singleWCharacterSize.Height;
                float num4 = 9.1f;
                if (PathLineStyle == MapDashStyle.Dash)
                {
                    num4 = 8.9f;
                }
                else if (PathLineStyle == MapDashStyle.DashDot)
                {
                    num4 = 11.5f;
                }
                else if (PathLineStyle == MapDashStyle.DashDotDot)
                {
                    num4 = 9.1f;
                }
                else if (PathLineStyle == MapDashStyle.Dot)
                {
                    num4 = 9.1f;
                }
                if (PathWidth == 1)
                {
                    num4 *= 3f;
                }
                else if (PathWidth == 2)
                {
                    num4 *= 2f;
                }
                else if (PathWidth == 3)
                {
                    num4 *= 1.5f;
                }
                int width2 = (int)Math.Round(num2 * num4);
                legendCell.SymbolSize = new Size(width2, (int)Math.Round(num2 + num3 * 2f));
            }
            if (num < legend.CellColumns.Count)
            {
                LegendCellColumn legendCellColumn = legend.CellColumns[num];
                legendCell.ToolTip        = legendCellColumn.ToolTip;
                legendCell.Href           = legendCellColumn.Href;
                legendCell.CellAttributes = legendCellColumn.CellColumnAttributes;
            }
            num        = Cells.Add(LegendCellType.Text, "#LEGENDTEXT", ContentAlignment.MiddleLeft);
            legendCell = Cells[num];
            if (num < legend.CellColumns.Count)
            {
                LegendCellColumn legendCellColumn2 = legend.CellColumns[num];
                legendCell.ToolTip        = legendCellColumn2.ToolTip;
                legendCell.Href           = legendCellColumn2.Href;
                legendCell.CellAttributes = legendCellColumn2.CellColumnAttributes;
            }
        }
Exemplo n.º 5
0
 public int Add(LegendCell cell)
 {
     return(base.List.Add(cell));
 }
Exemplo n.º 6
0
 public int IndexOf(LegendCell cell)
 {
     return(base.List.IndexOf(cell));
 }
Exemplo n.º 7
0
 public void Insert(int index, LegendCell cell)
 {
     base.List.Insert(index, cell);
 }