1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0028789: Visualization, TKV3d - extend API for accessing and assigning BVH builders

Several methods in Selection classes have been moved to header files for better inlining.

BVH_Constants - added new enumeration defining common constant values used with BVH trees.
BVH - replaced NCollection_Handle with Standard_Transient handle
in classes BVH_Properties, BVH_Builder, BVH_Tree, BVH_Object.

Defined global BVH-builders instead of allocating a new one for each object set.
SelectMgr_ViewerSelector - added new method ::SetEntitySetBuilder() defining
default BVH Tree builder for SelectMgr_SensitiveEntitySet.

Added new method SelectMgr_SensitiveEntitySet::SetBuilder()
for overriding default BVH tree builder.
This commit is contained in:
kgv
2017-05-26 10:45:22 +03:00
committed by bugmaster
parent 645f581fbe
commit f5b7241978
54 changed files with 561 additions and 357 deletions

View File

@@ -212,9 +212,9 @@ SelectMgr_SelectableObjectSet::SelectMgr_SelectableObjectSet()
myBVH[BVHSubset_3dPersistent] = new BVH_Tree<Standard_Real, 3>();
myBVH[BVHSubset_3d] = new BVH_Tree<Standard_Real, 3>();
myBuilder[BVHSubset_2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (1, 32);
myBuilder[BVHSubset_3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (1, 32);
myBuilder[BVHSubset_3d] = new BVH_BinnedBuilder<Standard_Real, 3, 4> (1, 32, Standard_True);
myBuilder[BVHSubset_2dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
myBuilder[BVHSubset_3dPersistent] = new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth);
myBuilder[BVHSubset_3d] = new BVH_BinnedBuilder<Standard_Real, 3, 4> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth, Standard_True);
myIsDirty[BVHSubset_2dPersistent] = Standard_False;
myIsDirty[BVHSubset_3dPersistent] = Standard_False;
@@ -327,7 +327,7 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
BVHBuilderAdaptorRegular anAdaptor (myObjects[BVHSubset_3d]);
// update corresponding BVH tree data structure
myBuilder[BVHSubset_3d]->Build (&anAdaptor, myBVH[BVHSubset_3d].operator->(), anAdaptor.Box());
myBuilder[BVHSubset_3d]->Build (&anAdaptor, myBVH[BVHSubset_3d].get(), anAdaptor.Box());
// release dirty state
myIsDirty[BVHSubset_3d] = Standard_False;
@@ -349,7 +349,7 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
theCamera, theProjectionMat, theWorldViewMat, theViewportWidth, theViewportHeight);
// update corresponding BVH tree data structure
myBuilder[BVHSubset_3dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_3dPersistent].operator->(), anAdaptor.Box());
myBuilder[BVHSubset_3dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_3dPersistent].get(), anAdaptor.Box());
}
// -----------------------------------------------------
@@ -363,7 +363,7 @@ void SelectMgr_SelectableObjectSet::UpdateBVH (const Handle(Graphic3d_Camera)& t
theCamera, theProjectionMat, THE_IDENTITY_MAT, theViewportWidth, theViewportHeight);
// update corresponding BVH tree data structure
myBuilder[BVHSubset_2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_2dPersistent].operator->(), anAdaptor.Box());
myBuilder[BVHSubset_2dPersistent]->Build (&anAdaptor, myBVH[BVHSubset_2dPersistent].get(), anAdaptor.Box());
}
// release dirty state for every subset

View File

