]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3274: Update trihedron after change of preferences
authorvsv <vsv@opencascade.com>
Tue, 28 Jul 2020 08:09:01 +0000 (11:09 +0300)
committervsv <vsv@opencascade.com>
Tue, 28 Jul 2020 08:09:01 +0000 (11:09 +0300)
src/SHAPERGUI/SHAPERGUI.cpp

index d5e43e5746bd074c28a902f291ea7a8584ee58f1..b86d3fdf5c69f8a6fe1ea3ba63e9673840ca034a 100644 (file)
@@ -952,11 +952,40 @@ void SHAPERGUI::preferencesChanged(const QString& theSection, const QString& the
   }
   aProp->setValue(aValue);
 
-  if ((theSection == "Visualization") && (theParam == "selection_color")) {
-    std::vector<int> aColor = Config_PropManager::color("Visualization", "selection_color");
-    myWorkshop->displayer()->setSelectionColor(aColor);
-  }
+  if (theSection == "Visualization") {
+    if (theParam == "selection_color") {
+      std::vector<int> 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();
 }