EgtGraphics 1.5j5 :
- aggiunta gestione entità da non selezionare (Unselectable).
This commit is contained in:
Binary file not shown.
@@ -60,6 +60,10 @@ class Scene : public IEGrScene
|
||||
virtual bool SetBackground( Color colBackTop, Color colBackBottom) ;
|
||||
virtual bool Draw( void) ;
|
||||
virtual bool Select( const Point3d& ptView, int nW, int nH, int& nSel) ;
|
||||
virtual bool UnselectableAdd( int nId) ;
|
||||
virtual bool UnselectableRemove( int nId) ;
|
||||
virtual bool UnselectableClearAll( void) ;
|
||||
virtual bool UnselectableFind( int nId) ;
|
||||
virtual bool GetSelectedObjs( INTVECTOR& nIds) ;
|
||||
virtual int GetFirstSelectedObj( void) ;
|
||||
virtual int GetNextSelectedObj( void) ;
|
||||
@@ -170,6 +174,7 @@ class Scene : public IEGrScene
|
||||
bool m_bShowCurveDirection ; // flag di visualizzazione direzione curve
|
||||
|
||||
bool m_bSelect ; // flag di selezione attiva
|
||||
INTVECTOR m_Unsel ; // vettore indici oggetti non selezionabili
|
||||
Point3d m_ptSelCent ; // centro di selezione
|
||||
int m_nSelW ; // larghezza finestra di selezione
|
||||
int m_nSelH ; // altezza finestra di selezione
|
||||
|
||||
+48
-1
@@ -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)
|
||||
|
||||
+8
-4
@@ -116,18 +116,22 @@ Scene::DrawGroup( const IGdbIterator& iIter, int nPass, MdStMk cParent)
|
||||
int nMark = GDB_MK_OFF ;
|
||||
pIter->GetMark( nMark) ;
|
||||
nMark = ::CalcMark( nMark, cParent.nMark) ;
|
||||
// se in modalità selezione, verifico sia selezionabile
|
||||
bool bSel = true ;
|
||||
if ( m_bSelect && UnselectableFind( pIter->GetId()))
|
||||
bSel = false ;
|
||||
// se oggetto geometrico
|
||||
if ( nGdbType == GDB_TY_GEO) {
|
||||
// se non nascosto, lo disegno
|
||||
if ( nStat != GDB_ST_OFF) {
|
||||
// se non nascosto e selezionabile, lo disegno
|
||||
if ( nStat != GDB_ST_OFF && bSel) {
|
||||
if ( ! DrawGeoObj( *pIter, nPass, MdStMk( nMode, nStat, nMark)))
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
// se gruppo
|
||||
else if ( nGdbType == GDB_TY_GROUP) {
|
||||
// se non nascosto, lo disegno
|
||||
if ( nStat != GDB_ST_OFF) {
|
||||
// se non nascosto e selezionabile, lo disegno
|
||||
if ( nStat != GDB_ST_OFF && bSel) {
|
||||
if ( ! DrawGroup( *pIter, nPass, MdStMk( nMode, nStat, nMark)))
|
||||
bOk = false ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user