CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
IfcEntity.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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 "IfcCommon.h"
28#include "IfcBuildOptions.h"
29#include "IfcEntityTypes.h"
30#include "IfcAttributesEnum.h"
31#include "daiApplicationInstance.h"
32#include "daiEntity.h"
33
34#include "Ge/GePoint2d.h"
35#include "Ge/GePoint3d.h"
36#include "Ge/GeVector2d.h"
37#include "Ge/GeVector3d.h"
38#include "Ge/GeMatrix2d.h"
39#include "Ge/GeMatrix3d.h"
40#include "CmColorBase.h"
41
45namespace OdIfc {
46
51 {
74 };
75
76 class OdIfcCompound;
77
82
86 class IFCCORE_EXPORT OdIfcEntity : public OdDAI::ApplicationInstance
87 {
88 public:
89
90 //DOM-IGNORE-BEGIN
92 //DOM-IGNORE-END
93
98
105
111 virtual bool isKindOf(OdIfcEntityType entityType) const;
112
118 bool isInstanceOf(OdIfcEntityType entityType) const;
119
124 virtual OdIfcEntityType type() const;
125
134 using OdDAI::ApplicationInstance::getAttr;
135
144 virtual OdRxValue getAttr(const OdIfcAttribute attrDef) const;
145
151 virtual bool testAttr(const char * explicitAttrName) const;
152
158 virtual bool testAttr(const OdIfcAttribute explicitAttrDef) const;
159
164 virtual void unsetAttr(const char * explicitAttrName);
165
170 virtual void unsetAttr(const OdIfcAttribute explicitAttrDef);
171
178 virtual bool putAttr(const char * explicitAttrName, const OdRxValue &val);
179
186 virtual bool putAttr(const OdIfcAttribute explicitAttrDef, const OdRxValue &val);
187
192 IfcOpResult resolved() { return m_resolved; };
193
199 void resolve(IfcOpResult resolved, void *resPtr)
200 {
202 ((resolved == kUnresolved || resolved == kResVisited) && !resPtr)
203 || resPtr);
204 m_resolved = resolved;
205 m_resPtr = resPtr;
206 };
207
211 void unresolve();
212
222 static const OdGePoint3d* asPoint3d(const OdIfcEntity *pEnt) {
223 if (pEnt->m_resolved == kResPoint3d || pEnt->m_resolved == kResPoint2d)
224 return reinterpret_cast<OdGePoint3d*>(pEnt->m_resPtr);
225 ODA_ASSERT(0);
226 return nullptr;
227 };
228
238 static const OdGePoint2d* asPoint2d(const OdIfcEntity *pEnt) {
239 if (pEnt->m_resolved == kResPoint2d || pEnt->m_resolved == kResPoint3d)
240 return reinterpret_cast<OdGePoint2d*>(pEnt->m_resPtr);
241 ODA_ASSERT(0);
242 return nullptr;
243 };
244
254 static const OdGeVector3d* asVector3d(const OdIfcEntity *pEnt) {
255 if (pEnt->m_resolved == kResVector3d || pEnt->m_resolved == kResVector2d)
256 return reinterpret_cast<OdGeVector3d*>(pEnt->m_resPtr);
257 ODA_ASSERT(0);
258 return nullptr;
259 };
260
270 static const OdGeVector2d* asVector2d(const OdIfcEntity *pEnt) {
271 if (pEnt->m_resolved == kResVector2d || pEnt->m_resolved == kResVector3d)
272 return reinterpret_cast<OdGeVector2d*>(pEnt->m_resPtr);
273 ODA_ASSERT(0);
274 return nullptr;
275 };
276
285 static const OdGeMatrix2d* asMatrix2d(const OdIfcEntity *pEnt) {
286 if (pEnt->m_resolved == kResMatrix2d)
287 return reinterpret_cast<OdGeMatrix2d*>(pEnt->m_resPtr);
288 ODA_ASSERT(0);
289 return nullptr;
290 };
291
300 static const OdGeMatrix3d* asMatrix3d(const OdIfcEntity *pEnt) {
301 if (pEnt->m_resolved == kResMatrix3d)
302 return reinterpret_cast<OdGeMatrix3d*>(pEnt->m_resPtr);
303 ODA_ASSERT(0);
304 return nullptr;
305 };
306
316
325 static const OdCmEntityColor* asRgbColor(const OdIfcEntity *pEnt) {
326 if (pEnt->m_resolved == kRgbColor)
327 return reinterpret_cast<OdCmEntityColor*>(pEnt->m_resPtr);
328 ODA_ASSERT(0);
329 return nullptr;
330 }
331
336 virtual void setGsNode(OdGsCache* pGsNode);
337
342 virtual OdGsCache* gsNode() const;
343
350
356 virtual bool subWorldDraw(OdGiWorldDraw * wd) const;
357
358 using OdDAI::ApplicationInstance::isKindOf;
359
360//DOM-IGNORE-BEGIN
361 protected:
362
363 void *m_resPtr;
365
366 private:
367
368 void* asCustom() const { return m_resPtr; }
369
370 friend class OdIfcCompound;
371//DOM-IGNORE-END
372 };
373
378
379} //namespace OdIfc
380
381#endif // _IFC_ENTITY_H_
#define ODA_ASSERT_ONCE(exp)
Definition: DebugStuff.h:73
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:57
#define IFCCORE_EXPORT
#define SMARTPTR(classname)
Definition: IfcCommon.h:33
unsigned int OdUInt32
ODRX_DECLARE_MEMBERS(OdIfcEntity)
static const OdGeMatrix3d * asMatrix3d(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:300
virtual bool putAttr(const OdIfcAttribute explicitAttrDef, const OdRxValue &val)
virtual void setGsNode(OdGsCache *pGsNode)
virtual bool putAttr(const char *explicitAttrName, const OdRxValue &val)
static OdIfcCompoundPtr asCompound(OdSmartPtr< OdIfcEntity > pEnt)
bool isInstanceOf(OdIfcEntityType entityType) const
IfcOpResult m_resolved
Definition: IfcEntity.h:364
static const OdGePoint3d * asPoint3d(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:222
virtual OdIfcEntityType type() const
virtual bool testAttr(const OdIfcAttribute explicitAttrDef) const
static const OdCmEntityColor * asRgbColor(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:325
static const OdGePoint2d * asPoint2d(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:238
void resolve(IfcOpResult resolved, void *resPtr)
Definition: IfcEntity.h:199
virtual bool isKindOf(OdIfcEntityType entityType) const
static const OdGeVector3d * asVector3d(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:254
virtual bool testAttr(const char *explicitAttrName) const
virtual OdRxValue getAttr(const OdIfcAttribute attrDef) const
virtual OdUInt32 subSetAttributes(OdGiDrawableTraits *traits) const
virtual void unsetAttr(const OdIfcAttribute explicitAttrDef)
virtual OdGsCache * gsNode() const
virtual bool subWorldDraw(OdGiWorldDraw *wd) const
static const OdGeVector2d * asVector2d(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:270
IfcOpResult resolved()
Definition: IfcEntity.h:192
static const OdGeMatrix2d * asMatrix2d(const OdIfcEntity *pEnt)
Definition: IfcEntity.h:285
virtual void unsetAttr(const char *explicitAttrName)
IfcOpResult
Definition: IfcEntity.h:51
@ kResPoint3d
Definition: IfcEntity.h:59
@ kResPoint2d
Definition: IfcEntity.h:57
@ kRgbColor
Definition: IfcEntity.h:69
@ kResVector2d
Definition: IfcEntity.h:61
@ kResMatrix3d
Definition: IfcEntity.h:67
@ kUnresolved
Definition: IfcEntity.h:53
@ kResVector3d
Definition: IfcEntity.h:63
@ kResCompound
Definition: IfcEntity.h:71
@ kResError
Definition: IfcEntity.h:73
@ kResMatrix2d
Definition: IfcEntity.h:65
@ kResVisited
Definition: IfcEntity.h:55
OdSmartPtr< OdIfcCompound > OdIfcCompoundPtr
Definition: IfcCompound.h:184