+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<SalomeApp_Application*>
+ (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;
+ }
+}
+