]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2293 Size of the view of a sketch is lost when pressing Set Plane View : resto...
authornds <nds@opencascade.com>
Tue, 19 Dec 2017 12:01:57 +0000 (15:01 +0300)
committernds <nds@opencascade.com>
Tue, 19 Dec 2017 12:01:57 +0000 (15:01 +0300)
src/PartSet/PartSet_PreviewSketchPlane.cpp
src/PartSet/PartSet_WidgetSketchLabel.cpp

index 243b232685f8c68d76625938bbb0bb9ea299b757..afd0e268cd9d48722e6319f05b8d4aad9f9487c8 100644 (file)
@@ -124,6 +124,7 @@ AISObjectPtr PartSet_PreviewSketchPlane::createPreviewPlane()
     int aDispMode = 1; // shading
     Handle(AIS_InteractiveObject) anAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
     if (!anAISIO.IsNull()) {
+      //anAISIO->SetInfiniteState(Standard_True);
       anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
       anAISIO->SetDisplayMode(aDispMode);
     }
index 7f383d6efb676cea33b9196089339cbb671cf9f7..96a84446d9d17eab9a8804e2d17643f13b3d1b32 100644 (file)
@@ -354,6 +354,20 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs
     if (aRotate) {
       myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
     }
+    QString aSizeOfViewStr = mySizeOfView->text();
+    if (!aSizeOfViewStr.isEmpty()) {
+      bool isOk;
+      double aSizeOfView = aSizeOfViewStr.toDouble(&isOk);
+      if (isOk && aSizeOfView > 0) {
+        Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView();
+        if (!aView3d.IsNull()) {
+          Bnd_Box aBndBox;
+          double aHalfSize = aSizeOfView/2.0;
+          aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize);
+          aView3d->FitAll(aBndBox, 0.01, false);
+        }
+      }
+    }
     PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
     if (aModule)
       aModule->onViewTransformed();