CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GsNode.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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 __OD_GS_NODE__
25#define __OD_GS_NODE__
26
27#include "TD_PackPush.h"
28
29#include "Gs/GsBaseModel.h"
30#include "ChunkAllocator.h"
31
33class OdGsLayerNode;
34
35class OdGsBaseModel;
36class OdGsUpdateContext;
40
60{
61 friend class OdGsBaseModel;
62 friend class OdGsViewImpl;
63 //FELIX_CHANGE_BEGIN
65 //FELIX_CHANGE_END
66protected:
67 //DOM-IGNORE-BEGIN
68
69 mutable OdGsNode* m_pPrev;
70 mutable OdGsNode* m_pNext;
71
73
79 enum
80 {
81 kPersistent = 0x00000001,
82 kContainer = 0x00000002,
83 kHLT = 0x00000004, // Highlight
84 kHLT_All = 0x00000008, // Highlight whole branch
85 kSyncDrawable=0x00000010,
86 kHidden = 0x00000020,
87 kSelectHidden=0x00000040,
88 kHiddenAll = 0x00000080, // The whole node is hidden
89 kSelStyle = 0x00000100, // Selection style provided
91 };
92
94
95 // Flags to provide some custom data for OdGsBaseModel-derived class at application level
97
98 enum { kInvalidateVp = 0x80000000 };
99
100 //DOM-IGNORE-END
101public:
102 inline bool invalidVp() const { return GETBIT(m_flags, kInvalidateVp); }
103protected:
104 inline void setInvalidVp(bool val) { SETBIT(m_flags, kInvalidateVp, val); }
105
110
126public:
131 void setToDrawable(const OdGiDrawable* pUnderlyingDrawable);
132
133public:
135
136 void* operator new(size_t);
137 void operator delete(void *);
138
142 void addRef();
143
148
155 OdGsNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable);
156protected:
158public:
162 virtual ~OdGsNode();
163
169 OdGsBaseModel* baseModel() const;
170
176 OdGsModel* model() const;
177
183 bool isContainer() const;
184
185 virtual ENodeType nodeType() const = 0;
186
192 bool isSyncDrawable() const;
193
203 virtual void invalidate(OdGsContainerNode* pParent, OdGsViewImpl* pView, OdUInt32 mask) = 0;
204
209
215 OdDbStub* underlyingDrawableId() const;
216
222 virtual void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
223 OdSiSpatialIndex* pParentIndex) = 0;
224
229 virtual void updateVisible( OdGsViewImpl* pViewImpl ) {};
230
235 virtual void display(OdGsDisplayContext& ctx) = 0;
236
245 virtual void propagateLayerChanges(OdGsViewImpl& view) = 0;
246
250 virtual void destroy() = 0;
251
258 virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle = 0);
259
265 bool isHighlighted() const;
271 bool isHighlightedAll() const;
272
279 virtual void hide(bool bDoIt, bool bSelectable = false, bool bWholeBranch = true);
285 bool isHidden() const;
291 bool isSelectableIfHidden() const;
297 bool isHiddenAll() const;
298
304 OdUInt32 selectionStyle() const;
310 bool hasSelectionStyle() const;
311
317 OdUInt32 userFlags() const;
322 void setUserFlags(OdUInt32 val);
323
324 virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
325 virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
326 virtual bool saveClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer) const;
327 virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer);
328 virtual bool postprocessNodeLoading(OdGsFiler *pFiler);
329
331
337 virtual bool extents(const OdGsView* pView, OdGeExtents3d& ext) const;
338
346 bool modelExtents(OdGeExtents3d& ext, bool bUseModelTf = true) const;
355 bool modelExtents(const OdGsView* pView, OdGeExtents3d& ext, bool bUseModelTf = true) const;
356
363
367 virtual void setDrawableNull();
368
379
386 virtual void addContentToUpdateManager( OdUInt32 viewportId, OdGsUpdateManager* pManager, const UpdateManagerContext& context ) {}
387
395 virtual bool isMetafilesCompatible( const OdGsViewImpl* pView1, const OdGsViewImpl* pView2, OdGsUpdateContext* ctx ) { return true; }
396};
397//FELIX_CHANGE_BEGIN
399//FELIX_CHANGE_END
401{
402 //FELIX_CHANGE_BEGIN
403 /*
404 if(GETBIT(m_flags, kPersistent))
405 return m_pModel->open(reinterpret_cast<OdDbStub*>(m_underlyingDrawable));
406 return reinterpret_cast<OdGiDrawable*>(m_underlyingDrawable);
407 */
408 return( fxUnderlyingDrawable( this ) );
409 //FELIX_CHANGE_END
410}
411
412inline OdDbStub* OdGsNode::underlyingDrawableId() const
413{
415 return reinterpret_cast<OdDbStub*>(m_underlyingDrawable);
416 return 0;
417}
418
420{
421 if (hasSelectionStyle())
422 return getSelectionStyleImpl();
423 return 0;
424}
425
427{
428 return GETBIT(m_flags, kSelStyle);
429}
430
431inline void OdGsNode::highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle)
432{
433 SETBIT(m_flags, kHLT, bDoIt);
434 SETBIT(m_flags, kHLT_All, bDoIt ? bWholeBranch : false);
435 if ((bDoIt && (nSelStyle || hasSelectionStyle())) || (!bDoIt && hasSelectionStyle()))
436 setSelectionStyleImpl(nSelStyle);
437}
438
439inline bool OdGsNode::isHighlighted() const
440{
441 return GETBIT(m_flags, kHLT);
442}
443
444inline bool OdGsNode::isHighlightedAll() const
445{
446 return GETBIT(m_flags, kHLT_All);
447}
448
450{
451 return const_cast<OdGsBaseModel*>(m_pModel);
452}
453
454inline bool OdGsNode::isContainer() const
455{
456 return GETBIT(m_flags, kContainer);
457}
458
459inline bool OdGsNode::isSyncDrawable() const
460{
462}
463
464inline bool OdGsNode::isHidden() const
465{
466 return GETBIT(m_flags, kHidden);
467}
468
470{
472}
473
474inline bool OdGsNode::isHiddenAll() const
475{
476 return GETBIT(m_flags, kHiddenAll);
477}
478
480{
481 return m_userFlags;
482}
483
485{
486 m_userFlags = val;
487}
488
489#include "TD_PackPop.h"
490
491#endif // __OD_GS_NODE__
OdSmartPtr< OdGiDrawable > OdGiDrawablePtr
ENodeType
Definition GsBaseModel.h:69
#define GS_TOOLKIT_EXPORT
Definition GsExport.h:37
#define GS_STATIC_EXPORT
Definition GsExport.h:38
GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
unsigned int OdUInt32
#define ODRX_ABSTRACT
#define ODRX_NOEXCEPT
#define SETBIT(flags, bit, value)
Definition OdaDefs.h:516
#define GETBIT(flags, bit)
Definition OdaDefs.h:517
virtual bool extents(OdGeExtents3d &extents) const =0
OdGsModel * model() const
bool isSelectableIfHidden() const
Definition GsNode.h:469
virtual void setDrawableNull()
virtual void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)=0
virtual bool postprocessNodeLoading(OdGsFiler *pFiler)
friend class OdGsViewImpl
Definition GsNode.h:62
TD_USING(OdGsCache::extents)
OdUInt32 userFlags() const
Definition GsNode.h:479
OdUInt32 m_flags
Definition GsNode.h:93
virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle=0)
Definition GsNode.h:431
virtual OdDb::LineWeight getMaxLineweightUsed() const
bool modelExtents(const OdGsView *pView, OdGeExtents3d &ext, bool bUseModelTf=true) const
virtual ENodeType nodeType() const =0
OdGiDrawablePtr underlyingDrawable() const
Definition GsNode.h:400
virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
bool hasSelectionStyle() const
Definition GsNode.h:426
bool isHighlightedAll() const
Definition GsNode.h:444
bool modelExtents(OdGeExtents3d &ext, bool bUseModelTf=true) const
virtual void addContentToUpdateManager(OdUInt32 viewportId, OdGsUpdateManager *pManager, const UpdateManagerContext &context)
Definition GsNode.h:386
virtual void destroy()=0
@ kSelectHidden
Definition GsNode.h:87
@ kHiddenAll
Definition GsNode.h:88
@ kSyncDrawable
Definition GsNode.h:85
@ kHLT_All
Definition GsNode.h:84
@ kLastFlag
Definition GsNode.h:90
@ kHLT
Definition GsNode.h:83
@ kSelStyle
Definition GsNode.h:89
@ kHidden
Definition GsNode.h:86
@ kContainer
Definition GsNode.h:82
@ kPersistent
Definition GsNode.h:81
ODRX_DECLARE_MEMBERS(OdGsNode)
friend GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
bool isHighlighted() const
Definition GsNode.h:439
friend class OdGsBaseModel
Definition GsNode.h:61
virtual void invalidate(OdGsContainerNode *pParent, OdGsViewImpl *pView, OdUInt32 mask)=0
void addRef()
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
OdGsBaseModel * m_pModel
Definition GsNode.h:74
void setSelectionStyleImpl(OdUInt32 nStyle)
virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer)
void setToDrawable(const OdGiDrawable *pUnderlyingDrawable)
OdUInt32 m_userFlags
Definition GsNode.h:96
void setInvalidVp(bool val)
Definition GsNode.h:104
OdGsNode * m_pPrev
Definition GsNode.h:69
@ kInvalidateVp
Definition GsNode.h:98
OdDbStub * underlyingDrawableId() const
Definition GsNode.h:412
OdUInt32 getSelectionStyleImpl() const
bool isContainer() const
Definition GsNode.h:454
OdGsNode * m_pNext
Definition GsNode.h:70
void clearDrawable()
bool isHiddenAll() const
Definition GsNode.h:474
virtual void hide(bool bDoIt, bool bSelectable=false, bool bWholeBranch=true)
void * m_underlyingDrawable
Definition GsNode.h:75
virtual void propagateLayerChanges(OdGsViewImpl &view)=0
virtual void updateVisible(OdGsViewImpl *pViewImpl)
Definition GsNode.h:229
OdUInt32 selectionStyle() const
Definition GsNode.h:419
virtual bool saveClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer) const
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
Definition GsNode.h:72
bool invalidVp() const
Definition GsNode.h:102
OdGsBaseModel * baseModel() const
Definition GsNode.h:449
void setUserFlags(OdUInt32 val)
Definition GsNode.h:484
void release() ODRX_NOEXCEPT
virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
bool isHidden() const
Definition GsNode.h:464
virtual void display(OdGsDisplayContext &ctx)=0
virtual bool isMetafilesCompatible(const OdGsViewImpl *pView1, const OdGsViewImpl *pView2, OdGsUpdateContext *ctx)
Definition GsNode.h:395
bool isSyncDrawable() const
Definition GsNode.h:459
OdGsNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable)
Definition Gs.h:141
GLenum GLint GLuint mask
Definition gles2_ext.h:262
LineWeight
Definition OdaDefs.h:386