AcDbAssocArrayPolarParameters.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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. // CREATED BY: Mei Jiayin March 2010
  12. //
  13. // DESCRIPTION:
  14. //
  15. //////////////////////////////////////////////////////////////////////////////
  16. #pragma once
  17. #include "AcDbAssocArrayCommonParameters.h"
  18. class AcDbImpAssocArrayPolarParameters;
  19. /// <summary>
  20. /// AcDbAssocArrayPolarParameters class provides interface to manipulate
  21. /// polar array parameters.
  22. /// </summary>
  23. ///
  24. class ACDB_PORT AcDbAssocArrayPolarParameters : public AcDbAssocArrayCommonParameters
  25. {
  26. public:
  27. ACRX_DECLARE_MEMBERS(AcDbAssocArrayPolarParameters);
  28. /// <summary> Constructor.</summary>
  29. /// <param name="angle"> The input angle formed by any two adjacent items and
  30. /// the center of polar array. The value should be between 0-360 degrees. </param>
  31. /// <param name="rowSpacing"> The input spacing between adjacent rows. </param>
  32. /// <param name="levelSpacing"> The input spacing between adjacent levels. </param>
  33. /// <param name="itemCount"> The input number of items. </param>
  34. /// <param name="rowCount"> The input number of rows. </param>
  35. /// <param name="levelCount"> The input number of levels. </param>
  36. /// <param name="rowElevation"> The input elevation between adjacent rows. </param>
  37. ///
  38. AcDbAssocArrayPolarParameters(double angle = 15, double rowSpacing = 1,
  39. double levelSpacing = 1, int itemCount = 1, int rowCount = 1,
  40. int levelCount = 1, double rowElevation = 1);
  41. /// <summary> Default destructor.</summary>
  42. ///
  43. virtual ~AcDbAssocArrayPolarParameters(void);
  44. /// <summary>
  45. /// Following list of enums can be used as input to method
  46. /// getGripPointAt(unsigned int, AcDbArrayGripAppData* &) to get specific
  47. /// type of grip. System internally uses these enums for grip operations on
  48. /// path array.
  49. /// </summary>
  50. ///
  51. enum GripModes
  52. {
  53. /// <summary>
  54. /// Moves the polar array.
  55. /// </summary>
  56. ///
  57. kCenterPointGrip = 1 << 0,
  58. /// <summary>
  59. /// Changes radius of the polar array.
  60. /// </summary>
  61. ///
  62. kStretchRadiusGrip = 1 << 1,
  63. /// <summary>
  64. /// Changes number of rows.
  65. /// </summary>
  66. ///
  67. kRowCountGrip = 1 << 2,
  68. /// <summary>
  69. /// Changes distance between rows.
  70. /// </summary>
  71. ///
  72. kRowSpacingGrip = 1 << 3,
  73. /// <summary>
  74. /// Changes distance between rows by distributing the move uniformly
  75. /// across all the rows.
  76. /// </summary>
  77. ///
  78. kUniformRowSpacingGrip = 1 << 4,
  79. /// <summary>
  80. /// Changes number of levels.
  81. /// </summary>
  82. ///
  83. kLevelCountGrip = 1 << 5,
  84. /// <summary>
  85. /// Changes distance between levels.
  86. /// </summary>
  87. ///
  88. kLevelSpacingGrip = 1 << 6,
  89. /// <summary>
  90. /// Changes distance between levels by distributing the move uniformly
  91. /// across all the levels.
  92. /// </summary>
  93. ///
  94. kUniformLevelSpacingGrip = 1 << 7,
  95. /// <summary>
  96. /// Changes number of items.
  97. /// </summary>
  98. ///
  99. kItemCountGrip = 1 << 8,
  100. /// <summary>
  101. /// Changes angle between items.
  102. /// </summary>
  103. ///
  104. kAngleBetweenItemsGrip = 1 << 9,
  105. /// <summary>
  106. /// Changes the fill angle of Polar array.
  107. /// </summary>
  108. ///
  109. kFillAngleGrip = 1 << 10,
  110. };
  111. /// <summary>
  112. /// Specifies the direction of the arc which array items depend on.
  113. /// </summary>
  114. ///
  115. enum Direction
  116. {
  117. kClockwise,
  118. kCounterClockwise,
  119. };
  120. /// <summary>
  121. /// Gets the item count of the polar array.
  122. /// If there is no expression for a particular param,
  123. /// expression string and the evaluatorId are empty strings.
  124. /// </summary>
  125. /// <param name="expression"> The returned expression. </param>
  126. /// <param name="evaluatorId"> The returned evaluatorId. </param>
  127. /// <returns> Returns item count. </returns>
  128. ///
  129. int itemCount(AcString& expression, AcString& evaluatorId) const;
  130. inline int itemCount() const
  131. {
  132. AcString expression, evaluatorId;
  133. return itemCount(expression, evaluatorId);
  134. }
  135. inline int itemCount(AcString& expression) const
  136. {
  137. AcString evaluatorId;
  138. return itemCount(expression, evaluatorId);
  139. }
  140. /// <summary>
  141. /// Gets the angle between items of the polar array.
  142. /// The value is between (0-360] degrees.
  143. /// If there is no expression for a particular param,
  144. /// expression string and the evaluatorId are empty strings.
  145. /// </summary>
  146. /// <param name="expression"> The returned expression. </param>
  147. /// <param name="evaluatorId"> The returned evaluatorId. </param>
  148. /// <returns> Returns angle between items. </returns>
  149. ///
  150. double angleBetweenItems(AcString& expression , AcString& evaluatorId) const;
  151. inline double angleBetweenItems() const
  152. {
  153. AcString expression, evaluatorId;
  154. return angleBetweenItems(expression, evaluatorId);
  155. }
  156. inline double angleBetweenItems(AcString& expression) const
  157. {
  158. AcString evaluatorId;
  159. return angleBetweenItems(expression, evaluatorId);
  160. }
  161. /// <summary>
  162. /// Gets angle between first and last item in array.
  163. /// The value is between (0-360] degrees.
  164. /// If there is no expression for a particular param,
  165. /// expression string and the evaluatorId are empty strings.
  166. /// </summary>
  167. /// <param name="expression"> The returned expression. </param>
  168. /// <param name="evaluatorId"> The returned evaluatorId. </param>
  169. /// <returns> Returns angle between first and last item. </returns>
  170. ///
  171. double fillAngle(AcString& expression, AcString& evaluatorId) const;
  172. inline double fillAngle() const
  173. {
  174. AcString expression, evaluatorId;
  175. return fillAngle(expression, evaluatorId);
  176. }
  177. inline double fillAngle(AcString& expression) const
  178. {
  179. AcString evaluatorId;
  180. return fillAngle(expression, evaluatorId);
  181. }
  182. /// <summary>
  183. /// Gets the angle for the first item in array.
  184. /// The value should be between 0-360 degrees.
  185. /// If there is no expression for a particular param,
  186. /// expression string and the evaluatorId are empty strings.
  187. /// </summary>
  188. /// <param name="expression"> The returned expression. </param>
  189. /// <param name="evaluatorId"> The returned evaluatorId. </param>
  190. /// <returns> Returns angle between first and last item. </returns>
  191. ///
  192. double startAngle(AcString& expression, AcString& evaluatorId) const;
  193. /// <summary>
  194. /// Gets the direction of arc.
  195. /// </summary>
  196. /// <returns> Returns the direction of arc. </returns>
  197. ///
  198. Direction direction() const;
  199. /// <summary>
  200. /// Gets the retate rotate items option.
  201. /// </summary>
  202. /// <returns> Returns whether to rotate items. </returns>
  203. ///
  204. bool rotateItems() const;
  205. /// <summary>
  206. /// Gets the radius of the polar array.
  207. /// If there is no expression for a particular param,
  208. /// expression string and the evaluatorId are empty strings.
  209. /// </summary>
  210. /// <param name="expression"> The returned expression. </param>
  211. /// <param name="evaluatorId"> The returned evaluatorId. </param>
  212. /// <returns> Returns the radius. </returns>
  213. ///
  214. double radius(AcString& expression, AcString& evaluatorId) const;
  215. inline double radius() const
  216. {
  217. AcString expression, evaluatorId;
  218. return radius(expression, evaluatorId);
  219. }
  220. inline double radius(AcString& expression) const
  221. {
  222. AcString evaluatorId;
  223. return radius(expression, evaluatorId);
  224. }
  225. /// <summary>
  226. /// Sets the item count of the polar array.
  227. /// If there is no expression for the parameter, the expression string and
  228. /// the evaluatorId must be empty strings.
  229. /// </summary>
  230. /// <param name="nItems"> The item count to set. </param>
  231. /// <param name="expression"> The expression to set. </param>
  232. /// <param name="evaluatorId"> The evaluatorId to set. </param>
  233. /// <param name="errorMessage"> The returned error message for the individual expression. </param>
  234. /// <returns> Acad::ErrorStatus. </returns>
  235. ///
  236. Acad::ErrorStatus setItemCount(int nItems, const AcString& expression = AcString(),
  237. const AcString& evaluatorId = AcString(), AcString& errorMessage = dummyString());
  238. /// <summary>
  239. /// Sets the angle between items of the polar array.
  240. /// The input value will be rounded off to (0-360] degree
  241. /// If there is no expression for the parameter, the expression string and
  242. /// the evaluatorId must be empty strings.
  243. /// </summary>
  244. /// <param name="angle"> The angle to set. This must be a positive value</param>
  245. /// <param name="expression"> The expression to set. </param>
  246. /// <param name="evaluatorId"> The evaluatorId to set. </param>
  247. /// <param name="errorMessage"> The returned error message for the individual expression. </param>
  248. /// <returns> Acad::ErrorStatus. </returns>
  249. ///
  250. Acad::ErrorStatus setAngleBetweenItems(double angle, const AcString& expression = AcString(),
  251. const AcString& evaluatorId = AcString(), AcString& errorMessage = dummyString());
  252. /// <summary>
  253. /// Sets angle between first and last item in array.
  254. /// The value will be rounded off to (0-360] degree
  255. /// If there is no expression for the parameter, the expression string and
  256. /// the evaluatorId must be empty strings.
  257. /// </summary>
  258. /// <param name="fillAngle"> The angle to set. Absolute value of this parameter is used. </param>
  259. /// <param name="expression"> The expression to set. </param>
  260. /// <param name="evaluatorId"> The evaluatorId to set. </param>
  261. /// <param name="errorMessage"> The returned error message for the individual expression. </param>
  262. /// <returns> Acad::ErrorStatus. </returns>
  263. ///
  264. Acad::ErrorStatus setFillAngle(double fillAngle, const AcString& expression = AcString(),
  265. const AcString& evaluatorId = AcString(), AcString& errorMessage = dummyString());
  266. /// <summary>
  267. /// Sets the angle for the first item in polar array.
  268. /// The value will be rounded off to [0-360] degree
  269. /// If there is no expression for the parameter, the expression string and
  270. /// the evaluatorId must be empty strings.
  271. /// </summary>
  272. /// <param name="angle"> The angle to set. </param>
  273. /// <param name="expression"> The expression to set. </param>
  274. /// <param name="evaluatorId"> The evaluatorId to set. </param>
  275. /// <param name="errorMessage"> The returned error message for the individual expression. </param>
  276. /// <returns> Acad::ErrorStatus. </returns>
  277. ///
  278. Acad::ErrorStatus setStartAngle(double angle, const AcString& expression = AcString(),
  279. const AcString& evaluatorId = AcString(), AcString& errorMessage = dummyString());
  280. /// <summary>
  281. /// Sets the direction of arc.
  282. /// </summary>
  283. /// <param name="direction"> The input direction of arc. </param>
  284. /// <returns> Acad::ErrorStatus. </returns>
  285. ///
  286. Acad::ErrorStatus setDirection(Direction direction);
  287. /// <summary>
  288. /// Sets whether to rotate items or not.
  289. /// </summary>
  290. /// <param name="bRotateItems"> The input boolean to set. </param>
  291. /// <returns> Acad::ErrorStatus. </returns>
  292. ///
  293. Acad::ErrorStatus setRotateItems(bool bRotateItems);
  294. /// <summary>
  295. /// Sets the radius of the polar array.
  296. /// If there is no expression for the parameter, the expression string and
  297. /// the evaluatorId must be empty strings.
  298. /// </summary>
  299. /// <param name="radius"> The radius to set. Absolute value of this parameter is used. </param>
  300. /// <param name="expression"> The expression to set. </param>
  301. /// <param name="evaluatorId"> The evaluatorId to set. </param>
  302. /// <param name="errorMessage"> The returned error message for the individual expression. </param>
  303. /// <returns> Acad::ErrorStatus. </returns>
  304. ///
  305. Acad::ErrorStatus setRadius(double radius, const AcString& expression = AcString(),
  306. const AcString& evaluatorId = AcString(), AcString& errorMessage = dummyString());
  307. /// <summary> <para>
  308. /// Obtains list of items patterned by the set of owned parameters. Each
  309. /// parameters class uses its own logic based on owned value as well as
  310. /// geometry parameters to define a set of items to be patterned as array.
  311. /// </para><para>
  312. /// The owning AcDbAssocArrayActionBody calls this method while evaluating
  313. /// the array to update transforms of each item in the array. The caller
  314. /// may pass its current list of items for update. The input list can be
  315. /// modified by this implementation to cater change in value parameters
  316. /// controlling number of items in various directions.
  317. /// </para></summary>
  318. /// <param name="items"> The updated list of items. </param>
  319. /// <returns> Acad::ErrorStatus. </returns>
  320. ///
  321. virtual Acad::ErrorStatus getItems(AcArray<AcDbAssocArrayItem*>& items) const;
  322. /// <summary>
  323. /// Obtains position as well as orientation of an item at given spatial
  324. /// index specified by the locator.
  325. /// </summary>
  326. /// <param name="locator"> The input item locator or spatial index. </param>
  327. /// <param name="position"> The returned positon of the item whose location is
  328. /// indicated by the input locator. </param>
  329. /// <param name="xform"> The returned orientation transform of the item.
  330. /// </param>
  331. /// <returns> Acad::ErrorStatus. </returns>
  332. ///
  333. virtual Acad::ErrorStatus getItemPosition(const AcDbItemLocator& locator,
  334. AcGePoint3d& position, AcGeMatrix3d& xform) const;
  335. protected:
  336. friend class AcDbImpAssocArrayPolarParameters;
  337. explicit AcDbAssocArrayPolarParameters(AcDbImpAssocArrayPolarParameters* pSelf);
  338. };