From b493f37fd89cdcd9a3a3a44a666bc1b5ca413b74 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 28 Jul 2020 11:09:01 +0300 Subject: [PATCH] Issue #3274: Update trihedron after change of preferences --- src/SHAPERGUI/SHAPERGUI.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index d5e43e574..b86d3fdf5 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -952,11 +952,40 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the } aProp->setValue(aValue); - if ((theSection == "Visualization") && (theParam == "selection_color")) { - std::vector aColor = Config_PropManager::color("Visualization", "selection_color"); - myWorkshop->displayer()->setSelectionColor(aColor); - } + if (theSection == "Visualization") { + if (theParam == "selection_color") { + std::vector aColor = Config_PropManager::color("Visualization", "selection_color"); + myWorkshop->displayer()->setSelectionColor(aColor); + } + if ((theParam == "zoom_trihedron_arrows") || (theParam == "axis_arrow_size")) { + if (mySelector) { + Handle(AIS_Trihedron) aTrihedron = mySelector->viewer()->getTrihedron(); + if (!aTrihedron.IsNull()) { + bool aZoom = Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows"); + Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext(); + + ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + Handle(V3d_View) aView = aViewer->activeView(); + if (aZoom) { + double aAxLen = + aView->Convert(Config_PropManager::integer("Visualization", "axis_arrow_size")); + Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); + double aAxisLen = aDatumAspect->AxisLength(Prs3d_DP_XAxis); + myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); + aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen); + aTrihedron->Attributes()->SetDatumAspect(aDatumAspect); + aContext->Redisplay(aTrihedron, true); + } + else if (myAxisArrowRate > 0) { + Handle(Prs3d_DatumAspect) aDatumAspect = aTrihedron->Attributes()->DatumAspect(); + aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, myAxisArrowRate); + aContext->Redisplay(aTrihedron, true); + } + } + } + } + } myWorkshop->displayer()->redisplayObjects(); } -- 2.39.2