123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using FastReport.Export.Dxf.Utils;
- using System.Drawing;
- namespace FastReport.Export.Dxf.Sections.Entities
- {
- public class LwPolyLine : EntityBase
- {
- #region Private Fields
- private bool isClosedPolyline;
- private PointF[] points;
- private byte[] pointTypes;
- private Color polyLineColor;
- private LineStyle polyLineStyle;
- private float polyLineWidth;
- private float x;
- private float y;
- #endregion Private Fields
- #region Public Constructors
- public LwPolyLine(float x, float y, PointF[] points, byte[] pointTypes, Color polyLineColor, float polyLineWidth,
- LineStyle polyLineStyle, bool isClosedPolyline) : base()
- {
- this.points = points;
- this.pointTypes = pointTypes;
- this.polyLineColor = polyLineColor;
- this.polyLineWidth = polyLineWidth;
- this.polyLineStyle = polyLineStyle;
- this.x = x;
- this.y = y;
- this.isClosedPolyline = isClosedPolyline;
- InitGroups();
- }
- #endregion Public Constructors
- #region Private Methods
- private void AddVertex(PointF point)
- {
- AddPrimary2DPoint(x + point.X, y + point.Y);
- }
- private void InitGroups()
- {
- // 0
- // LWPOLYLINE
- // 8
- // Layer_1
- // 62
- // 7
- // 90
- // 4
- // 70
- // 1
- // 10
- // 42.763123
- // 20
- // 220.497360
- // 30
- // 0.0
- // 10
- // 117.598587
- // 20
- // 220.497360
- // 30
- // 0.0
- // 10
- // 117.598587
- // 20
- // 154.214515
- // 30
- // 0.0
- // 10
- // 42.763123
- // 20
- // 154.214515
- // 30
- // 0.0
- AddTypeName("LWPOLYLINE");
- AddGroup(8, "Layer_1");
- if (polyLineStyle != LineStyle.Solid)
- AddLineStyle(polyLineStyle);
- byte aciColor = ACIDictionary.GetAciColor(polyLineColor);
- AddColor(aciColor);
- AddEntityThickness(polyLineWidth);
- // Number of vertices
- AddGroup(90, points.Length);
- // Polyline flag (bit-coded); default is 0:
- // 1 = Closed; 128 = Plinegen
- if (isClosedPolyline)
- AddGroup(70, 1);
- else
- AddGroup(70, 0);
- //// Default start width (optional; default = 0)
- //AddGroup(40, 0);
- //// Default end width (optional; default = 0)
- //AddGroup(41, 0);
- // add VERTEX-es
- for (int i = 0; i < points.Length; i++)
- {
- PointF point = points[i];
- AddVertex(point);
- }
- }
- #endregion Private Methods
- }
- }
|