1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

remarks from kgv

This commit is contained in:
mzernova
2020-09-30 10:21:41 +03:00
parent 5c9a669080
commit fb390c0ef0
3 changed files with 31 additions and 31 deletions

View File

@@ -225,7 +225,7 @@ AIS_Manipulator::AIS_Manipulator()
myCurrentMode (AIS_MM_None), myCurrentMode (AIS_MM_None),
myIsActivationOnDetection (Standard_False), myIsActivationOnDetection (Standard_False),
myIsZoomPersistentMode (Standard_True), myIsZoomPersistentMode (Standard_True),
mySkinMode (AIS_SM_Shaded), mySkinMode (ManipulatorSkin_Shaded),
myHasStartedTransformation (Standard_False), myHasStartedTransformation (Standard_False),
myStartPosition (gp::XOY()), myStartPosition (gp::XOY()),
myStartPick (0.0, 0.0, 0.0), myStartPick (0.0, 0.0, 0.0),
@@ -247,7 +247,7 @@ AIS_Manipulator::AIS_Manipulator (const gp_Ax2& thePosition)
myCurrentMode (AIS_MM_None), myCurrentMode (AIS_MM_None),
myIsActivationOnDetection (Standard_False), myIsActivationOnDetection (Standard_False),
myIsZoomPersistentMode (Standard_True), myIsZoomPersistentMode (Standard_True),
mySkinMode (AIS_SM_Shaded), mySkinMode (ManipulatorSkin_Shaded),
myHasStartedTransformation (Standard_False), myHasStartedTransformation (Standard_False),
myStartPosition (gp::XOY()), myStartPosition (gp::XOY()),
myStartPick (0.0, 0.0, 0.0), myStartPick (0.0, 0.0, 0.0),
@@ -930,7 +930,7 @@ void AIS_Manipulator::SetZoomPersistence (const Standard_Boolean theToEnable)
//function : SetSkinMode //function : SetSkinMode
//purpose : //purpose :
//======================================================================= //=======================================================================
void AIS_Manipulator::SetSkinMode (const AIS_SkinMode theSkinMode) void AIS_Manipulator::SetSkinMode (const ManipulatorSkin theSkinMode)
{ {
if (mySkinMode != theSkinMode) if (mySkinMode != theSkinMode)
{ {
@@ -1049,7 +1049,7 @@ void AIS_Manipulator::HilightSelected (const Handle(PrsMgr_PresentationManager3d
return; return;
} }
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == AIS_SM_Shaded) if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
{ {
myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color()); myDraggerHighlight->SetColor(myAxes[anOwner->Index()].Color());
aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect()); aGroup->SetGroupPrimitivesAspect(myDraggerHighlight->Aspect());
@@ -1087,7 +1087,7 @@ void AIS_Manipulator::HilightOwnerWithColor (const Handle(PrsMgr_PresentationMan
aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this)); aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == AIS_SM_Shaded) if (anOwner->Mode() == AIS_MM_TranslationPlane && mySkinMode == ManipulatorSkin_Shaded)
{ {
Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer(); Handle(Prs3d_Drawer) aStyle = new Prs3d_Drawer();
aStyle->SetColor (myAxes[anOwner->Index()].Color()); aStyle->SetColor (myAxes[anOwner->Index()].Color());
@@ -1149,7 +1149,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
const Axis& anAxis = myAxes[anIt]; const Axis& anAxis = myAxes[anIt];
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9); anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
if (mySkinMode == AIS_SM_Shaded) if (mySkinMode == ManipulatorSkin_Shaded)
{ {
// define sensitivity by line // define sensitivity by line
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition()); Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
@@ -1168,7 +1168,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
{ {
for (Standard_Integer anIt = 0; anIt < 3; ++anIt) for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{ {
if (!myAxes[anIt].HasRotation() || mySkinMode == AIS_SM_Flat) if (!myAxes[anIt].HasRotation() || mySkinMode == ManipulatorSkin_Flat)
{ {
continue; continue;
} }
@@ -1190,7 +1190,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
{ {
for (Standard_Integer anIt = 0; anIt < 3; ++anIt) for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{ {
if (!myAxes[anIt].HasScaling() || mySkinMode == AIS_SM_Flat) if (!myAxes[anIt].HasScaling() || mySkinMode == ManipulatorSkin_Flat)
{ {
continue; continue;
} }
@@ -1222,7 +1222,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition(); aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0; gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
if (mySkinMode == AIS_SM_Shaded) if (mySkinMode == ManipulatorSkin_Shaded)
{ {
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2); Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
aLine1->SetSensitivityFactor(10); aLine1->SetSensitivityFactor(10);
@@ -1269,7 +1269,7 @@ void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
//======================================================================= //=======================================================================
void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius, void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
const gp_Pnt& thePosition, const gp_Pnt& thePosition,
const AIS_SkinMode theSkinMode, const ManipulatorSkin theSkinMode,
const Standard_Integer theSlicesNb, const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb) const Standard_Integer theStacksNb)
{ {
@@ -1279,7 +1279,7 @@ void AIS_Manipulator::Sphere::Init (const Standard_ShortReal theRadius,
gp_Trsf aTrsf; gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition)); aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
if (theSkinMode == AIS_SM_Flat) if (theSkinMode == ManipulatorSkin_Flat)
{ {
myArray = new Graphic3d_ArrayOfTriangles (3, 3, Graphic3d_ArrayFlags_VertexNormal); myArray = new Graphic3d_ArrayOfTriangles (3, 3, Graphic3d_ArrayFlags_VertexNormal);
myTriangulation = new Poly_Triangulation (3, 1, Standard_False); myTriangulation = new Poly_Triangulation (3, 1, Standard_False);
@@ -1390,7 +1390,7 @@ void AIS_Manipulator::Cube::addTriangle (const Standard_Integer theIndex,
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius, void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
const gp_Ax1& thePosition, const gp_Ax1& thePosition,
const gp_Dir& theXDirection, const gp_Dir& theXDirection,
const AIS_SkinMode theSkinMode, const ManipulatorSkin theSkinMode,
const Standard_Integer theSlicesNb, const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb) const Standard_Integer theStacksNb)
{ {
@@ -1398,7 +1398,7 @@ void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
gp_Trsf aTrsf; gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3()); aTrsf.SetTransformation (aSystem, gp_Ax3());
if (theSkinMode == AIS_SM_Flat) if (theSkinMode == ManipulatorSkin_Flat)
{ {
myArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal); myArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal);
myTriangulation = new Poly_Triangulation (4, 2, Standard_False); myTriangulation = new Poly_Triangulation (4, 2, Standard_False);
@@ -1471,7 +1471,7 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect, const Handle(Prs3d_ShadingAspect)& theAspect,
const AIS_SkinMode theSkinMode) const ManipulatorSkin theSkinMode)
{ {
if (myHasTranslation) if (myHasTranslation)
{ {
@@ -1479,7 +1479,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
const Standard_Real aCylinderLength = myLength - anArrowLength; const Standard_Real aCylinderLength = myLength - anArrowLength;
myArrowTipPos = gp_Pnt (0.0, 0.0, 0.0).Translated (myReferenceAxis.Direction().XYZ() * aCylinderLength); myArrowTipPos = gp_Pnt (0.0, 0.0, 0.0).Translated (myReferenceAxis.Direction().XYZ() * aCylinderLength);
if (theSkinMode == AIS_SM_Flat) if (theSkinMode == ManipulatorSkin_Flat)
{ {
myTriangleArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal); myTriangleArray = new Graphic3d_ArrayOfTriangles (4, 6, Graphic3d_ArrayFlags_VertexNormal);
const Standard_Integer aSign = myReferenceAxis.Direction().X() > 0 ? -1 : 1; const Standard_Integer aSign = myReferenceAxis.Direction().X() > 0 ? -1 : 1;
@@ -1514,7 +1514,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
} }
myTranslatorGroup = thePrs->NewGroup(); myTranslatorGroup = thePrs->NewGroup();
myTranslatorGroup->SetClosed (theSkinMode == AIS_SM_Shaded); myTranslatorGroup->SetClosed (theSkinMode == ManipulatorSkin_Shaded);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect()); myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myTranslatorGroup->AddPrimitiveArray (myTriangleArray); myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
@@ -1533,7 +1533,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
} }
} }
if (myHasScaling && theSkinMode == AIS_SM_Shaded) if (myHasScaling && theSkinMode == ManipulatorSkin_Shaded)
{ {
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent); myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize); myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
@@ -1558,7 +1558,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
} }
} }
if (myHasRotation && theSkinMode == AIS_SM_Shaded) if (myHasRotation && theSkinMode == ManipulatorSkin_Shaded)
{ {
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f; myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2); myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
@@ -1591,12 +1591,12 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
else else
aXDirection = gp::DX(); aXDirection = gp::DX();
gp_Pnt aPosition = theSkinMode == AIS_SM_Flat ? gp_Pnt (myReferenceAxis.Direction().XYZ() * (-myAxisRadius)) : gp::Origin(); gp_Pnt aPosition = theSkinMode == ManipulatorSkin_Flat ? gp_Pnt (myReferenceAxis.Direction().XYZ() * (-myAxisRadius)) : gp::Origin();
Standard_ShortReal aRadius = theSkinMode == AIS_SM_Flat ? myLength : myInnerRadius + myIndent * 2; Standard_ShortReal aRadius = theSkinMode == ManipulatorSkin_Flat ? myLength : myInnerRadius + myIndent * 2;
mySector.Init (aRadius, gp_Ax1 (aPosition, myReferenceAxis.Direction()), aXDirection, theSkinMode, myFacettesNumber * 2); mySector.Init (aRadius, gp_Ax1 (aPosition, myReferenceAxis.Direction()), aXDirection, theSkinMode, myFacettesNumber * 2);
myDraggerGroup = thePrs->NewGroup(); myDraggerGroup = thePrs->NewGroup();
Handle(Graphic3d_AspectFillArea3d) aFillArea = theSkinMode == AIS_SM_Flat Handle(Graphic3d_AspectFillArea3d) aFillArea = theSkinMode == ManipulatorSkin_Flat
? theAspect->Aspect() ? theAspect->Aspect()
: new Graphic3d_AspectFillArea3d(); : new Graphic3d_AspectFillArea3d();

View File

@@ -268,17 +268,17 @@ public: //! @name Configuration of graphical transformations
public: //! @name Setters for parameters public: //! @name Setters for parameters
enum AIS_SkinMode enum ManipulatorSkin
{ {
AIS_SM_Shaded, ManipulatorSkin_Shaded,
AIS_SM_Flat ManipulatorSkin_Flat
}; };
//! @return current manipulator skin mode. //! @return current manipulator skin mode.
AIS_SkinMode SkinMode() const { return mySkinMode; } ManipulatorSkin SkinMode() const { return mySkinMode; }
//! Sets skin mode for the manipulator. //! Sets skin mode for the manipulator.
Standard_EXPORT void SetSkinMode (const AIS_SkinMode theSkinMode); Standard_EXPORT void SetSkinMode (const ManipulatorSkin theSkinMode);
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; } AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
@@ -440,7 +440,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
void Init (const Standard_ShortReal theRadius, void Init (const Standard_ShortReal theRadius,
const gp_Pnt& thePosition, const gp_Pnt& thePosition,
const AIS_SkinMode theSkinMode = AIS_SM_Shaded, const ManipulatorSkin theSkinMode,
const Standard_Integer theSlicesNb = 20, const Standard_Integer theSlicesNb = 20,
const Standard_Integer theStacksNb = 20); const Standard_Integer theStacksNb = 20);
@@ -488,7 +488,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
void Init(const Standard_ShortReal theRadius, void Init(const Standard_ShortReal theRadius,
const gp_Ax1& thePosition, const gp_Ax1& thePosition,
const gp_Dir& theXDirection, const gp_Dir& theXDirection,
const AIS_SkinMode theSkinMode = AIS_SM_Shaded, const ManipulatorSkin theSkinMode,
const Standard_Integer theSlicesNb = 5, const Standard_Integer theSlicesNb = 5,
const Standard_Integer theStacksNb = 5); const Standard_Integer theStacksNb = 5);
@@ -514,7 +514,7 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs, const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect, const Handle(Prs3d_ShadingAspect)& theAspect,
const AIS_SkinMode theSkinMode = AIS_SM_Shaded); const ManipulatorSkin theSkinMode);
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; } const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
@@ -700,7 +700,7 @@ protected:
Standard_Integer myCurrentIndex; //!< Index of active axis. Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode. AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
AIS_SkinMode mySkinMode; //!< Name of active skin mode. ManipulatorSkin mySkinMode; //!< Name of active skin mode.
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection). Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation. Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.

View File

@@ -13004,7 +13004,7 @@ static int VManipulator (Draw_Interpretor& theDi,
} }
if (aCmd.HasOption ("flat", 1, Standard_True)) if (aCmd.HasOption ("flat", 1, Standard_True))
{ {
aManipulator->SetSkinMode ((AIS_Manipulator::AIS_SkinMode) aCmd.ArgBool ("flat")); aManipulator->SetSkinMode ((AIS_Manipulator::ManipulatorSkin) aCmd.ArgBool ("flat"));
if (ViewerTest::GetAISContext()->IsDisplayed (aManipulator)) if (ViewerTest::GetAISContext()->IsDisplayed (aManipulator))
{ {