From 0b961884eca9e1e44eaaa9a6443fd9d9f8746ad5 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 9 Apr 2020 17:52:50 +0300 Subject: [PATCH] Issue #2999: Synchronize deflection for presentation of circle objects and for selection area of them --- src/ModuleBase/ModuleBase_ResultPrs.cpp | 3 +- src/XGUI/XGUI_ViewerProxy.cpp | 38 +++++++++---------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 517336b24..74749fd5e 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -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(); } //******************************************************************** diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index e66a9f060..aac07b597 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -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 aResults = theFeature->results(); - std::list::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(); - if (!aTShape.IsSame(theIgnoreShape)) { + if (theFeature.get()) { + std::list aResults = theFeature->results(); + std::list::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(); + if (!aTShape.IsSame(theIgnoreShape)) { + anAISIO = aDisplayer->getAISObject(aRes)->impl(); + 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(); - 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() -- 2.39.2