1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028954: Visualization - implement interactive object for camera manipulations

Added new class AIS_ViewCube implementing interactive cube
displaying orientation of the main axes of the model space in the viewer.
Each side, edge, or corner of the cube corresponds to particular orientation of the camera,
and the class provides methods to move the camera to corresponding position (with animation if needed).

AIS_InteractiveContext::LastActiveView(), added new property returning the last View processed by MoveTo() event.
AIS_InteractiveContext::BoundingBoxOfSelection(), added method returning bounding box of selected objects.
SelectMgr_EntityOwner::HandleMouseClick(), added new callback for handling
mouse clicks by owner itself without automatic highlighting and clearing previous selection.
Called by AIS_InteractiveContext::Select() method.

AIS_ViewController::ViewAnimation() has been extened with camera animation propery,
which can be bound to AIS_ViewCube for smooth embedding into event loop.

Prs3d_ToolDisk has been extended with parameters specifying angle range.
Graphic3d_MaterialAspect now initializes all coefficients to 1.0
when Graphic3d_NOM_UserDefined is passed to class constructor.
AIS_AnimationCamera::update() now sets the end camera position if animation duration is 0.
Prs3d_DatumAspect, added missing setters.

New command vviewcube has been added.
This commit is contained in:
aba
2019-07-03 12:37:36 +03:00
committed by bugmaster
parent e8dec5e171
commit 2108d9a25b
22 changed files with 2129 additions and 32 deletions

View File

@@ -187,6 +187,29 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
}
}
//=======================================================================
//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 :
@@ -2447,12 +2470,10 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView)
}
//=======================================================================
//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;
@@ -2491,12 +2512,22 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
aBndSelected.Add (aTmpBox);
}
anObjectOwnerMap.Clear();
return aBndSelected;
}
if (aBndSelected.IsVoid())
return;
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);
}
}
//=======================================================================