AcDbAssocPersSubentIdPE.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  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: Jiri Kripac March 2007
  12. //
  13. // DESCRIPTION:
  14. //
  15. // AcDbAssocPersSubentIdPE AcRx protocol extension abstract base class.
  16. //
  17. //////////////////////////////////////////////////////////////////////////////
  18. #pragma once
  19. #include "AcDbAssocSimplePersSubentId.h"
  20. #pragma pack (push, 8)
  21. class AcDbCompoundObjectId;
  22. class AcDbIdMapping;
  23. /// <summary> Rigid set type. </summary>
  24. ///
  25. enum RigidSetType
  26. {
  27. /// <summary> Not a rigid set. </summary>
  28. kNotRigidSet = 0,
  29. /// <summary> A rigid set that can be uniformly scaled. </summary>
  30. kScalableRigidSet,
  31. /// <summary> A rigid set that cannot be scaled. </summary>
  32. kNonScalableRigidSet
  33. };
  34. /// <summary> <para>
  35. /// AcRx protocol extension base class that defines protocol to obtain a persistent
  36. /// AcDbAssocPersSubentId from a transient AcDbSubentId. It also adds subentity
  37. /// query and manipulation protocol that is not available in the AcDbEntity class
  38. /// proper so that the client code can manipulate subentities of entities.
  39. /// </para> <para>
  40. /// The derived concrete classes implement this protocol for the individual
  41. /// derived AcDbEntity classes. Only the methods that are pertinent to the
  42. /// particular AcDbEntity type need to be overridden.
  43. /// </para> <para>
  44. /// Notice that ObjectARX provides implementation of the AcDbAssocPersSubentIdPE
  45. /// protocol extension for the common entity types such as AcDbLine, AcDbCircle,
  46. /// AcDbArc, AcDbPolyline, AcDb2dPolyline, etc.
  47. /// </para> </summary>
  48. ///
  49. class ACDB_PORT AcDbAssocPersSubentIdPE : public AcRxObject
  50. {
  51. public:
  52. ACRX_DECLARE_MEMBERS(AcDbAssocPersSubentIdPE);
  53. /// <summary> <para>
  54. /// Mapping: AcDbSubentId --> AcDbAssocPersSubentId
  55. /// <para> </para>
  56. /// Creates a new AcDbAssocPersSubentId object from a given AcDbSubentId.
  57. /// The default implementation creates an AcDbSimplePersSubentId that just
  58. /// holds the given AcDbSubentId.
  59. /// </para> </summary>
  60. /// <param name="pEntity">
  61. /// The entity must be open for write, but usually no changes to the
  62. /// entity will be made (usually no assertWriteEnabled() will be called).
  63. /// </param>
  64. /// <param name="pDatabase">
  65. /// The database that the newly created AcDbAssocPersSubentId is going to belong to.
  66. /// It may be a different database than the database of the given AcDbEntity when
  67. /// the entity is in an XREF database but the AcDbAssocPersSubentId is going to
  68. /// be owned by an object in the host database. If the database pointer is NULL,
  69. /// the database of the entity is used.
  70. /// </param>
  71. /// <param name="compId">
  72. /// Contains optional full context path to pEntity. Can be empty for simple reference.
  73. /// </param>
  74. /// <param name="subentId"> Transient AcDbSubentId. </param>
  75. /// <returns> The newly created AcDbAssocPersSubentId or NULL if it cannot be created. </returns>
  76. ///
  77. virtual AcDbAssocPersSubentId* createNewPersSubent(AcDbEntity* pEntity,
  78. AcDbDatabase* pDatabase,
  79. const AcDbCompoundObjectId& /*compId*/,
  80. const AcDbSubentId& subentId)
  81. {
  82. UNREFERENCED_PARAMETER(pEntity);
  83. UNREFERENCED_PARAMETER(pDatabase);
  84. return new AcDbAssocSimplePersSubentId(subentId);
  85. }
  86. /// <summary>
  87. /// Needs to be called when an AcDbAssocPersSubentId is no more needed, to inform
  88. /// to release and resources possibly associated with this AcDbAssocPersSubentId.
  89. /// The AcDbAssocPersSubentId object may just keep an index and there is a complex
  90. /// data structure somewhere that keeps data for that index. Deleting the
  91. /// AcDbAssocPersSubentId would just make this data in the complex data structure
  92. /// orphaned, but the data would stay around and never removed.
  93. /// </summary>
  94. /// <param name="pEntity">
  95. /// The entity must be open for write, but usually no changes to the
  96. /// entity will be made (usually no assertWriteEnabled() will be called).
  97. /// </param>
  98. /// <param name="pDatabase">
  99. /// The database that the AcDbAssocPersSubentId belongs to. It may be a different
  100. /// database than the database of the given AcDbEntity when the entity is in an XREF
  101. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  102. /// If the database pointer is NULL, the database of the entity is used.
  103. /// </param>
  104. /// <param name="pPerSubentId">
  105. /// The persistent subentity id on the entity that is to be released.
  106. /// </param>
  107. /// <returns> Acad::ErrorStatus. </returns>
  108. ///
  109. virtual Acad::ErrorStatus releasePersSubent(AcDbEntity* pEntity,
  110. AcDbDatabase* pDatabase,
  111. const AcDbAssocPersSubentId* pPerSubentId)
  112. {
  113. UNREFERENCED_PARAMETER(pEntity);
  114. UNREFERENCED_PARAMETER(pDatabase);
  115. UNREFERENCED_PARAMETER(pPerSubentId);
  116. return Acad::eOk;
  117. }
  118. /// <summary>
  119. /// Redirects the given AcDbAssocPersSubentId that currently refers to a subentity
  120. /// in the current entity to refer to the same subentity in the new entity.
  121. /// It is assumed that the old and new entities are topologically equal (such as the
  122. /// new entity is a clone of the old one), so that the transfer can be accomplished
  123. /// by simply remapping the data associatied with the AcDbAssocPersSubentId. Notice
  124. /// that the AcDbAssocPersSubentId itself does not change, only the data associated
  125. /// with it and kept somewhere else.
  126. /// </summary>
  127. /// <param name="pToEntity">
  128. /// The entity to redirect the AcDbAssocPersSubentId to. It must be open for write,
  129. /// but usually no changes to the entity will be made (usually no assertWriteEnabled()
  130. /// will be called).
  131. /// </param>
  132. /// <param name="pToDatabase">
  133. /// The database that the AcDbAssocPersSubentId should belong to. It may be a different
  134. /// database than the database of the given AcDbEntity when the entity is in an XREF
  135. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  136. /// If the database pointer is NULL, the database of the entity is used.
  137. /// </param>
  138. /// <param name="pFromEntity">
  139. /// The entity to redirect the AcDbAssocPersSubentId from. It must be open for write,
  140. /// but usually no changes to the entity will be made (usually no assertWriteEnabled()
  141. /// will be called). It may even be NULL, e.g. when the entity is not available any more.
  142. /// </param>
  143. /// <param name="pFromDatabase">
  144. /// The database that the AcDbAssocPersSubentId currently belongs to. It may be a different
  145. /// database than the database of the given AcDbEntity when the entity is in an XREF
  146. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  147. /// If the database pointer is NULL, the database of the entity is used.
  148. /// </param>
  149. /// <param name="pPersSubentId">
  150. /// The persistent subentity id that is going to be redirected to refer to a subentity
  151. /// in the new entity. Notice that the AcDbAssocPersSubentId is const does not change,
  152. /// only the data associated with it and kept somewhere else.
  153. /// </param>
  154. /// <returns> Acad::ErrorStatus. </returns>
  155. ///
  156. virtual Acad::ErrorStatus transferPersSubentToAnotherEntity(
  157. AcDbEntity* pToEntity,
  158. AcDbDatabase* pToDatabase,
  159. AcDbEntity* pFromEntity,
  160. AcDbDatabase* pFromDatabase,
  161. const AcDbAssocPersSubentId* pPersSubentId)
  162. {
  163. UNREFERENCED_PARAMETER(pToEntity);
  164. UNREFERENCED_PARAMETER(pToDatabase);
  165. UNREFERENCED_PARAMETER(pFromEntity);
  166. UNREFERENCED_PARAMETER(pFromDatabase);
  167. UNREFERENCED_PARAMETER(pPersSubentId);
  168. return Acad::eOk;
  169. }
  170. /// <summary><para>
  171. /// Allows to automatically call releasePersSubent() on the AcDbAssocPersSubentId if
  172. /// it is no more used. What "no more used" means, who checks for it, and which code
  173. /// implements the purging is defined by the application that the AcDbAssocPersSubentId
  174. /// relates to. By default the AcDbAssocPersSubentIds are not automatically purgeable.
  175. /// </para><para>
  176. /// When an AcDbAssocPersSubentId is created by AcDbAssocGeomDependency::setSubentity(),
  177. /// the created AcDbAssocPersSubentIds is made purgeable, because on file open all
  178. /// AcDbAssocActions, AcDbAssocDependencies and all AcDbObjects the dependencies depend
  179. /// are visited, all used ids can be safely collected and the not used ones can be automatically
  180. /// purged.
  181. /// </para><para>
  182. /// This purging is because of the infamous lazy-erase mess in AutoCAD when only
  183. /// the parent object is erased but not its children. The children are not erased,
  184. /// do not know that their parent was erased, but when saving to a file, they are not
  185. /// saved, because their parent is not saved.
  186. /// When the file is open, these objects are not in the file any more. If there are
  187. /// some other resources related to these not-saved objects but kept in some other place,
  188. /// these resources are not released because the not-saved objects had no opportunity
  189. /// to request to release these resources, i.e., in our scenario to call releasePersSubent().
  190. /// </para><para>
  191. /// Currently this method is only implemented by AcDbAssocAsmBasedEntityPersSubentIdPE
  192. /// that interacts with AcDbAssocPersSubentManager.
  193. /// </para></summary>
  194. /// <param name="pEntity">
  195. /// The entity must be open for write, but usually no changes to the
  196. /// entity will be made (usually no assertWriteEnabled() will be called).
  197. /// </param>
  198. /// <param name="pDatabase">
  199. /// The database that the AcDbAssocPersSubentId belongs to. It may be a different
  200. /// database than the database of the given AcDbEntity when the entity is in an XREF
  201. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  202. /// If the database pointer is NULL, the database of the entity is used.
  203. /// </param>
  204. /// <param name="pPerSubentId">
  205. /// The persistent subentity id on the entity that is to be made purgeable or not.
  206. /// </param>
  207. /// <param name="yesNo"> Make the given AcDbAssocPersSubentId purgeable or not. </param>
  208. /// <returns> Acad::ErrorStatus. </returns>
  209. ///
  210. virtual Acad::ErrorStatus makePersSubentPurgeable(AcDbEntity* pEntity,
  211. AcDbDatabase* pDatabase,
  212. const AcDbAssocPersSubentId* pPerSubentId,
  213. bool yesNo)
  214. {
  215. UNREFERENCED_PARAMETER(pEntity);
  216. UNREFERENCED_PARAMETER(pDatabase);
  217. UNREFERENCED_PARAMETER(yesNo);
  218. UNREFERENCED_PARAMETER(pPerSubentId);
  219. return Acad::eOk;
  220. }
  221. /// <summary> <para>
  222. /// Mapping: AcDbAssocPersSubentId --> AcDbSubentId(s)
  223. /// </para> <para>
  224. /// Obtains all AcDbSubentIds of the provided AcDbEntity that correspond to
  225. /// the provided AcDbAssocPersSubentId.
  226. /// </para> </summary>
  227. /// <remarks>
  228. /// Notice that one AcDbAssocPersSubentId may correspond to none, one or more
  229. /// that one AcDbSubentId, because the entity may have changed and there may
  230. /// not be just a single subentity corresponding to the original subentity
  231. /// identified by the AcDbAssocPersSubentId.
  232. /// </remarks>
  233. /// <param name="pEntity"> The entity needs to be open for read. </param>
  234. /// <param name="pDatabase">
  235. /// The database that the AcDbAssocPersSubentId belongs to. It may be a different
  236. /// database than the database of the given AcDbEntity when the entity is in an XREF
  237. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  238. /// If the database pointer is NULL, the database of the entity is used.
  239. /// </param>
  240. /// <param name="pPersSubentId"> The persistent subentity id on the entity. </param>
  241. /// <param name="subents"> The returned AcDbSubentIds. </param>
  242. /// <returns> Acad::ErrorStatus. </returns>
  243. ///
  244. virtual Acad::ErrorStatus getTransientSubentIds(const AcDbEntity* pEntity,
  245. AcDbDatabase* pDatabase,
  246. const AcDbAssocPersSubentId* pPersSubentId,
  247. AcArray<AcDbSubentId>& subents) const;
  248. /// <summary>
  249. /// Gets all subentities of the given type. The default implementation
  250. /// just returns Acad::eNotImplemented.
  251. /// </summary>
  252. /// <param name="pEntity"> The entity must be open for read. </param>
  253. /// <param name="subentType"> The required type of the subentities. </param>
  254. /// <param name="allSubentIds"> Returned AcDbSubentIds of the required type. </param>
  255. /// <returns> Acad::ErrorStatus. </returns>
  256. ///
  257. virtual Acad::ErrorStatus getAllSubentities(const AcDbEntity* pEntity,
  258. AcDb::SubentType subentType,
  259. AcArray<AcDbSubentId>& allSubentIds)
  260. {
  261. UNREFERENCED_PARAMETER(pEntity);
  262. UNREFERENCED_PARAMETER(subentType);
  263. UNREFERENCED_PARAMETER(allSubentIds);
  264. return Acad::eNotImplemented;
  265. }
  266. /// <summary>
  267. /// Gets all subentities of the given class for kClassSubentType subentity type.
  268. /// The default implementation just returns Acad::eNotImplemented.
  269. /// </summary>
  270. /// <param name="pEntity"> The entity must be open for read. </param>
  271. /// <param name="pSubentClass"> The required class of the subentities for kClassSubentType. </param>
  272. /// <param name="allSubentIds"> Returned AcDbSubentIds of the required type. </param>
  273. /// <returns> Acad::ErrorStatus. </returns>
  274. ///
  275. virtual Acad::ErrorStatus getAllSubentities(const AcDbEntity* pEntity,
  276. const AcRxClass* pSubentClass,
  277. AcArray<AcDbSubentId>& allSubentIds)
  278. {
  279. UNREFERENCED_PARAMETER(pEntity);
  280. UNREFERENCED_PARAMETER(pSubentClass);
  281. UNREFERENCED_PARAMETER(allSubentIds);
  282. return Acad::eNotImplemented;
  283. }
  284. /// <summary>
  285. /// Gets the vertex AcDbSubentIds corresponding to the given edge AcDbSubentId.
  286. /// This protocol is needed to query the relations between the edge and vertex
  287. /// subentities. The default implementation just returns Acad::eNotImplemented.
  288. /// </summary>
  289. /// <param name="pEntity"> The entity must be open for read. </param>
  290. /// <param name="edgeSubentId">
  291. /// Edge AcDbSubentId whose vertex AcDbSubentIds are to be obtained.
  292. /// </param>
  293. /// <param name="startVertexSubentId">
  294. /// Returned AcDbSubentId of the start vertex of the edge (or kNullSubentId
  295. /// if there is not any).
  296. /// </param>
  297. /// <param name="endVertexSubentId">
  298. /// Returned AcDbSubentId of the end vertex of the edge (or kNullSubentId
  299. /// if there is not any).
  300. /// </param>
  301. /// <param name="otherVertexSubentIds">
  302. /// Returned other AcDbSubentIds associated with the edge, such as the
  303. /// circle or arc center, spline control and fit points, etc.
  304. /// </param>
  305. /// <returns> Acad::ErrorStatus. </returns>
  306. ///
  307. virtual Acad::ErrorStatus getEdgeVertexSubentities(const AcDbEntity* pEntity,
  308. const AcDbSubentId& edgeSubentId,
  309. AcDbSubentId& startVertexSubentId,
  310. AcDbSubentId& endVertexSubentId,
  311. AcArray<AcDbSubentId>& otherVertexSubentIds)
  312. {
  313. UNREFERENCED_PARAMETER(pEntity);
  314. UNREFERENCED_PARAMETER(edgeSubentId);
  315. UNREFERENCED_PARAMETER(startVertexSubentId);
  316. UNREFERENCED_PARAMETER(endVertexSubentId);
  317. UNREFERENCED_PARAMETER(otherVertexSubentIds);
  318. return Acad::eNotImplemented;
  319. }
  320. /// <summary>
  321. /// Gets the vertex AcDbSubentIds corresponding to the given edge AcDbSubentId
  322. /// whose geometry is defined by a spline.
  323. /// This protocol is needed to query the relations between the edge and vertex
  324. /// subentities. The default implementation just returns Acad::eNotImplemented.
  325. /// </summary>
  326. /// <param name="pEntity"> The entity must be open for read. </param>
  327. /// <param name="edgeSubentId">
  328. /// Edge AcDbSubentId whose vertex AcDbSubentIds are to be obtained.
  329. /// </param>
  330. /// <param name="startVertexSubentId">
  331. /// Returned AcDbSubentId of the start vertex of the edge (or kNullSubentId
  332. /// if there is not any).
  333. /// </param>
  334. /// <param name="endVertexSubentId">
  335. /// Returned AcDbSubentId of the end vertex of the edge (or kNullSubentId
  336. /// if there is not any).
  337. /// </param>
  338. /// <param name="controlPointSubentIds">
  339. /// Returned AcDbSubentIds identifying the spline control points. The order
  340. /// is the same as the order of the spline control points.
  341. /// </param>
  342. /// <param name="fitPointSubentIds">
  343. /// Returned AcDbSubentIds identifying the spline fit points (if any).
  344. /// The order is the same as the order of the spline fit points.
  345. /// </param>
  346. /// <returns> Acad::ErrorStatus. </returns>
  347. ///
  348. virtual Acad::ErrorStatus getSplineEdgeVertexSubentities(const AcDbEntity* pEntity,
  349. const AcDbSubentId& edgeSubentId,
  350. AcDbSubentId& startVertexSubentId,
  351. AcDbSubentId& endVertexSubentId,
  352. AcArray<AcDbSubentId>& controlPointSubentIds,
  353. AcArray<AcDbSubentId>& fitPointSubentIds)
  354. {
  355. UNREFERENCED_PARAMETER(pEntity);
  356. UNREFERENCED_PARAMETER(edgeSubentId);
  357. UNREFERENCED_PARAMETER(startVertexSubentId);
  358. UNREFERENCED_PARAMETER(endVertexSubentId);
  359. UNREFERENCED_PARAMETER(controlPointSubentIds);
  360. UNREFERENCED_PARAMETER(fitPointSubentIds);
  361. return Acad::eNotImplemented;
  362. }
  363. /// <summary>
  364. /// Gets the coordinates of a vertex subentity. The default implementation
  365. /// just returns Acad::eNotImplemented.
  366. /// </summary>
  367. /// <param name="pEntity"> The entity must be open for read. </param>
  368. /// <param name="vertexSubentId"> Vertex AcDbSubentId whose position is to be obtained. </param>
  369. /// <param name="vertexPosition"> Returned coordinates of the vertex subentity. </param>
  370. /// <returns> Acad::ErrorStatus. </returns>
  371. ///
  372. virtual Acad::ErrorStatus getVertexSubentityGeometry(const AcDbEntity* pEntity,
  373. const AcDbSubentId& vertexSubentId,
  374. AcGePoint3d& vertexPosition)
  375. {
  376. UNREFERENCED_PARAMETER(pEntity);
  377. UNREFERENCED_PARAMETER(vertexSubentId);
  378. UNREFERENCED_PARAMETER(vertexPosition);
  379. return Acad::eNotImplemented;
  380. }
  381. /// <summary>
  382. /// Gets the curve of an edge subentity. The default implementation
  383. /// just returns Acad::eNotImplemented.
  384. /// </summary>
  385. /// <param name="pEntity"> The entity must be open for read. </param>
  386. /// <param name="edgeSubentId"> Edge AcDbSubentId whose curve is to be obtained. </param>
  387. /// <param name="pEdgeCurve"> Returned curve of the edge subentity (the caller becomes its owner). </param>
  388. /// <returns> Acad::ErrorStatus. </returns>
  389. ///
  390. virtual Acad::ErrorStatus getEdgeSubentityGeometry(const AcDbEntity* pEntity,
  391. const AcDbSubentId& edgeSubentId,
  392. AcGeCurve3d*& pEdgeCurve)
  393. {
  394. UNREFERENCED_PARAMETER(pEntity);
  395. UNREFERENCED_PARAMETER(edgeSubentId);
  396. UNREFERENCED_PARAMETER(pEdgeCurve);
  397. return Acad::eNotImplemented;
  398. }
  399. /// <summary>
  400. /// Gets the surface of a face subentity. The default implementation
  401. /// just returns Acad::eNotImplemented.
  402. /// </summary>
  403. /// <param name="pEntity"> The entity must be open for read. </param>
  404. /// <param name="faceSubentId"> Face AcDbSubentId whose surface is to be changed. </param>
  405. /// <param name="pFaceSurface"> Returned surface of the face subentity (the caller becomes its owner). </param>
  406. /// <returns> Acad::ErrorStatus. </returns>
  407. ///
  408. virtual Acad::ErrorStatus getFaceSubentityGeometry(const AcDbEntity* pEntity,
  409. const AcDbSubentId& faceSubentId,
  410. AcGeSurface*& pFaceSurface)
  411. {
  412. UNREFERENCED_PARAMETER(pEntity);
  413. UNREFERENCED_PARAMETER(faceSubentId);
  414. UNREFERENCED_PARAMETER(pFaceSurface);
  415. return Acad::eNotImplemented;
  416. }
  417. /// <summary>
  418. /// Change the geometry of a vertex subentity. The subentity can also be
  419. /// transformed, but for doing so there already is AcDbEntity protocol so
  420. /// no protocol extension is needed. The default implementation
  421. /// just returns Acad::eNotImplemented.
  422. /// </summary>
  423. /// <param name="pEntity"> The entity must be open for write. </param>
  424. /// <param name="vertexSubentId"> Vertex AcDbSubentId whose position is to be changed. </param>
  425. /// <param name="newVertexPosition"> New coordinates of the vertex subentity. </param>
  426. /// <returns> Acad::ErrorStatus. </returns>
  427. ///
  428. virtual Acad::ErrorStatus setVertexSubentityGeometry(AcDbEntity* pEntity,
  429. const AcDbSubentId& vertexSubentId,
  430. const AcGePoint3d& newVertexPosition)
  431. {
  432. UNREFERENCED_PARAMETER(pEntity);
  433. UNREFERENCED_PARAMETER(vertexSubentId);
  434. UNREFERENCED_PARAMETER(newVertexPosition);
  435. return Acad::eNotImplemented;
  436. }
  437. /// <summary>
  438. /// Change the curve of an edge subentity. The subentity can also be
  439. /// transformed, but for doing so there already is AcDbEntity protocol so
  440. /// no protocol extension is needed. The default implementation
  441. /// just returns Acad::eNotImplemented.
  442. /// </summary>
  443. /// <param name="pEntity"> The entity must be open for write. </param>
  444. /// <param name="edgeSubentId"> Edge AcDbSubentId whose curve is to be changed. </param>
  445. /// <param name="pNewEdgeCurve"> New curve of the edge subentity (copied, not reused). </param>
  446. /// <returns> Acad::ErrorStatus. </returns>
  447. ///
  448. virtual Acad::ErrorStatus setEdgeSubentityGeometry(AcDbEntity* pEntity,
  449. const AcDbSubentId& edgeSubentId,
  450. const AcGeCurve3d* pNewEdgeCurve)
  451. {
  452. UNREFERENCED_PARAMETER(pEntity);
  453. UNREFERENCED_PARAMETER(edgeSubentId);
  454. UNREFERENCED_PARAMETER(pNewEdgeCurve);
  455. return Acad::eNotImplemented;
  456. }
  457. /// <summary>
  458. /// Change the surface of a face subentity. The subentity can also be
  459. /// transformed, but for doing so there already is AcDbEntity protocol so
  460. /// no protocol extension is needed. The default implementation
  461. /// just returns Acad::eNotImplemented.
  462. /// </summary>
  463. /// <param name="pEntity"> The entity must be open for write. </param>
  464. /// <param name="faceSubentId"> Face AcDbSubentId whose surface is to be changed. </param>
  465. /// <param name="pNewFaceSurface"> New surface of the face subentity (copied, not reused). </param>
  466. /// <returns> Acad::ErrorStatus. </returns>
  467. ///
  468. virtual Acad::ErrorStatus setFaceSubentityGeometry(AcDbEntity* pEntity,
  469. const AcDbSubentId& faceSubentId,
  470. const AcGeSurface* pNewFaceSurface)
  471. {
  472. UNREFERENCED_PARAMETER(pEntity);
  473. UNREFERENCED_PARAMETER(faceSubentId);
  474. UNREFERENCED_PARAMETER(pNewFaceSurface);
  475. return Acad::eNotImplemented;
  476. }
  477. /// <summary><para>
  478. /// Gets the geometry of a subentity.
  479. /// </para><para>
  480. /// For AcDb::kFaceSubentTpe, AcDb::kEdgeSubentType, AcDb::kVertexSubentType the default
  481. /// implementation calls getFace/Edge/VertexSubentityGeometry(). For other subentity types
  482. /// the default implementation returns Acad::eNotImplemented.
  483. /// </para></summary>
  484. /// <remarks>
  485. /// Geometry of a vertex subentity is returned in an AcGePosition3d object.
  486. /// </remarks>
  487. /// <param name="pEntity"> The entity must be open for read. </param>
  488. /// <param name="subentId"> AcDbSubentId whose geometry is to be obtained. </param>
  489. /// <param name="pSubentityGeometry"> Returned geometry of the subentity. </param>
  490. /// <returns> Acad::ErrorStatus. </returns>
  491. ///
  492. virtual Acad::ErrorStatus getSubentityGeometry(const AcDbEntity* pEntity,
  493. const AcDbSubentId& subentId,
  494. AcGeEntity3d*& pSubentityGeometry);
  495. /// <summary><para>
  496. /// Changes the geometry of a subentity.
  497. /// </para><para>
  498. /// For AcDb::kFaceSubentTpe, AcDb::kEdgeSubentType, AcDb::kVertexSubentType the default
  499. /// implementation calls setFace/Edge/VertexSubentityGeometry(). For other subentity types
  500. /// the default implementation returns Acad::eNotImplemented.
  501. /// </para></summary>
  502. /// <remarks>
  503. /// Geometry of a vertex subentity is passed in as an AcGePosition3d object.
  504. /// </remarks>
  505. /// <param name="pEntity"> The entity must be open for write. </param>
  506. /// <param name="subentId"> AcDbSubentId whose geometry is to be changed. </param>
  507. /// <param name="pNewSubentityGeometry"> New geometry of the subentity (copied, not reused). </param>
  508. /// <returns> Acad::ErrorStatus. </returns>
  509. ///
  510. virtual Acad::ErrorStatus setSubentityGeometry(AcDbEntity* pEntity,
  511. const AcDbSubentId& subentId,
  512. const AcGeEntity3d* pNewSubentityGeometry);
  513. /// <summary><para>
  514. /// Gets silhouette curves of a face at the given projection. If transientSilhIds is empty,
  515. /// it returns all of them because it is the way silhouettes are usually evaluated by the
  516. /// modeling system. If transientSilhIds contains transient ids of some silhouettes,
  517. /// it only returns silhouette curves for these silhouettes of the face.
  518. /// </para><para>
  519. /// The transientSilhIds are relative to the given face and the given projection,
  520. /// not global for the whole entity.
  521. /// </para><para>
  522. /// The default implementation just clears the output silhCurves array and returns Acad::eNotImplemented.
  523. /// </para></summary>
  524. /// <param name="pEntity"> The entity must be open for write (in case it needs to do some caching). </param>
  525. /// <param name="pContext"> Additional context info that may be needed. Its meaning is client-specific. </param>
  526. /// <param name="pEntityTransform"> Optional transform of the entity (may be NULL). </param>
  527. /// <param name="faceSubentId"> Face AcDbSubentId whose silhouette curves are to be obtained. </param>
  528. /// <param name="pProjector"> Current projection parameters. Silhouettes are view-dependent. </param>
  529. /// <param name="transientSilhIds"><para>
  530. /// If the paassed-in array is empty, it is used as an output argument to return ids
  531. /// of all the returned silhouette curves. The ids are transient, i.e. when the entity
  532. /// changes, different ids may be returned.
  533. /// </para><para>
  534. /// If the passed-in array is not empty, it is used as an input argument specifying which
  535. /// sihouette curves to return.
  536. /// </para><para>
  537. /// Id 0 is reserved and means null id, and must not be used as a transient id of a valid silhouette.
  538. /// </para></param>
  539. /// <param name="silhCurves">
  540. /// Returned face silhouette curves (the caller becomes their owner).
  541. /// The length of the silhCurves and silhIds arrays must be the same.
  542. /// </param>
  543. /// <returns> Acad::ErrorStatus. </returns>
  544. ///
  545. virtual Acad::ErrorStatus getFaceSilhouetteGeometry(AcDbEntity* pEntity,
  546. AcRxObject* pContext,
  547. const AcDbSubentId& faceSubentId,
  548. const AcGeMatrix3d* pEntityTransform,
  549. class AcDbGeometryProjector* pGeometryProjector,
  550. AcArray<int>& transientSilhIds, // Either in or out argument
  551. AcArray<AcGeCurve3d*>& silhCurves)
  552. {
  553. UNREFERENCED_PARAMETER(pEntity);
  554. UNREFERENCED_PARAMETER(pContext);
  555. UNREFERENCED_PARAMETER(faceSubentId);
  556. UNREFERENCED_PARAMETER(pEntityTransform);
  557. UNREFERENCED_PARAMETER(pGeometryProjector);
  558. UNREFERENCED_PARAMETER(transientSilhIds);
  559. silhCurves.removeAll();
  560. return Acad::eNotImplemented;
  561. }
  562. /// <summary><para>
  563. /// Returns a persistent silhouette id for the given transient silhouette id of a face.
  564. /// Notice that a transient silhouette id is just an integer number but a persistent
  565. /// silhouette id is a complete AcDbAssocPersSubentId object.
  566. /// </para><para>
  567. /// The transientSilhId is relative to the given face and the given projection,
  568. /// not global for the whole entity.
  569. /// </para><para>
  570. /// Id 0 is reserved and means null id, and must not be used as a transient id of a valid silhouette.
  571. /// </para><para>
  572. /// The default implementation just returns NULL.
  573. /// </para></summary>
  574. /// </summary>
  575. /// <param name="pEntity"> The entity must be open for write (in case it needs to do some caching). </param>
  576. /// <param name="pDatabase">
  577. /// The database that the AcDbAssocPersSubentId belongs to. It may be a different
  578. /// database than the database of the given AcDbEntity when the entity is in an XREF
  579. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  580. /// If the database pointer is NULL, the database of the entity is used.
  581. /// </param>
  582. /// <param name="pContext"> Additional context info that may be needed. Its meaning is client-specific. </param>
  583. /// <param name="compId"> Contains optional full context path to pEntity. Can be empty for simple reference. </param>
  584. /// <param name="pEntityTransform"> Optional transform of the entity (may be NULL). </param>
  585. /// <param name="faceSubentId"> Face AcDbSubentId whose persistent silhouette id is to be obtained. </param>
  586. /// <param name="pProjector"> Current projection parameters. Silhouettes are view-dependent. </param>
  587. /// <param name="transientSilhId"> Transient id of a silhouette of a face </param>
  588. /// <returns> Persistent silhouette id, or 0 if cannot be created. </returns>
  589. ///
  590. virtual AcDbAssocPersSubentId* createNewPersFaceSilhouetteId(AcDbEntity* pEntity,
  591. AcDbDatabase* pDatabase,
  592. AcRxObject* pContext,
  593. const AcDbCompoundObjectId& /*compId*/,
  594. const AcDbSubentId& faceSubentId,
  595. const AcGeMatrix3d* pEntityTransform,
  596. class AcDbGeometryProjector* pGeometryProjector,
  597. int transientSilhId)
  598. {
  599. UNREFERENCED_PARAMETER(pEntity);
  600. UNREFERENCED_PARAMETER(pDatabase);
  601. UNREFERENCED_PARAMETER(pContext);
  602. UNREFERENCED_PARAMETER(faceSubentId);
  603. UNREFERENCED_PARAMETER(pEntityTransform);
  604. UNREFERENCED_PARAMETER(pGeometryProjector);
  605. UNREFERENCED_PARAMETER(transientSilhId);
  606. return NULL;
  607. }
  608. /// <summary><para>
  609. /// Returns all transient silhouette ids for the given persistent silhouette id of a face.
  610. /// Notice that a transient silhouette id is just an integer number but a persistent
  611. /// silhouette id is a complete AcDbAssocPersSubentId object.
  612. /// </para><para>
  613. /// The transientSilhId is relative to the given face and the given projection,
  614. /// not global for the whole entity.
  615. /// </para><para>
  616. /// Id 0 is reserved and means null id, and must not be used as a transient id of a valid silhouette.
  617. /// </para><para>
  618. /// The default implementation just clears the output transientSilhIds array and returns Acad::eNotImplemented.
  619. /// </para></summary>
  620. /// </summary>
  621. /// <param name="pEntity"> The entity must be open for write (in case it needs to do some caching). </param>
  622. /// <param name="pDatabase">
  623. /// The database that the AcDbAssocPersSubentId belongs to. It may be a different
  624. /// database than the database of the given AcDbEntity when the entity is in an XREF
  625. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  626. /// If the database pointer is NULL, the database of the entity is used.
  627. /// </param>
  628. /// <param name="pContext"> Additional context info that may be needed. Its meaning is client-specific. </param>
  629. /// <param name="pEntityTransform"> Optional transform of the entity (may be NULL). </param>
  630. /// <param name="faceSubentId"> Face AcDbSubentId whose persistent silhouette id is to be obtained. </param>
  631. /// <param name="pProjector"> Current projection parameters. Silhouettes are view-dependent. </param>
  632. /// <param name="pPersSilhId"> Persistent id of a silhouette of a face. </param>
  633. /// <param name="transientSilhIds">
  634. /// All transient ids of a silhouette of a face that correspond to the given persistentSilhId.
  635. /// </param>
  636. /// <returns> Persistent silhouette id, or 0 if cannot be obtained. </returns>
  637. ///
  638. virtual Acad::ErrorStatus getTransientFaceSilhouetteIds(AcDbEntity* pEntity,
  639. AcDbDatabase* pDatabase,
  640. AcRxObject* pContext,
  641. const AcDbSubentId& faceSubentId,
  642. const AcGeMatrix3d* pEntityTransform,
  643. class AcDbGeometryProjector* pGeometryProjector,
  644. const AcDbAssocPersSubentId* pPersSilhId,
  645. AcArray<int>& transientSilhIds)
  646. {
  647. UNREFERENCED_PARAMETER(pEntity);
  648. UNREFERENCED_PARAMETER(pDatabase);
  649. UNREFERENCED_PARAMETER(pContext);
  650. UNREFERENCED_PARAMETER(faceSubentId);
  651. UNREFERENCED_PARAMETER(pEntityTransform);
  652. UNREFERENCED_PARAMETER(pGeometryProjector);
  653. UNREFERENCED_PARAMETER(pPersSilhId);
  654. transientSilhIds.removeAll();
  655. return Acad::eNotImplemented;
  656. }
  657. /// <summary>
  658. /// Call this method to obtain block transformation matrix for a given
  659. /// sub-entity within the block reference.
  660. /// </summary>
  661. /// <param name="pEntity"> The entity must be open for read. </param>
  662. /// <param name="fullSubentPath">
  663. /// Full path of the sub-entity whose collective transformation matrix is
  664. /// to be determined.
  665. /// </param>
  666. /// <param name="trans"> Output block transformation matrix. </param>
  667. /// <returns> Acad::ErrorStatus. </returns>
  668. ///
  669. virtual Acad::ErrorStatus getSubentGeometryXform(const AcDbEntity* pEntity,
  670. const AcDbObjectIdArray& fullSubentPath,
  671. AcGeMatrix3d& trans) const
  672. {
  673. UNREFERENCED_PARAMETER(pEntity);
  674. UNREFERENCED_PARAMETER(fullSubentPath);
  675. UNREFERENCED_PARAMETER(trans);
  676. trans.setToIdentity();
  677. return Acad::eOk;
  678. }
  679. /// <summary> <para>
  680. /// Mirrors the given AcDbAssocPersSubentId, i.e. it changes it so that it
  681. /// identitifies the same subentity in the mirrored entity as it identified
  682. /// before the entity has been mirrored. It is called from the default
  683. /// implementation of the AcDbAssocPersSubentId::mirror() method.
  684. /// </para> <para>
  685. /// The default implementation is a no-op, but some derived AcDbAssocPersSubentIdPE
  686. /// protocol extension classes (such as AcDbAssocArcPersSubentIdPE) may need
  687. /// to override this method.
  688. /// </para> </summary>
  689. /// <param name="pMirroredEntity">
  690. /// The entity that has been mirrored. It needs to be open for read.
  691. /// </param>
  692. /// <param name="pDatabase">
  693. /// The database that the AcDbAssocPersSubentId belongs to. It may be a different
  694. /// database than the database of the given AcDbEntity when the entity is in an XREF
  695. /// database but the AcDbAssocPersSubentId is owned by an object in the host database.
  696. /// If the database pointer is NULL, the database of the entity is used.
  697. /// </param>
  698. /// <param name="pPersSubentIdToMirror">
  699. /// The AcDbAssocPersSubentId to be changed to reflect the fact that the
  700. /// entity has been mirrored.
  701. /// </param>
  702. /// <returns> Acad::ErrorStatus. </returns>
  703. ///
  704. virtual Acad::ErrorStatus mirrorPersSubent(const AcDbEntity* pMirroredEntity,
  705. AcDbDatabase* pDatabase,
  706. AcDbAssocPersSubentId* pPersSubentIdToMirror)
  707. {
  708. UNREFERENCED_PARAMETER(pMirroredEntity);
  709. UNREFERENCED_PARAMETER(pDatabase);
  710. UNREFERENCED_PARAMETER(pPersSubentIdToMirror);
  711. return Acad::eOk;
  712. }
  713. /// <summary>
  714. /// Returns kScalableRigidSet or kNonScalableRigidSet if the entity is a rigid
  715. /// set, i.e. it can be rotated and translated as a whole, but its subentities
  716. /// cannot be individually changed.
  717. /// The default implementation returns kNotRigidSet.
  718. /// </summary>
  719. /// <param name="pEntity"> The entity must be open for read. </param>
  720. /// <returns> kScalableRigidSet or kNonScalableRigidSet if the entity is a rigid set. </returns>
  721. ///
  722. virtual int getRigidSetState(const AcDbEntity* pEntity) {
  723. UNREFERENCED_PARAMETER(pEntity);
  724. return kNotRigidSet;
  725. }
  726. /// <summary>
  727. /// Get the transformation of the rigid set entity.
  728. /// The default implementation returns Acad::eNotApplicable.
  729. /// </summary>
  730. /// <param name="pEntity"> The entity must be open for read. </param>
  731. /// <param name="trans"> The returned transformation matrix. </param>
  732. /// <returns> Acad::ErrorStatus. </returns>
  733. ///
  734. virtual Acad::ErrorStatus getRigidSetTransform(const AcDbEntity* pEntity,
  735. AcGeMatrix3d& trans)
  736. {
  737. UNREFERENCED_PARAMETER(pEntity);
  738. UNREFERENCED_PARAMETER(trans);
  739. return Acad::eNotApplicable;
  740. }
  741. /// <summary>
  742. /// Set the transformation of the rigid set entity.
  743. /// The default implementation returns Acad::eNotApplicable.
  744. /// </summary>
  745. /// <param name="pEntity"> The entity must be open for write. </param>
  746. /// <param name="trans"> New transformation matrix of the rigid set entity. </param>
  747. /// <returns> Acad::ErrorStatus. </returns>
  748. ///
  749. virtual Acad::ErrorStatus setRigidSetTransform(AcDbEntity* pEntity,
  750. const AcGeMatrix3d& trans)
  751. {
  752. UNREFERENCED_PARAMETER(pEntity);
  753. UNREFERENCED_PARAMETER(trans);
  754. return Acad::eNotApplicable;
  755. }
  756. }; // class AcDbAssocPersSubentIdPE
  757. #pragma pack (pop)