mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0030737: Visualization - implementing new selection schemes in context
AIS_SelectionScheme enumeration is defined to set which selection behaviour is used in Select of context AIS_InteractiveContext is corrected to use single Select method instead of combination of Select/ShiftSelect methods with a selection scheme parameter. Upgrade: Select() -> SelectDetected/Rectangle/Polygon(AIS_SelectionScheme_Replace), ShiftSelect -> SelectDetected/Rectangle/Polygon(AIS_SelectionScheme_XOR)
This commit is contained in:
@@ -26,7 +26,7 @@ class V3d_View;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(ViewerTest_EventManager, Standard_Transient)
|
||||
|
||||
//! used to manage mouse event (move,select,shiftselect)
|
||||
//! used to manage mouse event (move,select)
|
||||
//! By default the events are transmitted to interactive context.
|
||||
class ViewerTest_EventManager : public Standard_Transient, public AIS_ViewController
|
||||
{
|
||||
|
@@ -7560,7 +7560,8 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
|
||||
}
|
||||
|
||||
NCollection_Sequence<Graphic3d_Vec2i> aPnts;
|
||||
bool isShiftSelection = false, toAllowOverlap = false;
|
||||
bool toAllowOverlap = false;
|
||||
AIS_SelectionScheme aSelScheme = AIS_SelectionScheme_Replace;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString anArg (theArgVec[anArgIter]);
|
||||
@@ -7584,7 +7585,10 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
|
||||
else if (anArgIter + 1 == theNbArgs
|
||||
&& anArg.IsIntegerValue())
|
||||
{
|
||||
isShiftSelection = anArg.IntegerValue() == 1;
|
||||
if (anArg.IntegerValue() == 1)
|
||||
{
|
||||
aSelScheme = AIS_SelectionScheme_XOR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7601,14 +7605,7 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
|
||||
Handle(ViewerTest_EventManager) aCurrentEventManager = ViewerTest::CurrentEventManager();
|
||||
if (aPnts.IsEmpty())
|
||||
{
|
||||
if (isShiftSelection)
|
||||
{
|
||||
aCtx->ShiftSelect (false);
|
||||
}
|
||||
else
|
||||
{
|
||||
aCtx->Select (false);
|
||||
}
|
||||
aCtx->SelectDetected (aSelScheme);
|
||||
aCtx->CurrentViewer()->Invalidate();
|
||||
}
|
||||
else if (aPnts.Length() == 2)
|
||||
@@ -7623,11 +7620,11 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
|
||||
{
|
||||
std::swap (aPnts.ChangeFirst(), aPnts.ChangeLast());
|
||||
}
|
||||
aCurrentEventManager->SelectInViewer (aPnts, isShiftSelection);
|
||||
aCurrentEventManager->SelectInViewer (aPnts, aSelScheme == AIS_SelectionScheme_XOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurrentEventManager->SelectInViewer (aPnts, isShiftSelection);
|
||||
aCurrentEventManager->SelectInViewer (aPnts, aSelScheme == AIS_SelectionScheme_XOR);
|
||||
}
|
||||
aCurrentEventManager->FlushViewEvents (aCtx, ViewerTest::CurrentView(), true);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user