mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +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:
@@ -495,9 +495,9 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
|
||||
aTypOfSel, aPriority, aDeflection, aDeviationAngle);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -233,9 +233,9 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
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())
|
||||
{
|
||||
// Get the copy of SE3D
|
||||
@@ -260,38 +260,28 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
|
||||
Shapes2EntitiesMap;
|
||||
|
||||
if (!myReference->HasSelection (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)
|
||||
{
|
||||
myReference->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
Handle(StdSelect_BRepOwner) anOwner;
|
||||
TopLoc_Location aDummyLoc;
|
||||
|
||||
Handle(Select3D_SensitiveEntity) aSE, aNewSE;
|
||||
// Fill in the map of subshapes and corresponding sensitive entities associated with aMode
|
||||
Shapes2EntitiesMap aShapes2EntitiesMap;
|
||||
|
||||
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())
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aRefSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive()->BaseSensitive());
|
||||
if(!aSE.IsNull())
|
||||
if (Handle(Select3D_SensitiveEntity) aSE = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
|
||||
{
|
||||
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId());
|
||||
if(!anOwner.IsNull())
|
||||
if (Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId()))
|
||||
{
|
||||
aSubShape = anOwner->Shape();
|
||||
const TopoDS_Shape& aSubShape = anOwner->Shape();
|
||||
if(!aShapes2EntitiesMap.IsBound (aSubShape))
|
||||
{
|
||||
aShapes2EntitiesMap.Bind (aSubShape, aSEList);
|
||||
aShapes2EntitiesMap.Bind (aSubShape, SensitiveList());
|
||||
}
|
||||
aShapes2EntitiesMap (aSubShape).Append (aSE);
|
||||
}
|
||||
@@ -301,20 +291,14 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
|
||||
// Fill in selection from aShapes2EntitiesMap
|
||||
for (Shapes2EntitiesMap::Iterator aMapIt (aShapes2EntitiesMap); aMapIt.More(); aMapIt.Next())
|
||||
{
|
||||
aSEList = aMapIt.Value();
|
||||
anOwner = new StdSelect_BRepOwner (aMapIt.Key(),
|
||||
this,
|
||||
aSEList.First()->OwnerId()->Priority(),
|
||||
Standard_True);
|
||||
const SensitiveList& aSEList = aMapIt.Value();
|
||||
Handle(StdSelect_BRepOwner) anOwner = new StdSelect_BRepOwner (aMapIt.Key(), this, aSEList.First()->OwnerId()->Priority(), Standard_True);
|
||||
anOwner->SetLocation (Transformation());
|
||||
|
||||
for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next())
|
||||
{
|
||||
aSE = aListIt.Value();
|
||||
|
||||
aNewSE = aSE->GetConnected();
|
||||
Handle(Select3D_SensitiveEntity) aSE = aListIt.Value();
|
||||
Handle(Select3D_SensitiveEntity) aNewSE = aSE->GetConnected();
|
||||
aNewSE->Set (anOwner);
|
||||
|
||||
theSelection->Add (aNewSE);
|
||||
}
|
||||
}
|
||||
|
@@ -186,11 +186,11 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
|
||||
Handle(AIS_InteractiveContext) aNullContext;
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.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);
|
||||
isFound = Standard_True;
|
||||
}
|
||||
|
||||
if (isFound && theToUpdateViewer)
|
||||
if (theToUpdateViewer && !mySelection->Objects().IsEmpty())
|
||||
{
|
||||
myMainVwr->Update();
|
||||
}
|
||||
@@ -717,17 +715,12 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
mySelection->Init();
|
||||
while (mySelection->More())
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
|
||||
Erase (anObj, Standard_False);
|
||||
isFound = Standard_True;
|
||||
|
||||
mySelection->Init();
|
||||
}
|
||||
|
||||
if (isFound && theToUpdateViewer)
|
||||
@@ -2858,15 +2851,14 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
||||
const Standard_Real theMargin,
|
||||
const Standard_Boolean theToUpdate)
|
||||
{
|
||||
const Handle(AIS_Selection)& aSelection = HasOpenedContext() ?
|
||||
myLocalContexts(myCurLocalIndex)->Selection() : mySelection;
|
||||
|
||||
const Handle(AIS_Selection)& aSelection = HasOpenedContext()
|
||||
? myLocalContexts(myCurLocalIndex)->Selection()
|
||||
: mySelection;
|
||||
Bnd_Box aBndSelected;
|
||||
|
||||
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());
|
||||
if (anObj->IsInfinite())
|
||||
{
|
||||
|
@@ -1015,10 +1015,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
{
|
||||
Display (theObject, Standard_False);
|
||||
}
|
||||
if (!theObject->HasSelection (theObject->GlobalSelectionMode()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
@@ -1039,9 +1036,9 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
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))
|
||||
{
|
||||
continue;
|
||||
@@ -1139,22 +1136,26 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(AIS_InteractiveOb
|
||||
const Standard_Boolean theToUpdateViewer)
|
||||
{
|
||||
if (theObject.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
return myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (theObject, theToUpdateViewer);
|
||||
}
|
||||
|
||||
const Standard_Integer aGlobalSelMode = theObject->GlobalSelectionMode();
|
||||
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode))
|
||||
if (!myObjects.IsBound (theObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
setContextToObject (theObject);
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
||||
return;
|
||||
|
||||
AddOrRemoveSelected (anOwner, theToUpdateViewer);
|
||||
if (!anOwner.IsNull()
|
||||
&& anOwner->HasSelectable())
|
||||
{
|
||||
AddOrRemoveSelected (anOwner, theToUpdateViewer);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AddOrRemoveSelected
|
||||
@@ -1195,8 +1196,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
theOwner->SetSelected (aSelStat == AIS_SS_Added);
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
|
||||
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
|
||||
if (theOwner->IsSelected())
|
||||
@@ -1241,19 +1241,18 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
|
||||
|
||||
const Standard_Integer aGlobalSelMode = theObj->GlobalSelectionMode();
|
||||
const TColStd_ListOfInteger& anActivatedModes = myObjects (theObj)->SelectionModes();
|
||||
Standard_Boolean isGlobalModeActivated = Standard_False;
|
||||
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
|
||||
{
|
||||
if (aModeIter.Value() == aGlobalSelMode)
|
||||
{
|
||||
isGlobalModeActivated = Standard_True;
|
||||
break;
|
||||
if (Handle(SelectMgr_EntityOwner) aGlobOwner = theObj->GlobalSelOwner())
|
||||
{
|
||||
return aGlobOwner->IsSelected();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated || theObj->GlobalSelOwner().IsNull())
|
||||
return Standard_False;
|
||||
|
||||
return theObj->GlobalSelOwner()->IsSelected();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1263,12 +1262,11 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
|
||||
Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const
|
||||
{
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
return myLocalContexts(myCurLocalIndex)->IsSelected (theOwner);
|
||||
|
||||
if (theOwner.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
return theOwner->IsSelected();
|
||||
}
|
||||
return !theOwner.IsNull()
|
||||
&& theOwner->IsSelected();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1392,37 +1390,44 @@ void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& t
|
||||
const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const Standard_Integer theMode) const
|
||||
{
|
||||
if ( theIObj.IsNull() )
|
||||
return;
|
||||
if (theIObj.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TColStd_ListOfInteger aModes;
|
||||
if ( theMode == -1 )
|
||||
ActivatedModes( theIObj, aModes );
|
||||
if (theMode == -1)
|
||||
{
|
||||
ActivatedModes (theIObj, aModes);
|
||||
}
|
||||
else
|
||||
aModes.Append( theMode );
|
||||
{
|
||||
aModes.Append (theMode);
|
||||
}
|
||||
|
||||
if (theOwners.IsNull())
|
||||
theOwners = new SelectMgr_IndexedMapOfOwner();
|
||||
|
||||
TColStd_ListIteratorOfListOfInteger anItr( aModes );
|
||||
for (; anItr.More(); anItr.Next() )
|
||||
{
|
||||
int aMode = anItr.Value();
|
||||
if ( !theIObj->HasSelection( aMode ) )
|
||||
continue;
|
||||
theOwners = new SelectMgr_IndexedMapOfOwner();
|
||||
}
|
||||
|
||||
Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
|
||||
|
||||
for ( aSel->Init(); aSel->More(); aSel->Next() )
|
||||
for (TColStd_ListIteratorOfListOfInteger anItr (aModes); anItr.More(); anItr.Next())
|
||||
{
|
||||
const int aMode = anItr.Value();
|
||||
const Handle(SelectMgr_Selection)& aSel = theIObj->Selection (aMode);
|
||||
if (aSel.IsNull())
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
|
||||
if ( aEntity.IsNull() )
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) aOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId());
|
||||
if ( !aOwner.IsNull() )
|
||||
theOwners->Add( aOwner );
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
if (Handle(SelectBasics_SensitiveEntity) aEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId()))
|
||||
{
|
||||
theOwners->Add (aOwner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -202,9 +202,8 @@ Load(const Handle(AIS_InteractiveObject)& 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 (!myMainVS->Contains (anInteractive))
|
||||
@@ -864,24 +863,26 @@ const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_Interac
|
||||
|
||||
void AIS_LocalContext::LoadContextObjects()
|
||||
{
|
||||
AIS_ListIteratorOfListOfInteractive It;
|
||||
if(myLoadDisplayed) {
|
||||
AIS_ListOfInteractive LL;
|
||||
myCTX->DisplayedObjects(LL,Standard_True);
|
||||
Handle(AIS_LocalStatus) Att;
|
||||
for (It.Initialize(LL);It.More();It.Next()){
|
||||
const Handle(AIS_InteractiveObject)& anObj = It.Value();
|
||||
Att= new AIS_LocalStatus();
|
||||
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
|
||||
Att->SetTemporary(Standard_False);
|
||||
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
|
||||
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
|
||||
}
|
||||
myActiveObjects.Bind(anObj,Att);
|
||||
if (!myLoadDisplayed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AIS_ListOfInteractive LL;
|
||||
myCTX->DisplayedObjects(LL,Standard_True);
|
||||
for (AIS_ListIteratorOfListOfInteractive It (LL); It.More(); It.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anObj = It.Value();
|
||||
Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
|
||||
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
|
||||
Att->SetTemporary(Standard_False);
|
||||
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
|
||||
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
|
||||
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
|
||||
}
|
||||
myActiveObjects.Bind(anObj,Att);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -804,13 +804,10 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
||||
{
|
||||
// 1. Collect selectable entities
|
||||
SelectMgr_IndexedMapOfOwner aValidOwners;
|
||||
|
||||
const TColStd_ListOfInteger& aModes = SelectionModes (theIO);
|
||||
|
||||
TColStd_ListIteratorOfListOfInteger aModeIter (aModes);
|
||||
for (; aModeIter.More(); aModeIter.Next())
|
||||
for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
|
||||
{
|
||||
int aMode = aModeIter.Value();
|
||||
const int aMode = aModeIter.Value();
|
||||
if (!theIO->HasSelection(aMode))
|
||||
{
|
||||
continue;
|
||||
@@ -821,24 +818,16 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_Selection) aSelection = theIO->Selection(aMode);
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
const Handle(SelectMgr_Selection)& aSelection = theIO->Selection (aMode);
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
|
||||
if (anEntity.IsNull())
|
||||
if (Handle(SelectBasics_SensitiveEntity) anEntity = aSelEntIter.Value()->BaseSensitive())
|
||||
{
|
||||
continue;
|
||||
if (Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId()))
|
||||
{
|
||||
aValidOwners.Add (anOwner);
|
||||
}
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
|
||||
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aValidOwners.Add(anOwner);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,14 +30,13 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive,AIS_InteractiveObjec
|
||||
|
||||
//=======================================================================
|
||||
//function : AIS_MultipleConnectedInteractive
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
|
||||
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
|
||||
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
|
||||
{
|
||||
myHasOwnPresentations = Standard_False;
|
||||
myAssemblyOwner = NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -213,53 +212,27 @@ Standard_Boolean AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() co
|
||||
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
if (theMode == 0)
|
||||
{
|
||||
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))
|
||||
{
|
||||
aChild->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
|
||||
aChild->ComputeSelection (aSelection, theMode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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;
|
||||
}
|
||||
{
|
||||
aChild->RecomputePrimitives (theMode);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
|
||||
aChild->ComputeSelection (aSelection, theMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -72,12 +72,11 @@ public:
|
||||
//! may be decomposed into sub-shapes for dynamic selection.
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the owner of mode for selection of object as a whole
|
||||
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
|
||||
//! Returns common entity owner if the object is an assembly
|
||||
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
|
||||
//! children of multiple connected interactive object.
|
||||
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
//! Returns the owner of mode for selection of object as a whole
|
||||
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return myAssemblyOwner; }
|
||||
|
||||
//! Assigns interactive context.
|
||||
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.
|
||||
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)
|
||||
|
@@ -41,6 +41,7 @@ void AIS_Selection::Clear()
|
||||
{
|
||||
myresult.Clear();
|
||||
myResultMap.Clear();
|
||||
myIterator = AIS_NListOfEntityOwner::Iterator();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Reference in New Issue
Block a user