@@ -16,12 +16,13 @@
#ifndef _SelectMgr_SelectableObjectSet_HeaderFile
#define _SelectMgr_SelectableObjectSet_HeaderFile
#include <BVH_PrimitiveSet.hxx>
#include <BVH_Builder.hxx>
#include <BVH_Tree.hxx>
#include <Graphic3d_Mat4d.hxx>
#include <Graphic3d_WorldViewProjState.hxx>
#include <NCollection_Handle.hxx>
#include <NCollection_IndexedMap.hxx>
#include <Select3D_BVHBuilder3d.hxx>
#include <SelectMgr_SelectableObject.hxx>
//! The purpose of this class is to organize all selectable objects into data structure, allowing to build
@@ -174,7 +175,7 @@ public:
}
//! Returns computed BVH for the theSubset given.
const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& BVH(const BVHSubset theSubset) const
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& BVH(const BVHSubset theSubset) const
{
return myBVH[theSubset];
}
@@ -214,8 +215,8 @@ private:
private:
NCollection_IndexedMap<Handle(SelectMgr_SelectableObject)> myObjects[BVHSubsetNb]; //!< Map of objects for each subset
NCollection_Handle<BVH_Tree<Standard_Real, 3> > myBVH[BVHSubsetNb]; //!< BVH tree computed for each subset
NCollection_Handle<BVH_Builder<Standard_Real, 3> > myBuilder[BVHSubsetNb]; //!< Builder allocated for each subset
opencascade::handle<BVH_Tree<Standard_Real, 3> > myBVH[BVHSubsetNb]; //!< BVH tree computed for each subset
Handle(Select3D_BVHBuilder3d) myBuilder[BVHSubsetNb]; //!< Builder allocated for each subset
Standard_Boolean myIsDirty[BVHSubsetNb]; //!< Dirty flag for each subset
Graphic3d_WorldViewProjState myLastViewState; //!< Last view-projection state used for construction of BVH
Standard_Integer myLastWidth; //!< Last viewport's (window's) width used for construction of BVH

View File

@@ -44,9 +44,9 @@ SelectMgr_Selection::~SelectMgr_Selection()
//==================================================
void SelectMgr_Selection::Destroy()
{
for (Standard_Integer anEntityIdx = 0; anEntityIdx < myEntities.Size(); ++anEntityIdx)
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anEntityIter (myEntities); anEntityIter.More(); anEntityIter.Next())
{
Handle(SelectMgr_SensitiveEntity)& anEntity = myEntities.ChangeValue (anEntityIdx);
Handle(SelectMgr_SensitiveEntity)& anEntity = anEntityIter.ChangeValue();
anEntity->BaseSensitive()->Set (NULL);
}
mySensFactor = 2;
@@ -92,9 +92,9 @@ void SelectMgr_Selection::Add (const Handle(SelectBasics_SensitiveEntity)& theSe
//==================================================
void SelectMgr_Selection::Clear()
{
for (Standard_Integer anIdx = 0; anIdx < myEntities.Size(); ++anIdx)
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anEntityIter (myEntities); anEntityIter.More(); anEntityIter.Next())
{
Handle(SelectMgr_SensitiveEntity)& anEntity = myEntities.ChangeValue (anIdx);
Handle(SelectMgr_SensitiveEntity)& anEntity = anEntityIter.ChangeValue();
anEntity->Clear();
}
@@ -157,9 +157,9 @@ void SelectMgr_Selection::SetSensitivity (const Standard_Integer theNewSens)
{
mySensFactor = theNewSens;
myIsCustomSens = Standard_True;
for (Standard_Integer anIdx = 0; anIdx < myEntities.Size(); ++anIdx)
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anEntityIter (myEntities); anEntityIter.More(); anEntityIter.Next())
{
Handle(SelectMgr_SensitiveEntity)& anEntity = myEntities.ChangeValue (anIdx);
Handle(SelectMgr_SensitiveEntity)& anEntity = anEntityIter.ChangeValue();
anEntity->BaseSensitive()->SetSensitivityFactor (theNewSens);
}
}

View File

