CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GsEntityNode.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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
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)
112 m_pNext->filterEmptyNestedPortions();
113 }
114};
115
117class OdGsBaseContext;
118
127{
128 //DOM-IGNORE-BEGIN
129
130 OdGsEntityNode* m_pNextEntity;
131
136 struct NextEntityEntry
137 {
138 OdGsEntityNode* m_pNextEntity;
140 };
145 void allocNextEntityArray(OdUInt32 nMaxVpId);
146
150 inline NextEntityEntry *firstEntEntry() { return reinterpret_cast<NextEntityEntry*>(m_pNextEntity); }
151
155 inline const NextEntityEntry *firstEntEntry() const { return reinterpret_cast<const NextEntityEntry*>(m_pNextEntity); }
156 inline void checkEntEntry(OdUInt32 nVpId) const { if ((OdUInt32)OdPtrToInt32(firstEntEntry()->m_pNextEntity) <= nVpId) throw OdError(eInvalidIndex); }
157
162 inline NextEntityEntry *nextEntEntry(OdUInt32 nVpId) { checkEntEntry(nVpId); return reinterpret_cast<NextEntityEntry*>(m_pNextEntity) + (nVpId + 1); }
163
168 inline const NextEntityEntry *nextEntEntry(OdUInt32 nVpId) const { checkEntEntry(nVpId); return reinterpret_cast<const NextEntityEntry*>(m_pNextEntity) + (nVpId + 1); }
169
170 //DOM-IGNORE-END
171protected:
173
174public:
175 class GS_TOOLKIT_EXPORT Metafile : public OdRxObject
176 {
177 public:
178 void* operator new(size_t);
179 void operator delete(void *);
180
185
190
202
213 bool playNested(const OdGsView& view, OdGsEntityNode& node, OdGsBaseContext& ctx);
214
223 bool hasDataToPlay(const OdGsView& view, EMetafilePlayMode eMode = kMfDisplay) const;
224
232 bool layersChanged(OdUInt32 nVpId) const;
233
241
249
258 bool containsAnyOfLayers( OdDbStub*const* layers, OdUInt32 count ) const;
259
266 bool isEmpty() const;
267
274 bool isAllLayersOff( OdUInt32 viewportId ) const;
275
282 };
283 friend class Metafile;
284
289 //DOM-IGNORE-BEGIN
291 {
292 protected:
295 public:
297 {
298 OdGsBaseVectorizeDevice* m_pDevice;
299 public:
301 {
302 m_pDevice = NULL;
303 };
305 {
306 m_pDevice = device;
307 }
308 OdGsBaseVectorizeDevice* device() { return m_pDevice; }
309 };
310
316 void setDevice( OdRxObjectPtr dev ) { m_pDeviceRef = dev; }
318
321 };
322 //DOM-IGNORE-END
323 friend class OdGsModuleObject;
325public:
326 static void* Alloc(size_t nBytes) { return OdGsNode::s_aAlloc.getAt(1)->alloc((int)nBytes); }
327 static void Free(void* pMemBlock) { OdGsNode::s_aAlloc.getAt(1)->release(pMemBlock); }
328 static void* Realloc(void* pMemBlock, size_t newSize, size_t)
329 {
330 if(pMemBlock)
331 OdGsNode::s_aAlloc.getAt(1)->release(pMemBlock);
332 return OdGsNode::s_aAlloc.getAt(1)->alloc((int)newSize);
333 }
334
337 class MetafilePtrArray: public OdArrayMemAlloc<MetafilePtr, OdObjectsAllocator<MetafilePtr>, OdGsEntityNode>
338 {
339 public:
344 };
345
353 {
354 public:
355 //DOM-IGNORE-BEGIN
356
357 enum
358 {
362
367
368 kDependentGeometry = 64, // Marks PaperSpace entities
369 kLayerDependent = 128 // Marks compound entities w/o blocks cache (#15036)
370 };
371
372 //DOM-IGNORE-END
373
378 {
379 *reinterpret_cast<Metafile**>(rawPtr()) = 0;
380 }
381
388 {
389 *reinterpret_cast<Metafile**>(rawPtr()) = 0;
390 if(!c.isValid())
391 return;
392 if(c.isArray())
393 {
394 allocateArray();
395 getArray() = const_cast<MetafileHolder&>(c).getArray();
396 }
397 else
398 {
399 *reinterpret_cast<Metafile**>(rawPtr()) = const_cast<MetafileHolder&>(c).get();
400 get()->addRef();
401 }
402 m_flags = c.m_flags;
403 }
404
409 {
410 destroy();
411 }
412
418 bool isValid() const { return *((const Metafile**)rawPtr()) != NULL; }
419
425 bool isArray() const { return GETBIT(flags(), kArray); }
426
432 bool isVpDependent() const { return GETBIT(flags(), kVpDependent); }
433
438 void setVpDependent(bool bOn)
439 {
441 if(bOn)
442 {
445 }
446 }
447
449 bool isRegenTypeDependent() const { return GETBIT(flags(), kRegenTypeMask); }
450
453
454 void setLayerDependent(bool bSet) { SETBIT(m_flags, kLayerDependent, bSet); }
456
461 {
463 return *reinterpret_cast<Metafile**>(rawPtr());
464 }
465
469 const Metafile* get() const
470 {
472 return *reinterpret_cast<Metafile**>(const_cast<MetafileHolder*>(this)->rawPtr());
473 }
474
479 {
481 return *reinterpret_cast<MetafilePtrArray*>(rawPtr());
482 }
483
488 {
490 return *reinterpret_cast<const MetafilePtrArray*>(rawPtr());
491 }
492
497 void set(Metafile* pMf)
498 {
499 destroy();
500 *reinterpret_cast<Metafile**>(rawPtr()) = pMf;
501 if(pMf)
502 pMf->addRef();
503 }
504
510 void setAtRegenType(Metafile* pMf, OdGiRegenType eRegenType);
511
517 {
521 eRegenType = kOdGiStandardDisplay;
523 eRegenType = kOdGiHideOrShadeCommand;
524 else
525 eRegenType = kOdGiRenderCommand;
526 return get();
527 }
528
533
537 void destroy();
538
546
552 void moveTo(MetafileHolder& c, int& n);
554 {
555 if(isArray())
556 {
557 if (isVpDependent() && (getArray().size() > nVpID))
558 { const MetafilePtr &pMetafile = getArray().at(nVpID);
559 return (!pMetafile.isNull()) ? pMetafile->m_nAwareFlags : 0;
560 }
562 }
563 return isValid() ? get()->m_nAwareFlags : 0;
564 }
565
572 void setAt(int n, Metafile* pMf)
573 {
575 if(getArray().size() <= OdUInt32(n))
576 getArray().resize(n + 1);
577 getArray()[n] = pMf;
578 }
579
580 protected:
581 int flags() const { return (int)m_flags; }
582 void* rawPtr() { return &m_data; }
583 const void* rawPtr() const { return &m_data; }
584 bool isValidMf(const Metafile& mf) const;
586
587 protected:
589#ifndef SWIG
590#ifdef TD_STRICT_ALIGNMENT
591#if defined(_MSC_VER) && (_MSC_VER < 1900)
592 OdIntPtr m_data[((sizeof(MetafilePtrArray) > sizeof(OdRxObject*)) sizeof(MetafilePtrArray) ? sizeof(OdRxObject*):) / sizeof(OdIntPtr)];
593#else
594 OdIntPtr m_data[odmax(sizeof(MetafilePtrArray),sizeof(OdRxObject*)) / sizeof(OdIntPtr)];
595#endif
596#else
597#if defined(_MSC_VER) && (_MSC_VER < 1900)
598 OdUInt8 m_data[((sizeof(MetafilePtrArray) > sizeof(OdRxObject*)) ? sizeof(MetafilePtrArray) : sizeof(OdRxObject*))];
599#else
600 OdUInt8 m_data[odmax(sizeof(MetafilePtrArray),sizeof(OdRxObject*))];
601#endif
602#endif
603#endif
604 };
605
606protected:
608
610protected:
615
620 const MetafilePtrArray& metafileArray() const;
621
626
628public:
636
641 OdGsEntityNode::MetafilePtr metafileAt(int metafileIndex) const;
642
647 void setMetafile(OdGsEntityNode::Metafile* metafiles);
648
654 void setMetafileAt(int metafileIndex, OdGsEntityNode::Metafile* pMetafile);
655
660 void convertToViewportDependent(const OdGsUpdateContext& ctx);
661
676
683 OdGsEntityNode::Metafile* metafile(const OdGsViewImpl& view, OdGsUpdateContext* ctx,
684 MetafileCompatibilityLevel findCompatibleLevel = kFindCompatible);
690 void setMetafile(OdGsUpdateContext& ctx, OdGsEntityNode::Metafile* metafiles);
691
698 OdRxObject* findCompatibleCache(const OdGsViewImpl& keyView, OdGsUpdateContext* ctx, OdUInt32 awareMask = 0);
699
706 OdRxObject *findFirstGsMetafile(const OdGsViewImpl &view, bool *bContainsNested = nullptr,
708protected:
709 // m_flags (don't add new flags here, we already utilized ~30 bits)
710 enum
711 {
727 };
728 // m_entFlags (add all new flags related to EntityNode here, keep some free space inside m_flags for inherited classes)
729 enum
730 {
731 kLineweightBit1 = (1 << 0), // reserve 8 bits for maximal lineweight
733 kLineweightBit3 = (1 << 2),
734 kLineweightBit4 = (1 << 3),
735 kLineweightBit5 = (1 << 4),
736 kLineweightBit6 = (1 << 5),
737 kLineweightBit7 = (1 << 6),
738 kLineweightBit8 = (1 << 7),
740 kLightSourceOwner = (1 << 8), // owning at least one light source
741 kRegenOnHighlight = (1 << 9), // cache require regeneration during highlighting state change
745 };
746 // m_markToSkipFlags
747 enum
748 {
749 kMarkedToSkipFirst = 0x00000001,
751 kMarkedToSkipAll = 0x7FFFFFFF
752 };
753
754public:
756
764 OdGsEntityNode(OdGsBaseModel* pModel, const OdGiDrawable* pUnderlyingDrawable, bool bSetGsNode = false);
765public:
770
775 void setNextEntity(OdGsEntityNode* pNextEntity);
776
782 void setNextEntity(OdUInt32 nVpId, OdGsEntityNode* pNextEntity);
787
796 const OdGsEntityNode* nextEntity() const;
797
802 const OdGsEntityNode* nextEntity(OdUInt32 nVpId) const;
806 OdUInt32 numNextEntity() const;
812
819 void update(OdGsUpdateContext& ctx, OdGsContainerNode* pParent,
820 OdSiSpatialIndex* pParentIndex);
821
826 void updateVisible( OdGsViewImpl* pViewImpl );
827
833 virtual OdGsEntityNode::MetafilePtr regenMetafile(OdGsUpdateContext &ctx, OdUInt32 vpDepFlags);
834
853 virtual OdUInt32 awareFlags(OdUInt32 viewportId) const;
854
858 virtual ENodeType nodeType() const { return kEntityNode; }
859
860 virtual bool isReference() const { return false; }
861 virtual bool isLight() const { return false; }
862 virtual bool isSelfReferential() const { return false; }
863
869
871
880
889
894 bool spatiallyIndexed() const;
895
900 bool spatiallyIndexed(OdUInt32 nVpId) const;
901
908
915
921 bool owned() const;
922
929 bool owned(OdUInt32 nVpId) const;
930
936 void setOwned(bool owned);
937
943 void setOwned(OdUInt32 nVpId, bool owned);
944
948 bool markedByUpdateManager() const;
949
954 void setMarkedByUpdateManager( bool marked );
955
959 bool hasExtents() const;
960
964 const OdGeExtents3d& extents() const;
965
971 virtual bool isEmpty();
972
978 virtual bool hasFrozenLayers();
979
986 inline bool markedToSkip(unsigned mask);
987
993 inline void markToSkip(unsigned mask, bool markToSkip);
994
998 inline void markToSkipAll();
999
1003 static unsigned markToSkipMask(OdUInt32 threadIndex)
1004 {
1005 ODA_ASSERT(threadIndex >= 0 && threadIndex < 31);
1006 return kMarkedToSkipFirst << threadIndex;
1007 }
1008
1012 void destroy(){}
1013
1021 virtual bool layersChanged(OdGsViewImpl& view) const;
1022
1028 bool markedAsNonSelectable() const;
1029
1034 void markAsNonSelectable(bool val);
1035 bool isMarkedSkipSelection() const;
1036 void markSkipSelection(bool val);
1037
1043 bool isMarkedErased() const;
1044
1050 void markErased(bool val);
1051
1052 bool isInWorkset() const;
1053 void setInWorkset(bool val);
1054
1060 bool isRegenOnDraw() const;
1061
1067 void setRegenOnDraw(bool val);
1068
1074 bool isSingleThreaded() const;
1075
1081 void setSingleThreaded(bool val);
1082
1088 bool skipDisplayClipping() const;
1089
1095 void setSkipDisplayClipping(bool bOn);
1096
1100 bool isXref() const;
1101
1109 virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle = 0);
1110
1117 void hide(bool bDoIt, bool bSelectable = false, bool bWholeBranch = true);
1118
1142 bool hasAnyStateBranch() const;
1143
1150
1156 bool extents(const OdGsView* pView, OdGeExtents3d& ext) const;
1157
1164
1171
1178
1184 bool entityUnerased() const;
1185
1191 void setEntityUnerased(bool flag);
1192
1198 bool isInvisible() const;
1199
1205 bool isExtentsOutOfModelSpace() const;
1210 void setExtentsOutOfModelSpace(bool flag);
1211
1215 void resetInvalidVpFlag();
1216
1222 void setAsLightSourceOwner(bool bSet);
1223
1229 bool isLightSourceOwner() const;
1230
1237
1238public:
1239 virtual void makeStock();
1240 virtual void releaseStock();
1242
1251 bool saveNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL) const;
1252
1261 bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer = NULL);
1262
1270 void transformExtents(OdGeExtents3d &ext, const OdGsStateBranch *pTransformBr = NULL, bool bInverse = false) const;
1271
1273 {
1274 protected:
1276 public:
1278 : m_extents(pNode->extents())
1279 { pNode->transformExtents(m_extents); }
1280 operator const OdGeExtents3d &() const { return m_extents; }
1281 };
1282
1283 void insertToSpatialIndex(OdUInt32 nVpId, OdSiSpatialIndex &parentIndex, const OdGeExtents3d &prevExtents);
1284protected:
1285 bool findMetafileInStock(OdGsUpdateContext& ctx);
1286 inline void setExtentsFlags();
1287private:
1288 MetafileHolder m_mfStock;
1289 volatile int m_markToSkipFlags;
1290protected:
1291 // This flags willn't increase memory usage (at least on Win32) since utilize free space in 8 bytes alignment (__alignof(entity_node) == 8).
1293public:
1300 void addContentToUpdateManager( OdUInt32 viewportId, OdGsUpdateManager* pManager, const UpdateManagerContext& context );
1301
1308 bool isMetafilesCompatible( const OdGsViewImpl* pView1, const OdGsViewImpl* pView2, OdGsUpdateContext* ctx );
1309};
1310
1315
1316
1318{
1320 throw OdError(eInvalidIndex);
1321 m_pNextEntity = pNextEntity;
1322}
1323
1325{
1327 nextEntEntry(nVpId)->m_pNextEntity = pNextEntity;
1328 else
1329 m_pNextEntity = pNextEntity;
1330}
1331
1333{
1334 if (nMaxVpId == 0xFFFFFFFF) nMaxVpId = 0;
1335 if ((numNextEntity() <= nMaxVpId) || ((nMaxVpId == 0) && GETBIT(m_flags, kMultilistNextPtr)))
1336 allocNextEntityArray(nMaxVpId);
1337}
1338
1340{
1342 throw OdError(eInvalidIndex);
1343 return m_pNextEntity;
1344}
1345
1347{
1349 return nextEntEntry(nVpId)->m_pNextEntity;
1350 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1351 // throw OdError(eInvalidIndex);
1352 return m_pNextEntity;
1353}
1354
1356{
1358 throw OdError(eInvalidIndex);
1359 return m_pNextEntity;
1360}
1361
1363{
1365 return nextEntEntry(nVpId)->m_pNextEntity;
1366 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1367 // throw OdError(eInvalidIndex);
1368 return m_pNextEntity;
1369}
1370
1372{
1374 return (OdUInt32)OdPtrToInt32(firstEntEntry()->m_pNextEntity);
1375 return 1;
1376}
1377
1379{
1380 return GETBIT(m_flags, kHasExtents);
1381}
1382
1384{
1385 return m_extents;
1386}
1387
1389{
1391 //atomic function is required, called in MT mode (display)
1392#ifndef TD_SINGLE_THREAD
1393 return (mask & OdInterlockedExchangeAdd(&m_markToSkipFlags, 0)) != 0;
1394#else
1395 return GETBIT(m_markToSkipFlags, mask);
1396#endif
1397}
1398
1399inline void OdGsEntityNode::markToSkip(unsigned mask, bool bSkip)
1400{
1402 ODA_ASSERT(mask && !(mask & (mask-1))); // this function does not accept multi-bit masks
1403 if(markedToSkip(mask) != bSkip)
1404 {
1405 //atomic function is required, called in MT mode (display)
1406#ifndef TD_SINGLE_THREAD
1407 if(bSkip)
1408 OdInterlockedExchangeAdd(&m_markToSkipFlags, mask);
1409 else
1410 OdInterlockedExchangeAdd(&m_markToSkipFlags, -(int)mask);
1411#else
1412 SETBIT(m_markToSkipFlags, mask, bSkip);
1413#endif
1414 }
1415}
1416
1418{
1419 //atomic function is NOT required, is NOT called in MT mode
1420 m_markToSkipFlags = kMarkedToSkipAll;
1421}
1422
1424{
1426 throw OdError(eInvalidIndex);
1428}
1429
1431{
1433 return GETBIT(nextEntEntry(nVpId)->m_entFlags, kSpatiallyIndexed);
1434 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1435 // throw OdError(eInvalidIndex);
1437}
1438
1439inline void OdGsEntityNode::setSpatiallyIndexed(bool bIndexed)
1440{
1442 throw OdError(eInvalidIndex);
1443 SETBIT(m_flags, kSpatiallyIndexed, bIndexed);
1444}
1445
1446inline void OdGsEntityNode::setSpatiallyIndexed(OdUInt32 nVpId, bool bIndexed)
1447{
1449 SETBIT(nextEntEntry(nVpId)->m_entFlags, kSpatiallyIndexed, bIndexed);
1450 else
1451 SETBIT(m_flags, kSpatiallyIndexed, bIndexed);
1452}
1453
1454inline bool OdGsEntityNode::owned() const
1455{
1457 throw OdError(eInvalidIndex);
1458 return GETBIT(m_flags, kOwned);
1459}
1460
1461inline bool OdGsEntityNode::owned(OdUInt32 nVpId) const
1462{
1464 return GETBIT(nextEntEntry(nVpId)->m_entFlags, kOwned);
1465 //if (nVpId > 0) // Normal case, since we can request from non-VpDep container
1466 // throw OdError(eInvalidIndex);
1467 return GETBIT(m_flags, kOwned);
1468}
1469
1470inline void OdGsEntityNode::setOwned(bool bOwned)
1471{
1473 throw OdError(eInvalidIndex);
1474 SETBIT(m_flags, kOwned, bOwned);
1475}
1476
1477inline void OdGsEntityNode::setOwned(OdUInt32 nVpId, bool bOwned)
1478{
1480 SETBIT(nextEntEntry(nVpId)->m_entFlags, kOwned, bOwned);
1481 else
1482 SETBIT(m_flags, kOwned, bOwned);
1483}
1484
1489
1491{
1492 return m_metafile.getArray();
1493}
1494
1496{
1497 return m_metafile.get();
1498}
1499
1501{
1502 return metafileArray()[metafileIndex];
1503}
1504
1505#define VPMETAFILEHOLDERARRAY_DESTRUCTOR ~MetafilePtrArray
1506
1508{
1509 m_metafile.set(pMetafile);
1510}
1511
1513{
1515}
1516
1518{
1520}
1521
1523{
1524 return GETBIT(m_flags, kInvisible);
1525}
1526
1528{
1529 if (invalidVp())
1530 {
1531 setInvalidVp(false);
1532 }
1533}
1534
1536{
1537 return GETBIT(m_flags, kNonSelectable);
1538}
1539
1541{
1543}
1544
1546{
1547 return GETBIT(m_flags, kSkipSelection);
1548}
1549
1551{
1553}
1554
1556{
1557 return GETBIT(m_flags, kErased);
1558}
1559
1560inline void OdGsEntityNode::markErased(bool val)
1561{
1562 SETBIT(m_flags, kErased, val);
1563}
1564
1566{
1567 for(const OdGsGeomPortion* ptr = &m_first; ptr; ptr = ptr->m_pNext)
1568 {
1569 if(ptr->m_pGsMetafile.get())
1570 return false;
1571 }
1572 return true;
1573}
1574
1576{
1578}
1579
1581{
1583}
1584
1586{
1588}
1589
1591{
1593}
1594
1599
1601{
1602 return GETBIT(m_flags, kInWorkset);
1603}
1604
1605inline void OdGsEntityNode::setInWorkset(bool val)
1606{
1607 SETBIT(m_flags, kInWorkset, val);
1608}
1609
1611{
1613}
1614
1616{
1618}
1619
1621{
1623}
1624
1626{
1628}
1629
1630inline void OdGsEntityNode::highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle)
1631{
1632 OdGsNode::highlight(bDoIt, bWholeBranch, nSelStyle);
1633 if (stateBranch() && (!bDoIt || bWholeBranch))
1635}
1636
1637inline void OdGsEntityNode::hide(bool bDoIt, bool bSelectable, bool bWholeBranch)
1638{
1639 OdGsNode::hide(bDoIt, bSelectable, bWholeBranch);
1640 if (stateBranch(OdGsStateBranch::kVisibilityBranch) && (!bDoIt || bWholeBranch) )
1642}
1643
1645{ if (pBr)
1646 { const OdGsStateBranch::BranchType branchType = pBr->type();
1647 OdGsStateBranch *pPrevBranch = NULL, *pCurBranch = m_stateBranch.get();
1648 while (pCurBranch && (branchType > pCurBranch->type()))
1649 pPrevBranch = pCurBranch, pCurBranch = pCurBranch->nextTypeOfBranch();
1650 if (pCurBranch && (pCurBranch->type() == branchType))
1651 { // This branch type already exist
1652 if (pCurBranch == pBr)
1653 return; // Same branch
1654 pBr->setNextTypeOfBranch(pCurBranch->nextTypeOfBranch());
1655 pCurBranch->setNextTypeOfBranch(NULL);
1656 }
1657 else
1658 { // New branch of this type
1659 pBr->setNextTypeOfBranch(pCurBranch);
1660 }
1661 if (pPrevBranch)
1662 pPrevBranch->setNextTypeOfBranch(pBr);
1663 else
1664 m_stateBranch = pBr;
1665 }
1666 else
1667 {
1668 ODA_FAIL();
1669 }
1670}
1671
1673{ OdGsStateBranch *pPrevBranch = NULL, *pCurBranch = m_stateBranch.get();
1674 while (pCurBranch && (branchType > pCurBranch->type()))
1675 pPrevBranch = pCurBranch, pCurBranch = pCurBranch->nextTypeOfBranch();
1676 if (pCurBranch && (pCurBranch->type() == branchType))
1677 { OdGsStateBranchPtr brLock(pCurBranch);
1678 if (pPrevBranch)
1679 pPrevBranch->setNextTypeOfBranch(pCurBranch->nextTypeOfBranch());
1680 else
1681 m_stateBranch = pCurBranch->nextTypeOfBranch();
1682 pCurBranch->setNextTypeOfBranch(NULL);
1683 if (brLock->reactor())
1684 brLock->reactor()->onBranchDetach(this, brLock);
1685 }
1686}
1687
1689{ OdGsStateBranch *pCurBranch = m_stateBranch.get();
1690 if (pCurBranch)
1691 {
1692 do
1693 {
1694 if (pCurBranch->type() == branchType)
1695 break;
1696 if (pCurBranch->type() > branchType)
1697 pCurBranch = NULL;
1698 else
1699 pCurBranch = pCurBranch->nextTypeOfBranch();
1700 } while (pCurBranch);
1701 }
1702 return pCurBranch;
1703}
1704
1706{ const OdGsStateBranch *pCurBranch = m_stateBranch.get();
1707 if (pCurBranch)
1708 {
1709 do
1710 {
1711 if (pCurBranch->type() == branchType)
1712 break;
1713 if (pCurBranch->type() > branchType)
1714 pCurBranch = NULL;
1715 else
1716 pCurBranch = pCurBranch->nextTypeOfBranch();
1717 } while (pCurBranch);
1718 }
1719 return pCurBranch;
1720}
1721
1723{
1724 return !m_stateBranch.isNull();
1725}
1726
1732
1737
1739{
1740 if (lwd)
1741 {
1743 if (lwd > maxLwd)
1745 }
1746}
1747
1752
1757
1759{
1761}
1762
1764{
1766}
1767
1772
1773inline bool OdGsEntityNode::isXref() const
1774{
1776}
1777
1779
1780#include "TD_PackPop.h"
1781
1782#endif // __OD_GS_ENTITY_NODE__
#define ODA_ASSERT(exp)
Definition DebugStuff.h:57
#define ODA_FAIL()
Definition DebugStuff.h:88
lwd
GE_TOOLKIT_EXPORT OdGeDoubleArray & getArray(OdGeKnotVector *p)
OdGiRegenType
@ kOdGiStandardDisplay
@ kOdGiHideOrShadeCommand
@ kOdGiRenderCommand
ENodeType
Definition GsBaseModel.h:69
@ kEntityNode
Definition GsBaseModel.h:76
EMetafilePlayMode
Definition GsDefs.h:511
@ kMfDisplay
Definition GsDefs.h:515
OdSmartPtr< OdGsEntityNode > OdGsEntityNodePtr
OdArray< OdGsEntityNode *, OdMemoryAllocator< OdGsEntityNode * > > OdGsEntityNodeArray
#define GS_TOOLKIT_EXPORT
Definition GsExport.h:37
TPtr< OdGsStateBranch > OdGsStateBranchPtr
@ kVpRegenType
@ kVpRenderMode
ODRX_CONSTEXPR const T & odmax(const T &a, const T &b)
Definition OdPlatform.h:38
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
T & at(size_type arrayIndex)
Definition OdArray.h:1664
void resize(size_type logicalLength, const T &value)
Definition OdArray.h:1192
bool isNull() const
void setDevice(OdGsBaseVectorizeDevice *device)
void setMetafileLength(OdUInt64 l)
void setDevice(OdRxObjectPtr dev)
OdUInt64 metafileLength() const
void setAwareFlagsRegenType(bool bOn)
bool isValidMf(const Metafile &mf) const
MetafilePtrArray & getArray()
void setDependentGeometry(bool bSet)
const MetafilePtrArray & getArray() const
OdUInt32 awareFlags(OdUInt32 nVpID) const
OdUInt8 m_data[odmax(sizeof(MetafilePtrArray), sizeof(OdRxObject *))]
MetafileHolder(const MetafileHolder &c)
void setAtRegenType(Metafile *pMf, OdGiRegenType eRegenType)
void setAt(int n, Metafile *pMf)
Metafile * getAtRegenType(OdGiRegenType &eRegenType)
const Metafile * get() const
void moveTo(MetafileHolder &c, int &n)
const void * rawPtr() const
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
TransformedExtents(const OdGsEntityNode *pNode)
virtual void makeStock()
friend class OdGsModuleObject
virtual bool isLight() const
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
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
virtual ENodeType nodeType() const
OdGsEntityNode::MetafilePtr metafile() const
bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
void select(OdGsBaseVectorizer &view)
OdRxObject * findFirstGsMetafile(const OdGsViewImpl &view, bool *bContainsNested=nullptr, MetafileCompatibilityLevel findCompatibleLevel=kSkipCheckCompatible)
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
OdGsEntityNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable, bool bSetGsNode=false)
static void Free(void *pMemBlock)
bool isMarkedErased() const
bool isExtentsOutOfModelSpace() const
OdUInt32 m_entFlags
virtual void releaseStock()
void transformExtents(OdGeExtents3d &ext, const OdGsStateBranch *pTransformBr=NULL, bool bInverse=false) const
void setMaxLineweightUsed(OdDb::LineWeight lwd)
void setExtentsFromMetafiles()
void display(OdGsDisplayContext &ctx)
virtual void propagateLayerChangesStock()
virtual bool isReference() const
virtual void playAsGeometry(OdGsBaseVectorizer &view, EMetafilePlayMode eMode)
bool isInWorkset() const
void setRegenOnDraw(bool val)
void setInWorkset(bool val)
OdSmartPtr< Metafile > MetafilePtr
void markAsNonSelectable(bool val)
void setStateBranch(OdGsStateBranch *pBr)
friend class OdGsBlockReferenceNode
bool hasAnyStateBranch() const
static unsigned markToSkipMask(OdUInt32 threadIndex)
bool loadNodeState(OdGsFiler *pFiler, OdGsBaseVectorizer *pVectorizer=NULL)
void setSkipDisplayClipping(bool bOn)
OdGsStateBranchPtr m_stateBranch
bool isSingleThreaded() const
const OdGeExtents3d & extents() const
virtual void propagateLayerChanges(OdGsViewImpl &view)
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
bool extents(OdGeExtents3d &extents) const
void convertToViewportDependent(const OdGsUpdateContext &ctx)
void resetStateBranch(OdGsStateBranch::BranchType branchType=OdGsStateBranch::kHighlightingBranch)
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
virtual bool layersChanged(OdGsViewImpl &view) const
bool findMetafileInStock(OdGsUpdateContext &ctx)
OdGsStateBranch * stateBranch(OdGsStateBranch::BranchType branchType=OdGsStateBranch::kHighlightingBranch)
void setSpatiallyIndexed(bool spatiallyIndexed)
bool spatiallyIndexed() const
OdGsEntityNode * nextEntity()
void setNextEntity(OdGsEntityNode *pNextEntity)
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)
bool markedToSkip(unsigned mask)
virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle=0)
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)
OdRxObject * findCompatibleCache(const OdGsViewImpl &keyView, OdGsUpdateContext *ctx, OdUInt32 awareMask=0)
void markErased(bool val)
bool hasExtents() const
friend class OdGsViewImpl
Definition GsNode.h:62
OdUInt32 m_flags
Definition GsNode.h:93
virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle=0)
Definition GsNode.h:431
virtual OdDb::LineWeight getMaxLineweightUsed() const
virtual void destroy()=0
@ kLastFlag
Definition GsNode.h:90
friend class OdGsBaseModel
Definition GsNode.h:61
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
void setInvalidVp(bool val)
Definition GsNode.h:104
virtual void hide(bool bDoIt, bool bSelectable=false, bool bWholeBranch=true)
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
Definition GsNode.h:72
bool invalidVp() const
Definition GsNode.h:102
OdGsNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable)
OdGsStateBranch * nextTypeOfBranch()
void setNextTypeOfBranch(OdGsStateBranch *pNext)
BranchType type() const
OdGsStateBranchReactor * reactor()
virtual void onBranchDetach(const OdGsCache *pGsNode, OdGsStateBranch *pStateBranch)=0
Definition Gs.h:141
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)
OdRxObjectPtr m_pGsMetafile
void filterEmptyNestedPortions()
bool isEmptyPortion() const
OdGsGeomPortion * m_pNext
OdGsLayerNode * m_pLayer
void freeNestedPortions()