//! Unhighlights previously selected owners and marks them as not selected.
//! Marks owner given as selected and highlights it.
+ //! Performs selection filters check.
Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
const Standard_Boolean theToUpdateViewer = Standard_True);
//! Standard_False, the presentation of the Interactive
//! Object activates the selection mode; the object is
//! displayed but no viewer will be updated.
+ //! Performs selection filters check.
Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
const Standard_Boolean theToUpdateViewer = Standard_True);
void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
const Quantity_NameOfColor theSelColor);
+ //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
+ //! The function updates global status and selection state of owner and interactive object.
+ //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
+ //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
+ void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
+
AIS_DataMapOfIOStatus myObjects;
Handle(SelectMgr_SelectionManager) mgrSelector;
Handle(PrsMgr_PresentationManager3d) myMainPM;
}
}
+//=======================================================================
+//function : unhighlightSelected
+//purpose :
+//=======================================================================
+void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
+{
+ AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
+ Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
+ NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
+ for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
+ {
+ const Handle(SelectMgr_EntityOwner) anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
+ if (anOwner.IsNull() || !anOwner->HasSelectable())
+ continue;
+
+ const Handle(AIS_InteractiveObject) anInteractive =
+ Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ if (anOwner->IsAutoHilight())
+ {
+ const Standard_Integer aHiMode = anInteractive->HasHilightMode() ? anInteractive->HilightMode() : 0;
+ anOwner->Unhilight (myMainPM, aHiMode);
+ if (theIsToHilightSubIntensity)
+ {
+ if (myObjects.IsBound (anInteractive) && myObjects (anInteractive)->IsSubIntensityOn())
+ {
+ anOwner->HilightWithColor (myMainPM, mySubIntensity, aHiMode);
+ }
+ }
+ }
+ else
+ {
+ if (!anObjToClear.Contains (anInteractive))
+ anObjToClear.Add (anInteractive);
+ }
+ anOwner->State (0);
+ if (anOwner == anInteractive->GlobalSelOwner())
+ {
+ myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
+ }
+ }
+ for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
+ {
+ const Handle(AIS_InteractiveObject)& anObj = anIter.Value();
+ const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
+ myMainPM->Unhighlight (anObj, aHiMode);
+ anObj->ClearSelected();
+ }
+}
+
//=======================================================================
//function : MoveTo
//purpose :
}
else
{
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aSelection = AIS_Selection::CurrentSelection();
- NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
- for (aSelection->Init(); aSelection->More(); aSelection->Next())
- {
- const Handle(SelectMgr_EntityOwner) anOwner
- = Handle(SelectMgr_EntityOwner)::DownCast (aSelection->Value());
-
- if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
- continue;
-
- const Handle(AIS_InteractiveObject) anObject =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- anOwner->State (0);
- if (anOwner == anObject->GlobalSelOwner())
- {
- myObjects.ChangeFind (anObject)->SetHilightStatus (Standard_False);
- }
- if (!anOwner->IsAutoHilight())
- {
- if (!anObjToClear.Contains (anObject))
- anObjToClear.Add (anObject);
- }
- else
- {
- const Standard_Integer aHiMode = anObject->HasHilightMode() ? anObject->HilightMode() : 0;
- anOwner->Unhilight (myMainPM, aHiMode);
- if (myObjects.IsBound (anObject) && myObjects(anObject)->IsSubIntensityOn())
- {
- anOwner->HilightWithColor (myMainPM, mySubIntensity, aHiMode);
- }
- }
- }
- while (!anObjToClear.IsEmpty())
- {
- const Handle(AIS_InteractiveObject)& anObj = anObjToClear.FindKey (anObjToClear.Size());
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
- myMainPM->Unhighlight (anObj, aHiMode);
- anObj->ClearSelected();
- anObjToClear.RemoveLast();
- }
+ unhighlightSelected (Standard_True);
AIS_Selection::Select();
if (toUpdateViewer && myWasLastMain)
if (NbSelected() == 0)
return;
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aSel = AIS_Selection::CurrentSelection();
- NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
- for (aSel->Init(); aSel->More(); aSel->Next())
- {
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
- if (!anOwner.IsNull() && anOwner->HasSelectable())
- {
- const Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- if (anOwner == anObj->GlobalSelOwner())
- {
- myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
- }
- anOwner->State (0);
- if (!anOwner->IsAutoHilight())
- {
- if (!anObjToClear.Contains (anObj))
- anObjToClear.Add (anObj);
- }
- else
- {
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
- anOwner->Unhilight (myMainPM, aHiMode);
- }
- }
- }
-
- while (!anObjToClear.IsEmpty())
- {
- anObjToClear.FindKey (anObjToClear.Size())->ClearSelected();
- anObjToClear.RemoveLast();
- }
+ unhighlightSelected();
AIS_Selection::Select();
myMainPM->ClearImmediateDraw();
{
const Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
- if (anOwner.IsNull() || !anOwner->HasSelectable())
+ if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
Handle(AIS_InteractiveObject) aSelectable =
void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
const Standard_Boolean theToUpdateViewer)
{
- if (theOwner.IsNull() || !theOwner->HasSelectable())
+ if (theOwner.IsNull() || !theOwner->HasSelectable() || !myFilters->IsOk (theOwner))
return;
const Handle(AIS_InteractiveObject) anObject =
if (!myObjects.IsBound (anObject))
Display (anObject, Standard_False);
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
- NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
- for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
- {
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
- if (!anOwner->HasSelectable())
- continue;
- const Handle(AIS_InteractiveObject) anInteractive =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- if (anOwner->IsAutoHilight())
- {
- const Standard_Integer aHiMode = anInteractive->HasHilightMode() ? anInteractive->HilightMode() : 0;
- anOwner->Unhilight (myMainPM, aHiMode);
- }
- else
- {
- if (!anObjToClear.Contains (anInteractive))
- anObjToClear.Add (anInteractive);
- }
- anOwner->State (0);
- if (theOwner == anObject->GlobalSelOwner())
- {
- myObjects.ChangeFind (anObject)->SetHilightStatus (Standard_False);
- }
- }
- while (!anObjToClear.IsEmpty())
- {
- anObjToClear.FindKey (anObjToClear.Size())->ClearSelected();
- anObjToClear.RemoveLast();
- }
+ unhighlightSelected();
AIS_Selection::ClearAndSelect (theOwner);
theOwner->State (1);