]> OCCT Git - occt-copy.git/commitdiff
Add specific key for two-sided coloring of AIS shape in vdisplay command
authorsnn <snn@opencascade.com>
Fri, 14 Apr 2017 07:42:30 +0000 (10:42 +0300)
committeraba <aba@opencascade.com>
Mon, 11 Feb 2019 09:28:02 +0000 (12:28 +0300)
src/ViewerTest/ViewerTest.cxx

index 6f53cd3ada957cb972b1e905f8bb618871f2438f..bb1bdf54f2c975fb26e590225d4dabe18fb6bac1 100644 (file)
@@ -4178,6 +4178,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
   TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
   AIS_DisplayStatus aDispStatus = AIS_DS_None;
   Standard_Integer toDisplayInView = Standard_False;
+  Standard_Boolean isWerthSpecific = Standard_False;
   for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
   {
     const TCollection_AsciiString aName     = theArgVec[anArgIter];
@@ -4380,6 +4381,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     {
       toReDisplay = Standard_True;
     }
+    else if (aNameCase == "-werth")
+    {
+      isWerthSpecific = Standard_True;
+    }
     else if (aNameCase == "-erased"
           || aNameCase == "-load")
     {
@@ -4454,6 +4459,19 @@ static int VDisplay2 (Draw_Interpretor& theDI,
           aSelMode = aShape->GlobalSelectionMode();
         }
 
+        if ( isWerthSpecific )
+        {
+          Graphic3d_MaterialAspect aFrontMat, aBackMat;
+          Handle(Prs3d_ShadingAspect) aShAspect = new Prs3d_ShadingAspect();
+          aFrontMat = aBackMat = aShAspect->Material();
+          aFrontMat.SetColor (Quantity_NOC_BLUE1);
+          aBackMat.SetColor  (Quantity_NOC_RED);
+          aShAspect->SetMaterial (aFrontMat, Aspect_TOFM_FRONT_SIDE);
+          aShAspect->SetMaterial (aBackMat,  Aspect_TOFM_BACK_SIDE);
+          aShAspect->Aspect()->SetSuppressBackFaces (Standard_False);
+          aShape->Attributes()->SetShadingAspect (aShAspect);
+        }
+
         aCtx->Display (aShape, aDispMode, aSelMode,
                        Standard_False, aShape->AcceptShapeDecomposition(),
                        aDispStatus);
@@ -5890,7 +5908,8 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:               (DY looks up)"
       "\n\t\t:  -dispmode    Sets display mode for objects."
       "\n\t\t:  -highmode    Sets hilight mode for objects."
-      "\n\t\t:  -redisplay   Recomputes presentation of objects.",
+      "\n\t\t:  -redisplay   Recomputes presentation of objects."
+      "\n\t\t:  -werth       Specific visualization mode for Werth.",
       __FILE__, VDisplay2, group);
 
   theCommands.Add ("vnbdisplayed",