EntityBase.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using FastReport.Export.Dxf.Groups;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace FastReport.Export.Dxf.Sections.Entities
  5. {
  6. public class EntityBase : GroupsStore
  7. {
  8. #region Private Fields
  9. //List<GroupBase> groups;
  10. private List<LineStyle> styles;
  11. #endregion Private Fields
  12. #region Public Properties
  13. public List<LineStyle> Styles
  14. {
  15. get { return styles; }
  16. }
  17. #endregion Public Properties
  18. //public List<GroupBase> Groups
  19. //{
  20. // get { return groups; }
  21. // set { groups = value; }
  22. //}
  23. #region Public Constructors
  24. public EntityBase()
  25. {
  26. styles = new List<LineStyle>();
  27. //Groups = new List<GroupBase>();
  28. }
  29. #endregion Public Constructors
  30. #region Public Methods
  31. public void AddLineStyle(LineStyle lineStyle)
  32. {
  33. // Linetype name
  34. Groups.Add(GroupUtils.CreateGroup(6, lineStyle.ToString()));
  35. // Add line type to table LTYPE
  36. bool shouldAdd = true;
  37. foreach (LineStyle s in styles)
  38. {
  39. if (s == lineStyle)
  40. shouldAdd = false;
  41. }
  42. if (shouldAdd)
  43. styles.Add(lineStyle);
  44. }
  45. public void AppendTo(StringBuilder s)
  46. {
  47. int i = 0;
  48. foreach (GroupBase g in Groups)
  49. {
  50. i++;
  51. g.AppendTo(s);
  52. if (i < Groups.Count)
  53. s.Append("\n");
  54. }
  55. }
  56. #endregion Public Methods
  57. }
  58. }