X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Group_i.cxx;h=d6f2d4ee477f1f5d5c97d6421e2e1db60db2deb8;hb=859a8ee4f086f0c35e27687efedbcb7f89f9178f;hp=1c7ff6a51fe8378e164da5362e3e60a33d841730;hpb=e9aead38a5bfd7949cbfc2b153e0e380d991b985;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index 1c7ff6a51..d6f2d4ee4 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 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 @@ -19,6 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes // File : SMESH_Group_i.cxx // Author : Sergey ANIKIN, OCC @@ -346,6 +347,36 @@ RemoveByPredicate( SMESH::Predicate_ptr thePredicate ) return 0; } +CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource ) +{ + long nbAdd = 0; + SMESHDS_Group* aGroupDS = dynamic_cast( GetGroupDS() ); + if (aGroupDS) { + SMESH::long_array_var anIds; + if ( !CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(theSource)) && + SMESH::SMESH_GroupBase::_narrow(theSource)->GetType() == GetType() ) { + anIds = theSource->GetIDs(); + } + else if ( !CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(theSource)) ) { + anIds = SMESH::SMESH_Mesh::_narrow(theSource)->GetElementsByType( GetType() ); + } + else if ( !CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(theSource)) ) { + anIds = SMESH::SMESH_subMesh::_narrow(theSource)->GetElementsByType( GetType() ); + } + else { + anIds->length( 0 ); + } + for ( int i = 0, total = anIds->length(); i < total; i++ ) { + if ( aGroupDS->Add((int)anIds[i]) ) nbAdd++; + } + } + + // Update Python script + TPythonDump() << "nbAdd = " << _this() << ".AddFrom( " << theSource << " )"; + + return nbAdd; +} + //============================================================================= /*! *