From: nds Date: Tue, 19 Dec 2017 12:01:57 +0000 (+0300) Subject: Issue #2293 Size of the view of a sketch is lost when pressing Set Plane View : resto... X-Git-Tag: V_2.10.1~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4942331141efc972607aa842260530d1a96b489a;p=modules%2Fshaper.git Issue #2293 Size of the view of a sketch is lost when pressing Set Plane View : restore zoom of the view to the entered value. --- diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index 243b23268..afd0e268c 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -124,6 +124,7 @@ AISObjectPtr PartSet_PreviewSketchPlane::createPreviewPlane() int aDispMode = 1; // shading Handle(AIS_InteractiveObject) anAISIO = aAIS->impl(); if (!anAISIO.IsNull()) { + //anAISIO->SetInfiniteState(Standard_True); anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True ); anAISIO->SetDisplayMode(aDispMode); } diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 7f383d6ef..96a84446d 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -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(myWorkshop->module()); if (aModule) aModule->onViewTransformed();