1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomValidators_ShapeType.h
4 // Created: 19 Mar 2015
5 // Author: Natalia ERMOLAEVA
7 #ifndef GeomValidators_ShapeType_H
8 #define GeomValidators_ShapeType_H
10 #include "GeomValidators.h"
11 #include "ModelAPI_AttributeValidator.h"
13 #include <GeomAPI_Shape.h>
19 * A validator for shape types, such as vertex, line, circe or arc.
20 * If there are some argument parameters, this validator returns true if the attribute satisfied
21 * at least one argument (OR combination of arguments).
23 class GeomValidators_ShapeType : public ModelAPI_AttributeValidator
40 GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {}
41 //! returns true if attribute is valid
42 //! \param theAttribute the checked attribute
43 //! \param theArguments arguments of the attribute
44 GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
45 const std::list<std::string>& theArguments) const;
47 /// Convert string to TypeOfShape value
48 /// \param theType a string value
49 static TypeOfShape shapeType(const std::string& theType);
51 bool isValidArgument(const AttributePtr& theAttribute,
52 const std::string& theArgument) const;
54 /// Returns true if the attibute's object type satisfies the argument value
55 /// \param theAttribute a checked attribute
56 /// \param theArgument a parameter
57 bool isValidAttribute(const AttributePtr& theAttribute,
58 const TypeOfShape theShapeType) const;
60 /// Returns true if the attibute's object type satisfies the argument value
61 /// \param theAttribute a checked object
62 /// \param theShapeType a shape type
63 bool isValidObject(const ObjectPtr& theObject,
64 const TypeOfShape theShapeType) const;
66 /// Returns true if the attibute's object type satisfies the argument value
67 /// \param theShape a checked shape
68 /// \param theShapeType a shape type
69 bool isValidShape(const GeomShapePtr theShape,
70 const TypeOfShape theShapeType) const;