]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_ConstraintRadiusPrs.h
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
[modules/shaper.git] / src / PartSet / PartSet_ConstraintRadiusPrs.h
1 // File:        PartSet_ConstraintRadiusPrs.h
2 // Created:     16 Jun 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_ConstraintRadiusPrs_H
6 #define PartSet_ConstraintRadiusPrs_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_AIS_InteractiveObject;
17 class Handle_V3d_View;
18
19 /*!
20  \class PartSet_ConstraintRadiusPrs
21  * \brief The class to define the circle 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_ConstraintRadiusPrs : 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_ConstraintRadiusPrs(FeaturePtr theSketch);
35   /// Destructor
36   virtual ~PartSet_ConstraintRadiusPrs() {};
37
38   /// Sets the feature to to a feature attribute depending on the selection mode
39   /// \param theFeature a feature instance
40   /// \param theMode the selection mode
41   /// \return whether the feature is set
42   virtual PartSet_SelectionMode setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode);
43
44   /// Sets the point to the feature in an attribute depending on the selection mode
45   /// \param theX the 2D point horizontal coordinate
46   /// \param theY the 2D point vertical coordinate
47   /// \param theMode the selection mode
48   /// \return the new selection mode
49   virtual PartSet_SelectionMode setPoint(double theX, double theY,
50                                          const PartSet_SelectionMode& theMode);
51
52   /// Creates an AIS presentation if the previous is null or update the given one
53   /// \param theFeature a feature
54   /// \param theSketch a feature sketch
55   /// \param thePrevious a previuos AIS presentation
56   /// \return a created/changed AIS object with the feature parameters
57   static Handle_AIS_InteractiveObject createPresentation(FeaturePtr theFeature,
58                                                          FeaturePtr theSketch,
59                                                          Handle_AIS_InteractiveObject thePreviuos);
60
61   /// Returns the feature attribute name for the selection mode
62   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
63   virtual std::string getAttribute(const PartSet_SelectionMode& theMode) const;
64
65   /// Returns the next selection mode after the attribute
66   /// \param theAttribute the feature attribute name
67   /// \return next attribute selection mode
68   virtual PartSet_SelectionMode getNextMode(const std::string& theAttribute) const;
69
70   /// \brief Move the full feature.
71   /// \param theDeltaX the delta for X coordinate is moved
72   /// \param theDeltaY the delta for Y coordinate is moved
73   virtual void move(double theDeltaX, double theDeltaY);
74
75   /// Return the distance between the feature and the point
76   /// \param theFeature feature object
77   /// \param theX the horizontal coordinate of the point
78   /// \param theX the vertical coordinate of the point
79   virtual double distanceToPoint(FeaturePtr theFeature, double theX, double theY);
80
81   /// Find a point in the line with given coordinates
82   /// \param theFeature the line feature
83   /// \param theX the horizontal point coordinate
84   /// \param theY the vertical point coordinate
85   virtual boost::shared_ptr<GeomDataAPI_Point2D> findPoint(FeaturePtr theFeature, double theX,
86                                                            double theY);
87   /// Project the view point on the feature. The output coordinates belong to the feature
88   /// \param theFeature a feature
89   /// \param theSketch the sketch feature
90   /// \param thePoint a viewer point
91   /// \param theView the OCC view
92   /// \theX the output horizontal coordinate of a projected point
93   /// \theY the output vertical coordinate of a projected point
94   static void projectPointOnFeature(FeaturePtr theFeature, FeaturePtr theSketch, gp_Pnt& thePoint,
95                                     Handle_V3d_View theView, double& theX, double& theY);
96
97 protected:
98   /// Returns the feature point in the selection mode position.
99   /// \param theMode the current operation selection mode. The feature attribute depends on the mode
100   virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);
101 };
102
103 #endif