1 // File: PartSet_FeatureLinePrs.h
2 // Created: 04 Jun 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_FeatureLinePrs_H
6 #define PartSet_FeatureLinePrs_H
10 #include "PartSet_FeaturePrs.h"
11 #include "PartSet_Constants.h"
15 class GeomDataAPI_Point2D;
17 class Handle_V3d_View;
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.
25 class PARTSET_EXPORT PartSet_FeatureLinePrs : public PartSet_FeaturePrs
28 /// Returns the feature type processed by this presentation
29 /// \return the feature kind
30 static std::string getKind();
33 /// \param theSketch the sketch feature
34 PartSet_FeatureLinePrs(FeaturePtr theSketch);
36 virtual ~PartSet_FeatureLinePrs() {};
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);
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);
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;
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;
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);
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 a lin 2d object on a base of the line feature
80 /// \param theFeature the line feature
81 static boost::shared_ptr<GeomAPI_Lin2d> createLin2d(FeaturePtr theFeature);
82 /// \brief Get the line point 2d coordinates.
83 /// \param theFeature the line feature
84 /// \param theAttribute the start or end attribute of the line
85 /// \param theX the horizontal coordinate
86 /// \param theY the vertical coordinate
87 static void getLinePoint(FeaturePtr theFeature, const std::string& theAttribute,
88 double& theX, double& theY);
91 /// Returns the feature point in the selection mode position.
92 /// \param theMode the current operation selection mode. The feature attribute depends on the mode
93 virtual boost::shared_ptr<GeomDataAPI_Point2D> featurePoint(const PartSet_SelectionMode& theMode);