]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix errors of dumping filters arguments.
authorazv <azv@opencascade.com>
Wed, 10 Jul 2019 05:27:41 +0000 (08:27 +0300)
committerazv <azv@opencascade.com>
Wed, 10 Jul 2019 05:27:41 +0000 (08:27 +0300)
src/FiltersAPI/FiltersAPI_Argument.cpp
src/FiltersAPI/FiltersAPI_Filter.cpp
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp

index d27819c4ea9dc2b55383354e4beab899a749be54..5940ebb7fb75872a1b7c0feec458df522388c402 100644 (file)
@@ -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;
index c39d0c7caca0577a938cd4ae065b3df47621ae98..577e428bc81bca3d78f1d29a5be06396bcdb75be 100644 (file)
@@ -38,15 +38,16 @@ FiltersAPI_Filter::FiltersAPI_Filter(const std::string& theName,
                                      const std::list<AttributePtr>& theArguments)
   : myName(theName)
 {
-  for (std::list<AttributePtr>::const_iterator anArgIt = theArguments.begin();
-       anArgIt != theArguments.end(); ++anArgIt) {
-    AttributeBooleanPtr aBoolAttr =
+  std::list<AttributePtr>::const_iterator anArgIt = theArguments.begin();
+  // first attribute is usually for reversing the filter
+  AttributeBooleanPtr aBoolAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(*anArgIt);
-    if (aBoolAttr) {
-      myReversed = aBoolAttr->value();
-      continue;
-    }
+  if (aBoolAttr) {
+    myReversed = aBoolAttr->value();
+    ++anArgIt;
+  }
 
+  for (; anArgIt != theArguments.end(); ++anArgIt) {
     AttributeSelectionListPtr aSelList =
         std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*anArgIt);
     if (aSelList) {
index 80a7440f22b9cc25110d84128a3558f86833b487..409f1b4306313f2eb47a89eaae331be86122aa7d 100644 (file)
@@ -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);
     }
 
index 54631e07685032085321f616cc1175d7d4cf6711..09e944d4ee7995413c522e680eea05f3dbc59060 100644 (file)
@@ -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<ModelAPI_FiltersFeature>(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()) {