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;
22 class PARTSET_EXPORT PartSet_Module: public QObject, public XGUI_Module
27 PartSet_Module(XGUI_Workshop* theWshop);
28 virtual ~PartSet_Module();
30 /// Returns the module workshop
31 /// \returns a workshop instance
32 XGUI_Workshop* workshop() const;
34 virtual void createFeatures();
35 virtual void featureCreated(XGUI_Command* theFeature);
36 virtual QStringList nestedFeatures(QString theFeature);
37 std::string featureFile(const std::string&);
39 /// Creates an operation and send it to loop
40 /// \param theCmdId the operation name
41 virtual void launchOperation(const QString& theCmdId);
43 /// Displays or erase the current operation preview, if it has it.
44 /// \param theFeature the feature instance to be displayed
45 /// \param isDisplay the state whether the presentation should be displayed or erased
46 /// \param isUpdateViewer the flag whether the viewer should be updated
47 void visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay,
48 const bool isUpdateViewer = true);
50 /// Activates the feature in the displayer
51 /// \param theFeature the feature instance to be displayed
52 /// \param isUpdateViewer the flag whether the viewer should be updated
53 void activateFeature(boost::shared_ptr<ModelAPI_Feature> theFeature,
54 const bool isUpdateViewer);
56 /// Updates current operation preview, if it has it.
57 /// \param theCmdId the operation name
58 void updateCurrentPreview(const std::string& theCmdId);
61 void onFeatureTriggered();
62 /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
63 /// by the operation start
64 void onOperationStopped(ModuleBase_Operation* theOperation);
66 /// SLOT, that is called by mouse press in the viewer.
67 /// The mouse released point is sent to the current operation to be processed.
68 /// \param theEvent the mouse event
69 void onMousePressed(QMouseEvent* theEvent);
70 /// SLOT, that is called by mouse release in the viewer.
71 /// The mouse released point is sent to the current operation to be processed.
72 /// \param theEvent the mouse event
73 void onMouseReleased(QMouseEvent* theEvent);
74 /// SLOT, that is called by mouse move in the viewer.
75 /// The mouse moved point is sent to the current operation to be processed.
76 /// \param theEvent the mouse event
77 void onMouseMoved(QMouseEvent* theEvent);
79 /// SLOT, that is called by the key in the viewer is clicked.
80 /// \param theEvent the mouse event
81 void onKeyRelease(QKeyEvent*);
83 /// SLOT, to apply to the current viewer the operation
84 /// \param theX the X projection value
85 /// \param theY the Y projection value
86 /// \param theZ the Z projection value
87 void onPlaneSelected(double theX, double theY, double theZ);
89 void onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
91 /// SLOT, to switch on/off the multi selection in the viewer
92 /// \param theEnabled the enabled state
93 void onMultiSelectionEnabled(bool theEnabled);
95 /// SLOT, to stop or start selection for the features
96 /// \param theFeatures a list of features to be disabled
97 /// \param theToStop the boolean state whether it it stopped or non stopped
98 void onStopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isStop);
100 /// SLOT, to visualize the feature in another local context mode
101 /// \param theFeature the feature to be put in another local context mode
102 /// \param theMode the mode appeared on the feature
103 void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
106 /// Creates a new operation
107 /// \param theCmdId the operation name
108 ModuleBase_Operation* createOperation(const std::string& theCmdId);
110 /// Sends the operation
111 /// \param theOperation the operation
112 void sendOperation(ModuleBase_Operation* theOperation);
115 XGUI_Workshop* myWorkshop;
116 PartSet_Listener* myListener;
118 std::map<std::string, std::string> myFeaturesInFiles;