From: nds Date: Mon, 21 Oct 2019 12:57:45 +0000 (+0300) Subject: 0031085: Visualization - possibility to use BRep text in AIS_ViewCube X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=6ad942b2880d1659d29dfd59b4e513b1596a4926;p=occt-copy.git 0031085: Visualization - possibility to use BRep text in AIS_ViewCube --- diff --git a/src/AIS/AIS_ViewCube.cxx b/src/AIS/AIS_ViewCube.cxx index 9460320d8b..d5477da915 100644 --- a/src/AIS/AIS_ViewCube.cxx +++ b/src/AIS/AIS_ViewCube.cxx @@ -776,6 +776,8 @@ Standard_Real AIS_ViewCube::ArrowTransparency() const void AIS_ViewCube::SetInnerColor (const Quantity_Color& theColor) { myDrawer->ShadingAspect()->SetColor (theColor, Aspect_TOFM_BACK_SIDE); + myArrowAspect->SetColor (theColor, Aspect_TOFM_BACK_SIDE); + SetToUpdate(); } @@ -1612,6 +1614,7 @@ void AIS_ViewCube::ToolRectangle::FillArray (Handle(Graphic3d_ArrayOfTriangles)& #include #include #include +#include void displayBRepText (const Handle(Graphic3d_Group)& theTextGroup, const Handle(Prs3d_TextAspect)& theTextAspect, const Handle(Prs3d_Presentation)& thePresentation, @@ -1712,10 +1715,9 @@ void displayBRepText (const Handle(Graphic3d_Group)& theTextGroup, //Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_True, aFlippingAxes); // draw text - //if (myDrawer->DimensionAspect()->IsTextShaded()) + if (myDrawer->DimensionAspect()->IsTextShaded()) { Handle(Prs3d_ShadingAspect) aCurShadingAspect = myDrawer->ShadingAspect(); - Standard_Real aDeviation = myDrawer->DeviationCoefficient();//SetDeviationCoefficient // Setting text shading and color parameters myDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); @@ -1728,31 +1730,21 @@ void displayBRepText (const Handle(Graphic3d_Group)& theTextGroup, myDrawer->ShadingAspect()->Aspect()->SetBackInteriorColor (aColor); myDrawer->ShadingAspect()->SetMaterial (aShadeMat); - //myDrawer->SetDeviationCoefficient (0.000001); - - // drawing text - //BRepMesh_IncrementalMesh aMesh(aTextShape, 0.00001, Standard_False, 0.00001); - StdPrs_ShadedShape::Add (thePresentation, aTextShape, myDrawer); // restore drawer shading parameters myDrawer->SetShadingAspect (aCurShadingAspect); - myDrawer->SetDeviationCoefficient (aDeviation); } - //else - //{ - //// Setting color for text - //if (!myDrawer->HasOwnFreeBoundaryAspect()) - //{ - // myDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (aColor, Aspect_TOL_SOLID, 1.0)); - //} + else + { + Handle(Prs3d_LineAspect) aCurLineAspect = myDrawer->FreeBoundaryAspect(); + myDrawer->FreeBoundaryAspect()->Aspect()->SetColor (aColor); - //myDrawer->FreeBoundaryAspect()->Aspect()->SetColor (aColor); + // drawing text + StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer); - //// drawing text - //StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer); - //} - //Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_False, gp_Ax2()); + myDrawer->SetFreeBoundaryAspect (aCurLineAspect); + } } //======================================================================= diff --git a/src/AIS/AIS_ViewCube.hxx b/src/AIS/AIS_ViewCube.hxx index 7f620b39a6..bce086ded0 100644 --- a/src/AIS/AIS_ViewCube.hxx +++ b/src/AIS/AIS_ViewCube.hxx @@ -326,6 +326,9 @@ public: //! @name Style management API //! @return value of transparency for 2D part of object. Standard_EXPORT Standard_Real ArrowTransparency() const; + //! Returns style for 2D arrows presentations. + const Handle(Prs3d_ShadingAspect)& ArrowAspect() const { return myArrowAspect; } + //! Set color of sides back material. //! @code Attributes()->ShadingAspect()->Aspect()->ChangeBackMaterial().SetColor() @endcode //! can be used instead