X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SelectionOp.cxx;h=e57e65c7711bedca692cd47332a097e093a75e7b;hp=9ea28adf97673f27bcee7b3b667edb60cc19c683;hb=b7a7d49664daa32e1befb558280e13ed0bde37c9;hpb=6bac08c1a81f34d3f21c550bd92f83654b2546a5 diff --git a/src/SMESHGUI/SMESHGUI_SelectionOp.cxx b/src/SMESHGUI/SMESHGUI_SelectionOp.cxx index 9ea28adf9..e57e65c77 100644 --- a/src/SMESHGUI/SMESHGUI_SelectionOp.cxx +++ b/src/SMESHGUI/SMESHGUI_SelectionOp.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 @@ -250,11 +250,11 @@ void SMESHGUI_SelectionOp::setSelectionMode( const Selection_Mode mode ) // Purpose : Highlight object in 3d viewer //======================================================================= void SMESHGUI_SelectionOp::highlight( const Handle( SALOME_InteractiveObject )& obj, - const bool hilight, const bool immediately ) + const bool highlight, const bool immediately ) { SVTK_ViewWindow* wnd = viewWindow(); if( wnd ) - wnd->highlight( obj, hilight, immediately ); + wnd->highlight( obj, highlight, immediately ); } //======================================================================= @@ -295,36 +295,28 @@ SVTK_Selector* SMESHGUI_SelectionOp::selector() const //======================================================================= int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype ) const { - SalomeApp_Study* _study = dynamic_cast( 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( 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( 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(); - } + GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow( + dynamic_cast( 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 { @@ -335,7 +327,7 @@ int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype 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( sobj.get() )->GetObject() ); SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow( @@ -422,13 +414,9 @@ void SMESHGUI_SelectionOp::selected( QStringList& names, QString id = anIt.Value()->getEntry(); ids.append( id ); types.append( typeById( id, Object ) ); - SalomeApp_Study* _study = dynamic_cast( study() ); - if( _study ) - { - _PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() ); - if( obj ) - names.append( QString( obj->GetName().c_str() ).trimmed() ); - } + _PTR(SObject) obj = SMESH::getStudy()->FindObjectID( anIt.Value()->getEntry() ); + if( obj ) + names.append( QString( obj->GetName().c_str() ).trimmed() ); } } }