1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FeaturesPlugin_Validators_H_
22 #define FeaturesPlugin_Validators_H_
24 #include <ModelAPI_AttributeValidator.h>
25 #include <ModelAPI_FeatureValidator.h>
27 /// \class FeaturesPlugin_ValidatorPipePath
28 /// \ingroup Validators
29 /// \brief A validator for selection pipe path.
30 class FeaturesPlugin_ValidatorPipePath: public ModelAPI_AttributeValidator
33 //! \return True if the attribute is valid.
34 //! \param[in] theAttribute the checked attribute.
35 //! \param[in] theArguments arguments of the attribute.
36 //! \param[out] theError error message.
37 virtual bool isValid(const AttributePtr& theAttribute,
38 const std::list<std::string>& theArguments,
39 Events_InfoMessage& theError) const;
42 /// \class FeaturesPlugin_ValidatorPipeLocations
43 /// \ingroup Validators
44 /// \brief Validator for the pipe locations.
45 class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator
48 //! \return true if number of selected locations the same as number of selected bases, or empty.
49 //! \param theFeature the checked feature
50 //! \param theArguments arguments of the feature (not used)
51 //! \param theError error message
52 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
53 const std::list<std::string>& theArguments,
54 Events_InfoMessage& theError) const;
57 /// \class FeaturesPlugin_ValidatorBaseForGeneration
58 /// \ingroup Validators
59 /// \brief A validator for selection base for generation. Allows to select faces on sketch,
60 /// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.
61 class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator
64 //! \return true if attribute has selection type listed in the parameter arguments.
65 //! \param[in] theAttribute the checked attribute.
66 //! \param[in] theArguments arguments of the attribute.
67 //! \param[out] theError error message.
68 virtual bool isValid(const AttributePtr& theAttribute,
69 const std::list<std::string>& theArguments,
70 Events_InfoMessage& theError) const;
73 bool isValidAttribute(const AttributePtr& theAttribute,
74 const std::list<std::string>& theArguments,
75 Events_InfoMessage& theError) const;
78 /// \class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects
79 /// \ingroup Validators
80 /// \brief Validator for the base objects for generation. Checks that sketch and it objects
81 /// are not selected at the same time.
82 class FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects:
83 public ModelAPI_FeatureValidator
86 //! \return true if sketch and it objects not selected at the same time.
87 //! \param theFeature the checked feature
88 //! \param theArguments arguments of the feature (not used)
89 //! \param theError error message
90 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
91 const std::list<std::string>& theArguments,
92 Events_InfoMessage& theError) const;
95 /// \class FeaturesPlugin_ValidatorCompositeLauncher
96 /// \ingroup Validators
97 /// \brief A validator for selection at composite feature start
98 class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator
101 //! \return true if attribute has selection type listed in the parameter arguments.
102 //! \param[in] theAttribute the checked attribute.
103 //! \param[in] theArguments arguments of the attribute.
104 //! \param[out] theError error message.
105 virtual bool isValid(const AttributePtr& theAttribute,
106 const std::list<std::string>& theArguments,
107 Events_InfoMessage& theError) const;
110 /// \class FeaturesPlugin_ValidatorExtrusionDir
111 /// \ingroup Validators
112 /// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are
113 /// planar and do not contain vertices and edges.
114 class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator
117 //! \return true if attribute listed in the parameter arguments are planar.
118 //! \param[in] theFeature the checked feature.
119 //! \param[in] theArguments arguments of the attribute.
120 //! \param[out] theError error message.
121 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
122 const std::list<std::string>& theArguments,
123 Events_InfoMessage& theError) const;
126 bool isShapesCanBeEmpty(const AttributePtr& theAttribute,
127 Events_InfoMessage& theError) const;
130 /// \class FeaturesPlugin_ValidatorBooleanSelection
131 /// \ingroup Validators
132 /// \brief Validates selection for boolean operation.
133 class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator
136 /// \return True if the attribute is valid. It checks whether the selection
137 /// is acceptable for boolean operation.
138 /// \param[in] theAttribute an attribute to check.
139 /// \param[in] theArguments a filter parameters.
140 /// \param[out] theError error message.
141 virtual bool isValid(const AttributePtr& theAttribute,
142 const std::list<std::string>& theArguments,
143 Events_InfoMessage& theError) const;
146 /// \class FeaturesPlugin_ValidatorFilletSelection
147 /// \ingroup Validators
148 /// \brief Validates selection for fillet operation.
149 class FeaturesPlugin_ValidatorFilletSelection: public ModelAPI_AttributeValidator
152 /// \return True if the attribute is valid. It checks whether the selection
153 /// is acceptable for boolean operation.
154 /// \param[in] theAttribute an attribute to check.
155 /// \param[in] theArguments a filter parameters.
156 /// \param[out] theError error message.
157 virtual bool isValid(const AttributePtr& theAttribute,
158 const std::list<std::string>& theArguments,
159 Events_InfoMessage& theError) const;
162 /// \class FeaturesPlugin_ValidatorPartitionSelection
163 /// \ingroup Validators
164 /// \brief Validates selection for partition.
165 class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator
168 /// \return True if the attribute is valid. It checks whether the selection
169 /// is acceptable for operation.
170 /// \param[in] theAttribute an attribute to check.
171 /// \param[in] theArguments a filter parameters.
172 /// \param[out] theError error message.
173 virtual bool isValid(const AttributePtr& theAttribute,
174 const std::list<std::string>& theArguments,
175 Events_InfoMessage& theError) const;
178 /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection
179 /// \ingroup Validators
180 /// \brief Validates selection for "Remove Sub-Shapes" feature.
181 class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator
184 /// \return True if the attribute is valid. It checks whether the selection
185 /// is acceptable for operation.
186 /// \param[in] theAttribute an attribute to check.
187 /// \param[in] theArguments a filter parameters.
188 /// \param[out] theError error message.
189 virtual bool isValid(const AttributePtr& theAttribute,
190 const std::list<std::string>& theArguments,
191 Events_InfoMessage& theError) const;
194 /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult
195 /// \ingroup Validators
196 /// \brief Validator for the Remove Sub-Shapes feature.
197 class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator
200 //! \return true if result is valid shape.
201 //! \param theFeature the checked feature
202 //! \param theArguments arguments of the feature (not used)
203 //! \param theError error message
204 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
205 const std::list<std::string>& theArguments,
206 Events_InfoMessage& theError) const;
209 /// \class FeaturesPlugin_ValidatorUnionSelection
210 /// \ingroup Validators
211 /// \brief Validates selection for "Union" feature.
212 class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator
215 /// \return True if the attribute is valid. It checks whether the selection
216 /// is acceptable for operation.
217 /// \param[in] theAttribute an attribute to check.
218 /// \param[in] theArguments a filter parameters.
219 /// \param[out] theError error message.
220 virtual bool isValid(const AttributePtr& theAttribute,
221 const std::list<std::string>& theArguments,
222 Events_InfoMessage& theError) const;
225 /// \class FeaturesPlugin_ValidatorUnionArguments
226 /// \ingroup Validators
227 /// \brief Validator for the "Union" feature.
228 class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator
231 //! \return true if result is valid shape.
232 //! \param theFeature the checked feature
233 //! \param theArguments arguments of the feature (not used)
234 //! \param theError error message
235 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
236 const std::list<std::string>& theArguments,
237 Events_InfoMessage& theError) const;
240 /// \class FeaturesPlugin_ValidatorConcealedResult
241 /// \ingroup Validators
242 /// \brief Validator for the "Recover" feature.
243 class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator
246 //! \return True if the attribute is valid.
247 //! \param[in] theAttribute the checked attribute.
248 //! \param[in] theArguments arguments of the attribute.
249 //! \param[out] theError error message.
250 virtual bool isValid(const AttributePtr& theAttribute,
251 const std::list<std::string>& theArguments,
252 Events_InfoMessage& theError) const;