Salome HOME
Merge branch 'Dev_1.5.0' into BR_REENTRANCE_OPERATION
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        SketchPlugin_Validators.h
4 // Created:     01 Aug 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef SketchPlugin_Validators_H
8 #define SketchPlugin_Validators_H
9
10 #include "SketchPlugin.h"
11 #include <ModelAPI_AttributeValidator.h>
12 #include <ModelAPI_FeatureValidator.h>
13
14 /**\class SketchPlugin_DistanceAttrValidator
15  * \ingroup Validators
16  * \brief Validator for the distance input.
17  *
18  * It just checks that distance is greater than zero.
19  */
20 class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator
21 {
22  public:
23   //! returns true if attribute is valid
24   //! \param theAttribute the checked attribute
25   //! \param theArguments arguments of the attribute
26   //! \param theError error message
27   virtual bool isValid(const AttributePtr& theAttribute,
28                        const std::list<std::string>& theArguments,
29                        std::string& theError) const;
30 };
31
32 /**\class SketchPlugin_TangentAttrValidator
33  * \ingroup Validators
34  * \brief Validator for the tangent constraint input.
35  *
36  * It just checks that distance is greater than zero.
37  */
38 class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator
39 {
40  public:
41   //! returns true if attribute is valid
42   //! \param theAttribute the checked attribute
43   //! \param theArguments arguments of the attribute
44   //! \param theError error message
45   virtual bool isValid(const AttributePtr& theAttribute,
46                        const std::list<std::string>& theArguments,
47                        std::string& theError) const;
48 };
49
50
51 /**\class SketchPlugin_NotFixedValidator
52  * \ingroup Validators
53  * \brief Validator for the rigid constraint input.
54  *
55  * It just checks there is no rigid constraint for the current feature.
56  */
57 class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator
58 {
59  public:
60   //! returns true if attribute is not used in another rigid constraint
61   //! \param theAttribute the checked attribute
62   //! \param theArguments arguments of the attribute
63   //! \param theError error message
64   virtual bool isValid(const AttributePtr& theAttribute,
65                        const std::list<std::string>& theArguments,
66                        std::string& theError) const;
67 };
68
69 /**\class SketchPlugin_EqualAttrValidator
70  * \ingroup Validators
71  * \brief Validator for the equal constraint input.
72  *
73  * It checks that attributes of the Equal constraint are correct.
74  */
75 class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator
76 {
77  public:
78   //! returns true if attribute is valid
79   //! \param theAttribute the checked attribute
80   //! \param theArguments arguments of the attribute
81   //! \param theError error message
82   virtual bool isValid(const AttributePtr& theAttribute,
83                        const std::list<std::string>& theArguments,
84                        std::string& theError) const;
85 };
86
87 /**\class SketchPlugin_MirrorAttrValidator
88  * \ingroup Validators
89  * \brief Validator for the mirror constraint input.
90  *
91  * It checks that attributes of the Mirror constraint are correct.
92  */
93 class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator
94 {
95  public:
96   //! returns true if attribute is valid
97   //! \param theAttribute the checked attribute
98   //! \param theArguments arguments of the attribute (not used)
99   //! \param theError error message
100   virtual bool isValid(const AttributePtr& theAttribute,
101                        const std::list<std::string>& theArguments,
102                        std::string& theError) const;
103 };
104
105
106 /**\class SketchPlugin_CoincidenceAttrValidator
107  * \ingroup Validators
108  * \brief Validator for the coincidence constraint input.
109  *
110  * It checks that attributes of the Coincidence constraint are correct.
111  */
112 class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator
113 {
114  public:
115   //! returns true if attribute is valid
116   //! \param theAttribute the checked attribute
117   //! \param theArguments arguments of the attribute (not used)
118   //! \param theError error message
119   virtual bool isValid(const AttributePtr& theAttribute,
120                        const std::list<std::string>& theArguments,
121                        std::string& theError) const;
122 };
123
124
125 /**\class SketchPlugin_CopyValidator
126  * \ingroup Validators
127  * \brief Validator for the constraints which create features.
128  *
129  * Applicable only for features, which creates another features. It verifies the produced
130  * features of current constraint don't become into the list of initial features
131  */
132 class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator
133 {
134  public:
135   //! returns true if attribute is valid
136   //! \param theAttribute the checked attribute
137   //! \param theArguments arguments of the attribute (not used)
138   //! \param theError error message
139   virtual bool isValid(const AttributePtr& theAttribute,
140                        const std::list<std::string>& theArguments,
141                        std::string& theError) const;
142 };
143
144 /**\class SketchPlugin_SolverErrorValidator
145  * \ingroup Validators
146  * \brief Validator for the solver error.
147  *
148  * Simply checks that solver error attribute is empty. Returns the attribute value as an error.
149  */
150 class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator
151 {
152  public:
153   //! returns true if there are no solver errors
154   //! \param theFeature the checked feature
155   //! \param theArguments arguments of the feature (not used)
156   //! \param theError error message
157   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
158                        const std::list<std::string>& theArguments,
159                        std::string& theError) const;
160
161   /// Returns true if the attribute in feature is not obligatory for the feature execution
162   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
163 };
164
165 /**\class SketchPlugin_FilletVertexValidator
166  * \ingroup Validators
167  * \brief Validator for the point for fillet creation.
168  *
169  * Checks that selected point have exactly two coincident lines.
170  */
171 class SketchPlugin_FilletVertexValidator : public ModelAPI_AttributeValidator
172 {
173  public:
174   //! returns true if attribute is valid
175   //! \param theAttribute the checked attribute
176   //! \param theArguments arguments of the attribute (not used)
177   //! \param theError error message
178   virtual bool isValid(const AttributePtr& theAttribute,
179                        const std::list<std::string>& theArguments,
180                        std::string& theError) const;
181 };
182
183 #endif