setContextToObject (theIObj);
if (!myObjects.IsBound (theIObj))
{
- Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
- myObjects.Bind (theIObj, aStatus);
+ setObjectStatus (theIObj, AIS_DS_Displayed, theDispMode, theSelectionMode);
myMainVwr->StructureManager()->RegisterObject (theIObj);
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
- Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
- myObjects.Bind (theIObj, aStatus);
+ setObjectStatus (theIObj, AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
myMainVwr->StructureManager()->RegisterObject (theIObj);
}
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
mgrSelector->Remove (anObj);
- myObjects.UnBind (theIObj);
+ setObjectStatus (theIObj, AIS_DS_None, -1, -1);
myMainVwr->StructureManager()->UnregisterObject (theIObj);
for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
{
return theView->GravityPoint();
}
+//=======================================================================
+//function : setObjectStatus
+//purpose :
+//=======================================================================
+void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
+ const AIS_DisplayStatus theStatus,
+ const Standard_Integer theDispMode,
+ const Standard_Integer theSelectionMode)
+{
+ if (theStatus != AIS_DS_None)
+ {
+ Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
+ myObjects.Bind (theIObj, aStatus);
+ }
+ else
+ myObjects.UnBind (theIObj);
+
+ for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (theIObj->Children()); aPrsIter.More(); aPrsIter.Next())
+ {
+ Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()));
+ if (aChild.IsNull())
+ continue;
+
+ setObjectStatus (aChild, theStatus, theDispMode, theSelectionMode);
+ }
+}
}
}
+ //! Bind/Unbind status to object and its children
+ //! @param theObj [in] the object to change status
+ //! @param theStatus status, if NULL, unbind object
+ Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
+ const AIS_DisplayStatus theStatus,
+ const Standard_Integer theDispyMode,
+ const Standard_Integer theSelectionMode);
+
protected: //! @name internal fields
AIS_DataMapOfIOStatus myObjects;