AcDbGeomRef.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  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 October 2009
  12. //
  13. //////////////////////////////////////////////////////////////////////////////
  14. #pragma once
  15. #include "AcDbAssocGlobal.h"
  16. #include "gemat3d.h"
  17. #include "AcDbCompoundObjectId.h"
  18. #pragma pack (push, 8)
  19. /// <summary><para>
  20. /// Base class for the concrete derived classes like AcDbFaceRef, AcDbEdgeRef,
  21. /// AcDbVertexRef, and AcDbPathRef. These are simple classes that keep a reference
  22. /// to a subentity of an entity and can represent this subentity information in
  23. /// various ways. They are used mainly to pass around information about geometry
  24. /// of a subentity or of an entity, not to keep this information.
  25. /// </para><para>
  26. /// The subentity references are non-presistent. Anytime the referenced entity
  27. /// is changed or re-evaluated, the subentity reference becomes invalid.
  28. /// Persistent references can be established using AcDbAssocEdgeActionParam,
  29. /// AcDbAssocPathActionParam, AcDbAssocVertexActionParam, or directly using
  30. /// AcDbAssocGeomDependencies.
  31. /// </para></summary>
  32. ///
  33. class ACDB_PORT AcDbGeomRef : public AcRxObject
  34. {
  35. public:
  36. ACRX_DECLARE_MEMBERS(AcDbGeomRef);
  37. virtual ~AcDbGeomRef() {}
  38. /// <summary> Resets the contents of the AcDbGeomRef to empty. </summary>
  39. ///
  40. virtual void reset() = 0;
  41. /// <summary> Checks is the contents of this AcDbGeomRef is valid. </summary>
  42. ///
  43. virtual bool isValid() const = 0;
  44. /// <summary>
  45. /// Checks if the AcDbGeomRef is empty, i.e. not referencing any entity,
  46. /// subentity, and not holding any constant geometry.
  47. /// </summary>
  48. ///
  49. virtual bool isEmpty() const = 0;
  50. /// <summary>
  51. /// Creates a new non-database resident AcDbEntity from the data the AcDbGeomRef
  52. /// holds, and returns it to the caller. The caller is responsible for deleting
  53. /// the entity after it is no more needed.
  54. /// </summary>
  55. ///
  56. virtual AcDbEntity* createEntity() const = 0;
  57. /// <summary>
  58. /// If the AcDbGeomRef references some entities and also caches the constant
  59. /// geometry, this method evaluates the current geometry from the referenced
  60. /// entities and caches it in the constant geometry.
  61. /// </summary>
  62. ///
  63. virtual Acad::ErrorStatus evaluateAndCacheGeometry() = 0;
  64. };
  65. /// <summary><para>
  66. /// Base class for AcDbFaceRef, AcDbEdgeRef and AcDbVertexRef. It keeps an
  67. /// AcDbCompoundObjectId of an AcDbEntity and AcDbSubentId of a subentity of
  68. /// this entity.
  69. /// </para></summary>
  70. ///
  71. class ACDB_PORT AcDbSubentRef : public AcDbGeomRef
  72. {
  73. public:
  74. ACRX_DECLARE_MEMBERS(AcDbSubentRef);
  75. /// <summary> Default constructor. </summary>
  76. ///
  77. AcDbSubentRef() {}
  78. /// <summary> The constructor sets data members of the AcDbSubentRef. </summary>
  79. ///
  80. explicit AcDbSubentRef(const AcDbCompoundObjectId&, const AcDbSubentId& = kNullSubentId);
  81. AcDbSubentRef& operator =(const AcDbSubentRef&);
  82. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  83. virtual void reset();
  84. virtual bool isEmpty() const { return mEntityId.isEmpty(); }
  85. /// <summary>
  86. /// Returns the AcDbCompoundObjectId of the entity that the AcDbSubentRef references.
  87. /// May be empty if a derived class holds constant geometry and does not
  88. /// reference any existing AcDbEntity.
  89. /// </summary>
  90. ///
  91. virtual const AcDbCompoundObjectId& entity() const;
  92. /// <summary>
  93. /// Returns the AcDbSubentId in an AcDbEntity that the AcDbSubentRef references.
  94. /// May be null if whole AcDbEntity is referenced.
  95. /// </summary>
  96. ///
  97. virtual AcDbSubentId subentId() const;
  98. /// <summary>
  99. /// Creates an AcDbEntity from the subentity of the entity.
  100. /// </summary>
  101. ///
  102. virtual AcDbEntity* createEntity() const;
  103. /// <summary>
  104. /// No cached constant geoemtry held in AcDbSubentRef base class.
  105. /// </summary>
  106. ///
  107. virtual Acad::ErrorStatus evaluateAndCacheGeometry() { return Acad::eOk; }
  108. protected:
  109. /// <summary> Sets mEntity data member. </summary>
  110. ///
  111. void setEntity(const AcDbCompoundObjectId& entityId) { mEntityId = entityId; }
  112. /// <summary> Sets mSubentId data member. </summary>
  113. ///
  114. void setSubent(const AcDbSubentId& subentId) { mSubentId = subentId; }
  115. /// <summary> Sets mEntity and mSubentId data members. </summary>
  116. ///
  117. void setFromSubentPath(const AcDbFullSubentPath&);
  118. private:
  119. AcDbCompoundObjectId mEntityId;
  120. AcDbSubentId mSubentId;
  121. };
  122. /// <summary>
  123. /// Reference to a face. It can either be represented by a face AcDbSubentId of
  124. /// an ASM-based AcDbEntity (AcDbSurface, AcDb3dSolid, AcDbRegion) or by
  125. /// a constant ASM BODY and the AcDbSubentId then specifies the index of the
  126. /// face in the constant ASM BODY.
  127. /// </summary>
  128. ///
  129. class ACDB_PORT AcDbFaceRef : public AcDbSubentRef
  130. {
  131. #ifdef __GNUC__
  132. private:
  133. typedef AcDbSubentRef __super;
  134. #endif
  135. public:
  136. ACRX_DECLARE_MEMBERS(AcDbFaceRef);
  137. /// <summary> Default constructor. </summary>
  138. ///
  139. AcDbFaceRef();
  140. AcDbFaceRef(const AcDbFaceRef&);
  141. virtual ~AcDbFaceRef();
  142. /// <summary>
  143. /// The constructor sets the data members of the AcDbFaceRef. The provided
  144. /// ASM BODY is not copied, the caller is responsible for providing a copy,
  145. /// if needed.
  146. /// </summary>
  147. ///
  148. explicit AcDbFaceRef(const AcDbCompoundObjectId&, const AcDbSubentId& = kNullSubentId, class BODY* = NULL);
  149. AcDbFaceRef& operator =(const AcDbFaceRef&);
  150. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  151. virtual void reset();
  152. virtual bool isValid() const;
  153. virtual bool isEmpty() const { return __super::isEmpty() && mpAsmBody == NULL; }
  154. /// <summary>
  155. /// Returns the ASM BODY that the AcDbFaceRef may hold. It does not return a
  156. /// copy of the ASM BODY, therefore the client code needs to make a copy if
  157. /// it needs to do any modifications to this ASM BODY.
  158. /// </summary>
  159. ///
  160. class BODY* asmBody() const { return mpAsmBody; }
  161. /// <summary>
  162. /// Creates a new non-database resident AcDbEntity from the data the AcDbFaceRef
  163. /// holds, and returns it to the caller. The caller is responsible for deleting
  164. /// the entity after it is no more needed.
  165. /// </summary>
  166. ///
  167. virtual AcDbEntity* createEntity() const;
  168. /// <summary>
  169. /// For now this method does nothing.
  170. /// </summary>
  171. ///
  172. virtual Acad::ErrorStatus evaluateAndCacheGeometry() { return Acad::eOk; }
  173. private:
  174. class BODY* mpAsmBody;
  175. };
  176. /// <summary><para>
  177. /// Reference to an edge, i.e. a subentity whose geometry is a simple curve.
  178. /// </para><para>
  179. /// It may either be the whole entity that itself is a single curve, kEdgeSubentType
  180. /// subentity of an entity, or a constant AcGeCurve3d. Notice that this reference
  181. /// is generally non-persistent, because it uses transient AcDbSubentId.
  182. /// </para><para>
  183. /// The option to reference the whole entity is questionable and has been provided
  184. /// just for the compatibility with old code that takes the whole entity. We should
  185. /// probably always represent edges by kEdgeSubentType subentities of entities, even
  186. /// if the whole entity is just a single edge, such as line, arc, or circle.
  187. /// </para></summary>
  188. ///
  189. class ACDB_PORT AcDbEdgeRef : public AcDbSubentRef
  190. {
  191. #ifdef __GNUC__
  192. typedef AcDbSubentRef __super;
  193. #endif
  194. public:
  195. ACRX_DECLARE_MEMBERS(AcDbEdgeRef);
  196. /// <summary> Default constructor. </summary>
  197. ///
  198. AcDbEdgeRef();
  199. AcDbEdgeRef(const AcDbEdgeRef&);
  200. virtual ~AcDbEdgeRef();
  201. /// <summary> The constructor sets the data members of the AcDbEdgeRef. </summary>
  202. ///
  203. explicit AcDbEdgeRef(const AcDbCompoundObjectId&,
  204. const AcDbSubentId& edgeSubentId = kNullSubentId,
  205. const AcDbSubentId& faceSubentId = kNullSubentId,
  206. const AcGeCurve3d* pCurve = NULL);
  207. /// <summary>
  208. /// Creates AcDbEdgeRef from an entity in a block table record
  209. /// and referenced via a path of block inserts.
  210. /// </summary>
  211. ///
  212. explicit AcDbEdgeRef(const AcDbFullSubentPath&);
  213. /// <summary>
  214. /// The constructor makes the AcDbEdgeRef keep the AcDbObjectId of the given
  215. /// AcDbEntity. Moreover, if the entity is derived from AcDbCurve, it obtains
  216. /// a copy of the AcGeCurve3d and keeps in it the AcDbEdgeRef.
  217. /// </summary>
  218. ///
  219. explicit AcDbEdgeRef(const AcDbEntity* pEntity);
  220. /// <summary>
  221. /// The constructor makes the AcDbEdgeRef keep the AcGeCurve3d.
  222. /// </summary>
  223. ///
  224. explicit AcDbEdgeRef(const AcGeCurve3d* pGeCurve);
  225. AcDbEdgeRef& operator =(const AcDbEdgeRef&);
  226. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  227. virtual void reset();
  228. virtual bool isValid() const;
  229. virtual bool isEmpty() const { return __super::isEmpty() && mpCurve == NULL; }
  230. /// <summary>
  231. /// The AcDbEdgeRef can also hold AcDbSubentId of a face subentity. The face
  232. /// needs to bounded by the referenced edge subentity. The additional face
  233. /// information is needed in cases like when an edge shared by two adjacent
  234. /// faces is referenced and used for a smooth blend operation. It needs to
  235. /// be known which face to use to create the smooth blend to.
  236. ///</summary>
  237. ///
  238. void setFaceSubentity(const AcDbSubentId& faceSubentId);
  239. /// <summary>
  240. /// Returns the optional face AcDbSubentId of one of the faces adjacent to the
  241. /// referenced edge.
  242. /// </summary>
  243. ///
  244. AcDbSubentId faceSubentId() const { return mFaceSubentId; }
  245. /// <summary>
  246. /// Returns the constant AcGeCurve3d* that the AcDbEdgeRef may hold.
  247. /// </summary>
  248. ///
  249. const AcGeCurve3d* curve() const { return mpCurve; }
  250. /// <summary>
  251. /// Evaluates the curve from the referenced entity geometry. If no entity
  252. /// is referenced, returns the cached curve. The caller is responsible for
  253. /// deleting the returned AcGeCurve3d*
  254. /// </summary>
  255. ///
  256. virtual Acad::ErrorStatus evaluateCurve(AcGeCurve3d*&) const;
  257. /// <summary>
  258. /// Creates a new non-database resident AcDbEntity from then data the AcDbEdgeRef
  259. /// holds, and returns it to the caller. The caller is responsible for deleting
  260. /// the entity after it is no more needed.
  261. /// </summary>
  262. ///
  263. virtual AcDbEntity* createEntity() const;
  264. /// <summary>
  265. /// Calls evaluateCurve() and replaces the current constant AcGeCurve3d* with the
  266. /// newly evaluated curve.
  267. /// </summary>
  268. ///
  269. virtual Acad::ErrorStatus evaluateAndCacheGeometry();
  270. private:
  271. // Deletes the previously stored AcGeCurve3d and sets the constant AcGeCurve3d
  272. // in the AcDbEdgeRef to be a copy of the provided curve. It is allowed to
  273. // pass NULL for the pCurve.
  274. //
  275. // This method is private because we hope it will not be needed by the client
  276. // code. We want to keep AcDbGeomRef methods read-only so that these classes
  277. // do not overgrow their original purpose of simple container classes. If needed,
  278. // the client code can usually make a new AcDbGeomRef from the existing one instead
  279. // of changing the existing one
  280. //
  281. void setCurve(const AcGeCurve3d* pCurve);
  282. AcDbSubentId mFaceSubentId;
  283. AcGeCurve3d* mpCurve;
  284. };
  285. /// <summary>
  286. /// Reference to a vertex, i.e. a subentity whose geometry is a point. It may
  287. /// either be whole AcDbPoint entity, kVertexSubentType subentity of an entity, or
  288. /// a constant AcGePoint3d. Notice that this reference is generally non-persistent,
  289. /// because it uses transient AcDbSubentId.
  290. /// </summary>
  291. ///
  292. class ACDB_PORT AcDbVertexRef : public AcDbSubentRef
  293. {
  294. #ifdef __GNUC__
  295. private:
  296. typedef AcDbSubentRef __super;
  297. #endif
  298. public:
  299. ACRX_DECLARE_MEMBERS(AcDbVertexRef);
  300. /// <summary><para>
  301. /// An implied vertex ref is a special point on another AcDbGeomRef.
  302. /// </para><para>
  303. /// Currently we only have implied vertex ref types for the most common case of
  304. /// special points on an AcDbEdgeRef. I am not sure if we should keep extending this
  305. /// mechanism in the future. Other mechanisms, such as derivation from AcDbVertexRef,
  306. /// should be used for more specialized and/or less common cases.
  307. /// </para></summary>
  308. ///
  309. enum ImpliedType
  310. {
  311. kExplicitVertex, // Not an implied vertex (the vertex is directly specified)
  312. kUnknownType,
  313. kEdgeStart,
  314. kEdgeEnd,
  315. kEdgeMid,
  316. kEdgeCenter,
  317. kEdgeSplineControlPoint,
  318. kEdgeSplineFitPoint,
  319. };
  320. /// <summary> Default constructor. </summary>
  321. ///
  322. AcDbVertexRef();
  323. AcDbVertexRef(const AcDbVertexRef&);
  324. virtual ~AcDbVertexRef();
  325. /// <summary> The constructor sets the data members of the AcDbEdgeRef. </summary>
  326. ///
  327. explicit AcDbVertexRef(const AcDbCompoundObjectId&, const AcDbSubentId& = kNullSubentId, const AcGePoint3d& = AcGePoint3d::kOrigin);
  328. /// <summary>
  329. /// Creates AcDbVertexRef from an entity in a block table record
  330. /// and referenced via a path of block inserts.
  331. /// </summary>
  332. ///
  333. explicit AcDbVertexRef(const AcDbFullSubentPath&);
  334. /// <summary>
  335. /// The constructor makes the AcDbVertexRef keep the AcDbObjectId of the given
  336. /// AcDbEntity. Moreover, if the entity is derived from AcDbPoint, it keeps
  337. /// its AcGePoint3d as AcGePoint3d.
  338. /// </summary>
  339. ///
  340. explicit AcDbVertexRef(const AcDbEntity*);
  341. /// <summary>
  342. /// The constructor makes the AcDbVertexRef keep the AcGePoint3d.
  343. /// </summary>
  344. ///
  345. explicit AcDbVertexRef(const AcGePoint3d&);
  346. /// <summary>
  347. /// Constructor for creating implied vertex refs, i.e. a vertex being defined
  348. /// as being a special point on an AcDbEdgeRef. See more comments at the
  349. /// ImpliedType enum.
  350. /// </summary>
  351. ///
  352. explicit AcDbVertexRef(ImpliedType, const AcDbEdgeRef& edgeRef, int controlOrFitPointIndex = 0, const AcGePoint3d& = AcGePoint3d::kOrigin);
  353. AcDbVertexRef& operator =(const AcDbVertexRef&);
  354. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  355. virtual void reset();
  356. virtual bool isValid() const;
  357. /// <summary>
  358. /// If referencedRef() is not NULL, returns its AcDbCompoundObjectId, otherwise
  359. /// returns AcDbCompoundObjectId from the base-class AcDbSubentRef.
  360. /// </summary>
  361. ///
  362. virtual const AcDbCompoundObjectId& entity() const;
  363. /// <summary>
  364. /// If referencedRef() is not NULL, returns kNussSubentId, otherwise returns
  365. /// AcDbSubentId from the base-class AcDbSubentRef.
  366. ///
  367. /// TODO Jiri kripac:
  368. /// The semantics of this method is questionable and should be revisited
  369. /// because an implied vertex does identify a subentity, but there is no
  370. /// simple AcDbSubentId for it.
  371. /// </summary>
  372. ///
  373. virtual AcDbSubentId subentId() const;
  374. /// <summary>
  375. /// The following are for implied vertex refs (see more comments comments
  376. /// at ImpliedType enum). The returned referenced AcDbGeomRef is currently
  377. /// always an AcDbEdgeRef but we want to keep the protocol general.
  378. /// </summary>
  379. ///
  380. ImpliedType impliedType() const { return mImpliedType; }
  381. const AcDbGeomRef* referencedRef() const { return mpReferencedRef; }
  382. int index() const { return mIndex; }
  383. /// <summary>
  384. /// Returns the AcGePoint3d directly held in the AcDbVertexRef.
  385. /// </summary>
  386. ///
  387. AcGePoint3d point() const;
  388. /// <summary>
  389. /// Evaluates the point from the referenced geometry. If no geometry,
  390. /// returns the cached point coordinates.
  391. /// </summary>
  392. ///
  393. virtual Acad::ErrorStatus evaluatePoint(AcGePoint3d&) const;
  394. /// <summary>
  395. /// Creates a new non-database resident AcDbPoint from then data the AcDbVertexRef
  396. /// holds, and returns it to the caller. The caller is responsible for deleting
  397. /// the AcDbPoint after it is no more needed.
  398. /// </summary>
  399. ///
  400. class AcDbEntity* createEntity()const;
  401. /// <summary>
  402. /// Calls evaluatePoint() and replaces the current constant AcGePoint3d with the
  403. /// newly evaluated point.
  404. /// </summary>
  405. ///
  406. virtual Acad::ErrorStatus evaluateAndCacheGeometry();
  407. private:
  408. // Deletes the previously stored mpReferencedRef and sets it to be a copy
  409. // of the provided AcDbGeomRef. It is allowed to pass NULL for the AcDbGeomRef
  410. //
  411. void setReferencedRef(const AcDbGeomRef*);
  412. // The following are only used when the vertex is an implied vertex on
  413. // some other AcDbSubentRef (i.e. when mType is not kExplicitVertex)
  414. //
  415. ImpliedType mImpliedType;
  416. const AcDbGeomRef* mpReferencedRef;
  417. int mIndex; // Currently only used to indicate spline control/fit point index
  418. AcGePoint3d mPoint;
  419. };
  420. /// <summary>
  421. /// Reference to a path, which is just a sequence of edges. If the path has an
  422. /// array of edges which happen to be connected at their end points, it will try
  423. /// to concatenate the curves into one composite curve.
  424. /// </summary>
  425. ///
  426. class ACDB_PORT AcDbPathRef : public AcDbGeomRef
  427. {
  428. public:
  429. ACRX_DECLARE_MEMBERS(AcDbPathRef);
  430. /// <summary> Default constructor. </summary>
  431. ///
  432. AcDbPathRef();
  433. AcDbPathRef(const AcDbPathRef&);
  434. /// <summary>
  435. /// Creates an AcDbPathRef from a sequence of AcDbEdgeRefs.
  436. /// </summary>
  437. ///
  438. explicit AcDbPathRef(const AcArray<AcDbEdgeRef>&);
  439. /// <summary>
  440. /// Constructor an AcDbPathRef that is a sequence of connected edges.
  441. /// </summary>
  442. /// <param name="edgeSubentPathArr">
  443. /// Subent paths of the edges that make up the path.
  444. /// </param>
  445. /// <param name="faceSubentPathArr">
  446. /// Optional subent paths of the faces for each edge. The number of elements in
  447. /// this array must be 0 or be the same as the number of elements in
  448. /// edgeSubentPathArr.
  449. /// </param>
  450. AcDbPathRef(const AcDbFullSubentPathArray& edgeSubentPathArr,
  451. const AcDbFullSubentPathArray& faceSubentPathArr);
  452. virtual ~AcDbPathRef();
  453. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  454. virtual void reset();
  455. virtual bool isValid() const;
  456. virtual bool isEmpty() const;
  457. /// <summary> Sets the AcDbPathRef from a sequence of AcDbEdgeRefs. </summary>
  458. ///
  459. void setEdgeRefs(const AcArray<AcDbEdgeRef>& edges);
  460. /// <summary>
  461. /// Returns an array of AcDbEntities created from the individual AcDbEdgeRefs
  462. /// in the path. If concatenate is true, it tries to concatenate them.
  463. /// </summary>
  464. ///
  465. Acad::ErrorStatus getEntityArray(AcArray<AcDbEntity*>& entities, bool concatenate) const;
  466. /// <summary> Returns the array of AcDbEdgeRefs kept in the AcDbPathRef. </summary>
  467. ///
  468. const AcArray<AcDbEdgeRef>& edgeRefs() const { return mEdgeRefs; }
  469. /// <summary> Returns true if the geometry of the path is equal to the geometry of the given curve. </summary>
  470. ///
  471. bool isEqualTo(const AcGeCurve3d*);
  472. /// <summary>
  473. /// Returns true if all elements of the path are references to entities, i.e.
  474. /// they are not constant geometries.
  475. /// </summary>
  476. ///
  477. bool isReferencePath();
  478. virtual AcDbEntity* createEntity() const;
  479. /// <summary>
  480. /// Calls evaluateAndCacheGeometry() on all the owned AcDbEdgeRefs.
  481. /// </summary>
  482. ///
  483. virtual Acad::ErrorStatus evaluateAndCacheGeometry();
  484. private:
  485. AcArray<AcDbEdgeRef> mEdgeRefs;
  486. };
  487. /// <summary>
  488. /// Arbitrary 3D vector, of any length.
  489. /// </summary>
  490. /// <remarks> For internal use only. </remarks>
  491. ///
  492. class ACDB_PORT AcDbVectorRef : public AcDbGeomRef
  493. {
  494. #ifdef __GNUC__
  495. private:
  496. typedef AcDbGeomRef __super;
  497. #endif
  498. public:
  499. ACRX_DECLARE_MEMBERS(AcDbVectorRef);
  500. explicit AcDbVectorRef();
  501. explicit AcDbVectorRef(const AcDbVectorRef&);
  502. explicit AcDbVectorRef(const AcGeVector3d&);
  503. virtual ~AcDbVectorRef();
  504. AcDbVectorRef& operator = (const AcDbVectorRef&);
  505. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  506. virtual void reset();
  507. virtual bool isValid() const;
  508. virtual bool isEmpty() const;
  509. const AcGeVector3d vector() const { return mVector; }
  510. void set(const AcGeVector3d&);
  511. /// <summary>
  512. /// TBD
  513. /// </summary>
  514. ///
  515. virtual AcDbEntity* createEntity() const;
  516. /// <summary>
  517. /// TBD
  518. /// </summary>
  519. ///
  520. virtual Acad::ErrorStatus evaluateAndCacheGeometry();
  521. private:
  522. AcGeVector3d mVector;
  523. };
  524. /// <summary>
  525. /// Coordinate system, actually an arbitrary matrix. The axes do not need to be
  526. /// unit lengths, perpendicular, or form right-hand coord system (may be mirrored).
  527. /// </summary>
  528. /// <remarks> For internal use only. </remarks>
  529. ///
  530. class ACDB_PORT AcDbCoordSystemRef : public AcDbGeomRef
  531. {
  532. #ifdef __GNUC__
  533. typedef AcDbGeomRef __super;
  534. #endif
  535. public:
  536. ACRX_DECLARE_MEMBERS(AcDbCoordSystemRef);
  537. explicit AcDbCoordSystemRef();
  538. explicit AcDbCoordSystemRef(const AcDbCoordSystemRef&);
  539. explicit AcDbCoordSystemRef(const AcGeMatrix3d&);
  540. explicit AcDbCoordSystemRef(const AcDbCompoundObjectId&, const AcGeMatrix3d&);
  541. explicit AcDbCoordSystemRef(const AcArray<AcDbSubentRef*>&);
  542. virtual ~AcDbCoordSystemRef();
  543. AcDbCoordSystemRef& operator = (const AcDbCoordSystemRef&);
  544. virtual Acad::ErrorStatus copyFrom(const AcRxObject*);
  545. virtual void reset();
  546. virtual bool isValid() const;
  547. virtual bool isEmpty() const;
  548. const AcGeMatrix3d& coordSystem() const { return mCoordSystem; }
  549. const AcDbCompoundObjectId& entityId () const { return mEntityId; }
  550. const AcArray<AcDbSubentRef*>& subentRefs () const { return mSubentRefs; }
  551. void set(const AcGeMatrix3d&);
  552. void set(const AcDbCompoundObjectId&);
  553. void set(const AcArray<AcDbSubentRef*>&);
  554. /// <summary>
  555. /// There is no AcDbEntity created from AcDbCoordSystemRef.
  556. /// </summary>
  557. ///
  558. virtual AcDbEntity* createEntity() const { return NULL; }
  559. /// <summary>
  560. /// Calls evaluateAndCacheGeometry on all owned AcDbSubentRefs and then updates
  561. /// the cached coordinate system.
  562. /// </summary>
  563. ///
  564. virtual Acad::ErrorStatus evaluateAndCacheGeometry();
  565. private:
  566. AcGeMatrix3d mCoordSystem;
  567. AcDbCompoundObjectId mEntityId;
  568. AcArray<AcDbSubentRef*> mSubentRefs;
  569. };
  570. #pragma pack (pop)