dbAnnotationScale.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. #ifndef ACDB_ANNOTATIONSCALE_H
  13. #define ACDB_ANNOTATIONSCALE_H
  14. #pragma once
  15. #pragma pack(push, 8)
  16. #include "dbObjContext.h"
  17. class AcDbImpAnnotationScale;
  18. ////////////////////////////////////////////////////////////////////////
  19. // class AcDbAnnotationScale
  20. ////////////////////////////////////////////////////////////////////////
  21. /// <summary>
  22. /// This class represents a single annotation scale defined in a drawing
  23. /// in the form of an object context. Objects of this class are obtained
  24. /// from the "ACDB_ANNOTATIONSCALES" context collection.
  25. /// </summary>
  26. ///
  27. class AcDbAnnotationScale : public AcDbObjectContext, public AcHeapOperators
  28. {
  29. public:
  30. ACRX_DECLARE_MEMBERS(AcDbAnnotationScale);
  31. /// <summary>
  32. /// Default constructor.
  33. /// </summary>
  34. ///
  35. AcDbAnnotationScale ();
  36. /// <summary>
  37. /// Destructor. Performs any necessary cleanup of the context data.
  38. /// </summary>
  39. ///
  40. virtual ~AcDbAnnotationScale ();
  41. /// <summary>
  42. /// The name of the annotation scale.
  43. /// </summary>
  44. ///
  45. /// <param name="name">
  46. /// Output parameter containing the name of the annotation scale.
  47. /// </param>
  48. ///
  49. /// <returns>
  50. /// Returns Acad::eOk if succssful.
  51. /// </returns>
  52. ///
  53. /// <remarks>
  54. /// The name of an annotation scale may appear in user interface components
  55. /// visile to the user, and may change if the user renames the scale.
  56. /// Applications should not identify contexts by name internally but should
  57. /// use the context ID, which is guaranteed to be unique and invariant over
  58. /// time.
  59. /// </remarks>
  60. virtual Acad::ErrorStatus getName (AcString& name) const;
  61. /// <summary>
  62. /// Sets the name of the annotation scale.
  63. /// </summary>
  64. ///
  65. /// <param name="name">
  66. /// New name of the annotation scale.
  67. /// </param>
  68. ///
  69. /// <returns>
  70. /// Returns Acad::eOk if succssful.
  71. /// </returns>
  72. ///
  73. /// <remarks>
  74. /// Annotation scale names are not guaranteed to be unique.
  75. /// </remarks>
  76. ///
  77. virtual Acad::ErrorStatus setName (const AcString& name);
  78. /// <summary>
  79. /// The unique annotation scale identifier
  80. /// </summary>
  81. ///
  82. /// <returns>
  83. /// Returns the annotation scale identifier.
  84. /// </returns>
  85. ///
  86. /// <remarks>
  87. /// The unique identifier is invariant for the lifetime of this
  88. /// object and is unique amongst all annotation scale context instances.
  89. /// </remarks>
  90. ///
  91. virtual Adesk::LongPtr uniqueIdentifier () const;
  92. /// <summary>
  93. /// The name of the annotation scale collection.
  94. /// </summary>
  95. ///
  96. /// <returns>
  97. /// Returns the name of the annotation scale collection.
  98. /// </returns>
  99. ///
  100. /// <remarks>
  101. /// Annotation scales are stored in an AcDbContextCollection named by the
  102. /// string returned by this method.
  103. /// </remarks>
  104. ///
  105. virtual AcString collectionName () const;
  106. /// <summary>
  107. /// Copies the annotation scale context data into this scale instance.
  108. /// </summary>
  109. ///
  110. /// <param name="pOther">
  111. /// A pointer to the annotation scale context object to copy.
  112. /// </param>
  113. ///
  114. /// <returns>
  115. /// Returns Acad::ErrorStatus Acad::eOk for success, otherwise an error
  116. /// return value Acad::eInvalidInput if the parameter passed is null or
  117. /// if the parameter passed is not of the correct type.
  118. /// </returns>
  119. ///
  120. virtual Acad::ErrorStatus copyFrom ( const AcRxObject *pOther);
  121. /// <summary>
  122. /// The paper units portion of the annotation scale.
  123. /// </summary>
  124. ///
  125. /// <param name="dPaperUnits">
  126. /// The paper positive non-zero units value for the scale.
  127. /// </param>
  128. ///
  129. /// <returns>
  130. /// Returns Acad::eOk if successful.
  131. /// </returns>
  132. ///
  133. /// <remarks>
  134. /// Annotation scales are described as a ratio of paper units to drawing
  135. /// units. For example a scale of 1 inch = 1 foot has a paper units scale
  136. /// of 1.0, and a drawing units scale of 12.0, for an effective scale of
  137. /// 0.083.
  138. /// </remarks>
  139. ///
  140. virtual Acad::ErrorStatus getPaperUnits (double& dPaperUnits) const;
  141. /// <summary>
  142. /// Sets the paper units portion of the annotation scale.
  143. /// </summary>
  144. ///
  145. /// <param name="dPaperUnits">
  146. /// The new paper units value for the scale.
  147. /// </param>
  148. ///
  149. /// <returns>
  150. /// Returns Acad::eOk if successful.
  151. /// </returns>
  152. ///
  153. /// <remarks>
  154. /// The paper units must be positive and non-zero. Annotation scales are
  155. /// described as a ratio of paper units to drawing units. For example a
  156. /// scale of 1 inch = 1 foot has a paper units scale of 1.0, and a drawing
  157. /// units scale of 12.0, for an effective scale of 0.083.
  158. /// </remarks>
  159. ///
  160. virtual Acad::ErrorStatus setPaperUnits (double dPaperUnits);
  161. /// <summary>
  162. /// The drawing units portion of the annotation scale.
  163. /// </summary>
  164. ///
  165. /// <param name="dDrawingUnits">
  166. /// The positive, non-zero drawing units value for the scale.
  167. /// </param>
  168. ///
  169. /// <returns>
  170. /// Returns Acad::eOk if successful.
  171. /// </returns>
  172. ///
  173. /// <remarks>
  174. /// Annotation scales are described as a ratio of paper units to drawing
  175. /// units. For example a scale of 1 inch = 1 foot has a paper units scale
  176. /// of 1.0, and a drawing units scale of 12.0, for an effective scale of
  177. /// 0.083.
  178. /// </remarks>
  179. ///
  180. virtual Acad::ErrorStatus getDrawingUnits (double& dDrawingUnits) const;
  181. /// <summary>
  182. /// Sets the drawing units portion of the annotation scale.
  183. /// </summary>
  184. ///
  185. /// <param name="dDrawingUnits">
  186. /// The drawing units value for the scale.
  187. /// </param>
  188. ///
  189. /// <returns>
  190. /// Returns Acad::eOk if successful.
  191. /// </returns>
  192. ///
  193. /// <remarks>
  194. /// The drawing units must be positive and non-zero. Annotation scales are
  195. /// described as a ratio of paper units to drawing units. For example a
  196. /// scale of 1 inch = 1 foot has a paper units scale of 1.0, and a drawing
  197. /// units scale of 12.0, for an effective scale of 0.083.
  198. /// </remarks>
  199. ///
  200. virtual Acad::ErrorStatus setDrawingUnits (const double dDrawingUnits);
  201. /// <summary>
  202. /// Gets the annotation scale factor.
  203. /// </summary>
  204. ///
  205. /// <param name="dScale">
  206. /// The annotation scale factor.
  207. /// </param>
  208. ///
  209. /// <returns>
  210. /// Returns Acad::eOk if successful.
  211. /// </returns>
  212. ///
  213. /// <remarks>
  214. /// Annotation scales are described as a ratio of paper units to drawing
  215. /// units. For example a scale of 1 inch = 1 foot has a paper units scale
  216. /// of 1.0, and a drawing units scale of 12.0, for a scale factor of
  217. /// 0.083.
  218. /// </remarks>
  219. ///
  220. virtual Acad::ErrorStatus getScale (double& dScale) const;
  221. /// <summary>
  222. /// Determies whether the scale is temporarily stored in the drawing.
  223. /// </summary>
  224. ///
  225. /// <param name="bTemporary">
  226. /// Return parameter indicating whether the scale object is temporarily
  227. /// stored in the drawing.
  228. /// </param>
  229. ///
  230. /// <returns>
  231. /// Returns Acad::eOk if successful.
  232. /// </returns>
  233. ///
  234. /// <remarks>
  235. /// The annotation scale collection in a drawing can contain temporary
  236. /// scale entries. These scale entries typically exist because attached
  237. /// XREF objects in the drawing have dependencies on scales that are not
  238. /// directly referenced by other objects in the drawing. Applications
  239. /// should not persist references to temporary scales, as other operations
  240. /// (for exampe detaching an XREF) may remove temporary scales from the
  241. /// collection. Temporary scales are not filed out to a drawing when it is
  242. /// saved.
  243. /// </remarks>
  244. virtual Acad::ErrorStatus getIsTemporaryScale (bool& bTemporary) const;
  245. /// <summary>
  246. /// Determies whether the given id matches the scale id.
  247. /// </summary>
  248. ///
  249. /// <param name="id">
  250. /// id which is to be compared to the scale id
  251. /// </param>
  252. ///
  253. /// <returns>
  254. /// Return true if the input id matches the scale id
  255. /// </returns>
  256. ///
  257. /// <remarks>
  258. /// This function can be used in place of direct comparison of the
  259. /// uniqueIdentifier property to determine if two instances of the
  260. /// class are referring to the same underlying scale instance. When
  261. /// an XREF has been attached it is possible for two instances of this
  262. /// class to have different unique identifiers but refer to the same
  263. /// underlying scale instance.
  264. /// </remarks>
  265. virtual bool matchScaleId(Adesk::LongPtr id) const;
  266. protected:
  267. AcDbImpAnnotationScale* mpImp;
  268. friend class AcDbSystemInternals;
  269. AcDbAnnotationScale ( bool );
  270. };
  271. // Notification of Annotation Scale change.
  272. class ACDB_PORT AcDbAnnotationScaleReactor: public AcRxObject
  273. {
  274. public:
  275. ACRX_DECLARE_MEMBERS(AcDbAnnotationScaleReactor);
  276. virtual void annotationScaleChanged (const AcDbDatabase* pDb,
  277. const AcDbViewport* pVP,
  278. const AcDbAnnotationScale* pScale,
  279. const bool bInitializing);
  280. };
  281. // Add an AcDbAnnotationScaleReactor reactor.
  282. ACDB_PORT bool acdbAddAnnotationScaleReactor(AcDbAnnotationScaleReactor *pReactor);
  283. // Remove an AcDbAnnotationScaleReactor reactor.
  284. ACDB_PORT bool acdbRemoveAnnotationScaleReactor(AcDbAnnotationScaleReactor *pReactor);
  285. #pragma pack(pop)
  286. #endif