1 // Name : SketchAPI_Line.cpp
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "SketchAPI_Line.h"
9 //--------------------------------------------------------------------------------------
10 #include <GeomAPI_Pnt2d.h>
11 //--------------------------------------------------------------------------------------
12 #include <ModelHighAPI_Selection.h>
13 #include <ModelHighAPI_Tools.h>
14 //--------------------------------------------------------------------------------------
15 SketchAPI_Line::SketchAPI_Line(
16 const std::shared_ptr<ModelAPI_Feature> & theFeature)
17 : SketchAPI_SketchEntity(theFeature)
22 SketchAPI_Line::SketchAPI_Line(
23 const std::shared_ptr<ModelAPI_Feature> & theFeature,
24 double theX1, double theY1, double theX2, double theY2)
25 : SketchAPI_SketchEntity(theFeature)
28 setByCoordinates(theX1, theY1, theX2, theY2);
32 SketchAPI_Line::SketchAPI_Line(
33 const std::shared_ptr<ModelAPI_Feature> & theFeature,
34 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
35 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
36 : SketchAPI_SketchEntity(theFeature)
39 setByPoints(theStartPoint, theEndPoint);
43 SketchAPI_Line::SketchAPI_Line(
44 const std::shared_ptr<ModelAPI_Feature> & theFeature,
45 const ModelHighAPI_Selection & theExternal )
46 : SketchAPI_SketchEntity(theFeature)
49 setByExternal(theExternal);
53 SketchAPI_Line::SketchAPI_Line(
54 const std::shared_ptr<ModelAPI_Feature> & theFeature,
55 const std::string & theExternalName )
56 : SketchAPI_SketchEntity(theFeature)
59 setByExternalName(theExternalName);
63 SketchAPI_Line::~SketchAPI_Line()
68 //--------------------------------------------------------------------------------------
69 void SketchAPI_Line::setByCoordinates(
70 double theX1, double theY1, double theX2, double theY2)
72 fillAttribute(startPoint(), theX1, theY1);
73 fillAttribute(endPoint(), theX2, theY2);
78 void SketchAPI_Line::setByPoints(
79 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
80 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
82 fillAttribute(theStartPoint, startPoint());
83 fillAttribute(theEndPoint, endPoint());
88 void SketchAPI_Line::setByExternal(const ModelHighAPI_Selection & theExternal)
90 fillAttribute(theExternal, external());
95 void SketchAPI_Line::setByExternalName(const std::string & theExternalName)
97 fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
102 //--------------------------------------------------------------------------------------
103 void SketchAPI_Line::setStartPoint(double theX, double theY)
105 fillAttribute(startPoint(), theX, theY);
109 void SketchAPI_Line::setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
111 fillAttribute(thePoint, startPoint());
115 void SketchAPI_Line::setEndPoint(double theX, double theY)
117 fillAttribute(endPoint(), theX, theY);
121 void SketchAPI_Line::setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
123 fillAttribute(thePoint, endPoint());
128 //--------------------------------------------------------------------------------------