Salome HOME
bdedb921b911ef0d4f64a95e224b4a3c85a345b9
[modules/shaper.git] / src / SketchAPI / SketchAPI_Line.h
1 // Name   : SketchAPI_Line.h
2 // Purpose: 
3 //
4 // History:
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
6
7 #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
8 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
9
10 //--------------------------------------------------------------------------------------
11 #include "SketchAPI.h"
12
13 #include <GeomDataAPI_Point2D.h>
14
15 #include <SketchPlugin_Line.h>
16
17 #include <SketchAPI_SketchEntity.h>
18 //--------------------------------------------------------------------------------------
19 class ModelHighAPI_Selection;
20 //--------------------------------------------------------------------------------------
21 /**\class SketchAPI_Line
22  * \ingroup CPPHighAPI
23  * \brief Interface for Line feature
24  */
25 class SketchAPI_Line : public SketchAPI_SketchEntity
26 {
27 public:
28   /// Constructor without values
29   SKETCHAPI_EXPORT
30   explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
31   /// Constructor with values
32   SKETCHAPI_EXPORT
33   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
34                  double theX1, double theY1, double theX2, double theY2);
35   /// Constructor with values
36   SKETCHAPI_EXPORT
37   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
38                  const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
39                  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
40   /// Constructor with values
41   SKETCHAPI_EXPORT
42   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
43                  const ModelHighAPI_Selection & theExternal);
44   /// Constructor with values
45   SKETCHAPI_EXPORT
46   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
47                  const std::string & theExternalName);
48   /// Destructor
49   SKETCHAPI_EXPORT
50   virtual ~SketchAPI_Line();
51
52   INTERFACE_3(SketchPlugin_Line::ID(),
53               startPoint, SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D, /** Start point */,
54               endPoint, SketchPlugin_Line::END_ID(), GeomDataAPI_Point2D, /** End point */,
55               external, SketchPlugin_Line::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */
56   )
57
58   /// Set by coordinates
59   SKETCHAPI_EXPORT
60   void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
61
62   /// Set by points
63   SKETCHAPI_EXPORT
64   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
65                    const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
66
67   /// Set by external
68   SKETCHAPI_EXPORT
69   void setByExternal(const ModelHighAPI_Selection & theExternal);
70
71   /// Set by external name
72   SKETCHAPI_EXPORT
73   void setByExternalName(const std::string & theExternalName);
74
75   /// Set start point
76   SKETCHAPI_EXPORT
77   void setStartPoint(double theX, double theY);
78
79   /// Set start point
80   SKETCHAPI_EXPORT
81   void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
82
83   /// Set end point
84   SKETCHAPI_EXPORT
85   void setEndPoint(double theX, double theY);
86
87   /// Set end point
88   SKETCHAPI_EXPORT
89   void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
90 };
91
92 //! Pointer on Line object
93 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
94
95 //--------------------------------------------------------------------------------------
96 //--------------------------------------------------------------------------------------
97 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */