]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2999: Synchronize deflection for presentation of circle objects and for select...
authorvsv <vsv@opencascade.com>
Thu, 9 Apr 2020 14:52:50 +0000 (17:52 +0300)
committervsv <vsv@opencascade.com>
Thu, 9 Apr 2020 14:52:50 +0000 (17:52 +0300)
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/XGUI/XGUI_ViewerProxy.cpp

index 517336b241aeefe97b7c37c791ea7ff1e1f0ebf3..74749fd5ed2633b43ec09950eaf207c8135b399b 100644 (file)
@@ -86,7 +86,7 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
       TopLoc_Location aLoc;
       Handle(Poly_Polygon3D) aPoly3D = BRep_Tool::Polygon3D(anEdge, aLoc);
       if (aPoly3D.IsNull()) {
-        double aDeflection = Config_PropManager::real("Visualization", "body_deflection");
+        double aDeflection = Config_PropManager::real("Visualization", "construction_deflection");
         BRepMesh_IncrementalMesh(aShape, aDeflection);
       }
     }
@@ -154,6 +154,7 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
 
   ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes());
   ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes());
+  Attributes()->UpdatePreviousDeviationCoefficient();
 }
 
 //********************************************************************
index e66a9f060a10ddbe5cdd0bef6108ab6df518947f..aac07b5975c7939a15079d688df2e4610499a50c 100644 (file)
@@ -454,21 +454,23 @@ void XGUI_ViewerProxy::displayHighlight(FeaturePtr theFeature, const TopoDS_Shap
   Handle(AIS_InteractiveContext) aContext = AISContext();
 
   double aDeflection;
-  if (myResult->groupName() == ModelAPI_ResultConstruction::group()) {
-    //FeaturePtr aFeature = ModelAPI_Feature::feature(myResult);
-    if (theFeature.get()) {
-      std::list<ResultPtr> aResults = theFeature->results();
-      std::list<ResultPtr>::const_iterator aIt;
-      ResultPtr aRes;
-      Handle(AIS_Shape) aAis;
-      for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
-        aRes = (*aIt);
-        TopoDS_Shape aTShape = aRes->shape()->impl<TopoDS_Shape>();
-        if (!aTShape.IsSame(theIgnoreShape)) {
+  if (theFeature.get()) {
+    std::list<ResultPtr> aResults = theFeature->results();
+    std::list<ResultPtr>::const_iterator aIt;
+    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    ResultPtr aRes;
+    Handle(AIS_InteractiveObject) anAISIO;
+    Handle(AIS_Shape) aAis;
+    for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+      aRes = (*aIt);
+      TopoDS_Shape aTShape = aRes->shape()->impl<TopoDS_Shape>();
+      if (!aTShape.IsSame(theIgnoreShape)) {
+        anAISIO = aDisplayer->getAISObject(aRes)->impl<Handle(AIS_InteractiveObject)>();
+        if (!anAISIO.IsNull()) {
           aAis = new AIS_Shape(aTShape);
           aAis->SetColor(HIGHLIGHT_COLOR);
           aAis->SetZLayer(Graphic3d_ZLayerId_Top); //Graphic3d_ZLayerId_Topmost
-          aDeflection = Config_PropManager::real("Visualization", "construction_deflection");
+          aDeflection = anAISIO->Attributes()->DeviationCoefficient();
           aAis->Attributes()->SetDeviationCoefficient(aDeflection);
           aAis->Attributes()->SetIsoOnPlane(false);
           myHighlights.Append(aAis);
@@ -478,18 +480,6 @@ void XGUI_ViewerProxy::displayHighlight(FeaturePtr theFeature, const TopoDS_Shap
       }
     }
   }
-  else {
-    TopoDS_Shape aTShape = myResult->shape()->impl<TopoDS_Shape>();
-    Handle(AIS_Shape) aAis = new AIS_Shape(aTShape);
-    aAis->SetColor(HIGHLIGHT_COLOR);
-    aAis->SetZLayer(Graphic3d_ZLayerId_Top); //Graphic3d_ZLayerId_Topmost
-    aDeflection = Config_PropManager::real("Visualization", "body_deflection");
-    aAis->Attributes()->SetDeviationCoefficient(aDeflection);
-    aAis->Attributes()->SetIsoOnPlane(false);
-    myHighlights.Append(aAis);
-    aContext->Display(aAis, false);
-    aContext->Deactivate(aAis);
-  }
 }
 
 bool XGUI_ViewerProxy::eraseHighlight()