Salome HOME
SMH: Preparation version 3.0.0 - merge (HEAD+POLYWORK)
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FilterDlg.h
index f63d2b2e0a134802a10023875517e0ad9c550238..cbef2c66feb0c72b981450c71843668a82ecbc21 100755 (executable)
 #include <qmap.h>
 #include <qvaluelist.h>
 
-#include "SALOME_Selection.h"
+#include "SalomeApp_SelectionMgr.h"
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_DataMapOfIOMapOfInteger.hxx"
+#include "SVTK_Selection.h"
 
 #include <TColStd_IndexedMapOfInteger.hxx>
 
@@ -55,17 +56,19 @@ class QStringList;
 class QTable;
 class QTableItem;
 class QWidgetStack;
-class SALOME_Selection;
+class SalomeApp_SelectionMgr;
 class SMESHGUI;
 class SMESHGUI_FilterLibraryDlg;
+class SVTK_Selector;
+class SVTK_ViewWindow;
 
-/*
-  Class       : SMESHGUI_FilterTable
-  Description : Frame containig 
-                  - Button group for switching entity type
-                  - Table for displaying filter criterions
-                  - Buttons for editing table
-*/
+/*!
 Class       : SMESHGUI_FilterTable
 Description : Frame containig 
                 - Button group for switching entity type
                 - Table for displaying filter criterions
                 - Buttons for editing table
+ */
 
 class SMESHGUI_FilterTable : public QFrame
 {
@@ -78,66 +81,64 @@ class SMESHGUI_FilterTable : public QFrame
   typedef QMap<int, Table*> TableMap;
 
 public:  
-  
-                            SMESHGUI_FilterTable( QWidget* parent, 
-                                                  const int type );
-                            SMESHGUI_FilterTable( QWidget* parent, 
-                                                  const QValueList<int>& type );
+                            SMESHGUI_FilterTable (QWidget* parent, 
+                                                  const int type);
+                            SMESHGUI_FilterTable (QWidget* parent, 
+                                                  const QValueList<int>& type);
   virtual                   ~SMESHGUI_FilterTable();
-  
-  void                      Init( const int type );
-  void                      Init( const QValueList<int>& types );
+
+  void                      Init (const int type);
+  void                      Init (const QValueList<int>& types);
 
   QGroupBox*                GetTableGrp();
 
-  bool                      IsValid( const bool = true, const int theEntityType = -1 ) const;
+  bool                      IsValid (const bool = true, const int theEntityType = -1) const;
   int                       GetType() const;
-  void                      SetType( const int );
+  void                      SetType (const int);
   void                      RestorePreviousEntityType();
-  int                       NumRows( const int theEntityType = -1 ) const;
-  void                      Clear( const int theEntityType = -1 );
-  void                      SetEditable( const bool );
-  void                      SetEnabled( const bool );
-  void                      SetLibsEnabled( const bool );
+  int                       NumRows (const int theEntityType = -1) const;
+  void                      Clear (const int theEntityType = -1);
+  void                      SetEditable (const bool);
+  void                      SetEnabled (const bool);
+  void                      SetLibsEnabled (const bool);
   bool                      IsEditable() const;
 
-  int                       GetCriterionType( const int theRow, const int theType = -1 ) const;
-  
-  void                      GetCriterionconst int                 theRow,
+  int                       GetCriterionType (const int theRow, const int theType = -1) const;
+
+  void                      GetCriterion (const int                 theRow,
                                           SMESH::Filter::Criterion& theCriterion,
-                                          const int                 theEntityType = -1 ) const;
+                                          const int                 theEntityType = -1) const;
 
-  void                      SetCriterionconst int                       theRow,
+  void                      SetCriterion (const int                       theRow,
                                           const SMESH::Filter::Criterion& theCriterion,
-                                          const int                       theEntityType = -1 );
+                                          const int                       theEntityType = -1);
 
-  void                      AddCriterion( const SMESH::Filter::Criterion& theCriterion,
-                                          const int    theEntityType = -1 );
-  
-  void                      Copy( const SMESHGUI_FilterTable* );
-  void                      SetValidity( const bool );
+  void                      AddCriterion (const SMESH::Filter::Criterion& theCriterion,
+                                          const int    theEntityType = -1);
 
