1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_FilterFactory.h
4 // Created: 10 Dec 2014
5 // Author: Natalia ERMOLAEVA
7 #ifndef ModuleBase_FilterFactory_H
8 #define ModeleBase_SelectionFilterFactory_H
10 #include "ModuleBase.h"
11 #include "ModuleBase_IWorkshop.h"
12 #include "ModuleBase_Filter.h"
14 #include <SelectMgr_ListOfFilter.hxx>
20 * Allows to get a selection filter by the feature identifier and
21 * the attribute identifier (if attribute is validated).
22 * All accessible filters must be registered by the ID string first.
23 * The instance of this factory can be get in the Workshop interface.
24 * Keeps the filter objects alive and just returns one of it by request.
25 * All the needed information is provided to the filter as an argument,
26 * this allows to work with them independently from the feature specific object.
28 class ModuleBase_FilterFactory : public QObject
31 std::map<std::string, Handle_ModuleBase_Filter> myIDs; ///< map from ID to registered filter
32 /// filters IDs to list of arguments
33 typedef std::map<std::string, std::list<std::string> > AttrFilters;
34 /// filters IDs by feature ID
35 std::map<std::string, AttrFilters> myFeatures;
36 /// filters IDs and arguments by feature and attribute IDs
37 std::map<std::string, std::map<std::string, AttrFilters> > myAttrs;
40 /// Registers the instance of the filter by the ID
41 MODULEBASE_EXPORT virtual void registerFilter(const std::string& theID,
42 Handle_ModuleBase_Filter theFilter);
44 /// Assigns filter to the attribute of the feature
45 MODULEBASE_EXPORT virtual void assignFilter(const std::string& theID,
46 const std::string& theFeatureID,
47 const std::string& theAttrID);
49 /// Provides a filter for the attribute, returns NULL if no filter
50 MODULEBASE_EXPORT void filters(const std::string& theFeatureID,
51 const std::string& theAttrID,
52 SelectMgr_ListOfFilter& theFilters) const;
54 /// Returns registered filter by its Id
55 MODULEBASE_EXPORT virtual const Handle_ModuleBase_Filter filter(const std::string& theID) const;
58 ModuleBase_FilterFactory();
60 ~ModuleBase_FilterFactory() {}
62 friend class ModuleBase_IWorkshop;
66 #endif //ModuleBase_FilterFactory