Salome HOME
Issue #2071 Fatal error when Create box
[modules/shaper.git] / src / SketchAPI / SketchAPI_Line.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2 // Name   : SketchAPI_Line.h
3 // Purpose:
4 //
5 // History:
6 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7
8 #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
9 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
10
11 //--------------------------------------------------------------------------------------
12 #include "SketchAPI.h"
13
14 #include <GeomDataAPI_Point2D.h>
15
16 #include <SketchPlugin_Line.h>
17
18 #include "SketchAPI_SketchEntity.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 SketchAPI_SketchEntity
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(),
55               GeomDataAPI_Point2D, /** Start point */,
56               endPoint, SketchPlugin_Line::END_ID(),
57               GeomDataAPI_Point2D, /** End point */,
58               external, SketchPlugin_Line::EXTERNAL_ID(),
59               ModelAPI_AttributeSelection, /** External */
60   )
61
62   /// Set by coordinates
63   SKETCHAPI_EXPORT
64   void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
65
66   /// Set by points
67   SKETCHAPI_EXPORT
68   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
69                    const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
70
71   /// Set by external
72   SKETCHAPI_EXPORT
73   void setByExternal(const ModelHighAPI_Selection & theExternal);
74
75   /// Set by external name
76   SKETCHAPI_EXPORT
77   void setByExternalName(const std::string & theExternalName);
78
79   /// Set start point
80   SKETCHAPI_EXPORT
81   void setStartPoint(double theX, double theY);
82
83   /// Set start point
84   SKETCHAPI_EXPORT
85   void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
86
87   /// Set end point
88   SKETCHAPI_EXPORT
89   void setEndPoint(double theX, double theY);
90
91   /// Set end point
92   SKETCHAPI_EXPORT
93   void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
94
95   /// Dump wrapped feature
96   SKETCHAPI_EXPORT
97   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
98 };
99
100 //! Pointer on Line object
101 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
102
103 //--------------------------------------------------------------------------------------
104 //--------------------------------------------------------------------------------------
105 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */