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

0029425: Visualization - AIS_InteractiveContext::SetAutomaticHilight() has no affect

AIS_InteractiveContext::MoveTo() and ::Select() now do not highlight entities
when ::AutomaticHilight() option is turned off.

vselprops command has been extended with new arguments -autoHighlight and -highlightSelected
(vhighlightselected command is now deprecated).
This commit is contained in:
kgv
2018-06-21 12:19:08 +03:00
committed by bugmaster
parent df6f165a2b
commit be3d8cbc02
3 changed files with 99 additions and 95 deletions

View File

@@ -491,12 +491,32 @@ public: //! @name Selection management
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
//! Return value specified whether selected object must be hilighted when mouse cursor is moved above it
//! @sa MoveTo()
Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
//! Specify whether selected object must be hilighted when mouse cursor is moved above it (in MoveTo method).
//! By default this value is false and selected object is not hilighted in this case.
//! @sa MoveTo()
void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
//! Return value specified whether selected object must be hilighted when mouse cursor is moved above it
Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
//! Returns true if the automatic highlight mode is active; TRUE by default.
//! @sa MoveTo(), Select(), HilightWithColor(), Unhilight()
Standard_Boolean AutomaticHilight() const { return myAutoHilight; }
//! Sets the highlighting status of detected and selected entities.
//! This function allows you to disconnect the automatic mode.
//!
//! MoveTo() will fill the list of detected entities
//! and Select() will set selected state to detected objects regardless of this flag,
//! but with disabled AutomaticHiligh() their highlighting state will be left unaffected,
//! so that application will be able performing custom highlighting in a different way, if needed.
//!
//! This API should be distinguished from SelectMgr_SelectableObject::SetAutoHilight()
//! that is used to implement custom highlighting logic for a specific interactive object class.
//!
//! @sa MoveTo(), Select(), HilightWithColor(), Unhilight()
void SetAutomaticHilight (Standard_Boolean theStatus) { myAutoHilight = theStatus; }
//! Unhighlights previously selected owners and marks them as not selected.
//! Marks owner given as selected and highlights it.
@@ -1039,15 +1059,6 @@ public: //! @name iso-line display attributes
//! Returns true if drawing isolines on triangulation algorithm is enabled.
Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
public: //! @name Local Context management (deprecated)
//! Sets the highlighting status of detected and selected entities.
//! This function allows you to disconnect the automatic mode.
void SetAutomaticHilight (Standard_Boolean theStatus) { myAutoHilight = theStatus; }
//! Returns true if the automatic highlight mode is active.
Standard_Boolean AutomaticHilight() const { return myAutoHilight; }
public:
//! Updates the view of the current object in open context.

View File

@@ -383,7 +383,9 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
// highlight detected object if it is not selected or myToHilightSelected flag is true
if (myLastPicked->HasSelectable())
{
if (!myLastPicked->IsSelected() || myToHilightSelected)
if (myAutoHilight
&& (!myLastPicked->IsSelected()
|| myToHilightSelected))
{
highlightWithColor (myLastPicked, theView->Viewer());
toUpdateViewer = Standard_True;
@@ -399,7 +401,9 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
// previously detected object is unhilighted if it is not selected or hilighted
// with selection color if it is selected
aStatus = AIS_SOD_Nothing;
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
if (myAutoHilight
&& !myLastPicked.IsNull()
&& myLastPicked->HasSelectable())
{
clearDynamicHighlight();
toUpdateViewer = Standard_True;
@@ -523,12 +527,12 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
{
if (myAutoHilight)
{
clearDynamicHighlight();
}
if (myWasLastMain && !myLastinMain.IsNull())
{
if (myAutoHilight)
{
clearDynamicHighlight();
}
if (!myLastinMain->IsSelected()
|| myLastinMain->IsForcedHilight()
|| NbSelected() > 1)
@@ -542,16 +546,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
}
else
{
if (myAutoHilight)
{
unhighlightSelected (Standard_True);
}
mySelection->Clear();
if (toUpdateViewer && myWasLastMain)
{
UpdateCurrentViewer();
}
ClearSelected (toUpdateViewer);
}
Standard_Integer aSelNum = NbSelected();
@@ -761,6 +756,13 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
{
unhighlightSelected();
}
else
{
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
aSelIter.Value()->SetSelected (Standard_False);
}
}
mySelection->Clear();
if (myAutoHilight)