Version: 9.12.0
SMESHGUI_SelectionOp.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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 <SVTK_Hash.h>
38 #include <SALOME_InteractiveObject.hxx>
39 
40 // IDL includes
41 #include <SALOMEconfig.h>
42 #include CORBA_SERVER_HEADER(SMESH_Mesh)
43 
44 // OCCT includes
45 #include <TColStd_MapOfInteger.hxx>
46 
48 class SVTK_ViewWindow;
49 class SVTK_Selector;
50 class SMESH_Actor;
51 
52 /*
53  Class : SMESHGUI_SelectionOp
54  Description : Base operation for all operations using object selection in viewer or objectbrowser
55  through common widgets created by LightApp_Dialog::createObject
56 */
58 {
59  Q_OBJECT
60 
61 public:
62  typedef QList<int> IdList;
63 
64 public:
65  SMESHGUI_SelectionOp( const Selection_Mode = ActorSelection );
66  virtual ~SMESHGUI_SelectionOp();
67 
68  static void extractIds( const QStringList&, IdList&, const QChar );
69 
70 protected:
71  typedef enum
72  {
75  MeshElement
76 
83 protected:
84  virtual void startOperation();
85  virtual void commitOperation();
86  virtual void abortOperation();
87  virtual void selectionDone();
88 
90  virtual void initDialog();
91 
97  virtual SUIT_SelectionFilter* createFilter( const int ) const;
98 
100  void removeCustomFilters();
101 
103  Selection_Mode selectionMode() const;
104 
106  void setSelectionMode( const Selection_Mode );
107 
109  void highlight( const Handle( SALOME_InteractiveObject )&,
110  const bool, const bool = true );
111 
113  void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&,
114  const SVTK_TVtkIDsMap&, const bool isModeShift);
115 
116  SVTK_ViewWindow* viewWindow() const;
117  SVTK_Selector* selector() const;
118 
120  virtual void selected( QStringList&,
121  SMESHGUI_Dialog::TypesList&, QStringList& ) const;
122 
124  virtual int typeById( const QString&, const EntityType ) const;
125 
127  virtual QChar idChar() const;
128 
130  void selectedIds( const int, IdList& ) const;
131 
133  void extractIds( const QStringList&, IdList& ) const;
134 
136  SMESH::SMESH_Mesh_var mesh() const;
137 
139  SMESH_Actor* actor() const;
140 
141 protected slots:
143  virtual void onActivateObject( int );
144 
146  virtual void onDeactivateObject( int );
147 
152  virtual void onSelectionChanged( int );
153 
161  virtual void onTextChanged( int, const QStringList& );
162 
163 private:
164  typedef QMap<int, SUIT_SelectionFilter*> Filters;
165 
166 private:
168  Selection_Mode myDefSelectionMode, myOldSelectionMode;
169 };
170 
171 #endif // SMESHGUI_SELECTIONOP_H
Handle(SALOME_InteractiveObject) GeomSelectionTools
Return the first selected Salome Interactive Object (Handle(Salome_InteractiveObject))
Definition: GeomSelectionTools.cxx:97
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Definition: SMESHGUI_Operation.h:47
virtual void initDialog()
sets the dialog widgets to state just after operation start
Definition: SMESHGUI_Operation.cxx:205
virtual void startOperation()
Definition: SMESHGUI_Operation.cxx:79
Definition: SMESHGUI_SelectionOp.h:58
@ Object
Definition: SMESHGUI_SelectionOp.h:73
@ MeshNode
Definition: SMESHGUI_SelectionOp.h:74
QList< int > IdList
Definition: SMESHGUI_SelectionOp.h:62
QMap< int, SUIT_SelectionFilter * > Filters
Definition: SMESHGUI_SelectionOp.h:164
Filters myFilters
Definition: SMESHGUI_SelectionOp.h:167
Selection_Mode myDefSelectionMode
Definition: SMESHGUI_SelectionOp.h:168
Definition: SMESH_Actor.h:55
EntityType
Enumeration of entity type used in mesh info array, it should be synchronised with enum SMDSAbs_Entit...
Definition: SMESH_Mesh.idl:174