Salome HOME
Rigid constraint should process selection of vertex, lines and circles. So, a new...
[modules/shaper.git] / src / GeomValidators / GeomValidators_ShapeType.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomValidators_ShapeType.h
4 // Created:     19 Mar 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef GeomValidators_ShapeType_H
8 #define GeomValidators_ShapeType_H
9
10 #include "GeomValidators.h"
11 #include "ModelAPI_AttributeValidator.h"
12
13 #include <string>
14
15 /**
16 * \ingroup Validators
17 * A validator for shape types, such as vertex, line, circe or arc.
18 * If there are some argument parameters, this validator returns true if the attribute satisfied
19 * at least one argument (OR combination of arguments).
20 */
21 class GeomValidators_ShapeType : public ModelAPI_AttributeValidator
22 {
23  public:
24   //  the edge type
25   enum TypeOfShape
26   {
27     AnyShape,
28     Vertex,
29     Line,
30     Circle
31   };
32
33  public:
34    GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {}
35   //! returns true if attribute is valid
36   //! \param theAttribute the checked attribute
37   //! \param theArguments arguments of the attribute
38   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
39                                              const std::list<std::string>& theArguments) const;
40 protected:
41   /// Convert string to TypeOfShape value
42   /// \param theType a string value
43   static TypeOfShape shapeType(const std::string& theType);
44
45   bool isValidArgument(const AttributePtr& theAttribute,
46                        const std::string& theArgument) const;
47
48 };
49
50 #endif