1 // File: PartSet_FeaturePrs.h
2 // Created: 04 Jun 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_FeaturePrs_H
6 #define PartSet_FeaturePrs_H
10 #include "PartSet_Constants.h"
12 class GeomDataAPI_Point2D;
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.
20 class PARTSET_EXPORT PartSet_FeaturePrs
24 /// \param theSketch the sketch feature
25 PartSet_FeaturePrs(FeaturePtr theSketch);
27 virtual ~PartSet_FeaturePrs();
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);
34 /// Returns the operation sketch feature
35 /// \returns the sketch instance
36 FeaturePtr sketch() const;
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;
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 bool setFeature(FeaturePtr theFeature, const PartSet_SelectionMode& theMode) { return false; };
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 = 0;
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 = 0;
61 /// \brief Move the full feature.
62 /// \param theDeltaX the delta for X coordinate is moved
63 /// \param theDeltaY the delta for Y coordinate is moved
64 virtual void move(double theDeltaX, double theDeltaY) = 0;
66 /// Return the distance between the feature and the point
67 /// \param theFeature feature object
68 /// \param theX the horizontal coordinate of the point
69 /// \param theX the vertical coordinate of the point
70 virtual double distanceToPoint(FeaturePtr theFeature, double theX, double theY) = 0;
72 /// Find a point in the line with given coordinates
73 /// \param theFeature the line feature
74 /// \param theX the horizontal point coordinate
75 /// \param theY the vertical point coordinate
76 virtual boost::shared_ptr<GeomDataAPI_Point2D> findPoint(FeaturePtr theFeature, double theX,
79 /// Creates constrains of the current
80 /// \param theX the horizontal coordnate of the point
81 /// \param theY the vertical coordnate of the point
82 /// \param theMode the current operation selection mode. The feature attribute depends on the mode
83 void setConstraints(double theX, double theY, const PartSet_SelectionMode& theMode);
86 /// Returns the operation feature
87 /// \return the feature
88 FeaturePtr feature() const;
90 /// Returns the feature point in the selection mode position.
91 /// \param theMode the current operation selection mode. The feature attribute depends on the mode
92 virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode) = 0;
95 FeaturePtr mySketch; ///< the sketch of the feature
96 FeaturePtr myFeature; ///< the feature