@@ -24,9 +24,10 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SensitiveEntity,Standard_Transient)
// theEntity
//=======================================================================
SelectMgr_SensitiveEntity::SelectMgr_SensitiveEntity (const Handle(SelectBasics_SensitiveEntity)& theEntity)
: mySensitive (theEntity),
myIsActiveForSelection (Standard_False)
{
mySensitive = theEntity;
myIsActiveForSelection = Standard_False;
//
}
//=======================================================================
@@ -38,40 +39,3 @@ void SelectMgr_SensitiveEntity::Clear()
mySensitive->Clear();
mySensitive.Nullify();
}
//=======================================================================
// function : BaseSensitive
// purpose : Returns related instance of SelectBasics class
//=======================================================================
const Handle(SelectBasics_SensitiveEntity)& SelectMgr_SensitiveEntity::BaseSensitive() const
{
return mySensitive;
}
//=======================================================================
// function : IsActiveForSelection
// purpose : Returns true if this entity belongs to the active selection
// mode of parent object
//=======================================================================
Standard_Boolean SelectMgr_SensitiveEntity::IsActiveForSelection() const
{
return myIsActiveForSelection;
}
//=======================================================================
// function : ResetSelectionActiveStatus
// purpose : Marks entity as inactive for selection
//=======================================================================
void SelectMgr_SensitiveEntity::ResetSelectionActiveStatus() const
{
myIsActiveForSelection = Standard_False;
}
//=======================================================================
// function : SetActiveForSelection
// purpose : Marks entity as active for selection
//=======================================================================
void SelectMgr_SensitiveEntity::SetActiveForSelection() const
{
myIsActiveForSelection = Standard_True;
}

View File

@@ -35,17 +35,17 @@ public:
Standard_EXPORT void Clear();
//! Returns related instance of SelectBasics class
Standard_EXPORT const Handle(SelectBasics_SensitiveEntity)& BaseSensitive() const;
const Handle(SelectBasics_SensitiveEntity)& BaseSensitive() const { return mySensitive; }
//! Returns true if this entity belongs to the active selection
//! mode of parent object
Standard_EXPORT Standard_Boolean IsActiveForSelection() const;
Standard_Boolean IsActiveForSelection() const { return myIsActiveForSelection; }
//! Marks entity as inactive for selection
Standard_EXPORT void ResetSelectionActiveStatus() const;
void ResetSelectionActiveStatus() const { myIsActiveForSelection = Standard_False; }
//! Marks entity as active for selection
Standard_EXPORT void SetActiveForSelection() const;
void SetActiveForSelection() const { myIsActiveForSelection = Standard_True; }
DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntity,Standard_Transient) // Type definition

View File

