#include <Prs3d_PlaneAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
-#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <Quantity_Color.hxx>
#include <SelectMgr_EntityOwner.hxx>
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)>::Iterator AIS_MapIteratorOfMapOfObjectOwners;
//! Initialize default highlighting attributes.
- static void initDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer)
+ static void initDefaultHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer,
+ const Quantity_Color& theColor)
{
theDrawer->SetMethod (Aspect_TOHM_COLOR);
theDrawer->SetDisplayMode (0);
+ theDrawer->SetColor (theColor);
- theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
- *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
+ theDrawer->SetupOwnShadingAspect();
+ theDrawer->SetupOwnPointAspect();
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
+ theDrawer->SetDatumAspect (new Prs3d_DatumAspect());
+
+ theDrawer->ShadingAspect()->SetColor (theColor);
+ theDrawer->WireAspect()->SetColor (theColor);
+ theDrawer->LineAspect()->SetColor (theColor);
+ theDrawer->PlaneAspect()->ArrowAspect()->SetColor (theColor);
+ theDrawer->PlaneAspect()->IsoAspect()->SetColor (theColor);
+ theDrawer->PlaneAspect()->EdgesAspect()->SetColor (theColor);
+ theDrawer->FreeBoundaryAspect()->SetColor (theColor);
+ theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
+ theDrawer->PointAspect()->SetColor (theColor);
+ for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DP_None; ++aPartIter)
+ {
+ if (Handle(Prs3d_LineAspect) aLineAsp = theDrawer->DatumAspect()->LineAspect ((Prs3d_DatumParts )aPartIter))
+ {
+ aLineAsp->SetColor (theColor);
+ }
+ }
theDrawer->WireAspect()->SetWidth (2.0);
theDrawer->LineAspect()->SetWidth (2.0);
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->StructureManager())),
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
-myWasLastMain(Standard_False),
myToHilightSelected(Standard_True),
mySelection(new AIS_Selection()),
myFilters(new SelectMgr_OrFilter()),
{
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Dynamic];
aStyle->Link (myDefaultDrawer);
- initDefaultHilightAttributes (aStyle);
+ initDefaultHilightAttributes (aStyle, Quantity_NOC_CYAN1);
aStyle->SetZLayer(Graphic3d_ZLayerId_Top);
- aStyle->SetColor (Quantity_NOC_CYAN1);
}
{
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalDynamic];
aStyle->Link (myDefaultDrawer);
- initDefaultHilightAttributes (aStyle);
+ initDefaultHilightAttributes (aStyle, Quantity_NOC_CYAN1);
aStyle->SetZLayer(Graphic3d_ZLayerId_Topmost);
- aStyle->SetColor (Quantity_NOC_CYAN1);
}
{
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_Selected];
aStyle->Link (myDefaultDrawer);
- initDefaultHilightAttributes (aStyle);
+ initDefaultHilightAttributes (aStyle, Quantity_NOC_GRAY80);
aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
- aStyle->SetColor (Quantity_NOC_GRAY80);
}
{
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_LocalSelected];
aStyle->Link (myDefaultDrawer);
- initDefaultHilightAttributes (aStyle);
+ initDefaultHilightAttributes (aStyle, Quantity_NOC_GRAY80);
aStyle->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
- aStyle->SetColor (Quantity_NOC_GRAY80);
}
{
const Handle(Prs3d_Drawer)& aStyle = myStyles[Prs3d_TypeOfHighlight_SubIntensity];
}
}
+//=======================================================================
+//function : LastActiveView
+//purpose :
+//=======================================================================
+Handle(V3d_View) AIS_InteractiveContext::LastActiveView() const
+{
+ if (myLastActiveView == NULL
+ || myMainVwr.IsNull())
+ {
+ return Handle(V3d_View)();
+ }
+
+ // as a precaution - check that myLastActiveView pointer is a valid active View
+ for (V3d_ListOfViewIterator aViewIter = myMainVwr->ActiveViewIterator(); aViewIter.More(); aViewIter.Next())
+ {
+ if (aViewIter.Value() == myLastActiveView)
+ {
+ return aViewIter.Value();
+ }
+ }
+ return Handle(V3d_View)();
+}
+
//=======================================================================
//function : UpdateCurrentViewer
//purpose :
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);
}
return myObjects (anObj)->IsHilighted();
}
- return theOwner->IsSelected();
+ const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
+ return theOwner->IsHilighted (myMainPM, aHiMode);
}
//=======================================================================
return;
}
- theIObj->Update (theAllModes);
+ theIObj->SetToUpdate();
+ theIObj->UpdatePresentations (theAllModes);
if (!theToUpdateViewer)
{
return;
return;
}
- TColStd_ListOfInteger aPrsModes;
- theIObj->ToBeUpdated (aPrsModes);
- for (TColStd_ListIteratorOfListOfInteger aPrsModesIt (aPrsModes); aPrsModesIt.More(); aPrsModesIt.Next())
- {
- theIObj->Update (aPrsModesIt.Value(), Standard_False);
- }
-
+ theIObj->UpdatePresentations();
mgrSelector->Update(theIObj);
if (theUpdateViewer)
return myDefaultDrawer->DeviationCoefficient();
}
-//=======================================================================
-//function : SetHLRDeviationCoefficient
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Standard_Real theCoefficient)
-{
- myDefaultDrawer->SetHLRDeviationCoefficient (theCoefficient);
-}
-
-//=======================================================================
-//function : HLRDeviationCoefficient
-//purpose :
-//=======================================================================
-Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const
-{
- return myDefaultDrawer->HLRDeviationCoefficient();
-}
-
-//=======================================================================
-//function : SetHLRAngle
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetHLRAngle (const Standard_Real theAngle)
-{
- myDefaultDrawer->SetHLRAngle (theAngle);
-}
-
-//=======================================================================
-//function : SetHLRAngleAndDeviation
-//purpose : compute with anangle a HLRAngle and a HLRDeviationCoefficient
-// and set them in myHLRAngle and in myHLRDeviationCoefficient
-// of myDefaultDrawer
-//=======================================================================
-void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Standard_Real theAngle)
-{
- Standard_Real anOutAngl, anOutDefl;
- HLRBRep::PolyHLRAngleAndDeflection (theAngle, anOutAngl, anOutDefl);
-
- myDefaultDrawer->SetHLRAngle (anOutAngl);
- myDefaultDrawer->SetHLRDeviationCoefficient (anOutDefl);
-}
-
-//=======================================================================
-//function : HLRAngle
-//purpose :
-//=======================================================================
-Standard_Real AIS_InteractiveContext::HLRAngle() const
-{
- return myDefaultDrawer->HLRAngle();
-}
-
//=======================================================================
//function : SetDisplayMode
//purpose :
}
}
-//=======================================================================
-//function : redisplayPrsRecModes
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj->RecomputeEveryPrs())
- {
- theIObj->Update (Standard_True);
- theIObj->UpdateSelection();
- }
- else
- {
- for (TColStd_ListIteratorOfListOfInteger aModes (theIObj->ListOfRecomputeModes()); aModes.More(); aModes.Next())
- {
- theIObj->Update (aModes.Value(), Standard_False);
- }
- theIObj->UpdateSelection();
- theIObj->SetRecomputeOk();
- }
-
- if (theToUpdateViewer)
- {
- UpdateCurrentViewer();
- }
-}
-
-//=======================================================================
-//function : redisplayPrsModes
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj->RecomputeEveryPrs())
- {
- theIObj->Update (Standard_True);
- theIObj->UpdateSelection();
- }
- else
- {
- TColStd_ListOfInteger aModes;
- theIObj->ToBeUpdated (aModes);
- for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
- {
- theIObj->Update (aModeIter.Value(), Standard_False);
- }
- theIObj->SetRecomputeOk();
- }
-
- if (theToUpdateViewer)
- {
- UpdateCurrentViewer();
- }
-}
-
//=======================================================================
//function : SetColor
//purpose :
setContextToObject (theIObj);
theIObj->SetColor (theColor);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetOwnDeviationCoefficient (theCoefficient);
- redisplayPrsModes (theIObj, theToUpdateViewer);
-}
-
-//=======================================================================
-//function : SetHLRDeviationCoefficient
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Real theCoefficient,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj.IsNull())
- {
- return;
- }
-
- // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
- setContextToObject (theIObj);
- if (theIObj->Type() != AIS_KOI_Object
- && theIObj->Type() != AIS_KOI_Shape)
- {
- return;
- }
- else if (theIObj->Signature() != 0)
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
{
- return;
+ UpdateCurrentViewer();
}
-
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
- aShape->SetOwnHLRDeviationCoefficient (theCoefficient);
- redisplayPrsModes (theIObj, theToUpdateViewer);
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetOwnDeviationAngle (theAngle);
- redisplayPrsModes (theIObj, theToUpdateViewer);
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
aShape->SetAngleAndDeviation (theAngle);
-
- if (theIObj->RecomputeEveryPrs())
- {
- theIObj->Update (Standard_True);
- theIObj->UpdateSelection();
- }
- else
- {
- Update (theIObj, theToUpdateViewer);
- }
-}
-
-//=======================================================================
-//function : SetHLRAngleAndDeviation
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Real theAngle,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj.IsNull())
- {
- return;
- }
-
- // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
- setContextToObject (theIObj);
- if (theIObj->Type() != AIS_KOI_Shape)
- {
- return;
- }
- if (theIObj->Signature() != 0)
- {
- return;
- }
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
- aShape->SetHLRAngleAndDeviation (theAngle);
- redisplayPrsModes (theIObj, theToUpdateViewer);
-}
-
-//=======================================================================
-//function : SetHLRDeviationAngle
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
- const Standard_Real theAngle,
- const Standard_Boolean theToUpdateViewer)
-{
- if (theIObj.IsNull())
- {
- return;
- }
-
- // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
- setContextToObject (theIObj);
- if (theIObj->Type() != AIS_KOI_Shape)
- {
- return;
- }
- if (theIObj->Signature() != 0)
+ aShape->UpdatePresentations();
+ if (theToUpdateViewer)
{
- return;
+ UpdateCurrentViewer();
}
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
- aShape->SetOwnHLRDeviationAngle (theAngle);
- redisplayPrsModes (theIObj, theToUpdateViewer);
}
//=======================================================================
}
theIObj->UnsetColor();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
setContextToObject (theIObj);
theIObj->SetWidth (theWidth);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
- if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
+ theIObj->UpdatePresentations();
+ if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (theIObj))
{
- if (myLastinMain->IsAutoHilight())
+ if (myLastPicked->IsAutoHilight())
{
const Standard_Integer aHiMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
- myLastinMain->HilightWithColor (myMainPM,
- myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
+ myLastPicked->HilightWithColor (myMainPM,
+ myLastPicked->IsSelected() ? getSelStyle (theIObj, myLastPicked) : getHiStyle (theIObj, myLastPicked),
aHiMode);
}
else
{
theIObj->HilightOwnerWithColor (myMainPM,
- myLastinMain->IsSelected() ? getSelStyle (theIObj, myLastinMain) : getHiStyle (theIObj, myLastinMain),
- myLastinMain);
+ myLastPicked->IsSelected() ? getSelStyle (theIObj, myLastPicked) : getHiStyle (theIObj, myLastPicked),
+ myLastPicked);
}
}
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->UnsetWidth();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
setContextToObject (theIObj);
theIObj->SetMaterial (theMaterial);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
return;
}
theIObj->UnsetMaterial();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->SetTransparency (theValue);
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
}
theIObj->UnsetTransparency();
- redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ theIObj->UpdatePresentations();
+ if (theToUpdateViewer)
+ {
+ UpdateCurrentViewer();
+ }
}
//=======================================================================
void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
const Standard_Boolean theToUpdateViewer)
{
+ Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
anObj->SetAspect (theAspect);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
if (isFound && theToUpdateViewer)
{
void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateviewer)
{
+ Handle(AIS_GlobalStatus) aStatus;
if (theIObj.IsNull()
- || !myObjects.IsBound (theIObj))
+ || !myObjects.Find (theIObj, aStatus)
+ || aStatus->GraphicStatus() == AIS_DS_Erased)
{
return;
}
- Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
- if (aStatus->GraphicStatus() == AIS_DS_Erased)
- {
- return;
- }
-
- if (aStatus->IsHilighted())
- {
- Standard_DISABLE_DEPRECATION_WARNINGS
- if (IsCurrent (theIObj))
- {
- AddOrRemoveCurrentObject (theIObj, Standard_False);
- }
- else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
- {
- unhighlightGlobal (theIObj);
- }
- Standard_ENABLE_DEPRECATION_WARNINGS
- }
-
+ unselectOwners (theIObj);
myMainPM->SetVisibility (theIObj, aStatus->DisplayMode(), Standard_False);
- if (aStatus->IsHilighted()
- && theIObj->HasHilightMode())
- {
- unhighlightGlobal (theIObj);
- }
-
if (!myLastPicked.IsNull()
&& myLastPicked->IsSameSelectable (theIObj))
{
}
//=======================================================================
-//function : unhighlightOwners
+//function : unselectOwners
//purpose :
//=======================================================================
-void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
+void AIS_InteractiveContext::unselectOwners (const Handle(AIS_InteractiveObject)& theObject)
{
SelectMgr_SequenceOfOwner aSeq;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateviewer)
{
+ Handle(AIS_GlobalStatus) aStatus;
if (theIObj.IsNull()
- || !myObjects.IsBound (theIObj))
+ || !myObjects.Find (theIObj, aStatus))
{
// for cases when reference shape of connected interactives was not displayed
// but its selection primitives were calculated
return;
}
- Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
- unhighlightOwners (theIObj);
+ unselectOwners (theIObj);
myMainPM->Erase (theIObj, -1);
theIObj->ErasePresentations (true); // make sure highlighting presentations are properly erased
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())
aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
}
- if (!myLastinMain.IsNull())
+ if (!myLastPicked.IsNull())
{
- if (myLastinMain->IsSameSelectable (theIObj)
- || myLastPicked->IsSameSelectable(theIObj))
+ if (myLastPicked->IsSameSelectable (theIObj))
{
clearDynamicHighlight();
- myLastinMain.Nullify();
myLastPicked.Nullify();
}
}
myCurDetected = 0;
myCurHighlighted = 0;
myDetectedSeq.Clear();
- myLastPicked = myLastinMain;
- myWasLastMain = Standard_True;
Standard_Boolean toUpdate = Standard_False;
if (!myLastPicked.IsNull() && myLastPicked->HasSelectable())
{
toUpdate = Standard_True;
clearDynamicHighlight();
}
- myLastinMain.Nullify();
myLastPicked.Nullify();
myMainSel->ClearPicked();
if (toUpdate && theToRedrawImmediate)
{
Handle(AIS_MultipleConnectedInteractive) theObj (Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly));
theObj->Disconnect (theObjToDisconnect);
+ if (!myObjects.IsBound (theObjToDisconnect))
+ {
+ // connected presentation might contain displayed presentations
+ myMainPM->Erase (theObjToDisconnect, -1);
+ theObjToDisconnect->ErasePresentations (true);
+ }
+
const Handle(SelectMgr_SelectableObject)& anObj = theObjToDisconnect; // to avoid ambiguity
mgrSelector->Remove (anObj);
}
}
//=======================================================================
-//function : FitSelected
-//purpose : Fits the view corresponding to the bounds of selected objects
+//function : BoundingBoxOfSelection
+//purpose :
//=======================================================================
-void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
- const Standard_Real theMargin,
- const Standard_Boolean theToUpdate)
+Bnd_Box AIS_InteractiveContext::BoundingBoxOfSelection() const
{
Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap;
aBndSelected.Add (aTmpBox);
}
- anObjectOwnerMap.Clear();
-
- if (aBndSelected.IsVoid())
- return;
+ return aBndSelected;
+}
- theView->FitAll (aBndSelected, theMargin, theToUpdate);
+//=======================================================================
+//function : FitSelected
+//purpose : Fits the view corresponding to the bounds of selected objects
+//=======================================================================
+void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
+ const Standard_Real theMargin,
+ const Standard_Boolean theToUpdate)
+{
+ Bnd_Box aBndSelected = BoundingBoxOfSelection();
+ if (!aBndSelected.IsVoid())
+ {
+ theView->FitAll (aBndSelected, theMargin, theToUpdate);
+ }
}
//=======================================================================
anActiveViewIter.Value()->View()->InvalidateZLayerBoundingBox (aLayerId);
}
}
+
+//=======================================================================
+//function : GravityPoint
+//purpose :
+//=======================================================================
+gp_Pnt AIS_InteractiveContext::GravityPoint (const Handle(V3d_View)& theView) const
+{
+ 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);
+ }
+}