CFx SDK Documentation  2023 SP0
IfcEntity.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2019, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Open Design Alliance software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Open Design Alliance Copyright (C) 2002-2019 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _IFC_ENTITY_H_
25 #define _IFC_ENTITY_H_
26 
27 #include "DbHandle.h"
28 #include "IfcCommon.h"
29 #include "IfcBuildOptions.h"
30 #include "IfcEntityTypes.h"
31 #include "IfcAttributesEnum.h"
32 #include "daiObjectId.h"
33 #include "daiAny.h"
34 #include "daiEntityInstance.h"
35 #include "daiEntity.h"
36 #include "daiModel.h"
37 
38 #include "Ge/GePoint2d.h"
39 #include "Ge/GePoint3d.h"
40 #include "Ge/GeVector2d.h"
41 #include "Ge/GeVector3d.h"
42 #include "Ge/GeMatrix2d.h"
43 #include "Ge/GeMatrix3d.h"
44 #include "CmColorBase.h"
45 
46 #define STL_USING_LIMITS
47 #include "OdaSTL.h"
48 
52 namespace OdIfc {
53 
58  {
59  kUnresolved = 0, // Unresolved operation.
60  kResVisited = 1, // No appropriate compound object exists for the entity instance.
61  kResPoint2d, // The entity is composed as an <exref target="https://docs.opendesign.com/tkernel/OdGePoint2d.html">OdGePoint2d</exref> object.
62  kResPoint3d, // The entity is composed as an <exref target="https://docs.opendesign.com/tkernel/OdGePoint3d.html">OdGePoint3d</exref> object.
63  kResVector2d, // The entity is composed as an <exref target="https://docs.opendesign.com/tkernel/OdGeVector2d.html">OdGeVector2d</exref> object.
64  kResVector3d, // The entity is composed as an <exref target="https://docs.opendesign.com/tkernel/OdGeVector3d.html">OdGeVector3d</exref> object.
65  kResMatrix2d, // The entity is composed as an <exref target="https://docs.opendesign.com/tkernel/OdGeMatrix2d.html">OdGeMatrix2d</exref> object.
66  kResMatrix3d, // The entity is composed as an <exref target="https://docs.opendesign.com/tkernel/OdGeMatrix3d.html">OdGeMatrix3d</exref> object.
67  kRgbColor, // The entity is composed as an RGB color value.
68  kResCompound, // The entity has attached a compound object.
69  kResError // An error occurred during the compose operation.
70  };
71 
72  class OdIfcModelContents;
73  class OdIfcCompound;
74 
79 
84  {
85  public:
86 
87  //DOM-IGNORE-BEGIN
89  //DOM-IGNORE-END
90 
95 
102 
108  virtual bool isKindOf(OdIfcEntityType entityType) const;
109 
115  virtual bool isInstanceOf(OdIfcEntityType entityType) const;
116 
121  virtual OdIfcEntityType type() const = 0;
122 
131  virtual OdRxValue getAttr(const OdAnsiString &attrName) const;
132 
141  virtual OdRxValue getAttr(const OdIfcAttribute attrDef) const;
142 
148  virtual bool testAttr(const OdAnsiString &explicitAttrName) const;
149 
155  virtual bool testAttr(const OdIfcAttribute explicitAttrDef) const;
156 
161  virtual void unsetAttr(const OdAnsiString &explicitAttrName);
162 
167  virtual void unsetAttr(const OdIfcAttribute explicitAttrDef);
168 
175  virtual bool putAttr(const OdAnsiString &explicitAttrName, const OdRxValue &val);
176 
183  virtual bool putAttr(const OdIfcAttribute explicitAttrDef, const OdRxValue &val);
184 
189  IfcOpResult resolved() { return m_resolved; };
190 
196  void resolve(IfcOpResult resolved, void *resPtr)
197  {
199  ((resolved == kUnresolved || resolved == kResVisited) && !resPtr)
200  || resPtr);
201  m_resolved = resolved;
202  m_resPtr = resPtr;
203  };
204 
215  if (pEnt->m_resolved == kResPoint3d || pEnt->m_resolved == kResPoint2d)
216  return reinterpret_cast<OdGePoint3d*>(pEnt->m_resPtr);
217  ODA_ASSERT(0);
218  return NULL;
219  };
220 
231  if (pEnt->m_resolved == kResPoint3d || pEnt->m_resolved == kResPoint2d)
232  return reinterpret_cast<OdGePoint2d*>(pEnt->m_resPtr);
233  ODA_ASSERT(0);
234  return NULL;
235  };
236 
247  if (pEnt->m_resolved == kResVector3d || pEnt->m_resolved == kResVector2d)
248  return reinterpret_cast<OdGeVector3d*>(pEnt->m_resPtr);
249  ODA_ASSERT(0);
250  return NULL;
251  };
252 
263  if (pEnt->m_resolved == kResVector3d || pEnt->m_resolved == kResVector2d)
264  return reinterpret_cast<OdGeVector2d*>(pEnt->m_resPtr);
265  ODA_ASSERT(0);
266  return NULL;
267  };
268 
278  if (pEnt->m_resolved == kResMatrix2d)
279  return reinterpret_cast<OdGeMatrix2d*>(pEnt->m_resPtr);
280  ODA_ASSERT(0);
281  return NULL;
282  };
283 
293  if (pEnt->m_resolved == kResMatrix3d)
294  return reinterpret_cast<OdGeMatrix3d*>(pEnt->m_resPtr);
295  ODA_ASSERT(0);
296  return NULL;
297  };
298 
299  /*OdGeCurve2d* asCurve2d() {
300  if (m_resolved == kResCurve2d)
301  return reinterpret_cast<OdGeCurve2d*>(m_resPtr);
302  ODA_ASSERT(0);
303  return NULL;
304  }
305 
306  OdGeCurve3d* asCurve3d() {
307  if (m_resolved == kResCurve3d)
308  return reinterpret_cast<OdGeCurve3d*>(m_resPtr);
309  ODA_ASSERT(0);
310  return NULL;
311  }*/
312 
322 
332  if (pEnt->m_resolved == kRgbColor)
333  return reinterpret_cast<OdCmEntityColor*>(pEnt->m_resPtr);
334  ODA_ASSERT(0);
335  return NULL;
336  }
337 
342  virtual void setGsNode(OdGsCache* pGsNode);
343 
348  virtual OdGsCache* gsNode() const;
349 
356 
362  virtual bool subWorldDraw(OdGiWorldDraw * wd) const;
363 
364 //DOM-IGNORE-BEGIN
365  protected:
366 
367  void *m_resPtr;
369 
370  private:
371 
372  void* asCustom() const { return m_resPtr; }
373 
374  friend class OdIfcCompound;
375  friend class OdIfcModelContents;
376 //DOM-IGNORE-END
377  };
378 
383 
384 } //namespace OdIfc
385 
386 #endif // _IFC_ENTITY_H_
#define ODA_ASSERT_ONCE(exp)
Definition: DebugStuff.h:51
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:49
#define NULL
Definition: GsProperties.h:177
#define IFCCORE_EXPORT
unsigned int OdUInt32
ODRX_DECLARE_MEMBERS(OdIfcEntity)
static OdGeMatrix2d * asMatrix2d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:277
static OdGeVector3d * asVector3d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:246
virtual OdIfcEntityType type() const =0
static OdGePoint3d * asPoint3d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:214
virtual bool putAttr(const OdIfcAttribute explicitAttrDef, const OdRxValue &val)
virtual void setGsNode(OdGsCache *pGsNode)
static OdCmEntityColor * asRgbColor(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:331
static OdIfcCompoundPtr asCompound(OdSmartPtr< OdIfcEntity > pEnt)
IfcOpResult m_resolved
Definition: IfcEntity.h:368
virtual OdGsCache * gsNode() const
virtual bool testAttr(const OdIfcAttribute explicitAttrDef) const
virtual bool putAttr(const OdAnsiString &explicitAttrName, const OdRxValue &val)
virtual OdRxValue getAttr(const OdAnsiString &attrName) const
void resolve(IfcOpResult resolved, void *resPtr)
Definition: IfcEntity.h:196
virtual bool isInstanceOf(OdIfcEntityType entityType) const
virtual bool isKindOf(OdIfcEntityType entityType) const
virtual OdRxValue getAttr(const OdIfcAttribute attrDef) const
virtual OdUInt32 subSetAttributes(OdGiDrawableTraits *traits) const
virtual void unsetAttr(const OdIfcAttribute explicitAttrDef)
static OdGeVector2d * asVector2d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:262
static OdGeMatrix3d * asMatrix3d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:292
virtual bool testAttr(const OdAnsiString &explicitAttrName) const
static OdGePoint2d * asPoint2d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:230
virtual bool subWorldDraw(OdGiWorldDraw *wd) const
IfcOpResult resolved()
Definition: IfcEntity.h:189
virtual void unsetAttr(const OdAnsiString &explicitAttrName)
IfcOpResult
Definition: IfcEntity.h:58
@ kResPoint3d
Definition: IfcEntity.h:62
@ kResPoint2d
Definition: IfcEntity.h:61
@ kRgbColor
Definition: IfcEntity.h:67
@ kResVector2d
Definition: IfcEntity.h:63
@ kResMatrix3d
Definition: IfcEntity.h:66
@ kUnresolved
Definition: IfcEntity.h:59
@ kResVector3d
Definition: IfcEntity.h:64
@ kResCompound
Definition: IfcEntity.h:68
@ kResError
Definition: IfcEntity.h:69
@ kResMatrix2d
Definition: IfcEntity.h:65
@ kResVisited
Definition: IfcEntity.h:60
SMARTPTR(OdIfcProject)
OdSmartPtr< OdIfcCompound > OdIfcCompoundPtr
Definition: IfcCompound.h:186