-  bool                      CurrentCell( int& theRow, int& theCol ) const;
-  void                      SetThreshold( const int      theRow,
+  void                      Copy (const SMESHGUI_FilterTable*);
+  void                      SetValidity (const bool);
+
+  bool                      CurrentCell (int& theRow, int& theCol) const;
+  void                      SetThreshold (const int      theRow,
                                           const QString& theText,
-                                          const int      theEntityType = -1 );
+                                          const int      theEntityType = -1);
 
-  bool                      GetThresholdconst int      theRow,
+  bool                      GetThreshold (const int      theRow,
                                           QString&       theText,
-                                          const int      theEntityType = -1 );
+                                          const int      theEntityType = -1);
 
   void                      Update();
 
 signals:
 
   void                      CopyFromClicked();
   void                      AddToClicked();
-  void                      EntityTypeChanged( const int );
+  void                      EntityTypeChanged (const int);
   void                      NeedValidation();
-  void                      CretarionChanged( const int theRow, const int theEntityType );
-  void                      CurrentChanged( int, int );
-  
+  void                      CretarionChanged (const int theRow, const int theEntityType);
+  void                      CurrentChanged (int, int);
+
 private slots:
 
   void                      onAddBtn();
@@ -146,30 +147,30 @@ private slots:
   void                      onClearBtn();
   void                      onCopyFromBtn();
   void                      onAddToBtn();
-  void                      onCriterionChanged( int, int );
-  void                      onEntityType( int );
-  void                      onCurrentChanged( int, int );
+  void                      onCriterionChanged (int, int);
+  void                      onEntityType (int);
+  void                      onCurrentChanged (int, int);
 
 private:
 
-  void                      addRow( Table*, const int, const bool toTheEnd = true );
-  QTableItem*               getCriterionItem( QTable*, const int );
-  QTableItem*               getCompareItem( QTable* );
-  QTableItem*               getUnaryItem( QTable* );
-  QTableItem*               getBinaryItem( QTable* );
-  const QMap<int, QString>& getCriteria( const int theType ) const;
+  void                      addRow (Table*, const int, const bool toTheEnd = true);
+  QTableItem*               getCriterionItem (QTable*, const int);
+  QTableItem*               getCompareItem (QTable*);
+  QTableItem*               getUnaryItem (QTable*);
+  QTableItem*               getBinaryItem (QTable*);
+  const QMap<int, QString>& getCriteria (const int theType) const;
   const QMap<int, QString>& getCompare() const;
-  Table*                    createTable( QWidget*, const int );
-  QWidget*                  createAdditionalFrame( QWidget* theParent );
+  Table*                    createTable (QWidget*, const int);
+  QWidget*                  createAdditionalFrame (QWidget* theParent);
   int                       getFirstSelectedRow() const;
-  void                      onCriterionChanged( const int, const int, const int  );
-  
+  void                      onCriterionChanged (const int, const int, const int);
+
   void                      updateBtnState();
-  void                      removeAdditionalWidget( QTable* theTable, const int theRow );
+  void                      removeAdditionalWidget (QTable* theTable, const int theRow);
   void                      updateAdditionalWidget();
 
   const QMap<int, QString>& getSupportedTypes() const;
-  
+
 private:
 
   QGroupBox*                myTableGrp;
@@ -186,45 +187,46 @@ private:
   QButtonGroup*             myEntityTypeGrp;
   int                       myEntityType;
   int                       myIsValid;
-  
+
   SMESHGUI_FilterLibraryDlg* myLibDlg;
 
-  QWidgetStack*             myWgStack;
+  QWidgetStack*              myWgStack;
+
   QMap<QTableItem*, AdditionalWidget*> myAddWidgets;
 };
 
 
-/*
-  Class       : SMESHGUI_FilterDlg
-  Description : Dialog to specify filters for VTK viewer
-*/
+/*!
 Class       : SMESHGUI_FilterDlg
 Description : Dialog to specify filters for VTK viewer
+ */
 
 class SMESHGUI_FilterDlg : public QDialog
