1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #ifndef PartSet_Module_H
4 #define PartSet_Module_H
7 #include "PartSet_Filters.h"
8 #include "PartSet_SketcherMgr.h"
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>
16 //#include <StdSelect_FaceFilter.hxx>
17 #include <TopoDS_Shape.hxx>
26 class ModuleBase_Operation;
27 class ModuleBase_IViewWindow;
31 * Implementation of Partset module
33 class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
37 /// Enumeration to specify the restart operation properties.
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
47 /// \param theWshop a pointer to a workshop
48 PartSet_Module(ModuleBase_IWorkshop* theWshop);
49 virtual ~PartSet_Module();
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);
56 /// Call back forlast tuning of property panel before operation performance
57 virtual void propertyPanelDefined(ModuleBase_Operation* theOperation);
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);
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);
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);
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);
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();
86 /// Called when previous operation is finished
87 virtual void onSelectionChanged();
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);
94 /// SLOT, that is called by enter key released
95 /// Set a specific type of restarting the current operation
96 void onEnterReleased();
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();
104 /// Register validators for this module
105 virtual void registerValidators();
107 /// Register selection filters for this module
108 virtual void registerFilters();
111 /// Processing of vertex selected
112 void onVertexSelected();
115 /// Breaks sequense of automatically resterted operations
116 void breakOperationSequence();
119 QString myLastOperationId;
120 FeaturePtr myLastFeature;
122 // Automatical restarting mode flag
123 RestartingMode myRestartingMode;
125 /// A filter which provides selection within a current document or whole PartSet
126 Handle(PartSet_GlobalFilter) myDocumentShapeFilter;
128 PartSet_SketcherMgr* mySketchMgr;