CFx SDK Documentation  2020SP3
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__
GETBIT
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
OdGsNode::saveNodeState
virtual bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
OdGsNode::OdGsNode
OdGsNode(const OdGsNode &c)
OdSiSpatialIndex
Definition: SiSpatialIndex.h:118
NULL
#define NULL
Definition: GsProperties.h:177
OdGsNode::loadClientNodeState
virtual bool loadClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer)
OdGsNode::s_aAlloc
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
Definition: GsNode.h:70
OdGsContainerNode
Definition: GsContainerNode.h:47
OdGsBaseVectorizer
Definition: GsBaseVectorizer.h:112
OdGsView
Definition: Gs.h:133
OdGsNode::highlight
virtual void highlight(bool bDoIt, bool bWholeBranch)
Definition: GsNode.h:262
OdGsNode::UpdateManagerContext::ContextType
ContextType
Definition: GsNode.h:224
OdGsNode::isContainer
bool isContainer() const
Definition: GsNode.h:283
OdGsNode::loadNodeState
virtual bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
SETBIT
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
OdGsNode
Definition: GsNode.h:60
OdGsLayerNode
Definition: GsLayerNode.h:41
OdGsNode::setToDrawable
void setToDrawable(const OdGiDrawable *pUnderlyingDrawable)
OdGsCache
Definition: GsModel.h:40
OdGsNode::updateVisible
virtual void updateVisible(OdGsViewImpl *pViewImpl)
Definition: GsNode.h:177
OdGsNode::UpdateManagerContext::contextType
ContextType contextType
Definition: GsNode.h:228
TD_PackPop.h
OdGsUpdateManager
Definition: GsUpdateManager.h:44
AllocatorArray
Definition: ChunkAllocator.h:52
OdGsNode::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdGsNode)
OdGsNode::TD_USING
TD_USING(OdGsCache::extents)
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGsNode::invalidVp
bool invalidVp() const
Definition: GsNode.h:91
mask
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
OdGsNode::addContentToUpdateManager
virtual void addContentToUpdateManager(OdUInt32 viewportId, OdGsUpdateManager *pManager, const UpdateManagerContext &context)
Definition: GsNode.h:238
OdGsNode::destroy
virtual void destroy()=0
OdGsNode::hide
void hide(bool bDoIt)
Definition: GsNode.h:293
OdGsNode::invalidate
virtual void invalidate(OdGsContainerNode *pParent, OdGsViewImpl *pView, OdUInt32 mask)=0
OdGsNode::kHLT_All
@ kHLT_All
Definition: GsNode.h:80
OdGsNode::propagateLayerChanges
virtual void propagateLayerChanges(OdGsViewImpl &view)=0
ENodeType
ENodeType
Definition: GsBaseModel.h:65
OdGsNode::~OdGsNode
virtual ~OdGsNode()
OdGsNode::model
OdGsModel * model() const
OdGsNode::m_pPrev
OdGsNode * m_pPrev
Definition: GsNode.h:67
OdSmartPtr< OdGiDrawable >
OdGsNode::m_pModel
OdGsBaseModel * m_pModel
Definition: GsNode.h:72
OdGsNode::isSyncDrawable
bool isSyncDrawable() const
Definition: GsNode.h:288
fxUnderlyingDrawable
GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
OdGsNode::fxUnderlyingDrawable
friend GS_TOOLKIT_EXPORT OdGiDrawablePtr fxUnderlyingDrawable(const OdGsNode *)
OdGsNode::release
void release()
OdGiDrawable
Definition: GiDrawable.h:49
OdGsNode::m_pNext
OdGsNode * m_pNext
Definition: GsNode.h:68
OdGsViewImpl
Definition: GsViewImpl.h:58
OdGsNode::setSelectableIfHidden
void setSelectableIfHidden(bool bSelectable)
Definition: GsNode.h:303
ChunkAllocator.h
TD_PackPush.h
OdGsNode::kPersistent
@ kPersistent
Definition: GsNode.h:77
OdGsNode::extents
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
ODRX_ABSTRACT
#define ODRX_ABSTRACT
Definition: OdPlatformSettings.h:117
OdGsNode::setDrawableNull
virtual void setDrawableNull()
OdGsNode::isSelectableIfHidden
bool isSelectableIfHidden() const
Definition: GsNode.h:308
OdGsNode::kHLT
@ kHLT
Definition: GsNode.h:79
GsBaseModel.h
OdGsBaseModel
Definition: GsBaseModel.h:118
OdGsNode::addRef
void addRef()
OdGsNode::kSelectHidden
@ kSelectHidden
Definition: GsNode.h:83
OdGeExtents3d
Definition: GeExtents3d.h:45
GS_TOOLKIT_EXPORT
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdDb::LineWeight
LineWeight
Definition: OdaDefs.h:382
OdGsNode::OdGsNode
OdGsNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable)
OdGsNode::saveClientNodeState
virtual bool saveClientNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer) const
OdGsNode::getMaxLineweightUsed
virtual OdDb::LineWeight getMaxLineweightUsed() const
OdGsNode::display
virtual void display(OdGsDisplayContext &ctx)=0
OdGsNode::UpdateManagerContext
Definition: GsNode.h:222
OdGsNode::m_flags
OdUInt32 m_flags
Definition: GsNode.h:87
OdGsCache::extents
virtual bool extents(OdGeExtents3d &extents) const =0
OdGsNode::isHidden
bool isHidden() const
Definition: GsNode.h:298
OdGsNode::isHighlightedAll
bool isHighlightedAll() const
Definition: GsNode.h:273
OdGsViewImpl::hide
virtual void hide()
GS_STATIC_EXPORT
#define GS_STATIC_EXPORT
Definition: GsExport.h:38
OdGsNode::kContainer
@ kContainer
Definition: GsNode.h:78
OdGsModel
Definition: GsModel.h:77
OdGsNode::kSyncDrawable
@ kSyncDrawable
Definition: GsNode.h:81
OdGsNode::underlyingDrawableId
OdDbStub * underlyingDrawableId() const
Definition: GsNode.h:255
OdGsFiler
Definition: GsFiler.h:63
OdGsNode::underlyingDrawable
OdGiDrawablePtr underlyingDrawable() const
Definition: GsNode.h:243
OdGsNode::setInvalidVp
void setInvalidVp(bool val)
Definition: GsNode.h:93
OdGsNode::m_underlyingDrawable
void * m_underlyingDrawable
Definition: GsNode.h:73
OdGsNode::isHighlighted
bool isHighlighted() const
Definition: GsNode.h:268
OdGsNode::postprocessNodeLoading
virtual bool postprocessNodeLoading(OdGsFiler *pFiler)
OdGsNode::UpdateManagerContext::pView
OdGsViewImpl * pView
Definition: GsNode.h:229
OdGsNode::update
virtual void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)=0
OdGsNode::nodeType
virtual ENodeType nodeType() const =0
OdGsNode::kHidden
@ kHidden
Definition: GsNode.h:82
OdGsNode::clearDrawable
void clearDrawable()
OdGsNode::baseModel
OdGsBaseModel * baseModel() const
Definition: GsNode.h:278