]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_Validators.h
Salome HOME
Multi-selection widget to be used in the extrusion feature.
[modules/shaper.git] / src / PartSet / 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_RefAttrValidator.h>
15 #include <ModelAPI_ResultValidator.h>
16
17 /*
18  * Selector validators
19  */
20
21 //! \ingroup Validators
22 //! A class to validate a selection for Distance constraint operation
23 class PartSet_DistanceValidator : public ModuleBase_SelectionValidator
24 {
25  public:
26   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
27 };
28
29 //! \ingroup Validators
30 //! A class to validate a selection for Length constraint operation
31 class PartSet_LengthValidator : public ModuleBase_SelectionValidator
32 {
33  public:
34   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
35 };
36
37 //! \ingroup Validators
38 //! A class to validate a selection for Perpendicular constraint operation
39 class PartSet_PerpendicularValidator : public ModuleBase_SelectionValidator
40 {
41  public:
42   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
43 };
44
45 //! \ingroup Validators
46 //! A class to validate a selection for Perpendicular constraint operation
47 class PartSet_ParallelValidator : public ModuleBase_SelectionValidator
48 {
49  public:
50   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
51 };
52
53 //! \ingroup Validators
54 //! A class to validate a selection for Perpendicular constraint operation
55 class PartSet_RadiusValidator : public ModuleBase_SelectionValidator
56 {
57  public:
58   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
59 };
60
61 //! \ingroup Validators
62 //! A class to validate a selection for Perpendicular constraint operation
63 class PartSet_RigidValidator : public ModuleBase_SelectionValidator
64 {
65  public:
66   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
67 };
68
69 /**
70 * \ingroup Validators
71 * A validator which checks that objects selected for feature attributes are different (not the same)
72 */
73 class PartSet_DifferentObjectsValidator : public ModelAPI_RefAttrValidator
74 {
75  public:
76   //! Returns true if the attribute is good for the feature attribute
77   //! \param theAttribute an attribute
78   //! \param theArguments a list of arguments (names of attributes to check)
79   virtual bool isValid(const AttributePtr& theAttribute,
80                        const std::list<std::string>& theArguments) const;
81
82 protected:
83   //! Casts the attribute to an attribute kind and obtains an object value if it is possible
84   //! \param theAttribute a source attribute to find object
85   //! \return an attribute object or NULL
86   ObjectPtr getObject(const AttributePtr& theAttribute) const;
87
88   //! Checks whethe other feature attributes has a reference to the given attribute
89   //! \param theAttribute a source attribute to find object
90   //! \return a boolean value
91   bool featureHasReferences(const AttributePtr& theAttribute) const;
92 };
93
94 /**
95 * \ingroup Validators
96 * A Validator which validates tha selected object is a Sketch
97 */
98 class PartSet_SketchValidator : public ModelAPI_ResultValidator
99 {
100  public:
101    /// Returns True if the given object is a sketch
102    /// \param theObject an object
103   virtual bool isValid(const ObjectPtr theObject) const;
104 };
105
106 #endif