1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef Model_FiltersFactory_H_
21 #define Model_FiltersFactory_H_
25 #include <ModelAPI_FiltersFactory.h>
30 /**\class Model_FiltersFactory
32 * \brief Manages registering of filters
34 class Model_FiltersFactory : public ModelAPI_FiltersFactory
37 /// Register an instance of a filter
38 /// \param theID unique identifier of the filter, not necessary equal to the name of filter
39 /// \param theFilter the filter's instance
40 virtual void registerFilter(const std::string& theID, ModelAPI_Filter* theFilter);
42 /// Returns true if all filters of the Filters feature are ok for the Shape (taking into account
43 /// the Reversed states).
44 /// \param theResult parent result of the shape to check
45 /// \param theShape the checked shape
46 virtual bool isValid(FeaturePtr theFiltersFeature,
48 GeomShapePtr theShape);
50 /// Returns list of all shapes and subshapes in the study, satisfying
51 /// criteria of all filters of \a theFilterFeature.
52 /// \param theFiltersFeature feature that contains all information about the filters
53 /// \param theShapeType the type of sub-shapes to find
54 virtual std::list< std::pair<ResultPtr, GeomShapePtr> > select
55 (const FiltersFeaturePtr& theFilterFeature,
56 const GeomAPI_Shape::ShapeType theShapeType);
58 /// Returns the filters that support the given shape type
59 virtual std::list<FilterPtr> filters(GeomAPI_Shape::ShapeType theType);
61 /// Returns a filter by ID
62 virtual FilterPtr filter(std::string theID);
64 /// Returns a filter ID by the filter pointer
65 virtual std::string id(FilterPtr theFilter);
68 /// Get instance from Session
69 Model_FiltersFactory() {}
72 std::map<std::string, FilterPtr> myFilters; ///< map from ID to registered filters
74 friend class Model_Session;