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 //! \ingroup Validators
119 //! A class to validate a selection for Collinear constraints operation
120 class PartSet_CollinearSelection : public ModuleBase_SelectionValidator
123 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
126 //! \ingroup Validators
127 //! A class to validate a selection for Middle point constraints operation
128 class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator
131 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
134 ////////////// Attribute validators ////////////////
138 * \ingroup Validators
139 * A validator which checks that objects selected for feature attributes are different (not the same)
141 class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
143 //! Validator possible error types
151 //! Returns true if the attribute is good for the feature attribute
152 //! \param theAttribute an attribute
153 //! \param theArguments a list of arguments (names of attributes to check)
154 //! \param theError an output error string
155 virtual bool isValid(const AttributePtr& theAttribute,
156 const std::list<std::string>& theArguments,
157 std::string& theError) const;
159 //! Returns error message for the error type
160 //! \param theType a type of error
161 //! \param thEqualObjectInfo an
162 std::string errorMessage(const PartSet_DifferentObjectsValidator::ErrorType& theType,
163 const std::string& thEqualObject, const std::string& theFirstAttribute,
164 const std::string& theSecondAttribute) 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;