X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFiltersPlugin%2FFiltersPlugin_BelongsTo.cpp;h=6a1553acedb9a7a4997630b09bc60be439d2de0c;hb=a47af7109078eea1a585d1f10a176f16ab838b87;hp=854fc26c9c030dff5d6866a3c4af58a0cdae2b1a;hpb=f418c935cc129eccc1e640b5c27f0589ad6acec5;p=modules%2Fshaper.git diff --git a/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp b/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp index 854fc26c9..6a1553ace 100644 --- a/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp +++ b/src/FiltersPlugin/FiltersPlugin_BelongsTo.cpp @@ -19,23 +19,36 @@ #include "FiltersPlugin_BelongsTo.h" +#include + bool FiltersPlugin_BelongsTo::isSupported(GeomAPI_Shape::ShapeType theType) const { return true; } -bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape, - const ModelAPI_FiltersArgs& theArgs) const +bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape, const ResultPtr&, + const ModelAPI_FiltersArgs& theArgs) const { - return true; + AttributePtr aAttr = theArgs.argument("BelongsTo"); + AttributeSelectionListPtr aList = + std::dynamic_pointer_cast(aAttr); + if (!aList.get()) + return false; + for (int i = 0; i < aList->size(); i++) { + AttributeSelectionPtr aAttr = aList->value(i); + GeomShapePtr aGeom = aAttr->value(); + if (aGeom->isSubShape(theShape)) + return true; + } + return false; } static std::string XMLRepresentation = -"" -" " +"" +" " " " ""; @@ -43,4 +56,9 @@ static std::string XMLRepresentation = std::string FiltersPlugin_BelongsTo::xmlRepresentation() const { return XMLRepresentation; -} \ No newline at end of file +} + +void FiltersPlugin_BelongsTo::initAttributes(ModelAPI_FiltersArgs& theArguments) +{ + theArguments.initAttribute("BelongsTo", ModelAPI_AttributeSelectionList::typeId()); +}