{
Backup();
getData()->SetSelectionMode (theSelectionMode);
- AISUpdate();
+
+ if ( myAIS.IsNull() )
+ AISUpdate();
+ else
+ ActivateSelectionMode();
}
//=======================================================================
myAIS->SetDisplayMode(aMode);
}
- if ( !aContext.IsNull() && IsDisplayed() )
- 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);
- }
- }
- }
-
+ ActivateSelectionMode();
}
if (IsDisplayed() && !aContext.IsNull())
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);
+ }
+ }
+ }
+}