Back to index

salome-smesh  6.5.0
SMESHGUI_SelectionOp.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : SMESHGUI_SelectionOp.h
00024 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
00025 //
00026 #ifndef SMESHGUI_SELECTIONOP_H
00027 #define SMESHGUI_SELECTIONOP_H
00028 
00029 // SMESH includes
00030 #include "SMESH_SMESHGUI.hxx"
00031 
00032 #include "SMESHGUI_Operation.h"
00033 #include "SMESHGUI_Dialog.h"
00034 
00035 // SALOME GUI includes
00036 #include <SVTK_Selection.h>
00037 #include <SALOME_InteractiveObject.hxx>
00038 
00039 // IDL includes
00040 #include <SALOMEconfig.h>
00041 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00042 
00043 class SUIT_SelectionFilter;
00044 class TColStd_MapOfInteger;
00045 class SVTK_ViewWindow;
00046 class SVTK_Selector;
00047 class SMESH_Actor;
00048 
00049 /*
00050   Class       : SMESHGUI_SelectionOp
00051   Description : Base operation for all operations using object selection in viewer or objectbrowser
00052                 through common widgets created by LightApp_Dialog::createObject
00053 */
00054 class SMESHGUI_EXPORT SMESHGUI_SelectionOp : public SMESHGUI_Operation
00055 { 
00056   Q_OBJECT
00057 
00058 public:
00059   typedef QList<int> IdList; 
00060   
00061 public:
00062   SMESHGUI_SelectionOp( const Selection_Mode = ActorSelection );
00063   virtual ~SMESHGUI_SelectionOp();
00064 
00065   static void                   extractIds( const QStringList&, IdList&, const QChar );  
00066 
00067 protected:
00068   typedef enum
00069   {
00070     Object,
00071     MeshNode,
00072     MeshElement
00073 
00074   } EntityType;
00080 protected:
00081   virtual void                  startOperation();
00082   virtual void                  commitOperation();
00083   virtual void                  abortOperation();
00084   virtual void                  selectionDone();
00085 
00087   virtual void                  initDialog();
00088 
00094   virtual SUIT_SelectionFilter* createFilter( const int ) const;
00095 
00097   void                          removeCustomFilters();
00098 
00100   Selection_Mode                selectionMode() const;
00101 
00103   void                          setSelectionMode( const Selection_Mode );
00104 
00106   void                          highlight( const Handle( SALOME_InteractiveObject )&,
00107                                            const bool, const bool = true );
00108                                
00110   void                          addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&,
00111                                                   const TColStd_MapOfInteger&, const bool isModeShift);
00112 
00113   SVTK_ViewWindow*              viewWindow() const;
00114   SVTK_Selector*                selector() const;
00115 
00117   virtual void                  selected( QStringList&, 
00118                                           SMESHGUI_Dialog::TypesList&, QStringList& ) const;
00119 
00121   virtual int                   typeById( const QString&, const EntityType ) const;
00122 
00124   virtual QChar                 idChar() const;
00125 
00127   void                          selectedIds( const int, IdList& ) const;
00128 
00130   void                          extractIds( const QStringList&, IdList& ) const;
00131 
00133   SMESH::SMESH_Mesh_var         mesh() const;
00134 
00136   SMESH_Actor*                  actor() const;
00137   
00138 protected slots:
00140   virtual void                  onActivateObject( int );
00141 
00143   virtual void                  onDeactivateObject( int );
00144 
00149   virtual void                  onSelectionChanged( int );
00150 
00158   virtual void                  onTextChanged( int, const QStringList& );
00159   
00160 private:
00161   typedef QMap<int, SUIT_SelectionFilter*> Filters;
00162   
00163 private:
00164   Filters         myFilters;
00165   Selection_Mode  myDefSelectionMode, myOldSelectionMode;
00166 };
00167 
00168 #endif // SMESHGUI_SELECTIONOP_H