From: nds Date: Mon, 2 Jun 2014 07:22:26 +0000 (+0400) Subject: refs #75 - reported by Hervé Legrand: sketch - color of planes displayed in 3D viewer... X-Git-Tag: V_0.4.4~336^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4df7dcf9479b69ac2f14622703c3af4a58f20318;p=modules%2Fshaper.git refs #75 - reported by Hervé Legrand: sketch - color of planes displayed in 3D viewer should be changed Fit all for the planes preview. --- 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();