1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_Validators.h
4 // Created: 09 July 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef PartSet_Validators_H
8 #define PartSet_Validators_H
12 #include <ModuleBase_SelectionValidator.h>
13 #include <ModuleBase_ISelection.h>
14 #include <ModelAPI_AttributeValidator.h>
21 //! \ingroup Validators
22 //! A class to validate a selection for Distance constraint operation
23 class PartSet_DistanceSelection : public ModuleBase_SelectionValidator
26 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
29 //! \ingroup Validators
30 //! A class to validate a selection for Length constraint operation
31 class PartSet_LengthSelection : public ModuleBase_SelectionValidator
34 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
37 //! \ingroup Validators
38 //! A class to validate a selection for Perpendicular constraint operation
39 class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator
42 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
45 //! \ingroup Validators
46 //! A class to validate a selection for Parallel constraint operation
47 class PartSet_ParallelSelection : public ModuleBase_SelectionValidator
50 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
53 //! \ingroup Validators
54 //! A class to validate a selection for Radius constraint operation
55 class PartSet_RadiusSelection : public ModuleBase_SelectionValidator
58 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
61 //! \ingroup Validators
62 //! A class to validate a selection for Rigid constraint operation
63 class PartSet_RigidSelection : public ModuleBase_SelectionValidator
66 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
70 //! \ingroup Validators
71 //! A class to validate a selection for coincedence constraint operation
72 class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator
75 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
78 //! \ingroup Validators
79 //! A class to validate a selection for Horizontal and Vertical constraints operation
80 class PartSet_HVDirSelection : public ModuleBase_SelectionValidator
83 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
86 //! \ingroup Validators
87 //! A class to validate a selection for Tangential constraints operation
88 class PartSet_TangentSelection : public ModuleBase_SelectionValidator
91 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
94 //! \ingroup Validators
95 //! A class to validate a selection for Fillet constraints operation
96 class PartSet_FilletSelection : public ModuleBase_SelectionValidator
99 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
102 //! \ingroup Validators
103 //! A class to validate a selection for Angle constraints operation
104 class PartSet_AngleSelection : public ModuleBase_SelectionValidator
107 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
110 //! \ingroup Validators
111 //! A class to validate a selection for Equal constraints operation
112 class PartSet_EqualSelection : public ModuleBase_SelectionValidator
115 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
118 ////////////// Attribute validators ////////////////
122 * \ingroup Validators
123 * A validator which checks that objects selected for feature attributes are different (not the same)
125 class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
127 //! Validator possible error types
135 //! Returns true if the attribute is good for the feature attribute
136 //! \param theAttribute an attribute
137 //! \param theArguments a list of arguments (names of attributes to check)
138 //! \param theError an output error string
139 virtual bool isValid(const AttributePtr& theAttribute,
140 const std::list<std::string>& theArguments,
141 std::string& theError) const;
143 //! Returns error message for the error type
144 //! \param theType a type of error
145 //! \param thEqualObjectInfo an
146 std::string errorMessage(const PartSet_DifferentObjectsValidator::ErrorType& theType,
147 const std::string& thEqualObject, const std::string& theFirstAttribute,
148 const std::string& theSecondAttribute) const;
153 * \ingroup Validators
154 * A validator which checks that objects selected for feature attributes are different (not the same)
156 class PartSet_SketchEntityValidator : public ModelAPI_AttributeValidator
159 //! Returns true if the attribute is good for the feature attribute
160 //! \param theAttribute an attribute
161 //! \param theArguments a list of arguments (names of attributes to check)
162 //! \param theError an output error string
163 virtual bool isValid(const AttributePtr& theAttribute,
164 const std::list<std::string>& theArguments,
165 std::string& theError) const;
168 /**\class PartSet_CoincidentAttr
169 * \ingroup Validators
170 * \brief Validator to check whether there is a coincident constraint between
171 * the attribute and attribute of argument.
173 class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator
176 //! returns true if attribute is valid
177 //! \param theAttribute the checked attribute
178 //! \param theArguments arguments of the attribute
179 //! \param theError an output error string
180 virtual bool isValid(const AttributePtr& theAttribute,
181 const std::list<std::string>& theArguments,
182 std::string& theError) const;