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