From 4df7dcf9479b69ac2f14622703c3af4a58f20318 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 2 Jun 2014 11:22:26 +0400 Subject: [PATCH] =?utf8?q?refs=20#75=20-=20reported=20by=20Herv=C3=A9=20Le?= =?utf8?q?grand:=20sketch=20-=20color=20of=20planes=20displayed=20in=203D?= =?utf8?q?=20viewer=20should=20be=20changed?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fit all for the planes preview. --- src/PartSet/PartSet_Module.cpp | 7 +++++++ src/PartSet/PartSet_Module.h | 3 +++ src/PartSet/PartSet_OperationSketch.cpp | 4 +++- src/PartSet/PartSet_OperationSketch.h | 2 ++ src/XGUI/XGUI_SalomeViewer.h | 3 +++ src/XGUI/XGUI_ViewerProxy.cpp | 10 ++++++++++ src/XGUI/XGUI_ViewerProxy.h | 3 +++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 3d9303402..99cab29e5 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -213,6 +213,11 @@ void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ) //PartSet_TestOCC::testSelection(myWorkshop); } +void PartSet_Module::onFitAllView() +{ + myWorkshop->viewer()->fitAll(); +} + void PartSet_Module::onLaunchOperation(std::string theName, boost::shared_ptr theFeature) { ModuleBase_Operation* anOperation = createOperation(theName.c_str()); @@ -355,6 +360,8 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI if (aSketchOp) { connect(aSketchOp, SIGNAL(planeSelected(double, double, double)), this, SLOT(onPlaneSelected(double, double, double))); + connect(aSketchOp, SIGNAL(fitAllView()), + this, SLOT(onFitAllView())); } } diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index bf571a323..d92604bbb 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -89,6 +89,9 @@ public slots: /// \param theZ the Z projection value void onPlaneSelected(double theX, double theY, double theZ); + /// SLOT, to fit all current viewer + void onFitAllView(); + void onLaunchOperation(std::string theName, boost::shared_ptr theFeature); /// SLOT, to switch on/off the multi selection in the viewer diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index 3270705d6..7deb0ef54 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -144,8 +144,10 @@ bool PartSet_OperationSketch::isNestedOperationsEnabled() const void PartSet_OperationSketch::startOperation() { - if (!feature()) + if (!feature()) { setFeature(createFeature()); + emit fitAllView(); + } } bool PartSet_OperationSketch::hasSketchPlane() const diff --git a/src/PartSet/PartSet_OperationSketch.h b/src/PartSet/PartSet_OperationSketch.h index d40a55331..9c76414e9 100644 --- a/src/PartSet/PartSet_OperationSketch.h +++ b/src/PartSet/PartSet_OperationSketch.h @@ -79,6 +79,8 @@ signals: /// \param theX the value in the Y direction value of the plane /// \param theX the value in the Z direction of the plane void planeSelected(double theX, double theY, double theZ); + // signal about the viewer fit all perform + void fitAllView(); protected: /// Virtual method called when operation started (see start() method for more description) diff --git a/src/XGUI/XGUI_SalomeViewer.h b/src/XGUI/XGUI_SalomeViewer.h index a1e5054bd..b00d5aea3 100644 --- a/src/XGUI/XGUI_SalomeViewer.h +++ b/src/XGUI/XGUI_SalomeViewer.h @@ -41,6 +41,9 @@ public: //! Returns true if multiselection is enabled virtual bool isMultiSelectionEnabled() const = 0; + //! Perfroms the fit all for the active view + virtual void fitAll() = 0; + signals: void lastViewClosed(); void tryCloseView(); diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index e07c3693e..c3ae206ca 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -51,6 +51,16 @@ void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ) } } +void XGUI_ViewerProxy::fitAll() +{ + if (myWorkshop->isSalomeMode()) { + myWorkshop->salomeConnector()->viewer()->fitAll(); + } + else { + XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); + aViewer->activeViewWindow()->viewPort()->fitAll(); + } +} void XGUI_ViewerProxy::connectToViewer() { diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 2d2864dd4..1f7f63344 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -46,6 +46,9 @@ public: /// \param theZ the Z projection value void setViewProjection(double theX, double theY, double theZ); + //! Sets the view fitted all + void fitAll(); + /// Connects to a viewer according to current environment void connectToViewer(); -- 2.39.2