1 // Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
20 #include "SketchAPI_IntersectionPoint.h"
21 //--------------------------------------------------------------------------------------
22 #include <GeomAPI_Pnt2d.h>
23 //--------------------------------------------------------------------------------------
24 #include <ModelHighAPI_Dumper.h>
25 #include <ModelHighAPI_Selection.h>
26 #include <ModelHighAPI_Tools.h>
27 //--------------------------------------------------------------------------------------
28 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
29 const std::shared_ptr<ModelAPI_Feature> & theFeature)
30 : SketchAPI_SketchEntity(theFeature)
35 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
36 const std::shared_ptr<ModelAPI_Feature> & theFeature,
37 const ModelHighAPI_Selection & theExternal )
38 : SketchAPI_SketchEntity(theFeature)
41 setByExternalLine(theExternal);
45 SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
46 const std::shared_ptr<ModelAPI_Feature> & theFeature,
47 const std::string & theExternalName )
48 : SketchAPI_SketchEntity(theFeature)
51 setByExternalLineName(theExternalName);
55 SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint()
60 //--------------------------------------------------------------------------------------
61 void SketchAPI_IntersectionPoint::setByExternalLine(const ModelHighAPI_Selection & theExternalLine)
63 fillAttribute(theExternalLine, externalLine());
68 void SketchAPI_IntersectionPoint::setByExternalLineName(const std::string & theExternalLineName)
70 fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalLine());
75 //--------------------------------------------------------------------------------------
77 void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const
79 FeaturePtr aBase = feature();
80 const std::string& aSketchName = theDumper.parentName(aBase);
82 AttributeSelectionPtr aLine = externalLine();
83 theDumper << aBase << " = " <<
84 aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl;
85 // dump "auxiliary" flag if necessary
86 SketchAPI_SketchEntity::dump(theDumper);