CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsEntityNode.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_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
35
36#include "TD_PackPush.h"
37
41{
48
53 : m_pLayer(0)
54 , m_pGsMetafile(0)
55 , m_pNext(0)
56 {
57 }
58
65 {
68 m_pNext = c.m_pNext;
69 }
70
74 void clear()
75 {
76 m_pLayer = NULL;
77 m_pGsMetafile = NULL;
78 m_pNext = NULL;
79 }
80
85 {
86 OdGsGeomPortion* pPortion = m_pNext;
87 while (pPortion)
88 {
89 OdGsGeomPortion* pNextPortion = pPortion->m_pNext;
90 delete pPortion;
91 pPortion = pNextPortion;
92 }
93 }
94
98 bool isEmptyPortion() const { return (m_pLayer == NULL) && m_pGsMetafile.isNull(); }
99
104 {
105 while (m_pNext && m_pNext->isEmptyPortion())
106 {
107 OdGsGeomPortion* pNextPortion = m_pNext->m_pNext;
108 delete m_pNext;
109 m_pNext = pNextPortion;
110 }
111 if (m_pNext)
113 }
114};
115
117class OdGsBaseContext;
118
127{
128 OdGsEntityNode* m_pNextEntity;
129
134 struct NextEntityEntry
135 {
136 OdGsEntityNode* m_pNextEntity;
137 OdUInt32 m_entFlags;
138 };
143 void allocNextEntityArray(OdUInt32 nMaxVpId);
144
148 inline NextEntityEntry *firstEntEntry() { return reinterpret_cast<NextEntityEntry*>(m_pNextEntity); }
149
153 inline const NextEntityEntry *firstEntEntry() const { return reinterpret_cast<const NextEntityEntry*>(m_pNextEntity); }
154 inline void checkEntEntry(OdUInt32 nVpId) const { if ((OdUInt32)OdPtrToInt32(firstEntEntry()->m_pNextEntity) <= nVpId) throw OdError(eInvalidIndex); }
155
160 inline NextEntityEntry *nextEntEntry(OdUInt32 nVpId) { checkEntEntry(nVpId); return reinterpret_cast<NextEntityEntry*>(m_pNextEntity) + (nVpId + 1); }
161
166 inline const NextEntityEntry *nextEntEntry(OdUInt32 nVpId) const { checkEntEntry(nVpId); return reinterpret_cast<const NextEntityEntry*>(m_pNextEntity) + (nVpId + 1); }
167protected:
169
170public:
172 {
173 public:
174 void* operator new(size_t);
175 void operator delete(void *);
176
181
186
197 bool play(OdGsBaseVectorizer& view, EMetafilePlayMode eMode, OdGsEntityNode& node, OdGsBaseContext* ctx = NULL);
198
209 bool playNested(const OdGsView& view, OdGsEntityNode& node, OdGsBaseContext& ctx);
210
219 bool hasDataToPlay(const OdGsView& view, EMetafilePlayMode eMode = kMfDisplay) const;
220
228 bool layersChanged(OdUInt32 nVpId) const;
229
237
245
254 bool containsAnyOfLayers( OdDbStub*const* layers, OdUInt32 count ) const;
255
262 bool isEmpty() const;
263
270 bool isAllLayersOff( OdUInt32 viewportId ) const;
271
278 };
279 friend class Metafile;
280
285
287 {
288 protected:
291 public:
293 {
294 OdGsBaseVectorizeDevice* m_pDevice;
295 public:
297 {
298 m_pDevice = NULL;
299 };
301 {
302 m_pDevice = device;
303 }
304 OdGsBaseVectorizeDevice* device() { return m_pDevice; }
305 };
306
307 MetafileEx() : Metafile(), OdGsUpdateManager::OdGsUpdateManagerElement()
308 {
309 m_pDeviceRef = NULL;
310 }
312 void setDevice( OdRxObjectPtr dev ) { m_pDeviceRef = dev; }
313 OdRxObjectPtr device() { return m_pDeviceRef; }
314
315 void setMetafileLength( OdUInt64 l ) { m_nLength = l; }
316 OdUInt64 metafileLength() const { return m_nLength; }
317 };
318
319 friend class OdGsModuleObject;
321public:
322 static void* Alloc(size_t nBytes) { return OdGsNode::s_aAlloc.getAt(1)->alloc((int)nBytes); }
323 static void Free(void* pMemBlock) { OdGsNode::s_aAlloc.getAt(1)->release(pMemBlock); }
324 static void* Realloc(void* pMemBlock, size_t newSize, size_t)
325 {
326 if(pMemBlock)
327 OdGsNode::s_aAlloc.getAt(1)->release(pMemBlock);
328 return OdGsNode::s_aAlloc.getAt(1)->alloc((int)newSize);
329 }
333 class MetafilePtrArray: public OdArrayMemAlloc<MetafilePtr, OdObjectsAllocator<MetafilePtr>, OdGsEntityNode>
334 {
335 public:
337 };
338
346 {
347 public:
348 enum
349 {
350 kArray = 1,
351 kVpDependent = 2,
352 kAwareFlagsRegenType = 4,
353
354 kRegenTypeStandard = 8,
355 kRegenTypeHideOrShade = 16,
356 kRegenTypeRenderCommand = 32,
357 kRegenTypeMask = kRegenTypeStandard | kRegenTypeHideOrShade | kRegenTypeRenderCommand,
358
359 kDependentGeometry = 64, // Marks PaperSpace entities
360 kLayerDependent = 128 // Marks compound entities w/o blocks cache (#15036)
361 };
362
366 MetafileHolder(): m_flags(0)
367 {
368 *reinterpret_cast<Metafile**>(rawPtr()) = 0;
369 }
370
376 MetafileHolder(const MetafileHolder& c): m_flags(0)
377 {
378 *reinterpret_cast<Metafile**>(rawPtr()) = 0;
379 if(!c.isValid())
380 return;
381 if(c.isArray())
382 {
383 allocateArray();
384 getArray() = const_cast<MetafileHolder&>(c).getArray();
385 }
386 else
387 {
388 *reinterpret_cast<Metafile**>(rawPtr()) = const_cast<MetafileHolder&>(c).get();
389 get()->addRef();
390 }
391 m_flags = c.m_flags;
392 }
393
398 {
399 destroy();
400 }
401
407 bool isValid() const { return *((const Metafile**)rawPtr()) != NULL; }
408
414 bool isArray() const { return GETBIT(flags(), kArray); }
415
421 bool isVpDependent() const { return GETBIT(flags(), kVpDependent); }
422
427 void setVpDependent(bool bOn)
428 {
429 SETBIT(m_flags, kVpDependent, bOn);
430 if(bOn)
431 {
432 SETBIT(m_flags, kRegenTypeMask, false);
433 setAwareFlagsRegenType(false);
434 }
435 }
436
437 bool isAwareFlagsRegenType() const { return GETBIT(flags(), kAwareFlagsRegenType); }
438 bool isRegenTypeDependent() const { return GETBIT(flags(), kRegenTypeMask); }
439
440 void setDependentGeometry(bool bSet) { SETBIT(m_flags, kDependentGeometry, bSet); }
441 bool isDependentGeometry() const { return GETBIT(flags(), kDependentGeometry); }
442
443 void setLayerDependent(bool bSet) { SETBIT(m_flags, kLayerDependent, bSet); }
444 bool isLayerDependent() const { return GETBIT(m_flags, kLayerDependent); }
445
450 {
451 ODA_ASSERT(!isArray());
452 return *reinterpret_cast<Metafile**>(rawPtr());
453 }
454
458 const Metafile* get() const
459 {
460 ODA_ASSERT(!isArray());
461 return *reinterpret_cast<Metafile**>(const_cast<MetafileHolder*>(this)->rawPtr());
462 }
463
468 {
469 ODA_ASSERT(isArray());
470 return *reinterpret_cast<MetafilePtrArray*>(rawPtr());
471 }
472
477 {
478 ODA_ASSERT(isArray());
479 return *reinterpret_cast<const MetafilePtrArray*>(rawPtr());
480 }
481
486 void set(Metafile* pMf)
487 {
488 destroy();
489 *reinterpret_cast<Metafile**>(rawPtr()) = pMf;
490 if(pMf)
491 pMf->addRef();
492 }
493
499 void setAtRegenType(Metafile* pMf, OdGiRegenType eRegenType);
500
506 {
507 ODA_ASSERT(isRegenTypeDependent());
508 ODA_ASSERT(!isArray());
509 if(GETBIT(flags(), kRegenTypeStandard))
510 eRegenType = kOdGiStandardDisplay;
511 else if(GETBIT(flags(), kRegenTypeHideOrShade))
512 eRegenType = kOdGiHideOrShadeCommand;
513 else
514 eRegenType = kOdGiRenderCommand;
515 return get();
516 }
517
522
526 void destroy();
527
535
541 void moveTo(MetafileHolder& c, int& n);
543 {
544 if(isArray())
545 {
546 if (isVpDependent() && (getArray().size() > nVpID))
547 { const MetafilePtr &pMetafile = getArray().at(nVpID);
548 return (!pMetafile.isNull()) ? pMetafile->m_nAwareFlags : 0;
549 }
550 return kVpRenderMode | (isAwareFlagsRegenType() ? kVpRegenType : 0);
551 }
552 return isValid() ? get()->m_nAwareFlags : 0;
553 }
554
561 void setAt(int n, Metafile* pMf)
562 {
563 ODA_ASSERT(isArray());
564 if(getArray().size() <= OdUInt32(n))
565 getArray().resize(n + 1);
566 getArray()[n] = pMf;
567 }
568
569 protected:
570 int flags() const { return (int)m_flags; }
571 void* rawPtr() { return &m_data; }
572 const void* rawPtr() const { return &m_data; }
573 bool isValidMf(const Metafile& mf) const;
574 void setAwareFlagsRegenType(bool bOn) { SETBIT(m_flags, kAwareFlagsRegenType, bOn); }
575
576 protected:
578#ifdef TD_STRICT_ALIGNMENT
579 OdIntPtr m_data[odmax(sizeof(MetafilePtrArray),sizeof(OdRxObject*)) / sizeof(OdIntPtr)];
580#else
581 OdUInt8 m_data[odmax(sizeof(MetafilePtrArray),sizeof(OdRxObject*))];
582#endif
583 };
584
585protected:
588
590protected:
594 MetafilePtrArray& metafileArray();
595
600 const MetafilePtrArray& metafileArray() const;
601
605 OdGsEntityNode::MetafilePtr metafile() const;
606
608public:
616
621 OdGsEntityNode::MetafilePtr metafileAt(int metafileIndex) const;
622
627 void setMetafile(OdGsEntityNode::Metafile* metafiles);
628
634 void setMetafileAt(int metafileIndex, OdGsEntityNode::Metafile* pMetafile);
635
640 void convertToViewportDependent(const OdGsUpdateContext& ctx);
641
646 {
648 kSkipCheckCompatible = 0,
650 kCheckViewChanges = 1,
652 kCheckCompatibleView = 2,
654 kFindCompatible = 3
655 };
656
663 OdGsEntityNode::Metafile* metafile(const OdGsViewImpl& view, OdGsUpdateContext* ctx,
664 MetafileCompatibilityLevel findCompatibleLevel = kFindCompatible);
670 void setMetafile(OdGsUpdateContext& ctx, OdGsEntityNode::Metafile* metafiles);
671
678 OdRxObject* findCompatibleCache(const OdGsViewImpl& keyView, OdGsUpdateContext* ctx, OdUInt32 awareMask = 0);
679protected:
680 // m_flags (don't add new flags here, we already utilized ~30 bits)
681 enum
682 {
683 kHasExtents = OdGsNode::kLastFlag << 1,
684 kSpatiallyIndexed = OdGsNode::kLastFlag << 2,
685 kInWorkset = OdGsNode::kLastFlag << 3,
686 kSingleThreaded = OdGsNode::kLastFlag << 4,
687 kOwned = OdGsNode::kLastFlag << 5,
688 kDrawableRegenDraw = OdGsNode::kLastFlag << 6,
689 kEntityUnerased = OdGsNode::kLastFlag << 7,
691 kExtentsOutOfMS = OdGsNode::kLastFlag << 9,
692 kNonSelectable = OdGsNode::kLastFlag << 10,
693 kSkipSelection = OdGsNode::kLastFlag << 11,
694 kErased = OdGsNode::kLastFlag << 12,
695 kDrawableIsXref = OdGsNode::kLastFlag << 13,
696 kMultilistNextPtr = OdGsNode::kLastFlag << 14,
697 kLastFlag = kMultilistNextPtr
698 };
699 // m_entFlags (add all new flags related to EntityNode here, keep some free space inside m_flags for inherited classes)
700 enum
701 {
702 kLineweightBit1 = (1 << 0), // reserve 8 bits for maximal lineweight
703 kLineweightBit2 = (1 << 1), kLineweightOffset = 0,
704 kLineweightBit3 = (1 << 2),
705 kLineweightBit4 = (1 << 3),
706 kLineweightBit5 = (1 << 4),
707 kLineweightBit6 = (1 << 5),
708 kLineweightBit7 = (1 << 6),
709 kLineweightBit8 = (1 << 7),
710 kLineweightBitMask = kLineweightBit1 | kLineweightBit2 | kLineweightBit3 | kLineweightBit4 | kLineweightBit5 | kLineweightBit6 | kLineweightBit7 | kLineweightBit8,
711 kLightSourceOwner = (1 << 8), // owning at least one light source
712 kRegenOnHighlight = (1 << 9), // cache require regeneration during highlighting state change
713 kMarkedByUpdateManager = (1 << 10),
714 kSkipDisplayClipping = (1 << 11),
715 kLastEntFlag = kSkipDisplayClipping
716 };
717 // m_markToSkipFlags
718 enum
719 {
720 kMarkedToSkipFirst = 0x00000001,
721 kMarkedToSkipLast = kMarkedToSkipFirst << 30,
722 kMarkedToSkipAll = 0x7FFFFFFF
723 };
724
725public:
727
735 OdGsEntityNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable, bool bSetGsNode = false);
736public:
741
746 void setNextEntity(OdGsEntityNode* pNextEntity);
747
753 void setNextEntity(OdUInt32 nVpId, OdGsEntityNode* pNextEntity);
757 OdGsEntityNode* nextEntity();
758
763 OdGsEntityNode* nextEntity(OdUInt32 nVpId);
767 const OdGsEntityNode* nextEntity() const;
768
773 const OdGsEntityNode* nextEntity(OdUInt32 nVpId) const;
777 OdUInt32 numNextEntity() const;
782 void enableMultipleNextEntities(OdUInt32 nMaxVpId);
783
790 void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
791 OdSiSpatialIndex* pParentIndex);
792
797 void updateVisible( OdGsViewImpl* pViewImpl );
798
804 virtual OdGsEntityNode::MetafilePtr regenMetafile(OdGsUpdateContext &ctx, OdUInt32 vpDepFlags);
805
824 virtual OdUInt32 awareFlags(OdUInt32 viewportId) const;
825
829 virtual ENodeType nodeType() const { return kEntityNode; }
830
831 virtual bool isReference() const { return false; }
832 virtual bool isLight() const { return false; }
833 virtual bool isSelfReferential() const { return false; }
834
839 void display(OdGsDisplayContext& ctx);
840
842
851
859 bool extents(OdGeExtents3d& extents) const;
860
865 bool spatiallyIndexed() const;
866
871 bool spatiallyIndexed(OdUInt32 nVpId) const;
872
878 void setSpatiallyIndexed(bool spatiallyIndexed);
879
885 void setSpatiallyIndexed(OdUInt32 nVpId, bool spatiallyIndexed);
886
892 bool owned() const;
893
900 bool owned(OdUInt32 nVpId) const;
901
907 void setOwned(bool owned);
908
914 void setOwned(OdUInt32 nVpId, bool owned);
915
919 bool markedByUpdateManager() const;
920
925 void setMarkedByUpdateManager( bool marked );
926
930 bool hasExtents() const;
931
935 const OdGeExtents3d& extents() const;
936
942 virtual bool isEmpty();
943
949 virtual bool hasFrozenLayers();
950
957 inline bool markedToSkip(unsigned mask);
958
964 inline void markToSkip(unsigned mask, bool markToSkip);
965
969 inline void markToSkipAll();
970
974 static unsigned markToSkipMask(OdUInt32 threadIndex)
975 {
976 ODA_ASSERT(threadIndex >= 0 && threadIndex < 31);
977 return kMarkedToSkipFirst << threadIndex;
978 }
979
983 void destroy(){}
984
992 virtual bool layersChanged(OdGsViewImpl& view) const;
993
999 bool markedAsNonSelectable() const;
1000
1005 void markAsNonSelectable(bool val);
1006 bool isMarkedSkipSelection() const;
1007 void markSkipSelection(bool val);
1008
1014 bool isMarkedErased() const;
1015
1021 void markErased(bool val);
1022
1023 bool isInWorkset() const;
1024 void setInWorkset(bool val);
1025
1031 bool isRegenOnDraw() const;
1032
1038 void setRegenOnDraw(bool val);
1039
1045 bool isSingleThreaded() const;
1046
1052 void setSingleThreaded(bool val);
1053
1059 bool skipDisplayClipping() const;
1060
1066 void setSkipDisplayClipping(bool bOn);
1067
1071 bool isXref() const;
1072
1080 virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle = 0);
1081
1087 void setHlBranch(OdGsStateBranch* pBr) { m_hlBranch = pBr; }
1088
1092 OdGsStateBranch* hlBranch() { return m_hlBranch; }
1093
1097 const OdGsStateBranch* hlBranch() const { return m_hlBranch; }
1104 void hide(bool bDoIt, bool bSelectable = false, bool bWholeBranch = true);
1108 void setVisibilityBranch( OdGsStateBranch* pBr ) { m_visBranch = pBr; }
1112 OdGsStateBranch* visibilityBranch() { return m_visBranch; }
1116 const OdGsStateBranch* visibilityBranch() const { return m_visBranch; }
1117
1119
1125 bool extents(const OdGsView* pView, OdGeExtents3d& ext) const;
1126
1133
1139 void addMaxLineweightUsed(OdDb::LineWeight lwd);
1140
1146 void setMaxLineweightUsed(OdDb::LineWeight lwd);
1147
1153 bool entityUnerased() const;
1154
1160 void setEntityUnerased(bool flag);
1161
1167 bool isInvisible() const;
1168
1169 bool isExtentsOutOfModelSpace() const;
1170 void setExtentsOutOfModelSpace(bool flag);
1171
1175 void resetInvalidVpFlag();
1176
1182 void setAsLightSourceOwner(bool bSet);
1183
1189 bool isLightSourceOwner() const;
1190
1196 bool isRequireRegenOnHighlightChange() const;
1197
1198public:
1199 virtual void makeStock();
1200 virtual void releaseStock();
1202
1211 bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
1212
1221 bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
1222protected:
1223 bool findMetafileInStock(OdGsUpdateContext& ctx);
1225 const OdGeExtents3d& prevExtents);
1226 inline void setExtentsFlags();
1227
1228private:
1229 MetafileHolder m_mfStock;
1230 volatile int m_markToSkipFlags;
1231protected:
1232 // This flags willn't increase memory usage (at least on Win32) since utilize free space in 8 bytes alignment (__alignof(entity_node) == 8).
1234public:
1241 void addContentToUpdateManager( OdUInt32 viewportId, OdGsUpdateManager* pManager, const UpdateManagerContext& context );
1242
1249 bool isMetafilesCompatible( const OdGsViewImpl* pView1, const OdGsViewImpl* pView2, OdGsUpdateContext* ctx );
1250};
1251
1256
1257
1259{
1261 throw OdError(eInvalidIndex);
1262 m_pNextEntity = pNextEntity;
1263}
1264
1266{
1268 nextEntEntry(nVpId)->m_pNextEntity = pNextEntity;
1269 else
1270 m_pNextEntity = pNextEntity;
1271}
1272
1274{
1275 if (nMaxVpId == 0xFFFFFFFF) nMaxVpId = 0;
1276 if ((numNextEntity() <= nMaxVpId) || ((nMaxVpId == 0) && GETBIT(m_flags, kMultilistNextPtr)))
1277 allocNextEntityArray(nMaxVpId);
1278}
1279
1281{
1283 throw OdError(eInvalidIndex);
1284 return m_pNextEntity;
1285}
1286
1288{
1290 return nextEntEntry(nVpId)->m_pNextEntity;
1291 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1292 // throw OdError(eInvalidIndex);
1293 return m_pNextEntity;
1294}
1295
1297{
1299 throw OdError(eInvalidIndex);
1300 return m_pNextEntity;
1301}
1302
1304{
1306 return nextEntEntry(nVpId)->m_pNextEntity;
1307 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1308 // throw OdError(eInvalidIndex);
1309 return m_pNextEntity;
1310}
1311
1313{
1315 return (OdUInt32)OdPtrToInt32(firstEntEntry()->m_pNextEntity);
1316 return 1;
1317}
1318
1320{
1321 return GETBIT(m_flags, kHasExtents);
1322}
1323
1325{
1326 return m_extents;
1327}
1328
1330{
1332 //atomic function is required, called in MT mode (display)
1333#ifndef TD_SINGLE_THREAD
1334 return (mask & OdInterlockedExchangeAdd(&m_markToSkipFlags, 0)) != 0;
1335#else
1336 return GETBIT(m_markToSkipFlags, mask);
1337#endif
1338}
1339
1340inline void OdGsEntityNode::markToSkip(unsigned mask, bool bSkip)
1341{
1343 ODA_ASSERT(mask && !(mask & (mask-1))); // this function does not accept multi-bit masks
1344 if(markedToSkip(mask) != bSkip)
1345 {
1346 //atomic function is required, called in MT mode (display)
1347#ifndef TD_SINGLE_THREAD
1348 if(bSkip)
1349 OdInterlockedExchangeAdd(&m_markToSkipFlags, mask);
1350 else
1351 OdInterlockedExchangeAdd(&m_markToSkipFlags, -(int)mask);
1352#else
1353 SETBIT(m_markToSkipFlags, mask, bSkip);
1354#endif
1355 }
1356}
1357
1359{
1360 //atomic function is NOT required, is NOT called in MT mode
1361 m_markToSkipFlags = kMarkedToSkipAll;
1362}
1363
1365{
1367 throw OdError(eInvalidIndex);
1369}
1370
1372{
1374 return GETBIT(nextEntEntry(nVpId)->m_entFlags, kSpatiallyIndexed);
1375 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1376 // throw OdError(eInvalidIndex);
1378}
1379
1380inline void OdGsEntityNode::setSpatiallyIndexed(bool bIndexed)
1381{
1383 throw OdError(eInvalidIndex);
1384 SETBIT(m_flags, kSpatiallyIndexed, bIndexed);
1385}
1386
1387inline void OdGsEntityNode::setSpatiallyIndexed(OdUInt32 nVpId, bool bIndexed)
1388{
1390 SETBIT(nextEntEntry(nVpId)->m_entFlags, kSpatiallyIndexed, bIndexed);
1391 else
1392 SETBIT(m_flags, kSpatiallyIndexed, bIndexed);
1393}
1394
1395inline bool OdGsEntityNode::owned() const
1396{
1398 throw OdError(eInvalidIndex);
1399 return GETBIT(m_flags, kOwned);
1400}
1401
1402inline bool OdGsEntityNode::owned(OdUInt32 nVpId) const
1403{
1405 return GETBIT(nextEntEntry(nVpId)->m_entFlags, kOwned);
1406 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1407 // throw OdError(eInvalidIndex);
1408 return GETBIT(m_flags, kOwned);
1409}
1410
1411inline void OdGsEntityNode::setOwned(bool bOwned)
1412{
1414 throw OdError(eInvalidIndex);
1415 SETBIT(m_flags, kOwned, bOwned);
1416}
1417
1418inline void OdGsEntityNode::setOwned(OdUInt32 nVpId, bool bOwned)
1419{
1421 SETBIT(nextEntEntry(nVpId)->m_entFlags, kOwned, bOwned);
1422 else
1423 SETBIT(m_flags, kOwned, bOwned);
1424}
1425
1427{
1428 return m_metafile.getArray();
1429}
1430
1432{
1433 return m_metafile.getArray();
1434}
1435
1437{
1438 return m_metafile.get();
1439}
1440
1442{
1443 return metafileArray()[metafileIndex];
1444}
1445
1446#define VPMETAFILEHOLDERARRAY_DESTRUCTOR ~MetafilePtrArray
1447
1449{
1450 m_metafile.set(pMetafile);
1451}
1452
1454{
1456}
1457
1459{
1461}
1462
1464{
1465 return GETBIT(m_flags, kInvisible);
1466}
1467
1469{
1470 if (invalidVp())
1471 {
1472 setInvalidVp(false);
1473 }
1474}
1475
1477{
1478 return GETBIT(m_flags, kNonSelectable);
1479}
1480
1482{
1484}
1485
1487{
1488 return GETBIT(m_flags, kSkipSelection);
1489}
1490
1492{
1494}
1495
1497{
1498 return GETBIT(m_flags, kErased);
1499}
1500
1501inline void OdGsEntityNode::markErased(bool val)
1502{
1503 SETBIT(m_flags, kErased, val);
1504}
1505
1507{
1508 for(const OdGsGeomPortion* ptr = &m_first; ptr; ptr = ptr->m_pNext)
1509 {
1510 if(ptr->m_pGsMetafile.get())
1511 return false;
1512 }
1513 return true;
1514}
1515
1517{
1519}
1520
1522{
1524}
1525
1527{
1529}
1530
1532{
1534}
1535
1537{
1539}
1540
1542{
1543 return GETBIT(m_flags, kInWorkset);
1544}
1545
1546inline void OdGsEntityNode::setInWorkset(bool val)
1547{
1548 SETBIT(m_flags, kInWorkset, val);
1549}
1550
1552{
1554}
1555
1557{
1559}
1560
1562{
1564}
1565
1567{
1569}
1570
1571inline void OdGsEntityNode::highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle)
1572{
1573 OdGsNode::highlight(bDoIt, bWholeBranch, nSelStyle);
1574 if(hlBranch() && (!bDoIt || bWholeBranch))
1575 setHlBranch(NULL);
1576}
1577
1578inline void OdGsEntityNode::hide(bool bDoIt, bool bSelectable, bool bWholeBranch)
1579{
1580 OdGsNode::hide(bDoIt, bSelectable, bWholeBranch);
1581 if( visibilityBranch() && (!bDoIt || bWholeBranch) )
1582 setVisibilityBranch(NULL);
1583}
1584
1586{
1589}
1590
1592{
1594}
1595
1597{
1598 if (lwd)
1599 {
1601 if (lwd > maxLwd)
1603 }
1604}
1605
1607{
1608 m_entFlags = ((OdUInt32(lwd) << kLineweightOffset) & kLineweightBitMask) | (m_entFlags & ~kLineweightBitMask);
1609}
1610
1612{
1614}
1615
1617{
1619}
1620
1622{
1624}
1625
1627{
1629}
1630
1631inline bool OdGsEntityNode::isXref() const
1632{
1634}
1635
1637
1638#include "TD_PackPop.h"
1639
1640#endif // __OD_GS_ENTITY_NODE__
@ kInvisible
Definition: BrEnums.h:152
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:57
lwd
Definition: DimVarDefs.h:1474
GE_TOOLKIT_EXPORT OdGeDoubleArray & getArray(OdGeKnotVector *p)
OdGiRegenType
Definition: GiCommonDraw.h:51
@ kOdGiStandardDisplay
Definition: GiCommonDraw.h:53
@ kOdGiHideOrShadeCommand
Definition: GiCommonDraw.h:54
@ kOdGiRenderCommand
Definition: GiCommonDraw.h:55
ENodeType
Definition: GsBaseModel.h:69
@ kEntityNode
Definition: GsBaseModel.h:76
EMetafilePlayMode
Definition: GsDefs.h:515
@ kMfDisplay
Definition: GsDefs.h:517
OdSmartPtr< OdGsEntityNode > OdGsEntityNodePtr
OdArray< OdGsEntityNode *, OdMemoryAllocator< OdGsEntityNode * > > OdGsEntityNodeArray
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
@ 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:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
IAllocator * getAt(unsigned i)
virtual void release(void *p)=0
virtual void * alloc(int)=0
T & at(size_type arrayIndex)
Definition: OdArray.h:1642
void resize(size_type logicalLength, const T &value)
Definition: OdArray.h:1185
bool isNull() const
Definition: BaseObjectPtr.h:86
bool isValidExtents() const
Definition: GeExtents3d.h:172
void setDevice(OdGsBaseVectorizeDevice *device)
Definition: GsEntityNode.h:300
void setMetafileLength(OdUInt64 l)
Definition: GsEntityNode.h:315
void setDevice(OdRxObjectPtr dev)
Definition: GsEntityNode.h:312
OdUInt64 metafileLength() const
Definition: GsEntityNode.h:316
void setAwareFlagsRegenType(bool bOn)
Definition: GsEntityNode.h:574
bool isValidMf(const Metafile &mf) const
MetafilePtrArray & getArray()
Definition: GsEntityNode.h:467
void setDependentGeometry(bool bSet)
Definition: GsEntityNode.h:440
const MetafilePtrArray & getArray() const
Definition: GsEntityNode.h:476
OdUInt32 awareFlags(OdUInt32 nVpID) const
Definition: GsEntityNode.h:542
MetafileHolder(const MetafileHolder &c)
Definition: GsEntityNode.h:376
void setAtRegenType(Metafile *pMf, OdGiRegenType eRegenType)
void setAt(int n, Metafile *pMf)
Definition: GsEntityNode.h:561
Metafile * getAtRegenType(OdGiRegenType &eRegenType)
Definition: GsEntityNode.h:505
const Metafile * get() const
Definition: GsEntityNode.h:458
void moveTo(MetafileHolder &c, int &n)
const void * rawPtr() const
Definition: GsEntityNode.h:572
void setLayerDependent(bool bSet)
Definition: GsEntityNode.h:443
bool isAllLayersOff(OdUInt32 viewportId) const
bool containsAnyOfLayers(OdDbStub *const *layers, OdUInt32 count) const
bool hasDataToPlay(const OdGsView &view, EMetafilePlayMode eMode=kMfDisplay) const
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:277
virtual void makeStock()
virtual bool isLight() const
Definition: GsEntityNode.h:832
MetafilePtrArray & metafileArray()
void setEntityUnerased(bool flag)
bool owned() const
void setMarkedByUpdateManager(bool marked)
bool markedAsNonSelectable() const
bool markedByUpdateManager() const
OdGsEntityNode::MetafilePtr metafileAt(int metafileIndex) const
OdGsStateBranchPtr m_visBranch
Definition: GsEntityNode.h:587
virtual bool hasFrozenLayers()
void invalidate(OdGsContainerNode *pParent, OdGsViewImpl *pView, OdUInt32 mask)
void addMaxLineweightUsed(OdDb::LineWeight lwd)
bool skipDisplayClipping() const
void update(OdGsUpdateContext &ctx, OdGsContainerNode *pParent, OdSiSpatialIndex *pParentIndex)
void setMetafile(OdGsUpdateContext &ctx, OdGsEntityNode::Metafile *metafiles)
void setExtentsOutOfModelSpace(bool flag)
virtual bool isSelfReferential() const
Definition: GsEntityNode.h:833
virtual ENodeType nodeType() const
Definition: GsEntityNode.h:829
void setHlBranch(OdGsStateBranch *pBr)
OdGsEntityNode::MetafilePtr metafile() const
bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
void select(OdGsBaseVectorizer &view)
ODRX_DECLARE_MEMBERS(OdGsEntityNode)
void setAsLightSourceOwner(bool bSet)
OdUInt32 numNextEntity() const
static OdGsEntityNode::MetafilePtr getEmptyMetafile(OdUInt32 flags, OdGsLayerNode *pLayerNode=NULL)
void resetInvalidVpFlag()
void enableMultipleNextEntities(OdUInt32 nMaxVpId)
bool entityUnerased() const
void setExtentsFlags()
OdGsEntityNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable, bool bSetGsNode=false)
static void Free(void *pMemBlock)
Definition: GsEntityNode.h:323
OdGsStateBranchPtr m_hlBranch
Definition: GsEntityNode.h:586
bool isMarkedErased() const
bool isExtentsOutOfModelSpace() const
OdUInt32 m_entFlags
virtual void releaseStock()
void setMaxLineweightUsed(OdDb::LineWeight lwd)
void setExtentsFromMetafiles()
void display(OdGsDisplayContext &ctx)
virtual void propagateLayerChangesStock()
virtual bool isReference() const
Definition: GsEntityNode.h:831
virtual void playAsGeometry(OdGsBaseVectorizer &view, EMetafilePlayMode eMode)
bool isInWorkset() const
void setRegenOnDraw(bool val)
void setInWorkset(bool val)
OdSmartPtr< Metafile > MetafilePtr
Definition: GsEntityNode.h:284
void markAsNonSelectable(bool val)
static unsigned markToSkipMask(OdUInt32 threadIndex)
Definition: GsEntityNode.h:974
bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
void setSkipDisplayClipping(bool bOn)
bool isSingleThreaded() const
const OdGeExtents3d & extents() const
virtual void propagateLayerChanges(OdGsViewImpl &view)
OdGsStateBranch * visibilityBranch()
bool isMetafilesCompatible(const OdGsViewImpl *pView1, const OdGsViewImpl *pView2, OdGsUpdateContext *ctx)
bool isInvisible() const
bool isMarkedSkipSelection() const
bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL) const
virtual OdUInt32 awareFlags(OdUInt32 viewportId) const
void setOwned(bool owned)
MetafileHolder m_metafile
Definition: GsEntityNode.h:596
bool extents(OdGeExtents3d &extents) const
void convertToViewportDependent(const OdGsUpdateContext &ctx)
void addContentToUpdateManager(OdUInt32 viewportId, OdGsUpdateManager *pManager, const UpdateManagerContext &context)
void updateVisible(OdGsViewImpl *pViewImpl)
void markToSkip(unsigned mask, bool markToSkip)
bool isRequireRegenOnHighlightChange() const
void setMetafileAt(int metafileIndex, OdGsEntityNode::Metafile *pMetafile)
void setMetafile(OdGsEntityNode::Metafile *metafiles)
OdGeExtents3d m_extents
Definition: GsEntityNode.h:168
virtual bool layersChanged(OdGsViewImpl &view) const
bool findMetafileInStock(OdGsUpdateContext &ctx)
void setSpatiallyIndexed(bool spatiallyIndexed)
OdGsStateBranch * hlBranch()
bool spatiallyIndexed() const
const OdGsStateBranch * visibilityBranch() const
OdGsEntityNode * nextEntity()
void markToSkipAll()
void setNextEntity(OdGsEntityNode *pNextEntity)
void setVisibilityBranch(OdGsStateBranch *pBr)
bool isLightSourceOwner() const
void setSingleThreaded(bool val)
OdGsEntityNode::Metafile * metafile(const OdGsViewImpl &view, OdGsUpdateContext *ctx, MetafileCompatibilityLevel findCompatibleLevel=kFindCompatible)
void markSkipSelection(bool val)
bool isXref() const
OdDb::LineWeight getMaxLineweightUsed() const
void insertToSpatialIndex(OdUInt32 nVpId, OdSiSpatialIndex &parentIndex, const OdGeExtents3d &prevExtents)
bool isRegenOnDraw() const
static void * Alloc(size_t nBytes)
Definition: GsEntityNode.h:322
bool markedToSkip(unsigned mask)
virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle=0)
const OdGsStateBranch * hlBranch() const
virtual OdGsEntityNode::MetafilePtr regenMetafile(OdGsUpdateContext &ctx, OdUInt32 vpDepFlags)
virtual bool isEmpty()
void hide(bool bDoIt, bool bSelectable=false, bool bWholeBranch=true)
static void * Realloc(void *pMemBlock, size_t newSize, size_t)
Definition: GsEntityNode.h:324
OdRxObject * findCompatibleCache(const OdGsViewImpl &keyView, OdGsUpdateContext *ctx, OdUInt32 awareMask=0)
void markErased(bool val)
bool hasExtents() const
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
@ kLastFlag
Definition: GsNode.h:88
virtual void destroy()=0
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
void setInvalidVp(bool val)
Definition: GsNode.h:100
virtual void hide(bool bDoIt, bool bSelectable=false, bool bWholeBranch=true)
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
Definition: GsNode.h:70
bool invalidVp() const
Definition: GsNode.h:98
Definition: Gs.h:140
virtual void addRef()=0
GLsizeiptr size
Definition: gles2_ext.h:182
GLenum GLint GLuint mask
Definition: gles2_ext.h:262
GLsizei GLsizei * count
Definition: gles2_ext.h:276
LineWeight
Definition: OdaDefs.h:386
bool ODSI_API properExtents(const OdGeExtents3d &ext)
void copyFrom(OdGsGeomPortion &c)
Definition: GsEntityNode.h:64
OdRxObjectPtr m_pGsMetafile
Definition: GsEntityNode.h:45
void filterEmptyNestedPortions()
Definition: GsEntityNode.h:103
bool isEmptyPortion() const
Definition: GsEntityNode.h:98
OdGsGeomPortion * m_pNext
Definition: GsEntityNode.h:47
OdGsLayerNode * m_pLayer
Definition: GsEntityNode.h:43
void freeNestedPortions()
Definition: GsEntityNode.h:84