0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / AIS / AIS_ColoredShape.cxx
index 9211c0e..22b5873 100644 (file)
@@ -124,8 +124,7 @@ Handle(AIS_ColoredDrawer) AIS_ColoredShape::CustomAspects (const TopoDS_Shape& t
   {
     aDrawer = new AIS_ColoredDrawer (myDrawer);
     myShapeColors.Bind (theShape, aDrawer);
-    LoadRecomputable (AIS_WireFrame);
-    LoadRecomputable (AIS_Shaded);
+    SetToUpdate();
   }
   return aDrawer;
 }
@@ -141,8 +140,7 @@ void AIS_ColoredShape::ClearCustomAspects()
     return;
   }
   myShapeColors.Clear();
-  LoadRecomputable (AIS_WireFrame);
-  LoadRecomputable (AIS_Shaded);
+  SetToUpdate();
 }
 
 //=======================================================================
@@ -157,8 +155,7 @@ void AIS_ColoredShape::UnsetCustomAspects (const TopoDS_Shape&    theShape,
     return;
   }
 
-  LoadRecomputable (AIS_WireFrame);
-  LoadRecomputable (AIS_Shaded);
+  SetToUpdate();
   if (theToUnregister)
   {
     myShapeColors.UnBind (theShape);
@@ -183,8 +180,6 @@ void AIS_ColoredShape::SetCustomColor (const TopoDS_Shape&   theShape,
   const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
   setColor (aDrawer, theColor);
   aDrawer->SetOwnColor (theColor);
-  LoadRecomputable (AIS_WireFrame);
-  LoadRecomputable (AIS_Shaded);
 }
 
 //=======================================================================
@@ -202,8 +197,6 @@ void AIS_ColoredShape::SetCustomTransparency (const TopoDS_Shape& theShape,
   const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
   setTransparency (aDrawer, theTransparency);
   aDrawer->SetOwnTransparency (theTransparency);
-  LoadRecomputable (AIS_WireFrame);
-  LoadRecomputable (AIS_Shaded);
 }
 
 //=======================================================================
@@ -221,8 +214,6 @@ void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
   const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
   setWidth (aDrawer, theLineWidth);
   aDrawer->SetOwnWidth (theLineWidth);
-  LoadRecomputable (AIS_WireFrame);
-  LoadRecomputable (AIS_Shaded);
 }
 
 //=======================================================================
@@ -342,7 +333,11 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
   for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
   {
     const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
-    //if (aDrawer->HasOwnMaterial()) continue;
+    if (aDrawer->HasOwnMaterial())
+    {
+      continue;
+    }
+
     if (aDrawer->HasOwnShadingAspect())
     {
       setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
@@ -377,7 +372,7 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& theP
 
       // After this call if type of deflection is relative
       // computed deflection coefficient is stored as absolute.
-      Prs3d::GetDeflection (myshape, myDrawer);
+      StdPrs_ToolTriangulatedShape::GetDeflection (myshape, myDrawer);
       break;
     }
     case AIS_Shaded:
@@ -495,8 +490,8 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
   }
 
   const TopAbs_ShapeEnum aTypOfSel   = AIS_Shape::SelectionType (theMode);
-  const Standard_Real    aDeflection = Prs3d::GetDeflection (myshape, myDrawer);
-  const Standard_Real    aDeviationAngle = myDrawer->HLRAngle();
+  const Standard_Real    aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (myshape, myDrawer);
+  const Standard_Real    aDeviationAngle = myDrawer->DeviationAngle();
   const Standard_Integer aPriority   = StdSelect_BRepSelectionTool::GetStandardPriority (myshape, aTypOfSel);
   if (myDrawer->IsAutoTriangulation()
   && !BRepTools::Triangulation (myshape, Precision::Infinite()))
@@ -521,8 +516,8 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
   Handle(SelectMgr_SelectableObject) aThis (this);
   for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
   {
-    Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
-    anOwner->Set (aThis);
+    const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
+    anOwner->SetSelectable (aThis);
   }
 
   StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);