Section.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using FastReport.Export.Dxf.Groups;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace FastReport.Export.Dxf.Sections
  5. {
  6. public class Section
  7. {
  8. #region Private Fields
  9. private List<GroupBase> endSection;
  10. private string name;
  11. private List<GroupBase> startSection;
  12. #endregion Private Fields
  13. #region Public Properties
  14. public string Name
  15. {
  16. get { return name; }
  17. set { name = value; }
  18. }
  19. #endregion Public Properties
  20. #region Public Constructors
  21. public Section(string name)
  22. {
  23. Name = name;
  24. StartSection();
  25. EndSection();
  26. }
  27. #endregion Public Constructors
  28. #region Public Methods
  29. public virtual void AppendTo(StringBuilder s)
  30. {
  31. StartSectionAppendTo(s);
  32. s.Append("\n");
  33. EndSectionAppendTo(s);
  34. }
  35. public void Clear()
  36. {
  37. name = string.Empty;
  38. }
  39. public void EndSectionAppendTo(StringBuilder s)
  40. {
  41. GroupUtils.GroupsAppendTo(endSection, s);
  42. }
  43. public void StartSectionAppendTo(StringBuilder s)
  44. {
  45. GroupUtils.GroupsAppendTo(startSection, s);
  46. }
  47. #endregion Public Methods
  48. #region Private Methods
  49. private void EndSection()
  50. {
  51. endSection = new List<GroupBase>();
  52. endSection.Add(GroupUtils.CreateTypeName("ENDSEC"));
  53. }
  54. private void StartSection()
  55. {
  56. startSection = new List<GroupBase>();
  57. startSection.Add(GroupUtils.CreateTypeName("SECTION"));
  58. startSection.Add(GroupUtils.CreateName(name));
  59. }
  60. #endregion Private Methods
  61. }
  62. }