//! different state of a Selection in a ViewerSelector...
enum SelectMgr_StateOfSelection
{
-SelectMgr_SOS_Activated,
-SelectMgr_SOS_Deactivated,
-SelectMgr_SOS_Sleeping,
-SelectMgr_SOS_Any,
-SelectMgr_SOS_Unknown
+ SelectMgr_SOS_Any = -2, //!< ANY selection state (for querying selections)
+ SelectMgr_SOS_Unknown = -1, //!< selection, which has never been in SelectMgr_SOS_Activated state (almost the same thing as SelectMgr_SOS_Deactivated)
+ SelectMgr_SOS_Deactivated = 0, //!< deactivated selection, once been in SelectMgr_SOS_Activated state
+ SelectMgr_SOS_Activated, //!< activated selection
};
#endif // _SelectMgr_StateOfSelection_HeaderFile
aSelEntIter.Value()->SetActiveForSelection();
}
- theSelection->SetSelectionState (SelectMgr_SOS_Activated);
+ if (theSelection->GetSelectionState() != SelectMgr_SOS_Activated)
+ {
+ theSelection->SetSelectionState (SelectMgr_SOS_Activated);
- myTolerances.Add (theSelection->Sensitivity());
- myToUpdateTolerance = Standard_True;
+ myTolerances.Add (theSelection->Sensitivity());
+ myToUpdateTolerance = Standard_True;
+ }
}
//==================================================
aSelEntIter.Value()->ResetSelectionActiveStatus();
}
- theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);
+ if (theSelection->GetSelectionState() == SelectMgr_SOS_Activated)
+ {
+ theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);
- myTolerances.Decrement (theSelection->Sensitivity());
- myToUpdateTolerance = Standard_True;
+ myTolerances.Decrement (theSelection->Sensitivity());
+ myToUpdateTolerance = Standard_True;
+ }
}
//==================================================
Standard_Boolean hasActivatedStates = Contains (theSelectableObject);
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theSelectableObject->Selections()); aSelIter.More(); aSelIter.Next())
{
- if (theWantedState == SelectMgr_SOS_Any)
- {
- theModeList.Append (aSelIter.Value()->Mode());
- }
- else if (theWantedState == aSelIter.Value()->GetSelectionState())
- {
- theModeList.Append (aSelIter.Value()->Mode());
- }
+ if (theWantedState == SelectMgr_SOS_Any)
+ {
+ theModeList.Append (aSelIter.Value()->Mode());
+ }
+ else if (theWantedState == aSelIter.Value()->GetSelectionState())
+ {
+ theModeList.Append (aSelIter.Value()->Mode());
+ }
}
return hasActivatedStates;
{
switch (theValue)
{
- case SelectMgr_SOS_Activated: return "Activated";
- case SelectMgr_SOS_Deactivated: return "Deactivated";
- case SelectMgr_SOS_Sleeping: return "Sleeping";
case SelectMgr_SOS_Any: return "Any";
case SelectMgr_SOS_Unknown: return "Unknown";
+ case SelectMgr_SOS_Activated: return "Activated";
+ case SelectMgr_SOS_Deactivated: return "Deactivated";
default: break;
}
}