CFx SDK Documentation  2023 SP0
GsNode.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 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 
32 class OdGsContainerNode;
33 class OdGsLayerNode;
34 
35 class OdGsBaseModel;
36 class OdGsUpdateContext;
37 class OdGsDisplayContext;
38 class OdSiSpatialIndex;
39 class OdGsUpdateManager;
40 
60 {
61  friend class OdGsBaseModel;
62  friend class OdGsViewImpl;
63  //FELIX_CHANGE_BEGIN
65  //FELIX_CHANGE_END
66 protected:
67  mutable OdGsNode* m_pPrev;
68  mutable OdGsNode* m_pNext;
69 
71 
74 
75  enum
76  {
77  kPersistent = 0x00000001,
78  kContainer = 0x00000002,
79  kHLT = 0x00000004, // Highlight
80  kHLT_All = 0x00000008, // Highlight whole branch
81  kSyncDrawable = 0x00000010,
82  kHidden = 0x00000020,
83  kSelectHidden = 0x00000040,
84  kLastFlag = kSelectHidden
85  };
86 
87  mutable OdUInt32 m_flags;
88 
89  enum { kInvalidateVp = 0x80000000 };
90 public:
91  inline bool invalidVp() const { return GETBIT(m_flags, kInvalidateVp); }
92 protected:
93  inline void setInvalidVp(bool val) { SETBIT(m_flags, kInvalidateVp, val); }
94 
98  void clearDrawable();
99 
100 public:
101  void setToDrawable(const OdGiDrawable* pUnderlyingDrawable);
102 
103 public:
105 
106  void* operator new(size_t);
107  void operator delete(void *);
108 
112  void addRef();
113 
117  void release();
118 
122  OdGsNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable);
123 protected:
124  OdGsNode(const OdGsNode& c);
125 public:
126  virtual ~OdGsNode();
127 
131  OdGsBaseModel* baseModel() const;
132 
133  OdGsModel* model() const;
134 
138  bool isContainer() const;
139 
140  virtual ENodeType nodeType() const = 0;
141 
142  bool isSyncDrawable() const;
143 
153  virtual void invalidate(OdGsContainerNode* pParent, OdGsViewImpl* pView, OdUInt32 mask) = 0;
154 
158  OdGiDrawablePtr underlyingDrawable() const;
159 
163  OdDbStub* underlyingDrawableId() const;
164 
170  virtual void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
171  OdSiSpatialIndex* pParentIndex) = 0;
172 
177  virtual void updateVisible( OdGsViewImpl* pViewImpl ) {};
178 
183  virtual void display(OdGsDisplayContext& ctx) = 0;
184 
192  virtual void propagateLayerChanges(OdGsViewImpl& view) = 0;
193 
194  virtual void highlight(bool bDoIt, bool bWholeBranch);
195 
196  bool isHighlighted() const;
197  bool isHighlightedAll() const;
198 
199  virtual void destroy() = 0;
200 
201  void hide(bool bDoIt);
202  bool isHidden() const;
203 
204  void setSelectableIfHidden(bool bSelectable);
205  bool isSelectableIfHidden() const;
206 
207  virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
208  virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
209  virtual bool saveClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer) const;
210  virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer);
211  virtual bool postprocessNodeLoading(OdGsFiler *pFiler);
212 
214 
215  virtual bool extents(const OdGsView* pView, OdGeExtents3d& ext) const;
216 
218 
219  virtual void setDrawableNull();
220 
222  {
224  {
225  kForMemoryLimit = 0,
226  kForDrawOrder
227  };
230  };
231 
238  virtual void addContentToUpdateManager( OdUInt32 viewportId, OdGsUpdateManager* pManager, const UpdateManagerContext& context ) {}
239 };
240 //FELIX_CHANGE_BEGIN
242 //FELIX_CHANGE_END
244 {
245  //FELIX_CHANGE_BEGIN
246  /*
247  if(GETBIT(m_flags, kPersistent))
248  return m_pModel->open(reinterpret_cast<OdDbStub*>(m_underlyingDrawable));
249  return reinterpret_cast<OdGiDrawable*>(m_underlyingDrawable);
250  */
251  return( fxUnderlyingDrawable( this ) );
252  //FELIX_CHANGE_END
253 }
254 
255 inline OdDbStub* OdGsNode::underlyingDrawableId() const
256 {
258  return reinterpret_cast<OdDbStub*>(m_underlyingDrawable);
259  return 0;
260 }
261 
262 inline void OdGsNode::highlight(bool bDoIt, bool bWholeBranch)
263 {
264  SETBIT(m_flags, kHLT, bDoIt);
265  SETBIT(m_flags, kHLT_All, bDoIt ? bWholeBranch : false);
266 }
267 
268 inline bool OdGsNode::isHighlighted() const
269 {
270  return GETBIT(m_flags, kHLT);
271 }
272 
273 inline bool OdGsNode::isHighlightedAll() const
274 {
275  return GETBIT(m_flags, kHLT_All);
276 }
277 
279 {
280  return const_cast<OdGsBaseModel*>(m_pModel);
281 }
282 
283 inline bool OdGsNode::isContainer() const
284 {
285  return GETBIT(m_flags, kContainer);
286 }
287 
288 inline bool OdGsNode::isSyncDrawable() const
289 {
290  return GETBIT(m_flags, kSyncDrawable);
291 }
292 
293 inline void OdGsNode::hide(bool bDoIt)
294 {
295  SETBIT(m_flags, kHidden, bDoIt);
296 }
297 
298 inline bool OdGsNode::isHidden() const
299 {
300  return GETBIT(m_flags, kHidden);
301 }
302 
303 inline void OdGsNode::setSelectableIfHidden(bool bSelectable)
304 {
305  SETBIT(m_flags, kSelectHidden, bSelectable);
306 }
307 
309 {
310  return GETBIT(m_flags, kSelectHidden);
311 }
312 
313 #include "TD_PackPop.h"
314 
315 #endif // __OD_GS_NODE__
ENodeType
Definition: GsBaseModel.h:65
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
#define GS_STATIC_EXPORT
Definition: GsExport.h:38
GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
#define ODRX_ABSTRACT
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:499
#define GETBIT(flags, bit)
Definition: OdaDefs.h:500
virtual bool extents(OdGeExtents3d &extents) const =0
bool isSelectableIfHidden() const
Definition: GsNode.h:308
virtual void setDrawableNull()
virtual void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)=0
virtual bool postprocessNodeLoading(OdGsFiler *pFiler)
TD_USING(OdGsCache::extents)
OdUInt32 m_flags
Definition: GsNode.h:87
virtual OdDb::LineWeight getMaxLineweightUsed() const
virtual ENodeType nodeType() const =0
OdGiDrawablePtr underlyingDrawable() const
Definition: GsNode.h:243
virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
bool isHighlightedAll() const
Definition: GsNode.h:273
virtual void addContentToUpdateManager(OdUInt32 viewportId, OdGsUpdateManager *pManager, const UpdateManagerContext &context)
Definition: GsNode.h:238
void setSelectableIfHidden(bool bSelectable)
Definition: GsNode.h:303
virtual void destroy()=0
ODRX_DECLARE_MEMBERS(OdGsNode)
friend GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
bool isHighlighted() const
Definition: GsNode.h:268
virtual ~OdGsNode()
virtual void invalidate(OdGsContainerNode *pParent, OdGsViewImpl *pView, OdUInt32 mask)=0
void addRef()
OdGsModel * model() const
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
OdGsBaseModel * m_pModel
Definition: GsNode.h:72
virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer)
void setToDrawable(const OdGiDrawable *pUnderlyingDrawable)
void setInvalidVp(bool val)
Definition: GsNode.h:93
OdGsNode * m_pPrev
Definition: GsNode.h:67
OdDbStub * underlyingDrawableId() const
Definition: GsNode.h:255
bool isContainer() const
Definition: GsNode.h:283
OdGsNode * m_pNext
Definition: GsNode.h:68
void clearDrawable()
void * m_underlyingDrawable
Definition: GsNode.h:73
virtual void propagateLayerChanges(OdGsViewImpl &view)=0
virtual void updateVisible(OdGsViewImpl *pViewImpl)
Definition: GsNode.h:177
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:91
void release()
OdGsNode(const OdGsNode &c)
OdGsBaseModel * baseModel() const
Definition: GsNode.h:278
void hide(bool bDoIt)
Definition: GsNode.h:293
virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
bool isHidden() const
Definition: GsNode.h:298
@ kSelectHidden
Definition: GsNode.h:83
@ kSyncDrawable
Definition: GsNode.h:81
@ kHLT_All
Definition: GsNode.h:80
@ kHLT
Definition: GsNode.h:79
@ kHidden
Definition: GsNode.h:82
@ kContainer
Definition: GsNode.h:78
@ kPersistent
Definition: GsNode.h:77
virtual void display(OdGsDisplayContext &ctx)=0
virtual void highlight(bool bDoIt, bool bWholeBranch)
Definition: GsNode.h:262
bool isSyncDrawable() const
Definition: GsNode.h:288
OdGsNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable)
Definition: Gs.h:133
virtual void hide()
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
LineWeight
Definition: OdaDefs.h:384