From: nds Date: Wed, 28 Oct 2020 18:16:27 +0000 (+0300) Subject: 0032205: Visualization - implementing new selection scheme in context - replace extra X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d2b61a3a3c278a3a832b8497c823aa6b664df75d;p=occt-copy.git 0032205: Visualization - implementing new selection scheme in context - replace extra AIS_SelectionScheme_ReplaceExtra introduce (cherry picked from commit 19efc0e3269d7c3173af73ecb131eaf0635e88c8) (cherry picked from commit 07135fceaa1a6db4ca8611ae4611d89611b3d6d5) --- diff --git a/dox/user_guides/visualization/images/visualization_selection_scheme_replaceExtra.svg b/dox/user_guides/visualization/images/visualization_selection_scheme_replaceExtra.svg new file mode 100644 index 0000000000..7e82fec688 --- /dev/null +++ b/dox/user_guides/visualization/images/visualization_selection_scheme_replaceExtra.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dox/user_guides/visualization/visualization.md b/dox/user_guides/visualization/visualization.md index 403749d53e..f38f9e483d 100644 --- a/dox/user_guides/visualization/visualization.md +++ b/dox/user_guides/visualization/visualization.md @@ -1040,7 +1040,7 @@ Select* methods of AIS_InteractiveContext accept some selection scheme as parame | :----- | :----- | :----- | :----- | :----- | | AIS_SelectionScheme_Replace | @figure{visualization_selection_scheme_replace.svg, ""} | | AIS_SelectionScheme_XOR | @figure{visualization_selection_scheme_XOR.svg, ""} | | AIS_SelectionScheme_Add | @figure{visualization_selection_scheme_add.svg, ""} | | AIS_SelectionScheme_Clear | @figure{visualization_selection_scheme_clear.svg, ""} | -| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | | | +| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | AIS_SelectionScheme_ReplaceExtra | @figure{visualization_selection_scheme_replaceExtra.svg, ""} | @subsection occt_visu_3_5 Standard Interactive Object Classes diff --git a/src/AIS/AIS_Selection.cxx b/src/AIS/AIS_Selection.cxx index 67d8266e91..8b6c6637b2 100644 --- a/src/AIS/AIS_Selection.cxx +++ b/src/AIS/AIS_Selection.cxx @@ -149,6 +149,28 @@ 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; + } + } + } case AIS_SelectionScheme_Replace: { Clear(); diff --git a/src/AIS/AIS_SelectionScheme.hxx b/src/AIS/AIS_SelectionScheme.hxx index ef5da37a7e..a5de1f3e0f 100644 --- a/src/AIS/AIS_SelectionScheme.hxx +++ b/src/AIS/AIS_SelectionScheme.hxx @@ -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