Salome HOME
Documentation update
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->\r
2 \r
3 // File:        FeaturesPlugin_Validators.h\r
4 // Created:     22 March 2016\r
5 // Author:      Dmitry Bobylev\r
6 \r
7 #ifndef FeaturesPlugin_Validators_H_\r
8 #define FeaturesPlugin_Validators_H_\r
9 \r
10 #include <ModelAPI_AttributeValidator.h>\r
11 #include <ModelAPI_FeatureValidator.h>\r
12 \r
13 /// \class FeaturesPlugin_ValidatorPipePath\r
14 /// \ingroup Validators\r
15 /// \brief A validator for selection pipe path.\r
16 class FeaturesPlugin_ValidatorPipePath: public ModelAPI_AttributeValidator\r
17 {\r
18 public:\r
19   //! \return True if the attribute is valid.\r
20   //! \param[in] theAttribute the checked attribute.\r
21   //! \param[in] theArguments arguments of the attribute.\r
22   //! \param[out] theError error message.\r
23    virtual bool isValid(const AttributePtr& theAttribute,\r
24                         const std::list<std::string>& theArguments,\r
25                         Events_InfoMessage& theError) const;\r
26 };\r
27 \r
28 /// \class FeaturesPlugin_ValidatorPipeLocations\r
29 /// \ingroup Validators\r
30 /// \brief Validator for the pipe locations.\r
31 class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator\r
32 {\r
33  public:\r
34   //! \return true if number of selected locations the same as number of selected bases, or empty.\r
35   //! \param theFeature the checked feature\r
36   //! \param theArguments arguments of the feature (not used)\r
37   //! \param theError error message\r
38   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
39                        const std::list<std::string>& theArguments,\r
40                        Events_InfoMessage& theError) const;\r
41 \r
42   /// Returns true if the attribute in feature is not obligatory for the feature execution\r
43   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
44 };\r
45 \r
46 /// \class FeaturesPlugin_ValidatorBaseForGeneration\r
47 /// \ingroup Validators\r
48 /// \brief A validator for selection base for generation. Allows to select faces on sketch,\r
49 /// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.\r
50 class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator\r
51 {\r
52 public:\r
53   //! \return true if attribute has selection type listed in the parameter arguments.\r
54   //! \param[in] theAttribute the checked attribute.\r
55   //! \param[in] theArguments arguments of the attribute.\r
56   //! \param[out] theError error message.\r
57    virtual bool isValid(const AttributePtr& theAttribute,\r
58                         const std::list<std::string>& theArguments,\r
59                         Events_InfoMessage& theError) const;\r
60 \r
61 private:\r
62   bool isValidAttribute(const AttributePtr& theAttribute,\r
63                         const std::list<std::string>& theArguments,\r
64                         Events_InfoMessage& theError) const;\r
65 };\r
66 \r
67 /// \class FeaturesPlugin_ValidatorCompositeLauncher\r
68 /// \ingroup Validators\r
69 /// \brief A validator for selection at composite feature start\r
70 class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator\r
71 {\r
72 public:\r
73   //! \return true if attribute has selection type listed in the parameter arguments.\r
74   //! \param[in] theAttribute the checked attribute.\r
75   //! \param[in] theArguments arguments of the attribute.\r
76   //! \param[out] theError error message.\r
77    virtual bool isValid(const AttributePtr& theAttribute,\r
78                         const std::list<std::string>& theArguments,\r
79                         Events_InfoMessage& theError) const;\r
80 };\r
81 \r
82 /// \class FeaturesPlugin_ValidatorExtrusionDir\r
83 /// \ingroup Validators\r
84 /// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are\r
85 ///        planar and do not contain vertices and edges.\r
86 class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator\r
87 {\r
88 public:\r
89   //! \return true if attribute listed in the parameter arguments are planar.\r
90   //! \param[in] theFeature the checked feature.\r
91   //! \param[in] theArguments arguments of the attribute.\r
92   //! \param[out] theError error message.\r
93   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
94                        const std::list<std::string>& theArguments,\r
95                        Events_InfoMessage& theError) const;\r
96 \r
97   /// \return true if the attribute in feature is not obligatory for the feature execution\r
98   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
99 \r
100 private:\r
101   bool isShapesCanBeEmpty(const AttributePtr& theAttribute,\r
102                           Events_InfoMessage& theError) const;\r
103 };\r
104 \r
105 /// \class FeaturesPlugin_ValidatorBooleanSelection\r
106 /// \ingroup Validators\r
107 /// \brief Validates selection for boolean operation.\r
108 class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator\r
109 {\r
110 public:\r
111   /// \return True if the attribute is valid. It checks whether the selection\r
112   /// is acceptable for boolean operation.\r
113   /// \param[in] theAttribute an attribute to check.\r
114   /// \param[in] theArguments a filter parameters.\r
115   /// \param[out] theError error message.\r
116   virtual bool isValid(const AttributePtr& theAttribute,\r
117                        const std::list<std::string>& theArguments,\r
118                        Events_InfoMessage& theError) const;\r
119 };\r
120 \r
121 /// \class FeaturesPlugin_ValidatorPartitionSelection\r
122 /// \ingroup Validators\r
123 /// \brief Validates selection for partition.\r
124 class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator\r
125 {\r
126 public:\r
127   /// \return True if the attribute is valid. It checks whether the selection\r
128   /// is acceptable for operation.\r
129   /// \param[in] theAttribute an attribute to check.\r
130   /// \param[in] theArguments a filter parameters.\r
131   /// \param[out] theError error message.\r
132   virtual bool isValid(const AttributePtr& theAttribute,\r
133                        const std::list<std::string>& theArguments,\r
134                        Events_InfoMessage& theError) const;\r
135 };\r
136 \r
137 /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection\r
138 /// \ingroup Validators\r
139 /// \brief Validates selection for "Remove Sub-Shapes" feature.\r
140 class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator\r
141 {\r
142 public:\r
143   /// \return True if the attribute is valid. It checks whether the selection\r
144   /// is acceptable for operation.\r
145   /// \param[in] theAttribute an attribute to check.\r
146   /// \param[in] theArguments a filter parameters.\r
147   /// \param[out] theError error message.\r
148   virtual bool isValid(const AttributePtr& theAttribute,\r
149                        const std::list<std::string>& theArguments,\r
150                        Events_InfoMessage& theError) const;\r
151 };\r
152 \r
153 /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult\r
154 /// \ingroup Validators\r
155 /// \brief Validator for the Remove Sub-Shapes feature.\r
156 class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator\r
157 {\r
158  public:\r
159   //! \return true if result is valid shape.\r
160   //! \param theFeature the checked feature\r
161   //! \param theArguments arguments of the feature (not used)\r
162   //! \param theError error message\r
163   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
164                        const std::list<std::string>& theArguments,\r
165                        Events_InfoMessage& theError) const;\r
166 \r
167   /// \return true if the attribute in feature is not obligatory for the feature execution\r
168   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
169 };\r
170 \r
171 /// \class FeaturesPlugin_ValidatorUnionSelection\r
172 /// \ingroup Validators\r
173 /// \brief Validates selection for "Union" feature.\r
174 class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator\r
175 {\r
176 public:\r
177   /// \return True if the attribute is valid. It checks whether the selection\r
178   /// is acceptable for operation.\r
179   /// \param[in] theAttribute an attribute to check.\r
180   /// \param[in] theArguments a filter parameters.\r
181   /// \param[out] theError error message.\r
182   virtual bool isValid(const AttributePtr& theAttribute,\r
183                        const std::list<std::string>& theArguments,\r
184                        Events_InfoMessage& theError) const;\r
185 };\r
186 \r
187 /// \class FeaturesPlugin_ValidatorUnionArguments\r
188 /// \ingroup Validators\r
189 /// \brief Validator for the "Union" feature.\r
190 class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator\r
191 {\r
192  public:\r
193   //! \return true if result is valid shape.\r
194   //! \param theFeature the checked feature\r
195   //! \param theArguments arguments of the feature (not used)\r
196   //! \param theError error message\r
197   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
198                        const std::list<std::string>& theArguments,\r
199                        Events_InfoMessage& theError) const;\r
200 \r
201   /// \return true if the attribute in feature is not obligatory for the feature execution\r
202   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
203 };\r
204 \r
205 /// \class FeaturesPlugin_ValidatorConcealedResult\r
206 /// \ingroup Validators\r
207 /// \brief Validator for the "Recover" feature.\r
208 class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator\r
209 {\r
210  public:\r
211   //! \return True if the attribute is valid.\r
212   //! \param[in] theAttribute the checked attribute.\r
213   //! \param[in] theArguments arguments of the attribute.\r
214   //! \param[out] theError error message.\r
215    virtual bool isValid(const AttributePtr& theAttribute,\r
216                         const std::list<std::string>& theArguments,\r
217                         Events_InfoMessage& theError) const;\r
218 };\r
219 \r
220 #endif\r