--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+from ModelHighAPI import *
+
+# Whole list of supported filters
+FILTER_BELONGS_TO = "BelongsTo"
+FILTER_ON_PLANE = "OnPlane"
+FILTER_ON_LINE = "OnLine"
+FILTER_ON_GEOMETRY = "OnGeometry"
+FILTER_ON_PLANE_SIDE = "OnPlaneSide"
+FILTER_OPPOSITE_TO_EDGE = "OppositeToEdge"
+FILTER_RELATIVE_TO_SOLID = "RelativeToSolid"
+FILTER_EXTERNAL_FACES = "ExternalFaces"
+FILTER_HORIZONTAL_FACES = "HorizontalFaces"
+FILTER_VERTICAL_FACES = "VerticalFaces"
+FILTER_CONNECTED_FACES = "TopoConnectedFaces"
+
+# Reference data (supported filters) for each type of shape
+Reference = {
+ GeomAPI_Shape.VERTEX : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_LINE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID],
+ GeomAPI_Shape.EDGE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_LINE, FILTER_ON_GEOMETRY, FILTER_ON_PLANE_SIDE, FILTER_OPPOSITE_TO_EDGE, FILTER_RELATIVE_TO_SOLID],
+ GeomAPI_Shape.WIRE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID],
+ GeomAPI_Shape.FACE : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_GEOMETRY, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID, FILTER_EXTERNAL_FACES, FILTER_HORIZONTAL_FACES, FILTER_VERTICAL_FACES, FILTER_CONNECTED_FACES],
+ GeomAPI_Shape.SHELL : [FILTER_BELONGS_TO, FILTER_ON_PLANE, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID],
+ GeomAPI_Shape.SOLID : [FILTER_BELONGS_TO, FILTER_ON_PLANE_SIDE, FILTER_RELATIVE_TO_SOLID],
+}
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+# load 'Filters' plugin
+model.filters(Part_1_doc, [])
+
+filtersFactory = ModelAPI_Session.get().filters()
+for type, res in Reference.items():
+ filtersList = filtersFactory.filters(type)
+ for filter in filtersList:
+ filterID = filtersFactory.id(filter)
+ assert(filterID in res), "Filter \"{}\" is not applicable for {}".format(filterID, strByShapeType(type))
+ res.remove(filterID)
+ assert(len(res) == 0), "There are more filters {}, which should be supported for {}".format(res, strByShapeType(type))
+model.end()
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+from ModelHighAPI import *
+
+# Map filter and emptyness of its XML representation
+Reference = {
+ "BelongsTo" : False,
+ "OnPlane" : False,
+ "OnLine" : False,
+ "OnGeometry" : False,
+ "OnPlaneSide" : False,
+ "OppositeToEdge" : False,
+ "RelativeToSolid" : False,
+ "ExternalFaces" : True,
+ "HorizontalFaces" : True,
+ "VerticalFaces" : True,
+ "TopoConnectedFaces" : False,
+}
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+# load 'Filters' plugin
+model.filters(Part_1_doc, [])
+
+filtersFactory = ModelAPI_Session.get().filters()
+for id, res in Reference.items():
+ filter = filtersFactory.filter(id)
+ xmlString = filter.xmlRepresentation()
+ assert((len(xmlString) == 0) == res)
+model.end()
%shared_ptr(ModelAPI_Feature)
%shared_ptr(ModelAPI_CompositeFeature)
%shared_ptr(ModelAPI_Data)
+%shared_ptr(ModelAPI_Filter)
%shared_ptr(ModelAPI_FiltersFeature)
%shared_ptr(ModelAPI_Folder)
%shared_ptr(ModelAPI_Attribute)
%template(FeatureList) std::list<std::shared_ptr<ModelAPI_Feature> >;
%template(ResultList) std::list<std::shared_ptr<ModelAPI_Result> >;
%template(DocumentList) std::list<std::shared_ptr<ModelAPI_Document> >;
+%template(FilterList) std::list<std::shared_ptr<ModelAPI_Filter> >;
// std::set -> []
%template(AttributeSet) std::set<std::shared_ptr<ModelAPI_Attribute> >;
%template(FeatureSet) std::set<std::shared_ptr<ModelAPI_Feature> >;