1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_Intersection.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_Intersection.h"
9 #include <ModelHighAPI_Dumper.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_Intersection::FeaturesAPI_Intersection(
14 const std::shared_ptr<ModelAPI_Feature>& theFeature)
15 : ModelHighAPI_Interface(theFeature)
20 //==================================================================================================
21 FeaturesAPI_Intersection::FeaturesAPI_Intersection(
22 const std::shared_ptr<ModelAPI_Feature>& theFeature,
23 const std::list<ModelHighAPI_Selection>& theObjects,
24 const std::list<ModelHighAPI_Selection>& theTools)
25 : ModelHighAPI_Interface(theFeature)
28 fillAttribute(theObjects, myobjects);
29 fillAttribute(theTools, mytools);
35 //==================================================================================================
36 FeaturesAPI_Intersection::~FeaturesAPI_Intersection()
41 //==================================================================================================
42 void FeaturesAPI_Intersection::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
44 fillAttribute(theObjects, myobjects);
49 //==================================================================================================
50 void FeaturesAPI_Intersection::setTools(const std::list<ModelHighAPI_Selection>& theTools)
52 fillAttribute(theTools, mytools);
57 //==================================================================================================
58 void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const
60 FeaturePtr aBase = feature();
61 const std::string& aDocName = theDumper.name(aBase->document());
63 AttributeSelectionListPtr anAttrObjects =
64 aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID());
65 AttributeSelectionListPtr anAttrTools =
66 aBase->selectionList(FeaturesPlugin_Intersection::TOOL_LIST_ID());
68 theDumper << aBase << " = model.addIntersection(" << aDocName << ", "
69 << anAttrObjects << ", " << anAttrTools << ")" << std::endl;
72 //==================================================================================================
73 IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
74 const std::list<ModelHighAPI_Selection>& theObjects,
75 const std::list<ModelHighAPI_Selection>& theTools)
77 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Intersection::ID());
78 return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, theTools));