Salome HOME
Issue #1860: fix end lines with spaces
[modules/shaper.git] / src / SketchAPI / SketchAPI_IntersectionPoint.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2 // Name   : SketchAPI_IntersectionPoint.cpp
3 // Purpose:
4 //
5 // History:
6 // 16/06/16 - Sergey POKHODENKO - Creation of the file
7
8 //--------------------------------------------------------------------------------------
9 #include "SketchAPI_IntersectionPoint.h"
10 //--------------------------------------------------------------------------------------
11 #include <GeomAPI_Pnt2d.h>
12 //--------------------------------------------------------------------------------------
13 #include <ModelHighAPI_Dumper.h>
14 #include <ModelHighAPI_Selection.h>
15 #include <ModelHighAPI_Tools.h>
16 //--------------------------------------------------------------------------------------
17 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
18     const std::shared_ptr<ModelAPI_Feature> & theFeature)
19 : SketchAPI_SketchEntity(theFeature)
20 {
21   initialize();
22 }
23
24 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
25     const std::shared_ptr<ModelAPI_Feature> & theFeature,
26     const ModelHighAPI_Selection & theExternal )
27 : SketchAPI_SketchEntity(theFeature)
28 {
29   if (initialize()) {
30     setByExternalLine(theExternal);
31   }
32 }
33
34 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
35     const std::shared_ptr<ModelAPI_Feature> & theFeature,
36     const std::string & theExternalName )
37 : SketchAPI_SketchEntity(theFeature)
38 {
39   if (initialize()) {
40     setByExternalLineName(theExternalName);
41   }
42 }
43
44 SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint()
45 {
46
47 }
48
49 //--------------------------------------------------------------------------------------
50 void SketchAPI_IntersectionPoint::setByExternalLine(const ModelHighAPI_Selection & theExternalLine)
51 {
52   fillAttribute(theExternalLine, externalLine());
53
54   execute();
55 }
56
57 void SketchAPI_IntersectionPoint::setByExternalLineName(const std::string & theExternalLineName)
58 {
59   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalLine());
60
61   execute();
62 }
63
64 //--------------------------------------------------------------------------------------
65
66 void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const
67 {
68   FeaturePtr aBase = feature();
69   const std::string& aSketchName = theDumper.parentName(aBase);
70
71   AttributeSelectionPtr aLine = externalLine();
72   theDumper << aBase << " = " <<
73     aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl;
74   // dump "auxiliary" flag if necessary
75   SketchAPI_SketchEntity::dump(theDumper);
76 }