}
}
+//=======================================================================
+//function : GetNbSelectionModes
+//purpose : Returns selection mode(s) of the attribute.
+// : It starts with 1 .. GetNbSelectionModes().
+//=======================================================================
+Standard_Integer TPrsStd_AISPresentation::GetNbSelectionModes() const
+{
+ return getData()->GetNbSelectionModes();
+}
+
//=======================================================================
//function : SelectionMode
//purpose :
//=======================================================================
-Standard_Integer TPrsStd_AISPresentation::SelectionMode() const
+Standard_Integer TPrsStd_AISPresentation::SelectionMode(const Standard_Integer index) const
{
- return getData()->SelectionMode();
+ return getData()->SelectionMode(index);
}
//=======================================================================
ActivateSelectionMode();
}
+//=======================================================================
+//function : AddSelectionMode
+//purpose :
+//=======================================================================
+void TPrsStd_AISPresentation::AddSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction)
+{
+ if (theTransaction)
+ Backup();
+ getData()->AddSelectionMode (theSelectionMode, theTransaction);
+
+ if (myAIS.IsNull())
+ AISUpdate();
+ else
+ ActivateSelectionMode();
+}
+
//=======================================================================
//function : UnsetSelectionMode
//purpose :
//=======================================================================
void TPrsStd_AISPresentation::UnsetSelectionMode()
{
- getData()->UnsetSelectionMode ();
+ getData()->UnsetSelectionMode();
AISUpdate();
}
{
TColStd_ListOfInteger anActivatedModes;
aContext->ActivatedModes (myAIS, anActivatedModes);
- Standard_Boolean isActivated = Standard_False;
- Standard_Integer aSelectionMode = SelectionMode();
- if (aSelectionMode == -1)
+ Standard_Integer nbSelModes = GetNbSelectionModes();
+ if (nbSelModes == 1)
{
- aContext->Deactivate(myAIS);
+ 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);
+ }
}
else
{
- for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
+ for (Standard_Integer iSelMode = 1; iSelMode <= nbSelModes; iSelMode++)
{
- if (aModeIter.Value() == aSelectionMode)
- {
- isActivated = Standard_True;
- break;
- }
+ const Standard_Integer aSelectionMode = SelectionMode (iSelMode);
+ aContext->SetSelectionModeActive (myAIS, aSelectionMode, Standard_True/*activate*/,
+ iSelMode == 1 ? AIS_SelectionModesConcurrency_Single : AIS_SelectionModesConcurrency_GlobalOrLocal);
}
- if (!isActivated)
- aContext->Activate (myAIS, aSelectionMode, Standard_False);
}
}
}