X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_FilterFactory.h;h=c1a7e36014e37118b1cf74b38baef0bc41f1e624;hb=e32f95642855a63da2727cb324ce2a75632a712f;hp=1e5cdeb55cbeab8ae1d9c4ed9225373ca3b3fce3;hpb=278328bad4390893a24864ee89a13a7c2e34bafc;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_FilterFactory.h b/src/ModuleBase/ModuleBase_FilterFactory.h index 1e5cdeb55..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 @@ -15,72 +17,46 @@ #include /** + * \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, - Handle_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); - - /// Provides a validator for the attribute, returns NULL if no validator - MODULEBASE_EXPORT const SelectMgr_ListOfFilter& filters(const std::string& theFeatureID, - const std::string& theAttrID) const; + const std::string& theFeatureID, + const std::string& theAttrID, + const std::list& theArguments); - /// Returns registered validator by its Id - MODULEBASE_EXPORT virtual const Handle_ModuleBase_Filter validator(const std::string& theID) 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 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() {}