@@ -15,18 +15,19 @@
#include <SelectMgr_SensitiveEntitySet.hxx>
#include <BVH_BinnedBuilder.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectMgr_SensitiveEntity.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SensitiveEntitySet, BVH_PrimitiveSet3d)
//=======================================================================
// function : SelectMgr_SensitiveEntitySet
// purpose :
//=======================================================================
SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet()
SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder)
: BVH_PrimitiveSet3d (theBuilder)
{
myBuilder = new BVH_BinnedBuilder<Standard_Real, 3, 4> (1, 32, Standard_True);
//
}
//=======================================================================
@@ -35,7 +36,7 @@ SelectMgr_SensitiveEntitySet::SelectMgr_SensitiveEntitySet()
//=======================================================================
void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_SensitiveEntity)& theEntity)
{
if (!theEntity->BaseSensitive()->IsKind ("Select3D_SensitiveEntity"))
if (!theEntity->BaseSensitive()->IsKind (STANDARD_TYPE(Select3D_SensitiveEntity)))
{
theEntity->ResetSelectionActiveStatus();
return;
@@ -53,7 +54,7 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_Selection)& th
{
for (theSelection->Init(); theSelection->More(); theSelection->Next())
{
if (!theSelection->Sensitive()->BaseSensitive()->IsKind ("Select3D_SensitiveEntity"))
if (!theSelection->Sensitive()->BaseSensitive()->IsKind (STANDARD_TYPE(Select3D_SensitiveEntity)))
{
theSelection->Sensitive()->ResetSelectionActiveStatus();
continue;

View File

@@ -16,13 +16,10 @@
#ifndef _SelectMgr_SensitiveEntitySet_HeaderFile
#define _SelectMgr_SensitiveEntitySet_HeaderFile
#include <BVH_PrimitiveSet.hxx>
#include <BVH_PrimitiveSet3d.hxx>
#include <NCollection_IndexedMap.hxx>
#include <NCollection_Handle.hxx>
#include <Select3D_BndBox3d.hxx>
#include <Select3D_BVHBuilder3d.hxx>
#include <SelectMgr_SensitiveEntity.hxx>
#include <SelectMgr_Selection.hxx>
@@ -31,11 +28,13 @@ typedef NCollection_IndexedMap<Handle(SelectMgr_SensitiveEntity)> SelectMgr_Inde
//! This class is used to store all calculated sensitive entites of one selectable
//! object. It provides an interface for building BVH tree which is used to speed-up
//! the performance of searching for overlap among sensitives of one selectable object
class SelectMgr_SensitiveEntitySet : public BVH_PrimitiveSet<Standard_Real, 3>
class SelectMgr_SensitiveEntitySet : public BVH_PrimitiveSet3d
{
DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntitySet, BVH_PrimitiveSet3d)
public:
Standard_EXPORT SelectMgr_SensitiveEntitySet();
//! Empty constructor.
Standard_EXPORT SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder);
virtual ~SelectMgr_SensitiveEntitySet() {};
@@ -54,7 +53,7 @@ public:
Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIndex) const Standard_OVERRIDE;
//! Make inherited method Box() visible to avoid CLang warning
using BVH_PrimitiveSet<Standard_Real, 3>::Box;
using BVH_PrimitiveSet3d::Box;
//! Returns geometry center of sensitive entity index theIdx
//! along the given axis theAxis

View File

@@ -34,7 +34,7 @@
#include <algorithm>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_ViewerSelector,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_ViewerSelector, Standard_Transient)
namespace {
// Comparison operator for sorting selection results
@@ -95,6 +95,7 @@ myCurRank (0),
myIsLeftChildQueuedFirst (Standard_False),
myEntityIdx (0)
{
myEntitySetBuilder = new BVH_BinnedBuilder<Standard_Real, 3, 4> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth, Standard_True);
}
//==================================================
@@ -315,16 +316,14 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight)
{
NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
myMapOfObjectSensitives.ChangeFind (theObject);
Handle(SelectMgr_SensitiveEntitySet)& anEntitySet = myMapOfObjectSensitives.ChangeFind (theObject);
if (anEntitySet->Size() == 0)
{
return;
}
const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aSensitivesTree = anEntitySet->BVH();
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aSensitivesTree = anEntitySet->BVH();
gp_GTrsf aInversedTrsf;
if (theObject->HasTransformation() || !theObject->TransformPersistence().IsNull())
{
if (theObject->TransformPersistence().IsNull())
@@ -363,7 +362,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
{
return;
}
Standard_Integer aStack[32];
Standard_Integer aStack[BVH_Constants_MaxTreeDepth];
Standard_Integer aHead = -1;
for (;;)
{
@@ -492,7 +491,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
? mySelectingVolumeMgr.WorldViewMatrix()
: THE_IDENTITY_MAT;
const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aBVHTree = mySelectableObjects.BVH (aBVHSubset);
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVHTree = mySelectableObjects.BVH (aBVHSubset);
Standard_Integer aNode = 0;
if (!aMgr.Overlaps (aBVHTree->MinPoint (0), aBVHTree->MaxPoint (0)))
@@ -500,7 +499,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
continue;
}
Standard_Integer aStack[32];
Standard_Integer aStack[BVH_Constants_MaxTreeDepth];
Standard_Integer aHead = -1;
for (;;)
{
@@ -608,6 +607,19 @@ const SelectMgr_SortCriterion& SelectMgr_ViewerSelector::PickedData(const Standa
//
//==================================================
//==================================================
// Function: SetEntitySetBuilder
// Purpose :
//==================================================
void SelectMgr_ViewerSelector::SetEntitySetBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder)
{
myEntitySetBuilder = theBuilder;
for (SelectMgr_MapOfObjectSensitives::Iterator aSetIter (myMapOfObjectSensitives); aSetIter.More(); aSetIter.Next())
{
aSetIter.ChangeValue()->SetBuilder (myEntitySetBuilder);
}
}
//==================================================
// Function: Contains
// Purpose :
@@ -747,16 +759,12 @@ void SelectMgr_ViewerSelector::SortResult()
if(myIndexes.IsNull() || anExtent != myIndexes->Length())
myIndexes = new TColStd_HArray1OfInteger (1, anExtent);
// to work faster...
TColStd_Array1OfInteger& thearr = myIndexes->ChangeArray1();
// indices from 1 to N are loaded
Standard_Integer I ;
for (I=1; I <= anExtent; I++)
thearr(I)=I;
std::sort (thearr.begin(), thearr.end(), CompareResults (mystored));
TColStd_Array1OfInteger& anIndexArray = myIndexes->ChangeArray1();
for (Standard_Integer anIndexIter = 1; anIndexIter <= anExtent; ++anIndexIter)
{
anIndexArray.SetValue (anIndexIter, anIndexIter);
}
std::sort (anIndexArray.begin(), anIndexArray.end(), CompareResults (mystored));
}
//=======================================================================
@@ -777,7 +785,7 @@ void SelectMgr_ViewerSelector::AddSelectableObject (const Handle(SelectMgr_Selec
if (!myMapOfObjectSensitives.IsBound (theObject))
{
mySelectableObjects.Append (theObject);
NCollection_Handle<SelectMgr_SensitiveEntitySet> anEntitySet = new SelectMgr_SensitiveEntitySet();
Handle(SelectMgr_SensitiveEntitySet) anEntitySet = new SelectMgr_SensitiveEntitySet (myEntitySetBuilder);
myMapOfObjectSensitives.Bind (theObject, anEntitySet);
}
}
@@ -789,12 +797,10 @@ void SelectMgr_ViewerSelector::AddSelectableObject (const Handle(SelectMgr_Selec
void SelectMgr_ViewerSelector::AddSelectionToObject (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_Selection)& theSelection)
{
if (myMapOfObjectSensitives.IsBound (theObject))
if (Handle(SelectMgr_SensitiveEntitySet)* anEntitySet = myMapOfObjectSensitives.ChangeSeek (theObject))
{
NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
myMapOfObjectSensitives.ChangeFind (theObject);
anEntitySet->Append (theSelection);
anEntitySet->BVH();
(*anEntitySet)->Append (theSelection);
(*anEntitySet)->BVH();
}
else
{
@@ -818,10 +824,10 @@ void SelectMgr_ViewerSelector::MoveSelectableObject (const Handle(SelectMgr_Sele
//=======================================================================
void SelectMgr_ViewerSelector::RemoveSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject)
{
if (myMapOfObjectSensitives.IsBound (theObject))
Handle(SelectMgr_SelectableObject) anObj = theObject;
if (myMapOfObjectSensitives.UnBind (theObject))
{
mySelectableObjects.Remove (theObject);
myMapOfObjectSensitives.UnBind (theObject);
}
}
@@ -833,11 +839,9 @@ void SelectMgr_ViewerSelector::RemoveSelectableObject (const Handle(SelectMgr_Se
void SelectMgr_ViewerSelector::RemoveSelectionOfObject (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_Selection)& theSelection)
{
if (myMapOfObjectSensitives.IsBound (theObject))
if (Handle(SelectMgr_SensitiveEntitySet)* anEntitySet = myMapOfObjectSensitives.ChangeSeek (theObject))
{
NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
myMapOfObjectSensitives.ChangeFind (theObject);
anEntitySet->Remove (theSelection);
(*anEntitySet)->Remove (theSelection);
}
}
@@ -876,7 +880,7 @@ void SelectMgr_ViewerSelector::RebuildSensitivesTree (const Handle(SelectMgr_Sel
if (!Contains (theObject))
return;
NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet = myMapOfObjectSensitives.ChangeFind (theObject);
Handle(SelectMgr_SensitiveEntitySet)& anEntitySet = myMapOfObjectSensitives.ChangeFind (theObject);
anEntitySet->MarkDirty();
if (theIsForce)
@@ -892,12 +896,10 @@ void SelectMgr_ViewerSelector::RebuildSensitivesTree (const Handle(SelectMgr_Sel
//=======================================================================
void SelectMgr_ViewerSelector::ResetSelectionActivationStatus()
{
SelectMgr_MapOfObjectSensitivesIterator aSensitivesIter (myMapOfObjectSensitives);
for ( ; aSensitivesIter.More(); aSensitivesIter.Next())
for (SelectMgr_MapOfObjectSensitivesIterator aSensitivesIter (myMapOfObjectSensitives); aSensitivesIter.More(); aSensitivesIter.Next())
{
NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
aSensitivesIter.ChangeValue();
Standard_Integer anEntitiesNb = anEntitySet->Size();
Handle(SelectMgr_SensitiveEntitySet)& anEntitySet = aSensitivesIter.ChangeValue();
const Standard_Integer anEntitiesNb = anEntitySet->Size();
for (Standard_Integer anIdx = 0; anIdx < anEntitiesNb; ++anIdx)
{
anEntitySet->GetSensitiveById (anIdx)->ResetSelectionActiveStatus();
@@ -924,13 +926,14 @@ void SelectMgr_ViewerSelector::ActiveOwners (NCollection_List<Handle(SelectBasic
{
for (SelectMgr_MapOfObjectSensitivesIterator anIter (myMapOfObjectSensitives); anIter.More(); anIter.Next())
{
const NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet = anIter.Value();
Standard_Integer anEntitiesNb = anEntitySet->Size();
const Handle(SelectMgr_SensitiveEntitySet)& anEntitySet = anIter.Value();
const Standard_Integer anEntitiesNb = anEntitySet->Size();
for (Standard_Integer anIdx = 0; anIdx < anEntitiesNb; ++anIdx)
{
if (anEntitySet->GetSensitiveById (anIdx)->IsActiveForSelection())
const Handle(SelectMgr_SensitiveEntity)& aSensitive = anEntitySet->GetSensitiveById (anIdx);
if (aSensitive->IsActiveForSelection())
{
theOwners.Append (anEntitySet->GetSensitiveById (anIdx)->BaseSensitive()->OwnerId());
theOwners.Append (aSensitive->BaseSensitive()->OwnerId());
}
}
}

View File

@@ -17,12 +17,12 @@
#ifndef _SelectMgr_ViewerSelector_HeaderFile
#define _SelectMgr_ViewerSelector_HeaderFile
#include <MMgt_TShared.hxx>
#include <NCollection_Handle.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <OSD_Chronometer.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <Select3D_BVHBuilder3d.hxx>
#include <SelectMgr_IndexedDataMapOfOwnerCriterion.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <SelectMgr_Selection.hxx>
@@ -37,8 +37,8 @@ class SelectMgr_SensitiveEntitySet;
class SelectMgr_EntityOwner;
class SelectBasics_SensitiveEntity;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SensitiveEntitySet> > SelectMgr_MapOfObjectSensitives;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SensitiveEntitySet> >::Iterator SelectMgr_MapOfObjectSensitivesIterator;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_SensitiveEntitySet) > SelectMgr_MapOfObjectSensitives;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_SensitiveEntitySet) >::Iterator SelectMgr_MapOfObjectSensitivesIterator;
typedef NCollection_DataMap<Standard_Integer, SelectMgr_SelectingVolumeManager> SelectMgr_FrustumCache;
@@ -127,6 +127,13 @@ public:
Standard_EXPORT Standard_Boolean Contains (const Handle(SelectMgr_SelectableObject)& theObject) const;
//! Returns the default builder used to construct BVH of entity set.
const Handle(Select3D_BVHBuilder3d) EntitySetBuilder() { return myEntitySetBuilder; }
//! Sets the default builder used to construct BVH of entity set.
//! The new builder will be also assigned for already defined objects, but computed BVH trees will not be invalidated.
Standard_EXPORT void SetEntitySetBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder);
//! Returns the list of selection modes ModeList found in
//! this selector for the selectable object aSelectableObject.
//! Returns true if aSelectableObject is referenced inside
@@ -319,6 +326,7 @@ protected:
mutable SelectMgr_SelectableObjectSet mySelectableObjects;
SelectMgr_ToleranceMap myTolerances;
NCollection_DataMap<Graphic3d_ZLayerId, Standard_Integer> myZLayerOrderMap;
Handle(Select3D_BVHBuilder3d) myEntitySetBuilder;
private:
@@ -330,6 +338,6 @@ private:
};
DEFINE_STANDARD_HANDLE(SelectMgr_ViewerSelector, MMgt_TShared)
DEFINE_STANDARD_HANDLE(SelectMgr_ViewerSelector, Standard_Transient)
#endif