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>
20 //! \ingroup Validators
21 //! A class to validate a selection for Distance constraint operation
22 class PartSet_DistanceSelection : public ModuleBase_SelectionValidator
25 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
28 //! \ingroup Validators
29 //! A class to validate a selection for Length constraint operation
30 class PartSet_LengthSelection : public ModuleBase_SelectionValidator
33 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
36 //! \ingroup Validators
37 //! A class to validate a selection for Perpendicular constraint operation
38 class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator
41 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
44 //! \ingroup Validators
45 //! A class to validate a selection for Parallel constraint operation
46 class PartSet_ParallelSelection : public ModuleBase_SelectionValidator
49 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
52 //! \ingroup Validators
53 //! A class to validate a selection for Radius constraint operation
54 class PartSet_RadiusSelection : public ModuleBase_SelectionValidator
57 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
60 //! \ingroup Validators
61 //! A class to validate a selection for Rigid constraint operation
62 class PartSet_RigidSelection : public ModuleBase_SelectionValidator
65 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
69 //! \ingroup Validators
70 //! A class to validate a selection for coincedence constraint operation
71 class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator
74 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
77 //! \ingroup Validators
78 //! A class to validate a selection for Horizontal and Vertical constraints operation
79 class PartSet_HVDirSelection : public ModuleBase_SelectionValidator
82 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
85 //! \ingroup Validators
86 //! A class to validate a selection for Tangential constraints operation
87 class PartSet_TangentSelection : public ModuleBase_SelectionValidator
90 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
93 //! \ingroup Validators
94 //! A class to validate a selection for Fillet constraints operation
95 class PartSet_FilletSelection : public ModuleBase_SelectionValidator
98 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
101 //! \ingroup Validators
102 //! A class to validate a selection for Angle constraints operation
103 class PartSet_AngleSelection : public ModuleBase_SelectionValidator
106 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
109 ////////////// Attribute validators ////////////////
113 * \ingroup Validators
114 * A validator which checks that objects selected for feature attributes are different (not the same)
116 class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
118 //! Validator possible error types
126 //! Returns true if the attribute is good for the feature attribute
127 //! \param theAttribute an attribute
128 //! \param theArguments a list of arguments (names of attributes to check)
129 virtual bool isValid(const AttributePtr& theAttribute,
130 const std::list<std::string>& theArguments,
131 std::string& theError) const;
133 //! Returns error message for the error type
134 //! \param theType a type of error
135 //! \param thEqualObjectInfo an
136 std::string errorMessage(const PartSet_DifferentObjectsValidator::ErrorType& theType,
137 const std::string& thEqualObject, const std::string& theFirstAttribute,
138 const std::string& theSecondAttribute) const;
143 * \ingroup Validators
144 * A validator which checks that objects selected for feature attributes are different (not the same)
146 class PartSet_SketchEntityValidator : public ModelAPI_AttributeValidator
149 //! Returns true if the attribute is good for the feature attribute
150 //! \param theAttribute an attribute
151 //! \param theArguments a list of arguments (names of attributes to check)
152 virtual bool isValid(const AttributePtr& theAttribute,
153 const std::list<std::string>& theArguments,
154 std::string& theError) const;
157 /**\class PartSet_CoincidentAttr
158 * \ingroup Validators
159 * \brief Validator to check whether there is a coincident constraint between
160 * the attribute and attribute of argument.
162 class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator
165 //! returns true if attribute is valid
166 //! \param theAttribute the checked attribute
167 //! \param theArguments arguments of the attribute
168 virtual bool isValid(const AttributePtr& theAttribute,
169 const std::list<std::string>& theArguments,
170 std::string& theError) const;