Version: 8.3.0
SMESHGUI_SelectionOp.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File : SMESHGUI_SelectionOp.h
24 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_SELECTIONOP_H
27 #define SMESHGUI_SELECTIONOP_H
28 
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31 
32 #include "SMESHGUI_Operation.h"
33 #include "SMESHGUI_Dialog.h"
34 
35 // SALOME GUI includes
36 #include <SVTK_Selection.h>
37 #include <SALOME_InteractiveObject.hxx>
38 
39 // IDL includes
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(SMESH_Mesh)
42 
43 // OCCT includes
44 #include <TColStd_MapOfInteger.hxx>
45 
47 class SVTK_ViewWindow;
48 class SVTK_Selector;
49 class SMESH_Actor;
50 
51 /*
52  Class : SMESHGUI_SelectionOp
53  Description : Base operation for all operations using object selection in viewer or objectbrowser
54  through common widgets created by LightApp_Dialog::createObject
55 */
57 {
58  Q_OBJECT
59 
60 public:
61  typedef QList<int> IdList;
62 
63 public:
64  SMESHGUI_SelectionOp( const Selection_Mode = ActorSelection );
65  virtual ~SMESHGUI_SelectionOp();
66 
67  static void extractIds( const QStringList&, IdList&, const QChar );
68 
69 protected:
70  typedef enum
71  {
74  MeshElement
75 
76  } EntityType;
82 protected:
83  virtual void startOperation();
84  virtual void commitOperation();
85  virtual void abortOperation();
86  virtual void selectionDone();
87 
89  virtual void initDialog();
90 
96  virtual SUIT_SelectionFilter* createFilter( const int ) const;
97 
99  void removeCustomFilters();
100 
102  Selection_Mode selectionMode() const;
103 
105  void setSelectionMode( const Selection_Mode );
106 
108  void highlight( const Handle( SALOME_InteractiveObject )&,
109  const bool, const bool = true );
110 
112  void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&,
113  const TColStd_MapOfInteger&, const bool isModeShift);
114 
115  SVTK_ViewWindow* viewWindow() const;
116  SVTK_Selector* selector() const;
117 
119  virtual void selected( QStringList&,
120  SMESHGUI_Dialog::TypesList&, QStringList& ) const;
121 
123  virtual int typeById( const QString&, const EntityType ) const;
124 
126  virtual QChar idChar() const;
127 
129  void selectedIds( const int, IdList& ) const;
130 
132  void extractIds( const QStringList&, IdList& ) const;
133 
135  SMESH::SMESH_Mesh_var mesh() const;
136 
138  SMESH_Actor* actor() const;
139 
140 protected slots:
142  virtual void onActivateObject( int );
143 
145  virtual void onDeactivateObject( int );
146 
151  virtual void onSelectionChanged( int );
152 
160  virtual void onTextChanged( int, const QStringList& );
161 
162 private:
163  typedef QMap<int, SUIT_SelectionFilter*> Filters;
164 
165 private:
167  Selection_Mode myDefSelectionMode, myOldSelectionMode;
168 };
169 
170 #endif // SMESHGUI_SELECTIONOP_H