Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / PartSet / PartSet_OperationFeatureCreate.h
index 606bdc3bfefa98b7e5a45fa9d751076a1f104f84..b13b8ece551344d3efb079359872832f4d886f77 100644 (file)
@@ -7,12 +7,11 @@
 
 #include "PartSet.h"
 
-#include <PartSet_OperationSketchBase.h>
+#include <PartSet_OperationFeatureBase.h>
 #include <PartSet_Constants.h>
 
 #include <QObject>
 
-class PartSet_FeaturePrs;
 class GeomDataAPI_Point2D;
 class QMouseEvent;
 class QKeyEvent;
@@ -20,76 +19,52 @@ class QKeyEvent;
 /*!
  \class PartSet_OperationFeatureCreate
  * \brief The operation for the sketch feature creation
-*/
-class PARTSET_EXPORT PartSet_OperationFeatureCreate : public PartSet_OperationSketchBase
+ */
+class PARTSET_EXPORT PartSet_OperationFeatureCreate : public PartSet_OperationFeatureBase
 {
-  Q_OBJECT
+Q_OBJECT
 
-public:
+ public:
   /// Returns true if the feature with the given kind can be created by this operation
   /// \param theId the feature kind
   /// \return the boolean result
   static bool canProcessKind(const std::string& theId);
 
-public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
   /// \param theSketch the parent feature
-  PartSet_OperationFeatureCreate(const QString& theId, QObject* theParent,
-                                 FeaturePtr theSketch);
+  PartSet_OperationFeatureCreate(
+    const QString& theId, QObject* theParent, CompositeFeaturePtr theSketch);
   /// Destructor
   virtual ~PartSet_OperationFeatureCreate();
 
-  /// Verifies whether this operator can be commited.
-  /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
-  virtual bool canBeCommitted() const;
-
-  /// Returns that this operator can be started above already running one.
-   /// The runned operation should be the sketch feature modified operation
-  /// \param theOperation the previous running operation
-  virtual bool isGranted(ModuleBase_IOperation* theOperation) const;
-
-  /// 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(FeaturePtr theFeature) const;
-
-  /// Initializes some fields accorging to the feature
-  /// \param theSelected the list of selected presentations
-  /// \param theHighlighted the list of highlighted presentations
-  virtual void init(FeaturePtr theFeature,
-                    const std::list<XGUI_ViewerPrs>& theSelected,
-                    const std::list<XGUI_ViewerPrs>& theHighlighted);
-
-  /// Returns the operation sketch feature
-  /// \returns the sketch instance
-  virtual FeaturePtr sketch() const;
+  /// 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);
 
   /// Gives the current selected objects to be processed by the operation
   /// \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<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
-  /// 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 mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
   /// Processes the key pressed in the view
   /// \param theKey a key value
   virtual void keyReleased(const int theKey);
 
-  virtual void keyReleased(std::string theName, QKeyEvent* theEvent);
+  /// Initializes the operation with previously created feature. It is used in sequental operations
+  void initFeature(FeaturePtr theFeature) { myInitFeature = theFeature; }
 
-public slots:
+ public slots:
   /// Slots which listen the mode widget activation
   /// \param theWidget the model widget
   virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
 
-protected:
+ protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
   /// After the parent operation body perform, set sketch feature to the created line feature
@@ -111,37 +86,16 @@ protected:
   /// the sketch feature
   /// \param theFlushMessage the flag whether the create message should be flushed
   /// \returns the created feature
-  virtual FeaturePtr createFeature(const bool theFlushMessage = true);
+  virtual FeaturePtr createFeature(const bool theFlushMessage = true,
+    CompositeFeaturePtr theCompositeFeature = CompositeFeaturePtr());
+
+  /// Verifies whether this operator can be commited.
+  /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
+  virtual bool canBeCommitted() const;
 
 protected:
-  ///< Set the point selection mode. Emit signal about focus change if necessary.
-  /// \param theMode a new selection mode
-  /// \param isToEmitSignal the neccessity to emit signal
-  //void setPointSelectionMode(const PartSet_SelectionMode& theMode,
-  //                           const bool isToEmitSignal = true);
-
-  /// Returns true if the active widget is the point selector widget
-  /// \return the boolean value
-  bool isPointWidget() const;
-
-  /// Set the point to the active widget
-  /// \param theX the horizontal coordinate
-  /// \param theY the vertical coordinate
-  /// \return true if the point is set
-  bool setWidgetPoint(double theX, double theY);
-
-  /// Set the feature to the active widget
-  /// \param theFeature a feature
-  /// \return true if the feature is set
-  bool setWidgetFeature(const FeaturePtr& theFeature);
-
-private:
-  //boost::shared_ptr<PartSet_FeaturePrs> myFeaturePrs; ///< the feature presentation
-  FeaturePtr myInitFeature; ///< the initial feature
-  FeaturePtr mySketch; ///< the sketch of the feature
-  //PartSet_SelectionMode myPointSelectionMode; ///< point selection mode
-
-  ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
+  /// Feature of previous operation (for sequintal operations)
+  FeaturePtr myInitFeature;
 };
 
 #endif