CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsNode.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 __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;
37class OdGsDisplayContext;
40
60{
61 friend class OdGsBaseModel;
62 friend class OdGsViewImpl;
63 //FELIX_CHANGE_BEGIN
65 //FELIX_CHANGE_END
66protected:
67 mutable OdGsNode* m_pPrev;
68 mutable OdGsNode* m_pNext;
69
71
77 enum
78 {
79 kPersistent = 0x00000001,
80 kContainer = 0x00000002,
81 kHLT = 0x00000004, // Highlight
82 kHLT_All = 0x00000008, // Highlight whole branch
83 kSyncDrawable=0x00000010,
84 kHidden = 0x00000020,
85 kSelectHidden=0x00000040,
86 kHiddenAll = 0x00000080, // The whole node is hidden
87 kSelStyle = 0x00000100, // Selection style provided
88 kLastFlag = kSelStyle
89 };
90
92
93 // Flags to provide some custom data for OdGsBaseModel-derived class at application level
95
96 enum { kInvalidateVp = 0x80000000 };
97public:
98 inline bool invalidVp() const { return GETBIT(m_flags, kInvalidateVp); }
99protected:
100 inline void setInvalidVp(bool val) { SETBIT(m_flags, kInvalidateVp, val); }
101
106
122public:
127 void setToDrawable(const OdGiDrawable* pUnderlyingDrawable);
128
129public:
131
132 void* operator new(size_t);
133 void operator delete(void *);
134
138 void addRef();
139
143 void release();
144
151 OdGsNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable);
152protected:
154public:
155 virtual ~OdGsNode();
156
162 OdGsBaseModel* baseModel() const;
163
169 OdGsModel* model() const;
170
176 bool isContainer() const;
177
178 virtual ENodeType nodeType() const = 0;
179
185 bool isSyncDrawable() const;
186
196 virtual void invalidate(OdGsContainerNode* pParent, OdGsViewImpl* pView, OdUInt32 mask) = 0;
197
201 OdGiDrawablePtr underlyingDrawable() const;
202
208 OdDbStub* underlyingDrawableId() const;
209
215 virtual void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
216 OdSiSpatialIndex* pParentIndex) = 0;
217
222 virtual void updateVisible( OdGsViewImpl* pViewImpl ) {};
223
228 virtual void display(OdGsDisplayContext& ctx) = 0;
229
238 virtual void propagateLayerChanges(OdGsViewImpl& view) = 0;
239
246 virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle = 0);
247
253 bool isHighlighted() const;
259 bool isHighlightedAll() const;
260
261 virtual void destroy() = 0;
268 virtual void hide(bool bDoIt, bool bSelectable = false, bool bWholeBranch = true);
274 bool isHidden() const;
280 bool isSelectableIfHidden() const;
286 bool isHiddenAll() const;
287
293 OdUInt32 selectionStyle() const;
299 bool hasSelectionStyle() const;
300
306 OdUInt32 userFlags() const;
311 void setUserFlags(OdUInt32 val);
312
313 virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
314 virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
315 virtual bool saveClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer) const;
316 virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer);
317 virtual bool postprocessNodeLoading(OdGsFiler *pFiler);
318
320
321 virtual bool extents(const OdGsView* pView, OdGeExtents3d& ext) const;
322
323 bool modelExtents(OdGeExtents3d& ext, bool bUseModelTf = true) const;
324 bool modelExtents(const OdGsView* pView, OdGeExtents3d& ext, bool bUseModelTf = true) const;
325
327
331 virtual void setDrawableNull();
332
334 {
336 {
337 kForMemoryLimit = 0,
338 kForDrawOrder
339 };
342 };
343
350 virtual void addContentToUpdateManager( OdUInt32 viewportId, OdGsUpdateManager* pManager, const UpdateManagerContext& context ) {}
351
359 virtual bool isMetafilesCompatible( const OdGsViewImpl* pView1, const OdGsViewImpl* pView2, OdGsUpdateContext* ctx ) { return true; }
360};
361//FELIX_CHANGE_BEGIN
363//FELIX_CHANGE_END
365{
366 //FELIX_CHANGE_BEGIN
367 /*
368 if(GETBIT(m_flags, kPersistent))
369 return m_pModel->open(reinterpret_cast<OdDbStub*>(m_underlyingDrawable));
370 return reinterpret_cast<OdGiDrawable*>(m_underlyingDrawable);
371 */
372 return( fxUnderlyingDrawable( this ) );
373 //FELIX_CHANGE_END
374}
375
376inline OdDbStub* OdGsNode::underlyingDrawableId() const
377{
379 return reinterpret_cast<OdDbStub*>(m_underlyingDrawable);
380 return 0;
381}
382
384{
385 if (hasSelectionStyle())
386 return getSelectionStyleImpl();
387 return 0;
388}
389
391{
392 return GETBIT(m_flags, kSelStyle);
393}
394
395inline void OdGsNode::highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle)
396{
397 SETBIT(m_flags, kHLT, bDoIt);
398 SETBIT(m_flags, kHLT_All, bDoIt ? bWholeBranch : false);
399 if ((bDoIt && (nSelStyle || hasSelectionStyle())) || (!bDoIt && hasSelectionStyle()))
400 setSelectionStyleImpl(nSelStyle);
401}
402
403inline bool OdGsNode::isHighlighted() const
404{
405 return GETBIT(m_flags, kHLT);
406}
407
408inline bool OdGsNode::isHighlightedAll() const
409{
410 return GETBIT(m_flags, kHLT_All);
411}
412
414{
415 return const_cast<OdGsBaseModel*>(m_pModel);
416}
417
418inline bool OdGsNode::isContainer() const
419{
420 return GETBIT(m_flags, kContainer);
421}
422
423inline bool OdGsNode::isSyncDrawable() const
424{
426}
427
428inline bool OdGsNode::isHidden() const
429{
430 return GETBIT(m_flags, kHidden);
431}
432
434{
436}
437
438inline bool OdGsNode::isHiddenAll() const
439{
440 return GETBIT(m_flags, kHiddenAll);
441}
442
444{
445 return m_userFlags;
446}
447
449{
450 m_userFlags = val;
451}
452
453#include "TD_PackPop.h"
454
455#endif // __OD_GS_NODE__
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 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:433
virtual void setDrawableNull()
virtual void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)=0
virtual bool postprocessNodeLoading(OdGsFiler *pFiler)
TD_USING(OdGsCache::extents)
OdUInt32 userFlags() const
Definition: GsNode.h:443
OdUInt32 m_flags
Definition: GsNode.h:91
virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle=0)
Definition: GsNode.h:395
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:364
@ kSelectHidden
Definition: GsNode.h:85
@ kHiddenAll
Definition: GsNode.h:86
@ kSyncDrawable
Definition: GsNode.h:83
@ kHLT_All
Definition: GsNode.h:82
@ kHLT
Definition: GsNode.h:81
@ kSelStyle
Definition: GsNode.h:87
@ kHidden
Definition: GsNode.h:84
@ kContainer
Definition: GsNode.h:80
@ kPersistent
Definition: GsNode.h:79
virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
bool hasSelectionStyle() const
Definition: GsNode.h:390
bool isHighlightedAll() const
Definition: GsNode.h:408
bool modelExtents(OdGeExtents3d &ext, bool bUseModelTf=true) const
virtual void addContentToUpdateManager(OdUInt32 viewportId, OdGsUpdateManager *pManager, const UpdateManagerContext &context)
Definition: GsNode.h:350
virtual void destroy()=0
ODRX_DECLARE_MEMBERS(OdGsNode)
friend GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
bool isHighlighted() const
Definition: GsNode.h:403
virtual ~OdGsNode()
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:72
void setSelectionStyleImpl(OdUInt32 nStyle)
virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer)
void setToDrawable(const OdGiDrawable *pUnderlyingDrawable)
OdUInt32 m_userFlags
Definition: GsNode.h:94
void setInvalidVp(bool val)
Definition: GsNode.h:100
OdGsNode * m_pPrev
Definition: GsNode.h:67
OdDbStub * underlyingDrawableId() const
Definition: GsNode.h:376
OdUInt32 getSelectionStyleImpl() const
bool isContainer() const
Definition: GsNode.h:418
OdGsNode * m_pNext
Definition: GsNode.h:68
void clearDrawable()
bool isHiddenAll() const
Definition: GsNode.h:438
virtual void hide(bool bDoIt, bool bSelectable=false, bool bWholeBranch=true)
void * m_underlyingDrawable
Definition: GsNode.h:73
virtual void propagateLayerChanges(OdGsViewImpl &view)=0
virtual void updateVisible(OdGsViewImpl *pViewImpl)
Definition: GsNode.h:222
OdUInt32 selectionStyle() const
Definition: GsNode.h:383
virtual bool saveClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer) const
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
Definition: GsNode.h:70
bool invalidVp() const
Definition: GsNode.h:98
void release()
OdGsNode(const OdGsNode &c)
OdGsBaseModel * baseModel() const
Definition: GsNode.h:413
void setUserFlags(OdUInt32 val)
Definition: GsNode.h:448
virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
bool isHidden() const
Definition: GsNode.h:428
virtual void display(OdGsDisplayContext &ctx)=0
virtual bool isMetafilesCompatible(const OdGsViewImpl *pView1, const OdGsViewImpl *pView2, OdGsUpdateContext *ctx)
Definition: GsNode.h:359
bool isSyncDrawable() const
Definition: GsNode.h:423
OdGsNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable)
Definition: Gs.h:140
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
LineWeight
Definition: OdaDefs.h:386