Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.h
index c26532fa627d03ef4548247716e554bdc22ef5f6..5c8f019e4d5df4cfc5e1c58910acfc763a72f88a 100644 (file)
-//  VISU VISUGUI : GUI of VISU component
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
+//  VISU VISUGUI : GUI of VISU component
 //  File   : VisuGUI_CutPlanesDlg.h
-//  Author : Laurent CORNABE & Hubert ROLLAND 
+//  Author : Laurent CORNABE & Hubert ROLLAND
 //  Module : VISU
 //  $Header$
-
+//
 #ifndef VISUGUI_CUTPLANESDLG_H
 #define VISUGUI_CUTPLANESDLG_H
 
-#include "QAD_SpinBoxDbl.h"
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_Prs3dDlg.h"
+
+#include <SALOME_Actor.h>
+#include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
 
-#include <qdialog.h>
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qspinbox.h>
-#include <qtable.h>
+#include <QFrame>
+
+class QRadioButton;
+class QTabWidget;
+class QTableWidget;
+class QCheckBox;
+class QComboBox;
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(VISU_Gen)
-namespace VISU{
+
+#include <map>
+#include <vector>
+
+namespace VISU 
+{
   class CutPlanes_i;
-}
+  class Result_i;
+};
+
+class SUIT_ViewWindow;
+class SUIT_ViewManager;
+class SalomeApp_Module;
+class VisuGUI_InputPane;
 
-class VisuGUI_CutPlanesDlg : public QDialog
-{ 
+class VisuGUI_CutPlanesPane : public QFrame
+{
     Q_OBJECT
 
 public:
-    VisuGUI_CutPlanesDlg();
-    ~VisuGUI_CutPlanesDlg();
+    VisuGUI_CutPlanesPane (QWidget* parent);
+    ~VisuGUI_CutPlanesPane();
 
-    void setBounds( const double x1, const double x2, 
-                   const double y1, const double y2, 
-                   const double z1, const double z2 );
-    void   setNbPlanes( const int nbp );
-    int    getNbPlanes();
+    void   setNbPlanes( const int nbp ) {nbPlan->setValue( nbp );}
+    int    getNbPlanes() {return nbPlan->value();}
     void   setPlanePos( const VISU::CutPlanes::Orientation orient/*, const double pos1, const double pos2 */);
     VISU::CutPlanes::Orientation  getOrientaion();
     void   setRotation( const double r1, const double r2 );
-    double getRotation1();
-    double getRotation2();
+    double getRotation1() {return Rot1->value();}
+    double getRotation2() {return Rot2->value();}
+
+    double getScaleFactor();
+    void   setScaleFactor(double factor);
+
+    void   initFromPrsObject(VISU::CutPlanes_i* thePrs);
+    int    storeToPrsObject(VISU::CutPlanes_i* thePrs);
 
-    void initFromPrsObject(VISU::CutPlanes_i* thePrs);
-    void storeToPrsObject(VISU::CutPlanes_i* thePrs);
-   
 private:
+    typedef std::vector<QString> TVectorialFieldsList;
+    typedef std::map<VISU::Entity, TVectorialFieldsList> TEntity2VectorialFields;
+    typedef std::pair<VISU::Entity,TVectorialFieldsList> TEntVectPair;
+    TEntity2VectorialFields myEntity2VectorialFields;
+
+    void createPlanes();
+    void deletePlanes();
+
+    void InitEntity2VectorialFieldsMap(VISU::ColoredPrs3d_i* thePrs);
+    void InsertAllVectorialFields();
+    void InitVectorialField();
+
     QLabel* LabelRot1;
     QLabel* LabelRot2;
-    QSpinBox* nbPlan;
-    QAD_SpinBoxDbl* Rot1;
-    QAD_SpinBoxDbl* Rot2;
+    QGroupBox* GDeformation;
+    SalomeApp_IntSpinBox* nbPlan;
+    SalomeApp_DoubleSpinBox* Rot1;
+    SalomeApp_DoubleSpinBox* Rot2;
     QRadioButton* RBzx;
     QRadioButton* RByz;
     QRadioButton* RBxy;
-    QAD_SpinBoxDbl* myPosSpn;
-    QTable* myPosTable;
-    VISU::CutPlanes_i* myCutPlanes;  
+    SalomeApp_DoubleSpinBox* myPosSpn;
+    QTableWidget* myPosTable;
+    SALOME::GenericObjPtr<VISU::CutPlanes_i> myCutPlanes;
+    QCheckBox* myPreviewCheck;
+    QComboBox* myVectorialFieldCombo;
+    SalomeApp_DoubleSpinBox* myScaleSpn;
     double          X1, X2;
     double          Y1, Y2;
     double          Z1, Z2;
     bool hasInit;
 
+    SALOME_Actor* myPreviewActor;
+
 private slots:
-    void editScalarBar();
     void orientationChanged( int );
     void DrawTable();
     void setDefault( int all = -1);
+    void onValueChanged(int theRow, int theCol);
+    void onRotation(double theValue);
+    void onPreviewCheck(bool thePreview);
+    void onScaleFactorChanged(double);
+    void onDeformationCheck(bool);
+    void onVectorialFieldChanged(int);
+};
+
+
+class VisuGUI_CutPlanesDlg : public VisuGUI_ScalarBarBaseDlg
+{
+    Q_OBJECT
+
+public:
+    VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule);
+    ~VisuGUI_CutPlanesDlg();
+
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                    bool theInit );
+
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
+protected:
+    virtual QString        GetContextHelpFilePath();
+
+protected slots:
+    void accept();
+    void reject();
+
+private:
+    QTabWidget*            myTabBox;
+    VisuGUI_CutPlanesPane* myCutPane;
+    VisuGUI_InputPane*     myInputPane;
+    SALOME::GenericObjPtr<VISU::CutPlanes_i> myPrsCopy;
 };
 
+
+/*class VisuGUI_NumEditItem: public QTableItem
+{
+public:
+    VisuGUI_NumEditItem(QTableWidget* table, const QString& text ):
+      QTableItem(table, et, text) {};
+    ~VisuGUI_NumEditItem() {};
+
+    QWidget* createEditor() const;
+};*/
+
 #endif // VISUGUI_CUTPLANESDLG_H