1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_Rotation.cpp
4 // Created: 07 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_Rotation.h"
9 #include <ModelHighAPI_Dumper.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 //==================================================================================================
20 FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21 const std::list<ModelHighAPI_Selection>& theMainObjects,
22 const ModelHighAPI_Selection& theAxisObject,
23 const ModelHighAPI_Double& theAngle)
24 : ModelHighAPI_Interface(theFeature)
27 fillAttribute(theMainObjects, mymainObjects);
28 fillAttribute(theAxisObject, myaxisObject);
33 //==================================================================================================
34 FeaturesAPI_Rotation::~FeaturesAPI_Rotation()
39 //==================================================================================================
40 void FeaturesAPI_Rotation::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
42 fillAttribute(theMainObjects, mymainObjects);
47 //==================================================================================================
48 void FeaturesAPI_Rotation::setAxisObject(const ModelHighAPI_Selection& theAxisObject)
50 fillAttribute(theAxisObject, myaxisObject);
55 //==================================================================================================
56 void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double& theAngle)
58 fillAttribute(theAngle, myangle);
63 //==================================================================================================
64 void FeaturesAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const
66 FeaturePtr aBase = feature();
67 const std::string& aDocName = theDumper.name(aBase->document());
69 AttributeSelectionListPtr anAttrObjects =
70 aBase->selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID());
71 AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
72 AttributeDoublePtr anAttrAngle = aBase->real(FeaturesPlugin_Rotation::ANGLE_ID());
74 theDumper << aBase << " = model.addRotation(" << aDocName << ", "
75 << anAttrObjects << ", " << anAttrAxis << ", " << anAttrAngle << ")" << std::endl;
78 //==================================================================================================
79 RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
80 const std::list<ModelHighAPI_Selection>& theMainObjects,
81 const ModelHighAPI_Selection& theAxisObject,
82 const ModelHighAPI_Double& theAngle)
84 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID());
85 return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theAngle));