Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
[modules/shaper.git] / src / PartSet / PartSet_FeatureLinePrs.h
1 // File:        PartSet_FeatureLinePrs.h
2 // Created:     04 Jun 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_FeatureLinePrs_H
6 #define PartSet_FeatureLinePrs_H
7
8 #include "PartSet.h"
9
10 #include "PartSet_FeaturePrs.h"
11 #include "PartSet_Constants.h"
12
13 #include <gp_Pnt.hxx>
14
15 class GeomDataAPI_Point2D;
16 class Handle_V3d_View;
17
18 /*!
19  \class PartSet_FeatureLinePrs
20  * \brief The class to define the line feature manipulation. It is created for
21  * the feature create operation to move out the feature properties set and use one operation
22  * for any type of features.
23 */
24 class PARTSET_EXPORT PartSet_FeatureLinePrs : public PartSet_FeaturePrs
25 {
26 public:
27   /// Constructor
28   /// \param theSketch the sketch feature
29   PartSet_FeatureLinePrs(FeaturePtr theSketch);
30   /// Destructor
31   virtual ~PartSet_FeatureLinePrs() {};
32
33   /// Sets the point to the feature in an attribute depending on the selection mode
34   /// \param theX the 2D point horizontal coordinate
35   /// \param theY the 2D point vertical coordinate
36   /// \param theMode the selection mode
37   /// \return the new selection mode
38   virtual PartSet_SelectionMode setPoint(double theX, double theY,
39                                          const PartSet_SelectionMode& theMode);
40
41   /// Returns the feature attribute name for the selection mode
42   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
43   virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
44
45   /// Returns the next selection mode after the attribute
46   /// \param theAttribute the feature attribute name
47   /// \return next attribute selection mode
48   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
49
50
51   /// Project the point on a feature
52   /// \param theFeature the feature to be projected on
53   /// \param theMode the selection mode
54   /// \param thePoint the clicked point
55   /// \param theView the viewer
56   /// \param theX the output horizontal coordinate
57   /// \param theY the output vertical coordinate
58   void projectPointOnLine(FeaturePtr theFeature, const PartSet_SelectionMode& theMode,
59                           const gp_Pnt& thePoint, Handle_V3d_View theView,
60                           double& theX, double& theY);
61
62 protected:
63   /// Initializes current feature by the given
64   /// \param theSourceFeature the feature, which attributes are used to initialize the current feature
65   virtual void initFeature(FeaturePtr theSourceFeature);
66
67   /// Returns the feature point in the selection mode position.
68   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
69   virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
70 };
71
72 #endif