Salome HOME
Issue #205: Rotate view on selection of sketch plane and not rotate on selection...
[modules/shaper.git] / src / PartSet / PartSet_OperationSketch.h
index 1cd920158bfa099b852c12d1ecfbbc40ccc6d99f..eb3fa84f4a182368c025a3d64b05881d1ea6ecfa 100644 (file)
 #include <SketchPlugin_Sketch.h>
 
 #include <QObject>
+#include <QList>
 
 class Handle_AIS_InteractiveObject;
 
 /*!
  \class PartSet_OperationSketch
  * \brief The operation for the sketch feature creation
-*/
+ */
 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Returns the operation type key
-  static std::string Type() { return SketchPlugin_Sketch::ID(); }
+  static std::string Type()
+  {
+    return SketchPlugin_Sketch::ID();
+  }
 
-public:
+ public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
@@ -34,39 +38,33 @@ public:
   /// Destructor
   virtual ~PartSet_OperationSketch();
 
-  /// Returns the operation local selection mode
-  /// \param theFeature the feature object to get the selection mode
-  /// \return the selection mode
-  virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
+  /// Returns True if the given operation is a Sketcher operation
+  virtual bool isGranted(ModuleBase_Operation* theOperation) const;
 
-  /// Initializes the operation with previously created feature. It is used in sequental operations
-  virtual void initFeature(FeaturePtr theFeature);
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
-  virtual FeaturePtr sketch() const;
+  virtual CompositeFeaturePtr sketch() const;
 
   /// Processes the mouse pressed in the point
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
+
   /// Processes the mouse release in the point
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                             ModuleBase_ISelection* theSelection);
 
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+  virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
 
   /// Returns the list of the nested features
   /// \return the list of subfeatures
@@ -88,7 +86,15 @@ public:
 
   /// Set the plane to the current sketch
   /// \param theShape the shape
-  void setSketchPlane(const TopoDS_Shape& theShape);
+  /// \return selected direction
+  boost::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
+  
+  /// Called on selection changed when the operation is active
+  virtual void selectionChanged(ModuleBase_ISelection* theSelection);
+
+  /// If operation needs to redisplay its result during operation
+  /// then this method has to return True
+  virtual bool hasPreview() const { return false; }
 
 signals:
   /// signal about the sketch plane is selected
@@ -99,13 +105,19 @@ signals:
   // signal about the viewer fit all perform
   void fitAllView();
 
-protected:
+  /// Signal to define sketch mode
+  void launchSketch();
+
+ protected:
   /// Virtual method called when operation started (see start() method for more description)
   /// Default impl calls corresponding slot and commits immediately.
   virtual void startOperation();
 
-private:
-  std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
+  /// Virtual method called after operation committed (see commit() method for more description)
+  virtual void afterCommitOperation();
+
+ private:
+  QList<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
 };
 
 #endif