Salome HOME
Erroneous cases in SALOME mode: Sketch, start sub-feature operation[some control...
[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   virtual bool isValid(const AttributePtr& theAttribute,
27                        const std::list<std::string>& theArguments,
28                        std::string& theError) const;
29 };
30
31 /**\class SketchPlugin_TangentAttrValidator
32  * \ingroup Validators
33  * \brief Validator for the tangent constraint input.
34  *
35  * It just checks that distance is greater than zero.
36  */
37 class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator
38 {
39  public:
40   //! returns true if attribute is valid
41   //! \param theAttribute the checked attribute
42   //! \param theArguments arguments of the attribute
43   virtual bool isValid(const AttributePtr& theAttribute,
44                        const std::list<std::string>& theArguments,
45                        std::string& theError) const;
46 };
47
48
49 /**\class SketchPlugin_NotFixed
50  * \ingroup Validators
51  * \brief Validator for the rigid constraint input.
52  *
53  * It just checks there is no rigid constraint for the current feature.
54  */
55 class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator
56 {
57  public:
58   //! returns true if attribute is not used in another rigid constraint
59   //! \param theAttribute the checked attribute
60   //! \param theArguments arguments of the attribute
61   virtual bool isValid(const AttributePtr& theAttribute,
62                        const std::list<std::string>& theArguments,
63                        std::string& theError) const;
64 };
65
66 /**\class SketchPlugin_EqualAttrValidator
67  * \ingroup Validators
68  * \brief Validator for the equal constraint input.
69  *
70  * It checks that attributes of the Equal constraint are correct.
71  */
72 class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator
73 {
74  public:
75   //! returns true if attribute is valid
76   //! \param theAttribute the checked attribute
77   //! \param theArguments arguments of the attribute
78   virtual bool isValid(const AttributePtr& theAttribute,
79                        const std::list<std::string>& theArguments,
80                        std::string& theError) const;
81 };
82
83 /**\class SketchPlugin_MirrorAttrValidator
84  * \ingroup Validators
85  * \brief Validator for the mirror constraint input.
86  *
87  * It checks that attributes of the Mirror constraint are correct.
88  */
89 class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator
90 {
91  public:
92   //! returns true if attribute is valid
93   //! \param theAttribute the checked attribute
94   //! \param theArguments arguments of the attribute (not used)
95   virtual bool isValid(const AttributePtr& theAttribute,
96                        const std::list<std::string>& theArguments,
97                        std::string& theError) const;
98 };
99
100
101 /**\class SketchPlugin_CoincidenceAttrValidator
102  * \ingroup Validators
103  * \brief Validator for the coincidence constraint input.
104  *
105  * It checks that attributes of the Coincidence constraint are correct.
106  */
107 class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator
108 {
109  public:
110   //! returns true if attribute is valid
111   //! \param theAttribute the checked attribute
112   //! \param theArguments arguments of the attribute (not used)
113   virtual bool isValid(const AttributePtr& theAttribute,
114                        const std::list<std::string>& theArguments,
115                        std::string& theError) const;
116 };
117
118
119 /**\class SketchPlugin_CopyValidator
120  * \ingroup Validators
121  * \brief Validator for the constraints which create features.
122  *
123  * Applicable only for features, which creates another features. It verifies the produced
124  * features of current constraint don't become into the list of initial features
125  */
126 class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator
127 {
128  public:
129   //! returns true if attribute is valid
130   //! \param theAttribute the checked attribute
131   //! \param theArguments arguments of the attribute (not used)
132   virtual bool isValid(const AttributePtr& theAttribute,
133                        const std::list<std::string>& theArguments,
134                        std::string& theError) const;
135 };
136
137 /**\class SketchPlugin_SolverErrorValidator
138  * \ingroup Validators
139  * \brief Validator for the solver error.
140  *
141  * Simply checks that solver error attribute is empty. Returns the attribute value as an error.
142  */
143 class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator
144 {
145  public:
146   //! returns true if there are no solver errors
147   //! \param theFeature the checked feature
148   //! \param theArguments arguments of the feature (not used)
149   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
150                        const std::list<std::string>& theArguments,
151                        std::string& theError) const;
152
153   /// Returns true if the attribute in feature is not obligatory for the feature execution
154   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
155 };
156
157 #endif