Salome HOME
Adaptation of the application to SALOME interface (issue #31)
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchBase.h
index bcc3f3aa1a5e9f110ef679735ed8348e5a919074..62de3116be461513ee152639edc724378ec645e6 100644 (file)
 #include <gp_Pnt.hxx>
 #include <NCollection_List.hxx>
 
-#include <ModuleBase_PropPanelOperation.h>
+#include <ModuleBase_Operation.h>
+#include <ModuleBase_Operation.h>
 #include <QObject>
 
+#include <map>
+
+class Handle_V3d_View;
+class QMouseEvent;
 class GeomAPI_Shape;
+class XGUI_ViewerPrs;
 
 /*!
   \class PartSet_OperationSketchBase
   * \brief The base operation for the sketch features.
   *  Base class for all sketch operations. It provides an access to the feature preview
 */
-class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_PropPanelOperation
+class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_Operation
 {
   Q_OBJECT
+public:
+  enum FeatureActionMode { FM_Activation, FM_Deactivation, FM_Abort };
+
 public:
   /// Constructor
   /// \param theId an feature index
@@ -33,23 +42,74 @@ public:
   virtual ~PartSet_OperationSketchBase();
 
   /// Returns the feature preview shape
-  boost::shared_ptr<GeomAPI_Shape> preview() const;
+  /// \param theFeature the feature object to obtain the preview
+  boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+
+  /// Returns the map of the operation previews including the nested feature previews
+  /// \return the map of feature to the feature preview
+  virtual std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> > preview() const;
 
   /// Returns the operation local selection mode
+  /// \param theFeature the feature object to get the selection mode
   /// \return the selection mode
-  virtual int getSelectionMode() const = 0;
+  virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
+
+  /// Initializes some fields accorging to the feature
+  /// \param theFeature the feature
+  /// \param thePresentations the list of additional presentations
+  virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                    const std::list<XGUI_ViewerPrs>& thePresentations) {}
 
-  /// Gives the current selected objects to be processed by the operation
-  /// \param theList a list of interactive selected shapes
-  virtual void setSelectedShapes(const NCollection_List<TopoDS_Shape>& theList) {};
+  /// Processes the mouse pressed in the point
+  /// \param thePoint a point clicked in the viewer
+  /// \param theEvent the mouse event
+  /// \param theSelected the list of selected presentations
+  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
+                            const std::list<XGUI_ViewerPrs>& theSelected);
 
   /// Processes the mouse release in the point
   /// \param thePoint a point clicked in the viewer
-  virtual void mouseReleased(const gp_Pnt& thePoint) {};
+  /// \param theEvent the mouse event
+  /// \param theSelected the list of selected presentations
+  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+                             const std::list<XGUI_ViewerPrs>& theSelected);
 
   /// Processes the mouse move in the point
   /// \param thePoint a 3D point clicked in the viewer
-  virtual void mouseMoved(const gp_Pnt& thePoint) {};
+  /// \param theEvent the mouse event
+  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+
+  /// Processes the key pressed in the view
+  /// \param theKey a key value
+  virtual void keyReleased(const int theKey) {};
+
+signals:
+  /// Signal about the feature construing is finished
+  /// \param theFeature the result feature
+  /// \param theMode the mode of the feature modification
+  void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                          int theMode);
+  /// Signal about the features should be selected
+  /// \param theSelected the list of selected presentations
+  void featureSelected(const std::list<XGUI_ViewerPrs>& theSelected);
+  /// signal about the request to launch operation
+  /// theName the operation name
+  /// theFeature the operation argument
+  void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
+  /// signal to enable/disable multi selection in the viewer
+  /// \param theEnabled the boolean state
+  void multiSelectionEnabled(bool theEnabled);
+
+  /// signal to enable/disable usual selection in the viewer
+  /// \param theEnabled the boolean state
+  void selectionEnabled(bool theEnabled);
+
+protected:
+  /// Creates an operation new feature
+  /// In addition to the default realization it appends the created line feature to
+  /// the sketch feature
+  /// \returns the created feature
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
 };
 
 #endif