From: asl Date: Wed, 2 Sep 2015 09:19:10 +0000 (+0300) Subject: refs #821: correct orientation of the viewer after the plane selection X-Git-Tag: V_1.4.0_beta4~156 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f6983bbb20107bac8e14360131ae763990d382f7;p=modules%2Fshaper.git refs #821: correct orientation of the viewer after the plane selection --- diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index b4c37edd5..a82b5d24a 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -57,7 +57,9 @@ Q_OBJECT /// \param theX the X projection value /// \param theY the Y projection value /// \param theZ the Z projection value - virtual void setViewProjection(double theX, double theY, double theZ) = 0; + /// \param theTwist the twist angle in radians + virtual void setViewProjection( double theX, double theY, double theZ, + double theTwist ) = 0; /// Add selection filter to the viewer /// \param theFilter a selection filter diff --git a/src/NewGeom/NewGeom_SalomeViewer.cpp b/src/NewGeom/NewGeom_SalomeViewer.cpp index 3f5a801b5..a9d0c382d 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.cpp +++ b/src/NewGeom/NewGeom_SalomeViewer.cpp @@ -286,7 +286,7 @@ void NewGeom_SalomeViewer::fitAll() } //********************************************** -void NewGeom_SalomeViewer::setViewProjection(double theX, double theY, double theZ) +void NewGeom_SalomeViewer::setViewProjection(double theX, double theY, double theZ, double theTwist) { if (!mySelector) return; @@ -297,6 +297,7 @@ void NewGeom_SalomeViewer::setViewProjection(double theX, double theY, double th Handle(V3d_View) aView3d = aVFrame->getViewPort()->getView(); if (!aView3d.IsNull()) { aView3d->SetProj(theX, theY, theZ); + aView3d->SetTwist( theTwist ); aView3d->FitAll(0.01, true); aView3d->SetZSize(0.); } diff --git a/src/NewGeom/NewGeom_SalomeViewer.h b/src/NewGeom/NewGeom_SalomeViewer.h index 56ba4f824..0635c8989 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.h +++ b/src/NewGeom/NewGeom_SalomeViewer.h @@ -98,7 +98,9 @@ Q_OBJECT /// \param theX the X projection value /// \param theY the Y projection value /// \param theZ the Z projection value - virtual void setViewProjection(double theX, double theY, double theZ); + /// \param theTwist the twist angle in radians + virtual void setViewProjection( double theX, double theY, double theZ, + double theTwist ); /// Set selector /// \param theSel a selector instance diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index e7f7e0d1c..f3d4179c3 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -152,6 +152,7 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs std::shared_ptr aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape); std::shared_ptr aDir = aPlane->direction(); gp_XYZ aXYZ = aDir->impl().XYZ(); + double aTwist = 0.0; // orienting projection if(aBaseShape.get() != NULL) { @@ -168,7 +169,7 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs } } - myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z()); + myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist); } // 3. Clear text in the label myLabel->setText(""); diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index e19cb39b0..345efbe07 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -47,11 +47,12 @@ Handle(V3d_View) XGUI_ViewerProxy::activeView() const } } -void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ) +void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ, double theTwist) { Handle(V3d_View) aView3d = activeView(); if (!aView3d.IsNull()) { aView3d->SetProj(theX, theY, theZ); + aView3d->SetTwist( theTwist ); aView3d->FitAll(0.01, true); aView3d->SetZSize(0.); } diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 5e8f75a63..64bc12fb8 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -48,7 +48,9 @@ Q_OBJECT /// \param theX the X projection value /// \param theY the Y projection value /// \param theZ the Z projection value - virtual void setViewProjection(double theX, double theY, double theZ); + /// \param theTwist the twist angle in radians + virtual void setViewProjection( double theX, double theY, double theZ, + double theTwist ); //! Sets the view fitted all virtual void fitAll();