1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031777: Visualization - improve SelectMgr_EntityOwner to process selection scheme

The selection scheme has been propagated to Owner object interface, and the
AIS_Selection::Select() method has been replaced to unify the logic.
This commit is contained in:
mzernova
2023-02-07 02:17:58 +00:00
parent c479c4f6d8
commit f9998f03ad
6 changed files with 157 additions and 95 deletions

View File

@@ -83,6 +83,51 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
}
}
// =======================================================================
// function : Select
// purpose :
// =======================================================================
Standard_Boolean SelectMgr_EntityOwner::Select (const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected) const
{
switch (theSelScheme)
{
case AIS_SelectionScheme_UNKNOWN:
{
return myIsSelected;
}
case AIS_SelectionScheme_Replace:
{
return theIsDetected;
}
case AIS_SelectionScheme_Add:
{
return !myIsSelected || theIsDetected || IsForcedHilight();
}
case AIS_SelectionScheme_Remove:
{
return myIsSelected && !theIsDetected;
}
case AIS_SelectionScheme_XOR:
{
if (theIsDetected)
{
return !myIsSelected && !IsForcedHilight();
}
return myIsSelected;
}
case AIS_SelectionScheme_Clear:
{
return Standard_False;
}
case AIS_SelectionScheme_ReplaceExtra:
{
return theIsDetected;
}
}
return Standard_False;
}
// =======================================================================
// function : DumpJson
// purpose :

View File

@@ -17,6 +17,7 @@
#ifndef _SelectMgr_EntityOwner_HeaderFile
#define _SelectMgr_EntityOwner_HeaderFile
#include <AIS_SelectionScheme.hxx>
#include <Aspect_VKey.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <SelectMgr_SelectableObject.hxx>
@@ -139,6 +140,12 @@ public:
//! @param theIsSelected [in] shows if owner is selected.
void SetSelected (const Standard_Boolean theIsSelected) { myIsSelected = theIsSelected; }
//! If the object needs to be selected, it returns true.
//! @param[in] theSelScheme selection scheme
//! @param[in] theIsDetected flag of object detection
Standard_EXPORT Standard_Boolean Select (const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected) const;
//! Returns selection state.
Standard_DEPRECATED ("Deprecated method - IsSelected() should be used instead")
Standard_Integer State() const { return myIsSelected ? 1 : 0; }