Version: 9.16.0
SMESHGUI.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 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// SMESH SMESHGUI : GUI for SMESH component
24// File : SMESHGUI.h
25// Author : Nicolas REJNERI, Open CASCADE S.A.S.
26//
27#ifndef SMESHGUI_H
28#define SMESHGUI_H
29
30// SMESH includes
31#include "SMESH_SMESHGUI.hxx"
32
33// SALOME GUI includes
34#include <SalomeApp_Module.h>
35#include <VTKViewer_MarkerDef.h>
36#include <SALOME_InteractiveObject.hxx>
37
38// IDL includes
39#include <SALOMEconfig.h>
40#include CORBA_SERVER_HEADER(SMESH_Gen)
41
42// VTK includes
43#include <vtkSmartPointer.h>
44#include <vtkType.h>
45
46class vtkActor;
47class vtkCallbackCommand;
48class vtkObject;
49
50class QDialog;
51
52class SUIT_Desktop;
53class SUIT_Study;
54class SUIT_ViewWindow;
55class SUIT_ResourceMgr;
56class SUIT_ViewManager;
57
59class SalomeApp_Study;
61class LightApp_SelectionMgr;
62
63class SMESH_Actor;
65
66namespace SMESH
67{
68 class OrientedPlane;
70 {
72 std::list<vtkActor*> ActorList;
73 };
74}
75
76typedef std::list<SMESH::ClippingPlaneInfo> SMESHGUI_ClippingPlaneInfoList;
77typedef std::map<SUIT_ViewManager*, SMESHGUI_ClippingPlaneInfoList> SMESHGUI_ClippingPlaneInfoMap;
78
79//=================================================================================
80// class : SMESHGUI
81// purpose :
82//=================================================================================
84{
85 Q_OBJECT
86
87public :
88 SMESHGUI();
89 ~SMESHGUI();
90
91 static SMESH::SMESH_Gen_var GetSMESHGen();
92 static SMESHGUI* GetSMESHGUI();
93 static LightApp_SelectionMgr* selectionMgr();
94 static SUIT_ResourceMgr* resourceMgr();
95 static SUIT_Desktop* desktop();
96 static SalomeApp_Study* activeStudy();
97
98 static bool automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0);
99 static bool automaticUpdate( SMESH::SMESH_IDSource_ptr, int*, bool*, int*, long* );
100
101 static void Modified( bool = true );
102
103 static bool isStudyLocked( bool = true );
104
105 virtual LightApp_Displayer* displayer();
106 virtual QString engineIOR() const;
107 virtual void initialize( CAM_Application* );
108 virtual void windows( QMap<int, int>& ) const;
109 virtual void viewManagers( QStringList& ) const;
110
111 QDialog* GetActiveDialogBox();
112 void SetActiveDialogBox( QDialog* );
113
114 void ResetState();
115 void SetState( int );
116 int GetState() const { return myState; }
117 bool DefineDlgPosition( QWidget*, int&, int& );
118 void switchToOperation( int );
119
120 virtual bool OnGUIEvent( int );
121 virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
122 virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
123 virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
124
125 virtual LightApp_Selection* createSelection() const;
126
127 virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
128 SUIT_ViewWindow* = 0 );
129
130 /* Non modal dialog boxes management */
131 void EmitSignalDeactivateDialog();
132 void EmitSignalStudyFrameChanged();
133 void EmitSignalCloseAllDialogs();
134 void EmitSignalVisibilityChanged();
135 void EmitSignalCloseView();
136 void EmitSignalActivatedViewManager();
137
138 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
139 virtual void createPreferences();
140 virtual void preferencesChanged( const QString&, const QString& );
141
142 virtual void message( const QString& );
143
144 virtual void update( const int );
145
146 static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
147 static SALOMEDS::Color getPredefinedUniqueColor();
148
149 virtual void storeVisualParameters (int savePoint);
150 virtual void restoreVisualParameters(int savePoint);
151
152 virtual void addActorAsObserver( SMESH_Actor* theActor );
153
154 virtual bool renameAllowed( const QString& ) const;
155 virtual bool renameObject( const QString&, const QString& );
156
157
158 SMESHGUI_ClippingPlaneInfoMap& getClippingPlaneInfoMap() { return myClippingPlaneInfoMap; }
159
160public slots:
161 virtual bool deactivateModule( SUIT_Study* );
162 virtual bool activateModule( SUIT_Study* );
163 virtual void studyClosed( SUIT_Study* );
164 void onViewClosed( SUIT_ViewWindow* );
165
166private slots:
167 void OnGUIEvent();
168 void onViewManagerActivated( SUIT_ViewManager* );
169 void onViewManagerRemoved( SUIT_ViewManager* );
170 void onOperationCommited( SUIT_Operation* );
171 void onOperationAborted( SUIT_Operation* );
172 void onHypothesisEdit( int result );
173 void onUpdateControlActions();
174
175signals:
182
183protected:
184 void createSMESHAction( const int,
185 const QString&,
186 const QString& = QString(),
187 const int = 0,
188 const bool = false,
189 const QString& = QString() );
190 void createPopupItem( const int,
191 const QString&,
192 const QString&,
193 const QString& = QString(),
194 const int = -1 );
195
196 virtual LightApp_Operation* createOperation( const int ) const;
197
198 virtual bool isSelectionCompatible();
199
200 virtual bool reusableOperation( const int id );
201
202 static void ProcessEvents( vtkObject* theObject,
203 unsigned long theEvent,
204 void* theClientData,
205 void* theCallData );
206
207private:
208 void OnEditDelete();
209 int addVtkFontPref( const QString&,
210 const int,
211 const QString&,
212 const bool = false);
213
214 void connectView( const SUIT_ViewWindow* );
215 void logSmeshGUIEvent(int theCommandID);
216
217
218private :
219 static SMESH::SMESH_Gen_var myComponentSMESH;
222 QMap<int, QString> myRules;
224
226
227 VTK::MarkerMap myMarkerMap;
229
232};
233
234#endif // SMESHGUI_H
Handle(SALOME_InteractiveObject) GeomSelectionTools
Return the first selected Salome Interactive Object (Handle(Salome_InteractiveObject))
Definition: GeomSelectionTools.cxx:97
std::list< SMESH::ClippingPlaneInfo > SMESHGUI_ClippingPlaneInfoList
Definition: SMESHGUI.h:76
std::map< SUIT_ViewManager *, SMESHGUI_ClippingPlaneInfoList > SMESHGUI_ClippingPlaneInfoMap
Definition: SMESHGUI.h:77
static SALOMEDS::Color getUniqueColor(const std::list< SALOMEDS::Color > &theReservedColors)
Return a random unique color.
Definition: SMESH_Mesh_i.cxx:3611
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Definition: SMESHGUI_FilterLibraryDlg.h:55
Definition: SMESHGUI.h:84
LightApp_Displayer * myDisplayer
Definition: SMESHGUI.h:223
void SignalCloseAllDialogs()
double myPriority
Definition: SMESHGUI.h:231
void SignalCloseView()
vtkSmartPointer< vtkCallbackCommand > myEventCallbackCommand
Definition: SMESHGUI.h:230
void SignalStudyFrameChanged()
QMap< int, QString > myRules
Definition: SMESHGUI.h:222
void SignalVisibilityChanged()
void SignalDeactivateActiveDialog()
int myState
Definition: SMESHGUI.h:221
QDialog * myActiveDialogBox
Definition: SMESHGUI.h:220
void SignalActivatedViewManager()
SMESHGUI_FilterLibraryDlg * myFilterLibraryDlg
Definition: SMESHGUI.h:225
int GetState() const
Definition: SMESHGUI.h:116
void logSmeshGUIEvent(int theCommandID)
SMESHGUI_ClippingPlaneInfoMap myClippingPlaneInfoMap
Definition: SMESHGUI.h:228
static SMESH::SMESH_Gen_var myComponentSMESH
Definition: SMESHGUI.h:219
VTK::MarkerMap myMarkerMap
Definition: SMESHGUI.h:227
SMESHGUI_ClippingPlaneInfoMap & getClippingPlaneInfoMap()
Definition: SMESHGUI.h:158
Definition: SMESHGUI_ClippingDlg.h:78
Definition: SMESH_Actor.h:56
Definition: SMESH_ControlsClassifier.cxx:39
Definition: SMESHGUI.h:70
OrientedPlane * Plane
Definition: SMESHGUI.h:71
std::list< vtkActor * > ActorList
Definition: SMESHGUI.h:72