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_ValidatorCompositeLauncher
68 /// \ingroup Validators
69 /// \brief A validator for selection at composite feature start
70 class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator
73 //! \return true if attribute has selection type listed in the parameter arguments.
74 //! \param[in] theAttribute the checked attribute.
75 //! \param[in] theArguments arguments of the attribute.
76 //! \param[out] theError error message.
77 virtual bool isValid(const AttributePtr& theAttribute,
78 const std::list<std::string>& theArguments,
79 Events_InfoMessage& theError) const;
82 /// \class FeaturesPlugin_ValidatorExtrusionDir
83 /// \ingroup Validators
84 /// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are
85 /// planar and do not contain vertices and edges.
86 class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator
89 //! \return true if attribute listed in the parameter arguments are planar.
90 //! \param[in] theFeature the checked feature.
91 //! \param[in] theArguments arguments of the attribute.
92 //! \param[out] theError error message.
93 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
94 const std::list<std::string>& theArguments,
95 Events_InfoMessage& theError) const;
97 /// \return true if the attribute in feature is not obligatory for the feature execution
98 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
101 bool isShapesCanBeEmpty(const AttributePtr& theAttribute,
102 Events_InfoMessage& theError) const;
105 /// \class FeaturesPlugin_ValidatorBooleanSelection
106 /// \ingroup Validators
107 /// \brief Validates selection for boolean operation.
108 class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator
111 /// \return True if the attribute is valid. It checks whether the selection
112 /// is acceptable for boolean operation.
113 /// \param[in] theAttribute an attribute to check.
114 /// \param[in] theArguments a filter parameters.
115 /// \param[out] theError error message.
116 virtual bool isValid(const AttributePtr& theAttribute,
117 const std::list<std::string>& theArguments,
118 Events_InfoMessage& theError) const;
121 /// \class FeaturesPlugin_ValidatorPartitionSelection
122 /// \ingroup Validators
123 /// \brief Validates selection for partition.
124 class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator
127 /// \return True if the attribute is valid. It checks whether the selection
128 /// is acceptable for operation.
129 /// \param[in] theAttribute an attribute to check.
130 /// \param[in] theArguments a filter parameters.
131 /// \param[out] theError error message.
132 virtual bool isValid(const AttributePtr& theAttribute,
133 const std::list<std::string>& theArguments,
134 Events_InfoMessage& theError) const;
137 /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection
138 /// \ingroup Validators
139 /// \brief Validates selection for "Remove Sub-Shapes" feature.
140 class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator
143 /// \return True if the attribute is valid. It checks whether the selection
144 /// is acceptable for operation.
145 /// \param[in] theAttribute an attribute to check.
146 /// \param[in] theArguments a filter parameters.
147 /// \param[out] theError error message.
148 virtual bool isValid(const AttributePtr& theAttribute,
149 const std::list<std::string>& theArguments,
150 Events_InfoMessage& theError) const;
153 /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult
154 /// \ingroup Validators
155 /// \brief Validator for the Remove Sub-Shapes feature.
156 class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator
159 //! \return true if result is valid shape.
160 //! \param theFeature the checked feature
161 //! \param theArguments arguments of the feature (not used)
162 //! \param theError error message
163 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
164 const std::list<std::string>& theArguments,
165 Events_InfoMessage& theError) const;
167 /// \return true if the attribute in feature is not obligatory for the feature execution
168 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
171 /// \class FeaturesPlugin_ValidatorUnionSelection
172 /// \ingroup Validators
173 /// \brief Validates selection for "Union" feature.
174 class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator
177 /// \return True if the attribute is valid. It checks whether the selection
178 /// is acceptable for operation.
179 /// \param[in] theAttribute an attribute to check.
180 /// \param[in] theArguments a filter parameters.
181 /// \param[out] theError error message.
182 virtual bool isValid(const AttributePtr& theAttribute,
183 const std::list<std::string>& theArguments,
184 Events_InfoMessage& theError) const;
187 /// \class FeaturesPlugin_ValidatorUnionArguments
188 /// \ingroup Validators
189 /// \brief Validator for the "Union" feature.
190 class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator
193 //! \return true if result is valid shape.
194 //! \param theFeature the checked feature
195 //! \param theArguments arguments of the feature (not used)
196 //! \param theError error message
197 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
198 const std::list<std::string>& theArguments,
199 Events_InfoMessage& theError) const;
201 /// \return true if the attribute in feature is not obligatory for the feature execution
202 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
205 /// \class FeaturesPlugin_ValidatorConcealedResult
206 /// \ingroup Validators
207 /// \brief Validator for the "Recover" feature.
208 class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator
211 //! \return True if the attribute is valid.
212 //! \param[in] theAttribute the checked attribute.
213 //! \param[in] theArguments arguments of the attribute.
214 //! \param[out] theError error message.
215 virtual bool isValid(const AttributePtr& theAttribute,
216 const std::list<std::string>& theArguments,
217 Events_InfoMessage& theError) const;