Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchAPI / SketchAPI_Line.h
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
21 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
22
23 //--------------------------------------------------------------------------------------
24 #include "SketchAPI.h"
25
26 #include <GeomDataAPI_Point2D.h>
27
28 #include <SketchPlugin_Line.h>
29
30 #include "SketchAPI_SketchEntity.h"
31 //--------------------------------------------------------------------------------------
32 class ModelHighAPI_Selection;
33 //--------------------------------------------------------------------------------------
34 /**\class SketchAPI_Line
35  * \ingroup CPPHighAPI
36  * \brief Interface for Line feature
37  */
38 class SketchAPI_Line : public SketchAPI_SketchEntity
39 {
40 public:
41   /// Constructor without values
42   SKETCHAPI_EXPORT
43   explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
44   /// Constructor with values
45   SKETCHAPI_EXPORT
46   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
47                  double theX1, double theY1, double theX2, double theY2);
48   /// Constructor with values
49   SKETCHAPI_EXPORT
50   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
51                  const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
52                  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
53   /// Constructor with values
54   SKETCHAPI_EXPORT
55   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
56                  const ModelHighAPI_Selection & theExternal);
57   /// Constructor with values
58   SKETCHAPI_EXPORT
59   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
60                  const std::wstring & theExternalName);
61   /// Destructor
62   SKETCHAPI_EXPORT
63   virtual ~SketchAPI_Line();
64
65   INTERFACE_3(SketchPlugin_Line::ID(),
66               startPoint, SketchPlugin_Line::START_ID(),
67               GeomDataAPI_Point2D, /** Start point */,
68               endPoint, SketchPlugin_Line::END_ID(),
69               GeomDataAPI_Point2D, /** End point */,
70               external, SketchPlugin_Line::EXTERNAL_ID(),
71               ModelAPI_AttributeSelection, /** External */
72   )
73
74   /// Set by coordinates
75   SKETCHAPI_EXPORT
76   void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
77
78   /// Set by points
79   SKETCHAPI_EXPORT
80   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
81                    const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
82
83   /// Set by external
84   SKETCHAPI_EXPORT
85   void setByExternal(const ModelHighAPI_Selection & theExternal);
86
87   /// Set by external name
88   SKETCHAPI_EXPORT
89   void setByExternalName(const std::wstring & theExternalName);
90
91   /// Set start point
92   SKETCHAPI_EXPORT
93   void setStartPoint(double theX, double theY);
94
95   /// Set start point
96   SKETCHAPI_EXPORT
97   void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
98
99   /// Set end point
100   SKETCHAPI_EXPORT
101   void setEndPoint(double theX, double theY);
102
103   /// Set end point
104   SKETCHAPI_EXPORT
105   void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
106
107   /// Dump wrapped feature
108   SKETCHAPI_EXPORT
109   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
110 };
111
112 //! Pointer on Line object
113 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
114
115 //--------------------------------------------------------------------------------------
116 //--------------------------------------------------------------------------------------
117 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */