Salome HOME
Add SketchAPI and Line feature. Also fix tests.
[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 <ModelHighAPI_Interface.h>
18 #include <ModelHighAPI_Macro.h>
19 //--------------------------------------------------------------------------------------
20 class ModelHighAPI_Selection;
21 //--------------------------------------------------------------------------------------
22 /**\class SketchAPI_Line
23  * \ingroup CPPHighAPI
24  * \brief Interface for Line feature
25  */
26 class SketchAPI_Line : public ModelHighAPI_Interface
27 {
28 public:
29   /// Constructor without values
30   SKETCHAPI_EXPORT
31   explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
32   /// Constructor with values
33   SKETCHAPI_EXPORT
34   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
35                  double theX1, double theY1, double theX2, double theY2);
36   /// Constructor with values
37   SKETCHAPI_EXPORT
38   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
39                  const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
40                  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
41   /// Constructor with values
42   SKETCHAPI_EXPORT
43   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
44                  const ModelHighAPI_Selection & theExternal);
45   /// Constructor with values
46   SKETCHAPI_EXPORT
47   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
48                  const std::string & theExternalName);
49   /// Destructor
50   SKETCHAPI_EXPORT
51   virtual ~SketchAPI_Line();
52
53   INTERFACE_3(SketchPlugin_Line::ID(),
54               startPoint, SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D, /** Start point */,
55               endPoint, SketchPlugin_Line::END_ID(), GeomDataAPI_Point2D, /** End point */,
56               external, SketchPlugin_Line::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */
57   )
58
59   /// Set by coordinates
60   SKETCHAPI_EXPORT
61   void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
62
63   /// Set by points
64   SKETCHAPI_EXPORT
65   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
66                    const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
67
68   /// Set by external
69   SKETCHAPI_EXPORT
70   void setByExternal(const ModelHighAPI_Selection & theExternal);
71
72   /// Set by external name
73   SKETCHAPI_EXPORT
74   void setByExternalName(const std::string & theExternalName);
75
76   /// Set start point
77   SKETCHAPI_EXPORT
78   void setStartPoint(double theX, double theY);
79
80   /// Set start point
81   SKETCHAPI_EXPORT
82   void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
83
84   /// Set end point
85   SKETCHAPI_EXPORT
86   void setEndPoint(double theX, double theY);
87
88   /// Set end point
89   SKETCHAPI_EXPORT
90   void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
91 };
92
93 //! Pointer on Line object
94 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
95
96 //--------------------------------------------------------------------------------------
97 //--------------------------------------------------------------------------------------
98 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */