/// <summary>
        /// Clone PlygonShape
        /// </summary>
        /// <returns>PolygonShape</returns>
        public override object Clone()
        {
            EllipseShape aPGS = new EllipseShape();

            aPGS.Extent   = Extent;
            aPGS.Points   = new List <PointD>(Points);
            aPGS.Visible  = Visible;
            aPGS.Selected = Selected;

            return(aPGS);
        }
示例#2
0
        private Shape LoadShape(XmlNode shapeNode)
        {
            Shape aShape = new Shape();

            try
            {
                ShapeTypes shapeType = (ShapeTypes)Enum.Parse(typeof(ShapeTypes), shapeNode.Attributes["ShapeType"].InnerText, true);
                switch (shapeType)
                {
                case ShapeTypes.Point:
                    aShape = new PointShape();
                    break;

                case ShapeTypes.WindArraw:
                    aShape = new WindArraw();
                    break;

                case ShapeTypes.Polyline:
                    aShape = new PolylineShape();
                    break;

                case ShapeTypes.CurveLine:
                    aShape = new CurveLineShape();
                    break;

                case ShapeTypes.Circle:
                    aShape = new CircleShape();
                    break;

                case ShapeTypes.Polygon:
                case ShapeTypes.Rectangle:
                    aShape = new PolygonShape();
                    break;

                case ShapeTypes.CurvePolygon:
                    aShape = new CurvePolygonShape();
                    break;

                case ShapeTypes.Ellipse:
                    aShape = new EllipseShape();
                    break;
                }

                aShape.Visible  = bool.Parse(shapeNode.Attributes["Visible"].InnerText);
                aShape.Selected = bool.Parse(shapeNode.Attributes["Selected"].InnerText);

                List <PointD> pointList  = new List <PointD>();
                XmlNode       pointsNode = shapeNode.ChildNodes[0];
                foreach (XmlNode pNode in pointsNode.ChildNodes)
                {
                    PointD aPoint = new PointD(double.Parse(pNode.Attributes["X"].InnerText),
                                               double.Parse(pNode.Attributes["Y"].InnerText));
                    pointList.Add(aPoint);
                }
                aShape.SetPoints(pointList);
            }
            catch
            {
            }

            return(aShape);
        }