EgtGraphics 1.5c5 :

- nel disegno si tiene conto dello stato dell'oggetto (ON, SEL, OFF)
- gli oggetti selezionati vengono evidenziati.
This commit is contained in:
Dario Sassi
2014-03-14 18:40:18 +00:00
parent 46df22d5ed
commit ec813123d0
9 changed files with 73 additions and 27 deletions
+31 -17
View File
@@ -24,6 +24,7 @@
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkGdbFunct.h"
using namespace std ;
@@ -80,7 +81,7 @@ Scene::UpdateExtension( void)
//----------------------------------------------------------------------------
bool
Scene::DrawGroup( int nId)
Scene::DrawGroup( int nId, int nParentMode, int nParentStat)
{
// creo un iteratore
PtrOwner<IGdbIterator> pIter( CreateGdbIterator()) ;
@@ -93,12 +94,12 @@ Scene::DrawGroup( int nId)
return false ;
// eseguo il disegno
return DrawGroup( *pIter) ;
return DrawGroup( *pIter, nParentMode, nParentStat) ;
}
//----------------------------------------------------------------------------
bool
Scene::DrawGroup( const IGdbIterator& iIter)
Scene::DrawGroup( const IGdbIterator& iIter, int nParentMode, int nParentStat)
{
// recupero il riferimento del gruppo
Frame3d frFrame ;
@@ -120,19 +121,32 @@ Scene::DrawGroup( const IGdbIterator& iIter)
pIter->SetGDB( m_pGeomDB) ;
bool bNext = pIter->GoToFirstInGroup( iIter) ;
while ( bNext) {
// leggo il tipo di nodo
// leggo il tipo di oggetto
int nGdbType = pIter->GetGdbType() ;
// recupero e aggiorno il modo dell'oggetto
int nMode = GDB_MD_STD ;
pIter->GetMode( nMode) ;
nMode = ::CalcMode( nMode, nParentMode) ;
// recupero e aggiorno lo stato dell'oggetto
int nStat = GDB_ST_ON ;
pIter->GetStatus( nStat) ;
nStat = ::CalcStatus( nStat, nParentStat) ;
nStat = ::AdjustStatusWithMode( nStat, nMode) ;
// se oggetto geometrico
if ( nGdbType == GDB_GEO) {
// lo disegno
if ( ! DrawGeoObj( *pIter))
return false ;
if ( nGdbType == GDB_TY_GEO) {
// se non nascosto, lo disegno
if ( nStat != GDB_ST_OFF) {
if ( ! DrawGeoObj( *pIter, nStat))
return false ;
}
}
// se gruppo
else if ( nGdbType == GDB_GROUP) {
// lo disegno
if ( ! DrawGroup( *pIter))
return false ;
else if ( nGdbType == GDB_TY_GROUP) {
// se non nascosto, lo disegno
if ( nStat != GDB_ST_OFF) {
if ( ! DrawGroup( *pIter, nMode, nStat))
return false ;
}
}
// passo al successivo
bNext = pIter->GoToNext() ;
@@ -146,7 +160,7 @@ Scene::DrawGroup( const IGdbIterator& iIter)
//----------------------------------------------------------------------------
bool
Scene::DrawGeoObj( const IGdbIterator& iIter)
Scene::DrawGeoObj( const IGdbIterator& iIter, int nObjStat)
{
// recupero l'oggetto geometrico
IGeoObj* pGeoObj = (const_cast<IGdbIterator*>(&iIter))->GetGeoObj() ;
@@ -169,7 +183,7 @@ Scene::DrawGeoObj( const IGdbIterator& iIter)
int nGeoType = pGeoObj->GetType() ;
// recupero il colore
Color cCol ;
if ( ! iIter.GetColor( cCol))
if ( ! iIter.GetCalcColor( cCol))
cCol = m_colDef ;
// se vettore
if ( nGeoType == GEO_VECT3D) {
@@ -228,7 +242,7 @@ Scene::DrawGeoObj( const IGdbIterator& iIter)
}
// visualizzo la grafica associata
return pGraphics->Draw() ;
return pGraphics->Draw( nObjStat) ;
}
//----------------------------------------------------------------------------
@@ -246,7 +260,7 @@ Scene::DeleteObjGraphicsGroup( int nId)
// leggo il tipo di nodo
int nGdbType = pIter->GetGdbType() ;
// se oggetto geometrico
if ( nGdbType == GDB_GEO) {
if ( nGdbType == GDB_TY_GEO) {
// lo recupero
IGeoObj* pGeoObj = pIter->GetGeoObj() ;
if ( pGeoObj == nullptr)
@@ -257,7 +271,7 @@ Scene::DeleteObjGraphicsGroup( int nId)
pGeoObj->SetObjGraphics( nullptr) ;
}
// se gruppo
else if ( nGdbType == GDB_GROUP) {
else if ( nGdbType == GDB_TY_GROUP) {
// ripeto sugli oggetti dello stesso
if ( ! DeleteObjGraphicsGroup( pIter->GetId()))
return false ;