SHAPER 9.16.0
XGUI_Workshop.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef XGUI_WORKSHOP_H
21#define XGUI_WORKSHOP_H
22
23#include "XGUI.h"
24
25#include <ModelAPI_Document.h>
26#include <ModelAPI_Feature.h>
27#include <ModelAPI_ResultBody.h>
28
29#include <ModuleBase_ActionInfo.h>
30#include <ModuleBase_ActionType.h>
31#include <ModuleBase_Definitions.h>
32
33#include <SelectMgr_ListOfFilter.hxx>
34
35#include <QIcon>
36#include <QObject>
37#include <QKeySequence>
38#include <QMap>
39#include <QTemporaryDir>
40
41#ifndef HAVE_SALOME
42class AppElements_Command;
43class AppElements_MainWindow;
44class AppElements_Workbench;
45#endif
46
48
49class XGUI_ActionsMgr;
52class XGUI_Displayer;
54class XGUI_ErrorMgr;
55class XGUI_FacesPanel;
56class XGUI_MenuMgr;
62class XGUI_SalomeViewer;
69
73
74class QAction;
75class QDockWidget;
76class QMainWindow;
77class QWidget;
78
82class XGUI_EXPORT XGUI_Workshop : public QObject
83{
84Q_OBJECT
85 public:
89 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
90 virtual ~XGUI_Workshop();
91
94 QDockWidget* createConstraintsBrowser(QWidget* theParent);
95
96 void removeConstrBrowser() { mySkConstBrwsr = NULL; }
97
99 void startApplication();
100
102 void activateModule();
103
105 void deactivateModule();
106
107#ifndef HAVE_SALOME
109 AppElements_MainWindow* mainWindow() const { return myMainWindow; }
110
112 AppElements_Workbench* addWorkbench(const QString& theName);
113#endif
114
116 XGUI_SelectionMgr* selector() const { return mySelector; }
117
119 XGUI_SelectionActivate* selectionActivate() const { return mySelectionActivate; }
120
122 XGUI_Displayer* displayer() const { return myDisplayer; }
123
125 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
126
128 XGUI_ErrorMgr* errorMgr() const { return myErrorMgr; }
129
131 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; }
132
134 XGUI_ActiveControlMgr* activeControlMgr() const { return myActiveControlMgr; }
135
137 XGUI_MenuMgr* menuMgr() const { return myMenuMgr; }
138
140 XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
141
143 XGUI_InspectionPanel* inspectionPanel() const { return myInspectionPanel; }
144
146 XGUI_FacesPanel* facesPanel() const { return myFacesPanel; }
147
149 XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; }
150
152 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
153
155 ModuleBase_IViewer* salomeViewer() const;
156
158 bool isSalomeMode() const { return mySalomeConnector != 0; }
159
161 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
162
164 XGUI_SketchConstraintsBrowser* constraintsBrowser() const { return mySkConstBrwsr; }
165
167 void salomeViewerSelectionChanged();
168
170 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
171
174 XGUI_ModuleConnector* moduleConnector() const { return myModuleConnector; }
175
178 QMainWindow* desktop() const;
179
184 virtual bool prepareForDisplay(const std::set<ObjectPtr>& theObjects) const;
185
187 void deleteObjects();
188
190 void editConstraints();
191
192 void deactivateCosntraint();
193
197 void cleanHistory();
198
201 bool canMoveFeature();
202
204 void moveObjects(const bool theSplit);
205
207 void recoverFeature();
208
212 bool canBeShaded(const ObjectPtr& theObject) const;
213
217 bool canChangeProperty(const QString& theActionName) const;
218
222 void changeColor(const QMap<ResultPtr, QList<GeomShapePtr>>& theSelectedObjects);
223
227 void changeAutoColor(const QMap<ResultPtr, QList<GeomShapePtr>>& theSelectedObjects);
228
232 void changeDeflection(const QObjectPtrList& theObjects);
233
237 void changeTransparency(const QObjectPtrList& theObjects);
238
241 void changeIsoLines(const QObjectPtrList& theObjects);
242
244 void showObjects(const QObjectPtrList& theList, bool isVisible);
245
247 void showOnlyObjects(const QObjectPtrList& theList);
248
252 void setDisplayMode(const QObjectPtrList& theList, int theMode);
253
255 void toggleEdgesDirection(const QObjectPtrList& theList);
256
258 void toggleBringToFront(const QObjectPtrList& theList);
259
262 void setViewerSelectionMode(int theMode);
263
265 void activateObjectsSelection(const QObjectPtrList& theList);
266
268 ModuleBase_IModule* module() const { return myModule; }
269
271 QString currentDataFile() const { return myCurrentFile; }
272
274 void setCurrentDataFile(const QString& theDir) { myCurrentFile = theDir; }
275
279 void saveDocument(const QString& theName, std::list<std::string>& theFileNames);
280
285 bool abortAllOperations();
286
290 void operationStarted(ModuleBase_Operation* theOperation);
291
295 bool deleteFeatures(const QObjectPtrList& theFeatures);
296
301 void deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer);
302
305 bool isFeatureOfNested(const FeaturePtr& theFeature);
306
309 void setStatusBarMessage(const QString& theMessage);
310
311#ifdef HAVE_SALOME
313 void synchronizeViewer();
314
319 void synchronizeGroupInViewer(const DocumentPtr& theDoc,
320 bool theUpdateViewer);
321
322 void synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer);
323
324#endif
328 void fillPropertyPanel(ModuleBase_Operation* theOperation);
329
332 void connectToPropertyPanel(const bool isToConnect);
333
335 QIntList viewerSelectionModes() const { return myViewerSelMode; }
336
339 void highlightResults(const QObjectPtrList& theObjects);
340
343 void highlightFeature(const QObjectPtrList& theObjects);
344
347 const Config_DataModelReader* dataModelXMLReader() const { return myDataModelXMLReader; }
348
351 static QString MOVE_TO_END_COMMAND;
355
358 void openFile(const QString& theDirectory);
359
360 void updateAutoComputeState();
361
362 void deactivateCurrentSelector();
363
365 void updateColorScaleVisibility();
366
368 void updateGroupsText();
369
370 void showHelpPage(const QString& thePage) const;
371
372 void setBackupState(bool theDoBackup=true);
373
374 bool backupState() const { return myDoBackup; }
375
376 void setWaitForBackup(bool theDoWait=true);
377
378 bool waitForBackup() const { return myWaitForBackup; }
379
380signals:
383
386
389
391 void updateUndoHistory(const QList<ActionInfo>&);
392
394 void updateRedoHistory(const QList<ActionInfo>&);
395
396 public slots:
398 void updateCommandStatus();
399
401 void updateHistory();
402
404 bool onSave();
405
407 bool onSaveAs();
408
410 void onUndo(int times = 1);
411
413 void onRedo(int times = 1);
414
417 void onWidgetStateChanged(int thePreviousState);
418
421 void onValuesChanged();
422
424 void onWidgetObjectUpdated();
425
427 void showPanel(QDockWidget* theDockWidget);
428
430 void hidePanel(QDockWidget* theDockWidget);
431
433 void showObjectBrowser();
434
436 void hideObjectBrowser();
437
439 void showConstraintsBrowser();
440
442 void hideConstraintsBrowser();
443
445 void closeDocument();
446
448 void onOpen();
449
451 void onNew();
452
454 void onImportPart();
455
457 void onImportShape();
458
460 void onImportImage();
461
463 void onExportPart();
464
466 void onExportShape();
467
468#ifndef HAVE_SALOME
470 void onExit();
471
473 void onPreferences();
474#endif
475
477 void onAutoApply();
478
480 void onTrihedronVisibilityChanged(bool theState);
481
483 void onTransparencyValueChanged();
484
485 protected:
489 void setGrantedFeatures(ModuleBase_Operation* theOperation);
490
491private:
494 void displayDocumentResults(DocumentPtr theDoc);
495
497 void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
498
500 void insertFeatureFolder();
501
503 void insertToFolder(bool isBefore);
504
506 void moveOutFolder(bool isBefore);
507
508 private slots:
512 virtual void onOperationResumed(ModuleBase_Operation* theOperation);
513
517 virtual void onOperationStopped(ModuleBase_Operation* theOperation);
518
521 virtual void onOperationCommitted(ModuleBase_Operation* theOperation);
522
525 void onOperationAborted(ModuleBase_Operation* theOperation);
526
530 void onContextMenuCommand(const QString& theId, bool isChecked);
531
533 void onStartWaiting();
534
537 void onAcceptActionClicked();
538
541 void onAcceptPlusActionClicked();
542
545 void onPreviewActionClicked();
546
548 void onHelpActionClicked() const;
549
551 void onDockSizeChanged();
552
553 private:
555 void initMenu();
556
558 void registerValidators() const;
559
562 ModuleBase_IModule* loadModule(const QString& theModule);
563
565 bool createModule();
566
569 QDockWidget* createObjectBrowser(QWidget* theParent);
570
571 // Creates Dock widgets: Object browser and Property panel
572 void createDockWidgets();
573
579 void addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot);
580
582 QList<ActionInfo> processHistoryList(const std::list<std::string>&) const;
583
587 void processUndoRedo(const ModuleBase_ActionType theActionType, int theTimes);
588
590 void clearTemporaryDir();
591
594 void setNormalView(bool toInvert = false);
595
596private:
597#ifndef HAVE_SALOME
598 AppElements_MainWindow* myMainWindow;
599#endif
600
601 XGUI_SketchConstraintsBrowser* mySkConstBrwsr; // ~~!!!!~~
602 ModuleBase_IModule* myModule;
603 XGUI_ErrorMgr* myErrorMgr;
604 XGUI_ObjectsBrowser* myObjectBrowser;
605 XGUI_PropertyPanel* myPropertyPanel;
606 XGUI_FacesPanel* myFacesPanel;
607 XGUI_SelectionMgr* mySelector;
608 XGUI_SelectionActivate* mySelectionActivate;
609 XGUI_Displayer* myDisplayer;
610 XGUI_OperationMgr* myOperationMgr;
611 XGUI_ActionsMgr* myActionsMgr;
612 XGUI_ActiveControlMgr* myActiveControlMgr;
613 XGUI_MenuMgr* myMenuMgr;
614 XGUI_SalomeConnector* mySalomeConnector;
615 XGUI_ErrorDialog* myErrorDlg;
616 XGUI_ViewerProxy* myViewerProxy;
617 XGUI_ContextMenuMgr* myContextMenuMgr;
618 XGUI_ModuleConnector* myModuleConnector;
619 XGUI_WorkshopListener* myEventsListener;
620 QString myCurrentFile;
621 QIntList myViewerSelMode;
622 Config_DataModelReader* myDataModelXMLReader;
623 XGUI_InspectionPanel* myInspectionPanel;
624 QTemporaryDir myTmpDir;
625 bool myDoBackup;
626 bool myWaitForBackup;
627};
628
629#endif
Class that reads data model definition XML for further processing in the XGUI_DataModel.
Definition: Config_DataModelReader.h:36
Interface to a module.
Definition: ModuleBase_IModule.h:70
A Base object for definition of connector object to Salome Viewer.
Definition: ModuleBase_IViewer.h:47
Base class for all operations.
Definition: ModuleBase_Operation.h:53
class XGUI_ActionsMgrA class for management of actions (features) activation/deactivation
Definition: XGUI_ActionsMgr.h:45
Interface of providing only one active control for workshop.
Definition: XGUI_ActiveControlMgr.h:38
A class which manages the context menu.
Definition: XGUI_ContextMenuMgr.h:39
Displayer.
Definition: XGUI_Displayer.h:172
A class of dialog to show error message.
Definition: XGUI_ErrorDialog.h:34
Class of Errors manager object.
Definition: XGUI_ErrorMgr.h:42
A Hide Faces panel for making it possible to hide faces in the 3D view.
Definition: XGUI_FacesPanel.h:72
A class which represents an inspection panel: to show content of currently selected objects.
Definition: XGUI_InspectionPanel.h:55
A class for management of menu actions (features).
Definition: XGUI_MenuMgr.h:44
Implementation of IWorkshop interface which provides access to Workshop services at module level.
Definition: XGUI_ModuleConnector.h:35
Object browser window object.
Definition: XGUI_ObjectsBrowser.h:154
Operation manager.
Definition: XGUI_OperationMgr.h:49
Realization of Property panel object.
Definition: XGUI_PropertyPanel.h:61
An interface which provides a connection of XGUI functionality with functionality of SALOME module in...
Definition: XGUI_SalomeConnector.h:40
A class which implements activation/deactivate selection modes and using selection filters.
Definition: XGUI_SelectionActivate.h:41
Selection manager.
Definition: XGUI_SelectionMgr.h:46
Object browser window object.
Definition: XGUI_SketchConstraintsBrowser.h:92
Proxy class which repersents or AppElements_Viewer or Salome Viewer dependently on current launching ...
Definition: XGUI_ViewerProxy.h:49
Class which process the events from the event loop.
Definition: XGUI_WorkshopListener.h:47
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:83
void salomeViewerSelection()
Emitted when selection happens in Salome viewer.
void updateRedoHistory(const QList< ActionInfo > &)
Signal to update Redo history list.
bool isSalomeMode() const
Returns true if the application works as SALOME module.
Definition: XGUI_Workshop.h:158
XGUI_SalomeConnector * salomeConnector() const
Returns an object which provides interface to Salome Module (LightApp_Module)
Definition: XGUI_Workshop.h:152
void applicationStarted()
the application is started
QString currentDataFile() const
Returns current file.
Definition: XGUI_Workshop.h:271
XGUI_ObjectsBrowser * objectBrowser() const
Returns Object browser.
Definition: XGUI_Workshop.h:161
XGUI_MenuMgr * menuMgr() const
Returns an actions manager.
Definition: XGUI_Workshop.h:137
XGUI_OperationMgr * operationMgr() const
Returns operation manager.
Definition: XGUI_Workshop.h:125
static QString MOVE_TO_END_SPLIT_COMMAND
A constant string used for "Move to end and split" command definition It is used for specific process...
Definition: XGUI_Workshop.h:354
XGUI_Displayer * displayer() const
Returns displayer.
Definition: XGUI_Workshop.h:122
void setCurrentDataFile(const QString &theDir)
Returns current file.
Definition: XGUI_Workshop.h:274
ModuleBase_IModule * module() const
Returns current module.
Definition: XGUI_Workshop.h:268
static QString MOVE_TO_END_COMMAND
A constant string used for "Move to end" command definition It is used for specific processing of Und...
Definition: XGUI_Workshop.h:351
XGUI_ModuleConnector * moduleConnector() const
Returns the module connector.
Definition: XGUI_Workshop.h:174
XGUI_ActionsMgr * actionsMgr() const
Returns an actions manager.
Definition: XGUI_Workshop.h:131
XGUI_SketchConstraintsBrowser * constraintsBrowser() const
Returns Sketch constraints browser.
Definition: XGUI_Workshop.h:164
XGUI_SelectionMgr * selector() const
Returns selection manager object.
Definition: XGUI_Workshop.h:116
XGUI_PropertyPanel * propertyPanel() const
Returns property panel widget.
Definition: XGUI_Workshop.h:140
XGUI_ContextMenuMgr * contextMenuMgr() const
Returns context menu manager object.
Definition: XGUI_Workshop.h:149
XGUI_InspectionPanel * inspectionPanel() const
Returns property panel widget.
Definition: XGUI_Workshop.h:143
AppElements_MainWindow * mainWindow() const
Returns main window (Desktop) of the application.
Definition: XGUI_Workshop.h:109
QIntList viewerSelectionModes() const
Returns default selection mode in 3d viewer.
Definition: XGUI_Workshop.h:335
const Config_DataModelReader * dataModelXMLReader() const
Returns Data Model XML reader which contains information about Data structure configuration.
Definition: XGUI_Workshop.h:347
XGUI_SelectionActivate * selectionActivate() const
Returns selection activating object.
Definition: XGUI_Workshop.h:119
XGUI_ActiveControlMgr * activeControlMgr() const
Returns an active control manager.
Definition: XGUI_Workshop.h:134
XGUI_ErrorMgr * errorMgr() const
Returns error manager.
Definition: XGUI_Workshop.h:128
void updateUndoHistory(const QList< ActionInfo > &)
Signal to update Undo history list.
XGUI_FacesPanel * facesPanel() const
Returns panel for hide object faces.
Definition: XGUI_Workshop.h:146
XGUI_ViewerProxy * viewer() const
Returns viewer which unifies access as to Salome viewer as to standalone viewer.
Definition: XGUI_Workshop.h:170
void commandStatusUpdated()
the signal about the workshop actions states are updated.