]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Crash by zoom in the viewer in a neutral point: arrows recompute should be performed...
authornds <nds@opencascade.com>
Thu, 5 Oct 2017 17:15:10 +0000 (20:15 +0300)
committernds <nds@opencascade.com>
Thu, 5 Oct 2017 17:15:10 +0000 (20:15 +0300)
src/PartSet/PartSet_Module.cpp

index 4cdd4e928e10fbb67da0e9a8745a30f1dd7a236c..8ae275c83eb766e8747a46e86ee18a4d517d40c6 100755 (executable)
@@ -986,29 +986,36 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
   }
   if (aView.IsNull())
     return;
-  double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
-
-  double aPrevLen = SketcherPrs_Tools::getArrowSize();
-  SketcherPrs_Tools::setArrowSize(aLen);
-  const double aCurScale = aViewer->activeView()->Camera()->Scale();
-  aViewer->SetScale(aViewer->activeView(), aCurScale);
-  double aTextHeight = SketcherPrs_Tools::getConfigTextHeight();
-  SketcherPrs_Tools::setTextHeight (aTextHeight);
-  bool isModified = false;
-  QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
-  foreach (AISObjectPtr aAIS, aPrsList) {
-    Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
-
-    Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
-    if (!aDim.IsNull()) {
-      aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
-      aDim->DimensionAspect()->TextAspect()->SetHeight(aTextHeight);
-      aContext->Redisplay(aDim, false);
-      isModified = true;
+
+  ModuleBase_Operation* aCurrentOperation = myWorkshop->currentOperation();
+  if (aCurrentOperation &&
+    (PartSet_SketcherMgr::isSketchOperation(aCurrentOperation) ||
+     sketchMgr()->isNestedSketchOperation(aCurrentOperation)))
+  {
+    double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize());
+
+    double aPrevLen = SketcherPrs_Tools::getArrowSize();
+    SketcherPrs_Tools::setArrowSize(aLen);
+    const double aCurScale = aViewer->activeView()->Camera()->Scale();
+    aViewer->SetScale(aViewer->activeView(), aCurScale);
+    double aTextHeight = SketcherPrs_Tools::getConfigTextHeight();
+    SketcherPrs_Tools::setTextHeight (aTextHeight);
+    bool isModified = false;
+    QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
+    foreach (AISObjectPtr aAIS, aPrsList) {
+      Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
+
+      Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
+      if (!aDim.IsNull()) {
+        aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
+        aDim->DimensionAspect()->TextAspect()->SetHeight(aTextHeight);
+        aContext->Redisplay(aDim, false);
+        isModified = true;
+      }
     }
+    if (isModified)
+      aDisplayer->updateViewer();
   }
-  if (isModified)
-    aDisplayer->updateViewer();
 }
 
 bool PartSet_Module::isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const