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_Attribute.h>
12 #include <ModelAPI_CompositeFeature.h>
14 #include <StdSelect_FaceFilter.hxx>
15 #include <TopoDS_Shape.hxx>
24 class ModuleBase_Operation;
25 class ModuleBase_IViewWindow;
27 class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
32 PartSet_Module(ModuleBase_IWorkshop* theWshop);
33 virtual ~PartSet_Module();
35 /// Creates custom widgets for property panel
36 virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
37 Config_WidgetAPI* theWidgetApi, std::string theParentId,
38 QList<ModuleBase_ModelWidget*>& theModelWidgets);
40 /// Call back forlast tuning of property panel before operation performance
41 virtual void propertyPanelDefined(ModuleBase_Operation* theOperation);
43 QStringList sketchOperationIdList() const;
46 /// Called when previous operation is finished
47 virtual void onOperationComitted(ModuleBase_Operation* theOperation);
49 virtual void onOperationAborted(ModuleBase_Operation* theOperation);
51 virtual void onOperationStarted(ModuleBase_Operation* theOperation);
53 virtual void onOperationStopped(ModuleBase_Operation* theOperation);
55 /// Called when previous operation is finished
56 virtual void onSelectionChanged();
58 /// SLOT, that is called by mouse press in the viewer.
59 /// The mouse released point is sent to the current operation to be processed.
60 /// \param theEvent the mouse event
61 void onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
63 /// SLOT, that is called by mouse release in the viewer.
64 /// The mouse released point is sent to the current operation to be processed.
65 /// \param theEvent the mouse event
66 virtual void onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
68 /// SLOT, that is called by mouse move in the viewer.
69 /// The mouse moved point is sent to the current operation to be processed.
70 /// \param theEvent the mouse event
71 virtual void onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
73 /// Launches the operation from current highlighting
77 /// Returns new instance of operation object (used in createOperation for customization)
78 virtual ModuleBase_Operation* getNewOperation(const std::string& theFeatureId);
80 /// Register validators for this module
81 virtual void registerValidators();
84 void onVertexSelected(ObjectPtr theObject, const TopoDS_Shape& theShape);
86 void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
89 /// Converts mouse position to 2d coordinates.
90 /// Member myCurrentSketch has to be correctly defined
91 void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
92 double& theX, double& theY);
94 /// Breaks sequense of automatically resterted operations
95 void breakOperationSequence();
98 QString myLastOperationId;
99 FeaturePtr myLastFeature;
104 // Automatical restarting mode flag
105 bool myRestartingMode;
107 double myCurX, myCurY;
108 CompositeFeaturePtr myCurrentSketch;
109 QList<FeaturePtr> myEditingFeatures;
110 QList<AttributePtr> myEditingAttr;
112 Handle(ModuleBase_ShapeInPlaneFilter) myPlaneFilter;
113 /// A filter which provides selection within a current document or whole PartSet
114 Handle(ModuleBase_ShapeDocumentFilter) myDocumentShapeFilter;