1 #ifndef PartSet_Module_H
2 #define PartSet_Module_H
6 #include <ModuleBase_IModule.h>
7 #include <ModuleBase_Definitions.h>
8 #include <ModuleBase_ViewerFilters.h>
9 #include <XGUI_Command.h>
10 #include <ModelAPI_Feature.h>
11 #include <ModelAPI_CompositeFeature.h>
13 #include <StdSelect_FaceFilter.hxx>
14 #include <TopoDS_Shape.hxx>
23 class ModuleBase_Operation;
24 class ModuleBase_IViewWindow;
26 class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
31 PartSet_Module(ModuleBase_IWorkshop* theWshop);
32 virtual ~PartSet_Module();
34 /// Creates custom widgets for property panel
35 virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
36 Config_WidgetAPI* theWidgetApi, std::string theParentId,
37 QList<ModuleBase_ModelWidget*>& theModelWidgets);
39 /// Call back forlast tuning of property panel before operation performance
40 virtual void propertyPanelDefined(ModuleBase_Operation* theOperation);
42 QStringList sketchOperationIdList() const;
45 /// Called when previous operation is finished
46 virtual void onOperationComitted(ModuleBase_Operation* theOperation);
48 virtual void onOperationAborted(ModuleBase_Operation* theOperation);
50 virtual void onOperationStarted(ModuleBase_Operation* theOperation);
52 virtual void onOperationStopped(ModuleBase_Operation* theOperation);
54 /// Called when previous operation is finished
55 virtual void onSelectionChanged();
57 /// SLOT, that is called by mouse press in the viewer.
58 /// The mouse released point is sent to the current operation to be processed.
59 /// \param theEvent the mouse event
60 void onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
62 /// SLOT, that is called by mouse release in the viewer.
63 /// The mouse released point is sent to the current operation to be processed.
64 /// \param theEvent the mouse event
65 virtual void onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
67 /// SLOT, that is called by mouse move in the viewer.
68 /// The mouse moved point is sent to the current operation to be processed.
69 /// \param theEvent the mouse event
70 virtual void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
72 /// Launches the operation from current highlighting
76 /// Returns new instance of operation object (used in createOperation for customization)
77 virtual ModuleBase_Operation* getNewOperation(const std::string& theFeatureId);
79 /// Register validators for this module
80 virtual void registerValidators();
83 void onVertexSelected(ObjectPtr theObject, const TopoDS_Shape& theShape);
86 /// Converts mouse position to 2d coordinates.
87 /// Member myCurrentSketch has to be correctly defined
88 void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
89 double& theX, double& theY);
91 /// Breaks sequense of automatically resterted operations
92 void breakOperationSequence();
95 QString myLastOperationId;
96 FeaturePtr myLastFeature;
101 // Automatical restarting mode flag
102 bool myRestartingMode;
104 double myCurX, myCurY;
105 CompositeFeaturePtr myCurrentSketch;
106 QList<FeaturePtr> myEditingFeatures;