Salome HOME
Update code documentation
[modules/shaper.git] / src / PartSet / PartSet_Module.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef PartSet_Module_H
4 #define PartSet_Module_H
5
6 #include "PartSet.h"
7 #include "PartSet_Filters.h"
8 #include "PartSet_SketcherMgr.h"
9
10 #include <ModuleBase_IModule.h>
11 #include <ModuleBase_Definitions.h>
12 #include <ModelAPI_Feature.h>
13 #include <ModelAPI_Attribute.h>
14 #include <ModelAPI_CompositeFeature.h>
15
16 //#include <StdSelect_FaceFilter.hxx>
17 #include <TopoDS_Shape.hxx>
18
19 #include <QMap>
20 #include <QObject>
21
22 #include <string>
23
24 #include <memory>
25
26 class ModuleBase_Operation;
27 class ModuleBase_IViewWindow;
28
29 /**
30 * \ingroup Module
31 * Implementation of Partset module
32 */
33 class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
34 {
35 Q_OBJECT
36
37 /// Enumeration to specify the restart operation properties.
38 enum RestartingMode {
39   RM_None, /// the operation should not be restarted
40   RM_Forbided, /// the operation should not be restarted after there is no active widget
41   RM_LastFeatureUsed, /// the operation is restarted and use the previous feature for own initialization
42   RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature
43 };
44
45 public:
46   /// Constructor
47   /// \param theWshop a pointer to a workshop
48   PartSet_Module(ModuleBase_IWorkshop* theWshop);
49   virtual ~PartSet_Module();
50
51   /// Creates custom widgets for property panel
52   virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
53                                       Config_WidgetAPI* theWidgetApi, std::string theParentId,
54                                       QList<ModuleBase_ModelWidget*>& theModelWidgets);
55
56   /// Call back forlast tuning of property panel before operation performance
57   virtual void propertyPanelDefined(ModuleBase_Operation* theOperation);
58
59
60   /// Realizes some functionality by an operation start
61   /// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters
62   /// \param theOperation a started operation
63   virtual void operationStarted(ModuleBase_Operation* theOperation);
64
65   /// Realizes some functionality by an operation commit
66   /// Restarts sketcher operation automatically of it is necessary
67   /// \param theOperation a committed operation
68   virtual void operationCommitted(ModuleBase_Operation* theOperation);
69
70   /// Realizes some functionality by an operation abort
71   /// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters
72   /// \param theOperation an aborted operation
73   virtual void operationAborted(ModuleBase_Operation* theOperation);
74
75   /// Realizes some functionality by an operation stop
76   /// Hides all sketcher sub-Objects, displays sketcher result and removes selection filters
77   /// \param theOperation a stopped operation
78   virtual void operationStopped(ModuleBase_Operation* theOperation);
79
80 public slots:
81   /// SLOT, that is called by no more widget signal emitted by property panel
82   /// Set a specific flag to restart the sketcher operation
83   void onNoMoreWidgets();
84
85 protected slots:
86   /// Called when previous operation is finished
87   virtual void onSelectionChanged();
88
89   /// SLOT, that is called by key release in the viewer.
90   /// \param theWnd a view window
91   /// \param theEvent the key event
92   void onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent);
93
94   /// SLOT, that is called by enter key released
95   /// Set a specific type of restarting the current operation
96   void onEnterReleased();
97
98   /// SLOT, that is called by the current operation filling with the preselection.
99   /// It commits the operation of it is can be committed
100   void onOperationActivatedByPreselection();
101
102
103  protected:
104   /// Register validators for this module
105   virtual void registerValidators();
106
107   /// Register selection filters for this module
108   virtual void registerFilters();
109
110  private slots:
111    /// Processing of vertex selected
112    void onVertexSelected();
113
114  private:
115   /// Breaks sequense of automatically resterted operations
116   void breakOperationSequence();
117
118  private:
119    QString myLastOperationId;
120    FeaturePtr myLastFeature;
121
122    // Automatical restarting mode flag
123    RestartingMode myRestartingMode;
124
125   /// A filter which provides selection within a current document or whole PartSet
126   Handle(PartSet_GlobalFilter) myDocumentShapeFilter;
127
128   PartSet_SketcherMgr* mySketchMgr;
129 };
130
131 #endif