Salome HOME
updated copyright message
[modules/shaper.git] / src / FiltersAPI / FiltersAPI_Argument.cpp
index d4c77ab2f2af56872dd18dd36152e641e81c4ff7..48d6656a01356dd2b078142fda9e0f11490f430e 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
@@ -23,6 +23,21 @@ FiltersAPI_Argument::FiltersAPI_Argument()
 {
 }
 
+FiltersAPI_Argument::FiltersAPI_Argument(const bool theValue)
+  : myBoolean(theValue)
+{
+}
+
+FiltersAPI_Argument::FiltersAPI_Argument(const ModelHighAPI_Double theValue)
+  : myDouble(theValue)
+{
+}
+
+FiltersAPI_Argument::FiltersAPI_Argument(const double& theValue)
+{
+  myDouble = theValue;
+}
+
 FiltersAPI_Argument::FiltersAPI_Argument(const std::string& theValue)
   : myValue(theValue)
 {
@@ -44,8 +59,19 @@ FiltersAPI_Argument::~FiltersAPI_Argument()
 
 void FiltersAPI_Argument::dump(ModelHighAPI_Dumper& theDumper) const
 {
-  if (mySelectionAttr)
-    theDumper << mySelectionAttr;
-  else if (mySelection.variantType() == ModelHighAPI_Selection::VT_Empty)
-    theDumper << "\"" << myValue << "\"";
+  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 (myDouble.value() > std::numeric_limits<double>::lowest() ) {
+      theDumper << myDouble.value();
+    }
+    else if (myValue.empty()) {
+      theDumper << myBoolean;
+    }
+    else{
+      theDumper << "\"" << myValue << "\"";
+    }
+  }
 }