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(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 //==================================================================================================
20 FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21 const std::list<ModelHighAPI_Selection>& theObjects,
22 const std::list<ModelHighAPI_Selection>& theTools)
23 : ModelHighAPI_Interface(theFeature)
26 fillAttribute(theObjects, myobjects);
27 fillAttribute(theTools, mytools);
33 //==================================================================================================
34 FeaturesAPI_Intersection::~FeaturesAPI_Intersection()
39 //==================================================================================================
40 void FeaturesAPI_Intersection::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
42 fillAttribute(theObjects, myobjects);
47 //==================================================================================================
48 void FeaturesAPI_Intersection::setTools(const std::list<ModelHighAPI_Selection>& theTools)
50 fillAttribute(theTools, mytools);
55 //==================================================================================================
56 void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const
58 FeaturePtr aBase = feature();
59 const std::string& aDocName = theDumper.name(aBase->document());
61 AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID());
62 AttributeSelectionListPtr anAttrTools = aBase->selectionList(FeaturesPlugin_Intersection::TOOL_LIST_ID());
64 theDumper << aBase << " = model.addIntersection(" << aDocName << ", "
65 << anAttrObjects << ", " << anAttrTools << ")" << std::endl;
68 //==================================================================================================
69 IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
70 const std::list<ModelHighAPI_Selection>& theObjects,
71 const std::list<ModelHighAPI_Selection>& theTools)
73 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Intersection::ID());
74 return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, theTools));