X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_FilterFactory.h;h=c1a7e36014e37118b1cf74b38baef0bc41f1e624;hb=39aa2839a4269a2fc87cfe3b4487cce8f3df9a6f;hp=bf6986b80fe0e137b7644e95afd5c61410ac9d94;hpb=e5f10931cdf5fa76d067b02d6862337ce0eb9929;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_FilterFactory.h b/src/ModuleBase/ModuleBase_FilterFactory.h index bf6986b80..c1a7e3601 100644 --- a/src/ModuleBase/ModuleBase_FilterFactory.h +++ b/src/ModuleBase/ModuleBase_FilterFactory.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModuleBase_FilterFactory.h // Created: 10 Dec 2014 // Author: Natalia ERMOLAEVA @@ -7,85 +9,54 @@ #include "ModuleBase.h" #include "ModuleBase_IWorkshop.h" +#include "ModuleBase_Filter.h" + +#include #include #include -class ModuleBase_Filter; - /** + * \ingroup GUI * Allows to get a selection filter by the feature identifier and * the attribute identifier (if attribute is validated). * All accessible filters must be registered by the ID string first. * The instance of this factory can be get in the Workshop interface. - * Keeps the validator objects alive and just returns one of it by request. - * All the needed information is provided to the validator as an argument, + * Keeps the filter objects alive and just returns one of it by request. + * All the needed information is provided to the filter as an argument, * this allows to work with them independently from the feature specific object. */ class ModuleBase_FilterFactory : public QObject { - public: - - //ModuleBase_FilterFactory(); - //virtual ~ModuleBase_FilterFactory() {} - - private: - std::map myIDs; ///< map from ID to registered validator - /// validators IDs to list of arguments - typedef std::map > AttrValidators; - /// validators IDs by feature ID - std::map myFeatures; - /// validators IDs and arguments by feature and attribute IDs - std::map > myAttrs; - /// Stores the registered attributes that leads to the concealment of referenced objects in - /// data tree. Map from feature kind to set of attribute IDs. - std::map > myConcealed; + std::map myIDs; ///< map from ID to registered filter + /// filters IDs to list of arguments + typedef std::map > AttrFilters; + /// filters IDs by feature ID + std::map myFeatures; + /// filters IDs and arguments by feature and attribute IDs + std::map > myAttrs; public: - /// Registers the instance of the validator by the ID + /// Registers the instance of the filter by the ID MODULEBASE_EXPORT virtual void registerFilter(const std::string& theID, - ModuleBase_Filter* theValidator); + ModuleBase_Filter* theFilter); - /// Assigns validator to the attribute of the feature + /// Assigns filter to the attribute of the feature MODULEBASE_EXPORT virtual void assignFilter(const std::string& theID, - const std::string& theFeatureID, - const std::string& theAttrID); + const std::string& theFeatureID, + const std::string& theAttrID, + const std::list& theArguments); - /// Provides a validator for the feature, returns NULL if no validator - MODULEBASE_EXPORT virtual void validators(const std::string& theFeatureID, - std::list& theResult, - std::list >& theArguments) const; - /// Provides a validator for the attribute, returns NULL if no validator - MODULEBASE_EXPORT virtual void validators(const std::string& theFeatureID, - const std::string& theAttrID, - std::list& theValidators, - std::list >& theArguments) const; + /// Provides a filter for the attribute, returns NULL if no filter + MODULEBASE_EXPORT void filters(const std::string& theFeatureID, + const std::string& theAttrID, + SelectMgr_ListOfFilter& theFilters) const; - /// Returns registered validator by its Id - MODULEBASE_EXPORT virtual const ModuleBase_Filter* validator(const std::string& theID) const; - - /// Returns true if feature and all its attributes are valid. - MODULEBASE_EXPORT virtual bool validate(const std::shared_ptr& theFeature) const; - - /// register that this attribute in feature is not obligatory for the feature execution - /// so, it is not needed for the standard validation mechanism - virtual void registerNotObligatory(std::string theFeature, std::string theAttribute); - - /// Returns true if the attribute in feature is not obligatory for the feature execution - virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); - - /// register that this attribute conceals in the object browser - /// all referenced features after execution - virtual void registerConcealment(std::string theFeature, std::string theAttribute); - - /// Returns true that it was registered that attribute conceals the referenced result - virtual bool isConcealed(std::string theFeature, std::string theAttribute); + /// Returns registered filter by its Id + MODULEBASE_EXPORT virtual const ModuleBase_Filter* filter(const std::string& theID) const; protected: - void addDefaultValidators(std::list& theValidators) const; - /// Get instance from workshop - ModuleBase_FilterFactory(); ~ModuleBase_FilterFactory() {}