Line.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using FastReport.Export.Dxf.Utils;
  2. using System.Drawing;
  3. namespace FastReport.Export.Dxf.Sections.Entities
  4. {
  5. public class Line : EntityBase
  6. {
  7. #region Private Fields
  8. private LineStyle lineStyle;
  9. private Color strokeColor;
  10. private float strokeThickness;
  11. private float x1;
  12. private float x2;
  13. private float y1;
  14. private float y2;
  15. #endregion Private Fields
  16. #region Public Constructors
  17. public Line(float x1, float y1, float x2, float y2, Color strokeColor, float strokeThickness, LineStyle lineStyle)
  18. : base()
  19. {
  20. this.x1 = x1;
  21. this.y1 = y1;
  22. this.x2 = x2;
  23. this.y2 = y2;
  24. this.strokeColor = strokeColor;
  25. this.strokeThickness = strokeThickness;
  26. this.lineStyle = lineStyle;
  27. InitGroups();
  28. }
  29. #endregion Public Constructors
  30. #region Private Methods
  31. private void InitGroups()
  32. {
  33. AddTypeName("LINE");
  34. AddGroup(8, "Layer_1");
  35. AddPrimary2DPoint(x1, y1);
  36. AddSecondPoint(x2, y2);
  37. byte aciColor = ACIDictionary.GetAciColor(strokeColor);
  38. AddColor(aciColor);
  39. AddEntityThickness(strokeThickness);
  40. if (lineStyle != LineStyle.Solid)
  41. AddLineStyle(lineStyle);
  42. }
  43. #endregion Private Methods
  44. }
  45. }