#include "FiltersAPI_Feature.h"
#include <ModelAPI_Feature.h>
+#include <ModelAPI_FiltersFactory.h>
+#include <ModelAPI_Session.h>
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
-#include <ModelAPI_Session.h>
-#include <ModelAPI_FiltersFactory.h>
FiltersAPI_Feature::FiltersAPI_Feature(
const std::shared_ptr<ModelAPI_Feature> & theFeature)
static void separateArguments(const std::list<FiltersAPI_Argument>& theArguments,
std::list<ModelHighAPI_Selection>& theSelections,
std::list<std::string>& theTextArgs,
- std::list<bool>& theBoolArgs)
+ std::list<bool>& theBoolArgs,
+ std::list<ModelHighAPI_Double>& theDoubleArgs)
{
std::list<FiltersAPI_Argument>::const_iterator anIt = theArguments.begin();
for (; anIt != theArguments.end(); ++anIt) {
if (anIt->selection().variantType() != ModelHighAPI_Selection::VT_Empty)
theSelections.push_back(anIt->selection());
- else if (anIt->string().empty())
+ else if (anIt->dble().value() > std::numeric_limits<double>::lowest()) {
+ theDoubleArgs.push_back(anIt->dble());
+ }
+ else if (anIt->string().empty()) {
theBoolArgs.push_back(anIt->boolean());
+ }
else
theTextArgs.push_back(anIt->string());
}
std::list<ModelHighAPI_Selection> aSelections;
std::list<std::string> aTexts;
std::list<bool> aBools;
- separateArguments(anArgs, aSelections, aTexts, aBools);
+ std::list<ModelHighAPI_Double> aDoubles;
+ separateArguments(anArgs, aSelections, aTexts, aBools, aDoubles);
std::list<AttributePtr> aFilterArgs = aBase->filterArgs(aFilterID);
std::list<AttributePtr>::iterator aFIt = aFilterArgs.begin();
if (aReversedFlag)
++aFIt;
// fill arguments of the filter
+ std::list<ModelHighAPI_Double>::const_iterator anItDle = aDoubles.begin();
for (; aFIt != aFilterArgs.end(); ++aFIt) {
AttributeSelectionListPtr aSelList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aFIt);
else {
AttributeBooleanPtr aBoolean =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(*aFIt);
- if (aBoolean && aBools.size() == 1)
- fillAttribute(aBools.front(), aBoolean);
+ if (aBoolean) {
+ if (aBools.size() == 1)
+ fillAttribute(aBools.front(), aBoolean);
+ } else {
+ AttributeDoublePtr aDouble =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(*aFIt);
+ if (aDouble) {
+ fillAttribute((*anItDle).value(), aDouble);
+ anItDle++;
+ }
+ }
}
}
}