CFx SDK Documentation  2020SP3
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_
OdCmEntityColor
Definition: CmColorBase.h:68
OdIfc::OdIfcEntity::unsetAttr
virtual void unsetAttr(const OdIfcAttribute explicitAttrDef)
OdGeVector3d
Definition: GeVector3d.h:54
NULL
#define NULL
Definition: GsProperties.h:177
GeVector2d.h
OdIfc::OdIfcAttribute
OdIfcAttribute
Definition: IfcAttributesEnum.h:34
IFCCORE_EXPORT
#define IFCCORE_EXPORT
Definition: IfcBuildOptions.h:28
OdIfc::OdIfcEntity::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdIfcEntity)
OdIfc::OdIfcEntity::type
virtual OdIfcEntityType type() const =0
OdIfc::OdIfcEntity::isKindOf
virtual bool isKindOf(OdIfcEntityType entityType) const
OdIfc::OdIfcEntity::asPoint2d
static OdGePoint2d * asPoint2d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:230
OdIfc::OdIfcCompound
Definition: IfcCompound.h:43
OdIfc::kResMatrix2d
@ kResMatrix2d
Definition: IfcEntity.h:65
OdIfc::kResVector2d
@ kResVector2d
Definition: IfcEntity.h:63
OdIfc::kResPoint3d
@ kResPoint3d
Definition: IfcEntity.h:62
OdaSTL.h
daiAny.h
ODA_ASSERT_ONCE
#define ODA_ASSERT_ONCE(exp)
Definition: DebugStuff.h:51
OdIfc::kResCompound
@ kResCompound
Definition: IfcEntity.h:68
OdGsCache
Definition: GsModel.h:40
OdIfc::OdIfcEntity::asVector2d
static OdGeVector2d * asVector2d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:262
OdIfc::IfcOpResult
IfcOpResult
Definition: IfcEntity.h:58
OdIfc::OdIfcEntity::m_resolved
IfcOpResult m_resolved
Definition: IfcEntity.h:368
IfcCommon.h
OdIfc::kResVector3d
@ kResVector3d
Definition: IfcEntity.h:64
OdDAI::EntityInstance
Definition: daiEntityInstance.h:47
OdIfc::kResVisited
@ kResVisited
Definition: IfcEntity.h:60
OdIfc::kResError
@ kResError
Definition: IfcEntity.h:69
OdIfc::kRgbColor
@ kRgbColor
Definition: IfcEntity.h:67
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGeMatrix3d
Definition: GeMatrix3d.h:73
OdIfc::OdIfcCompoundPtr
OdSmartPtr< OdIfcCompound > OdIfcCompoundPtr
Definition: IfcCompound.h:186
OdIfc::OdIfcEntity::asVector3d
static OdGeVector3d * asVector3d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:246
OdRxValue
Definition: RxValue.h:64
OdIfc::OdIfcEntity::isInstanceOf
virtual bool isInstanceOf(OdIfcEntityType entityType) const
OdIfc::kResPoint2d
@ kResPoint2d
Definition: IfcEntity.h:61
OdSmartPtr
Definition: SmartPtr.h:58
OdGePoint3d
Definition: GePoint3d.h:55
OdIfc
Definition: FxBIMDatabase.h:24
GeMatrix2d.h
OdIfc::OdIfcEntity::setGsNode
virtual void setGsNode(OdGsCache *pGsNode)
OdIfc::OdIfcEntity::unsetAttr
virtual void unsetAttr(const OdAnsiString &explicitAttrName)
OdIfc::OdIfcEntity::asPoint3d
static OdGePoint3d * asPoint3d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:214
GePoint3d.h
OdIfc::OdIfcEntity::testAttr
virtual bool testAttr(const OdIfcAttribute explicitAttrDef) const
daiEntityInstance.h
IfcEntityTypes.h
DbHandle.h
OdIfc::OdIfcEntity::subWorldDraw
virtual bool subWorldDraw(OdGiWorldDraw *wd) const
OdIfc::OdIfcEntity::testAttr
virtual bool testAttr(const OdAnsiString &explicitAttrName) const
OdIfc::OdIfcEntity::putAttr
virtual bool putAttr(const OdIfcAttribute explicitAttrDef, const OdRxValue &val)
daiEntity.h
OdIfc::OdIfcEntity
Definition: IfcEntity.h:84
OdGeVector2d
Definition: GeVector2d.h:51
OdIfc::OdIfcEntity::gsNode
virtual OdGsCache * gsNode() const
OdIfc::OdIfcEntity::subSetAttributes
virtual OdUInt32 subSetAttributes(OdGiDrawableTraits *traits) const
CmColorBase.h
GeVector3d.h
daiModel.h
OdIfc::OdIfcEntity::asMatrix2d
static OdGeMatrix2d * asMatrix2d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:277
OdGiWorldDraw
Definition: GiWorldDraw.h:44
OdIfc::OdIfcEntity::asRgbColor
static OdCmEntityColor * asRgbColor(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:331
OdIfc::OdIfcEntity::getAttr
virtual OdRxValue getAttr(const OdIfcAttribute attrDef) const
OdIfc::OdIfcEntity::resolved
IfcOpResult resolved()
Definition: IfcEntity.h:189
OdGiDrawableTraits
Definition: Gi.h:71
OdIfc::SMARTPTR
SMARTPTR(OdIfcProject)
ODA_ASSERT
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:49
OdGeMatrix2d
Definition: GeMatrix2d.h:73
OdIfc::kUnresolved
@ kUnresolved
Definition: IfcEntity.h:59
OdIfc::OdIfcEntity::asMatrix3d
static OdGeMatrix3d * asMatrix3d(OdSmartPtr< OdIfcEntity > pEnt)
Definition: IfcEntity.h:292
OdIfc::OdIfcEntity::resolve
void resolve(IfcOpResult resolved, void *resPtr)
Definition: IfcEntity.h:196
OdIfc::OdIfcEntity::putAttr
virtual bool putAttr(const OdAnsiString &explicitAttrName, const OdRxValue &val)
OdIfc::OdIfcEntity::m_resPtr
void * m_resPtr
Definition: IfcEntity.h:367
OdIfc::OdIfcEntity::getAttr
virtual OdRxValue getAttr(const OdAnsiString &attrName) const
OdIfc::OdIfcEntityType
OdIfcEntityType
Definition: IfcEntityTypes.h:31
OdIfc::OdIfcEntity::OdIfcEntity
OdIfcEntity()
GeMatrix3d.h
OdIfc::OdIfcEntity::~OdIfcEntity
~OdIfcEntity()
GePoint2d.h
IfcBuildOptions.h
daiObjectId.h
OdIfc::kResMatrix3d
@ kResMatrix3d
Definition: IfcEntity.h:66
OdIfc::OdIfcEntity::asCompound
static OdIfcCompoundPtr asCompound(OdSmartPtr< OdIfcEntity > pEnt)
IfcAttributesEnum.h
OdGePoint2d
Definition: GePoint2d.h:60