// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
//=================================================================================
SMESHGUI_SelectionOp::~SMESHGUI_SelectionOp()
{
- Filters::const_iterator anIt = myFilters.begin(),
- aLast = myFilters.end();
- for( ; anIt!=aLast; anIt++ )
- if( anIt.data() )
- delete anIt.data();
+ removeCustomFilters();
}
//=================================================================================
//=================================================================================
void SMESHGUI_SelectionOp::startOperation()
{
+ myOldSelectionMode = selectionMode();
+ setSelectionMode( myDefSelectionMode );
+
SMESHGUI_Operation::startOperation();
if( dlg() )
{
connect( dlg(), SIGNAL( objectDeactivated( int ) ), this, SLOT( onDeactivateObject( int ) ) );
connect( dlg(), SIGNAL( selectionChanged( int ) ), this, SLOT( onSelectionChanged( int ) ) );
}
-
- myOldSelectionMode = selectionMode();
- setSelectionMode( myDefSelectionMode );
}
//=================================================================================
// name : removeCustomFilters
// purpose :
//=================================================================================
-void SMESHGUI_SelectionOp::removeCustomFilters() const
+void SMESHGUI_SelectionOp::removeCustomFilters()
{
- LightApp_SelectionMgr* mgr = selectionMgr();
- if( !mgr )
- return;
-
- Filters::const_iterator anIt = myFilters.begin(),
- aLast = myFilters.end();
- for( ; anIt!=aLast; anIt++ )
- if( anIt.data() )
- mgr->removeFilter( anIt.data() );
+ if (myFilters.count() > 0) {
+ LightApp_SelectionMgr* mgr = selectionMgr();
+ Filters::const_iterator anIt = myFilters.begin(),
+ aLast = myFilters.end();
+ for (; anIt != aLast; anIt++) {
+ if (anIt.data()) {
+ if (mgr) mgr->removeFilter(anIt.data());
+ delete anIt.data();
+ }
+ }
+
+ myFilters.clear();
+ }
}
//=================================================================================
//=================================================================================
void SMESHGUI_SelectionOp::commitOperation()
{
+ SMESHGUI_Operation::commitOperation();
removeCustomFilters();
setSelectionMode( myOldSelectionMode );
- SMESHGUI_Operation::commitOperation();
}
//=================================================================================
//=================================================================================
void SMESHGUI_SelectionOp::abortOperation()
{
+ SMESHGUI_Operation::abortOperation();
removeCustomFilters();
setSelectionMode( myOldSelectionMode );
- SMESHGUI_Operation::abortOperation();
}
//=================================================================================
//=================================================================================
void SMESHGUI_SelectionOp::onDeactivateObject( int id )
{
- LightApp_SelectionMgr* mgr = selectionMgr();
- if( mgr && myFilters.contains( id ) && myFilters[ id ] )
- mgr->removeFilter( myFilters[ id ] );
+ removeCustomFilters();
}
//=================================================================================
QString id = anIt.Value()->getEntry();
ids.append( id );
types.append( typeById( id, Object ) );
- names.append( anIt.Value()->getName() );
+ 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() );
+ }
}
}
}