1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0028987: Visualization, SelectMgr_SelectableObject - move out iterator from object

Added method SelectMgr_SelectableObject::Selections() and depreacted methods
Init(), More(), Next() and CurrentSelection().

Added method SelectMgr_Selection::Entities() and depreacted methods
Init(), More(), Next() and Sensitivity().

SelectMgr_SelectableObject::myAssemblyOwner has been moved to AIS_MultipleConnectedInteractive.
SelectMgr_SelectableObject::Selection() now returns NULL handle for not found selection.
SelectMgr_SelectableObject::HasSelection() is no more virtual and just retuns !Selection().IsNull().

SelectMgr_SelectionManager::mySelectors map is now declared using proper
key type Handle(SelectMgr_ViewerSelector) instead of Handle(Standard_Transient).
This commit is contained in:
kgv 2017-09-10 21:24:56 +03:00
parent 746f3d7ab2
commit b5cce1ab23
31 changed files with 872 additions and 1133 deletions

View File

@ -495,9 +495,9 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
aTypOfSel, aPriority, aDeflection, aDeviationAngle); aTypOfSel, aPriority, aDeflection, aDeviationAngle);
Handle(SelectMgr_SelectableObject) aThis (this); Handle(SelectMgr_SelectableObject) aThis (this);
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (theSelection->Sensitive()->BaseSensitive()->OwnerId()); Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
anOwner->Set (aThis); anOwner->Set (aThis);
} }

View File

@ -233,9 +233,9 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
myReference->RecomputePrimitives (theMode); myReference->RecomputePrimitives (theMode);
} }
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (TheRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive()->BaseSensitive()); aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive());
if (!aSensitive.IsNull()) if (!aSensitive.IsNull())
{ {
// Get the copy of SE3D // Get the copy of SE3D
@ -260,38 +260,28 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
Shapes2EntitiesMap; Shapes2EntitiesMap;
if (!myReference->HasSelection (theMode)) if (!myReference->HasSelection (theMode))
{
myReference->RecomputePrimitives (theMode); myReference->RecomputePrimitives (theMode);
}
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode); const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode);
if (aRefSel->IsEmpty() || aRefSel->UpdateStatus() == SelectMgr_TOU_Full) if (aRefSel->IsEmpty() || aRefSel->UpdateStatus() == SelectMgr_TOU_Full)
{ {
myReference->RecomputePrimitives (theMode); myReference->RecomputePrimitives (theMode);
} }
Handle(StdSelect_BRepOwner) anOwner; // Fill in the map of subshapes and corresponding sensitive entities associated with aMode
TopLoc_Location aDummyLoc;
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
Shapes2EntitiesMap aShapes2EntitiesMap; Shapes2EntitiesMap aShapes2EntitiesMap;
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
SensitiveList aSEList;
TopoDS_Shape aSubShape;
// Fill in the map of subshapes and corresponding
// sensitive entities associated with aMode
for (aRefSel->Init(); aRefSel->More(); aRefSel->Next())
{ {
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive()->BaseSensitive()); if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
if(!aSE.IsNull())
{ {
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()); if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
if(!anOwner.IsNull())
{ {
aSubShape = anOwner->Shape(); const TopoDS_Shape& aSubShape = anOwner->Shape();
if(!aShapes2EntitiesMap.IsBound (aSubShape)) if(!aShapes2EntitiesMap.IsBound (aSubShape))
{ {
aShapes2EntitiesMap.Bind (aSubShape, aSEList); aShapes2EntitiesMap.Bind (aSubShape, SensitiveList());
} }
aShapes2EntitiesMap (aSubShape).Append (aSE); aShapes2EntitiesMap (aSubShape).Append (aSE);
} }
@ -301,20 +291,14 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
// Fill in selection from aShapes2EntitiesMap // Fill in selection from aShapes2EntitiesMap
for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next()) for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next())
{ {
aSEList = aMapIt.Value(); const SensitiveList& aSEList = aMapIt.Value();
anOwner = new StdSelect_BRepOwner (aMapIt.Key(), Handle(StdSelect_BRepOwner) anOwner = new StdSelect_BRepOwner (aMapIt.Key(), this, aSEList.First()->OwnerId()->Priority(), Standard_True);
this,
aSEList.First()->OwnerId()->Priority(),
Standard_True);
anOwner->SetLocation (Transformation()); anOwner->SetLocation (Transformation());
for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next()) for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next())
{ {
aSE = aListIt.Value(); Handle(Select3D_SensitiveEntity) aSE = aListIt.Value();
Handle(Select3D_SensitiveEntity) aNewSE = aSE->GetConnected();
aNewSE = aSE->GetConnected();
aNewSE->Set (anOwner); aNewSE->Set (anOwner);
theSelection->Add (aNewSE); theSelection->Add (aNewSE);
} }
} }

View File

@ -186,11 +186,11 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
Handle(AIS_InteractiveContext) aNullContext; Handle(AIS_InteractiveContext) aNullContext;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next()) for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{ {
Handle(AIS_InteractiveObject) anObj = anObjIter.Key(); const Handle(AIS_InteractiveObject)& anObj = anObjIter.Key();
anObj->SetContext (aNullContext); anObj->SetContext (aNullContext);
for (anObj->Init(); anObj->More(); anObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew); aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Renew);
} }
} }
} }
@ -692,15 +692,13 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
return; return;
} }
Standard_Boolean isFound = Standard_False; for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{ {
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable()); Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Display (anObj, Standard_False); Display (anObj, Standard_False);
isFound = Standard_True;
} }
if (isFound && theToUpdateViewer) if (theToUpdateViewer && !mySelection->Objects().IsEmpty())
{ {
myMainVwr->Update(); myMainVwr->Update();
} }
@ -718,16 +716,11 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
} }
Standard_Boolean isFound = Standard_False; Standard_Boolean isFound = Standard_False;
mySelection->Init(); for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
while (mySelection->More())
{ {
Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value(); Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Erase (anObj, Standard_False); Erase (anObj, Standard_False);
isFound = Standard_True; isFound = Standard_True;
mySelection->Init();
} }
if (isFound && theToUpdateViewer) if (isFound && theToUpdateViewer)
@ -2858,15 +2851,14 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin, const Standard_Real theMargin,
const Standard_Boolean theToUpdate) const Standard_Boolean theToUpdate)
{ {
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ? const Handle(AIS_Selection)& aSelection = HasOpenedContext()
myLocalContexts(myCurLocalIndex)->Selection() : mySelection; ? myLocalContexts(myCurLocalIndex)->Selection()
: mySelection;
Bnd_Box aBndSelected; Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap; AIS_MapOfObjectOwners anObjectOwnerMap;
for (aSelection->Init(); aSelection->More(); aSelection->Next()) for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value(); const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
if (anObj->IsInfinite()) if (anObj->IsInfinite())
{ {

View File

@ -1015,10 +1015,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
{ {
Display (theObject, Standard_False); Display (theObject, Standard_False);
} }
if (!theObject->HasSelection (theObject->GlobalSelectionMode()))
{
return;
}
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner(); Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
if (anOwner.IsNull()) if (anOwner.IsNull())
{ {
@ -1039,9 +1036,9 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
return; return;
} }
for (mySelection->Init(); mySelection->More(); mySelection->Next()) for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_EntityOwner) aSelOwner = mySelection->Value(); const Handle(SelectMgr_EntityOwner)& aSelOwner = aSelIter.Value();
if (!myFilters->IsOk (aSelOwner)) if (!myFilters->IsOk (aSelOwner))
{ {
continue; continue;
@ -1139,23 +1136,27 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(AIS_InteractiveOb
const Standard_Boolean theToUpdateViewer) const Standard_Boolean theToUpdateViewer)
{ {
if (theObject.IsNull()) if (theObject.IsNull())
{
return; return;
}
if (HasOpenedContext()) if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (theObject, theToUpdateViewer); return myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (theObject, theToUpdateViewer);
}
const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode(); if (!myObjects.IsBound (theObject))
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode)) {
return; return;
}
setContextToObject (theObject);
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner(); const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
if (!anOwner.IsNull()
if (anOwner.IsNull() || !anOwner->HasSelectable()) && anOwner->HasSelectable())
return; {
AddOrRemoveSelected (anOwner, theToUpdateViewer); AddOrRemoveSelected (anOwner, theToUpdateViewer);
} }
}
//======================================================================= //=======================================================================
//function : AddOrRemoveSelected //function : AddOrRemoveSelected
//purpose : //purpose :
@ -1195,8 +1196,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
AIS_SelectStatus aSelStat = mySelection->Select (theOwner); AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
theOwner->SetSelected (aSelStat == AIS_SS_Added); theOwner->SetSelected (aSelStat == AIS_SS_Added);
const Handle(AIS_InteractiveObject) anObj = const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner; const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj); Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (theOwner->IsSelected()) if (theOwner->IsSelected())
@ -1241,19 +1241,18 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
const Standard_Integer aGlobalSelMode = theObj->GlobalSelectionMode(); const Standard_Integer aGlobalSelMode = theObj->GlobalSelectionMode();
const TColStd_ListOfInteger& anActivatedModes = myObjects (theObj)->SelectionModes(); const TColStd_ListOfInteger& anActivatedModes = myObjects (theObj)->SelectionModes();
Standard_Boolean isGlobalModeActivated = Standard_False;
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next()) for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
{ {
if (aModeIter.Value() == aGlobalSelMode) if (aModeIter.Value() == aGlobalSelMode)
{ {
isGlobalModeActivated = Standard_True; if (Handle(SelectMgr_EntityOwner) aGlobOwner = theObj->GlobalSelOwner())
break; {
return aGlobOwner->IsSelected();
}
return Standard_False;
}
} }
}
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated || theObj->GlobalSelOwner().IsNull())
return Standard_False; return Standard_False;
return theObj->GlobalSelOwner()->IsSelected();
} }
//======================================================================= //=======================================================================
@ -1263,12 +1262,11 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const
{ {
if (HasOpenedContext()) if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->IsSelected (theOwner); return myLocalContexts(myCurLocalIndex)->IsSelected (theOwner);
}
if (theOwner.IsNull()) return !theOwner.IsNull()
return Standard_False; && theOwner->IsSelected();
return theOwner->IsSelected();
} }
//======================================================================= //=======================================================================
@ -1393,39 +1391,46 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
const Standard_Integer theMode) const const Standard_Integer theMode) const
{ {
if (theIObj.IsNull()) if (theIObj.IsNull())
{
return; return;
}
TColStd_ListOfInteger aModes; TColStd_ListOfInteger aModes;
if (theMode == -1) if (theMode == -1)
{
ActivatedModes (theIObj, aModes); ActivatedModes (theIObj, aModes);
}
else else
{
aModes.Append (theMode); aModes.Append (theMode);
}
if (theOwners.IsNull()) if (theOwners.IsNull())
{
theOwners = new SelectMgr_IndexedMapOfOwner(); theOwners = new SelectMgr_IndexedMapOfOwner();
}
TColStd_ListIteratorOfListOfInteger anItr( aModes ); for (TColStd_ListIteratorOfListOfInteger anItr (aModes); anItr.More(); anItr.Next())
for (; anItr.More(); anItr.Next() )
{ {
int aMode = anItr.Value(); const int aMode = anItr.Value();
if ( !theIObj->HasSelection( aMode ) ) const Handle(SelectMgr_Selection)& aSel = theIObj->Selection (aMode);
continue; if (aSel.IsNull())
Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
for ( aSel->Init(); aSel->More(); aSel->Next() )
{ {
Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
if ( aEntity.IsNull() )
continue; continue;
}
Handle(SelectMgr_EntityOwner) aOwner = for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()); {
if ( !aOwner.IsNull() ) if (Handle(SelectBasics_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
{
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()))
{
theOwners->Add (aOwner); theOwners->Add (aOwner);
} }
} }
} }
}
}
//======================================================================= //=======================================================================
//function : NbSelected //function : NbSelected

View File

@ -202,9 +202,8 @@ Load(const Handle(AIS_InteractiveObject)& anInteractive,
{ {
if (myActiveObjects.IsBound (anInteractive)) if (myActiveObjects.IsBound (anInteractive))
{ {
if (anInteractive->HasSelection (ActivationMode)) if (const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode))
{ {
const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode);
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated) if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
{ {
if (!myMainVS->Contains (anInteractive)) if (!myMainVS->Contains (anInteractive))
@ -864,26 +863,28 @@ const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_Interac
void AIS_LocalContext::LoadContextObjects() void AIS_LocalContext::LoadContextObjects()
{ {
AIS_ListIteratorOfListOfInteractive It; if (!myLoadDisplayed)
if(myLoadDisplayed) { {
return;
}
AIS_ListOfInteractive LL; AIS_ListOfInteractive LL;
myCTX->DisplayedObjects(LL,Standard_True); myCTX->DisplayedObjects(LL,Standard_True);
Handle(AIS_LocalStatus) Att; for (AIS_ListIteratorOfListOfInteractive It (LL); It.More(); It.Next())
for (It.Initialize(LL);It.More();It.Next()){ {
const Handle(AIS_InteractiveObject)& anObj = It.Value(); const Handle(AIS_InteractiveObject)& anObj = It.Value();
Att= new AIS_LocalStatus(); Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode)); Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetTemporary(Standard_False); Att->SetTemporary(Standard_False);
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0); Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
for (anObj->Init(); anObj->More(); anObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection(); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
aSel->SetSelectionState (SelectMgr_SOS_Deactivated); aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
} }
myActiveObjects.Bind(anObj,Att); myActiveObjects.Bind(anObj,Att);
} }
} }
}
void AIS_LocalContext::UnloadContextObjects() void AIS_LocalContext::UnloadContextObjects()
{ {

View File

@ -804,13 +804,10 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
{ {
// 1. Collect selectable entities // 1. Collect selectable entities
SelectMgr_IndexedMapOfOwner aValidOwners; SelectMgr_IndexedMapOfOwner aValidOwners;
const TColStd_ListOfInteger& aModes = SelectionModes (theIO); const TColStd_ListOfInteger& aModes = SelectionModes (theIO);
for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
TColStd_ListIteratorOfListOfInteger aModeIter (aModes);
for (; aModeIter.More(); aModeIter.Next())
{ {
int aMode = aModeIter.Value(); const int aMode = aModeIter.Value();
if (!theIO->HasSelection(aMode)) if (!theIO->HasSelection(aMode))
{ {
continue; continue;
@ -821,26 +818,18 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
continue; continue;
} }
Handle(SelectMgr_Selection) aSelection = theIO->Selection(aMode); const Handle(SelectMgr_Selection)& aSelection = theIO->Selection (aMode);
for (aSelection->Init(); aSelection->More(); aSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive(); if (Handle(SelectBasics_SensitiveEntity) anEntity = aSelEntIter.Value()->BaseSensitive())
if (anEntity.IsNull())
{ {
continue; if (Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId()))
}
Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
if (anOwner.IsNull())
{ {
continue;
}
aValidOwners.Add (anOwner); aValidOwners.Add (anOwner);
} }
} }
}
}
// 2. Refresh context's detection and selection and keep only active owners. // 2. Refresh context's detection and selection and keep only active owners.
// Keep last detected object for lastindex initialization. // Keep last detected object for lastindex initialization.

View File

@ -37,7 +37,6 @@ AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
: AIS_InteractiveObject (PrsMgr_TOP_AllView) : AIS_InteractiveObject (PrsMgr_TOP_AllView)
{ {
myHasOwnPresentations = Standard_False; myHasOwnPresentations = Standard_False;
myAssemblyOwner = NULL;
} }
//======================================================================= //=======================================================================
@ -213,8 +212,11 @@ Standard_Boolean AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() co
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/, void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
const Standard_Integer theMode) const Standard_Integer theMode)
{ {
if (theMode != 0) if (theMode == 0)
{ {
return;
}
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next()) for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
{ {
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value()); Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
@ -232,35 +234,6 @@ void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_
aChild->ComputeSelection (aSelection, theMode); aChild->ComputeSelection (aSelection, theMode);
} }
} }
}
//=======================================================================
//function : GlobalSelOwner
//purpose :
//=======================================================================
Handle(SelectMgr_EntityOwner) AIS_MultipleConnectedInteractive::GlobalSelOwner() const
{
return myAssemblyOwner;
}
//=======================================================================
//function : HasSelection
//purpose :
//=======================================================================
Standard_Boolean AIS_MultipleConnectedInteractive::HasSelection (const Standard_Integer theMode) const
{
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
{
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
if (aChild.IsNull())
continue;
if (!aChild->HasSelection (theMode))
return Standard_False;
}
return Standard_True;
}
//======================================================================= //=======================================================================
//function : SetContext //function : SetContext

