Salome HOME
Merge branch 'BR_PYTHON_PLUGIN' of newgeom:newgeom.git into Dev_0.6.1
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Validators.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        SketchPlugin_Validators.h
4 // Created:     01 Aug 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef SketchPlugin_Validators_H
8 #define SketchPlugin_Validators_H
9
10 #include "SketchPlugin.h"
11 #include <ModelAPI_RefAttrValidator.h>
12
13 class SketchPlugin_DistanceAttrValidator : public ModelAPI_RefAttrValidator
14 {
15  public:
16   //! returns true if attribute is valid
17   //! \param theAttribute the checked attribute
18   //! \param theArguments arguments of the attribute
19   virtual bool isValid(
20     const AttributePtr& theAttribute, const std::list<std::string>& theArguments) const;
21   //! Returns true if object is good for the feature attribute
22   virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
23                        const ObjectPtr& theObject) const;
24
25   //! Returns true if the attribute is good for the feature attribute
26   virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
27                        const AttributePtr& theAttribute) const { return true; };
28 };
29
30 /**
31  * Check that there is no same object was already selected in the feature.
32  * For an example: to avoid perpendicularity on line and the same line.
33  */
34 class SketchPlugin_DifferentObjectsValidator : public ModelAPI_RefAttrValidator
35 {
36  public:
37   //! returns true if attribute is valid
38   //! \param theAttribute the checked attribute
39   //! \param theArguments arguments of the attribute
40   virtual bool isValid(
41     const AttributePtr& theAttribute, const std::list<std::string>& theArguments) const;
42   //! Returns true if object is good for the feature attribute
43   virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
44                        const ObjectPtr& theObject) const;
45   //! Returns true if the attribute is good for the feature attribute
46   virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
47                        const AttributePtr& theAttribute) const;
48 };
49
50 #endif