X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Validators.h;h=66006583f85656277ed0d334283aa539eba35fbd;hb=658fccce59f75b0cfa7c3f3d45f1ffb295ed24be;hp=2e0978b910ac0baea874ac7f85335901626b8f4b;hpb=87b74a6fd4660ebfa71a40f0be84e44535f84798;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index 2e0978b91..66006583f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -10,10 +10,10 @@ #include #include -/// \class FeaturesPlugin_PipeLocationsValidator +/// \class FeaturesPlugin_ValidatorPipeLocations /// \ingroup Validators /// \brief Validator for the pipe locations. -class FeaturesPlugin_PipeLocationsValidator : public ModelAPI_FeatureValidator +class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator { public: //! \return true if number of selected locations the same as number of selected bases, or empty. @@ -32,7 +32,7 @@ class FeaturesPlugin_PipeLocationsValidator : public ModelAPI_FeatureValidator /// \ingroup Validators /// \brief A validator for selection base for generation. Allows to select faces on sketch, /// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face. -class FeaturesPlugin_ValidatorBaseForGeneration : public ModelAPI_AttributeValidator +class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator { public: //! Returns true if attribute has selection type listed in the parameter arguments. @@ -45,6 +45,62 @@ public: private: bool isValidAttribute(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorCompositeLauncher +/// \ingroup Validators +/// \brief A validator for selection at composite feature start +class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator +{ +public: + //! Returns true if attribute has selection type listed in the parameter arguments. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorCanBeEmpty +/// \ingroup Validators +/// \brief A validator for extrusion direction attribute and bounding planes for extrusion and +/// revolution. Allows them to be empty if base objects are planar and do not contain +/// vertices and edges. +class FeaturesPlugin_ValidatorCanBeEmpty: public ModelAPI_FeatureValidator +{ +public: + //! Returns true if attribute listed in the parameter arguments are planar. + //! \param[in] theFeature the checked feature. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + std::string& theError) const; + + /// Returns true if the attribute in feature is not obligatory for the feature execution + virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); + +private: + bool isShapesCanBeEmpty(const AttributePtr& theAttribute, + std::string& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorBaseForWire +/// \ingroup Validators +/// \brief A validator for selection base shapes for wire. Allows to select edges on sketch and +/// wires objects that are connected to already selected shapes. +class FeaturesPlugin_ValidatorBaseForWire: public ModelAPI_AttributeValidator +{ +public: + //! Returns true if attribute is ok. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, std::string& theError) const; };