Salome HOME
updated copyright message
[modules/shaper.git] / src / FiltersAPI / FiltersAPI_Filter.cpp
index c39d0c7caca0577a938cd4ae065b3df47621ae98..f98e9efcb4e0d9d13c3cbaeefcb0e9761fe3f046 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  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
@@ -21,6 +21,7 @@
 
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeString.h>
 
@@ -38,15 +39,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) {
@@ -71,6 +73,12 @@ FiltersAPI_Filter::FiltersAPI_Filter(const std::string& theName,
       continue;
     }
 
+    AttributeDoublePtr aDouble = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(*anArgIt);
+    if (aDouble) {
+      myFilterArguments.push_back(FiltersAPI_Argument(aDouble->value()));
+      continue;
+    }
+
     AttributeBooleanPtr aBoolean = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(*anArgIt);
     if (aBoolean) {
       myFilterArguments.push_back(FiltersAPI_Argument(aBoolean->value()));