-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
/*! Gets selected data owners from list with type \a type to list \a lst.
*/
-void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& type ) const
+void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& type, const bool onlyOne ) const
{
lst.clear();
if ( !type.isEmpty() && (*it)->type() != type )
continue;
- SUIT_DataOwnerPtrList curList;
+ SUIT_DataOwnerPtrList curList( /*skipAllEqual=*/false );
(*it)->selected( curList );
- for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr )
- lst.append( *itr );
+ if ( onlyOne )
+ {
+ for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr )
+ {
+ lst.append( *itr );
+ if ( lst.count() > 1 )
+ {
+ lst.clear();
+ return;
+ }
+ }
+ }
+ else
+ {
+ for ( SUIT_DataOwnerPtrList::const_iterator itr = curList.begin(); itr != curList.end(); ++itr )
+ lst.append( *itr );
+ }
}
}
if ( isOk( *it ) )
out.append( *it );
}
-}
+}
\ No newline at end of file