Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchLine.h
index 044e739ffd777c2c9b0e36df862780c35417ae06..b048ef8a7b451dc018878adf551a88a37d0a41af 100644 (file)
@@ -51,11 +51,15 @@ public:
   /// Gives the current selected objects to be processed by the operation
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
-  virtual void mouseReleased(const gp_Pnt& thePoint, QMouseEvent* theEvent);
+  /// \param theSelected the list of selected presentations
+ virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+                             const std::list<XGUI_ViewerPrs>& theSelected);
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
-  virtual void mouseMoved(const gp_Pnt& thePoint, QMouseEvent* theEvent);
+  /// \param theSelected the list of selected presentations
+  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView,
+                          const std::list<XGUI_ViewerPrs>& theSelected);
   /// Processes the key pressed in the view
   /// \param theKey a key value
   virtual void keyReleased(const int theKey);
@@ -70,17 +74,50 @@ protected:
   /// Before the feature is aborted, it should be hidden from the viewer
   virtual void abortOperation();
 
+  /// Virtual method called when operation stopped - committed or aborted.
+  /// Restore the multi selection state
+  virtual void stopOperation();
+
   /// 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();
 
+  /// Creates a constraint on two points
+  /// \param thePoint1 the first point
+  /// \param thePoint1 the second point
+  void createConstraint(boost::shared_ptr<GeomDataAPI_Point2D> thePoint1,
+                        boost::shared_ptr<GeomDataAPI_Point2D> thePoint2);
+
+  /// Creates constrains of the current 
+  /// \param theX the horizontal coordnate of the point
+  /// \param theY the vertical coordnate of the point
+  void setConstraints(double theX, double theY);
 protected:
+  /// \brief Get the line point 2d coordinates.
+  /// \param theFeature the line feature
+  /// \param theAttribute the start or end attribute of the line
+  /// \param theX the horizontal coordinate
+  /// \param theY the vertical coordinate
+  void getLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature, const std::string& theAttribute,
+                    double& theX, double& theY);
+  /// Find a point in the line with given coordinates
+  /// \param theFeature the line feature
+  /// \param theX the horizontal point coordinate
+  /// \param theY the vertical point coordinate
+  boost::shared_ptr<GeomDataAPI_Point2D> findLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                                                       double theX, double theY);
+
+  /// \brief Save the point to the line.
+  /// \param theX the horizontal coordinate
+  /// \param theY the vertical coordinate
+  /// \param theAttribute the start or end attribute of the line
+  void setLinePoint(double theX, double theY, const std::string& theAttribute);
   /// \brief Save the point to the line.
   /// \param thePoint the 3D point in the viewer
   /// \param theAttribute the start or end attribute of the line
-  void setLinePoint(const gp_Pnt& thePoint, const std::string& theAttribute);
+  void setLinePoint(const gp_Pnt& thePoint, Handle(V3d_View) theView, const std::string& theAttribute);
 
 protected:
   ///< Structure to lists the possible types of point selection modes