X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_Translation.cpp;h=6b09954827301b2285e1c18aaed76ad1b2d77691;hb=857f94a96eb62e69746221f2b919335140b117c6;hp=5037e4bfd391126b7dc51b40e26810b96b21791b;hpb=322b8d77ba294283a4703856c96321247e89fb9f;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.cpp b/src/FeaturesAPI/FeaturesAPI_Translation.cpp index 5037e4bfd..6b0995482 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Translation.cpp @@ -6,20 +6,23 @@ #include "FeaturesAPI_Translation.h" +#include #include //================================================================================================== -FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr& theFeature) +FeaturesAPI_Translation::FeaturesAPI_Translation( + const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr& theFeature, - const std::list& theMainObjects, - const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) +FeaturesAPI_Translation::FeaturesAPI_Translation( + const std::shared_ptr& theFeature, + const std::list& theMainObjects, + const ModelHighAPI_Selection& theAxisObject, + const ModelHighAPI_Double& theDistance) : ModelHighAPI_Interface(theFeature) { if(initialize()) { @@ -36,7 +39,8 @@ FeaturesAPI_Translation::~FeaturesAPI_Translation() } //================================================================================================== -void FeaturesAPI_Translation::setMainObjects(const std::list& theMainObjects) +void FeaturesAPI_Translation::setMainObjects( + const std::list& theMainObjects) { fillAttribute(theMainObjects, mymainObjects); @@ -59,7 +63,22 @@ void FeaturesAPI_Translation::setDistance(const ModelHighAPI_Double& theDistance execute(); } -// TODO(spo): make add* as static functions of the class +//================================================================================================== +void FeaturesAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const +{ + FeaturePtr aBase = feature(); + const std::string& aDocName = theDumper.name(aBase->document()); + + AttributeSelectionListPtr anAttrObjects = + aBase->selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID()); + AttributeSelectionPtr anAttrAxis = + aBase->selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID()); + AttributeDoublePtr anAttrDistance = aBase->real(FeaturesPlugin_Translation::DISTANCE_ID()); + + theDumper << aBase << " = model.addTranslation(" << aDocName << ", " + << anAttrObjects << ", " << anAttrAxis << ", " << anAttrDistance << ")" << std::endl; +} + //================================================================================================== TranslationPtr addTranslation(const std::shared_ptr& thePart, const std::list& theMainObjects, @@ -67,5 +86,6 @@ TranslationPtr addTranslation(const std::shared_ptr& thePart, const ModelHighAPI_Double& theDistance) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Translation::ID()); - return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, theAxisObject, theDistance)); + return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, + theAxisObject, theDistance)); }