SectionEntities.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using FastReport.Export.Dxf.Sections.Entities;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Text;
  5. namespace FastReport.Export.Dxf.Sections
  6. {
  7. public class SectionEntities : Section
  8. {
  9. #region Private Fields
  10. private List<EntityBase> entities;
  11. #endregion Private Fields
  12. #region Public Properties
  13. public List<EntityBase> Entities
  14. {
  15. get { return entities; }
  16. set { entities = value; }
  17. }
  18. #endregion Public Properties
  19. #region Public Constructors
  20. public SectionEntities() : base("ENTITIES")
  21. {
  22. Entities = new List<EntityBase>();
  23. }
  24. #endregion Public Constructors
  25. #region Public Methods
  26. public List<LineStyle> AddLine(float x1, float y1, float x2, float y2, Color strokeColor, float strokeThickness, LineStyle lineStyle)
  27. {
  28. Line line = new Line(x1, y1, x2, y2, strokeColor, strokeThickness, lineStyle);
  29. Entities.Add(line);
  30. return line.Styles;
  31. }
  32. public override void AppendTo(StringBuilder s)
  33. {
  34. StartSectionAppendTo(s);
  35. s.Append("\n");
  36. foreach (EntityBase e in Entities)
  37. {
  38. e.AppendTo(s);
  39. s.Append("\n");
  40. }
  41. EndSectionAppendTo(s);
  42. }
  43. #endregion Public Methods
  44. #region Internal Methods
  45. internal List<LineStyle> AddEllipse(float x, float y, float width, float height, Color ellipseColor, float ellipseWidth, LineStyle ellipseStyle)
  46. {
  47. Ellipse ellipse = new Ellipse(x, y, width, height, ellipseColor, ellipseWidth, ellipseStyle);
  48. Entities.Add(ellipse);
  49. return ellipse.Styles;
  50. }
  51. internal void AddHatch(float x, float y, PointF[] points, byte[] pointTypes, Color color)
  52. {
  53. Hatch hatch = new Hatch(x, y, points, pointTypes, color);
  54. Entities.Add(hatch);
  55. }
  56. internal List<LineStyle> AddPolyLine(float x, float y, PointF[] points, byte[] pointTypes, Color polyLineColor,
  57. float polyLineWidth, LineStyle polyLineStyle, bool isClosedPolyline)
  58. {
  59. LwPolyLine polyLine = new LwPolyLine(x, y, points, pointTypes, polyLineColor, polyLineWidth, polyLineStyle, isClosedPolyline);
  60. Entities.Add(polyLine);
  61. return polyLine.Styles;
  62. }
  63. internal void AddSolid(float x, float y, float width, float height, Color color)
  64. {
  65. Solid ellipse = new Solid(x, y, width, height, color);
  66. Entities.Add(ellipse);
  67. }
  68. #endregion Internal Methods
  69. }
  70. }