AcGiStyleAttributes.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // AcGiStyleAttributes interface
  13. #ifndef __AcGiStyleAttributes_H_Defined__
  14. #define __AcGiStyleAttributes_H_Defined__
  15. #include "AcGiLineAttributes.h"
  16. class ADESK_NO_VTABLE AcGiStyleAttributes
  17. {
  18. public:
  19. enum AttributeFlags {
  20. kNothing = 0x00,
  21. kColor = 0x01,
  22. kLine = 0x02,
  23. kLineType = 0x04,
  24. kPlotStyle = 0x08,
  25. kEverything = 0x0F
  26. };
  27. // Ctor/dtor/copy
  28. AcGiStyleAttributes() { }
  29. AcGiStyleAttributes(const AcGiStyleAttributes& source);
  30. virtual ~AcGiStyleAttributes() { }
  31. // Member data access
  32. // Color
  33. AcCmEntityColor& getColorAttribute();
  34. const AcCmEntityColor& getColorAttribute() const;
  35. void setColorAttribute(const AcCmEntityColor& color);
  36. // Complex line type
  37. AcDbObjectId linetypeObjectId() const;
  38. void setLinetypeObjectId(const AcDbObjectId& newId);
  39. // Plot style
  40. AcDbObjectId plotStyleNameId() const;
  41. void setPlotStyleName(const AcDbObjectId& newId);
  42. // Interface methods - Other line attributes
  43. virtual AcGiLineAttributes* getLineAttribute() = 0;
  44. virtual const AcGiLineAttributes* getLineAttribute() const = 0;
  45. virtual void setLineAttribute(const AcGiLineAttributes* pLineAttributes) = 0;
  46. virtual void EnsureColorVisibility (AcCmEntityColor& color) = 0;
  47. protected:
  48. /* The style engine will resolve the color, taking into account color
  49. policy, dither, specified color, assigned pen number, and dimming.
  50. If m_colorAttribute.isByColor() then use
  51. getColorAttribute().color();
  52. if m_colorAttribute.isByPen() then use
  53. getColorAttribute().penIndex()
  54. */
  55. AcCmEntityColor m_colorAttribute;
  56. AcDbObjectId m_idLinetype;
  57. AcDbObjectId m_idPlotstyle;
  58. };
  59. inline
  60. AcGiStyleAttributes::AcGiStyleAttributes(
  61. const AcGiStyleAttributes& source)
  62. {
  63. m_colorAttribute = source.getColorAttribute();
  64. m_idLinetype = source.linetypeObjectId();
  65. m_idPlotstyle = source.plotStyleNameId();
  66. }
  67. inline
  68. AcCmEntityColor&
  69. AcGiStyleAttributes::getColorAttribute()
  70. {
  71. return m_colorAttribute;
  72. }
  73. inline
  74. const AcCmEntityColor&
  75. AcGiStyleAttributes::getColorAttribute() const
  76. {
  77. return m_colorAttribute;
  78. }
  79. inline
  80. void
  81. AcGiStyleAttributes::setColorAttribute (
  82. const AcCmEntityColor& color)
  83. {
  84. m_colorAttribute = color;
  85. }
  86. inline
  87. AcDbObjectId
  88. AcGiStyleAttributes::linetypeObjectId() const
  89. {
  90. return m_idLinetype;
  91. }
  92. inline
  93. void
  94. AcGiStyleAttributes::setLinetypeObjectId(const AcDbObjectId& newId)
  95. {
  96. m_idLinetype = newId;
  97. }
  98. inline
  99. AcDbObjectId
  100. AcGiStyleAttributes::plotStyleNameId() const
  101. {
  102. return m_idPlotstyle;
  103. }
  104. inline
  105. void
  106. AcGiStyleAttributes::setPlotStyleName(const AcDbObjectId& newId)
  107. {
  108. m_idPlotstyle = newId;
  109. }
  110. #endif // #ifndef __AcGiStyleAttributes_H_Defined__