24#ifndef __OD_GS_ENTITY_NODE__
25#define __OD_GS_ENTITY_NODE__
91 pPortion = pNextPortion;
117class OdGsBaseContext;
134 struct NextEntityEntry
143 void allocNextEntityArray(
OdUInt32 nMaxVpId);
148 inline NextEntityEntry *firstEntEntry() {
return reinterpret_cast<NextEntityEntry*
>(m_pNextEntity); }
153 inline const NextEntityEntry *firstEntEntry()
const {
return reinterpret_cast<const NextEntityEntry*
>(m_pNextEntity); }
160 inline NextEntityEntry *nextEntEntry(
OdUInt32 nVpId) { checkEntEntry(nVpId);
return reinterpret_cast<NextEntityEntry*
>(m_pNextEntity) + (nVpId + 1); }
166 inline const NextEntityEntry *nextEntEntry(
OdUInt32 nVpId)
const { checkEntEntry(nVpId);
return reinterpret_cast<const NextEntityEntry*
>(m_pNextEntity) + (nVpId + 1); }
174 void*
operator new(size_t);
175 void operator delete(
void *);
262 bool isEmpty()
const;
319 friend class OdGsModuleObject;
324 static void*
Realloc(
void* pMemBlock,
size_t newSize,
size_t)
352 kAwareFlagsRegenType = 4,
354 kRegenTypeStandard = 8,
355 kRegenTypeHideOrShade = 16,
356 kRegenTypeRenderCommand = 32,
357 kRegenTypeMask = kRegenTypeStandard | kRegenTypeHideOrShade | kRegenTypeRenderCommand,
359 kDependentGeometry = 64,
360 kLayerDependent = 128
368 *
reinterpret_cast<Metafile**
>(rawPtr()) = 0;
378 *
reinterpret_cast<Metafile**
>(rawPtr()) = 0;
429 SETBIT(m_flags, kVpDependent, bOn);
432 SETBIT(m_flags, kRegenTypeMask,
false);
433 setAwareFlagsRegenType(
false);
452 return *
reinterpret_cast<Metafile**
>(rawPtr());
489 *
reinterpret_cast<Metafile**
>(rawPtr()) = pMf;
509 if(
GETBIT(flags(), kRegenTypeStandard))
511 else if(
GETBIT(flags(), kRegenTypeHideOrShade))
548 return (!pMetafile.
isNull()) ? pMetafile->m_nAwareFlags : 0;
552 return isValid() ? get()->m_nAwareFlags : 0;
572 const void*
rawPtr()
const {
return &m_data; }
578#ifdef TD_STRICT_ALIGNMENT
648 kSkipCheckCompatible = 0,
650 kCheckViewChanges = 1,
652 kCheckCompatibleView = 2,
697 kLastFlag = kMultilistNextPtr
702 kLineweightBit1 = (1 << 0),
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),
712 kRegenOnHighlight = (1 << 9),
713 kMarkedByUpdateManager = (1 << 10),
714 kSkipDisplayClipping = (1 << 11),
715 kLastEntFlag = kSkipDisplayClipping
720 kMarkedToSkipFirst = 0x00000001,
721 kMarkedToSkipLast = kMarkedToSkipFirst << 30,
722 kMarkedToSkipAll = 0x7FFFFFFF
782 void enableMultipleNextEntities(
OdUInt32 nMaxVpId);
832 virtual bool isLight()
const {
return false; }
865 bool spatiallyIndexed()
const;
871 bool spatiallyIndexed(
OdUInt32 nVpId)
const;
878 void setSpatiallyIndexed(
bool spatiallyIndexed);
885 void setSpatiallyIndexed(
OdUInt32 nVpId,
bool spatiallyIndexed);
907 void setOwned(
bool owned);
914 void setOwned(
OdUInt32 nVpId,
bool owned);
919 bool markedByUpdateManager()
const;
925 void setMarkedByUpdateManager(
bool marked );
930 bool hasExtents()
const;
957 inline bool markedToSkip(
unsigned mask);
964 inline void markToSkip(
unsigned mask,
bool markToSkip);
969 inline void markToSkipAll();
976 ODA_ASSERT(threadIndex >= 0 && threadIndex < 31);
977 return kMarkedToSkipFirst << threadIndex;
999 bool markedAsNonSelectable()
const;
1005 void markAsNonSelectable(
bool val);
1006 bool isMarkedSkipSelection()
const;
1007 void markSkipSelection(
bool val);
1014 bool isMarkedErased()
const;
1021 void markErased(
bool val);
1023 bool isInWorkset()
const;
1024 void setInWorkset(
bool val);
1031 bool isRegenOnDraw()
const;
1038 void setRegenOnDraw(
bool val);
1045 bool isSingleThreaded()
const;
1052 void setSingleThreaded(
bool val);
1059 bool skipDisplayClipping()
const;
1066 void setSkipDisplayClipping(
bool bOn);
1071 bool isXref()
const;
1104 void hide(
bool bDoIt,
bool bSelectable =
false,
bool bWholeBranch =
true);
1153 bool entityUnerased()
const;
1160 void setEntityUnerased(
bool flag);
1167 bool isInvisible()
const;
1169 bool isExtentsOutOfModelSpace()
const;
1170 void setExtentsOutOfModelSpace(
bool flag);
1175 void resetInvalidVpFlag();
1182 void setAsLightSourceOwner(
bool bSet);
1189 bool isLightSourceOwner()
const;
1196 bool isRequireRegenOnHighlightChange()
const;
1226 inline void setExtentsFlags();
1230 volatile int m_markToSkipFlags;
1262 m_pNextEntity = pNextEntity;
1268 nextEntEntry(nVpId)->m_pNextEntity = pNextEntity;
1270 m_pNextEntity = pNextEntity;
1275 if (nMaxVpId == 0xFFFFFFFF) nMaxVpId = 0;
1277 allocNextEntityArray(nMaxVpId);
1284 return m_pNextEntity;
1290 return nextEntEntry(nVpId)->m_pNextEntity;
1293 return m_pNextEntity;
1300 return m_pNextEntity;
1306 return nextEntEntry(nVpId)->m_pNextEntity;
1309 return m_pNextEntity;
1333#ifndef TD_SINGLE_THREAD
1334 return (
mask & OdInterlockedExchangeAdd(&m_markToSkipFlags, 0)) != 0;
1347#ifndef TD_SINGLE_THREAD
1349 OdInterlockedExchangeAdd(&m_markToSkipFlags,
mask);
1351 OdInterlockedExchangeAdd(&m_markToSkipFlags, -(
int)
mask);
1446#define VPMETAFILEHOLDERARRAY_DESTRUCTOR ~MetafilePtrArray
1510 if(ptr->m_pGsMetafile.get())
1574 if(
hlBranch() && (!bDoIt || bWholeBranch))
GE_TOOLKIT_EXPORT OdGeDoubleArray & getArray(OdGeKnotVector *p)
@ kOdGiHideOrShadeCommand
OdSmartPtr< OdGsEntityNode > OdGsEntityNodePtr
OdArray< OdGsEntityNode *, OdMemoryAllocator< OdGsEntityNode * > > OdGsEntityNodeArray
#define GS_TOOLKIT_EXPORT
#define SETBIT(flags, bit, value)
#define GETBIT(flags, bit)
IAllocator * getAt(unsigned i)
virtual void release(void *p)=0
virtual void * alloc(int)=0
T & at(size_type arrayIndex)
void resize(size_type logicalLength, const T &value)
bool isValidExtents() const
virtual bool isLight() const
MetafilePtrArray & metafileArray()
void setEntityUnerased(bool flag)
void setMarkedByUpdateManager(bool marked)
bool markedAsNonSelectable() const
bool markedByUpdateManager() const
OdGsEntityNode::MetafilePtr metafileAt(int metafileIndex) const
OdGsStateBranchPtr m_visBranch
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
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
OdGsEntityNode(OdGsBaseModel *pModel, const OdGiDrawable *pUnderlyingDrawable, bool bSetGsNode=false)
static void Free(void *pMemBlock)
MetafileCompatibilityLevel
OdGsStateBranchPtr m_hlBranch
bool isMarkedErased() const
bool isExtentsOutOfModelSpace() const
virtual void releaseStock()
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)
void setRegenOnDraw(bool val)
void setInWorkset(bool val)
OdSmartPtr< Metafile > MetafilePtr
void markAsNonSelectable(bool val)
static unsigned markToSkipMask(OdUInt32 threadIndex)
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 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 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)
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 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)
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)
const OdGsStateBranch * hlBranch() const
virtual OdGsEntityNode::MetafilePtr regenMetafile(OdGsUpdateContext &ctx, OdUInt32 vpDepFlags)
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)
virtual void highlight(bool bDoIt, bool bWholeBranch, OdUInt32 nSelStyle=0)
virtual OdDb::LineWeight getMaxLineweightUsed() const
virtual bool extents(const OdGsView *pView, OdGeExtents3d &ext) const
void setInvalidVp(bool val)
virtual void hide(bool bDoIt, bool bSelectable=false, bool bWholeBranch=true)
static GS_STATIC_EXPORT AllocatorArray s_aAlloc
bool ODSI_API properExtents(const OdGeExtents3d &ext)
void copyFrom(OdGsGeomPortion &c)
OdRxObjectPtr m_pGsMetafile
void filterEmptyNestedPortions()
bool isEmptyPortion() const
OdGsGeomPortion * m_pNext
void freeNestedPortions()