1 #ifndef PartSet_Module_H
2 #define PartSet_Module_H
6 #include <XGUI_Module.h>
7 #include <XGUI_Command.h>
14 #include <boost/shared_ptr.hpp>
18 class PartSet_Listener;
19 class ModelAPI_Feature;
21 class PARTSET_EXPORT PartSet_Module: public QObject, public XGUI_Module
26 PartSet_Module(XGUI_Workshop* theWshop);
27 virtual ~PartSet_Module();
29 /// Returns the module workshop
30 /// \returns a workshop instance
31 XGUI_Workshop* workshop() const;
33 virtual void createFeatures();
34 virtual void featureCreated(QAction* theFeature);
35 virtual QStringList nestedFeatures(QString theFeature);
36 std::string featureFile(const std::string&);
38 /// Creates an operation and send it to loop
39 /// \param theCmdId the operation name
40 virtual void launchOperation(const QString& theCmdId);
42 /// Displays or erase the current operation preview, if it has it.
44 /// \param isDisplay the state whether the presentation should be displayed or erased
45 void visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay);
47 /// Updates current operation preview, if it has it.
48 /// \param theCmdId the operation name
49 void updateCurrentPreview(const std::string& theCmdId);
52 void onFeatureTriggered();
53 /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
54 /// by the operation start
55 void onOperationStopped(ModuleBase_Operation* theOperation);
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(QMouseEvent* theEvent);
61 /// SLOT, that is called by mouse release in the viewer.
62 /// The mouse released point is sent to the current operation to be processed.
63 /// \param theEvent the mouse event
64 void onMouseReleased(QMouseEvent* theEvent);
65 /// SLOT, that is called by mouse move in the viewer.
66 /// The mouse moved point is sent to the current operation to be processed.
67 /// \param theEvent the mouse event
68 void onMouseMoved(QMouseEvent* theEvent);
70 /// SLOT, that is called by the key in the viewer is clicked.
71 /// \param theEvent the mouse event
72 void onKeyRelease(QKeyEvent*);
74 /// SLOT, to apply to the current viewer the operation
75 /// \param theX the X projection value
76 /// \param theY the Y projection value
77 /// \param theZ the Z projection value
78 void onPlaneSelected(double theX, double theY, double theZ);
80 void onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
82 /// SLOT, to switch on/off the multi selection in the viewer
83 /// \param theEnabled the enabled state
84 void onMultiSelectionEnabled(bool theEnabled);
86 /// SLOT, to visualize the feature in another local context mode
87 /// \param theFeature the feature to be put in another local context mode
88 /// \param theMode the mode appeared on the feature
89 void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
92 /// Creates a new operation
93 /// \param theCmdId the operation name
94 ModuleBase_Operation* createOperation(const std::string& theCmdId);
96 /// Sends the operation
97 /// \param theOperation the operation
98 void sendOperation(ModuleBase_Operation* theOperation);
101 XGUI_Workshop* myWorkshop;
102 PartSet_Listener* myListener;
104 std::map<std::string, std::string> myFeaturesInFiles;