/// <summary>
        /// Update control size
        /// </summary>
        public void UpdateControlSize()
        {
            if (_graphic.Shape == null)
            {
                return;
            }

            _updatingSize = true;

            switch (_graphic.Shape.ShapeType)
            {
            case ShapeTypes.Point:
                PointShape aPS = (PointShape)_graphic.Shape;
                this.Left = (int)aPS.Point.X;
                this.Top  = (int)aPS.Point.Y;
                if (_graphic.Legend.GetType() == typeof(PointBreak))
                {
                    PointBreak aPB = (PointBreak)_graphic.Legend;
                    this.Left  -= (int)(aPB.Size / 2);
                    this.Top   -= (int)(aPB.Size / 2);
                    this.Width  = (int)Math.Ceiling(aPB.Size);
                    this.Height = (int)Math.Ceiling(aPB.Size);
                }
                else if (_graphic.Legend.GetType() == typeof(LabelBreak))
                {
                    LabelBreak aLB = (LabelBreak)_graphic.Legend;
                    SizeF      aSF = _mapLayout.CreateGraphics().MeasureString(aLB.Text, aLB.Font);
                    this.Left  -= (int)(aSF.Width / 2);
                    this.Top   -= (int)(aSF.Height / 2);
                    this.Width  = (int)Math.Ceiling(aSF.Width);
                    this.Height = (int)Math.Ceiling(aSF.Height);
                }
                break;

            case ShapeTypes.WindArraw:
                WindArraw aWA = (WindArraw)_graphic.Shape;
                this.Left   = (int)aWA.Point.X;
                this.Top    = (int)aWA.Point.Y;
                this.Width  = (int)(aWA.length * ((VectorBreak)_graphic.Legend).Zoom);
                this.Height = 20;
                break;

            case ShapeTypes.Polyline:
            case ShapeTypes.Polygon:
            case ShapeTypes.Rectangle:
            case ShapeTypes.Circle:
            case ShapeTypes.CurveLine:
            case ShapeTypes.CurvePolygon:
            case ShapeTypes.Ellipse:
                Extent extent = _graphic.Shape.Extent;
                this.Left   = (int)Math.Ceiling(extent.minX);
                this.Top    = (int)Math.Ceiling(extent.minY);
                this.Width  = (int)Math.Ceiling((extent.Width));
                this.Height = (int)Math.Ceiling((extent.Height));
                break;
            }

            _updatingSize = false;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aPB"></param>
 public PointShapeSet(PointBreak aPB)
 {
     m_PointColor   = aPB.Color;
     m_PointSize    = aPB.Size;
     m_PointStyle   = aPB.Style;
     m_OutlineColor = aPB.OutlineColor;
     m_DrawOutline  = aPB.DrawOutline;
     m_DrawFill     = aPB.DrawFill;
     m_DrawPoint    = aPB.DrawShape;
 }
        /// <summary>
        /// Resize shape
        /// </summary>
        public override void  ResizeUpdate()
        {
            if (_graphic.Shape != null)
            {
                switch (_graphic.Shape.ShapeType)
                {
                case ShapeTypes.Point:
                    if (_graphic.Legend.GetType() == typeof(PointBreak))
                    {
                        PointBreak aPB = (PointBreak)_graphic.Legend;
                        aPB.Size = Width;
                    }
                    break;

                case ShapeTypes.Polyline:
                case ShapeTypes.Polygon:
                case ShapeTypes.CurveLine:
                case ShapeTypes.CurvePolygon:
                    MoveUpdate();
                    List <PointD> points  = _graphic.Shape.GetPoints();
                    Extent        aExtent = _graphic.Shape.Extent;
                    int           deltaX  = this.Width - (int)aExtent.Width;
                    int           deltaY  = this.Height - (int)aExtent.Height;

                    for (int i = 0; i < points.Count; i++)
                    {
                        PointD aP = points[i];
                        aP.X      = aP.X + deltaX * (aP.X - aExtent.minX) / aExtent.Width;
                        aP.Y      = aP.Y + deltaY * (aP.Y - aExtent.minY) / aExtent.Height;
                        points[i] = aP;
                    }
                    _graphic.Shape.SetPoints(points);
                    break;

                case ShapeTypes.Rectangle:
                case ShapeTypes.Ellipse:
                    points = new List <PointD>();
                    points.Add(new PointD(this.Left, this.Top));
                    points.Add(new PointD(this.Left, this.Bottom));
                    points.Add(new PointD(this.Right, this.Bottom));
                    points.Add(new PointD(this.Right, this.Top));
                    _graphic.Shape.SetPoints(points);
                    break;

                case ShapeTypes.Circle:
                    points = new List <PointD>();
                    points.Add(new PointD(this.Left, this.Top + this.Width / 2));
                    points.Add(new PointD(this.Left + this.Width / 2, this.Top));
                    points.Add(new PointD(this.Left + this.Width, this.Top + this.Width / 2));
                    points.Add(new PointD(this.Left + this.Width / 2, this.Top + this.Width));
                    _graphic.Shape.SetPoints(points);
                    break;
                }
            }
        }
        /// <summary>
        /// Paint graphics
        /// </summary>
        /// <param name="g">graphics</param>
        public void PaintGraphics(Graphics g)
        {
            switch (_graphic.Shape.ShapeType)
            {
            case ShapeTypes.Point:
                PointD dPoint = _graphic.Shape.GetPoints()[0];
                PointF aPoint = new PointF((float)dPoint.X, (float)dPoint.Y);
                if (_graphic.Legend.GetType() == typeof(PointBreak))
                {
                    PointBreak aPB = (PointBreak)_graphic.Legend;
                    //PointF aPoint = new PointF(this.Left + (float)this.Width / 2, this.Top + (float)this.Height / 2);
                    g.SmoothingMode = SmoothingMode.HighQuality;
                    Draw.DrawPoint(aPoint, aPB, g);
                    g.SmoothingMode = _smoothingMode;
                }
                else if (_graphic.Legend.GetType() == typeof(LabelBreak))
                {
                    LabelBreak aLB  = (LabelBreak)_graphic.Legend;
                    Rectangle  rect = new Rectangle();
                    //Draw.DrawLabelPoint(new PointF(this.Left + (float)this.Width / 2, this.Top + (float)this.Height / 2), aLB, g, ref rect);
                    Draw.DrawLabelPoint(aPoint, aLB, g, ref rect);
                    //g.DrawString(aLB.Text, aLB.Font, new SolidBrush(aLB.Color), new PointF(0, 0));
                }
                break;

            case ShapeTypes.Polyline:
            case ShapeTypes.Polygon:
            case ShapeTypes.Rectangle:
                List <PointD> pList  = _graphic.Shape.GetPoints();
                PointF[]      points = new PointF[pList.Count];
                for (int i = 0; i < pList.Count; i++)
                {
                    points[i].X = (float)pList[i].X;
                    points[i].Y = (float)pList[i].Y;
                }

                if (_graphic.Shape.ShapeType == ShapeTypes.Polyline)
                {
                    Draw.DrawPolyline(points, (PolyLineBreak)_graphic.Legend, g);
                }
                else
                {
                    Draw.DrawPolygon(points, (PolygonBreak)_graphic.Legend, g);
                }

                break;
            }
        }
        /// <summary>
        /// Paint graphics
        /// </summary>
        /// <param name="g">graphics</param>
        /// <param name="pageLocation">page location</param>
        /// <param name="zoom">zoom</param>
        public void PaintGraphics(Graphics g, PointF pageLocation, float zoom)
        {
            switch (_graphic.Shape.ShapeType)
            {
            case ShapeTypes.Point:
                PointD dPoint = _graphic.Shape.GetPoints()[0];
                PointF aPoint = PageToScreen((float)dPoint.X, (float)dPoint.Y, pageLocation, zoom);
                if (_graphic.Legend.GetType() == typeof(PointBreak))
                {
                    PointBreak aPB  = (PointBreak)((PointBreak)_graphic.Legend).Clone();
                    float      size = aPB.Size;
                    aPB.Size = aPB.Size * zoom;
                    //PointF aPoint = new PointF(this.Left + (float)this.Width / 2, this.Top + (float)this.Height / 2);
                    g.SmoothingMode = SmoothingMode.HighQuality;
                    Draw.DrawPoint(aPoint, aPB, g);
                    aPB.Size        = size;
                    g.SmoothingMode = _smoothingMode;
                }
                else if (_graphic.Legend.GetType() == typeof(LabelBreak))
                {
                    LabelBreak aLB  = (LabelBreak)((LabelBreak)_graphic.Legend).Clone();
                    Font       font = (Font)aLB.Font.Clone();
                    aLB.Font = new Font(font.Name, font.Size * zoom, font.Style);
                    Rectangle rect = new Rectangle();
                    //Draw.DrawLabelPoint(new PointF(this.Left + (float)this.Width / 2, this.Top + (float)this.Height / 2), aLB, g, ref rect);
                    Draw.DrawLabelPoint(aPoint, aLB, g, ref rect);
                    aLB.Font = font;
                    //g.DrawString(aLB.Text, aLB.Font, new SolidBrush(aLB.Color), new PointF(0, 0));
                }
                break;

            case ShapeTypes.WindArraw:
                dPoint = _graphic.Shape.GetPoints()[0];
                aPoint = PageToScreen((float)dPoint.X, (float)dPoint.Y, pageLocation, zoom);
                WindArraw   aArraw = (WindArraw)_graphic.Shape;
                VectorBreak aVB    = (VectorBreak)_graphic.Legend;
                Draw.DrawArraw(aVB.Color, aPoint, aArraw, g, aVB.Zoom * zoom);
                Font drawFont = new Font("Arial", 8 * zoom);
                g.DrawString(aArraw.length.ToString(), drawFont, new SolidBrush(aVB.Color), aPoint.X, aPoint.Y);
                break;

            case ShapeTypes.Polyline:
            case ShapeTypes.Polygon:
            case ShapeTypes.Rectangle:
            case ShapeTypes.Circle:
            case ShapeTypes.CurveLine:
            case ShapeTypes.CurvePolygon:
            case ShapeTypes.Ellipse:
                List <PointD> pList  = _graphic.Shape.GetPoints();
                PointF[]      points = new PointF[pList.Count];
                for (int i = 0; i < pList.Count; i++)
                {
                    points[i] = PageToScreen((float)pList[i].X, (float)pList[i].Y, pageLocation, zoom);
                }

                switch (_graphic.Shape.ShapeType)
                {
                case ShapeTypes.Polyline:
                    PolyLineBreak aPLB = (PolyLineBreak)((PolyLineBreak)_graphic.Legend).Clone();
                    float         size = aPLB.Size;
                    aPLB.Size = size * zoom;
                    Draw.DrawPolyline(points, (PolyLineBreak)_graphic.Legend, g);
                    aPLB.Size = size;
                    break;

                case ShapeTypes.Polygon:
                case ShapeTypes.Rectangle:
                    PolygonBreak aPGB = (PolygonBreak)((PolygonBreak)_graphic.Legend).Clone();
                    size             = aPGB.OutlineSize;
                    aPGB.OutlineSize = size * zoom;
                    Draw.DrawPolygon(points, (PolygonBreak)_graphic.Legend, g);
                    aPGB.OutlineSize = size;
                    break;

                case ShapeTypes.Circle:
                    aPGB             = (PolygonBreak)((PolygonBreak)_graphic.Legend).Clone();
                    size             = aPGB.OutlineSize;
                    aPGB.OutlineSize = size * zoom;
                    Draw.DrawCircle(points, (PolygonBreak)_graphic.Legend, g);
                    aPGB.OutlineSize = size;
                    break;

                case ShapeTypes.CurveLine:
                    aPLB      = (PolyLineBreak)((PolyLineBreak)_graphic.Legend).Clone();
                    size      = aPLB.Size;
                    aPLB.Size = size * zoom;
                    Draw.DrawCurveLine(points, (PolyLineBreak)_graphic.Legend, g);
                    aPLB.Size = size;
                    break;

                case ShapeTypes.CurvePolygon:
                    aPGB             = (PolygonBreak)((PolygonBreak)_graphic.Legend).Clone();
                    size             = aPGB.OutlineSize;
                    aPGB.OutlineSize = size * zoom;
                    Draw.DrawCurvePolygon(points, (PolygonBreak)_graphic.Legend, g);
                    aPGB.OutlineSize = size;
                    break;

                case ShapeTypes.Ellipse:
                    aPGB             = (PolygonBreak)((PolygonBreak)_graphic.Legend).Clone();
                    size             = aPGB.OutlineSize;
                    aPGB.OutlineSize = size * zoom;
                    Draw.DrawEllipse(points, (PolygonBreak)_graphic.Legend, g);
                    aPGB.OutlineSize = size;
                    break;
                }
                break;
            }
        }
Ejemplo n.º 6
0
        private ColorBreak LoadLegend(XmlNode legendNode, ShapeTypes shapeType)
        {
            ColorBreak legend = new ColorBreak();

            try
            {
                Color      color      = ColorTranslator.FromHtml(legendNode.Attributes["Color"].InnerText);
                string     legendType = legendNode.Attributes["LegendType"].InnerText;
                BreakTypes breakType  = (BreakTypes)Enum.Parse(typeof(BreakTypes), legendType);
                switch (breakType)
                {
                case BreakTypes.PointBreak:
                    PointBreak aPB = new PointBreak();
                    try
                    {
                        aPB.Color        = color;
                        aPB.DrawFill     = bool.Parse(legendNode.Attributes["DrawFill"].InnerText);
                        aPB.DrawOutline  = bool.Parse(legendNode.Attributes["DrawOutline"].InnerText);
                        aPB.OutlineColor = ColorTranslator.FromHtml(legendNode.Attributes["OutlineColor"].InnerText);
                        aPB.Size         = float.Parse(legendNode.Attributes["Size"].InnerText);
                        aPB.Style        = (PointStyle)Enum.Parse(typeof(PointStyle), legendNode.Attributes["Style"].InnerText);
                        aPB.MarkerType   = (MarkerType)Enum.Parse(typeof(MarkerType), legendNode.Attributes["MarkerType"].InnerText, true);
                        aPB.FontName     = legendNode.Attributes["FontName"].InnerText;
                        aPB.CharIndex    = int.Parse(legendNode.Attributes["CharIndex"].InnerText);
                        aPB.ImagePath    = legendNode.Attributes["ImagePath"].InnerText;
                        aPB.Angle        = float.Parse(legendNode.Attributes["Angle"].InnerText);
                    }
                    catch { }
                    finally
                    {
                        legend = aPB;
                    }
                    break;

                case BreakTypes.LabelBreak:
                    LabelBreak aLB = new LabelBreak();
                    try
                    {
                        aLB.Color = color;
                        aLB.Angle = float.Parse(legendNode.Attributes["Angle"].InnerText);
                        aLB.Text  = legendNode.Attributes["Text"].InnerText;
                        string fontName = legendNode.Attributes["FontName"].InnerText;
                        float  fontSize = float.Parse(legendNode.Attributes["FontSize"].InnerText);
                        bool   fontBold = bool.Parse(legendNode.Attributes["FontBold"].InnerText);
                        if (fontBold)
                        {
                            aLB.Font = new Font(fontName, fontSize, FontStyle.Bold);
                        }
                        else
                        {
                            aLB.Font = new Font(fontName, fontSize);
                        }

                        aLB.YShift = float.Parse(legendNode.Attributes["YShift"].InnerText);
                    }
                    catch { }
                    finally
                    {
                        legend = aLB;
                    }
                    break;

                case BreakTypes.ChartBreak:
                    ChartBreak aChB = new ChartBreak(ChartTypes.BarChart);
                    try
                    {
                        ChartTypes chartType = (ChartTypes)Enum.Parse(typeof(ChartTypes), legendNode.Attributes["ChartType"].InnerText);
                        aChB            = new ChartBreak(chartType);
                        aChB.ShapeIndex = int.Parse(legendNode.Attributes["ShapeIndex"].InnerText);
                        List <float> cData    = new List <float>();
                        string[]     cDataStr = legendNode.Attributes["ChartData"].InnerText.Split(',');
                        for (int i = 0; i < cDataStr.Length; i++)
                        {
                            cData.Add(float.Parse(cDataStr[i]));
                        }

                        aChB.ChartData = cData;
                        aChB.XShift    = int.Parse(legendNode.Attributes["XShift"].InnerText);
                        aChB.YShift    = int.Parse(legendNode.Attributes["YShift"].InnerText);
                    }
                    catch { }
                    finally
                    {
                        legend = aChB;
                    }
                    break;

                case BreakTypes.VectorBreak:
                    VectorBreak aVB = new VectorBreak();
                    try
                    {
                        aVB.Color = color;
                    }
                    catch { }
                    finally
                    {
                        legend = aVB;
                    }
                    break;

                case BreakTypes.PolylineBreak:
                    PolyLineBreak aPLB = new PolyLineBreak();
                    try
                    {
                        aPLB.Color = color;
                        aPLB.Size  = Convert.ToSingle(legendNode.Attributes["Size"].InnerText);
                        aPLB.Style = (LineStyles)Enum.Parse(typeof(LineStyles),
                                                            legendNode.Attributes["Style"].InnerText, true);
                        aPLB.DrawSymbol  = bool.Parse(legendNode.Attributes["DrawSymbol"].InnerText);
                        aPLB.SymbolSize  = Single.Parse(legendNode.Attributes["SymbolSize"].InnerText);
                        aPLB.SymbolStyle = (PointStyle)Enum.Parse(typeof(PointStyle),
                                                                  legendNode.Attributes["SymbolStyle"].InnerText, true);
                        aPLB.SymbolColor    = ColorTranslator.FromHtml(legendNode.Attributes["SymbolColor"].InnerText);
                        aPLB.SymbolInterval = int.Parse(legendNode.Attributes["SymbolInterval"].InnerText);
                    }
                    catch { }
                    finally
                    {
                        legend = aPLB;
                    }
                    break;

                case BreakTypes.PolygonBreak:
                    PolygonBreak aPGB = new PolygonBreak();
                    try
                    {
                        aPGB.Color           = color;
                        aPGB.DrawFill        = Convert.ToBoolean(legendNode.Attributes["DrawFill"].InnerText);
                        aPGB.DrawOutline     = Convert.ToBoolean(legendNode.Attributes["DrawOutline"].InnerText);
                        aPGB.OutlineSize     = Convert.ToSingle(legendNode.Attributes["OutlineSize"].InnerText);
                        aPGB.OutlineColor    = ColorTranslator.FromHtml(legendNode.Attributes["OutlineColor"].InnerText);
                        aPGB.UsingHatchStyle = bool.Parse(legendNode.Attributes["UsingHatchStyle"].InnerText);
                        aPGB.Style           = (HatchStyle)Enum.Parse(typeof(HatchStyle), legendNode.Attributes["Style"].InnerText, true);
                        aPGB.BackColor       = ColorTranslator.FromHtml(legendNode.Attributes["BackColor"].InnerText);
                        //aPGB.TransparencyPercent = int.Parse(legendNode.Attributes["TransparencyPercent"].InnerText);
                        aPGB.IsMaskout = bool.Parse(legendNode.Attributes["IsMaskout"].InnerText);
                    }
                    catch { }
                    {
                        legend = aPGB;
                    }
                    break;
                }
            }
            catch { }
            return(legend);
        }
Ejemplo n.º 7
0
        private void AddLegend(ref XmlDocument doc, XmlElement parent, ColorBreak aLegend, ShapeTypes shapeType)
        {
            XmlElement   legend = doc.CreateElement("Legend");
            XmlAttribute color  = doc.CreateAttribute("Color");

            color.InnerText = ColorTranslator.ToHtml(aLegend.Color);
            legend.Attributes.Append(color);

            XmlAttribute legendType = doc.CreateAttribute("LegendType");
            XmlAttribute size;
            XmlAttribute style;
            XmlAttribute outlineColor;
            XmlAttribute drawOutline;
            XmlAttribute drawFill;

            legendType.InnerText = aLegend.BreakType.ToString();
            switch (aLegend.BreakType)
            {
            case BreakTypes.PointBreak:
                PointBreak aPB = (PointBreak)aLegend;
                outlineColor = doc.CreateAttribute("OutlineColor");
                size         = doc.CreateAttribute("Size");
                style        = doc.CreateAttribute("Style");
                drawOutline  = doc.CreateAttribute("DrawOutline");
                drawFill     = doc.CreateAttribute("DrawFill");
                XmlAttribute markerType = doc.CreateAttribute("MarkerType");
                XmlAttribute fontName   = doc.CreateAttribute("FontName");
                XmlAttribute charIndex  = doc.CreateAttribute("CharIndex");
                XmlAttribute imagePath  = doc.CreateAttribute("ImagePath");
                XmlAttribute angle      = doc.CreateAttribute("Angle");

                //legendType.InnerText = "PointBreak";
                outlineColor.InnerText = ColorTranslator.ToHtml(aPB.OutlineColor);
                size.InnerText         = aPB.Size.ToString();
                style.InnerText        = Enum.GetName(typeof(PointStyle), aPB.Style);
                drawOutline.InnerText  = aPB.DrawOutline.ToString();
                drawFill.InnerText     = aPB.DrawFill.ToString();
                markerType.InnerText   = aPB.MarkerType.ToString();
                fontName.InnerText     = aPB.FontName;
                charIndex.InnerText    = aPB.CharIndex.ToString();
                imagePath.InnerText    = aPB.ImagePath;
                angle.InnerText        = aPB.Angle.ToString();

                legend.Attributes.Append(legendType);
                legend.Attributes.Append(outlineColor);
                legend.Attributes.Append(size);
                legend.Attributes.Append(style);
                legend.Attributes.Append(drawOutline);
                legend.Attributes.Append(drawFill);
                legend.Attributes.Append(markerType);
                legend.Attributes.Append(fontName);
                legend.Attributes.Append(charIndex);
                legend.Attributes.Append(imagePath);
                legend.Attributes.Append(angle);
                break;

            case BreakTypes.LabelBreak:
                LabelBreak   aLB  = (LabelBreak)aLegend;
                XmlAttribute text = doc.CreateAttribute("Text");
                angle    = doc.CreateAttribute("Angle");
                fontName = doc.CreateAttribute("FontName");
                XmlAttribute fontSize = doc.CreateAttribute("FontSize");
                XmlAttribute fontBold = doc.CreateAttribute("FontBold");
                XmlAttribute yShift   = doc.CreateAttribute("YShift");

                //legendType.InnerText = "LabelBreak";
                text.InnerText     = aLB.Text;
                angle.InnerText    = aLB.Angle.ToString();
                fontName.InnerText = aLB.Font.Name;
                fontSize.InnerText = aLB.Font.Size.ToString();
                fontBold.InnerText = aLB.Font.Bold.ToString();
                yShift.InnerText   = aLB.YShift.ToString();

                legend.Attributes.Append(legendType);
                legend.Attributes.Append(text);
                legend.Attributes.Append(angle);
                legend.Attributes.Append(fontName);
                legend.Attributes.Append(fontSize);
                legend.Attributes.Append(fontBold);
                legend.Attributes.Append(yShift);
                break;

            case BreakTypes.ChartBreak:
                ChartBreak   aChB       = (ChartBreak)aLegend;
                XmlAttribute shapeIndex = doc.CreateAttribute("ShapeIndex");
                XmlAttribute chartType  = doc.CreateAttribute("ChartType");
                XmlAttribute chartData  = doc.CreateAttribute("ChartData");
                XmlAttribute xShift     = doc.CreateAttribute("XShift");
                yShift = doc.CreateAttribute("YShift");

                shapeIndex.InnerText = aChB.ShapeIndex.ToString();
                //legendType.InnerText = "ChartBreak";
                chartType.InnerText = aChB.ChartType.ToString();
                string cdata = "";
                for (int i = 0; i < aChB.ItemNum; i++)
                {
                    if (i == 0)
                    {
                        cdata = aChB.ChartData[i].ToString();
                    }
                    else
                    {
                        cdata += "," + aChB.ChartData[i].ToString();
                    }
                }
                chartData.InnerText = cdata;
                xShift.InnerText    = aChB.XShift.ToString();
                yShift.InnerText    = aChB.YShift.ToString();

                legend.Attributes.Append(legendType);
                legend.Attributes.Append(shapeIndex);
                legend.Attributes.Append(chartType);
                legend.Attributes.Append(chartData);
                legend.Attributes.Append(xShift);
                legend.Attributes.Append(yShift);
                break;

            case BreakTypes.VectorBreak:
                //legendType.InnerText = "VectorBreak";
                legend.Attributes.Append(legendType);
                break;

            case BreakTypes.PolylineBreak:
                PolyLineBreak aPLB = (PolyLineBreak)aLegend;
                size  = doc.CreateAttribute("Size");
                style = doc.CreateAttribute("Style");
                XmlAttribute drawSymbol     = doc.CreateAttribute("DrawSymbol");
                XmlAttribute symbolSize     = doc.CreateAttribute("SymbolSize");
                XmlAttribute symbolStyle    = doc.CreateAttribute("SymbolStyle");
                XmlAttribute symbolColor    = doc.CreateAttribute("SymbolColor");
                XmlAttribute symbolInterval = doc.CreateAttribute("SymbolInterval");

                //legendType.InnerText = "PolylineBreak";
                size.InnerText           = aPLB.Size.ToString();
                style.InnerText          = Enum.GetName(typeof(LineStyles), aPLB.Style);
                drawSymbol.InnerText     = aPLB.DrawSymbol.ToString();
                symbolSize.InnerText     = aPLB.SymbolSize.ToString();
                symbolStyle.InnerText    = aPLB.SymbolStyle.ToString();
                symbolColor.InnerText    = ColorTranslator.ToHtml(aPLB.SymbolColor);
                symbolInterval.InnerText = aPLB.SymbolInterval.ToString();

                legend.Attributes.Append(legendType);
                legend.Attributes.Append(size);
                legend.Attributes.Append(style);
                legend.Attributes.Append(drawSymbol);
                legend.Attributes.Append(symbolSize);
                legend.Attributes.Append(symbolStyle);
                legend.Attributes.Append(symbolColor);
                legend.Attributes.Append(symbolInterval);
                break;

            case BreakTypes.PolygonBreak:
                PolygonBreak aPGB = (PolygonBreak)aLegend;
                outlineColor = doc.CreateAttribute("OutlineColor");
                drawOutline  = doc.CreateAttribute("DrawOutline");
                drawFill     = doc.CreateAttribute("DrawFill");
                XmlAttribute outlineSize     = doc.CreateAttribute("OutlineSize");
                XmlAttribute usingHatchStyle = doc.CreateAttribute("UsingHatchStyle");
                style = doc.CreateAttribute("Style");
                XmlAttribute backColor = doc.CreateAttribute("BackColor");
                //XmlAttribute transparencyPer = doc.CreateAttribute("TransparencyPercent");
                XmlAttribute isMaskout = doc.CreateAttribute("IsMaskout");

                //legendType.InnerText = "PolygonBreak";
                outlineColor.InnerText    = ColorTranslator.ToHtml(aPGB.OutlineColor);
                drawOutline.InnerText     = aPGB.DrawOutline.ToString();
                drawFill.InnerText        = aPGB.DrawFill.ToString();
                outlineSize.InnerText     = aPGB.OutlineSize.ToString();
                usingHatchStyle.InnerText = aPGB.UsingHatchStyle.ToString();
                style.InnerText           = aPGB.Style.ToString();
                backColor.InnerText       = ColorTranslator.ToHtml(aPGB.BackColor);
                //transparencyPer.InnerText = aPGB.TransparencyPercent.ToString();
                isMaskout.InnerText = aPGB.IsMaskout.ToString();

                legend.Attributes.Append(legendType);
                legend.Attributes.Append(outlineColor);
                legend.Attributes.Append(drawOutline);
                legend.Attributes.Append(drawFill);
                legend.Attributes.Append(outlineSize);
                legend.Attributes.Append(usingHatchStyle);
                legend.Attributes.Append(style);
                legend.Attributes.Append(backColor);
                //legend.Attributes.Append(transparencyPer);
                legend.Attributes.Append(isMaskout);
                break;
            }

            parent.AppendChild(legend);
        }