It provides finite validators to skip Axis,Plane selection in Export.
</export_file_selector>
<multi_selector id="selection_list" tooltip="Select a set of objects" type_choice="Vertices Edges Faces Solids Objects">
<validator id="GeomValidators_PartSet"/>
+ <validator id="GeomValidators_Finite"/>
</multi_selector>
</feature>
</group>
GeomValidators_BooleanArguments.h
GeomValidators_ConstructionComposite.h
GeomValidators_Face.h
+ GeomValidators_Finite.h
GeomValidators_PartSet.h
GeomValidators_Positive.h
GeomValidators_ShapeType.h
GeomValidators_BooleanArguments.cpp
GeomValidators_ConstructionComposite.cpp
GeomValidators_Face.cpp
+ GeomValidators_Finite.cpp
GeomValidators_PartSet.cpp
GeomValidators_Positive.cpp
GeomValidators_ShapeType.cpp
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: GeomValidators_Finite.cpp
+// Created: 27 Aug 2015
+// Author: Natalia ERMOLAEVA
+
+#include <GeomValidators_Finite.h>
+
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_ResultConstruction.h>
+
+bool GeomValidators_Finite::isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
+ std::string& theError) const
+{
+ bool aValid = true;
+
+ if (theAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aSelectionListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) {
+ AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
+ ResultPtr aResult = aSelectAttr->context();
+ if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) {
+ ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
+ if (aConstruction.get() && aConstruction->isInfinite()) {
+ aValid = false;
+ }
+ }
+ }
+ }
+ return aValid;
+}
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: GeomValidators_Finite.h
+// Created: 27 Aug 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef GeomValidators_Finite_H
+#define GeomValidators_Finite_H
+
+#include <GeomValidators.h>
+#include <ModelAPI_AttributeValidator.h>
+
+/**
+* \ingroup Validators
+* A validator for finite objects. It returns false for construction infinite results.
+*/
+class GeomValidators_Finite : public ModelAPI_AttributeValidator
+{
+public:
+ //! returns true if attribute is valid
+ //! \param theAttribute the checked attribute
+ //! \param theArguments arguments of the attribute
+ GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
+ std::string& theError) const;
+};
+
+#endif
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-// File: GeomValidators_Face.h
+// File: GeomValidators_PartSet.h
// Created: 27 Aug 2015
// Author: Natalia ERMOLAEVA
/**
* \ingroup Validators
-* A validator for partset objects.
+* A validator for partset document. When PartSet is active, the attribute can accept only
+* shape, which coincide to the shape of result.
*/
class GeomValidators_PartSet : public ModelAPI_AttributeValidator
{
}
}
#ifdef DEBUG_FILTERS
- qDebug(QString("ModuleBase_ShapeDocumentFilter::IsOk = %1").arg(aValid).toStdString().c_str());
+ qDebug(QString("PartSet_FilterInfinite::IsOk = %1").arg(aValid).toStdString().c_str());
#endif
return aValid;
}
#include <GeomValidators_ShapeType.h>
#include <GeomValidators_PartSet.h>
+#include <GeomValidators_Finite.h>
#include <GeomValidators_Face.h>
#include <GeomValidators_ConstructionComposite.h>
#include <GeomValidators_ZeroOffset.h>
aFactory->registerValidator("GeomValidators_PartSet", new GeomValidators_PartSet);
+ aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
+
aFactory->registerValidator("GeomValidators_ConstructionComposite",
new GeomValidators_ConstructionComposite);