public override DW.WrapPolygon ToWrapPolygon() { DW.WrapPolygon polygon = new DW.WrapPolygon(); if (Edited != null) { polygon.Edited = Edited; } polygon.StartPoint = new DW.StartPoint { X = StartPoint.X, Y = StartPoint.Y }; long horizontalSize; long verticalSize; if (HorizontalSize == 0) { if (VerticalSize == 0) { throw new PBException("horizontal size and vertical size can't both be 0"); } horizontalSize = VerticalSize; verticalSize = VerticalSize; } else if (VerticalSize == 0) { horizontalSize = HorizontalSize; verticalSize = HorizontalSize; } else { horizontalSize = HorizontalSize; verticalSize = VerticalSize; } long x = StartPoint.X; long y = StartPoint.Y; // Wrapping Polygon Line End Position, <wp:lineTo x="0" y="0"/> y += verticalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); x += horizontalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); y -= verticalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); x -= horizontalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); return(polygon); }
public override DW.WrapPolygon ToWrapPolygon() { DW.WrapPolygon polygon = new DW.WrapPolygon(); if (Edited != null) { polygon.Edited = Edited; } long startPointX = 0; long startPointY = 0; if (StartPoint != null) { startPointX = StartPoint.X; startPointY = StartPoint.Y; } polygon.StartPoint = new DW.StartPoint { X = startPointX, Y = startPointY }; if (LinesTo.Length < 2) { throw new PBException("polygon must have at least 2 lines"); } polygon.Append(LinesTo.Select(lineTo => new ODW.LineTo() { X = lineTo.X, Y = lineTo.Y })); OXmlPoint2DType lastPoint = LinesTo[LinesTo.Length - 1]; if (lastPoint.X != startPointX || lastPoint.Y != startPointY) { polygon.AppendChild(new ODW.LineTo() { X = startPointX, Y = startPointY }); } return(polygon); }
public override DW.WrapPolygon ToWrapPolygon() { DW.WrapPolygon polygon = new DW.WrapPolygon(); if (Edited != null) polygon.Edited = Edited; polygon.StartPoint = new DW.StartPoint { X = StartPoint.X, Y = StartPoint.Y }; long horizontalSize; long verticalSize; if (HorizontalSize == 0) { if (VerticalSize == 0) throw new PBException("horizontal size and vertical size can't both be 0"); horizontalSize = VerticalSize; verticalSize = VerticalSize; } else if (VerticalSize == 0) { horizontalSize = HorizontalSize; verticalSize = HorizontalSize; } else { horizontalSize = HorizontalSize; verticalSize = VerticalSize; } long x = StartPoint.X; long y = StartPoint.Y; // Wrapping Polygon Line End Position, <wp:lineTo x="0" y="0"/> y += verticalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); x += horizontalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); y -= verticalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); x -= horizontalSize; polygon.AppendChild(new ODW.LineTo() { X = x, Y = y }); return polygon; }
public override DW.WrapPolygon ToWrapPolygon() { DW.WrapPolygon polygon = new DW.WrapPolygon(); if (Edited != null) polygon.Edited = Edited; long startPointX = 0; long startPointY = 0; if (StartPoint != null) { startPointX = StartPoint.X; startPointY = StartPoint.Y; } polygon.StartPoint = new DW.StartPoint { X = startPointX, Y = startPointY }; if (LinesTo.Length < 2) throw new PBException("polygon must have at least 2 lines"); polygon.Append(LinesTo.Select(lineTo => new ODW.LineTo() { X = lineTo.X, Y = lineTo.Y })); OXmlPoint2DType lastPoint = LinesTo[LinesTo.Length - 1]; if (lastPoint.X != startPointX || lastPoint.Y != startPointY) polygon.AppendChild(new ODW.LineTo() { X = startPointX, Y = startPointY }); return polygon; }