X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFiltersAPI%2FFiltersAPI_Selection.cpp;h=343f852e8bd628d3c3ebbd853268e72ce9066736;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=93a4444d92826fc518672c035b049280811ff059;hpb=86f8397a0cc86e83d5f963aaadffb3d765fc836a;p=modules%2Fshaper.git diff --git a/src/FiltersAPI/FiltersAPI_Selection.cpp b/src/FiltersAPI/FiltersAPI_Selection.cpp index 93a4444d9..343f852e8 100644 --- a/src/FiltersAPI/FiltersAPI_Selection.cpp +++ b/src/FiltersAPI/FiltersAPI_Selection.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 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 @@ -19,6 +19,11 @@ #include "FiltersAPI_Selection.h" +#include "GeomAPI_Edge.h" +#include "ModelAPI_Session.h" +#include "ModelAPI_FiltersFactory.h" +#include "ModelHighAPI_Services.h" + FiltersAPI_Selection::FiltersAPI_Selection(const FiltersPtr & theFeature) { myVariantType = VT_Filtering; @@ -29,6 +34,38 @@ FiltersAPI_Selection::~FiltersAPI_Selection() { } +FiltersFeaturePtr FiltersAPI_Selection::feature() const +{ + return myFilterFeature; +} + +std::list FiltersAPI_Selection::select + (const std::string theShapeType) const +{ + return select(GeomAPI_Shape::shapeTypeByStr(theShapeType)); +} + +std::list FiltersAPI_Selection::select + (const GeomAPI_Shape::ShapeType theShapeType) const +{ + // finish operation to make sure the selection is done on the current state of the history + apply(); + + std::list aSelList; + static SessionPtr aSession = ModelAPI_Session::get(); + std::list< std::pair > aResList = + aSession->filters()->select(myFilterFeature, theShapeType); + + std::list< std::pair >::const_iterator itSelected = aResList.cbegin(); + for (; itSelected != aResList.cend(); itSelected++) { + ResultPtr aCurRes = (*itSelected).first; + GeomShapePtr aSubShape = (*itSelected).second; + aSelList.push_back(ModelHighAPI_Selection(aCurRes, aSubShape)); + } + + return aSelList; +} + // ================================================================================================ FiltersAPI_Selection filters(const std::shared_ptr& thePart, const std::list& theFilters)