Version: 9.16.0
GeometryGUI.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// GEOM GEOMGUI : GUI for Geometry component
24// File : GeometryGUI.h
25// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26
27#ifndef GEOMETRYGUI_H
28#define GEOMETRYGUI_H
29
30#include "GEOM_GEOMGUI.hxx"
31
32#include <SalomeApp_Module.h>
33
34#include <GEOM_Client.hxx>
35#include <SALOME_InteractiveObject.hxx>
36#include <SALOMEDSClient.hxx>
37#include <Qtx.h>
38
39#include "GEOMGUI.h"
40#include "GEOMPluginGUI.h"
41
42// QT Includes
43#include <QMap>
44#include <QPair>
45
46// OCCT Includes
47#include <gp_Ax3.hxx>
48
49#include <TColStd_HArray1OfByte.hxx>
50
51// IDL headers
52#include "SALOMEconfig.h"
53#include CORBA_CLIENT_HEADER(SALOMEDS)
54
55#include <SALOME_ListIO.hxx>
56
57class QDialog;
58class QMenu;
59class QAction;
61class LightApp_VTKSelector;
63class SUIT_ViewManager;
64class SalomeApp_Study;
68
69//=================================================================================
70// class : GeometryGUI
71// purpose :
72//=================================================================================
74{
75 Q_OBJECT
76
77public:
78 // Constructor
80
81 // Destructor
83
84 virtual LightApp_Displayer* displayer();
85 virtual void initialize( CAM_Application* );
86 virtual QString engineIOR() const;
87
88 static Handle(TColStd_HArray1OfByte) getTexture (int, int&, int&);
89
90 static bool InitGeomGen();
91
92 static GEOM::GEOM_Gen_var GetGeomGen();
93
94 static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
95 static bool IsInGeomComponent( _PTR(SObject) theSObject );
96 static SALOMEDS::Study_var getStudyServant();
97
98 static void Modified( bool = true );
99
100 GEOM_Client& GetShapeReader() { static SHAPE_READER(myShapeReader);return myShapeReader; }
101
102 GEOMGUI_AnnotationMgr* GetAnnotationMgr();
103
104 GEOMGUI_TextTreeWdg* GetTextTreeWdg() const;
105
106 // Get active dialog box
107 QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
108 // Set active dialog box
109 void SetActiveDialogBox( QDialog* aDlg );
110
111 // Non modal dialog boxes management
112 void EmitSignalDeactivateDialog();
113 void EmitSignalCloseAllDialogs();
114 void EmitSignalDefaultStepValueChanged( double newVal );
115
116 // Process action
117 void OnGUIEvent( int id, const QVariant& theParam = QVariant( QVariant::Invalid ) );
118 virtual bool activateOperation( int actionId );
119 virtual bool activateOperation( const QString& actionId );
120 virtual bool activateOperation( const QString& actionId, const QString& plugin );
121
122 // The Working Plane management
123 void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
124 gp_Ax3 GetWorkingPlane() { return myWorkingPlane; }
125 void ActiveWorkingPlane();
126
127 virtual bool renameObject( const QString&, const QString& );
128 virtual bool renameAllowed( const QString& ) const;
129
130 virtual void windows( QMap<int, int>& ) const;
131 virtual void viewManagers( QStringList& ) const;
132
133 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
134 virtual void createPreferences();
135 virtual void preferencesChanged( const QString&, const QString& );
136 int getLocalSelectionMode() const;
137 void setLocalSelectionMode(const int mode);
138
139 virtual void storeVisualParameters (int savePoint);
140 virtual void restoreVisualParameters(int savePoint);
141
142 QAction* getAction(const int id);
143
144 virtual void message( const QString& msg);
145 static void ClearShapeBuffer( GEOM::GEOM_Object_ptr );
146 static GEOM::GEOM_Object_ptr
147 GetObjectFromIOR( const QString& IOR );
148
149 static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
150
151 virtual bool isDraggable( const SUIT_DataObject* what ) const;
152 virtual bool isDropAccepted( const SUIT_DataObject* where ) const;
153 virtual void dropObjects( const DataObjectList& what,
154 SUIT_DataObject* where,
155 const int row, Qt::DropAction action );
156
157 void emitDimensionsUpdated( QString entry );
158 void emitAnnotationsUpdated( QString entry );
159
160public slots:
161 virtual bool deactivateModule( SUIT_Study* );
162 virtual bool activateModule( SUIT_Study* );
163 virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* );
164 virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
165 virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
166 virtual void OnMouseRelease ( SUIT_ViewWindow*, QMouseEvent* );
167
168protected slots:
169 virtual void onViewManagerAdded( SUIT_ViewManager* );
170 virtual void onViewManagerRemoved( SUIT_ViewManager* );
171
172private slots:
173 void OnGUIEvent();
174 void onWindowActivated( SUIT_ViewWindow* );
175 void onViewAboutToShow();
176 void OnSetMaterial( const QString& );
177 void updateMaterials();
178 void updateCreationInfo();
179 void onAutoBringToFront();
180 void updateFieldColorScale();
181
182signals :
185 void SignalDefaultStepValueChanged( double newVal );
186 void SignalDependencyTreeParamChanged( const QString&, const QString& );
187 void SignalDependencyTreeRenameObject( const QString& );
188 void SignalTextTreeRenameObject( const QString& );
189 void SignalAnnotationsUpdated( const QString& );
190 void DimensionsUpdated( const QString& );
191
192protected:
193 virtual LightApp_Selection* createSelection() const;
194
195private:
196 GEOMGUI* getLibrary( const QString& libraryName );
197 GEOMPluginGUI* getPluginLibrary( const QString& libraryName );
198 void createGeomAction( const int id, const QString& po_id,
199 const QString& icon_id,
200 const int key, const bool toggle,
201 const QString& shortcutAction);
202 void createGeomAction( const int id, const QString& po_id,
203 const QString& icon_id = QString(""),
204 const int key = 0, const bool toggle = false);
205
206 void createGeomAction( const int inMenuIdx,
207 const QPair<QString, QString>& inModuleIDLastTokenAndPrefix,
208 const QString& iconID = QString(),
209 const bool toggle = false);
210
211 void createPopupItem( const int, const QString& clients, const QString& types,
212 const bool isSingle = false, const int isVisible = -1,
213 const bool isExpandAll = false, const bool isOCC = false,
214 const int parentId = -1 );
215 void addPluginActions();
216
217 void createOriginAndBaseVectors();
218
219public:
220 static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!!
221
222private:
223
224 typedef QMap<QString, GEOMGUI*> GUIMap;
225
226 typedef QPair<QString, QString> PluginAction;
227
228 GUIMap myGUIMap; // GUI libraries map
229 QDialog* myActiveDialogBox; // active dialog box
231 //QMap<int,QString> myRules; // popup rules
232
233 QMap<int, PluginAction> myPluginActions; // plugin actions
234 QMap<QString, QString> myPluginLibs; // plugin name to plugin client library
235
236 QList<GEOMGUI_OCCSelector*> myOCCSelectors;
237 QList<LightApp_VTKSelector*> myVTKSelectors;
238
240 int myLocalSelectionMode; //Select Only
241
243
246
247 SALOME_ListIO myTopLevelIOList;
248
249 friend class DisplayGUI;
250};
251
252#endif
#define SHAPE_READER(obj)
Definition: GEOM_Client.hxx:96
#define GEOMGUI_EXPORT
Definition: GEOM_GEOMGUI.hxx:36
Definition: DisplayGUI.h:40
A help class to process visualization of annotation presentations. It contains a map of presentations...
Definition: GEOMGUI_AnnotationMgr.h:47
A widget showing information about object creation:
Definition: GEOMGUI_CreationInfoWdg.h:46
Definition: GEOMGUI_OCCSelector.h:35
Tree view contains Dimension and Annotation text items:
Definition: GEOMGUI_TextTreeWdg.h:47
Definition: GEOMGUI.h:45
Definition: GEOMPluginGUI.h:38
Definition: GEOM_Client.hxx:60
Definition: GeometryGUI.h:74
void SignalAnnotationsUpdated(const QString &)
void SignalCloseAllDialogs()
QPair< QString, QString > PluginAction
Definition: GeometryGUI.h:226
void SignalDependencyTreeRenameObject(const QString &)
void SignalDefaultStepValueChanged(double newVal)
void createPopupItem(const int, const QString &clients, const QString &types, const bool isSingle=false, const int isVisible=-1, const bool isExpandAll=false, const bool isOCC=false, const int parentId=-1)
void SignalDeactivateActiveDialog()
gp_Ax3 myWorkingPlane
Definition: GeometryGUI.h:230
static GEOM::GEOM_Gen_var myComponentGeom
Definition: GeometryGUI.h:220
gp_Ax3 GetWorkingPlane()
Definition: GeometryGUI.h:124
int myLocalSelectionMode
Definition: GeometryGUI.h:240
GEOMGUI_TextTreeWdg * myTextTreeWdg
Definition: GeometryGUI.h:244
QList< GEOMGUI_OCCSelector * > myOCCSelectors
Definition: GeometryGUI.h:236
QMap< int, PluginAction > myPluginActions
Definition: GeometryGUI.h:233
GEOMGUI_CreationInfoWdg * myCreationInfoWdg
Definition: GeometryGUI.h:242
GEOM_Client & GetShapeReader()
Definition: GeometryGUI.h:100
QDialog * myActiveDialogBox
Definition: GeometryGUI.h:229
QMap< QString, QString > myPluginLibs
Definition: GeometryGUI.h:234
QList< LightApp_VTKSelector * > myVTKSelectors
Definition: GeometryGUI.h:237
SALOME_ListIO myTopLevelIOList
Definition: GeometryGUI.h:247
void SetWorkingPlane(gp_Ax3 wp)
Definition: GeometryGUI.h:123
GEOMGUI_AnnotationMgr * myAnnotationMgr
Definition: GeometryGUI.h:245
void SignalDependencyTreeParamChanged(const QString &, const QString &)
LightApp_Displayer * myDisplayer
Definition: GeometryGUI.h:239
QDialog * GetActiveDialogBox()
Definition: GeometryGUI.h:107
void DimensionsUpdated(const QString &)
QMap< QString, GEOMGUI * > GUIMap
Definition: GeometryGUI.h:224
void SignalTextTreeRenameObject(const QString &)
GUIMap myGUIMap
Definition: GeometryGUI.h:228
static Handle(TColStd_HArray1OfByte) getTexture(int