EgtGraphics 1.5j5 :

- aggiunta gestione entità da non selezionare (Unselectable).
This commit is contained in:
Dario Sassi
2014-10-21 10:50:02 +00:00
parent f8a508fa7b
commit e1e4af8792
4 changed files with 61 additions and 5 deletions
+48 -1
View File
@@ -7,7 +7,7 @@
//
//
// Modifiche : 29.01.14 DS Creazione modulo.
//
// 21.10.14 DS Aggiunta gestione Unselectable.
//
//----------------------------------------------------------------------------
@@ -58,6 +58,7 @@ Scene::Scene( void)
m_nShowMode = SM_WIREFRAME ;
// Selezione
m_bSelect = false ;
m_Unsel.reserve( 50) ;
m_nSelCurr = - 1 ;
// GeomData
m_pGeomDB = nullptr ;
@@ -849,6 +850,52 @@ Scene::GetSelectedObjWinZ( int nSel)
return 0.5 * ( double( m_nSelBuff[nSel].nZmin) + double( m_nSelBuff[nSel].nZmax)) / UINT_MAX ;
}
/*------------------------------------------------------------------------------------------*/
bool
Scene::UnselectableAdd( int nId)
{
// non si ammettono radice e id negativi
if ( nId <= GDB_ID_ROOT)
return false ;
// inserisco l'elemento
m_Unsel.push_back( nId) ;
// ordino in senso crescente
stable_sort( m_Unsel.begin(), m_Unsel.end()) ;
return true ;
}
/*------------------------------------------------------------------------------------------*/
bool
Scene::UnselectableRemove( int nId)
{
// non si ammettono radice e id negativi
if ( nId <= GDB_ID_ROOT)
return false ;
// cerco l'elemento
INTVECTOR::iterator Iter = find( m_Unsel.begin(), m_Unsel.end(), nId) ;
if ( Iter == m_Unsel.end())
return true ;
m_Unsel.erase( Iter) ;
return true ;
}
/*------------------------------------------------------------------------------------------*/
bool
Scene::UnselectableClearAll( void)
{
// cancello tutto
m_Unsel.clear() ;
return true ;
}
/*------------------------------------------------------------------------------------------*/
bool
Scene::UnselectableFind( int nId)
{
// eseguo ricerca su vettore ordinato in senso crescente
return binary_search( m_Unsel.begin(), m_Unsel.end(), nId) ;
}
/*------------------------------------------------------------------------------------------*/
bool
Scene::Project( const Point3d& ptWorld, Point3d& ptView)