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

0030737: Visualization - implementing new selection schemes in context

#apply selection scheme to container of owners

(cherry picked from commit 40c33142278a094947c906637cc84e6c67addd46)
This commit is contained in:
nds
2019-05-31 20:43:18 +03:00
parent a2f9edbd19
commit aa66d8db58
3 changed files with 44 additions and 60 deletions

View File

@@ -501,6 +501,13 @@ public: //! @name Selection management
const Handle(V3d_View)& theView,
const Standard_Boolean theToUpdateViewer);
//! Sets list of owner selected/deselected using selection scheme
//! It is possible that selection of other objects is changed relatively selection scheme .
//! \param theOwner owners to change selection state
//! \param theSelScheme selection scheme
Standard_EXPORT AIS_StatusOfPick Select (const AIS_NListOfEntityOwner& theOwners,
const AIS_SelectionScheme theSelScheme);
//! Fits the view correspondingly to the bounds of selected objects.
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,

View File

@@ -418,15 +418,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
if (myAutoHilight)
{
clearDynamicHighlight();
UnhilightSelected (Standard_False);
}
myWasLastMain = Standard_True;
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
AIS_NListOfEntityOwner aPickedOwners;
@@ -434,19 +425,8 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
{
aPickedOwners.Append (myMainSel->Picked (aPickIter));
}
mySelection->SelectOwners (aPickedOwners, theSelScheme, myFilters);
if (myAutoHilight)
{
HilightSelected (Standard_False);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
@@ -462,15 +442,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
if (myAutoHilight)
{
clearDynamicHighlight();
UnhilightSelected (Standard_False);
}
myWasLastMain = Standard_True;
myMainSel->Pick (thePolyline, theView);
AIS_NListOfEntityOwner aPickedOwners;
@@ -478,19 +449,8 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
{
aPickedOwners.Append (myMainSel->Picked (aPickIter));
}
mySelection->SelectOwners (aPickedOwners, theSelScheme, myFilters);
if (myAutoHilight)
{
HilightSelected (Standard_False);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
@@ -509,26 +469,10 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_SelectionScheme theSe
return getStatusOfPick (NbSelected());
}*/
if (myAutoHilight)
{
clearDynamicHighlight();
UnhilightSelected (Standard_False);
}
AIS_NListOfEntityOwner aPickedOwners;
aPickedOwners.Append (myLastinMain);
mySelection->SelectOwners (aPickedOwners, theSelScheme, myFilters);
if (myAutoHilight)
{
HilightSelected (Standard_False);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
return Select (aPickedOwners, theSelScheme);
}
//=======================================================================
@@ -599,6 +543,36 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
return Select (thePolyline, theView, AIS_SelectionScheme_Switch);
}
//=======================================================================
//function : Select
//purpose :
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_NListOfEntityOwner& theOwners,
const AIS_SelectionScheme theSelScheme)
{
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
if (myAutoHilight)
{
clearDynamicHighlight();
UnhilightSelected (Standard_False);
}
myWasLastMain = Standard_True;
mySelection->SelectOwners (theOwners, theSelScheme, myFilters);
if (myAutoHilight)
{
HilightSelected (Standard_False);
}
Standard_Integer aSelNum = NbSelected();
return (aSelNum == 0) ? AIS_SOP_NothingSelected
: (aSelNum == 1) ? AIS_SOP_OneSelected
: AIS_SOP_SeveralSelected;
}
//=======================================================================
//function : HilightSelected
//purpose :

View File

@@ -20,12 +20,15 @@
//! It is possible to use combination of schemes.
enum AIS_SelectionScheme
{
AIS_SelectionScheme_Empty = 0x0000, // do nothing
AIS_SelectionScheme_Clear = 0x0001, // clears current selection
AIS_SelectionScheme_Add = 0x0002, // add detected object to current selection
AIS_SelectionScheme_Switch = 0x0004, // switch selection state in values selected/deselected
AIS_SelectionScheme_PickedIfEmpty = 0x0008, // if after switch, result selection is empty, select picked objects
AIS_SelectionScheme_ClearAndSwitch = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Switch,
AIS_SelectionScheme_ClearAndAdd = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Add
AIS_SelectionScheme_ClearAndAdd = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Add,
AIS_SelectionScheme_ClearAndSwitchAndPicked = AIS_SelectionScheme_ClearAndSwitch | AIS_SelectionScheme_PickedIfEmpty,
AIS_SelectionScheme_Custom // reserved item for custom selection scheme
};
#endif // _AIS_SelectionScheme_HeaderFile