AcDbArrayGripAppData.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. //
  12. // DESCRIPTION:
  13. //
  14. // AcDbArrayGripAppData class.
  15. //
  16. //////////////////////////////////////////////////////////////////////////////
  17. #pragma once
  18. #include "AcDbAssocArrayItem.h"
  19. /// <summary>
  20. /// AcDbArrayGripAppData, represents grip specific data for associative array.
  21. /// Object of this class will be attached with AcDbGripData as appdata by
  22. /// AcDbAssocArrayActionBody and it's derived classes.
  23. /// </summary>
  24. /// <remarks> This class is currently for internal use only. </remarks>
  25. ///
  26. class ACDB_PORT AcDbArrayGripAppData : public AcRxObject
  27. {
  28. public:
  29. ACRX_DECLARE_MEMBERS(AcDbArrayGripAppData);
  30. /// <summary>
  31. /// Default constructor. Can be initialized using position and mode.
  32. /// </summary>
  33. /// <param name="position"> The input position of the grip. </param>
  34. /// <param name="modes"> The input grip modes. </param>
  35. ///
  36. AcDbArrayGripAppData(const AcGePoint3d& position = AcGePoint3d(),
  37. unsigned int modes = 0);
  38. /// <summary>
  39. /// Default destructor.
  40. /// </summary>
  41. ///
  42. virtual ~AcDbArrayGripAppData();
  43. /// <summary>
  44. /// Returns position of the grip.
  45. /// </summary>
  46. /// <returns> The position of the grip.
  47. /// </returns>
  48. ///
  49. const AcGePoint3d& position() const { return mPosition; }
  50. /// <summary>
  51. /// Returns modes of the grip.
  52. /// </summary>
  53. /// <returns> The modes of the grip.
  54. /// </returns>
  55. ///
  56. unsigned int modes() const { return mnModes; }
  57. /// <summary>
  58. /// Adds additional grip mode.
  59. /// </summary>
  60. /// <param name="mode"> The input grip mode. </param>
  61. ///
  62. void addGripMode(unsigned int mode) { mnModes |= mode; }
  63. /// <summary>
  64. /// Returns app data and it's class attached with this grip.
  65. /// </summary>
  66. /// <param name="ppClass"> The input AcRxClass attached to this grip. </param>
  67. /// <returns> Pointer to app data.
  68. /// </returns>
  69. ///
  70. void* getAppData(AcRxClass** ppClass = NULL) const
  71. {
  72. if(NULL != ppClass)
  73. *ppClass = mpAppDataClass;
  74. return mpAppData;
  75. }
  76. /// <summary>
  77. /// Attaches app data and its class to the grip.
  78. /// </summary>
  79. /// <param name="pData"> The input app data. </param>
  80. /// <param name="pClass"> The input AcRxClass attached to this grip. </param>
  81. ///
  82. void setAppData(void* pData, AcRxClass* pClass)
  83. {
  84. mpAppData = pData; mpAppDataClass = pClass;
  85. }
  86. /// <summary>
  87. /// Checks if it represents an arrow grip.
  88. /// </summary>
  89. /// <returns> The boolean value indicating whether the grip is of arrow shape.
  90. /// </returns>
  91. ///
  92. bool& arrowGrip() { return mbArrowGrip; }
  93. /// <summary>
  94. /// Returns x direction of the arrow grip.
  95. /// </summary>
  96. /// <returns> The x direction of the arrow grip.
  97. /// </returns>
  98. ///
  99. AcGeVector3d& xDir() { return mDirections[0]; }
  100. /// <summary>
  101. /// Returns y direction of the arrow grip.
  102. /// </summary>
  103. /// <returns> The y direction of the arrow grip.
  104. /// </returns>
  105. ///
  106. AcGeVector3d& yDir() { return mDirections[1]; }
  107. /// <summary>
  108. /// Returns locator index for the grip.
  109. /// </summary>
  110. /// <returns> The locator index for the grip.
  111. /// </returns>
  112. ///
  113. AcDbItemLocator& locator() { return mLocator; }
  114. /// <summary>
  115. /// Returns the dynamic dimension data array.
  116. /// </summary>
  117. /// <returns> The dynamic dimension data array.
  118. /// </returns>
  119. ///
  120. const AcDbDimDataPtrArray& dimData() const { return mDimData; }
  121. /// <summary>
  122. /// Adds the dynamic dimension data.
  123. /// </summary>
  124. /// <param name="pData"> The input dynamic dimension data. </param>
  125. ///
  126. void appendDimData(AcDbDimData* pData);
  127. /// <summary>
  128. /// deletes all AcDimAppData in AcDbDimData of the dynamic dimension data array..
  129. /// </summary>
  130. ///
  131. void deleteDimData();
  132. /// <summary>
  133. /// cache a base point for AcDbGripData if the rubber band is to be displayed from some other starting point.
  134. /// </summary>
  135. /// <param name="basePoint"> The input base point for AcDbGripData. </param>
  136. ///
  137. void setBasePoint(AcGePoint3d &basePoint);
  138. /// <summary>
  139. /// return the base point being cached. If NULL, then no need to set this base point for AcDbGripData.
  140. /// </summary>
  141. /// <returns> The base point being cached.
  142. /// </returns>
  143. ///
  144. const AcGePoint3d* basePoint() const {return mpBasePoint;}
  145. private:
  146. AcGePoint3d mPosition;
  147. unsigned int mnModes;
  148. void* mpAppData;
  149. AcRxClass* mpAppDataClass;
  150. AcDbItemLocator mLocator;
  151. bool mbArrowGrip;
  152. AcGeVector3d mDirections[2];
  153. AcDbDimDataPtrArray mDimData;
  154. AcGePoint3d *mpBasePoint;
  155. };