]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchPlugin/SketchPlugin_Validators.h
Salome HOME
Issue #1889 Amélioration des contraintes H et V (Filter horizontal and vertical segme...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Validators.h
index aaae2d95783e2bade6ab4bc715b58b6ab4979e03..998d13d7d82d3bc089946631e519abf0dde18f42 100644 (file)
@@ -292,4 +292,145 @@ class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator
                        Events_InfoMessage& theError) const;
 };
 
+/**\class SketchPlugin_DifferentReferenceValidator
+ * \ingroup Validators
+ * \brief Validator for attributes of a sketch feature.
+ *
+ * It checks that at least one of specified attributes
+ * refers to another feature in respect to each other.
+ */
+class SketchPlugin_DifferentReferenceValidator : public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/**\class SketchPlugin_DifferentPointReferenceValidator
+ * \ingroup Validators
+ * \brief Validator for attributes of a sketch feature.
+ *
+ * It checks that at least two of specified attributes refer to different points.
+ */
+class SketchPlugin_DifferentPointReferenceValidator : public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/**\class SketchPlugin_CirclePassedPointValidator
+ * \ingroup Validators
+ * \brief Validator for passed point of MacroCircle feature.
+ *
+ * Checks that passed point does not refer to the feature, the center is coincident to.
+ */
+class SketchPlugin_CirclePassedPointValidator : public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>&,
+                       Events_InfoMessage& theError) const;
+};
+
+/**\class SketchPlugin_ThirdPointValidator
+ * \ingroup Validators
+ * \brief Validator for the third point of MacroCircle feature.
+ *
+ * Checks that third point does not lie on a line passed through the first two points.
+ * Checks that third point does not refer to feature lying between the first two points.
+ */
+class SketchPlugin_ThirdPointValidator : public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+
+private:
+  //! returns true if three points have not been placed on the same line
+  bool arePointsNotOnLine(const FeaturePtr& theMacroFeature,
+                          Events_InfoMessage& theError) const;
+
+  //! returns true if the first two points have not been separated
+  //! by a feature referred by thrid point
+  bool arePointsNotSeparated(const FeaturePtr& theMacroFeature,
+                             const std::list<std::string>& theArguments,
+                             Events_InfoMessage& theError) const;
+};
+
+/**\class SketchPlugin_ArcEndPointValidator
+ * \ingroup Validators
+ * \brief Validator for the end point of MacroArc feature.
+ *
+ * Checks that third point does not lie on a point.
+ */
+class SketchPlugin_ArcEndPointValidator: public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/**\class SketchPlugin_ArcEndPointIntersectionValidator
+ * \ingroup Validators
+ * \brief Validator for the end point of MacroArc feature.
+ *
+ * Checks that third point does lie on edge which intersects arc.
+ */
+class SketchPlugin_ArcEndPointIntersectionValidator: public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/**\class SketchPlugin_HasNoConstraint
+ * \ingroup Validators
+ * \brief Validator for checking whether the feature has constraint.
+ *
+ * Checks that feature of the attribute does not have constraint with some kinds.
+ * The kinds of constraints should be described in parameters of the validator
+ * Validator processes the ModelAPI_AttributeRefAttr attribute kind
+ */
+class SketchPlugin_HasNoConstraint: public ModelAPI_AttributeValidator
+{
+ public:
+  //! returns true if attribute is valid
+  //! \param theAttribute the checked attribute
+  //! \param theArguments arguments of the attribute
+  //! \param theError error message
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
 #endif