Files
EgtGeomKernel/SelManager.h
T
Dario Sassi 0239607929 EgtGeomKernel 1.5e7 :
- velocizzata selezione con migliaia di entità
- aggiunta creazione superfici trimesh da zuppa di triangoli.
2014-05-19 20:03:58 +00:00

69 lines
2.5 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : SelManager.h Data : 19.05.14 Versione : 1.5e7
// Contenuto : Dichiarazione e implementazione della classe SelManager.
//
//
//
// Modifiche : 19.03.14 DS Creazione modulo.
// 19.05.14 DS La AddObj non controlla eventuale precedente presenza
// oggetto in lista, perchè già si fa tramite flag di GdbObj.
//
//----------------------------------------------------------------------------
#pragma once
#include <list>
class GdbObj ;
//----------------------------------------------------------------------------
typedef std::list<GdbObj*> PGDBO_LIST ;
//----------------------------------------------------------------------------
class SelManager
{
public :
SelManager( void)
{ m_Iter = m_SelList.end() ; }
void Clear( void)
{ m_SelList.clear() ;
m_Iter = m_SelList.end() ; }
int GetSize( void) const
{ return int ( m_SelList.size()) ; }
bool AddObj( GdbObj* pGObj)
{ if ( pGObj == nullptr)
return false ;
try { m_SelList.push_back( pGObj) ; }
catch (...) { return false ;}
return true ; }
bool RemoveObj( GdbObj* pGObj)
{ PGDBO_LIST::iterator Iter ;
for ( Iter = m_SelList.begin() ; Iter != m_SelList.end() ; ++ Iter) {
if ( *Iter == pGObj) {
if ( Iter == m_Iter)
m_Iter = m_SelList.end() ;
m_SelList.erase( Iter) ;
return true ;
}
}
return true ; }
GdbObj* GetFirstObj( void) const
{ m_Iter = m_SelList.begin() ;
if ( m_Iter == m_SelList.end())
return nullptr ;
return (*m_Iter) ; }
GdbObj* GetNextObj( void) const
{ if ( m_Iter == m_SelList.end())
return nullptr ;
++ m_Iter ;
if ( m_Iter == m_SelList.end())
return nullptr ;
return (*m_Iter) ; }
private :
PGDBO_LIST m_SelList ;
mutable PGDBO_LIST::const_iterator m_Iter ;
} ;