1 #ifndef PartSet_Module_H
2 #define PartSet_Module_H
6 #include <ModuleBase_IModule.h>
7 #include <ModuleBase_Definitions.h>
8 #include <XGUI_Command.h>
9 #include <XGUI_ViewerFilters.h>
10 #include <ModelAPI_Feature.h>
17 #include <boost/shared_ptr.hpp>
21 class PartSet_Listener;
22 class ModelAPI_Feature;
25 class ModuleBase_Operation;
26 class GeomAPI_AISObject;
28 class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
33 PartSet_Module(ModuleBase_IWorkshop* theWshop);
34 virtual ~PartSet_Module();
36 /// Reads description of features from XML file
37 virtual void createFeatures();
39 /// Called on creation of menu item in desktop
40 virtual void featureCreated(QAction* theFeature);
42 std::string featureFile(const std::string&);
44 /// Creates an operation and send it to loop
45 /// \param theCmdId the operation name
46 //virtual void launchOperation(const QString& theCmdId);
48 /// Activates the feature in the displayer
49 /// \param theFeature the feature instance to be displayed
50 /// \param isUpdateViewer the flag whether the viewer should be updated
51 void activateFeature(ObjectPtr theFeature, const bool isUpdateViewer);
53 /// Updates current operation preview, if it has it.
54 /// \param theCmdId the operation name
55 void updateCurrentPreview(const std::string& theCmdId);
57 /// Creates custom widgets for property panel
58 virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
59 Config_WidgetAPI* theWidgetApi,
60 QList<ModuleBase_ModelWidget*>& theModelWidgets);
62 XGUI_Workshop* xWorkshop() const;
65 void onFeatureTriggered();
66 /// SLOT, that is called after the operation is started. Connect on the focus activated signal
67 void onOperationStarted(ModuleBase_Operation* theOperation);
68 /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
69 /// by the operation start
70 void onOperationStopped(ModuleBase_Operation* theOperation);
71 /// SLOT, that is called afetr the popup menu action clicked.
72 void onContextMenuCommand(const QString& theId, bool isChecked);
73 /// SLOT, that is called by mouse press in the viewer.
74 /// The mouse released point is sent to the current operation to be processed.
75 /// \param theEvent the mouse event
76 void onMousePressed(QMouseEvent* theEvent);
77 /// SLOT, that is called by mouse release in the viewer.
78 /// The mouse released point is sent to the current operation to be processed.
79 /// \param theEvent the mouse event
80 void onMouseReleased(QMouseEvent* theEvent);
81 /// SLOT, that is called by mouse move in the viewer.
82 /// The mouse moved point is sent to the current operation to be processed.
83 /// \param theEvent the mouse event
84 void onMouseMoved(QMouseEvent* theEvent);
86 /// SLOT, that is called by the key in the viewer is clicked.
87 /// \param theEvent the mouse event
88 void onKeyRelease(QKeyEvent* theEvent);
90 /// SLOT, that is called by the mouse double click in the viewer.
91 /// \param theEvent the mouse event
92 void onMouseDoubleClick(QMouseEvent* theEvent);
94 /// SLOT, to apply to the current viewer the operation
95 /// \param theX the X projection value
96 /// \param theY the Y projection value
97 /// \param theZ the Z projection value
98 void onPlaneSelected(double theX, double theY, double theZ);
100 /// SLOT, to fit all current viewer
103 void onRestartOperation(std::string theName, ObjectPtr theFeature);
105 /// SLOT, to switch on/off the multi selection in the viewer
106 /// \param theEnabled the enabled state
107 void onMultiSelectionEnabled(bool theEnabled);
109 /// SLOT, to stop or start selection mode for the features
110 /// \param theFeatures a list of features to be disabled
111 /// \param theToStop the boolean state whether it it stopped or non stopped
112 void onStopSelection(const QList<ObjectPtr>& theFeatures, const bool isStop);
114 /// SLOT, to set selection
115 /// \param theFeatures a list of features to be selected
116 void onSetSelection(const QList<ObjectPtr>& theFeatures);
118 /// SLOT, to close the viewer local context
119 void onCloseLocalContext();
121 /// SLOT, to visualize the feature in another local context mode
122 /// \param theFeature the feature to be put in another local context mode
123 /// \param theMode the mode appeared on the feature
124 void onFeatureConstructed(ObjectPtr theFeature, int theMode);
126 /// Slot which reacts to the point 2d set to the feature. Creates a constraint
127 /// \param the feature
128 /// \param the attribute of the feature
129 void onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute);
132 /// Creates a new operation
133 /// \param theCmdId the operation name
134 /// \param theFeatureKind a kind of feature to get the feature xml description
135 ModuleBase_Operation* createOperation(const std::string& theCmdId,
136 const std::string& theFeatureKind = "");
140 //! Edits the feature
141 void editFeature(FeaturePtr theFeature);
144 //XGUI_Workshop* myWorkshop;
145 PartSet_Listener* myListener;
147 std::map<std::string, std::string> myFeaturesInFiles;
149 /// A filter which provides selection within a current document or whole PartSet
150 Handle(XGUI_ShapeDocumentFilter) myDocumentShapeFilter;