#include <V3d_View.hxx>
#include <Standard_Version.hxx>
#include <Standard_DefineHandle.hxx>
-NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject));
+
+NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject))
DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
//! Constructs a manipulator object with input location and positions of axes and all parts to be displayed.
Standard_EXPORT AIS_Manipulator (const gp_Ax2& thePosition);
- //! Destructor.
- Standard_EXPORT virtual ~AIS_Manipulator() {}
-
//! Disable or enable visual parts for translation, rotation or scaling for some axis.
//! By default all parts are enabled (will be displayed).
//! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation (selection) mode.
//! @warning Raises program error if axis index is < 0 or > 2.
Standard_EXPORT void SetPart (const Standard_Integer theAxisIndex, const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled);
+ //! Disable or enable visual parts for translation, rotation or scaling for ALL axes.
+ //! By default all parts are enabled (will be displayed).
+ //! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation (selection) mode.
+ //! @warning Raises program error if axis index is < 0 or > 2.
+ Standard_EXPORT void SetPart (const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled);
+
//! Behavior settings to be applied when performing transformation:
//! - FollowTranslation - whether the manipulator will be moved together with an object.
//! - FollowRotation - whether the manipulator will be rotated together with an object.
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
+ Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; }
+
//! @return poition of manipulator interactive object.
const gp_Ax2& Position() const { return myPosition; }
//! - FollowRotation - whether the manipulator will be rotated together with an object.
struct BehaviorOnTransform {
- BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True) {}
+ BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True), FollowDragging (Standard_True) {}
BehaviorOnTransform& SetFollowTranslation (const Standard_Boolean theApply) { FollowTranslation = theApply; return *this; }
BehaviorOnTransform& SetFollowRotation (const Standard_Boolean theApply) { FollowRotation = theApply; return *this; }
+ BehaviorOnTransform& SetFollowDragging (const Standard_Boolean theApply) { FollowDragging = theApply; return *this; }
Standard_Boolean FollowTranslation;
Standard_Boolean FollowRotation;
+ Standard_Boolean FollowDragging;
};
//! Sets behavior settings for transformation action carried on the manipulator,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
- Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
+ virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
{
return Standard_False;
}
//! without need for recomputing presentation.
//! @warning Invokes debug assertion in debug to catch incompatible usage of the
//! method, silently does nothing in release mode.
- Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
+ Standard_EXPORT virtual void setLocalTransformation (const Handle(TopLoc_Datum3D)& theTrsf) Standard_OVERRIDE;
using AIS_InteractiveObject::SetLocalTransformation; // hide visibility
protected: //! @name Auxiliary classes to fill presentation with proper primitives
Handle(Graphic3d_ArrayOfTriangles) myArray;
};
+ class Sector : public Quadric
+ {
+ public:
+
+ Sector()
+ : Quadric(),
+ myRadius(0.0f)
+ { }
+
+ ~Sector() { }
+
+ void Init(const Standard_ShortReal theRadius,
+ const gp_Ax1& thePosition,
+ const gp_Dir& theXDirection,
+ const Standard_Integer theSlicesNb = 5,
+ const Standard_Integer theStacksNb = 5);
+
+ protected:
+
+ gp_Ax1 myPosition;
+ Standard_ShortReal myRadius;
+ };
+
//! The class describes on axis sub-object.
//! It includes sub-objects itself:
//! -rotator
{
myHighlightRotator->SetTransformPersistence (theTrsfPers);
}
+
+ if (!myHighlightDragger.IsNull())
+ {
+ myHighlightDragger->SetTransformPersistence(theTrsfPers);
+ }
}
- void Transform (const Handle(Geom_Transformation)& theTransformation)
+ void Transform (const Handle(TopLoc_Datum3D)& theTransformation)
{
if (!myHighlightTranslator.IsNull())
{
{
myHighlightRotator->SetTransformation (theTransformation);
}
+
+ if (!myHighlightDragger.IsNull())
+ {
+ myHighlightDragger->SetTransformation(theTransformation);
+ }
}
Standard_Boolean HasTranslation() const { return myHasTranslation; }
Standard_Boolean HasScaling() const { return myHasScaling; }
+ Standard_Boolean HasDragging() const { return myHasDragging; }
+
void SetTranslation (const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
void SetRotation (const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
+ void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
+
Quantity_Color Color() const { return myColor; }
Standard_ShortReal AxisLength() const { return myLength; }
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
+ const Handle(Prs3d_Presentation)& DraggerHighlightPrs() const { return myHighlightDragger; }
+
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
+ const Handle(Graphic3d_Group)& DraggerGroup() const { return myDraggerGroup; }
+
const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
public:
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
+ const Sector& DraggerSector() const { return mySector; }
const Disk& RotatorDisk() const { return myCircle; }
float RotatorDiskRadius() const { return myCircleRadius; }
const Cube& ScalerCube() const { return myCube; }
Standard_ShortReal myDiskThickness;
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
+ Standard_Boolean myHasDragging;
+
protected:
Standard_Integer myFacettesNumber;
gp_Pnt myArrowTipPos;
+ Sector mySector;
Disk myCircle;
float myCircleRadius;
Cube myCube;
Handle(Graphic3d_Group) myTranslatorGroup;
Handle(Graphic3d_Group) myScalerGroup;
Handle(Graphic3d_Group) myRotatorGroup;
+ Handle(Graphic3d_Group) myDraggerGroup;
Handle(Prs3d_Presentation) myHighlightTranslator;
Handle(Prs3d_Presentation) myHighlightScaler;
Handle(Prs3d_Presentation) myHighlightRotator;
+ Handle(Prs3d_Presentation) myHighlightDragger;
Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
//! Aspect used to color current detected part and current selected part.
Handle(Prs3d_ShadingAspect) myHighlightAspect;
+
+ //! Aspect used to color sector part when it's selected.
+ Handle(Prs3d_ShadingAspect) myDraggerHighlight;
public:
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)