1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
21 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
23 //--------------------------------------------------------------------------------------
24 #include "SketchAPI.h"
26 #include <GeomDataAPI_Point2D.h>
28 #include <SketchPlugin_Line.h>
30 #include "SketchAPI_SketchEntity.h"
31 //--------------------------------------------------------------------------------------
32 class ModelHighAPI_Selection;
33 //--------------------------------------------------------------------------------------
34 /**\class SketchAPI_Line
36 * \brief Interface for Line feature
38 class SketchAPI_Line : public SketchAPI_SketchEntity
41 /// Constructor without values
43 explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
44 /// Constructor with values
46 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
47 double theX1, double theY1, double theX2, double theY2);
48 /// Constructor with values
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
55 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
56 const ModelHighAPI_Selection & theExternal);
57 /// Constructor with values
59 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
60 const std::wstring & theExternalName);
63 virtual ~SketchAPI_Line();
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 */
74 /// Set by coordinates
76 void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
80 void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
81 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
85 void setByExternal(const ModelHighAPI_Selection & theExternal);
87 /// Set by external name
89 void setByExternalName(const std::wstring & theExternalName);
93 void setStartPoint(double theX, double theY);
97 void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
101 void setEndPoint(double theX, double theY);
105 void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
107 /// Dump wrapped feature
109 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
112 //! Pointer on Line object
113 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
115 //--------------------------------------------------------------------------------------
116 //--------------------------------------------------------------------------------------
117 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */