1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesPlugin_Validators.h
4 // Created: 22 March 2016
5 // Author: Dmitry Bobylev
7 #ifndef FeaturesPlugin_Validators_H_
8 #define FeaturesPlugin_Validators_H_
10 #include <ModelAPI_AttributeValidator.h>
11 #include <ModelAPI_FeatureValidator.h>
13 /// \class FeaturesPlugin_ValidatorPipePath
14 /// \ingroup Validators
15 /// \brief A validator for selection pipe path.
16 class FeaturesPlugin_ValidatorPipePath: public ModelAPI_AttributeValidator
19 //! \return True if the attribute is valid.
20 //! \param[in] theAttribute the checked attribute.
21 //! \param[in] theArguments arguments of the attribute.
22 //! \param[out] theError error message.
23 virtual bool isValid(const AttributePtr& theAttribute,
24 const std::list<std::string>& theArguments,
25 Events_InfoMessage& theError) const;
28 /// \class FeaturesPlugin_ValidatorPipeLocations
29 /// \ingroup Validators
30 /// \brief Validator for the pipe locations.
31 class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator
34 //! \return true if number of selected locations the same as number of selected bases, or empty.
35 //! \param theFeature the checked feature
36 //! \param theArguments arguments of the feature (not used)
37 //! \param theError error message
38 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
39 const std::list<std::string>& theArguments,
40 Events_InfoMessage& theError) const;
42 /// Returns true if the attribute in feature is not obligatory for the feature execution
43 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
46 /// \class FeaturesPlugin_ValidatorBaseForGeneration
47 /// \ingroup Validators
48 /// \brief A validator for selection base for generation. Allows to select faces on sketch,
49 /// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.
50 class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator
53 //! \return true if attribute has selection type listed in the parameter arguments.
54 //! \param[in] theAttribute the checked attribute.
55 //! \param[in] theArguments arguments of the attribute.
56 //! \param[out] theError error message.
57 virtual bool isValid(const AttributePtr& theAttribute,
58 const std::list<std::string>& theArguments,
59 Events_InfoMessage& theError) const;
62 bool isValidAttribute(const AttributePtr& theAttribute,
63 const std::list<std::string>& theArguments,
64 Events_InfoMessage& theError) const;
67 /// \class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects
68 /// \ingroup Validators
69 /// \brief Validator for the base objects for generation. Checks that sketch and it objects
70 /// are not selected at the same time.
71 class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects:
72 public ModelAPI_FeatureValidator
75 //! \return true if sketch and it objects not selected at the same time.
76 //! \param theFeature the checked feature
77 //! \param theArguments arguments of the feature (not used)
78 //! \param theError error message
79 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
80 const std::list<std::string>& theArguments,
81 Events_InfoMessage& theError) const;
83 /// Returns true if the attribute in feature is not obligatory for the feature execution
84 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
87 /// \class FeaturesPlugin_ValidatorCompositeLauncher
88 /// \ingroup Validators
89 /// \brief A validator for selection at composite feature start
90 class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator
93 //! \return true if attribute has selection type listed in the parameter arguments.
94 //! \param[in] theAttribute the checked attribute.
95 //! \param[in] theArguments arguments of the attribute.
96 //! \param[out] theError error message.
97 virtual bool isValid(const AttributePtr& theAttribute,
98 const std::list<std::string>& theArguments,
99 Events_InfoMessage& theError) const;
102 /// \class FeaturesPlugin_ValidatorExtrusionDir
103 /// \ingroup Validators
104 /// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are
105 /// planar and do not contain vertices and edges.
106 class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator
109 //! \return true if attribute listed in the parameter arguments are planar.
110 //! \param[in] theFeature the checked feature.
111 //! \param[in] theArguments arguments of the attribute.
112 //! \param[out] theError error message.
113 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
114 const std::list<std::string>& theArguments,
115 Events_InfoMessage& theError) const;
117 /// \return true if the attribute in feature is not obligatory for the feature execution
118 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
121 bool isShapesCanBeEmpty(const AttributePtr& theAttribute,
122 Events_InfoMessage& theError) const;
125 /// \class FeaturesPlugin_ValidatorBooleanSelection
126 /// \ingroup Validators
127 /// \brief Validates selection for boolean operation.
128 class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator
131 /// \return True if the attribute is valid. It checks whether the selection
132 /// is acceptable for boolean operation.
133 /// \param[in] theAttribute an attribute to check.
134 /// \param[in] theArguments a filter parameters.
135 /// \param[out] theError error message.
136 virtual bool isValid(const AttributePtr& theAttribute,
137 const std::list<std::string>& theArguments,
138 Events_InfoMessage& theError) const;
141 /// \class FeaturesPlugin_ValidatorPartitionSelection
142 /// \ingroup Validators
143 /// \brief Validates selection for partition.
144 class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator
147 /// \return True if the attribute is valid. It checks whether the selection
148 /// is acceptable for operation.
149 /// \param[in] theAttribute an attribute to check.
150 /// \param[in] theArguments a filter parameters.
151 /// \param[out] theError error message.
152 virtual bool isValid(const AttributePtr& theAttribute,
153 const std::list<std::string>& theArguments,
154 Events_InfoMessage& theError) const;
157 /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection
158 /// \ingroup Validators
159 /// \brief Validates selection for "Remove Sub-Shapes" feature.
160 class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator
163 /// \return True if the attribute is valid. It checks whether the selection
164 /// is acceptable for operation.
165 /// \param[in] theAttribute an attribute to check.
166 /// \param[in] theArguments a filter parameters.
167 /// \param[out] theError error message.
168 virtual bool isValid(const AttributePtr& theAttribute,
169 const std::list<std::string>& theArguments,
170 Events_InfoMessage& theError) const;
173 /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult
174 /// \ingroup Validators
175 /// \brief Validator for the Remove Sub-Shapes feature.
176 class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator
179 //! \return true if result is valid shape.
180 //! \param theFeature the checked feature
181 //! \param theArguments arguments of the feature (not used)
182 //! \param theError error message
183 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
184 const std::list<std::string>& theArguments,
185 Events_InfoMessage& theError) const;
187 /// \return true if the attribute in feature is not obligatory for the feature execution
188 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
191 /// \class FeaturesPlugin_ValidatorUnionSelection
192 /// \ingroup Validators
193 /// \brief Validates selection for "Union" feature.
194 class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator
197 /// \return True if the attribute is valid. It checks whether the selection
198 /// is acceptable for operation.
199 /// \param[in] theAttribute an attribute to check.
200 /// \param[in] theArguments a filter parameters.
201 /// \param[out] theError error message.
202 virtual bool isValid(const AttributePtr& theAttribute,
203 const std::list<std::string>& theArguments,
204 Events_InfoMessage& theError) const;
207 /// \class FeaturesPlugin_ValidatorUnionArguments
208 /// \ingroup Validators
209 /// \brief Validator for the "Union" feature.
210 class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator
213 //! \return true if result is valid shape.
214 //! \param theFeature the checked feature
215 //! \param theArguments arguments of the feature (not used)
216 //! \param theError error message
217 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
218 const std::list<std::string>& theArguments,
219 Events_InfoMessage& theError) const;
221 /// \return true if the attribute in feature is not obligatory for the feature execution
222 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
225 /// \class FeaturesPlugin_ValidatorConcealedResult
226 /// \ingroup Validators
227 /// \brief Validator for the "Recover" feature.
228 class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator
231 //! \return True if the attribute is valid.
232 //! \param[in] theAttribute the checked attribute.
233 //! \param[in] theArguments arguments of the attribute.
234 //! \param[out] theError error message.
235 virtual bool isValid(const AttributePtr& theAttribute,
236 const std::list<std::string>& theArguments,
237 Events_InfoMessage& theError) const;