CFx SDK Documentation  2022 SP0
GsEntityNode.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_ENTITY_NODE__
25 #define __OD_GS_ENTITY_NODE__
26 
27 #include "Gs/GsNode.h"
28 #include "Si/SiSpatialIndex.h"
29 #include "OdArrayMemAlloc.h"
30 #include "Gs/GsHighlightData.h"
31 #include "Gs/GsUpdateManager.h"
32 
33 class OdGsBaseVectorizer;
35 
36 #include "TD_PackPush.h"
37 
41 {
45 
47  : m_pLayer(0)
48  , m_pGsMetafile(0)
49  , m_pNext(0)
50  {
51  }
52 
54  {
55  m_pLayer = c.m_pLayer;
57  m_pNext = c.m_pNext;
58  }
59 
60  void clear()
61  {
62  m_pLayer = NULL;
64  m_pNext = NULL;
65  }
66 
68  {
69  OdGsGeomPortion* pPortion = m_pNext;
70  while (pPortion)
71  {
72  OdGsGeomPortion* pNextPortion = pPortion->m_pNext;
73  delete pPortion;
74  pPortion = pNextPortion;
75  }
76  }
77 
78  bool isEmptyPortion() const { return (m_pLayer == NULL) && m_pGsMetafile.isNull(); }
80  {
81  while (m_pNext && m_pNext->isEmptyPortion())
82  {
83  OdGsGeomPortion* pNextPortion = m_pNext->m_pNext;
84  delete m_pNext;
85  m_pNext = pNextPortion;
86  }
87  if (m_pNext)
89  }
90 };
91 
93 class OdGsBaseContext;
94 
103 {
104  OdGsEntityNode* m_pNextEntity;
105 
106  struct NextEntityEntry
107  {
108  OdGsEntityNode* m_pNextEntity;
109  OdUInt32 m_entFlags;
110  };
111  void allocNextEntityArray(OdUInt32 nMaxVpId);
112  inline NextEntityEntry *firstEntEntry() { return reinterpret_cast<NextEntityEntry*>(m_pNextEntity); }
113  inline const NextEntityEntry *firstEntEntry() const { return reinterpret_cast<const NextEntityEntry*>(m_pNextEntity); }
114  inline void checkEntEntry(OdUInt32 nVpId) const { if ((OdUInt32)OdPtrToInt32(firstEntEntry()->m_pNextEntity) <= nVpId) throw OdError(eInvalidIndex); }
115  inline NextEntityEntry *nextEntEntry(OdUInt32 nVpId) { checkEntEntry(nVpId); return reinterpret_cast<NextEntityEntry*>(m_pNextEntity) + (nVpId + 1); }
116  inline const NextEntityEntry *nextEntEntry(OdUInt32 nVpId) const { checkEntEntry(nVpId); return reinterpret_cast<const NextEntityEntry*>(m_pNextEntity) + (nVpId + 1); }
117 protected:
119 
120 public:
122  {
123  public:
124  void* operator new(size_t);
125  void operator delete(void *);
126 
129 
130  bool play(OdGsBaseVectorizer& view, EMetafilePlayMode eMode, OdGsEntityNode& node, OdGsBaseContext* ctx = NULL);
131  bool playNested(const OdGsView& view, OdGsEntityNode& node, OdGsBaseContext& ctx);
133  bool layersChanged(OdUInt32 nVpId) const;
135  bool containsFrozenLayers() const;
136  bool containsAnyOfLayers( OdDbStub*const* layers, OdUInt32 count ) const;
137 
138  bool isEmpty() const;
139  bool isAllLayersOff( OdUInt32 viewportId ) const;
140 
144  };
145  friend class Metafile;
146 
151 
153  {
154  protected:
157  public:
159  {
160  OdGsBaseVectorizeDevice* m_pDevice;
161  public:
163  {
164  m_pDevice = NULL;
165  };
167  {
168  m_pDevice = device;
169  }
170  OdGsBaseVectorizeDevice* device() { return m_pDevice; }
171  };
172 
173  MetafileEx() : Metafile(), OdGsUpdateManager::OdGsUpdateManagerElement()
174  {
175  m_pDeviceRef = NULL;
176  }
178  void setDevice( OdRxObjectPtr dev ) { m_pDeviceRef = dev; }
179  OdRxObjectPtr device() { return m_pDeviceRef; }
180 
181  void setMetafileLength( OdUInt64 l ) { m_nLength = l; }
182  OdUInt64 metafileLength() const { return m_nLength; }
183  };
184 
185  friend class OdGsModuleObject;
187 public:
188  static void* Alloc(size_t nBytes) { return OdGsNode::s_aAlloc.getAt(1)->alloc((int)nBytes); }
189  static void Free(void* pMemBlock) { OdGsNode::s_aAlloc.getAt(1)->release(pMemBlock); }
190  static void* Realloc(void* pMemBlock, size_t newSize, size_t)
191  {
192  if(pMemBlock)
193  OdGsNode::s_aAlloc.getAt(1)->release(pMemBlock);
194  return OdGsNode::s_aAlloc.getAt(1)->alloc((int)newSize);
195  }
199  class MetafilePtrArray: public OdArrayMemAlloc<MetafilePtr, OdObjectsAllocator<MetafilePtr>, OdGsEntityNode>
200  {
201  public:
203  };
204 
206  {
207  public:
208  enum
209  {
210  kArray = 1,
211  kVpDependent = 2,
212  kAwareFlagsRegenType = 4,
213 
214  kRegenTypeStandard = 8,
215  kRegenTypeHideOrShade = 16,
216  kRegenTypeRenderCommand = 32,
217  kRegenTypeMask = kRegenTypeStandard | kRegenTypeHideOrShade | kRegenTypeRenderCommand,
218 
219  kDependentGeometry = 64, // Marks PaperSpace entities
220  kLayerDependent = 128 // Marks compound entities w/o blocks cache (#15036)
221  };
222  MetafileHolder(): m_flags(0)
223  {
224  *reinterpret_cast<Metafile**>(rawPtr()) = 0;
225  }
226  MetafileHolder(const MetafileHolder& c): m_flags(0)
227  {
228  *reinterpret_cast<Metafile**>(rawPtr()) = 0;
229  if(!c.isValid())
230  return;
231  if(c.isArray())
232  {
233  allocateArray();
234  getArray() = const_cast<MetafileHolder&>(c).getArray();
235  }
236  else
237  {
238  *reinterpret_cast<Metafile**>(rawPtr()) = const_cast<MetafileHolder&>(c).get();
239  get()->addRef();
240  }
241  m_flags = c.m_flags;
242  }
244  {
245  destroy();
246  }
247 
248  bool isValid() const { return *((const Metafile**)rawPtr()) != NULL; }
249  bool isArray() const { return GETBIT(flags(), kArray); }
250 
251  bool isVpDependent() const { return GETBIT(flags(), kVpDependent); }
252  void setVpDependent(bool bOn)
253  {
254  SETBIT(m_flags, kVpDependent, bOn);
255  if(bOn)
256  {
257  SETBIT(m_flags, kRegenTypeMask, false);
258  setAwareFlagsRegenType(false);
259  }
260  }
261 
262  bool isAwareFlagsRegenType() const { return GETBIT(flags(), kAwareFlagsRegenType); }
263  bool isRegenTypeDependent() const { return GETBIT(flags(), kRegenTypeMask); }
264 
265  void setDependentGeometry(bool bSet) { SETBIT(m_flags, kDependentGeometry, bSet); }
266  bool isDependentGeometry() const { return GETBIT(flags(), kDependentGeometry); }
267 
268  void setLayerDependent(bool bSet) { SETBIT(m_flags, kLayerDependent, bSet); }
269  bool isLayerDependent() const { return GETBIT(m_flags, kLayerDependent); }
270 
272  {
273  ODA_ASSERT(!isArray());
274  return *reinterpret_cast<Metafile**>(rawPtr());
275  }
276  const Metafile* get() const
277  {
278  ODA_ASSERT(!isArray());
279  return *reinterpret_cast<Metafile**>(const_cast<MetafileHolder*>(this)->rawPtr());
280  }
282  {
283  ODA_ASSERT(isArray());
284  return *reinterpret_cast<MetafilePtrArray*>(rawPtr());
285  }
286  const MetafilePtrArray& getArray() const
287  {
288  ODA_ASSERT(isArray());
289  return *reinterpret_cast<const MetafilePtrArray*>(rawPtr());
290  }
291  void set(Metafile* pMf)
292  {
293  destroy();
294  *reinterpret_cast<Metafile**>(rawPtr()) = pMf;
295  if(pMf)
296  pMf->addRef();
297  }
298 
299  void setAtRegenType(Metafile* pMf, OdGiRegenType eRegenType)
300  {
301  int index = eRegenType - kOdGiStandardDisplay;
302  if(isArray())
303  {
304  ODA_ASSERT(isRegenTypeDependent());
305  setAt(index, pMf);
306  }
307  else if(isRegenTypeDependent())
308  {
309  if(GETBIT(m_flags , kRegenTypeStandard << index))
310  {
311  set(pMf);
312  if(!pMf)
313  setAwareFlagsRegenType(false);
314  return;
315  }
316  allocateArray();
317  setAt(index, pMf);
318  }
319  else
320  {
321  set(pMf);
322  }
323  if(pMf)
324  {
325  m_flags |= kRegenTypeStandard << index;
326  if(pMf->m_nAwareFlags & kVpRegenType)
327  setAwareFlagsRegenType(true);
328  }
329  }
330 
332  {
333  ODA_ASSERT(isRegenTypeDependent());
334  ODA_ASSERT(!isArray());
335  if(GETBIT(flags(), kRegenTypeStandard))
336  eRegenType = kOdGiStandardDisplay;
337  else if(GETBIT(flags(), kRegenTypeHideOrShade))
338  eRegenType = kOdGiHideOrShadeCommand;
339  else
340  eRegenType = kOdGiRenderCommand;
341  return get();
342  }
343 
345 
346  void destroy();
347  int checkValid();
348 
349  void moveTo(MetafileHolder& c, int& n);
351  {
352  if(isArray())
353  {
354  if(isVpDependent())
355  return getArray().at(nVpID)->m_nAwareFlags;
356  return kVpRenderMode | (isAwareFlagsRegenType() ? kVpRegenType : 0);
357  }
358  return isValid() ? get()->m_nAwareFlags : 0;
359  }
360 
361  void setAt(int n, Metafile* pMf)
362  {
363  ODA_ASSERT(isArray());
364  if(getArray().size() <= OdUInt32(n))
365  getArray().resize(n + 1);
366  getArray()[n] = pMf;
367  }
368 
369  protected:
370  int flags() const { return (int)m_flags; }
371  void* rawPtr() { return &m_data; }
372  const void* rawPtr() const { return &m_data; }
373  bool isValidMf(const Metafile& mf) const;
374  void setAwareFlagsRegenType(bool bOn) { SETBIT(m_flags, kAwareFlagsRegenType, bOn); }
375 
376  protected:
378 #ifdef TD_STRICT_ALIGNMENT
379  OdIntPtr m_data[odmax(sizeof(MetafilePtrArray),sizeof(OdRxObject*)) / sizeof(OdIntPtr)];
380 #else
381  OdUInt8 m_data[odmax(sizeof(MetafilePtrArray),sizeof(OdRxObject*))];
382 #endif
383  };
384 
385 protected:
387 
388  virtual void propagateLayerChanges(OdGsViewImpl& view);
389 protected:
393  MetafilePtrArray& metafileArray();
394 
399  const MetafilePtrArray& metafileArray() const;
400 
404  OdGsEntityNode::MetafilePtr metafile() const;
405 
407 public:
409 
414  OdGsEntityNode::MetafilePtr metafileAt(int metafileIndex) const;
415 
420  void setMetafile(OdGsEntityNode::Metafile* metafiles);
421 
427  void setMetafileAt(int metafileIndex, OdGsEntityNode::Metafile* pMetafile);
428 
433  void convertToViewportDependent(const OdGsUpdateContext& ctx);
434 
439  {
440  kSkipCheckCompatible = 0, // Avoid check of viewport compatibility.
441  kCheckViewChanges = 1, // Check for view changes.
442  kCheckCompatibleView = 2, // Avoid check for viewp changes, but find compatible metafile for other viewport.
443  kFindCompatible = 3 // Check for view changes and try to find compatible for other viewports.
444  };
445 
452  OdGsEntityNode::Metafile* metafile(const OdGsViewImpl& view, OdGsUpdateContext* ctx,
453  MetafileCompatibilityLevel findCompatibleLevel = kFindCompatible);
459  void setMetafile(OdGsUpdateContext& ctx, OdGsEntityNode::Metafile* metafiles);
460  OdRxObject* findCompatibleCache(const OdGsViewImpl& keyView, OdGsUpdateContext* ctx, OdUInt32 awareMask = 0);
461 protected:
462  // m_flags (don't add new flags here, we already utilized ~30 bits)
463  enum
464  {
465  kHasExtents = OdGsNode::kLastFlag << 1,
466  kSpatiallyIndexed = OdGsNode::kLastFlag << 2,
467  kInWorkset = OdGsNode::kLastFlag << 3,
468  kSingleThreaded = OdGsNode::kLastFlag << 4,
469  kOwned = OdGsNode::kLastFlag << 5,
470  kDrawableRegenDraw = OdGsNode::kLastFlag << 6,
471  kEntityUnerased = OdGsNode::kLastFlag << 7,
473  kExtentsOutOfMS = OdGsNode::kLastFlag << 9,
474  kNonSelectable = OdGsNode::kLastFlag << 10,
475  kSkipSelection = OdGsNode::kLastFlag << 11,
476  kErased = OdGsNode::kLastFlag << 12,
477  kDrawableIsXref = OdGsNode::kLastFlag << 13,
478  kMultilistNextPtr = OdGsNode::kLastFlag << 14,
479  kLastFlag = kMultilistNextPtr
480  };
481  // m_entFlags (add all new flags related to EntityNode here, keep some free space inside m_flags for inherited classes)
482  enum
483  {
484  kLineweightBit1 = (1 << 0), // reserve 8 bits for maximal lineweight
485  kLineweightBit2 = (1 << 1), kLineweightOffset = 0,
486  kLineweightBit3 = (1 << 2),
487  kLineweightBit4 = (1 << 3),
488  kLineweightBit5 = (1 << 4),
489  kLineweightBit6 = (1 << 5),
490  kLineweightBit7 = (1 << 6),
491  kLineweightBit8 = (1 << 7),
492  kLineweightBitMask = kLineweightBit1 | kLineweightBit2 | kLineweightBit3 | kLineweightBit4 | kLineweightBit5 | kLineweightBit6 | kLineweightBit7 | kLineweightBit8,
493  kLightSourceOwner = (1 << 8), // owning at least one light source
494  kRegenOnHighlight = (1 << 9), // cache require regeneration during highlighting state change
495  kMarkedByUpdateManager = (1 << 10),
496  kLastEntFlag = kMarkedByUpdateManager
497  };
498  // m_markToSkipFlags
499  enum
500  {
501  kMarkedToSkipFirst = 0x00000001,
502  kMarkedToSkipLast = kMarkedToSkipFirst << 30,
503  kMarkedToSkipAll = 0x7FFFFFFF
504  };
505 
506 public:
508 
512  OdGsEntityNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable, bool bSetGsNode = false);
513 public:
515 
520  void setNextEntity(OdGsEntityNode* pNextEntity);
521 
527  void setNextEntity(OdUInt32 nVpId, OdGsEntityNode* pNextEntity);
532  OdGsEntityNode* nextEntity();
533  OdGsEntityNode* nextEntity(OdUInt32 nVpId);
538  const OdGsEntityNode* nextEntity() const;
539  const OdGsEntityNode* nextEntity(OdUInt32 nVpId) const;
543  OdUInt32 numNextEntity() const;
547  void enableMultipleNextEntities(OdUInt32 nMaxVpId);
548 
549  void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
550  OdSiSpatialIndex* pParentIndex);
551 
552  void updateVisible( OdGsViewImpl* pViewImpl );
553 
554  virtual OdGsEntityNode::MetafilePtr regenMetafile(OdGsUpdateContext &ctx, OdUInt32 vpDepFlags);
555 
574  virtual OdUInt32 awareFlags(OdUInt32 viewportId) const;
575 
576  virtual ENodeType nodeType() const { return kEntityNode; }
577 
578  virtual bool isReference() const { return false; }
579  virtual bool isLight() const { return false; }
580 
581  void display(OdGsDisplayContext& ctx);
582 
584 
586 
587  bool extents(OdGeExtents3d& extents) const;
588 
593  bool spatiallyIndexed() const;
594 
599  bool spatiallyIndexed(OdUInt32 nVpId) const;
600 
606  void setSpatiallyIndexed(bool spatiallyIndexed);
607 
613  void setSpatiallyIndexed(OdUInt32 nVpId, bool spatiallyIndexed);
614 
618  bool owned() const;
619 
624  bool owned(OdUInt32 nVpId) const;
630  void setOwned(bool owned);
631 
637  void setOwned(OdUInt32 nVpId, bool owned);
638 
642  bool markedByUpdateManager() const;
643 
648  void setMarkedByUpdateManager( bool marked );
649 
653  bool hasExtents() const;
654 
655  const OdGeExtents3d& extents() const;
656 
660  virtual bool isEmpty();
661 
665  virtual bool hasFrozenLayers();
666 
671  inline bool markedToSkip(unsigned mask);
672 
678  inline void markToSkip(unsigned mask, bool markToSkip);
679 
680  inline void markToSkipAll();
681 
682  static unsigned markToSkipMask(OdUInt32 threadIndex)
683  {
684  ODA_ASSERT(threadIndex >= 0 && threadIndex < 31);
685  return kMarkedToSkipFirst << threadIndex;
686  }
687 
688  void destroy(){}
689 
690  virtual bool layersChanged(OdGsViewImpl& view) const;
691 
692  bool markedAsNonSelectable() const;
693  void markAsNonSelectable(bool val);
694  bool isMarkedSkipSelection() const;
695  void markSkipSelection(bool val);
696  bool isMarkedErased() const;
697  void markErased(bool val);
698 
699  bool isInWorkset() const;
700  void setInWorkset(bool val);
701 
702  bool isRegenOnDraw() const;
703  void setRegenOnDraw(bool val);
704 
705  bool isSingleThreaded() const;
706  void setSingleThreaded(bool val);
707 
708  virtual void highlight(bool bDoIt, bool bWholeBranch);
709  void setHlBranch(OdGsHlBranch* pBr) { m_hlBranch = pBr; }
710  OdGsHlBranch* hlBranch() { return m_hlBranch; }
711  const OdGsHlBranch* hlBranch() const { return m_hlBranch; }
712 
714 
715  bool extents(const OdGsView* pView, OdGeExtents3d& ext) const;
717  void addMaxLineweightUsed(OdDb::LineWeight lwd);
718  void setMaxLineweightUsed(OdDb::LineWeight lwd);
719 
720  bool entityUnerased() const;
721  void setEntityUnerased(bool flag);
722 
723  bool isInvisible() const;
724 
725  bool isExtentsOutOfModelSpace() const;
726  void setExtentsOutOfModelSpace(bool flag);
727 
728  void resetInvalidVpFlag();
729 
730  void setAsLightSourceOwner(bool bSet);
731  bool isLightSourceOwner() const;
732 
733  bool isRequireRegenOnHighlightChange() const;
734 
735 public:
736  virtual void makeStock();
737  virtual void releaseStock();
739 
740  bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
741  bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
742 protected:
743  bool findMetafileInStock(OdGsUpdateContext& ctx);
745  const OdGeExtents3d& prevExtents);
746  inline void setExtentsFlags();
747 
748 private:
749  MetafileHolder m_mfStock;
750  volatile int m_markToSkipFlags;
751 protected:
752  // This flags willn't increase memory usage (at least on Win32) since utilize free space in 8 bytes alignment (__alignof(entity_node) == 8).
754 
756 
757 public:
758  void addContentToUpdateManager( OdUInt32 viewportId, OdGsUpdateManager* pManager, const UpdateManagerContext& context );
759 };
760 
765 
766 
768 {
770  throw OdError(eInvalidIndex);
771  m_pNextEntity = pNextEntity;
772 }
773 
774 inline void OdGsEntityNode::setNextEntity(OdUInt32 nVpId, OdGsEntityNode* pNextEntity)
775 {
777  nextEntEntry(nVpId)->m_pNextEntity = pNextEntity;
778  else
779  m_pNextEntity = pNextEntity;
780 }
781 
783 {
784  if (nMaxVpId == 0xFFFFFFFF) nMaxVpId = 0;
785  if ((numNextEntity() <= nMaxVpId) || ((nMaxVpId == 0) && GETBIT(m_flags, kMultilistNextPtr)))
786  allocNextEntityArray(nMaxVpId);
787 }
788 
790 {
792  throw OdError(eInvalidIndex);
793  return m_pNextEntity;
794 }
795 
797 {
799  return nextEntEntry(nVpId)->m_pNextEntity;
800  //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
801  // throw OdError(eInvalidIndex);
802  return m_pNextEntity;
803 }
804 
806 {
808  throw OdError(eInvalidIndex);
809  return m_pNextEntity;
810 }
811 
813 {
815  return nextEntEntry(nVpId)->m_pNextEntity;
816  //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
817  // throw OdError(eInvalidIndex);
818  return m_pNextEntity;
819 }
820 
822 {
824  return (OdUInt32)OdPtrToInt32(firstEntEntry()->m_pNextEntity);
825  return 1;
826 }
827 
828 inline bool OdGsEntityNode::hasExtents() const
829 {
830  return GETBIT(m_flags, kHasExtents);
831 }
832 
834 {
835  return m_extents;
836 }
837 
838 inline bool OdGsEntityNode::markedToSkip(unsigned mask)
839 {
841  //atomic function is required, called in MT mode (display)
842 #ifndef TD_SINGLE_THREAD
843  return (mask & OdInterlockedExchangeAdd(&m_markToSkipFlags, 0)) != 0;
844 #else
845  return GETBIT(m_markToSkipFlags, mask);
846 #endif
847 }
848 
849 inline void OdGsEntityNode::markToSkip(unsigned mask, bool bSkip)
850 {
852  if(markedToSkip(mask) != bSkip)
853  {
854  //atomic function is required, called in MT mode (display)
855 #ifndef TD_SINGLE_THREAD
856  if(bSkip)
857  OdInterlockedExchangeAdd(&m_markToSkipFlags, mask);
858  else
859  OdInterlockedExchangeAdd(&m_markToSkipFlags, -(int)mask);
860 #else
861  SETBIT(m_markToSkipFlags, mask, bSkip);
862 #endif
863  }
864 }
865 
867 {
868  //atomic function is NOT required, is NOT called in MT mode
869  m_markToSkipFlags = kMarkedToSkipAll;
870 }
871 
873 {
875  throw OdError(eInvalidIndex);
877 }
878 
880 {
882  return GETBIT(nextEntEntry(nVpId)->m_entFlags, kSpatiallyIndexed);
883  //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
884  // throw OdError(eInvalidIndex);
886 }
887 
888 inline void OdGsEntityNode::setSpatiallyIndexed(bool bIndexed)
889 {
891  throw OdError(eInvalidIndex);
892  SETBIT(m_flags, kSpatiallyIndexed, bIndexed);
893 }
894 
895 inline void OdGsEntityNode::setSpatiallyIndexed(OdUInt32 nVpId, bool bIndexed)
896 {
898  SETBIT(nextEntEntry(nVpId)->m_entFlags, kSpatiallyIndexed, bIndexed);
899  else
900  SETBIT(m_flags, kSpatiallyIndexed, bIndexed);
901 }
902 
903 inline bool OdGsEntityNode::owned() const
904 {
906  throw OdError(eInvalidIndex);
907  return GETBIT(m_flags, kOwned);
908 }
909 
910 inline bool OdGsEntityNode::owned(OdUInt32 nVpId) const
911 {
913  return GETBIT(nextEntEntry(nVpId)->m_entFlags, kOwned);
914  //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
915  // throw OdError(eInvalidIndex);
916  return GETBIT(m_flags, kOwned);
917 }
918 
919 inline void OdGsEntityNode::setOwned(bool bOwned)
920 {
922  throw OdError(eInvalidIndex);
923  SETBIT(m_flags, kOwned, bOwned);
924 }
925 
926 inline void OdGsEntityNode::setOwned(OdUInt32 nVpId, bool bOwned)
927 {
929  SETBIT(nextEntEntry(nVpId)->m_entFlags, kOwned, bOwned);
930  else
931  SETBIT(m_flags, kOwned, bOwned);
932 }
933 
935 {
936  return m_metafile.getArray();
937 }
938 
940 {
941  return m_metafile.getArray();
942 }
943 
945 {
946  return m_metafile.get();
947 }
948 
950 {
951  return metafileArray()[metafileIndex];
952 }
953 
954 #define VPMETAFILEHOLDERARRAY_DESTRUCTOR ~MetafilePtrArray
955 
957 {
958  m_metafile.set(pMetafile);
959 }
960 
962 {
963  return GETBIT(m_flags, kEntityUnerased);
964 }
965 
966 inline void OdGsEntityNode::setEntityUnerased(bool flag)
967 {
969 }
970 
971 inline bool OdGsEntityNode::isInvisible() const
972 {
973  return GETBIT(m_flags, kInvisible);
974 }
975 
977 {
978  if (invalidVp())
979  {
980  setInvalidVp(false);
981  }
982 }
983 
985 {
986  return GETBIT(m_flags, kNonSelectable);
987 }
988 
990 {
992 }
993 
995 {
996  return GETBIT(m_flags, kSkipSelection);
997 }
998 
1000 {
1001  SETBIT(m_flags, kSkipSelection, val);
1002 }
1003 
1005 {
1006  return GETBIT(m_flags, kErased);
1007 }
1008 
1009 inline void OdGsEntityNode::markErased(bool val)
1010 {
1011  SETBIT(m_flags, kErased, val);
1012 }
1013 
1015 {
1016  for(const OdGsGeomPortion* ptr = &m_first; ptr; ptr = ptr->m_pNext)
1017  {
1018  if(ptr->m_pGsMetafile.get())
1019  return false;
1020  }
1021  return true;
1022 }
1023 
1025 {
1026  return GETBIT(m_flags, kExtentsOutOfMS);
1027 }
1028 
1030 {
1032 }
1033 
1035 {
1037 }
1038 
1040 {
1042 }
1043 
1045 {
1047 }
1048 
1049 inline bool OdGsEntityNode::isInWorkset() const
1050 {
1051  return GETBIT(m_flags, kInWorkset);
1052 }
1053 
1054 inline void OdGsEntityNode::setInWorkset(bool val)
1055 {
1056  SETBIT(m_flags, kInWorkset, val);
1057 }
1058 
1060 {
1061  return GETBIT(m_flags, kSingleThreaded);
1062 }
1063 
1065 {
1067 }
1068 
1070 {
1072 }
1073 
1074 inline void OdGsEntityNode::setRegenOnDraw(bool val)
1075 {
1077 }
1078 
1079 inline void OdGsEntityNode::highlight(bool bDoIt, bool bWholeBranch)
1080 {
1081  OdGsNode::highlight(bDoIt, bWholeBranch);
1082  if(hlBranch() && (!bDoIt || bWholeBranch))
1083  setHlBranch(NULL);
1084 }
1085 
1087 {
1090 }
1091 
1093 {
1095 }
1096 
1098 {
1099  if (lwd)
1100  {
1102  if (lwd > maxLwd)
1104  }
1105 }
1106 
1108 {
1110 }
1111 
1113 {
1115 }
1116 
1118 {
1120 }
1121 
1122 #include "TD_PackPop.h"
1123 
1124 #endif // __OD_GS_ENTITY_NODE__
@ kInvisible
Definition: BrEnums.h:115
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:49
lwd
Definition: DimVarDefs.h:1474
GE_TOOLKIT_EXPORT OdGeDoubleArray & getArray(OdGeKnotVector *p)
OdGiRegenType
Definition: GiCommonDraw.h:50
@ kOdGiStandardDisplay
Definition: GiCommonDraw.h:52
@ kOdGiHideOrShadeCommand
Definition: GiCommonDraw.h:53
@ kOdGiRenderCommand
Definition: GiCommonDraw.h:54
ENodeType
Definition: GsBaseModel.h:65
@ kEntityNode
Definition: GsBaseModel.h:72
EMetafilePlayMode
Definition: GsDefs.h:328
@ kMfDisplay
Definition: GsDefs.h:329
OdSmartPtr< OdGsEntityNode > OdGsEntityNodePtr
Definition: GsEntityNode.h:764
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
#define NULL
Definition: GsProperties.h:177
@ kVpRegenType
@ kVpRenderMode
#define odmax(X, Y)
Definition: OdPlatform.h:35
unsigned int OdUInt32
unsigned char OdUInt8
#define OdPtrToInt32(arg)
ptrdiff_t OdIntPtr
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
IAllocator * getAt(unsigned i)
virtual void release(void *p)=0
virtual void * alloc(int)=0
T & at(size_type arrayIndex)
Definition: OdArray.h:1140
void resize(size_type logicalLength, const T &value)
Definition: OdArray.h:834
bool isNull() const
Definition: BaseObjectPtr.h:70
bool isValidExtents() const
Definition: GeExtents3d.h:120
void setDevice(OdGsBaseVectorizeDevice *device)
Definition: GsEntityNode.h:166
void setMetafileLength(OdUInt64 l)
Definition: GsEntityNode.h:181
void setDevice(OdRxObjectPtr dev)
Definition: GsEntityNode.h:178
OdUInt64 metafileLength() const
Definition: GsEntityNode.h:182
void setAwareFlagsRegenType(bool bOn)
Definition: GsEntityNode.h:374
bool isValidMf(const Metafile &mf) const
Metafile * getAtRegenType(OdGiRegenType &eRegenType)
Definition: GsEntityNode.h:331
const Metafile * get() const
Definition: GsEntityNode.h:276
const void * rawPtr() const
Definition: GsEntityNode.h:372
void setDependentGeometry(bool bSet)
Definition: GsEntityNode.h:265
OdUInt32 awareFlags(OdUInt32 nVpID) const
Definition: GsEntityNode.h:350
MetafileHolder(const MetafileHolder &c)
Definition: GsEntityNode.h:226
void setAtRegenType(Metafile *pMf, OdGiRegenType eRegenType)
Definition: GsEntityNode.h:299
MetafilePtrArray & getArray()
Definition: GsEntityNode.h:281
void setAt(int n, Metafile *pMf)
Definition: GsEntityNode.h:361
void moveTo(MetafileHolder &c, int &n)
const MetafilePtrArray & getArray() const
Definition: GsEntityNode.h:286
void setLayerDependent(bool bSet)
Definition: GsEntityNode.h:268
bool isAllLayersOff(OdUInt32 viewportId) const
bool containsAnyOfLayers(OdDbStub *const *layers, OdUInt32 count) const
bool hasDataToPlay(OdGsBaseVectorizer &view, EMetafilePlayMode eMode=kMfDisplay)
bool containsVpFrozenLayers() const
bool playNested(const OdGsView &view, OdGsEntityNode &node, OdGsBaseContext &ctx)
bool containsFrozenLayers() const
bool play(OdGsBaseVectorizer &view, EMetafilePlayMode eMode, OdGsEntityNode &node, OdGsBaseContext *ctx=NULL)
bool layersChanged(OdUInt32 nVpId) const
OdGsGeomPortion m_first
Definition: GsEntityNode.h:143
virtual void makeStock()
const OdGsHlBranch * hlBranch() const
Definition: GsEntityNode.h:711
virtual bool isLight() const
Definition: GsEntityNode.h:579
MetafilePtrArray & metafileArray()
Definition: GsEntityNode.h:934
void setEntityUnerased(bool flag)
Definition: GsEntityNode.h:966
static void * Realloc(void *pMemBlock, size_t newSize, size_t)
Definition: GsEntityNode.h:190
bool owned() const
Definition: GsEntityNode.h:903
void setMarkedByUpdateManager(bool marked)
bool markedAsNonSelectable() const
Definition: GsEntityNode.h:984
bool markedByUpdateManager() const
OdGsEntityNode::MetafilePtr metafileAt(int metafileIndex) const
Definition: GsEntityNode.h:949
virtual bool hasFrozenLayers()
void invalidate(OdGsContainerNode *pParent, OdGsViewImpl *pView, OdUInt32 mask)
void addMaxLineweightUsed(OdDb::LineWeight lwd)
OdGsHlBranch * hlBranch()
Definition: GsEntityNode.h:710
void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)
void setMetafile(OdGsUpdateContext &ctx, OdGsEntityNode::Metafile *metafiles)
void setExtentsOutOfModelSpace(bool flag)
virtual ENodeType nodeType() const
Definition: GsEntityNode.h:576
OdGsEntityNode::MetafilePtr metafile() const
Definition: GsEntityNode.h:944
bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
void select(OdGsBaseVectorizer &view)
ODRX_DECLARE_MEMBERS(OdGsEntityNode)
OdGsDCRect extentsToPixels(const OdGeExtents3d &ext, OdGsViewImpl *pViewImpl)
void setAsLightSourceOwner(bool bSet)
OdUInt32 numNextEntity() const
Definition: GsEntityNode.h:821
static OdGsEntityNode::MetafilePtr getEmptyMetafile(OdUInt32 flags, OdGsLayerNode *pLayerNode=NULL)
void resetInvalidVpFlag()
Definition: GsEntityNode.h:976
void enableMultipleNextEntities(OdUInt32 nMaxVpId)
Definition: GsEntityNode.h:782
static void * Alloc(size_t nBytes)
Definition: GsEntityNode.h:188
virtual void highlight(bool bDoIt, bool bWholeBranch)
bool entityUnerased() const
Definition: GsEntityNode.h:961
void setExtentsFlags()
OdGsEntityNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable, bool bSetGsNode=false)
static void Free(void *pMemBlock)
Definition: GsEntityNode.h:189
bool isMarkedErased() const
bool isExtentsOutOfModelSpace() const
OdUInt32 m_entFlags
Definition: GsEntityNode.h:753
virtual void releaseStock()
void setMaxLineweightUsed(OdDb::LineWeight lwd)
void setExtentsFromMetafiles()
void display(OdGsDisplayContext &ctx)
virtual void propagateLayerChangesStock()
virtual bool isReference() const
Definition: GsEntityNode.h:578
virtual void playAsGeometry(OdGsBaseVectorizer &view, EMetafilePlayMode eMode)
bool isInWorkset() const
void setRegenOnDraw(bool val)
void setInWorkset(bool val)
OdSmartPtr< Metafile > MetafilePtr
Definition: GsEntityNode.h:150
void markAsNonSelectable(bool val)
Definition: GsEntityNode.h:989
static unsigned markToSkipMask(OdUInt32 threadIndex)
Definition: GsEntityNode.h:682
bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
bool isSingleThreaded() const
const OdGeExtents3d & extents() const
Definition: GsEntityNode.h:833
virtual void propagateLayerChanges(OdGsViewImpl &view)
bool isInvisible() const
Definition: GsEntityNode.h:971
bool isMarkedSkipSelection() const
Definition: GsEntityNode.h:994
bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
virtual OdUInt32 awareFlags(OdUInt32 viewportId) const
void setOwned(bool owned)
Definition: GsEntityNode.h:919
MetafileHolder m_metafile
Definition: GsEntityNode.h:395
OdRxObject * findCompatibleCache(const OdGsViewImpl &keyView, OdGsUpdateContext *ctx, OdUInt32 awareMask=0)
bool extents(OdGeExtents3d &extents) const
void setHlBranch(OdGsHlBranch *pBr)
Definition: GsEntityNode.h:709
void convertToViewportDependent(const OdGsUpdateContext &ctx)
void addContentToUpdateManager(OdUInt32 viewportId, OdGsUpdateManager *pManager, const UpdateManagerContext &context)
OdGsEntityNode::Metafile * metafile(const OdGsViewImpl &view, OdGsUpdateContext *ctx, MetafileCompatibilityLevel findCompatibleLevel=kFindCompatible)
void updateVisible(OdGsViewImpl *pViewImpl)
void markToSkip(unsigned mask, bool markToSkip)
Definition: GsEntityNode.h:849
bool isRequireRegenOnHighlightChange() const
void setMetafileAt(int metafileIndex, OdGsEntityNode::Metafile *pMetafile)
void setMetafile(OdGsEntityNode::Metafile *metafiles)
Definition: GsEntityNode.h:956
OdGeExtents3d m_extents
Definition: GsEntityNode.h:118
virtual bool layersChanged(OdGsViewImpl &view) const
bool findMetafileInStock(OdGsUpdateContext &ctx)
void setSpatiallyIndexed(bool spatiallyIndexed)
Definition: GsEntityNode.h:888
bool spatiallyIndexed() const
Definition: GsEntityNode.h:872
OdGsEntityNode * nextEntity()
Definition: GsEntityNode.h:789
void markToSkipAll()
Definition: GsEntityNode.h:866
void setNextEntity(OdGsEntityNode *pNextEntity)
Definition: GsEntityNode.h:767
bool isLightSourceOwner() const
void setSingleThreaded(bool val)
void markSkipSelection(bool val)
Definition: GsEntityNode.h:999
OdGsHlBranchPtr m_hlBranch
Definition: GsEntityNode.h:386
OdDb::LineWeight getMaxLineweightUsed() const
void insertToSpatialIndex(OdUInt32 nVpId, OdSiSpatialIndex &parentIndex, const OdGeExtents3d &prevExtents)
bool isRegenOnDraw() const
bool markedToSkip(unsigned mask)
Definition: GsEntityNode.h:838
virtual OdGsEntityNode::MetafilePtr regenMetafile(OdGsUpdateContext &ctx, OdUInt32 vpDepFlags)
virtual bool isEmpty()
void markErased(bool val)
bool hasExtents() const
Definition: GsEntityNode.h:828
OdUInt32 m_flags
Definition: GsNode.h:87
virtual OdDb::LineWeight getMaxLineweightUsed() const
virtual void destroy()=0
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
@ kLastFlag
Definition: GsNode.h:84
void setInvalidVp(bool val)
Definition: GsNode.h:93
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
Definition: GsNode.h:70
bool invalidVp() const
Definition: GsNode.h:91
virtual void highlight(bool bDoIt, bool bWholeBranch)
Definition: GsNode.h:262
Definition: Gs.h:133
virtual void addRef()=0
GLsizeiptr size
Definition: gles2_ext.h:182
GLuint index
Definition: gles2_ext.h:265
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
GLsizei GLsizei * count
Definition: gles2_ext.h:276
LineWeight
Definition: OdaDefs.h:382
bool ODSI_API properExtents(const OdGeExtents3d &ext)
void copyFrom(OdGsGeomPortion &c)
Definition: GsEntityNode.h:53
OdRxObjectPtr m_pGsMetafile
Definition: GsEntityNode.h:43
void filterEmptyNestedPortions()
Definition: GsEntityNode.h:79
bool isEmptyPortion() const
Definition: GsEntityNode.h:78
OdGsGeomPortion * m_pNext
Definition: GsEntityNode.h:44
OdGsLayerNode * m_pLayer
Definition: GsEntityNode.h:42
void freeNestedPortions()
Definition: GsEntityNode.h:67