]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #75 - reported by Hervé Legrand: sketch - color of planes displayed in 3D viewer...
authornds <natalia.donis@opencascade.com>
Mon, 2 Jun 2014 07:22:26 +0000 (11:22 +0400)
committernds <natalia.donis@opencascade.com>
Mon, 2 Jun 2014 07:22:26 +0000 (11:22 +0400)
Fit all for the planes preview.

src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/XGUI/XGUI_SalomeViewer.h
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_ViewerProxy.h

index 3d93034020fd5ae115d03761f5ee5d1f0174a6c2..99cab29e5c2a2be1f1c3660db3f475f92ec16c61 100644 (file)
@@ -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<ModelAPI_Feature> 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()));
     }
   }
 
index bf571a32332a294f68bd532a7a6d627bfb16fd7a..d92604bbb89410135ec12244364edb5464ac4779 100644 (file)
@@ -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<ModelAPI_Feature> theFeature);
 
   /// SLOT, to switch on/off the multi selection in the viewer
index 3270705d61af4f68d75d8ad4c06526a29c76bc0a..7deb0ef54c44d670e467ac214ba58afb10d74a8a 100644 (file)
@@ -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
index d40a55331a198a5fdccbb4fdb9cbc8a22872ffda..9c76414e9f7b5ce2b9cce0c008afe8d3b12cbeac 100644 (file)
@@ -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)
index a1e5054bd81c88a1345e8d37be87cbe2282d2695..b00d5aea391c940138b1320dbfb5f5d8d7411d48 100644 (file)
@@ -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();
index e07c3693e75ca6e91446ddefc12c7d9d2b16b020..c3ae206ca44440ac40effb8a549a385d323f08cd 100644 (file)
@@ -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()
 {
index 2d2864dd4f9a7cafd85d8687f25eca655852a23c..1f7f63344662da2dfef8de75ebc948c303a4e4fc 100644 (file)
@@ -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();