From: azv Date: Wed, 10 Jul 2019 05:27:41 +0000 (+0300) Subject: Fix errors of dumping filters arguments. X-Git-Tag: VEDF2019Lot4~101^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=16dcb54e70a3c03c189b99e737224afea81e7f6c;p=modules%2Fshaper.git Fix errors of dumping filters arguments. --- diff --git a/src/FiltersAPI/FiltersAPI_Argument.cpp b/src/FiltersAPI/FiltersAPI_Argument.cpp index d27819c4e..5940ebb7f 100644 --- a/src/FiltersAPI/FiltersAPI_Argument.cpp +++ b/src/FiltersAPI/FiltersAPI_Argument.cpp @@ -49,8 +49,10 @@ FiltersAPI_Argument::~FiltersAPI_Argument() void FiltersAPI_Argument::dump(ModelHighAPI_Dumper& theDumper) const { - if (mySelectionAttr) - theDumper << mySelectionAttr; + if (mySelectionAttr) { + // write empty selection attribute, because parametrization is not supported yet + theDumper << "model.selection()"; // mySelectionAttr; + } else if (mySelection.variantType() == ModelHighAPI_Selection::VT_Empty) { if (myValue.empty()) theDumper << myBoolean; diff --git a/src/FiltersAPI/FiltersAPI_Filter.cpp b/src/FiltersAPI/FiltersAPI_Filter.cpp index c39d0c7ca..577e428bc 100644 --- a/src/FiltersAPI/FiltersAPI_Filter.cpp +++ b/src/FiltersAPI/FiltersAPI_Filter.cpp @@ -38,15 +38,16 @@ FiltersAPI_Filter::FiltersAPI_Filter(const std::string& theName, const std::list& theArguments) : myName(theName) { - for (std::list::const_iterator anArgIt = theArguments.begin(); - anArgIt != theArguments.end(); ++anArgIt) { - AttributeBooleanPtr aBoolAttr = + std::list::const_iterator anArgIt = theArguments.begin(); + // first attribute is usually for reversing the filter + AttributeBooleanPtr aBoolAttr = std::dynamic_pointer_cast(*anArgIt); - if (aBoolAttr) { - myReversed = aBoolAttr->value(); - continue; - } + if (aBoolAttr) { + myReversed = aBoolAttr->value(); + ++anArgIt; + } + for (; anArgIt != theArguments.end(); ++anArgIt) { AttributeSelectionListPtr aSelList = std::dynamic_pointer_cast(*anArgIt); if (aSelList) { diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 80a7440f2..409f1b430 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -1344,7 +1344,8 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( // check selection list is obtained by filters FiltersFeaturePtr aFilters = theAttrSelList->filters(); if (aFilters) { - *myDumpStorage << ", "; + if (theAttrSelList->size() > 0) + *myDumpStorage << ", "; dumpFeature(aFilters, true); } diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index 54631e076..09e944d4e 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -159,6 +159,14 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr& theAttr) { return "__notcase__"; } std::string aType = theAttr->attributeType(); + + // do not check selection of the filter, + // because there is neither parametric update nor dump support yet. + FiltersFeaturePtr aFilter = std::dynamic_pointer_cast(aFeatOwner); + if (aFilter && (aType == ModelAPI_AttributeSelection::typeId() || + aType == ModelAPI_AttributeSelectionList::typeId())) + return "__filter_selection__"; + std::ostringstream aResult; if (!theAttr->isInitialized()) { if (aType == ModelAPI_AttributeBoolean::typeId()) {