Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchAPI / SketchAPI_Line.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
22 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
23
24 //--------------------------------------------------------------------------------------
25 #include "SketchAPI.h"
26
27 #include <GeomDataAPI_Point2D.h>
28
29 #include <SketchPlugin_Line.h>
30
31 #include "SketchAPI_SketchEntity.h"
32 //--------------------------------------------------------------------------------------
33 class ModelHighAPI_Selection;
34 //--------------------------------------------------------------------------------------
35 /**\class SketchAPI_Line
36  * \ingroup CPPHighAPI
37  * \brief Interface for Line feature
38  */
39 class SketchAPI_Line : public SketchAPI_SketchEntity
40 {
41 public:
42   /// Constructor without values
43   SKETCHAPI_EXPORT
44   explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
45   /// Constructor with values
46   SKETCHAPI_EXPORT
47   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
48                  double theX1, double theY1, double theX2, double theY2);
49   /// Constructor with values
50   SKETCHAPI_EXPORT
51   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
52                  const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
53                  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
54   /// Constructor with values
55   SKETCHAPI_EXPORT
56   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
57                  const ModelHighAPI_Selection & theExternal);
58   /// Constructor with values
59   SKETCHAPI_EXPORT
60   SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
61                  const std::string & theExternalName);
62   /// Destructor
63   SKETCHAPI_EXPORT
64   virtual ~SketchAPI_Line();
65
66   INTERFACE_3(SketchPlugin_Line::ID(),
67               startPoint, SketchPlugin_Line::START_ID(),
68               GeomDataAPI_Point2D, /** Start point */,
69               endPoint, SketchPlugin_Line::END_ID(),
70               GeomDataAPI_Point2D, /** End point */,
71               external, SketchPlugin_Line::EXTERNAL_ID(),
72               ModelAPI_AttributeSelection, /** External */
73   )
74
75   /// Set by coordinates
76   SKETCHAPI_EXPORT
77   void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
78
79   /// Set by points
80   SKETCHAPI_EXPORT
81   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
82                    const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
83
84   /// Set by external
85   SKETCHAPI_EXPORT
86   void setByExternal(const ModelHighAPI_Selection & theExternal);
87
88   /// Set by external name
89   SKETCHAPI_EXPORT
90   void setByExternalName(const std::string & theExternalName);
91
92   /// Set start point
93   SKETCHAPI_EXPORT
94   void setStartPoint(double theX, double theY);
95
96   /// Set start point
97   SKETCHAPI_EXPORT
98   void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
99
100   /// Set end point
101   SKETCHAPI_EXPORT
102   void setEndPoint(double theX, double theY);
103
104   /// Set end point
105   SKETCHAPI_EXPORT
106   void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
107
108   /// Dump wrapped feature
109   SKETCHAPI_EXPORT
110   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
111 };
112
113 //! Pointer on Line object
114 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
115
116 //--------------------------------------------------------------------------------------
117 //--------------------------------------------------------------------------------------
118 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */