1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_Validators.h
4 // Created: 01 Aug 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef SketchPlugin_Validators_H
8 #define SketchPlugin_Validators_H
10 #include "SketchPlugin.h"
11 #include <ModelAPI_AttributeValidator.h>
12 #include <ModelAPI_FeatureValidator.h>
14 /**\class SketchPlugin_DistanceAttrValidator
16 * \brief Validator for the distance input.
18 * It just checks that distance is greater than zero.
20 class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
32 /**\class SketchPlugin_TangentAttrValidator
34 * \brief Validator for the tangent constraint input.
36 * It just checks that distance is greater than zero.
38 class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
51 /**\class SketchPlugin_NotFixedValidator
53 * \brief Validator for the rigid constraint input.
55 * It just checks there is no rigid constraint for the current feature.
57 class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
69 /**\class SketchPlugin_EqualAttrValidator
71 * \brief Validator for the equal constraint input.
73 * It checks that attributes of the Equal constraint are correct.
75 class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
87 /**\class SketchPlugin_MirrorAttrValidator
89 * \brief Validator for the mirror constraint input.
91 * It checks that attributes of the Mirror constraint are correct.
93 class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
106 /**\class SketchPlugin_CoincidenceAttrValidator
107 * \ingroup Validators
108 * \brief Validator for the coincidence constraint input.
110 * It checks that attributes of the Coincidence constraint are correct.
112 class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
125 /**\class SketchPlugin_CopyValidator
126 * \ingroup Validators
127 * \brief Validator for the constraints which create features.
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
132 class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
144 /**\class SketchPlugin_SolverErrorValidator
145 * \ingroup Validators
146 * \brief Validator for the solver error.
148 * Simply checks that solver error attribute is empty. Returns the attribute value as an error.
150 class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator
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 Events_InfoMessage& theError) const;
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);
165 /**\class SketchPlugin_FilletVertexValidator
166 * \ingroup Validators
167 * \brief Validator for the point for fillet creation.
169 * Checks that selected point have exactly two coincident lines.
171 class SketchPlugin_FilletVertexValidator : public ModelAPI_AttributeValidator
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 Events_InfoMessage& theError) const;
184 /**\class SketchPlugin_MiddlePointAttrValidator
185 * \ingroup Validators
186 * \brief Validator for the middle point constraint input.
188 * It checks that attributes of the Middle point constraint are correct.
190 class SketchPlugin_MiddlePointAttrValidator : public ModelAPI_AttributeValidator
193 //! returns true if attribute is valid
194 //! \param theAttribute the checked attribute
195 //! \param theArguments arguments of the attribute (not used)
196 //! \param theError error message
197 virtual bool isValid(const AttributePtr& theAttribute,
198 const std::list<std::string>& theArguments,
199 Events_InfoMessage& theError) const;
203 /**\class SketchPlugin_ArcTangentPointValidator
204 * \ingroup Validators
205 * \brief Validator for the point where the tangent arc is building.
207 * Checks that the point is a start or end point just on line or arc.
209 class SketchPlugin_ArcTangentPointValidator : public ModelAPI_AttributeValidator
212 //! returns true if attribute is valid
213 //! \param theAttribute the checked attribute
214 //! \param theArguments arguments of the attribute
215 //! \param theError error message
216 virtual bool isValid(const AttributePtr& theAttribute,
217 const std::list<std::string>& theArguments,
218 Events_InfoMessage& theError) const;
221 /**\class SketchPlugin_IntersectionValidator
222 * \ingroup Validators
223 * \brief Validator for the attribute to be intersected with the sketch plane.
225 class SketchPlugin_IntersectionValidator : public ModelAPI_AttributeValidator
228 //! returns true if attribute is valid
229 //! \param theAttribute the checked attribute
230 //! \param theArguments arguments of the attribute
231 //! \param theError error message
232 virtual bool isValid(const AttributePtr& theAttribute,
233 const std::list<std::string>& theArguments,
234 Events_InfoMessage& theError) const;
237 /**\class SketchPlugin_ProjectionValidator
238 * \ingroup Validators
239 * \brief Validator for the attribute to be projected onto the sketch plane.
241 class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator
244 //! returns true if attribute is valid
245 //! \param theAttribute the checked attribute
246 //! \param theArguments arguments of the attribute
247 //! \param theError error message
248 virtual bool isValid(const AttributePtr& theAttribute,
249 const std::list<std::string>& theArguments,
250 Events_InfoMessage& theError) const;