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 GeomAPI_Lin2d;
17 class Handle_V3d_View;
18
19 /*!
20  \class PartSet_FeatureLinePrs
21  * \brief The class to define the line feature manipulation. It is created for
22  * the feature create operation to move out the feature properties set and use one operation
23  * for any type of features.
24 */
25 class PARTSET_EXPORT PartSet_FeatureLinePrs : public PartSet_FeaturePrs
26 {
27 public:
28   /// Returns the feature type processed by this presentation
29   /// \return the feature kind
30   static std::string getKind();
31
32   /// Constructor
33   /// \param theSketch the sketch feature
34   PartSet_FeatureLinePrs(FeaturePtr theSketch);
35   /// Destructor
36   virtual ~PartSet_FeatureLinePrs() {};
37
38   /// Sets the point to the feature in an attribute depending on the selection mode
39   /// \param theX the 2D point horizontal coordinate
40   /// \param theY the 2D point vertical coordinate
41   /// \param theMode the selection mode
42   /// \return the new selection mode
43   virtual PartSet_SelectionMode setPoint(double theX, double theY,
44                                          const PartSet_SelectionMode& theMode);
45
46   /// Sets the feature to to a feature attribute depending on the selection mode
47   /// \param theFeature a feature instance
48   /// \param theMode the selection mode
49   /// \return whether the feature is set
50   virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
51
52   /// Returns the feature attribute name for the selection mode
53   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
54   virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
55
56   /// Returns the next selection mode after the attribute
57   /// \param theAttribute the feature attribute name
58   /// \return next attribute selection mode
59   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
60
61   /// Project the point on a feature
62   /// \param theFeature the feature to be projected on
63   /// \param theMode the selection mode
64   /// \param thePoint the clicked point
65   /// \param theView the viewer
66   /// \param theX the output horizontal coordinate
67   /// \param theY the output vertical coordinate
68   void projectPointOnLine(FeaturePtr theFeature, const PartSet_SelectionMode& theMode,
69                           const gp_Pnt& thePoint, Handle_V3d_View theView,
70                           double& theX, double& theY);
71
72   /// Creates a lin 2d object on a base of the line feature
73   /// \param theFeature the line feature
74   static boost::shared_ptr<GeomAPI_Lin2d> createLin2d(FeaturePtr theFeature);
75   /// \brief Get the line point 2d coordinates.
76   /// \param theFeature the line feature
77   /// \param theAttribute the start or end attribute of the line
78   /// \param theX the horizontal coordinate
79   /// \param theY the vertical coordinate
80   static void getLinePoint(FeaturePtr theFeature, const std::string& theAttribute,
81                            double& theX, double& theY);
82
83 protected:
84   /// Returns the feature point in the selection mode position.
85   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
86   virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
87 };
88
89 #endif