]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_Validators.h
Salome HOME
Implementation of the Angle constraint (issue #788)
[modules/shaper.git] / src / PartSet / PartSet_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_Validators.h
4 // Created:     09 July 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef PartSet_Validators_H
8 #define PartSet_Validators_H
9
10 #include "PartSet.h"
11
12 #include <ModuleBase_SelectionValidator.h>
13 #include <ModuleBase_ISelection.h>
14 #include <ModelAPI_AttributeValidator.h>
15
16 /*
17  * Selector validators
18  */
19
20 //! \ingroup Validators
21 //! A class to validate a selection for Distance constraint operation
22 class PartSet_DistanceSelection : public ModuleBase_SelectionValidator
23 {
24  protected:
25   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
26 };
27
28 //! \ingroup Validators
29 //! A class to validate a selection for Length constraint operation
30 class PartSet_LengthSelection : public ModuleBase_SelectionValidator
31 {
32  protected:
33   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
34 };
35
36 //! \ingroup Validators
37 //! A class to validate a selection for Perpendicular constraint operation
38 class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator
39 {
40  protected:
41   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
42 };
43
44 //! \ingroup Validators
45 //! A class to validate a selection for Parallel constraint operation
46 class PartSet_ParallelSelection : public ModuleBase_SelectionValidator
47 {
48  protected:
49   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
50 };
51
52 //! \ingroup Validators
53 //! A class to validate a selection for Radius constraint operation
54 class PartSet_RadiusSelection : public ModuleBase_SelectionValidator
55 {
56  protected:
57   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
58 };
59
60 //! \ingroup Validators
61 //! A class to validate a selection for Rigid constraint operation
62 class PartSet_RigidSelection : public ModuleBase_SelectionValidator
63 {
64  protected:
65   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
66 };
67
68
69 //! \ingroup Validators
70 //! A class to validate a selection for coincedence constraint operation
71 class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator
72 {
73  protected:
74   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
75 };
76
77 //! \ingroup Validators
78 //! A class to validate a selection for Horizontal and Vertical constraints operation
79 class PartSet_HVDirSelection : public ModuleBase_SelectionValidator
80 {
81  protected:
82   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
83 };
84
85 //! \ingroup Validators
86 //! A class to validate a selection for Tangential constraints operation
87 class PartSet_TangentSelection : public ModuleBase_SelectionValidator
88 {
89  protected:
90   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
91 };
92
93 //! \ingroup Validators
94 //! A class to validate a selection for Fillet constraints operation
95 class PartSet_FilletSelection : public ModuleBase_SelectionValidator
96 {
97  protected:
98   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
99 };
100
101 //! \ingroup Validators
102 //! A class to validate a selection for Angle constraints operation
103 class PartSet_AngleSelection : public ModuleBase_SelectionValidator
104 {
105  protected:
106   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
107 };
108
109 ////////////// Attribute validators ////////////////
110
111
112 /**
113 * \ingroup Validators
114 * A validator which checks that objects selected for feature attributes are different (not the same)
115 */
116 class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
117 {
118  public:
119   //! Returns true if the attribute is good for the feature attribute
120   //! \param theAttribute an attribute
121   //! \param theArguments a list of arguments (names of attributes to check)
122   virtual bool isValid(const AttributePtr& theAttribute,
123                        const std::list<std::string>& theArguments,
124                        std::string& theError) const;
125
126 protected:
127   //! Checks whethe other feature attributes has a reference to the given attribute
128   //! \param theAttribute a source attribute to find object
129   //! \return a boolean value
130   bool featureHasReferences(const AttributePtr& theAttribute) const;
131 };
132
133 /**
134 * \ingroup Validators
135 * A validator which checks that objects selected for feature attributes are different (not the same)
136 */
137 class PartSet_SketchEntityValidator : public ModelAPI_AttributeValidator
138 {
139  public:
140   //! Returns true if the attribute is good for the feature attribute
141   //! \param theAttribute an attribute
142   //! \param theArguments a list of arguments (names of attributes to check)
143   virtual bool isValid(const AttributePtr& theAttribute,
144                        const std::list<std::string>& theArguments,
145                        std::string& theError) const;
146 };
147
148 /**\class PartSet_SameTypeAttrValidator
149  * \ingroup Validators
150  * \brief Validator for the tangent constraint input.
151  *
152  * It just checks that distance is greater than zero.
153  */
154 class PartSet_SameTypeAttrValidator : public ModelAPI_AttributeValidator
155 {
156  public:
157   //! returns true if attribute is valid
158   //! \param theAttribute the checked attribute
159   //! \param theArguments arguments of the attribute
160   virtual bool isValid(const AttributePtr& theAttribute,
161                        const std::list<std::string>& theArguments,
162                        std::string& theError) const;
163 };
164
165 /**\class PartSet_CoincidentAttr
166  * \ingroup Validators
167  * \brief Validator to check whether there is a coincident constraint between
168  * the attribute and attribute of argument.
169  */
170 class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator
171 {
172  public:
173   //! returns true if attribute is valid
174   //! \param theAttribute the checked attribute
175   //! \param theArguments arguments of the attribute
176   virtual bool isValid(const AttributePtr& theAttribute,
177                        const std::list<std::string>& theArguments,
178                        std::string& theError) const;
179 };
180
181
182 #endif