1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +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

@@ -43,15 +43,24 @@ public:
//! Returns the right-handed coordinate system set in SetComponent.
Standard_EXPORT Handle(Prs3d_ShadingAspect) ShadingAspect (Prs3d_DatumParts thePart) const;
//! Returns the right-handed coordinate system set in SetComponent.
//! Returns the text attributes for rendering labels.
const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
//! Sets text attributes for rendering labels.
void SetTextAspect (const Handle(Prs3d_TextAspect)& theTextAspect) { myTextAspect = theTextAspect; }
//! Returns the point aspect of origin wireframe presentation
const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; }
//! Returns the point aspect of origin wireframe presentation
void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) { myPointAspect = theAspect; }
//! Returns the arrow aspect of presentation
const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
//! Sets the arrow aspect of presentation
void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; }
//! Returns the attributes for display of the first axis.
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects.Find (Prs3d_DP_XAxis); }

View File

@@ -28,7 +28,9 @@ Prs3d_ToolDisk::Prs3d_ToolDisk (const Standard_Real theInnerRadius,
const Standard_Integer theNbSlices,
const Standard_Integer theNbStacks)
: myInnerRadius (theInnerRadius),
myOuterRadius (theOuterRadius)
myOuterRadius (theOuterRadius),
myStartAngle (0.0),
myEndAngle (M_PI * 2.0)
{
mySlicesNb = theNbSlices;
myStacksNb = theNbStacks;
@@ -40,22 +42,13 @@ Prs3d_ToolDisk::Prs3d_ToolDisk (const Standard_Real theInnerRadius,
//=======================================================================
gp_Pnt Prs3d_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV)
{
const Standard_Real aU = theU * M_PI * 2.0;
const Standard_Real aU = myStartAngle + theU * (myEndAngle - myStartAngle);
const Standard_Real aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
return gp_Pnt (Cos (aU) * aRadius,
Sin (aU) * aRadius,
0.0);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
gp_Dir Prs3d_ToolDisk::Normal (const Standard_Real /*theU*/, const Standard_Real /*theV*/)
{
return gp_Dir (0.0, 0.0, -1.0);
}
//=======================================================================
//function : Perform
//purpose :

View File

@@ -37,18 +37,31 @@ public:
const Standard_Real theOuterRadius,
const Standard_Integer theNbSlices,
const Standard_Integer theNbStacks);
//! Set angle range in radians [0, 2*PI] by default.
//! @param theStartAngle [in] Start angle in counter clockwise order
//! @param theEndAngle [in] End angle in counter clockwise order
void SetAngleRange (Standard_Real theStartAngle,
Standard_Real theEndAngle)
{
myStartAngle = theStartAngle;
myEndAngle = theEndAngle;
}
protected:
//! Computes vertex at given parameter location of the surface.
Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
//! Computes normal at given parameter location of the surface.
Standard_EXPORT virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
virtual gp_Dir Normal (const Standard_Real , const Standard_Real ) Standard_OVERRIDE { return gp_Dir (0.0, 0.0, -1.0); }
protected:
Standard_Real myInnerRadius;
Standard_Real myOuterRadius;
Standard_Real myStartAngle; //!< Start angle in counter clockwise order
Standard_Real myEndAngle; //!< End angle in counter clockwise order
};