mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -187,28 +187,24 @@ void StdSelect_ViewerSelector3d::Pick (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
//=======================================================================
|
||||
void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theView)
|
||||
{
|
||||
SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects);
|
||||
|
||||
for (; aSelectableIt.More(); aSelectableIt.Next())
|
||||
for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
|
||||
{
|
||||
const Handle (SelectMgr_SelectableObject)& anObj = aSelectableIt.Value();
|
||||
|
||||
Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (theView->Viewer()->StructureManager());
|
||||
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
const Handle (SelectMgr_SelectableObject)& anObj = aSelectableIt.Value();
|
||||
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);
|
||||
}
|
||||
|
||||
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->Display();
|
||||
}
|
||||
@@ -222,11 +218,10 @@ void StdSelect_ViewerSelector3d::DisplaySensitive (const Handle(V3d_View)& theVi
|
||||
//=======================================================================
|
||||
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();
|
||||
|
||||
if (!theView.IsNull())
|
||||
@@ -274,25 +269,20 @@ void StdSelect_ViewerSelector3d::computeSensitivePrs (const Handle(Graphic3d_Str
|
||||
Handle(Graphic3d_Group) aSensGroup = theStructure->NewGroup();
|
||||
|
||||
Quantity_Color aColor (Quantity_NOC_INDIANRED3);
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect =
|
||||
new Graphic3d_AspectMarker3d (Aspect_TOM_O_PLUS, aColor, 2.0);
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect =new Graphic3d_AspectMarker3d (Aspect_TOM_O_PLUS, aColor, 2.0);
|
||||
|
||||
aSensGroup->SetPrimitivesAspect (aMarkerAspect);
|
||||
aSensGroup->SetPrimitivesAspect (
|
||||
new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
|
||||
aSensGroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
|
||||
|
||||
Handle(Graphic3d_Group) anAreaGroup = theStructure->NewGroup();
|
||||
|
||||
anAreaGroup->SetPrimitivesAspect (
|
||||
new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
|
||||
anAreaGroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
|
||||
|
||||
TColgp_SequenceOfPnt aSeqLines, aSeqFree;
|
||||
TColStd_SequenceOfInteger aSeqBnds;
|
||||
|
||||
for (theSel->Init(); theSel->More(); theSel->Next())
|
||||
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||
{
|
||||
Handle(Select3D_SensitiveEntity) Ent =
|
||||
Handle(Select3D_SensitiveEntity)::DownCast(theSel->Sensitive()->BaseSensitive());
|
||||
Handle(Select3D_SensitiveEntity) Ent = Handle(Select3D_SensitiveEntity)::DownCast(aSelEntIter.Value()->BaseSensitive());
|
||||
const Standard_Boolean hasloc = theLoc.Form() != gp_Identity;
|
||||
|
||||
//==============
|
||||
@@ -741,12 +731,12 @@ namespace
|
||||
for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
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();
|
||||
for (aSel->Init(); aSel->More(); aSel->Next())
|
||||
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
|
||||
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()))
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
@@ -902,12 +892,12 @@ namespace
|
||||
for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
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();
|
||||
for (aSel->Init(); aSel->More(); aSel->Next())
|
||||
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
|
||||
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();
|
||||
if (!myMapOwnerColors.IsBound (anOwner))
|
||||
{
|
||||
@@ -980,12 +970,12 @@ namespace
|
||||
Standard_Integer aSelectionMode = -1;
|
||||
const Handle(SelectMgr_SelectableObject)& aSelectable = myMainSel->Picked (thePicked)->Selectable();
|
||||
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();
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
|
||||
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();
|
||||
break;
|
||||
|
Reference in New Issue
Block a user