Files
EgtGeomKernel/SelManager.h
T
Dario Sassi b304c329ef EgtGeomKernel 1.5k1 :
- aggiunta estensione di curve agli estremi di data lunghezza
- a selezione oggetto aggiunto flag per farlo solo se già visibile
- possibilità di ciclare gli oggetti selezionati a ritroso
- a tutti gli oggetti Geo aggiunto il costruttore di copia.
2014-11-18 16:13:19 +00:00

84 lines
3.0 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) ; }
GdbObj* GetLastObj( void) const
{ m_Iter = m_SelList.end() ;
if ( m_Iter == m_SelList.begin())
return nullptr ;
-- m_Iter ;
if ( m_Iter == m_SelList.end())
return nullptr ;
return (*m_Iter) ; }
GdbObj* GetPrevObj( void) const
{ if ( m_Iter == m_SelList.begin())
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 ;
} ;