View File

@ -72,12 +72,11 @@ public:
//! may be decomposed into sub-shapes for dynamic selection. //! may be decomposed into sub-shapes for dynamic selection.
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE; Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
//! Returns the owner of mode for selection of object as a whole //! Returns common entity owner if the object is an assembly
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE; virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
//! Returns true if a selection corresponding to the selection mode theMode was computed for all //! Returns the owner of mode for selection of object as a whole
//! children of multiple connected interactive object. virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
//! Assigns interactive context. //! Assigns interactive context.
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE; Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE;
@ -142,6 +141,10 @@ private:
//! Computes the selection for whole subtree in scene hierarchy. //! Computes the selection for whole subtree in scene hierarchy.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
protected:
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
}; };
DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject) DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)

View File

@ -41,6 +41,7 @@ void AIS_Selection::Clear()
{ {
myresult.Clear(); myresult.Clear();
myResultMap.Clear(); myResultMap.Clear();
myIterator = AIS_NListOfEntityOwner::Iterator();
} }
//======================================================================= //=======================================================================

View File

@ -188,9 +188,9 @@ void IVtkOCC_ViewerSelector::Pick (double** thePoly,
//============================================================================ //============================================================================
void IVtkOCC_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theSelection) void IVtkOCC_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
theSelection->Sensitive()->SetActiveForSelection(); aSelEntIter.Value()->SetActiveForSelection();
} }
theSelection->SetSelectionState (SelectMgr_SOS_Activated); theSelection->SetSelectionState (SelectMgr_SOS_Activated);
@ -205,9 +205,9 @@ void IVtkOCC_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theSel
//============================================================================ //============================================================================
void IVtkOCC_ViewerSelector::Deactivate (const Handle(SelectMgr_Selection)& theSelection) void IVtkOCC_ViewerSelector::Deactivate (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
theSelection->Sensitive()->ResetSelectionActiveStatus(); aSelEntIter.Value()->ResetSelectionActiveStatus();
} }
theSelection->SetSelectionState (SelectMgr_SOS_Deactivated); theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);

View File

@ -23,6 +23,7 @@
#include <Graphic3d_TransformPers.hxx> #include <Graphic3d_TransformPers.hxx>
#include <Graphic3d_TransModeFlags.hxx> #include <Graphic3d_TransModeFlags.hxx>
#include <Graphic3d_ZLayerId.hxx> #include <Graphic3d_ZLayerId.hxx>
#include <Prs3d_Drawer.hxx>
#include <PrsMgr_ListOfPresentableObjects.hxx> #include <PrsMgr_ListOfPresentableObjects.hxx>
#include <PrsMgr_Presentation.hxx> #include <PrsMgr_Presentation.hxx>
#include <PrsMgr_Presentations.hxx> #include <PrsMgr_Presentations.hxx>

View File

@ -115,9 +115,11 @@ static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, con
if(AISObj->HasSelection(4)) { if(AISObj->HasSelection(4)) {
//Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4); //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4); const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
if(!aSelection.IsNull()) { if(!aSelection.IsNull())
for(aSelection->Init();aSelection->More();aSelection->Next()) { {
Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelection->Sensitive()->BaseSensitive()->OwnerId()); for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelEntIter.Value()->BaseSensitive()->OwnerId());
aO->SetHilightMode(Draw::Atoi(argv[1])); aO->SetHilightMode(Draw::Atoi(argv[1]));
} }
} }

View File

@ -32,7 +32,6 @@ SelectMgr_SelectingVolumeManager.cxx
SelectMgr_SelectingVolumeManager.hxx SelectMgr_SelectingVolumeManager.hxx
SelectMgr_Selection.cxx SelectMgr_Selection.cxx
SelectMgr_Selection.hxx SelectMgr_Selection.hxx
SelectMgr_Selection.lxx
SelectMgr_SelectionManager.cxx SelectMgr_SelectionManager.cxx
SelectMgr_SelectionManager.hxx SelectMgr_SelectionManager.hxx
SelectMgr_SensitiveEntity.cxx SelectMgr_SensitiveEntity.cxx

View File

