]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_Module.cpp
Salome HOME
Issue #3233:Resize thrihedron arrows on zooming to avoid "big arrows".
[modules/shaper.git] / src / PartSet / PartSet_Module.cpp
index 8dfec292f04d56fb463bed339aef3065c7424737..7ac26dd9c76e9b5d6e9a808614b7482216724235 100644 (file)
@@ -236,6 +236,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
                                    "Hidden faces transparency",
                                    Config_Prop::DblSpin,
                                    "0.8");
+
   std::ostringstream aStream;
   aStream << SketcherPrs_Tools::getDefaultArrowSize();
   Config_PropManager::registerProp("Visualization", "dimension_arrow_size",
@@ -258,6 +259,12 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
     "Feature items in Object Browser",
     Config_Prop::Color, FEATURE_ITEM_COLOR);
 
+  Config_PropManager::registerProp("Visualization", "zoom_trihedron_arrows",
+    "Zoom trihedron arrows", Config_Prop::Boolean, "false");
+
+  Config_PropManager::registerProp("Visualization", "axis_arrow_size",
+    "Axis arrow size", Config_Prop::IntSpin, "10");
+
   Config_PropManager::registerProp("Shortcuts", "add_parameter_shortcut",
     "Add parameter in parameters manager dialog",
     Config_Prop::Shortcut, "Ctrl+A");
@@ -1156,13 +1163,13 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
     return;
 
   bool isModified = false;
+  double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
   ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
   if (aCurrentOperation &&
     (PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) ||
      sketchMgr()->isNestedSketchOperation(aCurrentOperation) ||
      (aCurrentOperation->id() == "Measurement")))
   {
-    double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
 
     double aPrevLen = SketcherPrs_Tools::getArrowSize();
     SketcherPrs_Tools::setArrowSize(aLen);
@@ -1183,10 +1190,24 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
         isModified = true;
       }
     }
-    if (isModified)
-      aDisplayer->updateViewer();
   }
 
+  // Manage trihedron arrows
+  if (Config_PropManager::boolean("Visualization", "zoom_trihedron_arrows")) {
+    Handle(AIS_Trihedron) aTrihedron = aViewer->trihedron();
+    if (!aTrihedron.IsNull()) {
+      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);
+      aDatumAspect->SetAttribute(Prs3d_DP_ShadingConeLengthPercent, aAxLen / aAxisLen);
+      aTrihedron->Attributes()->SetDatumAspect(aDatumAspect);
+      aContext->Redisplay(aTrihedron, false);
+      isModified = true;
+    }
+  }
+  if (isModified)
+    aDisplayer->updateViewer();
 }
 
 //******************************************************