X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHFiltersSelection%2FSMESH_TypeFilter.cxx;h=a405af18434ecfe29fbebd92d6fe27133540ffda;hp=ea3593b884f6453d606a9328597ce74f546a4fa0;hb=3957e28e356bf351b3c7f2bdd5f923f99e6c277f;hpb=251f8c052dd12dd29922210dc901b295fe999a0e diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx index ea3593b88..a405af184 100644 --- a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,10 +22,10 @@ #include "SMESH_TypeFilter.hxx" +#include #include - +#include #include -#include #include #include CORBA_CLIENT_HEADER(SMESH_Gen) @@ -39,6 +39,40 @@ SMESH_TypeFilter::~SMESH_TypeFilter() { } +namespace +{ + //================================================================================ + /*! + * \brief Returns true if \a obj is SMESH_IDSource including elements of a given \a type + */ + //================================================================================ + + bool isIDSourceOfType( _PTR(SObject) obj, SMESH::ElementType type ) + { + bool Ok = false; + SalomeApp_Application* app = dynamic_cast + (SUIT_Session::session()->activeApplication()); + _PTR(GenericAttribute) anAttr; + if ( obj->FindAttribute(anAttr, "AttributeIOR")) + { + _PTR(AttributeIOR) anIOR = anAttr; + std::string aVal = anIOR->Value(); + if ( aVal.size() > 0 ) + { + CORBA::Object_var corbaObj = app->orb()->string_to_object( aVal.c_str() ); + SMESH::SMESH_IDSource_var ids = SMESH::SMESH_IDSource::_narrow( corbaObj ); + if ( ! ids->_is_nil() ) + { + SMESH::array_of_ElementType_var types = ids->GetTypes(); + for ( int i = 0, nb = types->length(); i < nb && !Ok; ++i ) + Ok = ( types[i] == type ); + } + } + } + return Ok; + } +} + bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const { bool Ok = false, extractReference = true; @@ -215,6 +249,22 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const SMESH_TypeFilter(SMESH::GROUP) .isOk( theDataOwner )); break; } + case SMESH::IDSOURCE_EDGE: + { + Ok = isIDSourceOfType( obj, SMESH::EDGE ); + break; + } + case SMESH::IDSOURCE_FACE: + { + Ok = isIDSourceOfType( obj, SMESH::FACE ); + break; + } + case SMESH::IDSOURCE_VOLUME: + { + Ok = isIDSourceOfType( obj, SMESH::VOLUME ); + break; + } + default:; } } return Ok;