@ -41,13 +41,10 @@
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectableObject,PrsMgr_PresentableObject) IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectableObject,PrsMgr_PresentableObject)
static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq, namespace
const Handle (SelectMgr_Selection)& theSel)
{ {
Standard_Integer ifound=0; Handle(SelectMgr_Selection) THE_NULL_SELECTION;
for (Standard_Integer i=1;i<=seq.Length()&& ifound==0;i++) Handle(SelectMgr_EntityOwner) THE_NULL_ENTITYOWNER;
{if(theSel == seq.Value(i)) ifound=i;}
return ifound;
} }
//================================================== //==================================================
@ -57,8 +54,8 @@ static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq,
SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d) SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
: PrsMgr_PresentableObject (aTypeOfPresentation3d), : PrsMgr_PresentableObject (aTypeOfPresentation3d),
myAssemblyOwner (NULL),
myAutoHilight (Standard_True), myAutoHilight (Standard_True),
mycurrent (0),
myGlobalSelMode (0) myGlobalSelMode (0)
{ {
// //
@ -70,26 +67,12 @@ SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPrese
//================================================== //==================================================
SelectMgr_SelectableObject::~SelectMgr_SelectableObject() SelectMgr_SelectableObject::~SelectMgr_SelectableObject()
{ {
for (Standard_Integer aSelIdx = 1; aSelIdx <= myselections.Length(); ++aSelIdx) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
myselections.Value (aSelIdx)->Clear(); aSelIter.Value()->Clear();
} }
} }
//==================================================
// Function: HasSelection
// Purpose :
//==================================================
Standard_Boolean SelectMgr_SelectableObject::HasSelection (const Standard_Integer theMode) const
{
for (Standard_Integer aSelIdx = 1; aSelIdx <= myselections.Length(); ++aSelIdx)
{
if (((myselections.Value (aSelIdx))->Mode()) == theMode)
return Standard_True;
}
return Standard_False;
}
//================================================== //==================================================
// Function: RecomputePrimitives // Function: RecomputePrimitives
// Purpose : IMPORTANT: Do not use this method to update // Purpose : IMPORTANT: Do not use this method to update
@ -102,9 +85,9 @@ Standard_Boolean SelectMgr_SelectableObject::HasSelection (const Standard_Intege
//================================================== //==================================================
void SelectMgr_SelectableObject::RecomputePrimitives() void SelectMgr_SelectableObject::RecomputePrimitives()
{ {
for (Standard_Integer aSelIdx = 1; aSelIdx <= myselections.Length(); aSelIdx++) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
RecomputePrimitives (myselections.ChangeValue (aSelIdx)->Mode()); RecomputePrimitives (aSelIter.Value()->Mode());
} }
} }
@ -120,20 +103,22 @@ void SelectMgr_SelectableObject::RecomputePrimitives()
//================================================== //==================================================
void SelectMgr_SelectableObject::RecomputePrimitives (const Standard_Integer theMode) void SelectMgr_SelectableObject::RecomputePrimitives (const Standard_Integer theMode)
{ {
Handle(PrsMgr_PresentableObject) aPrsParent (Parent()); SelectMgr_SelectableObject* aSelParent = dynamic_cast<SelectMgr_SelectableObject* > (Parent());
Handle(SelectMgr_SelectableObject) aSelParent = Handle(SelectMgr_SelectableObject)::DownCast (aPrsParent); for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
for (Standard_Integer aSelIdx =1; aSelIdx <= myselections.Length(); aSelIdx++ )
{ {
if (myselections.Value (aSelIdx)->Mode() == theMode) const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
if (aSel->Mode() == theMode)
{ {
myselections (aSelIdx)->Clear(); aSel->Clear();
ComputeSelection (myselections (aSelIdx), theMode); ComputeSelection (aSel, theMode);
myselections (aSelIdx)->UpdateStatus (SelectMgr_TOU_Partial); aSel->UpdateStatus (SelectMgr_TOU_Partial);
myselections (aSelIdx)->UpdateBVHStatus (SelectMgr_TBU_Renew); aSel->UpdateBVHStatus (SelectMgr_TBU_Renew);
if (theMode == 0 && ! aSelParent.IsNull() && ! aSelParent->GetAssemblyOwner().IsNull()) if (theMode == 0 && aSelParent != NULL)
{ {
SetAssemblyOwner (aSelParent->GetAssemblyOwner(), theMode); if (const Handle(SelectMgr_EntityOwner)& anAsmOwner = aSelParent->GetAssemblyOwner())
{
SetAssemblyOwner (anAsmOwner, theMode);
}
} }
return; return;
} }
@ -142,9 +127,12 @@ void SelectMgr_SelectableObject::RecomputePrimitives (const Standard_Integer the
Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode); Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
ComputeSelection (aNewSel, theMode); ComputeSelection (aNewSel, theMode);
if (theMode == 0 && ! aSelParent.IsNull() && ! aSelParent->GetAssemblyOwner().IsNull()) if (theMode == 0 && aSelParent != NULL)
{ {
SetAssemblyOwner (aSelParent->GetAssemblyOwner(), theMode); if (const Handle(SelectMgr_EntityOwner)& anAsmOwner = aSelParent->GetAssemblyOwner())
{
SetAssemblyOwner (anAsmOwner, theMode);
}
} }
aNewSel->UpdateStatus (SelectMgr_TOU_Partial); aNewSel->UpdateStatus (SelectMgr_TOU_Partial);
@ -157,14 +145,16 @@ void SelectMgr_SelectableObject::RecomputePrimitives (const Standard_Integer the
// Function: ClearSelections // Function: ClearSelections
// Purpose : // Purpose :
//================================================== //==================================================
void SelectMgr_SelectableObject::ClearSelections(const Standard_Boolean update) void SelectMgr_SelectableObject::ClearSelections (const Standard_Boolean theToUpdate)
{ {
for (Standard_Integer i =1; i<= myselections.Length(); i++ ) { for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
myselections.Value(i)->Clear();
myselections.Value (i)->UpdateBVHStatus (SelectMgr_TBU_Remove);
if(update)
{ {
myselections.Value(i)->UpdateStatus(SelectMgr_TOU_Full); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
aSel->Clear();
aSel->UpdateBVHStatus (SelectMgr_TBU_Remove);
if (theToUpdate)
{
aSel->UpdateStatus (SelectMgr_TOU_Full);
} }
} }
} }
@ -175,64 +165,68 @@ void SelectMgr_SelectableObject::ClearSelections(const Standard_Boolean update)
// Purpose : // Purpose :
//================================================== //==================================================
const Handle(SelectMgr_Selection)& SelectMgr_SelectableObject const Handle(SelectMgr_Selection)& SelectMgr_SelectableObject::Selection (const Standard_Integer theMode) const
::Selection(const Standard_Integer aMode) const
{ {
Standard_Boolean Found = Standard_False; if (theMode == -1)
Standard_Integer Rank=0;
for (Standard_Integer i=1;i<=myselections.Length() && !Found;i++)
{ {
if((myselections.Value(i))->Mode()==aMode){ Found = Standard_True; return THE_NULL_SELECTION;
Rank=i;}}
return myselections.Value(Rank);
} }
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
if (aSel->Mode() == theMode)
{
return aSel;
}
}
return THE_NULL_SELECTION;
}
//================================================== //==================================================
// Function: AddSelection // Function: AddSelection
// Purpose : // Purpose :
//================================================== //==================================================
void SelectMgr_SelectableObject void SelectMgr_SelectableObject::AddSelection (const Handle(SelectMgr_Selection)& theSel,
::AddSelection(const Handle(SelectMgr_Selection)& aSel, const Standard_Integer theMode)
const Standard_Integer aMode)
{ {
Standard_Boolean isReplaced = Standard_False; if(theSel->IsEmpty())
if(aSel->IsEmpty())
{ {
ComputeSelection(aSel, aMode); ComputeSelection(theSel, theMode);
aSel->UpdateStatus(SelectMgr_TOU_Partial); theSel->UpdateStatus(SelectMgr_TOU_Partial);
aSel->UpdateBVHStatus (SelectMgr_TBU_Add); theSel->UpdateBVHStatus (SelectMgr_TBU_Add);
} }
if (HasSelection(aMode))
Standard_Boolean isReplaced = Standard_False;
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& temp= Selection(aMode); if (aSelIter.Value()->Mode() == theMode)
Standard_Integer I = Search(myselections,temp);
if(I!=0)
{ {
myselections.Remove(I);
isReplaced = Standard_True; isReplaced = Standard_True;
myselections.Remove (aSelIter);
break;
} }
} }
myselections.Append(aSel); myselections.Append (theSel);
if (isReplaced) if (isReplaced)
{ {
myselections.Last()->UpdateBVHStatus (SelectMgr_TBU_Renew); myselections.Last()->UpdateBVHStatus (SelectMgr_TBU_Renew);
} }
if (aMode == 0) if (theMode == 0)
{ {
Handle(PrsMgr_PresentableObject) aPrsParent (Parent()); SelectMgr_SelectableObject* aSelParent = dynamic_cast<SelectMgr_SelectableObject* > (Parent());
Handle(SelectMgr_SelectableObject) aSelParent = Handle(SelectMgr_SelectableObject)::DownCast (aPrsParent); if (aSelParent != NULL)
if (! aSelParent.IsNull() && ! aSelParent->GetAssemblyOwner().IsNull())
{ {
SetAssemblyOwner (aSelParent->GetAssemblyOwner(), aMode); if (const Handle(SelectMgr_EntityOwner)& anAsmOwner = aSelParent->GetAssemblyOwner())
{
SetAssemblyOwner (anAsmOwner, theMode);
}
} }
} }
} }
//======================================================================= //=======================================================================
//function : ReSetTransformation //function : ReSetTransformation
@ -240,15 +234,12 @@ void SelectMgr_SelectableObject
//======================================================================= //=======================================================================
void SelectMgr_SelectableObject::ResetTransformation() void SelectMgr_SelectableObject::ResetTransformation()
{ {
for (Init(); More(); Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection) & aSel = CurrentSelection();
for (aSel->Init(); aSel->More(); aSel->Next())
{ {
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
aSel->UpdateStatus (SelectMgr_TOU_Partial); aSel->UpdateStatus (SelectMgr_TOU_Partial);
aSel->UpdateBVHStatus (SelectMgr_TBU_None); aSel->UpdateBVHStatus (SelectMgr_TBU_None);
} }
}
PrsMgr_PresentableObject::ResetTransformation(); PrsMgr_PresentableObject::ResetTransformation();
} }
@ -259,9 +250,9 @@ void SelectMgr_SelectableObject::ResetTransformation()
//======================================================================= //=======================================================================
void SelectMgr_SelectableObject::UpdateTransformation() void SelectMgr_SelectableObject::UpdateTransformation()
{ {
for (Init(); More(); Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
CurrentSelection()->UpdateStatus (SelectMgr_TOU_Partial); aSelIter.Value()->UpdateStatus (SelectMgr_TOU_Partial);
} }
PrsMgr_PresentableObject::UpdateTransformation(); PrsMgr_PresentableObject::UpdateTransformation();
@ -271,29 +262,32 @@ void SelectMgr_SelectableObject::UpdateTransformation()
//function : UpdateTransformation //function : UpdateTransformation
//purpose : //purpose :
//======================================================================= //=======================================================================
void SelectMgr_SelectableObject::UpdateTransformations(const Handle(SelectMgr_Selection)& Sel) void SelectMgr_SelectableObject::UpdateTransformations (const Handle(SelectMgr_Selection)& theSel)
{
const TopLoc_Location aSelfLocation (Transformation());
if (aSelfLocation.IsIdentity())
{
return;
}
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
if (Handle(Select3D_SensitiveEntity) aSensEntity = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
{
const Handle(SelectBasics_EntityOwner)& aEOwner = aSensEntity->OwnerId();
if (Handle(SelectMgr_EntityOwner) aMgrEO = Handle(SelectMgr_EntityOwner)::DownCast (aEOwner))
{ {
TopLoc_Location aSelfLocation (Transformation());
Handle(Select3D_SensitiveEntity) SE;
if(aSelfLocation.IsIdentity()) return;
for(Sel->Init();Sel->More();Sel->Next()){
SE = Handle(Select3D_SensitiveEntity)::DownCast (Sel->Sensitive()->BaseSensitive());
if(!SE.IsNull()){
const Handle(SelectBasics_EntityOwner)& aEOwner = SE->OwnerId();
Handle(SelectMgr_EntityOwner) aMgrEO =
Handle(SelectMgr_EntityOwner)::DownCast (aEOwner);
if (!aMgrEO.IsNull())
aMgrEO->SetLocation (aSelfLocation); aMgrEO->SetLocation (aSelfLocation);
} }
} }
} }
}
//======================================================================= //=======================================================================
//function : HilightSelected //function : HilightSelected
//purpose : //purpose :
//======================================================================= //=======================================================================
void SelectMgr_SelectableObject::HilightSelected void SelectMgr_SelectableObject::HilightSelected (const Handle(PrsMgr_PresentationManager3d)&,
( const Handle(PrsMgr_PresentationManager3d)&,
const SelectMgr_SequenceOfOwner&) const SelectMgr_SequenceOfOwner&)
{ {
throw Standard_NotImplemented("SelectMgr_SelectableObject::HilightSelected"); throw Standard_NotImplemented("SelectMgr_SelectableObject::HilightSelected");
@ -306,8 +300,10 @@ void SelectMgr_SelectableObject::HilightSelected
void SelectMgr_SelectableObject::ClearSelected() void SelectMgr_SelectableObject::ClearSelected()
{ {
if(!mySelectionPrs.IsNull()) if(!mySelectionPrs.IsNull())
{
mySelectionPrs->Clear(); mySelectionPrs->Clear();
} }
}
//======================================================================= //=======================================================================
//function : ClearDynamicHighlight //function : ClearDynamicHighlight
@ -330,7 +326,7 @@ void SelectMgr_SelectableObject::HilightOwnerWithColor (const Handle(PrsMgr_Pres
} }
//======================================================================= //=======================================================================
//function : MaxFaceNodes //function : IsAutoHilight
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean SelectMgr_SelectableObject::IsAutoHilight() const Standard_Boolean SelectMgr_SelectableObject::IsAutoHilight() const
@ -339,7 +335,7 @@ Standard_Boolean SelectMgr_SelectableObject::IsAutoHilight () const
} }
//======================================================================= //=======================================================================
//function : MaxFaceNodes //function : SetAutoHilight
//purpose : //purpose :
//======================================================================= //=======================================================================
void SelectMgr_SelectableObject::SetAutoHilight ( const Standard_Boolean newAutoHilight ) void SelectMgr_SelectableObject::SetAutoHilight ( const Standard_Boolean newAutoHilight )
@ -421,23 +417,21 @@ void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
myHilightPrs->SetZLayer (theLayerId); myHilightPrs->SetZLayer (theLayerId);
// update all entity owner presentations // update all entity owner presentations
for (Init (); More () ;Next ()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSel = CurrentSelection(); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
for (aSel->Init (); aSel->More (); aSel->Next ()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
Handle(Select3D_SensitiveEntity) aEntity = if (Handle(Select3D_SensitiveEntity) aEntity = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
Handle(Select3D_SensitiveEntity)::DownCast (aSel->Sensitive()->BaseSensitive()); {
if (!aEntity.IsNull()) if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast (aEntity->OwnerId()))
{ {
Handle(SelectMgr_EntityOwner) aOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aEntity->OwnerId());
if (!aOwner.IsNull())
aOwner->SetZLayer (theLayerId); aOwner->SetZLayer (theLayerId);
} }
} }
} }
} }
}
//======================================================================= //=======================================================================
//function : updateSelection //function : updateSelection
@ -449,20 +443,20 @@ void SelectMgr_SelectableObject::updateSelection (const Standard_Integer theMode
{ {
if (theMode == -1) if (theMode == -1)
{ {
for (Init(); More(); Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSel = CurrentSelection(); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
aSel->UpdateStatus (SelectMgr_TOU_Full); aSel->UpdateStatus (SelectMgr_TOU_Full);
} }
return; return;
} }
for (Init(); More(); Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
if (CurrentSelection()->Mode() == theMode) const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
if (aSel->Mode() == theMode)
{ {
CurrentSelection()->UpdateStatus (SelectMgr_TOU_Full); aSel->UpdateStatus (SelectMgr_TOU_Full);
return; return;
} }
} }
@ -477,44 +471,31 @@ void SelectMgr_SelectableObject::SetAssemblyOwner (const Handle(SelectMgr_Entity
{ {
if (theMode == -1) if (theMode == -1)
{ {
for (Standard_Integer aModeIter = 1; aModeIter <= myselections.Length(); ++aModeIter) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
Handle(SelectMgr_Selection)& aSel = myselections.ChangeValue (aModeIter); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
for (aSel->Init(); aSel->More(); aSel->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
aSel->Sensitive()->BaseSensitive()->Set (theOwner); aSelEntIter.Value()->BaseSensitive()->Set (theOwner);
} }
} }
return; return;
} }
if (!HasSelection (theMode)) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
return;
for (Standard_Integer aModeIter = 1; aModeIter <= myselections.Length(); ++aModeIter)
{ {
if (myselections.Value (aModeIter)->Mode() == theMode) const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
if (aSel->Mode() == theMode)
{ {
Handle(SelectMgr_Selection)& aSel = myselections.ChangeValue (aModeIter); for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
for (aSel->Init(); aSel->More(); aSel->Next())
{ {
aSel->Sensitive()->BaseSensitive()->Set (theOwner); aSelEntIter.Value()->BaseSensitive()->Set (theOwner);
} }
return; return;
} }
} }
} }
//=======================================================================
//function : GetAssemblyOwner
//purpose : Returns common entity owner if it is an assembly
//=======================================================================
const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwner() const
{
return myAssemblyOwner;
}
//======================================================================= //=======================================================================
//function : BndBoxOfSelected //function : BndBoxOfSelected
//purpose : //purpose :
@ -525,19 +506,18 @@ Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (const Handle(SelectMgr_Ind
return Bnd_Box(); return Bnd_Box();
Bnd_Box aBnd; Bnd_Box aBnd;
for (Init(); More(); Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSel = CurrentSelection(); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated) if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
continue; continue;
for (aSel->Init(); aSel->More(); aSel->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
const Handle(SelectMgr_EntityOwner) anOwner = const Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
if (theOwners->Contains (anOwner)) if (theOwners->Contains (anOwner))
{ {
Select3D_BndBox3d aBox = aSel->Sensitive()->BaseSensitive()->BoundingBox(); Select3D_BndBox3d aBox = aSelEntIter.Value()->BaseSensitive()->BoundingBox();
aBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(), aBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z()); aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
} }
@ -553,18 +533,20 @@ Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (const Handle(SelectMgr_Ind
//======================================================================= //=======================================================================
Handle(SelectMgr_EntityOwner) SelectMgr_SelectableObject::GlobalSelOwner() const Handle(SelectMgr_EntityOwner) SelectMgr_SelectableObject::GlobalSelOwner() const
{ {
Handle(SelectMgr_EntityOwner) anOwner;
if (!HasSelection (myGlobalSelMode))
return anOwner;
const Handle(SelectMgr_Selection)& aGlobalSel = Selection (myGlobalSelMode); const Handle(SelectMgr_Selection)& aGlobalSel = Selection (myGlobalSelMode);
if (aGlobalSel->IsEmpty()) if (!aGlobalSel.IsNull()
return anOwner; && !aGlobalSel->IsEmpty())
{
aGlobalSel->Init(); return Handle(SelectMgr_EntityOwner)::DownCast (aGlobalSel->Entities().First()->BaseSensitive()->OwnerId());
anOwner = }
Handle(SelectMgr_EntityOwner)::DownCast (aGlobalSel->Sensitive()->BaseSensitive()->OwnerId()); return THE_NULL_ENTITYOWNER;
}
return anOwner;
//=======================================================================
//function : GetAssemblyOwner
//purpose :
//=======================================================================
const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwner() const
{
return THE_NULL_ENTITYOWNER;
} }

View File

@ -17,30 +17,18 @@
#ifndef _SelectMgr_SelectableObject_HeaderFile #ifndef _SelectMgr_SelectableObject_HeaderFile
#define _SelectMgr_SelectableObject_HeaderFile #define _SelectMgr_SelectableObject_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <SelectMgr_SequenceOfSelection.hxx>
#include <Prs3d_Drawer.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <PrsMgr_PresentableObject.hxx> #include <PrsMgr_PresentableObject.hxx>
#include <PrsMgr_TypeOfPresentation3d.hxx>
#include <SelectMgr_Selection.hxx>
#include <PrsMgr_PresentationManager3d.hxx> #include <PrsMgr_PresentationManager3d.hxx>
#include <SelectMgr_SequenceOfOwner.hxx> #include <PrsMgr_TypeOfPresentation3d.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx> #include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_SequenceOfSelection.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
class SelectMgr_EntityOwner; class SelectMgr_EntityOwner;
class Prs3d_Presentation; class Prs3d_Presentation;
class Standard_NotImplemented; class Standard_NotImplemented;
class SelectMgr_SelectionManager; class SelectMgr_SelectionManager;
class Bnd_Box;
class SelectMgr_SelectableObject;
DEFINE_STANDARD_HANDLE(SelectMgr_SelectableObject, PrsMgr_PresentableObject)
//! A framework to supply the structure of the object to be //! A framework to supply the structure of the object to be
//! selected. At the first pick, this structure is created by //! selected. At the first pick, this structure is created by
@ -94,36 +82,30 @@ public:
//! completely) when some selection mode is activated not for the first time. //! completely) when some selection mode is activated not for the first time.
Standard_EXPORT void ClearSelections (const Standard_Boolean update = Standard_False); Standard_EXPORT void ClearSelections (const Standard_Boolean update = Standard_False);
//! Returns the selection Selection having the selection mode aMode. //! Returns the selection having specified selection mode or NULL.
Standard_EXPORT const Handle(SelectMgr_Selection)& Selection (const Standard_Integer aMode) const; Standard_EXPORT const Handle(SelectMgr_Selection)& Selection (const Standard_Integer theMode) const;
//! Returns true if a selection corresponding to the //! Returns true if a selection corresponding to the selection mode theMode was computed for this object.
//! selection mode theMode was computed for this object. Standard_Boolean HasSelection (const Standard_Integer theMode) const { return !Selection (theMode).IsNull(); }
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const;
//! Return the sequence of selections.
const SelectMgr_SequenceOfSelection& Selections() const { return myselections; }
//! Begins the iteration scanning for sensitive primitives. //! Begins the iteration scanning for sensitive primitives.
void Init() Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
{ void Init() { mycurrent = 1; }
mycurrent = 1;
}
//! Continues the iteration scanning for sensitive primitives. //! Continues the iteration scanning for sensitive primitives.
Standard_Boolean More() const Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
{ Standard_Boolean More() const { return mycurrent <= myselections.Length(); }
return mycurrent <= myselections.Length();
}
//! Continues the iteration scanning for sensitive primitives. //! Continues the iteration scanning for sensitive primitives.
void Next() Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
{ void Next() { ++mycurrent; }
mycurrent++;
}
//! Returns the current selection in this framework. //! Returns the current selection in this framework.
const Handle(SelectMgr_Selection)& CurrentSelection() const Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
{ const Handle(SelectMgr_Selection)& CurrentSelection() const { return myselections (mycurrent); }
return myselections (mycurrent);
}
Standard_EXPORT void ResetTransformation() Standard_OVERRIDE; Standard_EXPORT void ResetTransformation() Standard_OVERRIDE;
@ -191,9 +173,6 @@ public:
//! Sets common entity owner for assembly sensitive object entities //! Sets common entity owner for assembly sensitive object entities
Standard_EXPORT void SetAssemblyOwner (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer theMode = -1); Standard_EXPORT void SetAssemblyOwner (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Integer theMode = -1);
//! Returns common entity owner if the object is an assembly
Standard_EXPORT const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const;
//! Returns a bounding box of sensitive entities with the owners given //! Returns a bounding box of sensitive entities with the owners given
//! if they are a part of activated selection //! if they are a part of activated selection
Standard_EXPORT Bnd_Box BndBoxOfSelected (const Handle(SelectMgr_IndexedMapOfOwner)& theOwners); Standard_EXPORT Bnd_Box BndBoxOfSelected (const Handle(SelectMgr_IndexedMapOfOwner)& theOwners);
@ -207,6 +186,9 @@ public:
//! Returns the owner of mode for selection of object as a whole //! Returns the owner of mode for selection of object as a whole
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const; Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const;
//! Returns common entity owner if the object is an assembly
Standard_EXPORT virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const;
protected: protected:
Standard_EXPORT SelectMgr_SelectableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView); Standard_EXPORT SelectMgr_SelectableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
@ -221,7 +203,6 @@ protected:
protected: protected:
SelectMgr_SequenceOfSelection myselections; SelectMgr_SequenceOfSelection myselections;
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
Handle(Prs3d_Presentation) mySelectionPrs; Handle(Prs3d_Presentation) mySelectionPrs;
Handle(Prs3d_Presentation) myHilightPrs; Handle(Prs3d_Presentation) myHilightPrs;
Standard_Boolean myAutoHilight; Standard_Boolean myAutoHilight;
@ -233,4 +214,6 @@ private:
}; };
DEFINE_STANDARD_HANDLE(SelectMgr_SelectableObject, PrsMgr_PresentableObject)
#endif // _SelectMgr_SelectableObject_HeaderFile #endif // _SelectMgr_SelectableObject_HeaderFile

View File

@ -14,10 +14,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <Standard_NullObject.hxx>
#include <SelectBasics_EntityOwner.hxx> #include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx> #include <SelectMgr_Selection.hxx>
#include <Standard_NullObject.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_Selection,Standard_Transient) IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_Selection,Standard_Transient)
@ -26,7 +26,8 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_Selection,Standard_Transient)
// Purpose : // Purpose :
//================================================== //==================================================
SelectMgr_Selection::SelectMgr_Selection (const Standard_Integer theModeIdx) SelectMgr_Selection::SelectMgr_Selection (const Standard_Integer theModeIdx)
: myMode (theModeIdx), : myEntityIter (0),
myMode (theModeIdx),
mySelectionState (SelectMgr_SOS_Unknown), mySelectionState (SelectMgr_SOS_Unknown),
myBVHUpdateStatus (SelectMgr_TBU_None), myBVHUpdateStatus (SelectMgr_TBU_None),
mySensFactor (2), mySensFactor (2),
@ -58,18 +59,18 @@ void SelectMgr_Selection::Destroy()
//================================================== //==================================================
void SelectMgr_Selection::Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive) void SelectMgr_Selection::Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive)
{ {
// if input is null: // if input is null: in debug mode raise exception
// in debug mode raise exception Standard_NullObject_Raise_if (theSensitive.IsNull(), "Null sensitive entity is added to the selection");
Standard_NullObject_Raise_if if (theSensitive.IsNull())
(theSensitive.IsNull(), "Null sensitive entity is added to the selection");
// in release mode do not add
if (!theSensitive.IsNull())
{ {
// in release mode do not add
return;
}
Handle(SelectMgr_SensitiveEntity) anEntity = new SelectMgr_SensitiveEntity (theSensitive); Handle(SelectMgr_SensitiveEntity) anEntity = new SelectMgr_SensitiveEntity (theSensitive);
myEntities.Append (anEntity); myEntities.Append (anEntity);
if (mySelectionState == SelectMgr_SOS_Activated && if (mySelectionState == SelectMgr_SOS_Activated
!anEntity->IsActiveForSelection()) && !anEntity->IsActiveForSelection())
{ {
anEntity->SetActiveForSelection(); anEntity->SetActiveForSelection();
} }
@ -80,9 +81,7 @@ void SelectMgr_Selection::Add (const Handle(SelectBasics_SensitiveEntity)& theSe
} }
else else
{ {
mySensFactor = Max (mySensFactor, mySensFactor = Max (mySensFactor, anEntity->BaseSensitive()->SensitivityFactor());
anEntity->BaseSensitive()->SensitivityFactor());
}
} }
} }
@ -101,52 +100,6 @@ void SelectMgr_Selection::Clear()
myEntities.Clear(); myEntities.Clear();
} }
//==================================================
// Function: IsEmpty
// Purpose :
//==================================================
Standard_Boolean SelectMgr_Selection::IsEmpty() const
{
return myEntities.IsEmpty();
}
//==================================================
// function: GetEntityById
// purpose : Returns sensitive entity stored by
// index theIdx in entites vector
//==================================================
Handle(SelectMgr_SensitiveEntity)& SelectMgr_Selection::GetEntityById (const Standard_Integer theIdx)
{
return myEntities.ChangeValue (theIdx);
}
//==================================================
// function: GetSelectionState
// purpose : Returns status of selection
//==================================================
SelectMgr_StateOfSelection SelectMgr_Selection::GetSelectionState() const
{
return mySelectionState;
}
//==================================================
// function: SetSelectionState
// purpose : Sets status of selection
//==================================================
void SelectMgr_Selection::SetSelectionState (const SelectMgr_StateOfSelection theState) const
{
mySelectionState = theState;
}
//==================================================
// function: Sensitivity
// purpose : Returns sensitivity of the selection
//==================================================
Standard_Integer SelectMgr_Selection::Sensitivity() const
{
return mySensFactor;
}
//================================================== //==================================================
// function: SetSensitivity // function: SetSensitivity
// purpose : Changes sensitivity of the selection and all its entities to the given value. // purpose : Changes sensitivity of the selection and all its entities to the given value.

