mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0032205: Visualization - implementing new selection scheme in context - replace extra
- implementation of additional selection scheme, mainly to deselect single selected object.
This commit is contained in:
@@ -149,6 +149,29 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
|
||||
{
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_ReplaceExtra:
|
||||
{
|
||||
// If picked owners is equivalent to the selected then just clear selected
|
||||
// Else go to AIS_SelectionScheme_Replace
|
||||
if (thePickedOwners.Size() == myresult.Size())
|
||||
{
|
||||
Standard_Boolean isTheSame = Standard_True;
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
if (!myResultMap.IsBound (aSelIter.Value()))
|
||||
{
|
||||
isTheSame = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isTheSame)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Standard_FALLTHROUGH
|
||||
case AIS_SelectionScheme_Replace:
|
||||
{
|
||||
Clear();
|
||||
|
@@ -22,7 +22,9 @@ enum AIS_SelectionScheme
|
||||
AIS_SelectionScheme_Add, //!< adds detected object to current selection
|
||||
AIS_SelectionScheme_Remove, //!< removes detected object from the current selection
|
||||
AIS_SelectionScheme_XOR, //!< performs XOR for detected objects, other selected not touched
|
||||
AIS_SelectionScheme_Clear //!< clears current selection
|
||||
AIS_SelectionScheme_Clear, //!< clears current selection
|
||||
AIS_SelectionScheme_ReplaceExtra, //!< replace with one difference: if result of replace is an empty,
|
||||
//!< and current selection contains detected element, it will be selected
|
||||
};
|
||||
|
||||
#endif // _AIS_SelectionScheme_HeaderFile
|
||||
|
@@ -7264,6 +7264,10 @@ static Standard_Integer VSelect (Draw_Interpretor& ,
|
||||
{
|
||||
aSelScheme = AIS_SelectionScheme_Replace;
|
||||
}
|
||||
else if (anArg == "-replaceextra")
|
||||
{
|
||||
aSelScheme = AIS_SelectionScheme_ReplaceExtra;
|
||||
}
|
||||
else if (anArg == "-xor"
|
||||
|| anArg == "-shift")
|
||||
{
|
||||
@@ -14846,7 +14850,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
"\n\t\t: When -closeOnEscape is specified, view will be closed on pressing Escape.",
|
||||
__FILE__, VDiffImage, group);
|
||||
theCommands.Add ("vselect",
|
||||
"vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [-allowoverlap 0|1] [-replace|-xor|-add|-remove]\n"
|
||||
"vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [-allowoverlap 0|1] [-replace|-replaceextra|-xor|-add|-remove]\n"
|
||||
"- emulates different types of selection:\n"
|
||||
"- 1) single click selection\n"
|
||||
"- 2) selection with rectangle having corners at pixel positions (x1,y1) and (x2,y2)\n"
|
||||
@@ -14855,7 +14859,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
" If the flag is set to 1, both sensitives that were included completely and overlapped partially by defined \n"
|
||||
" rectangle or polygon will be detected, otherwise algorithm will chose only fully included sensitives.\n"
|
||||
" Default behavior is to detect only full inclusion. (partial inclusion - overlap - is not allowed by default)\n"
|
||||
"- 5) selection scheme replace, xor, add or remove (replace by default)",
|
||||
"- 5) selection scheme replace, replaceextra, xor, add or remove (replace by default)",
|
||||
__FILE__, VSelect, group);
|
||||
theCommands.Add ("vmoveto",
|
||||
"vmoveto [x y] [-reset]"
|
||||
|
Reference in New Issue
Block a user