X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_BooleanFill.cpp;h=ed635775d4aad9ef68e6888ea85b60f09c81aa1f;hb=ac6689aff8d62d06f13c278d146978a303a0e7db;hp=1d4b4d7e07c3a0c55a45026f3524419d83301942;hpb=6e421e939851e0de46554ae45a3ca0e1f67cd91d;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp index 1d4b4d7e0..ed635775d 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,10 @@ #include #include + +static const double DEFAULT_FUZZY = 1.e-5; + + //================================================================================================== FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( const std::shared_ptr& theFeature) @@ -35,12 +39,17 @@ FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( const std::shared_ptr& theFeature, const std::list& theMainObjects, - const std::list& theToolObjects) + const std::list& theToolObjects, + const ModelHighAPI_Double& theFuzzy) : ModelHighAPI_Interface(theFeature) { if(initialize()) { + bool aUseFuzzy = (theFuzzy.value() > 0); + ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY)); fillAttribute(theMainObjects, mymainObjects); fillAttribute(theToolObjects, mytoolObjects); + fillAttribute(aUseFuzzy, myuseFuzzy); + fillAttribute(aFuzzy, myfuzzyParam); execute(false); } @@ -70,29 +79,57 @@ void FeaturesAPI_BooleanFill::setToolObjects( execute(); } +//================================================================================================== +void FeaturesAPI_BooleanFill::setUseFuzzy(bool theUseFuzzy) +{ + fillAttribute(theUseFuzzy, myuseFuzzy); + + execute(); +} + +//================================================================================================== +void FeaturesAPI_BooleanFill::setFuzzyValue(const ModelHighAPI_Double& theFuzzy) +{ + fillAttribute(theFuzzy, myfuzzyParam); + + execute(); +} + //================================================================================================== void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const { FeaturePtr aBase = feature(); - theDumper << aBase << " = model.addFill"; + theDumper << aBase << " = model.addSplit"; const std::string& aDocName = theDumper.name(aBase->document()); AttributeSelectionListPtr anObjects = aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID()); AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID()); + bool aUseFuzzy = aBase->boolean(FeaturesPlugin_BooleanFill::USE_FUZZY_ID())->value(); + double aFuzzy = aBase->real(FeaturesPlugin_BooleanFill::FUZZY_PARAM_ID())->value(); + + theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools; + + if (aUseFuzzy) + theDumper << ", fuzzyParam = " << aFuzzy; + + if (!aBase->data()->version().empty()) + theDumper << ", keepSubResults = True"; - theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl; + theDumper << ")" << std::endl; } //================================================================================================== -BooleanFillPtr addFill(const std::shared_ptr& thePart, - const std::list& theMainObjects, - const std::list& theToolObjects) +BooleanFillPtr addSplit(const std::shared_ptr& thePart, + const std::list& theMainObjects, + const std::list& theToolObjects, + const ModelHighAPI_Double& fuzzyParam, + const bool keepSubResults) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID()); - return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature, - theMainObjects, - theToolObjects)); + if (!keepSubResults) + aFeature->data()->setVersion(""); + return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature, theMainObjects, theToolObjects, fuzzyParam)); }