-// Copyright (C) 2007-2012 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
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <SVTK_ViewModel.h>
#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDS_SObject.hxx>
//=======================================================================
int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype ) const
{
- SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
- if( !_study )
- return -1;
-
- _PTR( Study ) st = _study->studyDS();
+ _PTR(Study) aStudy = SMESH::getStudy();
int res = -1;
if( objtype == Object )
{
- SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
- if( _study )
+ int t = SMESHGUI_Selection::type( str );
+ if( t<0 )
{
- int t = SMESHGUI_Selection::type( str, _study->studyDS() );
- if( t<0 )
+ //try to get GEOM type
+ _PTR( SObject ) sobj = aStudy->FindObjectID( str.toLatin1().data() );
+ if( sobj )
{
- //try to get GEOM type
- _PTR( SObject ) sobj = st->FindObjectID( str.toLatin1().data() );
- if( sobj )
- {
- GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow(
- dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
- if( !CORBA::is_nil( obj ) )
- res = SMESHGUI_Dialog::prefix( "GEOM" ) + obj->GetType();
- }
+ GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow(
+ dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
+ if( !CORBA::is_nil( obj ) )
+ // as decoding of type id is not realized in LightApp_Dialog,
+ //make all GEOM objects have same type id
+ res = SMESHGUI_Dialog::prefix( "GEOM" );// + obj->GetType();
}
- else
- res = SMESHGUI_Dialog::prefix( "SMESH" ) + t;
}
+ else
+ res = SMESHGUI_Dialog::prefix( "SMESH" ) + t;
}
else
{
int id = _id.toInt( &ok );
if( ok )
{
- _PTR( SObject ) sobj = st->FindObjectID( entry.toLatin1().data() );
+ _PTR( SObject ) sobj = aStudy->FindObjectID( entry.toLatin1().data() );
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow(
dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow(
QString id = anIt.Value()->getEntry();
ids.append( id );
types.append( typeById( id, Object ) );
- SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
- if( _study )
- {
- _PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() );
- if( obj )
- names.append( obj->GetName().c_str() );
- }
+ _PTR(SObject) obj = SMESH::getStudy()->FindObjectID( anIt.Value()->getEntry() );
+ if( obj )
+ names.append( QString( obj->GetName().c_str() ).trimmed() );
}
}
}
IdList ids; extractIds( list, ids, '\0' );
IdList::const_iterator anIt = ids.begin(),
aLast = ids.end();
- for( ; anIt!=aLast; anIt++ )
- if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) )
- newIndices.Add( n->GetID() );
+ if ( selectionMode() == NodeSelection )
+ for( ; anIt!=aLast; anIt++ ) {
+ if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) )
+ newIndices.Add( n->GetID() );
+ }
+ else
+ for( ; anIt!=aLast; anIt++ ) {
+ if( const SMDS_MeshElement* e = aMesh->FindElement( *anIt ) )
+ newIndices.Add( e->GetID() );
+ }
selector()->AddOrRemoveIndex( sel.First(), newIndices, false );
highlight( sel.First(), true, true );