-{ 
+{
   Q_OBJECT
 
   // Source elements to be selected
   enum { Mesh, Selection, Dialog, None };
-  
+
   // Buttons
   enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close };
 
 public:
-                            SMESHGUI_FilterDlg( QWidget*               parent,
+                            SMESHGUI_FilterDlg( SMESHGUI*,
                                                 const QValueList<int>& types,
-                                                const char*            name = 0 );
-                                                
-                            SMESHGUI_FilterDlg( QWidget*               parent,
+                                                const char*            name = 0);
+
+                            SMESHGUI_FilterDlg( SMESHGUI*,
                                                 const int              type,
-                                                const char*            name = 0 );                                                    
+                                                const char*            name = 0);
   virtual                   ~SMESHGUI_FilterDlg();
 
-  void                      Init( const QValueList<int>& types );
-  void                      Init( const int type );
+  void                      Init (const QValueList<int>& types);
+  void                      Init (const int type);
 
-  void                      SetSelection( SALOME_Selection* );
-  void                      SetMesh( SMESH::SMESH_Mesh_ptr );
-  void                      SetSourceWg( QWidget* );
+  void                      SetSelection();
+  void                      SetMesh (SMESH::SMESH_Mesh_ptr);
+  void                      SetSourceWg (QWidget*);
 
   static SMESH::Filter::Criterion createCriterion();
 
@@ -239,35 +241,35 @@ private slots:
   void                      onClose();
   void                      onDeactivate();
   void                      onSelectionDone();
-  void                      onCriterionChanged( const int, const int );
-  void                      onCurrentChanged( int, int );
-  
+  void                      onCriterionChanged (const int, const int);
+  void                      onCurrentChanged (int, int);
+
 private:
 
-  void                      construct( const QValueList<int>& types ); 
+  void                      construct (const QValueList<int>& types); 
 
-  void                      closeEvent( QCloseEvent* e );
-  void                      enterEvent ( QEvent * );
+  void                      closeEvent (QCloseEvent*);
+  void                      enterEvent (QEvent*);
 
   // dialog creation
-  QFrame*                   createButtonFrame( QWidget* );
-  QFrame*                   createMainFrame( QWidget* );
-  QButtonGroup*             createSourceGroup( QWidget* );
+  QFrame*                   createButtonFrame (QWidget*);
+  QFrame*                   createMainFrame (QWidget*);
+  QButtonGroup*             createSourceGroup (QWidget*);
   void                      updateMainButtons();
-  
+
   // execution
   bool                      isValid() const;
-  bool                      createFilter( const int theType );
+  bool                      createFilter (const int theType);
   void                      insertFilterInViewer();
-  void                      selectInViewer( const int theType,
-                                            const QValueList<int>& theIds );
-  void                      filterSource( const int            theType,
-                                          QValueList<int>&     theResIds );
-  void                      filterSelectionSource( const int            theType,
-                                                   QValueList<int>&     theResIds );
-  void                      getIdsFromWg( const QWidget*, QValueList<int>& ) const;
-  void                      setIdsToWg( QWidget*, const QValueList<int>& );
-  Selection_Mode            getSelMode( const int ) const;
+  void                      selectInViewer (const int              theType,
+                                            const QValueList<int>& theIds);
+  void                      filterSource (const int        theType,
+                                          QValueList<int>& theResIds);
+  void                      filterSelectionSource (const int        theType,
+                                                   QValueList<int>& theResIds);
+  void                      getIdsFromWg (const QWidget*, QValueList<int>&) const;
+  void                      setIdsToWg (QWidget*, const QValueList<int>&);
+  Selection_Mode            getSelMode (const int) const;
   void                      updateSelection();
 
 private:
@@ -285,7 +287,9 @@ private:
   // initial fields
   QValueList<int>           myTypes;
   SMESHGUI*                 mySMESHGUI;
-  SALOME_Selection*         mySelection;
+  SalomeApp_SelectionMgr*   mySelectionMgr;
+  SVTK_Selector*            mySelector;
+  SVTK_ViewWindow*          myViewWindow;
   SMESH::SMESH_Mesh_ptr     myMesh;
   QWidget*                  mySourceWg;
 
@@ -297,23 +301,3 @@ private:
 };
 
 #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-