X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_BooleanCommon.cpp;h=e7ad27b677e4d54a108ae127eec7fc1a408bb7a7;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=c54ffa2cca6eb75c77718807964040add2287d7e;hpb=57f95f226733dbd01fcd42c4b1f842c71560b7d7;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp index c54ffa2cc..e7ad27b67 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2022 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -43,12 +43,17 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( : ModelHighAPI_Interface(theFeature) { if(initialize()) { - bool aUseFuzzy = (theFuzzy.value() > 0); - ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY)); - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), mycreationMethod); - fillAttribute(theMainObjects, mymainObjects); - fillAttribute(aUseFuzzy, myuseFuzzy); - fillAttribute(aFuzzy, myfuzzyValue); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod)); + fillAttribute(theMainObjects, VAR_NAME(mainObjects)); + fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); + + // Get the evaluated fuzzy parameter from the attribute!! + bool aUseFuzzy = (fuzzyParam()->value() > 0); + fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy)); + if (!aUseFuzzy) { + ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY); + fillAttribute(aFuzzy, VAR_NAME(fuzzyParam)); + } execute(false); } @@ -63,13 +68,18 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( : ModelHighAPI_Interface(theFeature) { if(initialize()) { - bool aUseFuzzy = (theFuzzy.value() > 0); - ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY)); - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod); - fillAttribute(theMainObjects, mymainObjects); - fillAttribute(theToolObjects, mytoolObjects); - fillAttribute(aUseFuzzy, myuseFuzzy); - fillAttribute(aFuzzy, myfuzzyValue); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + fillAttribute(theMainObjects, VAR_NAME(mainObjects)); + fillAttribute(theToolObjects, VAR_NAME(toolObjects)); + fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); + + // Get the evaluated fuzzy parameter from the attribute!! + bool aUseFuzzy = (fuzzyParam()->value() > 0); + fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy)); + if (!aUseFuzzy) { + ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY); + fillAttribute(aFuzzy, VAR_NAME(fuzzyParam)); + } execute(false); } @@ -85,7 +95,7 @@ FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() void FeaturesAPI_BooleanCommon::setMainObjects( const std::list& theMainObjects) { - fillAttribute(theMainObjects, mymainObjects); + fillAttribute(theMainObjects, VAR_NAME(mainObjects)); execute(); } @@ -94,8 +104,8 @@ void FeaturesAPI_BooleanCommon::setMainObjects( void FeaturesAPI_BooleanCommon::setToolObjects( const std::list& theToolObjects) { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod); - fillAttribute(theToolObjects, mytoolObjects); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); + fillAttribute(theToolObjects, VAR_NAME(toolObjects)); execute(); } @@ -103,7 +113,7 @@ void FeaturesAPI_BooleanCommon::setToolObjects( //================================================================================================== void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy) { - fillAttribute(theUseFuzzy, myuseFuzzy); + fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy)); execute(); } @@ -111,7 +121,7 @@ void FeaturesAPI_BooleanCommon::setUseFuzzy(bool theUseFuzzy) //================================================================================================== void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) { - fillAttribute(theFuzzy, myfuzzyValue); + fillAttribute(theFuzzy, VAR_NAME(fuzzyParam)); execute(); } @@ -120,9 +130,9 @@ void FeaturesAPI_BooleanCommon::setFuzzyValue(const ModelHighAPI_Double& theFuzz void FeaturesAPI_BooleanCommon::setAdvancedMode(const bool theMode) { if (theMode) { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), VAR_NAME(creationMethod)); } else { - fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), mycreationMethod); + fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), VAR_NAME(creationMethod)); } execute(); @@ -142,7 +152,7 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID()); bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanCommon::USE_FUZZY_ID())->value(); - double aFuzzy = aBase->real(FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID())->value(); + AttributeDoublePtr aFuzzy = aBase->real(FeaturesPlugin_BooleanCommon::FUZZY_PARAM_ID()); theDumper << "(" << aDocName << ", " << anObjects; @@ -163,7 +173,7 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const BooleanCommonPtr addCommon(const std::shared_ptr& thePart, const std::list& theMainObjects, const std::list& theToolObjects, - const ModelHighAPI_Double& fuzzyParam, + const ModelHighAPI_Double& theFuzzy, const bool keepSubResults) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID()); @@ -171,8 +181,8 @@ BooleanCommonPtr addCommon(const std::shared_ptr& thePart, aFeature->data()->setVersion(""); BooleanCommonPtr aCommon; if (theToolObjects.empty()) - aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, fuzzyParam)); + aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theFuzzy)); else - aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theToolObjects, fuzzyParam)); + aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theToolObjects, theFuzzy)); return aCommon; }