Salome HOME
Merge remote-tracking branch 'remotes/origin/master' into SketchSolver
[modules/shaper.git] / src / PartSet / PartSet_FeaturePrs.h
1 // File:        PartSet_FeaturePrs.h
2 // Created:     04 Jun 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_FeaturePrs_H
6 #define PartSet_FeaturePrs_H
7
8 #include "PartSet.h"
9
10 #include "PartSet_Constants.h"
11
12 class GeomDataAPI_Point2D;
13
14 /*!
15  \class PartSet_FeaturePrs
16  * \brief The abstract class to define the specific feature manipulation. It is created for
17  * the feature create operation to move out the feature properties set and use one operation
18  * for any type of features.
19 */
20 class PARTSET_EXPORT PartSet_FeaturePrs
21 {
22 public:
23   /// Constructor
24   /// \param theSketch the sketch feature
25   PartSet_FeaturePrs(FeaturePtr theSketch);
26   /// Destructor
27   virtual ~PartSet_FeaturePrs();
28
29   /// Initializes some fields of feature accorging to the source feature
30   /// Saves the fiature as the presentation internal feature
31   /// \param theFeature the presentation feature
32   void init(FeaturePtr theFeature);
33
34   /// Returns the operation sketch feature
35   /// \returns the sketch instance
36   FeaturePtr sketch() const;
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) = 0;
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   /// \return the new selection mode
51   virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
52
53   /// Returns the feature attribute name for the selection mode
54   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
55   virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const = 0;
56
57   /// Returns the next selection mode after the attribute
58   /// \param theAttribute the feature attribute name
59   /// \return next attribute selection mode
60   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const = 0;
61
62   /// Find a point in the line with given coordinates
63   /// \param theFeature the line feature
64   /// \param theX the horizontal point coordinate
65   /// \param theY the vertical point coordinate
66   virtual boost::shared_ptr<GeomDataAPI_Point2D> findPoint(FeaturePtr theFeature, double theX,
67                                                            double theY) = 0;
68
69 protected:
70   /// Returns the operation feature
71   /// \return the feature
72   FeaturePtr feature() const;
73
74   /// Returns the feature point in the selection mode position.
75   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
76   virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode) = 0;
77
78 private:
79   FeaturePtr mySketch; ///< the sketch of the feature
80   FeaturePtr myFeature; ///< the feature
81 };
82
83 #endif