X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_Boolean.cpp;h=ec9737156f9ffec569f0d748a8057e5c746c8a7b;hb=65b511870adccd85f3cf65e1b80466045abc1608;hp=0774fb529c656181ca682e93be99acc83dd00506;hpb=f98f887290d4e2b4bd6618389911e82b6b9674f3;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_Boolean.cpp b/src/FeaturesAPI/FeaturesAPI_Boolean.cpp index 0774fb529..ec9737156 100644 --- a/src/FeaturesAPI/FeaturesAPI_Boolean.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Boolean.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Boolean.h" +#include #include #include #include @@ -29,7 +30,7 @@ FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr fillAttribute(theMainObjects, mymainObjects); fillAttribute(theToolObjects, mytoolObjects); - execute(); + execute(false); } } @@ -63,6 +64,33 @@ void FeaturesAPI_Boolean::setToolObjects(const std::list execute(); } +//================================================================================================== +void FeaturesAPI_Boolean::dump(ModelHighAPI_Dumper& theDumper) const +{ + FeaturePtr aBase = feature(); + + FeaturesPlugin_Boolean::OperationType aType = + (FeaturesPlugin_Boolean::OperationType)aBase->integer( + FeaturesPlugin_Boolean::TYPE_ID())->value(); + + theDumper << aBase << " = model.add"; + + switch(aType) { + case FeaturesPlugin_Boolean::BOOL_CUT: theDumper << "Cut"; break; + case FeaturesPlugin_Boolean::BOOL_FUSE: theDumper << "Fuse"; break; + case FeaturesPlugin_Boolean::BOOL_COMMON: theDumper << "Common"; break; + case FeaturesPlugin_Boolean::BOOL_FILL: theDumper << "Fill"; break; + case FeaturesPlugin_Boolean::BOOL_SMASH: theDumper << "Smash"; break; + } + + const std::string& aDocName = theDumper.name(aBase->document()); + AttributeSelectionListPtr anObjects = + aBase->selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID()); + AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID()); + + theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl; +} + //================================================================================================== BooleanPtr addCut(const std::shared_ptr& thePart, const std::list& theMainObjects, @@ -110,3 +138,27 @@ BooleanPtr addCommon(const std::shared_ptr& thePart, theMainObjects, theToolObjects)); } + +//================================================================================================== +BooleanPtr addSmash(const std::shared_ptr& thePart, + const std::list& theMainObjects, + const std::list& theToolObjects) +{ + std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID()); + return BooleanPtr(new FeaturesAPI_Boolean(aFeature, + FeaturesPlugin_Boolean::BOOL_SMASH, + theMainObjects, + theToolObjects)); +} + +//================================================================================================== +BooleanPtr addFill(const std::shared_ptr& thePart, + const std::list& theMainObjects, + const std::list& theToolObjects) +{ + std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID()); + return BooleanPtr(new FeaturesAPI_Boolean(aFeature, + FeaturesPlugin_Boolean::BOOL_FILL, + theMainObjects, + theToolObjects)); +}