X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Validators.h;h=bfaffbeda13bbf6c246793c5e4524d5bb0bcefe1;hb=7a94b78e6086557361f027435686e8420627d459;hp=3dfd9398d231e6d490054359e59f4680ee1dd0c6;hpb=e5cad9459578b7fce01219d1d3eb4235e0bd9761;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index 3dfd9398d..bfaffbeda 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.h +++ b/src/SketchPlugin/SketchPlugin_Validators.h @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchPlugin_Validators.h -// Created: 01 Aug 2014 -// Author: Vitaly SMETANNIKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef SketchPlugin_Validators_H #define SketchPlugin_Validators_H @@ -311,6 +325,24 @@ class SketchPlugin_DifferentReferenceValidator : public ModelAPI_AttributeValida 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& theArguments, + Events_InfoMessage& theError) const; +}; + /**\class SketchPlugin_CirclePassedPointValidator * \ingroup Validators * \brief Validator for passed point of MacroCircle feature. @@ -344,18 +376,123 @@ class SketchPlugin_ThirdPointValidator : public ModelAPI_AttributeValidator //! \param theArguments arguments of the attribute //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list&, + const std::list& theArguments, Events_InfoMessage& theError) const; private: //! returns true if three points have not been placed on the same line - bool arePointsNotOnLine(const FeaturePtr& theMacroCircle, + 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& theMacroCircle, + bool arePointsNotSeparated(const FeaturePtr& theMacroFeature, + const std::list& 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& 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& 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& theArguments, + Events_InfoMessage& theError) const; +}; + +/**\class SketchPlugin_ReplicationReferenceValidator + * \ingroup Validators + * \brief Validator checking that the replications features (Mirror, + * Multi-Rotation, Mutli-Translation) do not refer to the shapes they produce. + */ +class SketchPlugin_ReplicationReferenceValidator: 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& theArguments, + Events_InfoMessage& theError) const; +}; + +/**\class SketchPlugin_SketchFeatureValidator + * \ingroup Validators + * \brief Validator for checking whether the feature referred by attribute is a sketch feature. + */ +class SketchPlugin_SketchFeatureValidator: 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& theArguments, + Events_InfoMessage& theError) const; +}; + +/**\class SketchPlugin_MultiRotationAngleValidator + * \ingroup Validators + * \brief Validator for checking whether the angle of MultiRotation is in range [0, 360]. + */ +class SketchPlugin_MultiRotationAngleValidator : public ModelAPI_AttributeValidator +{ + //! 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& theArguments, + Events_InfoMessage& theError) const; +}; + #endif