mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0029353: Optimization of TPrsStd_AISPresentation::SetSelectionMode()
This commit is contained in:
parent
992ed6b3c0
commit
ab3ff92cc0
@ -595,7 +595,11 @@ void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelecti
|
|||||||
{
|
{
|
||||||
Backup();
|
Backup();
|
||||||
getData()->SetSelectionMode (theSelectionMode);
|
getData()->SetSelectionMode (theSelectionMode);
|
||||||
|
|
||||||
|
if ( myAIS.IsNull() )
|
||||||
AISUpdate();
|
AISUpdate();
|
||||||
|
else
|
||||||
|
ActivateSelectionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -871,36 +875,7 @@ void TPrsStd_AISPresentation::AISUpdate()
|
|||||||
myAIS->SetDisplayMode(aMode);
|
myAIS->SetDisplayMode(aMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !aContext.IsNull() && IsDisplayed() )
|
ActivateSelectionMode();
|
||||||
aContext->Redisplay(myAIS, Standard_False);
|
|
||||||
|
|
||||||
if (HasOwnSelectionMode()) {
|
|
||||||
if (!aContext.IsNull())
|
|
||||||
{
|
|
||||||
TColStd_ListOfInteger anActivatedModes;
|
|
||||||
aContext->ActivatedModes (myAIS, anActivatedModes);
|
|
||||||
Standard_Boolean isActivated = Standard_False;
|
|
||||||
Standard_Integer aSelectionMode = SelectionMode();
|
|
||||||
if (aSelectionMode == -1)
|
|
||||||
{
|
|
||||||
aContext->Deactivate(myAIS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
|
|
||||||
{
|
|
||||||
if (aModeIter.Value() == aSelectionMode)
|
|
||||||
{
|
|
||||||
isActivated = Standard_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isActivated)
|
|
||||||
aContext->Activate (myAIS, aSelectionMode, Standard_False);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDisplayed() && !aContext.IsNull())
|
if (IsDisplayed() && !aContext.IsNull())
|
||||||
@ -1013,3 +988,40 @@ Handle(AIS_InteractiveContext) TPrsStd_AISPresentation::getAISContext() const
|
|||||||
|
|
||||||
return Handle_AIS_InteractiveContext();
|
return Handle_AIS_InteractiveContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ActivateSelectionMode
|
||||||
|
//purpose : Activates selection mode of the interactive object.
|
||||||
|
// It is called internally on change of selection mode and AISUpdate().
|
||||||
|
//=======================================================================
|
||||||
|
void TPrsStd_AISPresentation::ActivateSelectionMode()
|
||||||
|
{
|
||||||
|
if (!myAIS.IsNull() && HasOwnSelectionMode())
|
||||||
|
{
|
||||||
|
Handle(AIS_InteractiveContext) aContext = getAISContext();
|
||||||
|
if (!aContext.IsNull())
|
||||||
|
{
|
||||||
|
TColStd_ListOfInteger anActivatedModes;
|
||||||
|
aContext->ActivatedModes (myAIS, anActivatedModes);
|
||||||
|
Standard_Boolean isActivated = Standard_False;
|
||||||
|
Standard_Integer aSelectionMode = SelectionMode();
|
||||||
|
if (aSelectionMode == -1)
|
||||||
|
{
|
||||||
|
aContext->Deactivate(myAIS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
|
||||||
|
{
|
||||||
|
if (aModeIter.Value() == aSelectionMode)
|
||||||
|
{
|
||||||
|
isActivated = Standard_True;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isActivated)
|
||||||
|
aContext->Activate (myAIS, aSelectionMode, Standard_False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -198,6 +198,10 @@ private:
|
|||||||
|
|
||||||
Handle(AIS_InteractiveContext) getAISContext() const;
|
Handle(AIS_InteractiveContext) getAISContext() const;
|
||||||
|
|
||||||
|
//! Activates selection mode of the interactive object.
|
||||||
|
//! It is called internally on change of selection mode and AISUpdate().
|
||||||
|
void ActivateSelectionMode();
|
||||||
|
|
||||||
//! Updates AIS_InteractiveObject stored in the attribute
|
//! Updates AIS_InteractiveObject stored in the attribute
|
||||||
//! and applies the visualization settings
|
//! and applies the visualization settings
|
||||||
Standard_EXPORT void AISUpdate();
|
Standard_EXPORT void AISUpdate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user