]> OCCT Git - occt-copy.git/commitdiff
0031085: Visualization - possibility to use BRep text in AIS_ViewCube
authornds <nds@opencascade.com>
Mon, 21 Oct 2019 12:57:45 +0000 (15:57 +0300)
committernds <nds@opencascade.com>
Mon, 21 Oct 2019 12:57:45 +0000 (15:57 +0300)
src/AIS/AIS_ViewCube.cxx
src/AIS/AIS_ViewCube.hxx

index 9460320d8b2853ad29c5107884d4c00a0d4ed91c..d5477da915cbc1f3507f2dede2738f293d39ec52 100644 (file)
@@ -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 <Font_BRepFont.hxx>
 #include <Font_BRepTextBuilder.hxx>
 #include <BRepBndLib.hxx>
+#include <StdPrs_WFShape.hxx>
 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);
+  }
 }
 
 //=======================================================================
index 7f620b39a6b4e6712f0254a56917919e7cc68be1..bce086ded003b168b9d5fb395dff60e0b79e87ee 100644 (file)
@@ -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