SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder)
: BVH_PrimitiveSet3d (theBuilder)
{
- //
+ myNbEntityWithPersistence = 0;
}
//=======================================================================
theEntity->ResetSelectionActiveStatus();
return;
}
-
const Standard_Integer anExtent = mySensitives.Extent();
if (mySensitives.Add (theEntity) > anExtent)
{
}
if (!theEntity->BaseSensitive()->TransformPersistence().IsNull())
{
- myHasEntityWithPersistence = Standard_True;
+ ++myNbEntityWithPersistence;
}
MarkDirty();
}
}
if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
{
- myHasEntityWithPersistence = Standard_True;
+ ++myNbEntityWithPersistence;
}
}
MarkDirty();
{
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
- const Standard_Integer anEntIdx = mySensitives.FindIndex (aSelEntIter.Value());
+ const Handle(SelectMgr_SensitiveEntity)& aSensEnt = aSelEntIter.Value();
+ const Standard_Integer anEntIdx = mySensitives.FindIndex (aSensEnt);
if (anEntIdx == 0)
{
continue;
{
Swap (anEntIdx - 1, mySensitives.Size() - 1);
}
+ if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
+ {
+ --myNbEntityWithPersistence;
+ }
mySensitives.RemoveLast();
- removeOwner (aSelEntIter.Value()->BaseSensitive()->OwnerId());
+ removeOwner (aSensEnt->BaseSensitive()->OwnerId());
}
MarkDirty();
const SelectMgr_MapOfOwners& Owners() const { return myOwnersMap; }
//! Returns map of entities.
- Standard_Boolean HasEntityWithPersistence() const { return myHasEntityWithPersistence; }
+ Standard_Boolean HasEntityWithPersistence() const { return myNbEntityWithPersistence > 0; }
protected:
private:
- SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
- SelectMgr_MapOfOwners myOwnersMap; //!< Map of entity owners and its corresponding number of sensitives
- Standard_Boolean myHasEntityWithPersistence; //!< flag if some of sensitive entity has own transform persistence
+ SelectMgr_IndexedMapOfHSensitive mySensitives; //!< Map of entities and its corresponding index in BVH
+ SelectMgr_MapOfOwners myOwnersMap; //!< Map of entity owners and its corresponding number of sensitives
+ Standard_Integer myNbEntityWithPersistence; //!< number of sensitive entities that have own transform persistence
};
#endif // _SelectMgr_SensitiveEntitySet_HeaderFile