#include <SMESHGUI_Selection.h>
#include <SMESHGUI.h>
#include <SUIT_SelectionFilter.h>
-#include <SalomeApp_SelectionMgr.h>
+#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Study.h>
-#include <SalomeApp_VTKSelector.h>
+#include <LightApp_VTKSelector.h>
#include <SVTK_ViewWindow.h>
#include <SVTK_ViewModel.h>
#include <SVTK_Selector.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
#include <SALOMEDS_SObject.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
/*
Class : SMESHGUI_SelectionOp
Description : Base operation for all operations using object selection in viewer or objectbrowser
- through common widgets created by SalomeApp_Dialog::createObject
+ through common widgets created by LightApp_Dialog::createObject
*/
//=================================================================================
//=================================================================================
void SMESHGUI_SelectionOp::removeCustomFilters() const
{
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
if( !mgr )
return;
}
QStringList names, ids;
- SalomeApp_Dialog::TypesList types;
+ LightApp_Dialog::TypesList types;
selected( names, types, ids );
dlg()->selectObject( names, types, ids );
}
//=================================================================================
void SMESHGUI_SelectionOp::onActivateObject( int id )
{
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
if( !mgr )
return;
//=================================================================================
void SMESHGUI_SelectionOp::onDeactivateObject( int id )
{
- SalomeApp_SelectionMgr* mgr = selectionMgr();
+ LightApp_SelectionMgr* mgr = selectionMgr();
if( mgr && myFilters.contains( id ) && myFilters[ id ] )
mgr->removeFilter( myFilters[ id ] );
}
// Purpose : Get names, types and ids of selected objects
//=======================================================================
void SMESHGUI_SelectionOp::selected( QStringList& names,
- SalomeApp_Dialog::TypesList& types,
+ LightApp_Dialog::TypesList& types,
QStringList& ids ) const
{
- SUIT_DataOwnerPtrList list; selectionMgr()->selected( list );
+/* SUIT_DataOwnerPtrList list; selectionMgr()->selected( list );
SUIT_DataOwnerPtrList::const_iterator anIt = list.begin(),
aLast = list.end();
for( ; anIt!=aLast; anIt++ )
{
- SalomeApp_DataOwner* owner = dynamic_cast<SalomeApp_DataOwner*>( (*anIt).operator->() );
- SalomeApp_SVTKDataOwner* vtkowner = dynamic_cast<SalomeApp_SVTKDataOwner*>( (*anIt).operator->() );
+ LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( (*anIt).operator->() );
+ LightApp_SVTKDataOwner* vtkowner = dynamic_cast<LightApp_SVTKDataOwner*>( (*anIt).operator->() );
if( vtkowner )
{
types.append( typeById( id, Object ) );
names.append( owner->IO()->getName() );
}
+ }*/
+
+ SALOME_ListIO selObjs;
+ TColStd_IndexedMapOfInteger selIndices;
+ selectionMgr()->selectedObjects( selObjs );
+ Selection_Mode mode = selectionMode();
+ EntityType objtype = mode == NodeSelection ? MeshNode : MeshElement;
+
+ for( SALOME_ListIteratorOfListIO anIt( selObjs ); anIt.More(); anIt.Next() )
+ {
+ selIndices.Clear();
+ selectionMgr()->GetIndexes( anIt.Value(), selIndices );
+ if( selIndices.Extent() > 0 )
+ {
+ QString id_str = QString( "%1%2%3" ).arg( anIt.Value()->getEntry() ).arg( idChar() ), current_id_str;
+ for( int i=1, n=selIndices.Extent(); i<=n; i++ )
+ {
+ int curid = selIndices( i );
+ current_id_str = id_str.arg( curid );
+ ids.append( current_id_str );
+ types.append( typeById( current_id_str, objtype ) );
+ names.append( QString( "%1" ).arg( curid ) );
+ }
+ }
+ else
+ {
+ 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() );
+ }
+ }
}
}
selector()->AddOrRemoveIndex( sel.First(), newIndices, false );
highlight( sel.First(), true, true );
- QStringList names, _ids; SalomeApp_Dialog::TypesList types;
+ QStringList names, _ids; LightApp_Dialog::TypesList types;
selected( names, types, _ids );
dlg()->selectObject( names, types, _ids, false );
}