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