dbunderlayref.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. // DESCRIPTION: Exported class for underlay references in dwg file - AcDbUnderlayReference
  13. #ifndef ACDB_DBUNDERLAYREF_H
  14. #define ACDB_DBUNDERLAYREF_H
  15. #pragma once
  16. #include "dbmain.h"
  17. #include "acstring.h"
  18. #pragma pack (push, 8)
  19. class AcUnderlayLayer;
  20. /// <summary>
  21. /// Abstract class that represents underlays in the drawing. Underlays are similar to raster images
  22. /// but their content is snappable. An AcDbUnderlayReference must reference compatible an AcDbUnderlayDefinition.
  23. /// The AcDbUnderlayRefernece is responsible for the placement of the content within the drawing while AcDbUnderlayDefinition
  24. /// handles the linkage to the underlay content.
  25. /// Instances of AcDbUnderlayReference derived concrete classes are inserted in a block table record.
  26. /// Instances of AcDbUnderlayDefinition derived concrete classes are inserted into a dictionay off of the named object dictionary.
  27. /// </summary>
  28. class ADESK_NO_VTABLE AcDbUnderlayReference: public AcDbEntity
  29. {
  30. public:
  31. ACDB_DECLARE_MEMBERS(AcDbUnderlayReference);
  32. /// <summary>
  33. /// Destroys the reference.
  34. /// </summary>
  35. virtual ~AcDbUnderlayReference() = 0;
  36. /// <summary>
  37. /// Gets the position of underlay in WCS (or block space coordinates if the reference is part of a block).
  38. /// </summary>
  39. /// <returns>Returns the position of underlay in WCS (or block space coordinates if the reference is part of a block).</returns>
  40. AcGePoint3d position() const;
  41. /// <summary>
  42. /// Sets the position of underlay in WCS (or block space coordinates if the reference is part of a block).
  43. /// </summary>
  44. /// <param name="position">New position value.</param>
  45. /// <returns>Returns Acad::eOk if successful.</returns>
  46. Acad::ErrorStatus setPosition(const AcGePoint3d& position);
  47. /// <summary>
  48. /// Gets the scale factors used to scale the underlay. Most underlays only allow uniform scaling.
  49. /// </summary>
  50. /// <returns>Returns the scale factors used to scale the underlay.</returns>
  51. AcGeScale3d scaleFactors() const;
  52. /// <summary>
  53. /// Sets the scale factors used to scale the underlay. Most underlays only allow uniform scaling.
  54. /// </summary>
  55. /// <param name="scale">New scale value.</param>
  56. /// <returns>Returns Acad::eOk if successful.</returns>
  57. Acad::ErrorStatus setScaleFactors(const AcGeScale3d& scale);
  58. /// <summary>
  59. /// Gets the rotation value around the axis defined by the point returned by position() and the vector returned by normal().
  60. /// </summary>
  61. /// <returns>Returns the rotation value of the underlay.</returns>
  62. double rotation() const;
  63. /// <summary>
  64. /// Sets the rotation value around the axis defined by the point returned by position() and the vector returned by normal().
  65. /// </summary>
  66. /// <param name="rotation">New rotation value.</param>
  67. /// <returns>Returns Acad::eOk if successful.</returns>
  68. Acad::ErrorStatus setRotation(double rotation);
  69. /// <summary>
  70. /// Gets the normal of the underlay.
  71. /// </summary>
  72. /// <returns>Returns the normal of the underlay.</returns>
  73. AcGeVector3d normal() const;
  74. /// <summary>
  75. /// Sets the normal of the underlay.
  76. /// </summary>
  77. /// <param name="normal">New normal value.</param>
  78. /// <returns>Returns Acad::eOk if successful.</returns>
  79. Acad::ErrorStatus setNormal(const AcGeVector3d& normal);
  80. /// <summary>
  81. /// Gets the transformation matrix from underlay coordinate system to world coordinate system (or block space coordinates if the underlay is part of a block).
  82. /// the transformation is defined by position(), normal() and rotatation().
  83. /// </summary>
  84. /// <returns>Returns the model to WCS transformation of the underlay.</returns>
  85. AcGeMatrix3d transform() const;
  86. /// <summary>
  87. /// Sets the trnsformation matrix of the underlay.
  88. /// The translation component of <paramref name="transform"/> will be used to set the position property.
  89. /// The rotation component of <paramref name="transform"/> will be used to set the rotation property.
  90. /// The scale component of <paramref name="transform"/> will be used to set the scale property.
  91. /// </summary>
  92. /// <param name="transform">New transformation matrix.</param>
  93. /// <returns>Returns Acad::eOk if successful.</returns>
  94. Acad::ErrorStatus setTransform(const AcGeMatrix3d& transform);
  95. /// <summary>
  96. /// Gets the object id of the AcDbUnderlayDefinition that this underlay references.
  97. /// </summary>
  98. /// <returns>Returns the object id of the AcDbUnderlayDefinition that this underlay references.</returns>
  99. AcDbObjectId definitionId() const;
  100. /// <summary>
  101. /// Sets the model to world transformation matrix of the underlay.
  102. /// The translation component of <paramref name="transform"/> will be used to set the position property.
  103. /// The rotation component of <paramref name="transform"/> will be used to set the rotation property.
  104. /// The scale component of <paramref name="transform"/> will be used to set the scale property.
  105. /// </summary>
  106. /// <param name="id">New transformation matrix.</param>
  107. /// <returns>Returns Acad::eOk if successful.</returns>
  108. Acad::ErrorStatus setDefinitionId(AcDbObjectId id);
  109. ACDB_PORT Acad::ErrorStatus setWidth(double width);
  110. ACDB_PORT Acad::ErrorStatus width(double& width) const;
  111. ACDB_PORT Acad::ErrorStatus setHeight(double width);
  112. ACDB_PORT Acad::ErrorStatus height(double& width) const;
  113. /// <summary>
  114. /// Gets the clip boundary of the underlay. The boundary is defined in model coordinates. (i.e. One must use
  115. /// the transformation matrix return by tranform() to obtain WCS points.)
  116. /// </summary>
  117. /// <returns>Gets the clip boundary of the underlay.</returns>
  118. const AcGePoint2dArray& clipBoundary() const;
  119. /// <summary>
  120. /// Sets the clip boundary of the underlay. The boundary is defined in model coordinates. (i.e. Given WCS points one must use
  121. /// the inverse of the transformation matrix return by tranform() to obtain points that can be passed to this function.)
  122. /// </summary>
  123. /// <param name="clipBoundary">New clip boundary. An array describing self interfecting polyline is not allowed.
  124. /// An array of two points is allowed and is treated as the minimum, maximum point of a rectangle.</param>
  125. /// <returns>Returns Acad::eOk if successful.</returns>
  126. Acad::ErrorStatus setClipBoundary(const AcGePoint2dArray& clipBoundary);
  127. /// <summary>
  128. /// Gets a boolean indicating whether the clip boundary should be used.
  129. /// </summary>
  130. /// <returns>Returns a boolean indicating whether the clip boundary should be used.</returns>
  131. bool isClipped() const;
  132. /// <summary>
  133. /// Sets a boolean indicating whether the clip boundary should be used.
  134. /// </summary>
  135. /// <param name="value">New value.</param>
  136. /// <returns>Returns Acad::eOk if successful.</returns>
  137. Acad::ErrorStatus setIsClipped(bool value);
  138. /// <summary>
  139. /// Gets the contrast value for the underlay ([0-100]).
  140. /// </summary>
  141. /// <returns>Returns the contrast value for the underlay ([0-100]).</returns>
  142. Adesk::UInt8 contrast() const;
  143. /// <summary>
  144. /// Sets the contrast value for the underlay ([0-100]).
  145. /// </summary>
  146. /// <param name="value">New value.</param>
  147. /// <returns>Returns Acad::eOk if successful.</returns>
  148. Acad::ErrorStatus setContrast(Adesk::UInt8 value);
  149. /// <summary>
  150. /// Gets the fade value for the underlay ([0-100]).
  151. /// </summary>
  152. /// <returns>Returns the fade value for the underlay ([0-100]).</returns>
  153. Adesk::UInt8 fade() const;
  154. /// <summary>
  155. /// Sets the fade value for the underlay ([0-100]).
  156. /// </summary>
  157. /// <param name="value">New value.</param>
  158. /// <returns>Returns Acad::eOk if successful.</returns>
  159. Acad::ErrorStatus setFade(Adesk::UInt8 value);
  160. /// <summary>
  161. /// Gets a value indicating whether the underlay content is shown. This variable governs the visibilty of the underlay content not its frame or clipping boundary.
  162. /// </summary>
  163. /// <returns>Returns a value indicating whether the underlay content is shown.</returns>
  164. bool isOn() const;
  165. /// <summary>
  166. /// Sets a value indicating whether the underlay content is shown. This variable governs the visibilty of the underlay content not its frame or clipping boundary.
  167. /// </summary>
  168. /// <param name="value">New value.</param>
  169. /// <returns>Returns Acad::eOk if successful.</returns>
  170. Acad::ErrorStatus setIsOn(bool value);
  171. /// <summary>
  172. /// Gets a value indicating whether the underlay content is shown monochrome.
  173. /// </summary>
  174. /// <returns>Returns a value indicating whether the underlay content is shown monochrome.</returns>
  175. bool isMonochrome() const;
  176. /// <summary>
  177. /// Sets a value indicating whether the underlay content is shown monochrome.
  178. /// </summary>
  179. /// <param name="value">New value.</param>
  180. /// <returns>Returns Acad::eOk if successful.</returns>
  181. Acad::ErrorStatus setIsMonochrome(bool value);
  182. /// <summary>
  183. /// Gets a value indicating whether the dwf content is adjusted for the current background color. Not all underlay types observe
  184. /// this setting.
  185. /// </summary>
  186. /// <returns>Returns a value indicating whether the underlay content is adjusted for the current background color.</returns>
  187. bool isAdjustedForBackground() const;
  188. /// <summary>
  189. /// Sets a value indicating whether the underlay content is adjusted for the current background color. Not all underlay types observe
  190. /// this setting.
  191. /// </summary>
  192. /// <param name="value">New value.</param>
  193. /// <returns>Returns Acad::eOk if successful.</returns>
  194. Acad::ErrorStatus setIsAdjustedForBackground(bool value);
  195. /// <summary>
  196. /// Gets a value indicating whether frame of the underlay is visible on screen.
  197. /// </summary>
  198. /// <returns>returns true if the frame is visible</returns>
  199. virtual bool isFrameVisible() const;
  200. /// <summary>
  201. /// Gets a value indicating whether frame of the underlay is visible in a plot.
  202. /// </summary>
  203. /// <returns>returns true if the frame is visible</returns>
  204. virtual bool isFramePlottable() const;
  205. /// <summary>
  206. /// Gets number of layers for this underlay
  207. /// </summary>
  208. /// <returns>returns 0 if underlay has no layer information.</returns>
  209. Adesk::UInt32 underlayLayerCount() const;
  210. /// <summary>
  211. /// Get Underlay layer information (layer name and layer on/off state)
  212. /// for the layer at given index
  213. /// </summary>
  214. /// <returns>Returns Acad::eOk if successful</returns>
  215. Acad::ErrorStatus getUnderlayLayer(int index, AcUnderlayLayer& layer) const;
  216. /// <summary>
  217. /// Get Underlay layer information (layer name and layer on/off state)
  218. /// for the layer name passed in
  219. /// </summary>
  220. /// <returns>Returns Acad::eOk if successful</returns>
  221. Acad::ErrorStatus setUnderlayLayer(int index, const AcUnderlayLayer& layer);
  222. /// <summary>
  223. /// Gets lower limit of the legal contrast values.
  224. /// </summary>
  225. /// <returns>returns lower limit of the legal contrast values.</returns>
  226. static Adesk::UInt8 contrastLowerLimit();
  227. /// <summary>
  228. /// Gets upper limit of the legal contrast values.
  229. /// </summary>
  230. /// <returns>returns upper limit of the legal contrast values.</returns>
  231. static Adesk::UInt8 contrastUpperLimit();
  232. /// <summary>
  233. /// Gets default contrast value.
  234. /// </summary>
  235. /// <returns>Returnss default contrast value.</returns>
  236. static Adesk::UInt8 contrastDefault();
  237. /// <summary>
  238. /// Gets lower limit of the legal fade values.
  239. /// </summary>
  240. /// <returns>returns lower limit of the legal fade values.</returns>
  241. static Adesk::UInt8 fadeLowerLimit();
  242. /// <summary>
  243. /// Gets upper limit of the legal fade values.
  244. /// </summary>
  245. /// <returns>returns upper limit of the legal fade values.</returns>
  246. static Adesk::UInt8 fadeUpperLimit();
  247. /// <summary>
  248. /// Gets default fade value.
  249. /// </summary>
  250. /// <returns>Returnss default fade value.</returns>
  251. static Adesk::UInt8 fadeDefault();
  252. /// <summary>
  253. /// Check if clip is inverted.
  254. /// </summary>
  255. /// <returns>Returns true if inverted.</returns>
  256. bool isClipInverted() const;
  257. /// <summary>
  258. /// Set if clip is inverted.
  259. /// </summary>
  260. /// <param name="value">New value.</param>
  261. /// <returns>Returns Acad::eOk if successful.</returns>
  262. Acad::ErrorStatus setClipInverted(bool value);
  263. /// <summary>
  264. /// Generate the clip boundary from a polyline.
  265. /// </summary>
  266. /// <param name="polyId">Polyline ID</param>
  267. /// <returns>Returns Acad::eOk if successful.</returns>
  268. Acad::ErrorStatus generateClipBoundaryFromPline(AcDbObjectId polyId);
  269. };
  270. /// <summary>
  271. /// Represents DWF underlays in the drawing. Underlays are similar to raster images
  272. /// but their content is snappable.
  273. /// </summary>
  274. class AcDbDwfReference: public AcDbUnderlayReference
  275. {
  276. public:
  277. ACDB_DECLARE_MEMBERS(AcDbDwfReference);
  278. /// <summary>
  279. /// Default constructor.
  280. /// </summary>
  281. AcDbDwfReference();
  282. /// <summary>
  283. /// Destroys the reference.
  284. /// </summary>
  285. virtual ~AcDbDwfReference();
  286. protected:
  287. /// <summary>
  288. /// Overridden from AcDbEntity
  289. /// </summary>
  290. /// <param name="pClsid">See AcDbEntity::getClassID()</param>
  291. /// <returns>See AcDbEntity::getClassID()</returns>
  292. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  293. };
  294. /// <summary>
  295. /// Represents DGN underlays in the drawing. Underlays are similar to raster images
  296. /// but their content is snappable.
  297. /// </summary>
  298. class AcDbDgnReference: public AcDbUnderlayReference
  299. {
  300. public:
  301. ACDB_DECLARE_MEMBERS(AcDbDgnReference);
  302. /// <summary>
  303. /// Default constructor.
  304. /// </summary>
  305. AcDbDgnReference();
  306. /// <summary>
  307. /// Destroys the reference.
  308. /// </summary>
  309. virtual ~AcDbDgnReference();
  310. void setXrefDepth(int depth);
  311. protected:
  312. /// <summary>
  313. /// Overridden from AcDbEntity
  314. /// </summary>
  315. /// <param name="pClsid">See AcDbEntity::getClassID()</param>
  316. /// <returns>See AcDbEntity::getClassID()</returns>
  317. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  318. };
  319. class AcDbPdfReference: public AcDbUnderlayReference
  320. {
  321. public:
  322. ACDB_DECLARE_MEMBERS(AcDbPdfReference);
  323. /// <summary>
  324. /// Default constructor.
  325. /// </summary>
  326. ACDB_PORT AcDbPdfReference();
  327. /// <summary>
  328. /// Destroys the reference.
  329. /// </summary>
  330. ACDB_PORT virtual ~AcDbPdfReference();
  331. protected:
  332. /// <summary>
  333. /// Overridden from AcDbEntity
  334. /// </summary>
  335. /// <param name="pClsid">See AcDbEntity::getClassID()</param>
  336. /// <returns>See AcDbEntity::getClassID()</returns>
  337. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  338. public:
  339. /// <summary>
  340. /// Gets default contrast value.
  341. /// </summary>
  342. /// <returns>Returnss default contrast value.</returns>
  343. static Adesk::UInt8 contrastDefault();
  344. /// <summary>
  345. /// Gets default fade value.
  346. /// </summary>
  347. /// <returns>Returnss default fade value.</returns>
  348. static Adesk::UInt8 fadeDefault();
  349. };
  350. #pragma pack (pop)
  351. #endif