View File

@ -18,18 +18,11 @@
#define _SelectMgr_Selection_HeaderFile #define _SelectMgr_Selection_HeaderFile
#include <NCollection_Vector.hxx> #include <NCollection_Vector.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <SelectMgr_TypeOfUpdate.hxx>
#include <Standard_Transient.hxx>
#include <SelectMgr_SensitiveEntity.hxx> #include <SelectMgr_SensitiveEntity.hxx>
#include <SelectMgr_StateOfSelection.hxx> #include <SelectMgr_StateOfSelection.hxx>
#include <SelectMgr_TypeOfBVHUpdate.hxx> #include <SelectMgr_TypeOfBVHUpdate.hxx>
#include <SelectMgr_TypeOfUpdate.hxx>
class Standard_NullObject;
class SelectBasics_SensitiveEntity; class SelectBasics_SensitiveEntity;
//! Represents the state of a given selection mode for a //! Represents the state of a given selection mode for a
@ -69,7 +62,7 @@ class SelectBasics_SensitiveEntity;
//! - mode 6 : selection of the constituent solids. //! - mode 6 : selection of the constituent solids.
class SelectMgr_Selection : public Standard_Transient class SelectMgr_Selection : public Standard_Transient
{ {
DEFINE_STANDARD_RTTIEXT(SelectMgr_Selection, Standard_Transient)
public: public:
//! Constructs a selection object defined by the selection mode IdMode. //! Constructs a selection object defined by the selection mode IdMode.
@ -80,8 +73,7 @@ public:
Standard_EXPORT void Destroy(); Standard_EXPORT void Destroy();
//! Adds the sensitive primitive aprimitive to the list of //! Adds the sensitive primitive to the list of stored entities in this object.
//! stored entities in this object.
//! Raises NullObject if the primitive is a null handle. //! Raises NullObject if the primitive is a null handle.
Standard_EXPORT void Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive); Standard_EXPORT void Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive);
@ -89,25 +81,35 @@ public:
Standard_EXPORT void Clear(); Standard_EXPORT void Clear();
//! returns true if no sensitive entity is stored. //! returns true if no sensitive entity is stored.
Standard_EXPORT Standard_Boolean IsEmpty() const; Standard_Boolean IsEmpty() const { return myEntities.IsEmpty(); }
//! returns the selection mode represented by this selection //! returns the selection mode represented by this selection
Standard_Integer Mode() const; Standard_Integer Mode() const { return myMode; }
//! Return entities.
const NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>& Entities() const { return myEntities; }
//! Return entities.
NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>& ChangeEntities() { return myEntities; }
//! Begins an iteration scanning for sensitive primitives. //! Begins an iteration scanning for sensitive primitives.
void Init(); Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
void Init() { myEntityIter = myEntities.Lower(); }
//! Continues the iteration scanning for sensitive //! Continues the iteration scanning for sensitive
//! primitives with the mode defined in this framework. //! primitives with the mode defined in this framework.
Standard_Boolean More() const; Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
Standard_Boolean More() const { return myEntityIter <= myEntities.Upper(); }
//! Returns the next sensitive primitive found in the //! Returns the next sensitive primitive found in the
//! iteration. This is a scan for entities with the mode //! iteration. This is a scan for entities with the mode
//! defined in this framework. //! defined in this framework.
void Next(); Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
void Next() { ++myEntityIter; }
//! Returns any sensitive primitive in this framework. //! Returns any sensitive primitive in this framework.
const Handle(SelectMgr_SensitiveEntity)& Sensitive() const; Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
const Handle(SelectMgr_SensitiveEntity)& Sensitive() const { return myEntities.Value (myEntityIter); }
//! Returns the flag UpdateFlag. //! Returns the flag UpdateFlag.
//! This flage gives the update status of this framework //! This flage gives the update status of this framework
@ -115,39 +117,32 @@ public:
//! - full //! - full
//! - partial, or //! - partial, or
//! - none. //! - none.
SelectMgr_TypeOfUpdate UpdateStatus() const; SelectMgr_TypeOfUpdate UpdateStatus() const { return myUpdateStatus; }
void UpdateStatus (const SelectMgr_TypeOfUpdate theStatus); void UpdateStatus (const SelectMgr_TypeOfUpdate theStatus) { myUpdateStatus = theStatus; }
void UpdateBVHStatus (const SelectMgr_TypeOfBVHUpdate theStatus); void UpdateBVHStatus (const SelectMgr_TypeOfBVHUpdate theStatus) { myBVHUpdateStatus = theStatus; }
SelectMgr_TypeOfBVHUpdate BVHUpdateStatus() const; SelectMgr_TypeOfBVHUpdate BVHUpdateStatus() const { return myBVHUpdateStatus; }
//! Returns status of selection //! Returns status of selection
Standard_EXPORT SelectMgr_StateOfSelection GetSelectionState() const; SelectMgr_StateOfSelection GetSelectionState() const { return mySelectionState; }
//! Sets status of selection //! Sets status of selection
Standard_EXPORT void SetSelectionState (const SelectMgr_StateOfSelection theState) const; void SetSelectionState (const SelectMgr_StateOfSelection theState) const { mySelectionState = theState; }
//! Returns sensitivity of the selection //! Returns sensitivity of the selection
Standard_EXPORT Standard_Integer Sensitivity() const; Standard_Integer Sensitivity() const { return mySensFactor; }
//! Changes sensitivity of the selection and all its entities to the given value. //! Changes sensitivity of the selection and all its entities to the given value.
//! IMPORTANT: This method does not update any outer selection structures, so for //! IMPORTANT: This method does not update any outer selection structures, so for
//! proper updates use SelectMgr_SelectionManager::SetSelectionSensitivity method. //! proper updates use SelectMgr_SelectionManager::SetSelectionSensitivity method.
Standard_EXPORT void SetSensitivity (const Standard_Integer theNewSens); Standard_EXPORT void SetSensitivity (const Standard_Integer theNewSens);
DEFINE_STANDARD_RTTIEXT(SelectMgr_Selection,Standard_Transient)
protected:
//! Returns sensitive entity stored by index theIdx in entites vector
Standard_EXPORT Handle(SelectMgr_SensitiveEntity)& GetEntityById (const Standard_Integer theIdx);
private: private:
NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities; NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities;
NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator myEntityIter; Standard_Integer myEntityIter;
Standard_Integer myMode; Standard_Integer myMode;
SelectMgr_TypeOfUpdate myUpdateStatus; SelectMgr_TypeOfUpdate myUpdateStatus;
mutable SelectMgr_StateOfSelection mySelectionState; mutable SelectMgr_StateOfSelection mySelectionState;
@ -158,6 +153,4 @@ private:
DEFINE_STANDARD_HANDLE(SelectMgr_Selection, Standard_Transient) DEFINE_STANDARD_HANDLE(SelectMgr_Selection, Standard_Transient)
#include <SelectMgr_Selection.lxx>
#endif #endif

View File

@ -1,94 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// =======================================================================
// function : Mode
// purpose :
// =======================================================================
inline Standard_Integer SelectMgr_Selection::Mode() const
{
return myMode;
}
// =======================================================================
// function : Init
// purpose :
// =======================================================================
inline void SelectMgr_Selection::Init()
{
myEntityIter.Init (myEntities);
}
// =======================================================================
// function : More
// purpose :
// =======================================================================
inline Standard_Boolean SelectMgr_Selection::More() const
{
return myEntityIter.More();
}
// =======================================================================
// function : Next
// purpose :
// =======================================================================
inline void SelectMgr_Selection::Next()
{
myEntityIter.Next();
}
// =======================================================================
// function : Sensitive
// purpose :
// =======================================================================
inline const Handle(SelectMgr_SensitiveEntity)& SelectMgr_Selection::Sensitive() const
{
return myEntityIter.Value();
}
// =======================================================================
// function : UpdateStatus
// purpose :
// =======================================================================
inline void SelectMgr_Selection::UpdateStatus(const SelectMgr_TypeOfUpdate theStatus)
{
myUpdateStatus = theStatus;
}
// =======================================================================
// function : UpdateStatus
// purpose :
// =======================================================================
inline SelectMgr_TypeOfUpdate SelectMgr_Selection::UpdateStatus() const
{
return myUpdateStatus;
}
// =======================================================================
// function : UpdateBVHStatus
// purpose :
// =======================================================================
inline void SelectMgr_Selection::UpdateBVHStatus (const SelectMgr_TypeOfBVHUpdate theStatus)
{
myBVHUpdateStatus = theStatus;
}
// =======================================================================
// function : BVHUpdateStatus
// purpose :
// =======================================================================
inline SelectMgr_TypeOfBVHUpdate SelectMgr_Selection::BVHUpdateStatus() const
{
return myBVHUpdateStatus;
}

