Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Validators.h
index 64262768a6716a185eec640772face543b0cec0b..d01605463efc0bd9577bc6c719b7660513927863 100644 (file)
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->\r
-\r
-// File:        FeaturesPlugin_Validators.h\r
-// Created:     22 March 2016\r
-// Author:      Dmitry Bobylev\r
-\r
-#ifndef FeaturesPlugin_Validators_H_\r
-#define FeaturesPlugin_Validators_H_\r
-\r
-#include <ModelAPI_AttributeValidator.h>\r
-#include <ModelAPI_FeatureValidator.h>\r
-\r
-/// \class FeaturesPlugin_ValidatorPipePath\r
-/// \ingroup Validators\r
-/// \brief A validator for selection pipe path.\r
-class FeaturesPlugin_ValidatorPipePath: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  //! \return True if the attribute is valid.\r
-  //! \param[in] theAttribute the checked attribute.\r
-  //! \param[in] theArguments arguments of the attribute.\r
-  //! \param[out] theError error message.\r
-   virtual bool isValid(const AttributePtr& theAttribute,\r
-                        const std::list<std::string>& theArguments,\r
-                        Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorPipeLocations\r
-/// \ingroup Validators\r
-/// \brief Validator for the pipe locations.\r
-class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator\r
-{\r
- public:\r
-  //! \return true if number of selected locations the same as number of selected bases, or empty.\r
-  //! \param theFeature the checked feature\r
-  //! \param theArguments arguments of the feature (not used)\r
-  //! \param theError error message\r
-  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-\r
-  /// Returns true if the attribute in feature is not obligatory for the feature execution\r
-  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorBaseForGeneration\r
-/// \ingroup Validators\r
-/// \brief A validator for selection base for generation. Allows to select faces on sketch,\r
-/// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face.\r
-class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  //! \return true if attribute has selection type listed in the parameter arguments.\r
-  //! \param[in] theAttribute the checked attribute.\r
-  //! \param[in] theArguments arguments of the attribute.\r
-  //! \param[out] theError error message.\r
-   virtual bool isValid(const AttributePtr& theAttribute,\r
-                        const std::list<std::string>& theArguments,\r
-                        Events_InfoMessage& theError) const;\r
-\r
-private:\r
-  bool isValidAttribute(const AttributePtr& theAttribute,\r
-                        const std::list<std::string>& theArguments,\r
-                        Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorCompositeLauncher\r
-/// \ingroup Validators\r
-/// \brief A validator for selection at composite feature start\r
-class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  //! \return true if attribute has selection type listed in the parameter arguments.\r
-  //! \param[in] theAttribute the checked attribute.\r
-  //! \param[in] theArguments arguments of the attribute.\r
-  //! \param[out] theError error message.\r
-   virtual bool isValid(const AttributePtr& theAttribute,\r
-                        const std::list<std::string>& theArguments,\r
-                        Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorExtrusionDir\r
-/// \ingroup Validators\r
-/// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are\r
-///        planar and do not contain vertices and edges.\r
-class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator\r
-{\r
-public:\r
-  //! \return true if attribute listed in the parameter arguments are planar.\r
-  //! \param[in] theFeature the checked feature.\r
-  //! \param[in] theArguments arguments of the attribute.\r
-  //! \param[out] theError error message.\r
-  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-\r
-  /// \return true if the attribute in feature is not obligatory for the feature execution\r
-  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
-\r
-private:\r
-  bool isShapesCanBeEmpty(const AttributePtr& theAttribute,\r
-                          Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorBooleanSelection\r
-/// \ingroup Validators\r
-/// \brief Validates selection for boolean operation.\r
-class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  /// \return True if the attribute is valid. It checks whether the selection\r
-  /// is acceptable for boolean operation.\r
-  /// \param[in] theAttribute an attribute to check.\r
-  /// \param[in] theArguments a filter parameters.\r
-  /// \param[out] theError error message.\r
-  virtual bool isValid(const AttributePtr& theAttribute,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorPartitionSelection\r
-/// \ingroup Validators\r
-/// \brief Validates selection for partition.\r
-class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  /// \return True if the attribute is valid. It checks whether the selection\r
-  /// is acceptable for operation.\r
-  /// \param[in] theAttribute an attribute to check.\r
-  /// \param[in] theArguments a filter parameters.\r
-  /// \param[out] theError error message.\r
-  virtual bool isValid(const AttributePtr& theAttribute,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection\r
-/// \ingroup Validators\r
-/// \brief Validates selection for "Remove Sub-Shapes" feature.\r
-class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  /// \return True if the attribute is valid. It checks whether the selection\r
-  /// is acceptable for operation.\r
-  /// \param[in] theAttribute an attribute to check.\r
-  /// \param[in] theArguments a filter parameters.\r
-  /// \param[out] theError error message.\r
-  virtual bool isValid(const AttributePtr& theAttribute,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorRemoveSubShapesResult\r
-/// \ingroup Validators\r
-/// \brief Validator for the Remove Sub-Shapes feature.\r
-class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator\r
-{\r
- public:\r
-  //! \return true if result is valid shape.\r
-  //! \param theFeature the checked feature\r
-  //! \param theArguments arguments of the feature (not used)\r
-  //! \param theError error message\r
-  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-\r
-  /// \return true if the attribute in feature is not obligatory for the feature execution\r
-  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorUnionSelection\r
-/// \ingroup Validators\r
-/// \brief Validates selection for "Union" feature.\r
-class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator\r
-{\r
-public:\r
-  /// \return True if the attribute is valid. It checks whether the selection\r
-  /// is acceptable for operation.\r
-  /// \param[in] theAttribute an attribute to check.\r
-  /// \param[in] theArguments a filter parameters.\r
-  /// \param[out] theError error message.\r
-  virtual bool isValid(const AttributePtr& theAttribute,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorUnionArguments\r
-/// \ingroup Validators\r
-/// \brief Validator for the "Union" feature.\r
-class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator\r
-{\r
- public:\r
-  //! \return true if result is valid shape.\r
-  //! \param theFeature the checked feature\r
-  //! \param theArguments arguments of the feature (not used)\r
-  //! \param theError error message\r
-  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,\r
-                       const std::list<std::string>& theArguments,\r
-                       Events_InfoMessage& theError) const;\r
-\r
-  /// \return true if the attribute in feature is not obligatory for the feature execution\r
-  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);\r
-};\r
-\r
-/// \class FeaturesPlugin_ValidatorUnionArguments\r
-/// \ingroup Validators\r
-/// \brief Validator for the "Union" feature.\r
-class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator\r
-{\r
- public:\r
-  //! \return True if the attribute is valid.\r
-  //! \param[in] theAttribute the checked attribute.\r
-  //! \param[in] theArguments arguments of the attribute.\r
-  //! \param[out] theError error message.\r
-   virtual bool isValid(const AttributePtr& theAttribute,\r
-                        const std::list<std::string>& theArguments,\r
-                        Events_InfoMessage& theError) const;\r
-};\r
-\r
-#endif\r
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        FeaturesPlugin_Validators.h
+// Created:     22 March 2016
+// Author:      Dmitry Bobylev
+
+#ifndef FeaturesPlugin_Validators_H_
+#define FeaturesPlugin_Validators_H_
+
+#include <ModelAPI_AttributeValidator.h>
+#include <ModelAPI_FeatureValidator.h>
+
+/// \class FeaturesPlugin_ValidatorPipePath
+/// \ingroup Validators
+/// \brief A validator for selection pipe path.
+class FeaturesPlugin_ValidatorPipePath: public ModelAPI_AttributeValidator
+{
+public:
+  //! \return True if the attribute is valid.
+  //! \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<std::string>& theArguments,
+                        Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorPipeLocations
+/// \ingroup Validators
+/// \brief Validator for the pipe locations.
+class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator
+{
+ public:
+  //! \return true if number of selected locations the same as number of selected bases, or empty.
+  //! \param theFeature the checked feature
+  //! \param theArguments arguments of the feature (not used)
+  //! \param theError error message
+  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& 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);
+};
+
+/// \class FeaturesPlugin_ValidatorBaseForGeneration
+/// \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
+{
+public:
+  //! \return 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<std::string>& theArguments,
+                        Events_InfoMessage& theError) const;
+
+private:
+  bool isValidAttribute(const AttributePtr& theAttribute,
+                        const std::list<std::string>& theArguments,
+                        Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorCompositeLauncher
+/// \ingroup Validators
+/// \brief A validator for selection at composite feature start
+class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator
+{
+public:
+  //! \return 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<std::string>& theArguments,
+                        Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorExtrusionDir
+/// \ingroup Validators
+/// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are
+///        planar and do not contain vertices and edges.
+class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator
+{
+public:
+  //! \return 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<ModelAPI_Feature>& theFeature,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+
+  /// \return 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,
+                          Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorBooleanSelection
+/// \ingroup Validators
+/// \brief Validates selection for boolean operation.
+class FeaturesPlugin_ValidatorBooleanSelection: public ModelAPI_AttributeValidator
+{
+public:
+  /// \return True if the attribute is valid. It checks whether the selection
+  /// is acceptable for boolean operation.
+  /// \param[in] theAttribute an attribute to check.
+  /// \param[in] theArguments a filter parameters.
+  /// \param[out] theError error message.
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorPartitionSelection
+/// \ingroup Validators
+/// \brief Validates selection for partition.
+class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator
+{
+public:
+  /// \return True if the attribute is valid. It checks whether the selection
+  /// is acceptable for operation.
+  /// \param[in] theAttribute an attribute to check.
+  /// \param[in] theArguments a filter parameters.
+  /// \param[out] theError error message.
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection
+/// \ingroup Validators
+/// \brief Validates selection for "Remove Sub-Shapes" feature.
+class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator
+{
+public:
+  /// \return True if the attribute is valid. It checks whether the selection
+  /// is acceptable for operation.
+  /// \param[in] theAttribute an attribute to check.
+  /// \param[in] theArguments a filter parameters.
+  /// \param[out] theError error message.
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorRemoveSubShapesResult
+/// \ingroup Validators
+/// \brief Validator for the Remove Sub-Shapes feature.
+class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator
+{
+ public:
+  //! \return true if result is valid shape.
+  //! \param theFeature the checked feature
+  //! \param theArguments arguments of the feature (not used)
+  //! \param theError error message
+  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+
+  /// \return true if the attribute in feature is not obligatory for the feature execution
+  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
+};
+
+/// \class FeaturesPlugin_ValidatorUnionSelection
+/// \ingroup Validators
+/// \brief Validates selection for "Union" feature.
+class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator
+{
+public:
+  /// \return True if the attribute is valid. It checks whether the selection
+  /// is acceptable for operation.
+  /// \param[in] theAttribute an attribute to check.
+  /// \param[in] theArguments a filter parameters.
+  /// \param[out] theError error message.
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
+/// \class FeaturesPlugin_ValidatorUnionArguments
+/// \ingroup Validators
+/// \brief Validator for the "Union" feature.
+class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator
+{
+ public:
+  //! \return true if result is valid shape.
+  //! \param theFeature the checked feature
+  //! \param theArguments arguments of the feature (not used)
+  //! \param theError error message
+  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+
+  /// \return true if the attribute in feature is not obligatory for the feature execution
+  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
+};
+
+/// \class FeaturesPlugin_ValidatorConcealedResult
+/// \ingroup Validators
+/// \brief Validator for the "Recover" feature.
+class FeaturesPlugin_ValidatorConcealedResult: public ModelAPI_AttributeValidator
+{
+ public:
+  //! \return True if the attribute is valid.
+  //! \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<std::string>& theArguments,
+                        Events_InfoMessage& theError) const;
+};
+
+#endif