Salome HOME
Issue #2999: Provide initialization of deviation coefficient for all presentations
authorvsv <vsv@opencascade.com>
Thu, 26 Mar 2020 09:22:58 +0000 (12:22 +0300)
committervsv <vsv@opencascade.com>
Thu, 26 Mar 2020 09:23:11 +0000 (12:23 +0300)
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ModuleBase/ModuleBase_Tools.cpp
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_ResultSketchPrs.cpp

index f94b65780416ef08c19eb73621c68de7733dc6b5..a860f61cdd89eba32d5f11ec077cafe460fe98f1 100644 (file)
@@ -79,6 +79,7 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
   // Set own free boundaries aspect in order to have free
   // and unfree boundaries with different colors
   Handle(Prs3d_Drawer) aDrawer = Attributes();
+  //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE);
   aDrawer->SetUnFreeBoundaryAspect(
     new Prs3d_LineAspect(Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1));
   aDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1));
@@ -119,6 +120,8 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
       SetDynamicHilightAttributes(aDrawer);
     }
   }
+  //if (!aDrawer.IsNull())
+  //  aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE);
 
   myHiddenSubShapesDrawer = new AIS_ColoredDrawer(myDrawer);
   Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
@@ -260,6 +263,9 @@ void ModuleBase_ResultPrs::Compute(
         aReadyToDisplay = false;
     }
   }
+  // change deviation coefficient to provide more precise circle
+  ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes());
+  ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes());
   try {
     AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
   }
index e41847bf8850f85ab1bab8fb234f8d7f7517056f..a9f463969f9e92b4d10f016838170e48e2ca1f66 100644 (file)
@@ -456,6 +456,8 @@ void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
 {
   if (theShape.IsNull())
     return;
+  if (theDrawer.IsNull())
+    return;
 
   std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape());
   aGeomShape->setImpl(new TopoDS_Shape(theShape));
index 5c2d2ae1135a92aa30c527495910ad23f6c88fa0..f782ca3c0c60d5263be8dddc626b01552f8d9a88 100644 (file)
@@ -92,6 +92,7 @@ PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop)
   aDrawer->SetUIsoAspect(aUIsoAspect);
   aDrawer->SetVIsoAspect(aVIsoAspect);
   aDrawer->SetIsoOnPlane(false);
+  //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE);
 }
 
 bool PartSet_OperationPrs::hasShapes()
@@ -135,9 +136,7 @@ void PartSet_OperationPrs::Compute(
     // change deviation coefficient to provide more precise circle
     // as there is no result, the shape is processed to correct deviation. To be unified
     ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
-    Handle(Prs3d_Drawer) aHighlightDrawer = DynamicHilightAttributes();
-    if (!aHighlightDrawer.IsNull())
-      ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aHighlightDrawer);
+    ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, DynamicHilightAttributes());
 
     if (myUseAISWidth) {
       Handle(AIS_InteractiveObject) anIO = anIter.Value();
index 380e4ac42f029ddcdcd803a80e272973a3933856..652a89b471eeda2e459f46e159ea236868f08867 100644 (file)
@@ -71,6 +71,7 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult)
     aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
   else
     aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
+  //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE);
 
   // Activate individual repaintng if this is a part of compsolid
   ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(myResult);
@@ -105,7 +106,8 @@ void PartSet_ResultSketchPrs::Compute(
   setAuxiliaryPresentationStyle(false);
 
   // change deviation coefficient to provide more precise circle
-  //ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes());
+  ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes());
+  ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes());
   try {
     AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
   }