View File

@ -14,12 +14,12 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <SelectMgr_SelectionManager.hxx>
#include <OSD_Environment.hxx> #include <OSD_Environment.hxx>
#include <SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx> #include <SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx>
#include <SelectMgr_SelectableObject.hxx> #include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_Selection.hxx> #include <SelectMgr_Selection.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <SelectMgr_SequenceOfSelector.hxx> #include <SelectMgr_SequenceOfSelector.hxx>
#include <SelectMgr_ViewerSelector.hxx> #include <SelectMgr_ViewerSelector.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
@ -30,25 +30,30 @@
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectionManager,Standard_Transient) IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectionManager,Standard_Transient)
static Standard_Integer FindIndex (const SelectMgr_SequenceOfSelector& theSelectorsSeq, namespace
{
static bool containsSelector (const SelectMgr_SequenceOfSelector& theSelectorsSeq,
const Handle(SelectMgr_ViewerSelector)& theSelector) const Handle(SelectMgr_ViewerSelector)& theSelector)
{ {
Standard_Integer aFoundIdx = 0; for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (theSelectorsSeq); aSelectorIter.More(); aSelectorIter.Next())
for (Standard_Integer anIdx = 1; anIdx <= theSelectorsSeq.Length() && aFoundIdx==0; anIdx++)
{ {
if (theSelector == theSelectorsSeq.Value (anIdx)) if (aSelectorIter.Value() == theSelector)
aFoundIdx = anIdx; {
return true;
}
}
return false;
} }
return aFoundIdx;
} }
//================================================== //==================================================
// Function: Create // Function: Create
// Purpose : // Purpose :
//================================================== //==================================================
SelectMgr_SelectionManager::SelectMgr_SelectionManager() {} SelectMgr_SelectionManager::SelectMgr_SelectionManager()
{
//
}
//================================================== //==================================================
// Function: Add // Function: Add
@ -68,12 +73,16 @@ void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_ViewerSelector)&
for (SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors aSelIter (myLocal); aSelIter.More(); aSelIter.Next()) for (SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors aSelIter (myLocal); aSelIter.More(); aSelIter.Next())
{ {
SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (aSelIter.Key()); SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (aSelIter.Key());
Standard_Integer aRank = FindIndex (theSelectors, theSelector); for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (theSelectors); aSelectorIter.More(); aSelectorIter.Next())
if (aRank != 0 && aRank <= theSelectors.Length()) {
theSelectors.Remove (aRank); if (aSelectorIter.Value() == theSelector)
{
theSelectors.Remove (aSelectorIter);
break;
}
}
} }
if (mySelectors.Contains (theSelector))
mySelectors.Remove (theSelector); mySelectors.Remove (theSelector);
} }
@ -92,13 +101,8 @@ Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_Vi
//================================================== //==================================================
Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_SelectableObject)& theObject) const Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_SelectableObject)& theObject) const
{ {
if (myGlobal.Contains (theObject)) return myGlobal.Contains (theObject)
return Standard_True; || myLocal.IsBound (theObject);
if (myLocal.IsBound (theObject))
return Standard_True;
return Standard_False;
} }
//================================================== //==================================================
@ -120,10 +124,9 @@ void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)&
return; return;
myGlobal.Add(theObject); myGlobal.Add(theObject);
for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aSelector = const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key());
if (!aSelector->Contains (theObject) && theObject->HasOwnPresentations()) if (!aSelector->Contains (theObject) && theObject->HasOwnPresentations())
{ {
aSelector->AddSelectableObject (theObject); aSelector->AddSelectableObject (theObject);
@ -141,24 +144,23 @@ void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)&
void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)& theObject, void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_ViewerSelector)& theSelector, const Handle(SelectMgr_ViewerSelector)& theSelector,
const Standard_Integer theMode) const Standard_Integer theMode)
{
if (!mySelectors.Contains (theSelector))
{ {
mySelectors.Add (theSelector); mySelectors.Add (theSelector);
if (theMode != -1)
{
loadMode (theObject, theMode, theSelector);
} }
if (theMode != -1)
loadMode (theObject, theMode, theSelector);
if (theObject->HasOwnPresentations()) if (theObject->HasOwnPresentations())
{
theSelector->AddSelectableObject (theObject); theSelector->AddSelectableObject (theObject);
}
if (myLocal.IsBound (theObject)) if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{ {
SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject); if (!containsSelector (*aSelectors, theSelector))
if (FindIndex (aSelectors, theSelector) == 0)
{ {
aSelectors.Append (theSelector); aSelectors->Append (theSelector);
} }
} }
else else
@ -172,14 +174,13 @@ void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)&
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
return; return;
SelectMgr_SequenceOfSelector aSelectors; SelectMgr_SequenceOfSelector aGlobSelectors;
aSelectors.Append (theSelector); aGlobSelectors.Append (theSelector);
myLocal.Bind (theObject, aSelectors); myLocal.Bind (theObject, aGlobSelectors);
} }
} }
} }
//================================================== //==================================================
// Function: Remove // Function: Remove
// Purpose : // Purpose :
@ -196,37 +197,36 @@ void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject
if (myGlobal.Contains (theObject)) if (myGlobal.Contains (theObject))
{ {
for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aCurSelector = const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorsIter.Key();
Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key());
if (!aCurSelector->Contains (theObject)) if (!aCurSelector->Contains (theObject))
continue;
for (theObject->Init(); theObject->More(); theObject->Next())
{ {
aCurSelector->RemoveSelectionOfObject (theObject, theObject->CurrentSelection()); continue;
theObject->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Remove); }
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
aCurSelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
} }
aCurSelector->RemoveSelectableObject (theObject); aCurSelector->RemoveSelectableObject (theObject);
} }
myGlobal.Remove (theObject); myGlobal.Remove (theObject);
} }
else if (myLocal.IsBound (theObject)) else if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{ {
SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject); for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
for (Standard_Integer aSelectorsIdx = 1; aSelectorsIdx <= aSelectors.Length(); aSelectorsIdx++)
{ {
Handle(SelectMgr_ViewerSelector) aCurSelector = aSelectors (aSelectorsIdx); const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorIter.Value();
if (!aCurSelector->Contains (theObject)) if (!aCurSelector->Contains (theObject))
continue; continue;
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{ {
aCurSelector->RemoveSelectionOfObject (theObject, theObject->CurrentSelection()); aCurSelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
theObject->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Remove); aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
} }
aCurSelector->RemoveSelectableObject (theObject); aCurSelector->RemoveSelectableObject (theObject);
} }
@ -251,31 +251,28 @@ void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject
{ {
Remove (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theSelector); Remove (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theSelector);
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
return; return;
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{ {
theSelector->RemoveSelectionOfObject (theObject, theObject->CurrentSelection()); theSelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
theObject->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Remove); aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
} }
theSelector->RemoveSelectableObject (theObject); theSelector->RemoveSelectableObject (theObject);
if (myLocal.IsBound (theObject)) if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{ {
SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject); for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= aSelectors.Length(); aSelectorIdx++)
{ {
if (aSelectors (aSelectorIdx) == theSelector) if (aSelectorIter.Value() == theSelector)
{ {
aSelectors.Remove (aSelectorIdx); aSelectors->Remove (aSelectorIter);
break; break;
} }
} }
if (aSelectors.IsEmpty()) if (aSelectors->IsEmpty())
{ {
myLocal.UnBind (theObject); myLocal.UnBind (theObject);
} }
@ -300,54 +297,60 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
{ {
Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode, theSelector); Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode, theSelector);
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
return; return;
Standard_Boolean isComputed = Standard_False; Standard_Boolean isComputed = Standard_False;
if (theObject->HasSelection (theMode)) if (const Handle(SelectMgr_Selection)& aSelOld = theObject->Selection (theMode))
{ {
isComputed = theObject->Selection (theMode)->IsEmpty() ? 0 : 1; isComputed = !aSelOld->IsEmpty();
} }
if (!isComputed) if (!isComputed)
{
loadMode (theObject, theMode); loadMode (theObject, theMode);
}
if (theSelector.IsNull()) if (theSelector.IsNull())
{ {
if (myGlobal.Contains (theObject)) if (myGlobal.Contains (theObject))
{ {
for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aCurSelector = const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorsIter.Key();
Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key());
Activate (theObject, theMode, aCurSelector); Activate (theObject, theMode, aCurSelector);
} }
} }
else if (myLocal.IsBound (theObject)) else if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{ {
SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (theObject); for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= theSelectors.Length(); aSelectorIdx++)
{ {
Handle(SelectMgr_ViewerSelector) aCurSelector = theSelectors (aSelectorIdx); Handle(SelectMgr_ViewerSelector) aCurSelector = aSelectorIter.Value();
Activate (theObject, theMode, aCurSelector); Activate (theObject, theMode, aCurSelector);
} }
} }
} }
const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode); const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
switch (aSelection->UpdateStatus()) switch (aSelection->UpdateStatus())
{ {
case SelectMgr_TOU_Full: case SelectMgr_TOU_Full:
{
if (theObject->HasSelection (theMode)) if (theObject->HasSelection (theMode))
{
theSelector->RemoveSelectionOfObject (theObject, aSelection); theSelector->RemoveSelectionOfObject (theObject, aSelection);
}
theObject->RecomputePrimitives (theMode); theObject->RecomputePrimitives (theMode);
// pass through SelectMgr_TOU_Partial
}
case SelectMgr_TOU_Partial: case SelectMgr_TOU_Partial:
{
if(theObject->HasTransformation()) if(theObject->HasTransformation())
{
theObject->UpdateTransformations (aSelection); theObject->UpdateTransformations (aSelection);
}
theSelector->RebuildObjectsTree(); theSelector->RebuildObjectsTree();
break; break;
}
default: default:
break; break;
} }
@ -357,12 +360,18 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
{ {
case SelectMgr_TBU_Add: case SelectMgr_TBU_Add:
case SelectMgr_TBU_Renew: case SelectMgr_TBU_Renew:
{
theSelector->AddSelectionToObject (theObject, aSelection); theSelector->AddSelectionToObject (theObject, aSelection);
break; break;
}
case SelectMgr_TBU_Remove: case SelectMgr_TBU_Remove:
{
if (aSelection->GetSelectionState() == SelectMgr_SOS_Deactivated) if (aSelection->GetSelectionState() == SelectMgr_SOS_Deactivated)
{
theSelector->AddSelectionToObject (theObject, aSelection); theSelector->AddSelectionToObject (theObject, aSelection);
}
break; break;
}
default: default:
break; break;
} }
@ -371,7 +380,8 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
if (myGlobal.Contains (theObject)) if (myGlobal.Contains (theObject))
{ {
const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode(); const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode();
if (theMode != aGlobalSelMode && theSelector->IsActive (theObject, aGlobalSelMode)) if (theMode != aGlobalSelMode
&& theSelector->IsActive (theObject, aGlobalSelMode))
{ {
theSelector->Deactivate (theObject->Selection (aGlobalSelMode)); theSelector->Deactivate (theObject->Selection (aGlobalSelMode));
} }
@ -379,10 +389,12 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
} }
else else
{ {
if (myLocal.IsBound (theObject)) if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{ {
if (FindIndex (myLocal.Find (theObject), theSelector) == 0) if (!containsSelector (*aSelectors, theSelector))
(myLocal.ChangeFind (theObject)).Append (theSelector); {
aSelectors->Append (theSelector);
}
theSelector->Activate (theObject->Selection (theMode)); theSelector->Activate (theObject->Selection (theMode));
} }
} }
@ -400,48 +412,47 @@ void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableOb
{ {
Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector);
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
{
return; return;
}
Standard_Boolean isInGlobal = myGlobal.Contains (theObject); if (!myGlobal.Contains(theObject)
Standard_Boolean hasSelection = theMode == -1 ? Standard_True : theObject->HasSelection (theMode); && !myLocal.IsBound (theObject))
if (theSelector.IsNull())
{ {
Handle(SelectMgr_ViewerSelector) aSelector; return;
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) }
{
aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode);
if (isInGlobal || myLocal.IsBound (theObject)) if (!theSelector.IsNull())
{ {
if (theMode == -1) if (theMode == -1)
{ {
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{ {
aSelector->Deactivate (theObject->CurrentSelection()); theSelector->Deactivate (aSelIter.Value());
} }
} }
else else if (!aSel.IsNull())
{ {
if (hasSelection) theSelector->Deactivate (aSel);
aSelector->Deactivate (theObject->Selection (theMode));
} }
return;
} }
}
} for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
else
{ {
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
if (theMode == -1) if (theMode == -1)
{ {
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{ {
theSelector->Deactivate (theObject->CurrentSelection()); aSelector->Deactivate (aSelIter.Value());
} }
} }
else else if (!aSel.IsNull())
if (hasSelection) {
theSelector->Deactivate (theObject->Selection (theMode)); aSelector->Deactivate (aSel);
}
} }
} }
@ -458,42 +469,47 @@ Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr
if (IsActivated (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector)) if (IsActivated (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector))
return Standard_True; return Standard_True;
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
{
return Standard_False; return Standard_False;
}
if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject))) if (!myGlobal.Contains(theObject)
&& !myLocal.IsBound (theObject))
{
return Standard_False; return Standard_False;
}
if (theMode == -1 && theSelector.IsNull()) if (theMode == -1 && theSelector.IsNull())
{ {
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
if (IsActivated (theObject, aSelIter.Value()->Mode()))
{ {
if (IsActivated (theObject, theObject->CurrentSelection()->Mode()))
return Standard_True; return Standard_True;
} }
}
return Standard_False; return Standard_False;
} }
if (!theObject->HasSelection (theMode))
return Standard_False;
const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode); const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
if (theSelector.IsNull()) if (aSelection.IsNull())
{ {
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) return Standard_False;
{
Handle(SelectMgr_ViewerSelector) aSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()));
if (aSelector->Status (aSelection) == SelectMgr_SOS_Activated)
return Standard_True;
} }
}
else if (!theSelector.IsNull())
{ {
return theSelector->Status (aSelection) == SelectMgr_SOS_Activated; return theSelector->Status (aSelection) == SelectMgr_SOS_Activated;
} }
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
if (aSelector->Status (aSelection) == SelectMgr_SOS_Activated)
{
return Standard_True;
}
}
return Standard_False; return Standard_False;
} }
@ -513,50 +529,44 @@ void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMg
} }
if (!theObj->HasOwnPresentations()) if (!theObj->HasOwnPresentations())
{
return; return;
}
if (!myGlobal.Contains(theObj)
&& !myLocal.IsBound (theObj))
{
return;
}
if (theSelector.IsNull()) if (theSelector.IsNull())
{ {
if (!(myGlobal.Contains (theObj) || myLocal.IsBound(theObj))) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
return;
TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors);
Handle(SelectMgr_ViewerSelector) aSelector;
for( ; aSelectorsIter.More(); aSelectorsIter.Next())
{ {
aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
ClearSelectionStructures (theObj, theMode, aSelector); ClearSelectionStructures (theObj, theMode, aSelector);
} }
}
else
{
if (!(myGlobal.Contains (theObj) || myLocal.IsBound (theObj)))
return; return;
}
if (theMode != -1) if (theMode != -1)
{ {
if (theObj->HasSelection (theMode)) if (const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode))
{
const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode);
if (theObj->HasSelection (theMode))
{ {
theSelector->RemoveSelectionOfObject (theObj, aSelection); theSelector->RemoveSelectionOfObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_Add); aSelection->UpdateBVHStatus (SelectMgr_TBU_Add);
} }
} }
}
else else
{ {
for (theObj->Init(); theObj->More(); theObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = theObj->CurrentSelection(); const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
theSelector->RemoveSelectionOfObject (theObj, aSelection); theSelector->RemoveSelectionOfObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_Add); aSelection->UpdateBVHStatus (SelectMgr_TBU_Add);
} }
} }
theSelector->RebuildObjectsTree(); theSelector->RebuildObjectsTree();
} }
}
//======================================================================= //=======================================================================
//function : RestoreSelectionStructuress //function : RestoreSelectionStructuress
@ -571,52 +581,45 @@ void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(Select
{ {
RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector); RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector);
} }
if (!theObj->HasOwnPresentations()) if (!theObj->HasOwnPresentations())
{
return; return;
}
if (!myGlobal.Contains(theObj)
&& !myLocal.IsBound (theObj))
{
return;
}
if (theSelector.IsNull()) if (theSelector.IsNull())
{ {
if (!(myGlobal.Contains (theObj) || myLocal.IsBound(theObj))) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
return;
TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors);
Handle(SelectMgr_ViewerSelector) aSelector;
for( ; aSelectorsIter.More(); aSelectorsIter.Next())
{ {
aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
RestoreSelectionStructures (theObj, theMode, aSelector); RestoreSelectionStructures (theObj, theMode, aSelector);
} }
}
else
{
if (!(myGlobal.Contains (theObj) || myLocal.IsBound (theObj)))
return; return;
}
if (theMode != -1) if (theMode != -1)
{ {
if (theObj->HasSelection (theMode)) if (const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode))
{
const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode);
if (theObj->HasSelection (theMode))
{ {
theSelector->AddSelectionToObject (theObj, aSelection); theSelector->AddSelectionToObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None); aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
} }
} }
}
else else
{ {
for (theObj->Init(); theObj->More(); theObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = theObj->CurrentSelection(); const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
theSelector->AddSelectionToObject (theObj, aSelection); theSelector->AddSelectionToObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None); aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
} }
} }
theSelector->RebuildObjectsTree(); theSelector->RebuildObjectsTree();
} }
}
//======================================================================= //=======================================================================
//function : rebuildSelectionStructures //function : rebuildSelectionStructures
@ -625,18 +628,16 @@ void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(Select
//======================================================================= //=======================================================================
void SelectMgr_SelectionManager::rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector) void SelectMgr_SelectionManager::rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector)
{ {
if (theSelector.IsNull()) if (!theSelector.IsNull())
{
Handle(SelectMgr_ViewerSelector) aSelector;
for(TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key());
rebuildSelectionStructures (aSelector);
}
}
else
{ {
theSelector->RebuildObjectsTree(); theSelector->RebuildObjectsTree();
return;
}
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
rebuildSelectionStructures (aSelector);
} }
} }
@ -650,9 +651,9 @@ void SelectMgr_SelectionManager::recomputeSelectionMode (const Handle(SelectMgr_
{ {
theSelection->UpdateStatus (SelectMgr_TOU_Full); theSelection->UpdateStatus (SelectMgr_TOU_Full);
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aCurSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key()); const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorIter.Key();
ClearSelectionStructures (theObject, theMode, aCurSelector); ClearSelectionStructures (theObject, theMode, aCurSelector);
theObject->RecomputePrimitives (theMode); theObject->RecomputePrimitives (theMode);
@ -693,31 +694,33 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele
{ {
RecomputeSelection (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theIsForce, theMode); RecomputeSelection (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theIsForce, theMode);
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
{
return; return;
}
if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject))) if (!myGlobal.Contains (theObject)
&& !myLocal.IsBound (theObject))
{
return; return;
}
if (theMode == -1) if (theMode == -1)
{ {
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
Standard_Integer aSelMode = aSelection->Mode(); const Standard_Integer aSelMode = aSelection->Mode();
recomputeSelectionMode (theObject, aSelection, aSelMode); recomputeSelectionMode (theObject, aSelection, aSelMode);
} }
} }
else else
{ {
if (!theObject->HasSelection (theMode)) if (const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode))
return; {
const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
recomputeSelectionMode (theObject, aSelection, theMode); recomputeSelectionMode (theObject, aSelection, theMode);
} }
} }
}
//======================================================================= //=======================================================================
//function : Update //function : Update
@ -733,25 +736,31 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
{ {
Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theIsForce); Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theIsForce);
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
return;
for (theObject->Init(); theObject->More(); theObject->Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); return;
}
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
if (theIsForce) if (theIsForce)
{ {
switch (aSelection->UpdateStatus()) switch (aSelection->UpdateStatus())
{ {
case SelectMgr_TOU_Full: case SelectMgr_TOU_Full:
{
ClearSelectionStructures (theObject, aSelection->Mode()); ClearSelectionStructures (theObject, aSelection->Mode());
theObject->RecomputePrimitives (aSelection->Mode()); // no break on purpose... theObject->RecomputePrimitives (aSelection->Mode()); // no break on purpose...
RestoreSelectionStructures (theObject, aSelection->Mode()); RestoreSelectionStructures (theObject, aSelection->Mode());
// pass through SelectMgr_TOU_Partial
}
case SelectMgr_TOU_Partial: case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection); theObject->UpdateTransformations (aSelection);
rebuildSelectionStructures(); rebuildSelectionStructures();
break; break;
}
default: default:
break; break;
} }
@ -759,9 +768,9 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
aSelection->UpdateBVHStatus (SelectMgr_TBU_None); aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
} }
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aSelector (Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key())); const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
Update (theObject, aSelector, Standard_False); Update (theObject, aSelector, Standard_False);
} }
} }
@ -776,37 +785,49 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
const Standard_Boolean theIsForce) const Standard_Boolean theIsForce)
{ {
if (!mySelectors.Contains (theSelector)) if (!mySelectors.Contains (theSelector))
{
return; return;
}
Standard_Boolean isKnown = myGlobal.Contains (theObject); if (!myGlobal.Contains (theObject))
if (!isKnown) {
isKnown = (myLocal.IsBound (theObject) && (FindIndex (myLocal.Find (theObject), theSelector) != 0)); const SelectMgr_SequenceOfSelector* aSelectors = myLocal.Seek (theObject);
if (!isKnown) if (aSelectors == NULL
|| !containsSelector (*aSelectors, theSelector))
{
return; return;
}
}
for (PrsMgr_ListOfPresentableObjectsIter aChildIter (theObject->Children()); aChildIter.More(); aChildIter.Next()) for (PrsMgr_ListOfPresentableObjectsIter aChildIter (theObject->Children()); aChildIter.More(); aChildIter.Next())
{ {
Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theSelector, theIsForce); Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theSelector, theIsForce);
} }
if (!theObject->HasOwnPresentations()) if (!theObject->HasOwnPresentations())
return;
for (theObject->Init(); theObject->More(); theObject->Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection(); return;
}
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
if (theIsForce) if (theIsForce)
{ {
switch (aSelection->UpdateStatus()) switch (aSelection->UpdateStatus())
{ {
case SelectMgr_TOU_Full: case SelectMgr_TOU_Full:
{
ClearSelectionStructures (theObject, aSelection->Mode()); ClearSelectionStructures (theObject, aSelection->Mode());
theObject->RecomputePrimitives (aSelection->Mode()); theObject->RecomputePrimitives (aSelection->Mode());
RestoreSelectionStructures (theObject, aSelection->Mode()); RestoreSelectionStructures (theObject, aSelection->Mode());
// pass through SelectMgr_TOU_Partial
}
case SelectMgr_TOU_Partial: case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection); theObject->UpdateTransformations (aSelection);
rebuildSelectionStructures(); rebuildSelectionStructures();
break; break;
}
default: default:
break; break;
} }
@ -819,16 +840,21 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
switch (aSelection->UpdateStatus()) switch (aSelection->UpdateStatus())
{ {
case SelectMgr_TOU_Full: case SelectMgr_TOU_Full:
{
ClearSelectionStructures (theObject, aSelection->Mode(), theSelector); ClearSelectionStructures (theObject, aSelection->Mode(), theSelector);
theObject->RecomputePrimitives (aSelection->Mode()); theObject->RecomputePrimitives (aSelection->Mode());
RestoreSelectionStructures (theObject, aSelection->Mode(), theSelector); RestoreSelectionStructures (theObject, aSelection->Mode(), theSelector);
// pass through SelectMgr_TOU_Partial
}
case SelectMgr_TOU_Partial: case SelectMgr_TOU_Partial:
{
if (theObject->HasTransformation()) if (theObject->HasTransformation())
{ {
theObject->UpdateTransformations (aSelection); theObject->UpdateTransformations (aSelection);
theSelector->RebuildObjectsTree(); theSelector->RebuildObjectsTree();
} }
break; break;
}
default: default:
break; break;
} }
@ -848,52 +874,52 @@ void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObje
const Handle(SelectMgr_ViewerSelector)& theSelector) const Handle(SelectMgr_ViewerSelector)& theSelector)
{ {
if (theMode == -1) if (theMode == -1)
{
return; return;
}
if (!theObject->HasSelection (theMode)) if (const Handle(SelectMgr_Selection)& aSelOld = theObject->Selection (theMode))
{
if (aSelOld->IsEmpty())
{
if (aSelOld->BVHUpdateStatus() == SelectMgr_TBU_Remove)
{ {
Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode); Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
theObject->AddSelection (aNewSel, theMode); theObject->AddSelection (aNewSel, theMode);
if (theSelector.IsNull()) aNewSel->UpdateBVHStatus (SelectMgr_TBU_Remove);
aNewSel->SetSelectionState (SelectMgr_SOS_Deactivated);
}
}
return;
}
Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
theObject->AddSelection (aNewSel, theMode);
if (!theSelector.IsNull())
{ {
theSelector->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
return;
}
if (myGlobal.Contains (theObject)) if (myGlobal.Contains (theObject))
{ {
TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
for ( ; aSelectorIter.More(); aSelectorIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aSelector = const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorIter.Key());
aSelector->AddSelectionToObject (theObject, aNewSel); aSelector->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None); aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
} }
} }
else if (myLocal.IsBound (theObject)) else if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{ {
const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject); for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= aSelectors.Length(); ++aSelectorIdx)
{ {
aSelectors (aSelectorIdx)->AddSelectionToObject (theObject, aNewSel); aSelectorIter.Value()->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None); aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
} }
} }
} }
else
{
theSelector->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
else if (theObject->Selection (theMode)->IsEmpty())
{
if (theObject->Selection (theMode)->BVHUpdateStatus() == SelectMgr_TBU_Remove)
{
Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
theObject->AddSelection (aNewSel, theMode);
theObject->Selection (theMode)->UpdateBVHStatus (SelectMgr_TBU_Remove);
theObject->Selection (theMode)->SetSelectionState (SelectMgr_SOS_Deactivated);
}
}
}
//======================================================================= //=======================================================================
//function : SetUpdateMode //function : SetUpdateMode
@ -902,8 +928,10 @@ void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObje
void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject, void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject,
const SelectMgr_TypeOfUpdate theType) const SelectMgr_TypeOfUpdate theType)
{ {
for (theObject->Init(); theObject->More(); theObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
theObject->CurrentSelection()->UpdateStatus (theType); {
aSelIter.Value()->UpdateStatus (theType);
}
} }
//======================================================================= //=======================================================================
@ -914,8 +942,10 @@ void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_Selectabl
const Standard_Integer theMode, const Standard_Integer theMode,
const SelectMgr_TypeOfUpdate theType) const SelectMgr_TypeOfUpdate theType)
{ {
if (theObject->HasSelection (theMode)) if (const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode))
theObject->Selection (theMode)->UpdateStatus (theType); {
aSel->UpdateStatus (theType);
}
} }
//======================================================================= //=======================================================================
@ -928,24 +958,25 @@ void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr
const Standard_Integer theMode, const Standard_Integer theMode,
const Standard_Integer theNewSens) const Standard_Integer theNewSens)
{ {
Standard_ASSERT_RAISE (theNewSens > 0, Standard_ASSERT_RAISE (theNewSens > 0, "Error! Selection sensitivity have positive value.");
"Error! Selection sensitivity have positive value."); if (theObject.IsNull())
{
if (theObject.IsNull() || !theObject->HasSelection (theMode))
return; return;
}
const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode);
if (theObject.IsNull())
{
return;
}
Handle(SelectMgr_Selection) aSel = theObject->Selection (theMode);
const Standard_Integer aPrevSens = aSel->Sensitivity(); const Standard_Integer aPrevSens = aSel->Sensitivity();
aSel->SetSensitivity (theNewSens); aSel->SetSensitivity (theNewSens);
if (!(myGlobal.Contains (theObject) || myLocal.IsBound (theObject)))
return;
if (myGlobal.Contains (theObject)) if (myGlobal.Contains (theObject))
{ {
for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
if (aSelector->Contains (theObject)) if (aSelector->Contains (theObject))
{ {
aSelector->myTolerances.Decrement (aPrevSens); aSelector->myTolerances.Decrement (aPrevSens);
@ -975,9 +1006,9 @@ void SelectMgr_SelectionManager::UpdateSelection (const Handle(SelectMgr_Selecta
{ {
if (myGlobal.Contains (theObject)) if (myGlobal.Contains (theObject))
{ {
for (TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next()) for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{ {
Handle(SelectMgr_ViewerSelector) aSelector = Handle(SelectMgr_ViewerSelector)::DownCast (aSelectorsIter.Key()); const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
if (aSelector->Contains (theObject)) if (aSelector->Contains (theObject))
{ {
aSelector->MoveSelectableObject (theObject); aSelector->MoveSelectableObject (theObject);

View File

@ -17,33 +17,21 @@
#ifndef _SelectMgr_SelectionManager_HeaderFile #ifndef _SelectMgr_SelectionManager_HeaderFile
#define _SelectMgr_SelectionManager_HeaderFile #define _SelectMgr_SelectionManager_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <SelectMgr_DataMapOfObjectSelectors.hxx> #include <SelectMgr_DataMapOfObjectSelectors.hxx>
#include <Standard_Transient.hxx>
#include <SelectMgr_ViewerSelector.hxx> #include <SelectMgr_ViewerSelector.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <SelectMgr_TypeOfUpdate.hxx> #include <SelectMgr_TypeOfUpdate.hxx>
#include <TColStd_MapOfTransient.hxx>
class SelectMgr_SelectableObject; class SelectMgr_SelectableObject;
//! A framework to manage selection from the point of view of viewer selectors.
class SelectMgr_SelectionManager; //! These can be added and removed, and selection modes can be activated and deactivated.
DEFINE_STANDARD_HANDLE(SelectMgr_SelectionManager, Standard_Transient) //! In addition, objects may be known to all selectors or only to some.
//! A framework to manage selection from the point of
//! view of viewer selectors. These can be added and
//! removed, and selection modes can be activated and
//! deactivated. In addition, objects may be known to all
//! selectors or only to some.
class SelectMgr_SelectionManager : public Standard_Transient class SelectMgr_SelectionManager : public Standard_Transient
{ {
DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectionManager, Standard_Transient)
public: public:
//! Constructs an empty selection manager object. //! Constructs an empty selection manager object.
Standard_EXPORT SelectMgr_SelectionManager(); Standard_EXPORT SelectMgr_SelectionManager();
@ -65,7 +53,7 @@ public:
Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1); Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1);
//! Loads and computes selection mode theMode (if it is not equal to -1) and adds selectable object to BVH tree. //! Loads and computes selection mode theMode (if it is not equal to -1) and adds selectable object to BVH tree.
//! Does not perform check of existance of theObject in global context before addition, but adds theSelector to local context. //! Does not perform check of existence of theObject in global context before addition, but adds theSelector to local context.
Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Handle(SelectMgr_ViewerSelector)& theSelector, const Standard_Integer theMode = -1); Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Handle(SelectMgr_ViewerSelector)& theSelector, const Standard_Integer theMode = -1);
//! Removes selectable object theObject from all viewer selectors it was added to previously, removes it from all contexts //! Removes selectable object theObject from all viewer selectors it was added to previously, removes it from all contexts
@ -78,26 +66,36 @@ public:
//! Activates the selection mode theMode in the selector theSelector for the selectable object anObject. //! Activates the selection mode theMode in the selector theSelector for the selectable object anObject.
//! By default, theMode is equal to 0. If theSelector is set to default (NULL), the selection with the mode theMode //! By default, theMode is equal to 0. If theSelector is set to default (NULL), the selection with the mode theMode
//! will be activated in all the viewers available. //! will be activated in all the viewers available.
Standard_EXPORT void Activate (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = 0, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL); Standard_EXPORT void Activate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode = 0,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
//! Deactivates mode theMode of theObject in theSelector. If theMode value is set to default (-1), all //! Deactivates mode theMode of theObject in theSelector. If theMode value is set to default (-1), all
//! avtive selection modes will be deactivated. Likewise, if theSelector value is set to default (NULL), theMode //! active selection modes will be deactivated. Likewise, if theSelector value is set to default (NULL), theMode
//! will be deactivated in all viewer selectors. //! will be deactivated in all viewer selectors.
Standard_EXPORT void Deactivate (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL); Standard_EXPORT void Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
//! Returns true if the selection with theMode is active for the selectable object theObject and selector theSelector. //! Returns true if the selection with theMode is active for the selectable object theObject and selector theSelector.
//! If all parameters are set to default values, it returns it there is any active selection in any known viewer selector for //! If all parameters are set to default values, it returns it there is any active selection in any known viewer selector for
//! object theObject. //! object theObject.
Standard_EXPORT Standard_Boolean IsActivated (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL) const; Standard_EXPORT Standard_Boolean IsActivated (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)()) const;
//! Removes sensitive entities from all viewer selectors //! Removes sensitive entities from all viewer selectors
//! after method Clear() was called to the selection they belonged to //! after method Clear() was called to the selection they belonged to
//! or it was recomputed somehow. //! or it was recomputed somehow.
Standard_EXPORT void ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL); Standard_EXPORT void ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
//! Re-adds newely calculated sensitive entities of recomputed selection //! Re-adds newly calculated sensitive entities of recomputed selection
//! defined by mode theMode to all viewer selectors contained that selection. //! defined by mode theMode to all viewer selectors contained that selection.
Standard_EXPORT void RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL); Standard_EXPORT void RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
//! Recomputes activated selections of theObject for all known viewer selectors according to theMode specified. //! Recomputes activated selections of theObject for all known viewer selectors according to theMode specified.
//! If theMode is set to default (-1), then all activated selections will be recomputed. If theIsForce is set to true, //! If theMode is set to default (-1), then all activated selections will be recomputed. If theIsForce is set to true,
@ -128,8 +126,6 @@ public:
//! Re-adds selectable object in BVHs in all viewer selectors. //! Re-adds selectable object in BVHs in all viewer selectors.
Standard_EXPORT void UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObj); Standard_EXPORT void UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObj);
DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectionManager,Standard_Transient)
protected: protected:
//! Recomputes given selection mode and updates BVHs in all viewer selectors //! Recomputes given selection mode and updates BVHs in all viewer selectors
@ -137,30 +133,27 @@ protected:
const Handle(SelectMgr_Selection)& theSelection, const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode); const Standard_Integer theMode);
private: private:
//! Loads and creates selection structures for object theObject with mode theMode in specified //! Loads and creates selection structures for object theObject with mode theMode in specified
//! viewer selector theSelector. If theSelector is set to default value (NULL), the selection mode //! viewer selector theSelector. If theSelector is set to default value (NULL), the selection mode
//! created will be added to all known viewer selectors. //! created will be added to all known viewer selectors.
Standard_EXPORT void loadMode (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL); Standard_EXPORT void loadMode (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
//! Internal function that marks 1st level BVH of the object theObj as //! Internal function that marks 1st level BVH of the object theObj as
//! outdated. //! outdated.
Standard_EXPORT void rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector = NULL); Standard_EXPORT void rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
TColStd_MapOfTransient mySelectors; private:
TColStd_MapOfTransient myGlobal;
NCollection_Map<Handle(SelectMgr_ViewerSelector)> mySelectors;
NCollection_Map<Handle(SelectMgr_SelectableObject)> myGlobal;
SelectMgr_DataMapOfObjectSelectors myLocal; SelectMgr_DataMapOfObjectSelectors myLocal;
}; };
DEFINE_STANDARD_HANDLE(SelectMgr_SelectionManager, Standard_Transient)
#endif // _SelectMgr_SelectionManager_HeaderFile #endif // _SelectMgr_SelectionManager_HeaderFile

View File

@ -52,14 +52,14 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_SensitiveEntit
//======================================================================= //=======================================================================
void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_Selection)& theSelection) void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
if (!theSelection->Sensitive()->BaseSensitive()->IsKind (STANDARD_TYPE(Select3D_SensitiveEntity))) if (!aSelEntIter.Value()->BaseSensitive()->IsKind (STANDARD_TYPE(Select3D_SensitiveEntity)))
{ {
theSelection->Sensitive()->ResetSelectionActiveStatus(); aSelEntIter.Value()->ResetSelectionActiveStatus();
continue; continue;
} }
mySensitives.Add (theSelection->Sensitive()); mySensitives.Add (aSelEntIter.Value());
} }
MarkDirty(); MarkDirty();
} }
@ -71,11 +71,13 @@ void SelectMgr_SensitiveEntitySet::Append (const Handle(SelectMgr_Selection)& th
//======================================================================= //=======================================================================
void SelectMgr_SensitiveEntitySet::Remove (const Handle(SelectMgr_Selection)& theSelection) void SelectMgr_SensitiveEntitySet::Remove (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{
const Standard_Integer anEntIdx = mySensitives.FindIndex (aSelEntIter.Value());
if (anEntIdx == 0)
{ {
Standard_Integer anEntIdx = mySensitives.FindIndex (theSelection->Sensitive());
if (!anEntIdx)
continue; continue;
}
if (anEntIdx != mySensitives.Size()) if (anEntIdx != mySensitives.Size())
{ {

View File

@ -104,9 +104,9 @@ myEntityIdx (0)
//================================================== //==================================================
void SelectMgr_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theSelection) void SelectMgr_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
theSelection->Sensitive()->SetActiveForSelection(); aSelEntIter.Value()->SetActiveForSelection();
} }
theSelection->SetSelectionState (SelectMgr_SOS_Activated); theSelection->SetSelectionState (SelectMgr_SOS_Activated);
@ -121,9 +121,9 @@ void SelectMgr_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theS
//================================================== //==================================================
void SelectMgr_ViewerSelector::Deactivate (const Handle(SelectMgr_Selection)& theSelection) void SelectMgr_ViewerSelector::Deactivate (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
theSelection->Sensitive()->ResetSelectionActiveStatus(); aSelEntIter.Value()->ResetSelectionActiveStatus();
} }
theSelection->SetSelectionState (SelectMgr_SOS_Deactivated); theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);
@ -670,15 +670,15 @@ Standard_Boolean SelectMgr_ViewerSelector::Modes (const Handle(SelectMgr_Selecta
const SelectMgr_StateOfSelection theWantedState) const const SelectMgr_StateOfSelection theWantedState) const
{ {
Standard_Boolean hasActivatedStates = Contains (theSelectableObject); Standard_Boolean hasActivatedStates = Contains (theSelectableObject);
for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theSelectableObject->Selections()); aSelIter.More(); aSelIter.Next())
{ {
if (theWantedState == SelectMgr_SOS_Any) if (theWantedState == SelectMgr_SOS_Any)
{ {
theModeList.Append (theSelectableObject->CurrentSelection()->Mode()); theModeList.Append (aSelIter.Value()->Mode());
} }
else if (theWantedState == theSelectableObject->CurrentSelection()->GetSelectionState()) else if (theWantedState == aSelIter.Value()->GetSelectionState())
{ {
theModeList.Append (theSelectableObject->CurrentSelection()->Mode()); theModeList.Append (aSelIter.Value()->Mode());
} }
} }
@ -695,15 +695,9 @@ Standard_Boolean SelectMgr_ViewerSelector::IsActive (const Handle(SelectMgr_Sele
if (!Contains (theSelectableObject)) if (!Contains (theSelectableObject))
return Standard_False; return Standard_False;
for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next()) const Handle(SelectMgr_Selection)& aSel = theSelectableObject->Selection (theMode);
{ return !aSel.IsNull()
if (theMode == theSelectableObject->CurrentSelection()->Mode()) && aSel->GetSelectionState() == SelectMgr_SOS_Activated;
{
return theSelectableObject->CurrentSelection()->GetSelectionState() == SelectMgr_SOS_Activated;
}
}
return Standard_False;
} }
//================================================== //==================================================
@ -716,15 +710,9 @@ Standard_Boolean SelectMgr_ViewerSelector::IsInside (const Handle(SelectMgr_Sele
if (!Contains (theSelectableObject)) if (!Contains (theSelectableObject))
return Standard_False; return Standard_False;
for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next()) const Handle(SelectMgr_Selection)& aSel = theSelectableObject->Selection (theMode);
{ return !aSel.IsNull()
if (theMode == theSelectableObject->CurrentSelection()->Mode()) && aSel->GetSelectionState() != SelectMgr_SOS_Unknown;
{
return theSelectableObject->CurrentSelection()->GetSelectionState() != SelectMgr_SOS_Unknown;
}
}
return Standard_False;
} }
@ -746,22 +734,12 @@ SelectMgr_StateOfSelection SelectMgr_ViewerSelector::Status (const Handle(Select
TCollection_AsciiString SelectMgr_ViewerSelector::Status (const Handle(SelectMgr_SelectableObject)& theSelectableObject) const TCollection_AsciiString SelectMgr_ViewerSelector::Status (const Handle(SelectMgr_SelectableObject)& theSelectableObject) const
{ {
TCollection_AsciiString aStatus ("Status Object :\n\t"); TCollection_AsciiString aStatus ("Status Object :\n\t");
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theSelectableObject->Selections()); aSelIter.More(); aSelIter.Next())
for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next())
{ {
if (theSelectableObject->CurrentSelection()->GetSelectionState() != SelectMgr_SOS_Unknown) if (aSelIter.Value()->GetSelectionState() != SelectMgr_SOS_Unknown)
{ {
aStatus = aStatus + "Mode " + aStatus = aStatus + "Mode " + TCollection_AsciiString (aSelIter.Value()->Mode()) + " present - "
TCollection_AsciiString (theSelectableObject->CurrentSelection()->Mode()) + + (aSelIter.Value()->GetSelectionState() == SelectMgr_SOS_Activated ? " Active \n\t" : " Inactive \n\t");
" present - ";
if (theSelectableObject->CurrentSelection()->GetSelectionState() == SelectMgr_SOS_Activated)
{
aStatus = aStatus + " Active \n\t";
}
else
{
aStatus = aStatus + " Inactive \n\t";
}
} }
} }

View File

@ -73,9 +73,9 @@
//================================================== //==================================================
void StdSelect_BRepSelectionTool::PreBuildBVH (const Handle(SelectMgr_Selection)& theSelection) void StdSelect_BRepSelectionTool::PreBuildBVH (const Handle(SelectMgr_Selection)& theSelection)
{ {
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
const Handle(SelectBasics_SensitiveEntity)& aSensitive = theSelection->Sensitive()->BaseSensitive(); const Handle(SelectBasics_SensitiveEntity)& aSensitive = aSelEntIter.Value()->BaseSensitive();
if (aSensitive->NbSubElements() >= BVH_PRIMITIVE_LIMIT) if (aSensitive->NbSubElements() >= BVH_PRIMITIVE_LIMIT)
{ {
aSensitive->BVH(); aSensitive->BVH();
@ -188,10 +188,9 @@ void StdSelect_BRepSelectionTool::Load (const Handle(SelectMgr_Selection)& theSe
theMaxParam); theMaxParam);
// loading of selectables... // loading of selectables...
for (theSelection->Init(); theSelection->More(); theSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
Handle(SelectMgr_EntityOwner) anOwner Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
= Handle(SelectMgr_EntityOwner)::DownCast (theSelection->Sensitive()->BaseSensitive()->OwnerId());
anOwner->Set (theSelectableObj); anOwner->Set (theSelectableObj);
} }

View File

@ -187,28 +187,24 @@ void StdSelect_ViewerSelector3d::Pick (const TColgp_Array1OfPnt2d& thePolyline,
//======================================================================= //=======================================================================
void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theView) void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theView)
{ {
SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
for (; aSelectableIt.More(); aSelectableIt.Next())
{ {
const Handle (SelectMgr_SelectableObject)& anObj = aSelectableIt.Value();
Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (theView->Viewer()->StructureManager()); Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (theView->Viewer()->StructureManager());
const Handle (SelectMgr_SelectableObject)& anObj = aSelectableIt.Value();
for (anObj->Init(); anObj->More(); anObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
if (anObj->CurrentSelection()->GetSelectionState() == SelectMgr_SOS_Activated) if (aSelIter.Value()->GetSelectionState() == SelectMgr_SOS_Activated)
{ {
computeSensitivePrs (aStruct, anObj->CurrentSelection(), anObj->Transformation(), Handle(Graphic3d_TransformPers)()); computeSensitivePrs (aStruct, aSelIter.Value(), anObj->Transformation(), Handle(Graphic3d_TransformPers)());
} }
} }
myStructs.Append (aStruct); myStructs.Append (aStruct);
} }
for (Standard_Integer aStructIdx = 1; aStructIdx <= myStructs.Length(); ++aStructIdx) for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructs); aStructIter.More(); aStructIter.Next())
{ {
Handle(Graphic3d_Structure)& aStruct = myStructs.ChangeValue (aStructIdx); Handle(Graphic3d_Structure)& aStruct = aStructIter.ChangeValue();
aStruct->SetDisplayPriority (10); aStruct->SetDisplayPriority (10);
aStruct->Display(); aStruct->Display();
} }
@ -222,11 +218,10 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theVi
//======================================================================= //=======================================================================
void StdSelect_ViewerSelector3d::ClearSensitive (const Handle(V3d_View)& theView) void StdSelect_ViewerSelector3d::ClearSensitive (const Handle(V3d_View)& theView)
{ {
for (Standard_Integer aStructIdx = 1; aStructIdx <= myStructs.Length(); ++aStructIdx) for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructs); aStructIter.More(); aStructIter.Next())
{ {
myStructs.Value (aStructIdx)->Remove(); aStructIter.ChangeValue()->Remove();
} }
myStructs.Clear(); myStructs.Clear();
if (!theView.IsNull()) if (!theView.IsNull())
@ -274,25 +269,20 @@ void StdSelect_ViewerSelector3d::computeSensitivePrs (const Handle(Graphic3d_Str
Handle(Graphic3d_Group) aSensGroup = theStructure->NewGroup(); Handle(Graphic3d_Group) aSensGroup = theStructure->NewGroup();
Quantity_Color aColor (Quantity_NOC_INDIANRED3); Quantity_Color aColor (Quantity_NOC_INDIANRED3);
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = Handle(Graphic3d_AspectMarker3d) aMarkerAspect =new Graphic3d_AspectMarker3d (Aspect_TOM_O_PLUS, aColor, 2.0);
new Graphic3d_AspectMarker3d (Aspect_TOM_O_PLUS, aColor, 2.0);
aSensGroup->SetPrimitivesAspect (aMarkerAspect); aSensGroup->SetPrimitivesAspect (aMarkerAspect);
aSensGroup->SetPrimitivesAspect ( aSensGroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
Handle(Graphic3d_Group) anAreaGroup = theStructure->NewGroup(); Handle(Graphic3d_Group) anAreaGroup = theStructure->NewGroup();
anAreaGroup->SetPrimitivesAspect ( anAreaGroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
TColgp_SequenceOfPnt aSeqLines, aSeqFree; TColgp_SequenceOfPnt aSeqLines, aSeqFree;
TColStd_SequenceOfInteger aSeqBnds; TColStd_SequenceOfInteger aSeqBnds;
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
for (theSel->Init(); theSel->More(); theSel->Next())
{ {
Handle(Select3D_SensitiveEntity) Ent = Handle(Select3D_SensitiveEntity) Ent = Handle(Select3D_SensitiveEntity)::DownCast(aSelEntIter.Value()->BaseSensitive());
Handle(Select3D_SensitiveEntity)::DownCast(theSel->Sensitive()->BaseSensitive());
const Standard_Boolean hasloc = theLoc.Form() != gp_Identity; const Standard_Boolean hasloc = theLoc.Form() != gp_Identity;
//============== //==============
@ -741,12 +731,12 @@ namespace
for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next()) for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next())
{ {
const Handle(SelectMgr_SelectableObject)& anObj = anObjIter.Value(); const Handle(SelectMgr_SelectableObject)& anObj = anObjIter.Value();
for (anObj->Init(); anObj->More(); anObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection(); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
for (aSel->Init(); aSel->More(); aSel->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
const Handle(SelectMgr_SensitiveEntity)& aSens = aSel->Sensitive(); const Handle(SelectMgr_SensitiveEntity)& aSens = aSelEntIter.Value();
if (!myMapEntityColors.IsBound (aSens->BaseSensitive())) if (!myMapEntityColors.IsBound (aSens->BaseSensitive()))
{ {
Quantity_Color aColor; Quantity_Color aColor;
@ -902,12 +892,12 @@ namespace
for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next()) for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next())
{ {
const Handle(SelectMgr_SelectableObject)& anObj = anObjIter.Value(); const Handle(SelectMgr_SelectableObject)& anObj = anObjIter.Value();
for (anObj->Init(); anObj->More(); anObj->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection(); const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
for (aSel->Init(); aSel->More(); aSel->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
const Handle(SelectMgr_SensitiveEntity)& aSens = aSel->Sensitive(); const Handle(SelectMgr_SensitiveEntity)& aSens = aSelEntIter.Value();
const Handle(SelectBasics_EntityOwner)& anOwner = aSens->BaseSensitive()->OwnerId(); const Handle(SelectBasics_EntityOwner)& anOwner = aSens->BaseSensitive()->OwnerId();
if (!myMapOwnerColors.IsBound (anOwner)) if (!myMapOwnerColors.IsBound (anOwner))
{ {
@ -980,12 +970,12 @@ namespace
Standard_Integer aSelectionMode = -1; Standard_Integer aSelectionMode = -1;
const Handle(SelectMgr_SelectableObject)& aSelectable = myMainSel->Picked (thePicked)->Selectable(); const Handle(SelectMgr_SelectableObject)& aSelectable = myMainSel->Picked (thePicked)->Selectable();
const Handle(SelectBasics_SensitiveEntity)& anEntity = myMainSel->PickedEntity (thePicked); const Handle(SelectBasics_SensitiveEntity)& anEntity = myMainSel->PickedEntity (thePicked);
for (aSelectable->Init(); aSelectable->More(); aSelectable->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (aSelectable->Selections()); aSelIter.More(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = aSelectable->CurrentSelection(); const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
for (aSelection->Init(); aSelection->More(); aSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
if (aSelection->Sensitive()->BaseSensitive() == anEntity) if (aSelEntIter.Value()->BaseSensitive() == anEntity)
{ {
aSelectionMode = aSelection->Mode(); aSelectionMode = aSelection->Mode();
break; break;

View File

@ -1,17 +1,12 @@
puts "============" puts "============"
puts "OCC24966" puts "0024966: Visualization - Problem in local selection mode with selected objects staying in the viewer after erase"
puts "Selected entity owners coming from decomposition are not erased in local selection context"
puts "============" puts "============"
puts "" puts ""
####################################################################################
# Visualization - Problem in local selection mode with selected objects staying
# in the viewer after erase
# Selected entity owners coming from decomposition are not erased in local selection
# context
####################################################################################
pload MODELING VISUALIZATION
vclear
vinit View1 vinit View1
pload ALL
vinit
vertex p1 100 100 0 vertex p1 100 100 0
vertex p2 150 300 0 vertex p2 150 300 0
@ -23,8 +18,6 @@ vselmode e1 1 1 -local
vselect 0 0 2500 2500 vselect 0 0 2500 2500
verase -local verase -local
if { "[vreadpixel 261 204 rgb name]" != "BLACK" } { if { "[vreadpixel 261 204 rgb name]" != "BLACK" } { puts "Error : Selection is not erased." }
puts "Error : Selection is not erased."
}
vdump ${imagedir}/${casename}.png vdump ${imagedir}/${casename}.png

View File

@ -1,23 +1,18 @@
puts "============" puts "============"
puts "CR24996" puts "0024996: Visualization - newly displayed objects are clipped until first camera movement"
puts "============" puts "============"
puts "" puts ""
#######################################################################
# Visualization - newly displayed objects are clipped until first camera movement
#######################################################################
box b1 0 0 0 1 2 3 box b1 0 0 0 1 2 3
box b2 3 2 1 1 2 3 box b2 3 2 1 1 2 3
box b3 5 -4 0 1 2 3 box b3 5 -4 0 1 2 3
vinit
vclear vclear
vinit View1
vaxo vaxo
vsetdispmode 0 vdisplay -dispMode 0 b1
vdisplay b1
vfit vfit
vzoom 0.25 vzoom 0.25
vdisplay b2 b3 vdisplay -dispMode 0 b2 b3
set anImage ${imagedir}/${casename}.png vdump ${imagedir}/${casename}.png
vdump ${anImage}

View File

@ -146,12 +146,12 @@ void VInspector_ItemEntityOwner::Init()
int aRowId = Row(); int aRowId = Row();
int aCurrentIndex = 0; int aCurrentIndex = 0;
for (anIO->Init(); anIO->More() && anOwner.IsNull(); anIO->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anIO->Selections()); aSelIter.More() && anOwner.IsNull(); aSelIter.Next())
{ {
const Handle(SelectMgr_Selection)& aSelection = anIO->CurrentSelection(); const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
for (aSelection->Init(); aSelection->More() && anOwner.IsNull(); aSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More() && anOwner.IsNull(); aSelEntIter.Next())
{ {
Handle(SelectMgr_SensitiveEntity) anEntity = aSelection->Sensitive(); Handle(SelectMgr_SensitiveEntity) anEntity = aSelEntIter.Value();
const Handle(SelectBasics_SensitiveEntity)& aBase = anEntity->BaseSensitive(); const Handle(SelectBasics_SensitiveEntity)& aBase = anEntity->BaseSensitive();
if (!aBase.IsNull()) if (!aBase.IsNull())
{ {

View File

@ -152,15 +152,10 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
// ======================================================================= // =======================================================================
int VInspector_ItemPresentableObject::initRowCount() const int VInspector_ItemPresentableObject::initRowCount() const
{ {
int aRows = 0;
Handle(AIS_InteractiveObject) anIO = GetInteractiveObject(); Handle(AIS_InteractiveObject) anIO = GetInteractiveObject();
if (anIO.IsNull()) return !anIO.IsNull()
return aRows; ? anIO->Selections().Size()
// iteration through sensitive privitives : 0;
for (anIO->Init(); anIO->More(); anIO->Next())
aRows++;
return aRows;
} }
// ======================================================================= // =======================================================================

View File

@ -44,12 +44,8 @@ Handle(SelectMgr_Selection) VInspector_ItemSelection::getSelection() const
// ======================================================================= // =======================================================================
int VInspector_ItemSelection::initRowCount() const int VInspector_ItemSelection::initRowCount() const
{ {
int aRows = 0;
Handle(SelectMgr_Selection) aSelection = getSelection(); Handle(SelectMgr_Selection) aSelection = getSelection();
for (aSelection->Init(); aSelection->More(); aSelection->Next()) return aSelection->Entities().Size();
aRows++;
return aRows;
} }
// ======================================================================= // =======================================================================
@ -88,9 +84,9 @@ QVariant VInspector_ItemSelection::initValue (int theItemRole) const
if (aState == SelectMgr_SOS_Activated || aState == SelectMgr_SOS_Any) if (aState == SelectMgr_SOS_Activated || aState == SelectMgr_SOS_Any)
{ {
Handle(AIS_InteractiveContext) aContext = GetContext(); Handle(AIS_InteractiveContext) aContext = GetContext();
for (mySelection->Init(); mySelection->More(); mySelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (mySelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
const Handle(SelectBasics_EntityOwner)& anOwner = mySelection->Sensitive()->BaseSensitive()->OwnerId(); const Handle(SelectBasics_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
if (VInspector_Tools::IsOwnerSelected(aContext, anOwner)) if (VInspector_Tools::IsOwnerSelected(aContext, anOwner))
aNbSelected++; aNbSelected++;
} }
@ -145,11 +141,11 @@ void VInspector_ItemSelection::Init()
int aRowId = Row(); int aRowId = Row();
int aCurrentId = 0; int aCurrentId = 0;
for (anIO->Init(); anIO->More(); anIO->Next(), aCurrentId++) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anIO->Selections()); aSelIter.More(); aSelIter.Next(), aCurrentId++)
{ {
if (aCurrentId != aRowId) if (aCurrentId != aRowId)
continue; continue;
mySelection = anIO->CurrentSelection(); mySelection = aSelIter.Value();
break; break;
} }
TreeModel_ItemBase::Init(); TreeModel_ItemBase::Init();

View File

@ -155,11 +155,11 @@ void VInspector_ItemSensitiveEntity::Init()
int aRowId = Row(); int aRowId = Row();
int aCurrentId = 0; int aCurrentId = 0;
for (aSelection->Init(); aSelection->More(); aSelection->Next(), aCurrentId++) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next(), aCurrentId++)
{ {
if (aCurrentId != aRowId) if (aCurrentId != aRowId)
continue; continue;
myEntity = aSelection->Sensitive(); myEntity = aSelEntIter.Value();
break; break;
} }
TreeModel_ItemBase::Init(); TreeModel_ItemBase::Init();

View File

@ -144,14 +144,14 @@ NCollection_List<Handle(SelectBasics_EntityOwner)> VInspector_Tools::ContextOwne
Handle(AIS_InteractiveObject) anIO = aIt.Value(); Handle(AIS_InteractiveObject) anIO = aIt.Value();
if (anIO.IsNull()) if (anIO.IsNull())
continue; continue;
for (anIO->Init(); anIO->More(); anIO->Next()) for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anIO->Selections()); aSelIter.More(); aSelIter.Next())
{ {
Handle(SelectMgr_Selection) aSelection = anIO->CurrentSelection(); Handle(SelectMgr_Selection) aSelection = aSelIter.Value();
if (aSelection.IsNull()) if (aSelection.IsNull())
continue; continue;
for (aSelection->Init(); aSelection->More(); aSelection->Next()) for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
{ {
Handle(SelectMgr_SensitiveEntity) anEntity = aSelection->Sensitive(); Handle(SelectMgr_SensitiveEntity) anEntity = aSelEntIter.Value();
if (anEntity.IsNull()) if (anEntity.IsNull())
continue; continue;
const Handle(SelectBasics_SensitiveEntity)& aBase = anEntity->BaseSensitive(); const Handle(SelectBasics_SensitiveEntity)& aBase = anEntity->BaseSensitive();