X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_BooleanFuse.cpp;h=6d837663c87152033b91e77626d9f3ee00aa82c0;hb=f60dc9dd94d5d4b0ea07e3e3cbfd5b3028f0942d;hp=b0e1c76a48f82ee0ced5c81774348be436a702b4;hpb=1e2eaa713f139d2617c80eba9ede62d4e9976bb7;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp index b0e1c76a4..6d837663c 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp @@ -32,6 +32,22 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( initialize(); } +//================================================================================================== +FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( + const std::shared_ptr& theFeature, + const std::list& theMainObjects, + const bool theRemoveEdges) + : ModelHighAPI_Interface(theFeature) +{ + if (initialize()) { + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod); + fillAttribute(theMainObjects, mymainObjects); + fillAttribute(theRemoveEdges, myremoveEdges); + + execute(false); + } +} + //================================================================================================== FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( const std::shared_ptr& theFeature, @@ -41,12 +57,7 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( : ModelHighAPI_Interface(theFeature) { if(initialize()) { - if (theToolObjects.empty()) { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod); - } else { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod); - } - + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod); fillAttribute(theMainObjects, mymainObjects); fillAttribute(theToolObjects, mytoolObjects); fillAttribute(theRemoveEdges, myremoveEdges); @@ -74,14 +85,9 @@ void FeaturesAPI_BooleanFuse::setMainObjects( void FeaturesAPI_BooleanFuse::setToolObjects( const std::list& theToolObjects) { + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod); fillAttribute(theToolObjects, mytoolObjects); - if (theToolObjects.empty()) { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod); - } else { - fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod); - } - execute(); } @@ -93,6 +99,18 @@ void FeaturesAPI_BooleanFuse::setRemoveEdges(const bool theRemoveEdges) execute(); } +//================================================================================================== +void FeaturesAPI_BooleanFuse::setAdvancedMode(const bool theMode) +{ + if (theMode) { + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED(), mycreationMethod); + } else { + fillAttribute(FeaturesPlugin_BooleanFuse::CREATION_METHOD_SIMPLE(), mycreationMethod); + } + + execute(); +} + //================================================================================================== void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const { @@ -101,6 +119,7 @@ void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const theDumper << aBase << " = model.addFuse"; const std::string& aDocName = theDumper.name(aBase->document()); + AttributeStringPtr aMode = aBase->string(FeaturesPlugin_BooleanFuse::CREATION_METHOD()); AttributeSelectionListPtr anObjects = aBase->selectionList(FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = @@ -110,7 +129,7 @@ void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const theDumper << "(" << aDocName << ", " << anObjects; - if (aTools->size() > 0) { + if (aMode->value() == FeaturesPlugin_BooleanFuse::CREATION_METHOD_ADVANCED()) { theDumper << ", " << aTools; } @@ -127,10 +146,8 @@ BooleanFusePtr addFuse(const std::shared_ptr& thePart, const bool theRemoveEdges) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID()); - std::list aToolObjects; return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature, theObjects, - aToolObjects, theRemoveEdges)); }