myCurrentMode (AIS_MM_None),
myIsActivationOnDetection (Standard_False),
myIsZoomPersistentMode (Standard_True),
- myIsFlatMode (Standard_False),
+ mySkinMode (AIS_SM_Shaded),
myHasStartedTransformation (Standard_False),
myStartPosition (gp::XOY()),
myStartPick (0.0, 0.0, 0.0),
myCurrentMode (AIS_MM_None),
myIsActivationOnDetection (Standard_False),
myIsZoomPersistentMode (Standard_True),
- myIsFlatMode (Standard_False),
+ mySkinMode (AIS_SM_Shaded),
myHasStartedTransformation (Standard_False),
myStartPosition (gp::XOY()),
myStartPick (0.0, 0.0, 0.0),
}
//=======================================================================
-//function : SetFlatMode
+//function : SetSkinMode
//purpose :
//=======================================================================
-void AIS_Manipulator::SetFlatMode (const Standard_Boolean theIsFlatMode)
+void AIS_Manipulator::SetSkinMode (const AIS_SkinMode theSkinMode)
{
- if (myIsFlatMode != theIsFlatMode)
+ if (mySkinMode != theSkinMode)
{
SetToUpdate();
}
- myIsFlatMode = theIsFlatMode;
+ mySkinMode = theSkinMode;
}
//=======================================================================
anAspect->SetTransparency (myDrawer->ShadingAspect()->Transparency());
// Display center
- myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin(), myIsFlatMode);
+ myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin(), mySkinMode);
aGroup = thePrs->NewGroup ();
aGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (myCenter.Array());
Handle(Prs3d_ShadingAspect) anAspectAx = new Prs3d_ShadingAspect (new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
anAspectAx->SetColor (myAxes[anIt].Color());
aGroup->SetGroupPrimitivesAspect (anAspectAx->Aspect());
- myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx, myIsFlatMode);
+ myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx, mySkinMode);
myAxes[anIt].SetTransformPersistence (TransformPersistence());
}
return;
}
- if (anOwner->Mode() == AIS_MM_TranslationPlane && !myIsFlatMode)
+ if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == AIS_SM_Shaded)
{
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
- if (anOwner->Mode() == AIS_MM_TranslationPlane && !myIsFlatMode)
+ if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == AIS_SM_Shaded)
{
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
aStyle->SetColor (myAxes[anOwner->Index()].Color());
const Axis& anAxis = myAxes[anIt];
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
- if (!myIsFlatMode)
+ if (mySkinMode == AIS_SM_Shaded)
{
// define sensitivity by line
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
{
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
- if (!myAxes[anIt].HasRotation() || myIsFlatMode)
+ if (!myAxes[anIt].HasRotation() || mySkinMode == AIS_SM_Flat)
{
continue;
}
{
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
- if (!myAxes[anIt].HasScaling() || myIsFlatMode)
+ if (!myAxes[anIt].HasScaling() || mySkinMode == AIS_SM_Flat)
{
continue;
}
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
- if (!myIsFlatMode)
+ if (mySkinMode == AIS_SM_Shaded)
{
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
aLine1->SetSensitivityFactor(10);
//=======================================================================
void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
const gp_Pnt& thePosition,
- const Standard_Boolean theIsFlatSkinMode,
+ const AIS_SkinMode theSkinMode,
const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb)
{
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
- if (theIsFlatSkinMode)
+ if (theSkinMode == AIS_SM_Flat)
{
myArray = new Graphic3d_ArrayOfTriangles (3, 3, Graphic3d_ArrayFlags_VertexNormal);
myTriangulation = new Poly_Triangulation (3, 1, Standard_False);
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
- const Standard_Boolean theIsFlatSkinMode,
+ const AIS_SkinMode theSkinMode,
const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb)
{
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
- if (theIsFlatSkinMode)
+ if (theSkinMode == AIS_SM_Flat)
{
myArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal);
myTriangulation = new Poly_Triangulation (4, 2, Standard_False);
void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect,
- const Standard_Boolean theIsFlatSkinMode)
+ const AIS_SkinMode theSkinMode)
{
if (myHasTranslation)
{
const Standard_Real aCylinderLength = myLength - anArrowLength;
myArrowTipPos = gp_Pnt (0.0, 0.0, 0.0).Translated (myReferenceAxis.Direction().XYZ() * aCylinderLength);
- if (theIsFlatSkinMode)
+ if (theSkinMode == AIS_SM_Flat)
{
myTriangleArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal);
const Standard_Integer aSign = myReferenceAxis.Direction().X() > 0 ? -1 : 1;
}
myTranslatorGroup = thePrs->NewGroup();
- myTranslatorGroup->SetClosed (!theIsFlatSkinMode);
+ myTranslatorGroup->SetClosed (theSkinMode == AIS_SM_Shaded);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
}
}
- if (myHasScaling && !theIsFlatSkinMode)
+ if (myHasScaling && theSkinMode == AIS_SM_Shaded)
{
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
}
}
- if (myHasRotation && !theIsFlatSkinMode)
+ if (myHasRotation && theSkinMode == AIS_SM_Shaded)
{
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
else
aXDirection = gp::DX();
- gp_Pnt aPosition = theIsFlatSkinMode ? gp_Pnt (myReferenceAxis.Direction().XYZ() * (-myAxisRadius)) : gp::Origin();
- Standard_ShortReal aRadius = theIsFlatSkinMode ? myLength : myInnerRadius + myIndent * 2;
- mySector.Init (aRadius, gp_Ax1 (aPosition, myReferenceAxis.Direction()), aXDirection, theIsFlatSkinMode, myFacettesNumber * 2);
+ gp_Pnt aPosition = theSkinMode == AIS_SM_Flat ? gp_Pnt (myReferenceAxis.Direction().XYZ() * (-myAxisRadius)) : gp::Origin();
+ Standard_ShortReal aRadius = theSkinMode == AIS_SM_Flat ? myLength : myInnerRadius + myIndent * 2;
+ mySector.Init (aRadius, gp_Ax1 (aPosition, myReferenceAxis.Direction()), aXDirection, theSkinMode, myFacettesNumber * 2);
myDraggerGroup = thePrs->NewGroup();
- Handle(Graphic3d_AspectFillArea3d) aFillArea = theIsFlatSkinMode
+ Handle(Graphic3d_AspectFillArea3d) aFillArea = theSkinMode == AIS_SM_Flat
? theAspect->Aspect()
: new Graphic3d_AspectFillArea3d();
//! Returns state of zoom persistence mode, whether it turned on or off.
Standard_Boolean ZoomPersistence() const { return myIsZoomPersistentMode; }
- //! Enable or disable flat skin mode for the manipulator.
- Standard_EXPORT void SetFlatMode (const Standard_Boolean theIsFlatMode);
-
- //! Returns state of flat skin mode, whether it turned on or off.
- Standard_Boolean IsFlatMode() const { return myIsFlatMode; }
-
//! Redefines transform persistence management to setup transformation for sub-presentation of axes.
//! @warning this interactive object does not support custom transformation persistence when
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
public: //! @name Setters for parameters
+ enum AIS_SkinMode
+ {
+ AIS_SM_Shaded,
+ AIS_SM_Flat
+ };
+
+ //! @return current manipulator skin mode.
+ AIS_SkinMode SkinMode() const { return mySkinMode; }
+
+ //! Sets skin mode for the manipulator.
+ Standard_EXPORT void SetSkinMode (const AIS_SkinMode theSkinMode);
+
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; }
void Init (const Standard_ShortReal theRadius,
const gp_Pnt& thePosition,
- const Standard_Boolean theIsFlatSkinMode = Standard_False,
+ const AIS_SkinMode theSkinMode = AIS_SM_Shaded,
const Standard_Integer theSlicesNb = 20,
const Standard_Integer theStacksNb = 20);
void Init(const Standard_ShortReal theRadius,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
- const Standard_Boolean theIsFlatSkinMode = Standard_False,
+ const AIS_SkinMode theSkinMode = AIS_SM_Shaded,
const Standard_Integer theSlicesNb = 5,
const Standard_Integer theStacksNb = 5);
void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect,
- const Standard_Boolean theIsFlatSkinMode = Standard_False);
+ const AIS_SkinMode theSkinMode = AIS_SM_Shaded);
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
+ AIS_SkinMode mySkinMode; //!< Name of active skin mode.
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
- Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
- Standard_Boolean myIsFlatMode; //!< Flat skin mode activation.
- BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
+ Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
+ BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
protected: //! @name Fields for interactive transformation. Fields only for internal needs. They do not have public interface.