Salome HOME
389cc4fa20def49b2048b0aa4707063d680465a1
[modules/shaper.git] / 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_DistanceValidator : public ModuleBase_SelectionValidator
23 {
24  public:
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_LengthValidator : public ModuleBase_SelectionValidator
31 {
32  public:
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_PerpendicularValidator : public ModuleBase_SelectionValidator
39 {
40  public:
41   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
42 };
43
44 //! \ingroup Validators
45 //! A class to validate a selection for Perpendicular constraint operation
46 class PartSet_ParallelValidator : public ModuleBase_SelectionValidator
47 {
48  public:
49   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
50 };
51
52 //! \ingroup Validators
53 //! A class to validate a selection for Perpendicular constraint operation
54 class PartSet_RadiusValidator : public ModuleBase_SelectionValidator
55 {
56  public:
57   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
58 };
59
60 //! \ingroup Validators
61 //! A class to validate a selection for Perpendicular constraint operation
62 class PartSet_RigidValidator : public ModuleBase_SelectionValidator
63 {
64  public:
65   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
66 };
67
68 /**
69 * \ingroup Validators
70 * A validator which checks that objects selected for feature attributes are different (not the same)
71 */
72 class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
73 {
74  public:
75   //! Returns true if the attribute is good for the feature attribute
76   //! \param theAttribute an attribute
77   //! \param theArguments a list of arguments (names of attributes to check)
78   virtual bool isValid(const AttributePtr& theAttribute,
79                        const std::list<std::string>& theArguments) const;
80
81 protected:
82   //! Casts the attribute to an attribute kind and obtains an object value if it is possible
83   //! \param theAttribute a source attribute to find object
84   //! \return an attribute object or NULL
85   ObjectPtr getObject(const AttributePtr& theAttribute) const;
86
87   //! Checks whethe other feature attributes has a reference to the given attribute
88   //! \param theAttribute a source attribute to find object
89   //! \return a boolean value
90   bool featureHasReferences(const AttributePtr& theAttribute) const;
91 };
92
93 /**
94 * \ingroup Validators
95 * A validator which checks that objects selected for feature attributes are different (not the same)
96 */
97 class PartSet_SketchEntityValidator : public ModelAPI_AttributeValidator
98 {
99  public:
100   //! Returns true if the attribute is good for the feature attribute
101   //! \param theAttribute an attribute
102   //! \param theArguments a list of arguments (names of attributes to check)
103   virtual bool isValid(const AttributePtr& theAttribute,
104                        const std::list<std::string>& theArguments) const;
105 };
106
107 #endif