Salome HOME
updated copyright message
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Validators.h
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef BuildPlugin_Validators_H_
21 #define BuildPlugin_Validators_H_
22
23 #include <ModelAPI_AttributeValidator.h>
24 #include <ModelAPI_FeatureValidator.h>
25
26 /// \class BuildPlugin_ValidatorBaseForBuild
27 /// \ingroup Validators
28 /// \brief A validator for selection base shapes for build features.
29 /// Allows to select shapes on sketch and
30 /// whole objects with allowed type.
31 class BuildPlugin_ValidatorBaseForBuild: public ModelAPI_AttributeValidator
32 {
33 public:
34   //! Returns true if attribute is ok.
35   //! \param[in] theAttribute the checked attribute.
36   //! \param[in] theArguments arguments of the attribute.
37   //! \param[out] theError error message.
38    virtual bool isValid(const AttributePtr& theAttribute,
39                         const std::list<std::string>& theArguments,
40                         Events_InfoMessage& theError) const;
41 };
42
43 /// \class BuildPlugin_ValidatorBaseForWire
44 /// \ingroup Validators
45 /// \brief A validator for selection base shapes for wire. Allows to select edges on sketch and
46 /// wires objects that are connected to already selected shapes.
47 class BuildPlugin_ValidatorBaseForWire: public ModelAPI_FeatureValidator
48 {
49 public:
50   //! Returns true if attributes is ok.
51   //! \param theFeature the checked feature.
52   //! \param theArguments arguments of the feature.
53   //! \param theError error message.
54   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55                        const std::list<std::string>& theArguments,
56                        Events_InfoMessage& theError) const;
57 };
58
59 /// \class BuildPlugin_ValidatorBaseForFace
60 /// \ingroup Validators
61 /// \brief A validator for selection base shapes for face. Allows to select sketch edges, edges and
62 /// wires objects that lie in the same plane and don't have intersections.
63 class BuildPlugin_ValidatorBaseForFace: public ModelAPI_FeatureValidator
64 {
65 public:
66   //! Returns true if attributes is ok.
67   //! \param theFeature the checked feature.
68   //! \param theArguments arguments of the feature.
69   //! \param theError error message.
70   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
71                        const std::list<std::string>& theArguments,
72                        Events_InfoMessage& theError) const;
73 };
74
75 /// \class BuildPlugin_ValidatorBaseForSolids
76 /// \ingroup Validators
77 /// \brief A validator for selection base shapes for solid. Allows to select faces closed enough
78 /// to create a solid.
79 class BuildPlugin_ValidatorBaseForSolids: public ModelAPI_FeatureValidator
80 {
81 public:
82   //! Returns true if attributes is ok.
83   //! \param theFeature the checked feature.
84   //! \param theArguments arguments of the feature.
85   //! \param theError error message.
86   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
87                        const std::list<std::string>& theArguments,
88                        Events_InfoMessage& theError) const;
89 };
90
91 /// \class BuildPlugin_ValidatorSubShapesSelection
92 /// \ingroup Validators
93 /// \brief A validator for selection sub-shapes for SubShape feature.
94 class BuildPlugin_ValidatorSubShapesSelection: public ModelAPI_AttributeValidator
95 {
96 public:
97   //! Returns true if attribute is ok.
98   //! \param[in] theAttribute the checked attribute.
99   //! \param[in] theArguments arguments of the attribute.
100   //! \param[out] theError error message.
101    virtual bool isValid(const AttributePtr& theAttribute,
102                         const std::list<std::string>& theArguments,
103                         Events_InfoMessage& theError) const;
104 };
105
106 /// \class BuildPlugin_ValidatorFillingSelection
107 /// \ingroup Validators
108 /// \brief A validator for selection of Filling feature.
109 class BuildPlugin_ValidatorFillingSelection: public ModelAPI_AttributeValidator
110 {
111 public:
112   //! Returns true if attribute is ok.
113   //! \param[in] theAttribute the checked attribute.
114   //! \param[in] theArguments arguments of the attribute.
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;
119 };
120
121 /// \class BuildPlugin_ValidatorBaseForVertex
122 /// \ingroup Validators
123 /// \brief A validator for selection of Vertex feature.
124 class BuildPlugin_ValidatorBaseForVertex: public ModelAPI_AttributeValidator
125 {
126 public:
127   //! Returns true if attribute is ok.
128   //! \param[in] theAttribute the checked attribute.
129   //! \param[in] theArguments arguments of the attribute.
130   //! \param[out] theError error message.
131    virtual bool isValid(const AttributePtr& theAttribute,
132                         const std::list<std::string>& theArguments,
133                         Events_InfoMessage& theError) const;
134 };
135
136  /// \class BuildPlugin_ValidatorExpression
137  /// \ingroup Validators
138  /// \brief Validator for the expression of parameter.
139 class BuildPlugin_ValidatorExpressionInterpolation: public ModelAPI_AttributeValidator
140 {
141 public:
142    //! Returns true if attribute has a valid parameter expression.
143    //! \param theAttribute the checked attribute
144    //! \param theArguments arguments of the attribute
145    //! \param theError the error string message if validation fails
146    virtual bool isValid(const AttributePtr& theAttribute,
147                         const std::list<std::string>& theArguments,
148                         Events_InfoMessage& theError) const;
149 };
150
151 #endif