X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_Rotation.cpp;h=ef0c55fdbd7608e0c72fb092d14e28bd57813eb2;hb=e20a4ec83c24222f7a3b159111f15e87bce6370f;hp=861f3da0006cb8be4b1f650ff9ffc374cd94de03;hpb=f98f887290d4e2b4bd6618389911e82b6b9674f3;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp index 861f3da00..ef0c55fdb 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Rotation.h" +#include #include //================================================================================================== @@ -29,6 +30,20 @@ FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr& theFeature, + const std::list& theMainObjects, + const ModelHighAPI_Selection& theCenterPoint, + const ModelHighAPI_Selection& theStartPoint, + const ModelHighAPI_Selection& theEndPoint) +: ModelHighAPI_Interface(theFeature) +{ + if(initialize()) { + fillAttribute(theMainObjects, mymainObjects); + setPoints(theCenterPoint, theStartPoint, theEndPoint); + } +} + //================================================================================================== FeaturesAPI_Rotation::~FeaturesAPI_Rotation() { @@ -46,6 +61,7 @@ void FeaturesAPI_Rotation::setMainObjects(const std::listdocument()); + + AttributeSelectionListPtr anAttrObjects = + aBase->selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID()); + + theDumper << aBase << " = model.addRotation(" << aDocName << ", " << anAttrObjects; + + std::string aCreationMethod = + aBase->string(FeaturesPlugin_Rotation::CREATION_METHOD())->value(); + + if (aCreationMethod == FeaturesPlugin_Rotation::CREATION_METHOD_BY_ANGLE()) { + AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID()); + AttributeDoublePtr anAttrAngle = aBase->real(FeaturesPlugin_Rotation::ANGLE_ID()); + theDumper << ", " << anAttrAxis << ", " << anAttrAngle; + } else if (aCreationMethod == FeaturesPlugin_Rotation::CREATION_METHOD_BY_THREE_POINTS()) { + AttributeSelectionPtr anAttrCenterPoint = + aBase->selection(FeaturesPlugin_Rotation::CENTER_POINT_ID()); + AttributeSelectionPtr anAttrStartPoint = + aBase->selection(FeaturesPlugin_Rotation::START_POINT_ID()); + AttributeSelectionPtr anAttrEndPoint = + aBase->selection(FeaturesPlugin_Rotation::END_POINT_ID()); + theDumper << ", " << anAttrCenterPoint << ", " << anAttrStartPoint << ", " << anAttrEndPoint; + } + + theDumper << ")" << std::endl; +} + //================================================================================================== RotationPtr addRotation(const std::shared_ptr& thePart, const std::list& theMainObjects, const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) + const ModelHighAPI_Double& theAngle) +{ + std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID()); + return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theAngle)); +} + +//================================================================================================== +RotationPtr addRotation(const std::shared_ptr& thePart, + const std::list& theMainObjects, + const ModelHighAPI_Selection& theCenterPoint, + const ModelHighAPI_Selection& theStartPoint, + const ModelHighAPI_Selection& theEndPoint) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID()); - return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theDistance)); + return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theCenterPoint, + theStartPoint, theEndPoint)); }