1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef PartSet_Validators_H
22 #define PartSet_Validators_H
26 #include <ModuleBase_SelectionValidator.h>
27 #include <ModuleBase_ISelection.h>
28 #include <ModelAPI_AttributeValidator.h>
35 //! \ingroup Validators
36 //! A class to validate a selection for Distance constraint operation
37 class PartSet_DistanceSelection : public ModuleBase_SelectionValidator
40 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
41 ModuleBase_Operation* theOperation) const;
44 //! \ingroup Validators
45 //! A class to validate a selection for Length constraint operation
46 class PartSet_LengthSelection : public ModuleBase_SelectionValidator
49 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
50 ModuleBase_Operation* theOperation) const;
53 //! \ingroup Validators
54 //! A class to validate a selection for Perpendicular constraint operation
55 class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator
58 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
59 ModuleBase_Operation* theOperation) const;
62 //! \ingroup Validators
63 //! A class to validate a selection for Parallel constraint operation
64 class PartSet_ParallelSelection : public ModuleBase_SelectionValidator
67 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
68 ModuleBase_Operation* theOperation) const;
71 //! \ingroup Validators
72 //! A class to validate a selection for Radius constraint operation
73 class PartSet_RadiusSelection : public ModuleBase_SelectionValidator
76 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
77 ModuleBase_Operation* theOperation) const;
80 //! \ingroup Validators
81 //! A class to validate a selection for Rigid constraint operation
82 class PartSet_RigidSelection : public ModuleBase_SelectionValidator
85 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
86 ModuleBase_Operation* theOperation) const;
90 //! \ingroup Validators
91 //! A class to validate a selection for coincedence constraint operation
92 class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator
95 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
96 ModuleBase_Operation* theOperation) const;
99 //! \ingroup Validators
100 //! A class to validate a selection for Horizontal and Vertical constraints operation
101 class PartSet_HVDirSelection : public ModuleBase_SelectionValidator
104 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
105 ModuleBase_Operation* theOperation) const;
108 //! \ingroup Validators
109 //! A class to validate a selection for Tangential constraints operation
110 class PartSet_TangentSelection : public ModuleBase_SelectionValidator
113 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
114 ModuleBase_Operation* theOperation) const;
117 //! \ingroup Validators
118 //! A class to validate a selection for Fillet constraints operation
119 class PartSet_FilletSelection : public ModuleBase_SelectionValidator
122 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
123 ModuleBase_Operation* theOperation) const;
126 //! \ingroup Validators
127 //! A class to validate a selection for Angle constraints operation
128 class PartSet_AngleSelection : public ModuleBase_SelectionValidator
131 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
132 ModuleBase_Operation* theOperation) const;
135 //! \ingroup Validators
136 //! A class to validate a selection for Equal constraints operation
137 class PartSet_EqualSelection : public ModuleBase_SelectionValidator
140 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
141 ModuleBase_Operation* theOperation) const;
144 //! \ingroup Validators
145 //! A class to validate a selection for Collinear constraints operation
146 class PartSet_CollinearSelection : public ModuleBase_SelectionValidator
149 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
150 ModuleBase_Operation* theOperation) const;
153 //! \ingroup Validators
154 //! A class to validate a selection for Middle point constraints operation
155 class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator
158 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
159 ModuleBase_Operation* theOperation) const;
162 //! \ingroup Validators
163 //! A class to validate a selection for Middle point constraints operation
164 class PartSet_MultyTranslationSelection : public ModuleBase_SelectionValidator
167 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
168 ModuleBase_Operation* theOperation) const;
171 //! \ingroup Validators
172 //! A class to validate a selection for Middle point constraints operation
173 class PartSet_SplitSelection : public ModuleBase_SelectionValidator
176 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
177 ModuleBase_Operation* theOperation) const;
180 //! \ingroup Validators
181 //! A class to validate a selection for Middle point constraints operation
182 class PartSet_ProjectionSelection : public ModuleBase_SelectionValidator
185 PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
186 ModuleBase_Operation* theOperation) const;
189 ////////////// Attribute validators ////////////////
193 * \ingroup Validators
194 * A validator which checks that objects selected for feature attributes are different (not the same)
196 class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
198 //! Validator possible error types
206 //! Returns true if the attribute is good for the feature attribute
207 //! \param theAttribute an attribute
208 //! \param theArguments a list of arguments (names of attributes to check)
209 //! \param theError an output error string
210 virtual bool isValid(const AttributePtr& theAttribute,
211 const std::list<std::string>& theArguments,
212 Events_InfoMessage& theError) const;
214 //! Returns error message for the error type
215 //! \param theType a type of error
216 //! \param thEqualObjectInfo an
217 std::string errorMessage(const PartSet_DifferentObjectsValidator::ErrorType& theType,
218 const std::string& thEqualObject, const std::string& theFirstAttribute,
219 const std::string& theSecondAttribute) const;
223 /**\class PartSet_CoincidentAttr
224 * \ingroup Validators
225 * \brief Validator to check whether there is a coincident constraint between
226 * the attribute and attribute of argument.
228 class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator
231 //! returns true if attribute is valid
232 //! \param theAttribute the checked attribute
233 //! \param theArguments arguments of the attribute
234 //! \param theError an output error string
235 virtual bool isValid(const AttributePtr& theAttribute,
236 const std::list<std::string>& theArguments,
237 Events_InfoMessage& theError) const;