EgtGeomKernel 1.5c6 :

- aggiunta gestione attributi Level, Mode e Status
- aggiunti comandi per assegnarli.
This commit is contained in:
Dario Sassi
2014-03-14 18:38:48 +00:00
parent 01ce6ea4a4
commit e2c8e72e22
13 changed files with 770 additions and 80 deletions
+231 -22
View File
@@ -16,6 +16,7 @@
#include "GdbObj.h"
#include "GdbGroup.h"
#include "Attribs.h"
#include "/EgtDev/Include/EGkGdbFunct.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include <new>
@@ -236,17 +237,216 @@ GdbObj::GetSafeAttribs( void)
return m_pAttribs ;
}
//----------------------------------------------------------------------------
bool
GdbObj::SetLevel( int nLevel)
{
// verifico esistenza (con eventuale creazione) degli attributi
if ( GetSafeAttribs() == nullptr)
return false ;
// assegno il livello
m_pAttribs->SetLevel( nLevel) ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::RevertLevel( void)
{
// se non ci sono attributi non fa alcunchè
if ( m_pAttribs == nullptr)
return true ;
// ripristina il vecchio livello
m_pAttribs->RevertLevel() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetLevel( int& nLevel) const
{
// se non ci sono attributi
if ( m_pAttribs == nullptr)
return false ;
// il livello è definito
nLevel = m_pAttribs->GetLevel() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetCalcLevel( int& nLevel) const
{
// recupero il livello dell'oggetto
int nObjLevel = GDB_LV_USER ;
if ( m_pAttribs != nullptr)
nObjLevel = m_pAttribs->GetLevel() ;
// se il livello è TEMP, non ho bisogno di sapere altro
if ( nObjLevel == GDB_LV_TEMP) {
nLevel = GDB_LV_TEMP ;
return true ;
}
// recupero il livello dell'eventuale padre
int nParentLevel = GDB_LV_USER ;
if ( GetParent() != nullptr)
GetParent()->GetCalcLevel( nParentLevel) ;
// calcolo il livello
nLevel = ::CalcLevel( nObjLevel, nParentLevel) ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::SetMode( int nMode)
{
// verifico esistenza (con eventuale creazione) degli attributi
if ( GetSafeAttribs() == nullptr)
return false ;
// assegno il modo
m_pAttribs->SetMode( nMode) ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::RevertMode( void)
{
// se non ci sono attributi non fa alcunchè
if ( m_pAttribs == nullptr)
return true ;
// ripristina il vecchio modo
m_pAttribs->RevertMode() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetMode( int& nMode) const
{
// se non ci sono attributi
if ( m_pAttribs == nullptr)
return false ;
// il modo è definito
nMode = m_pAttribs->GetMode() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetCalcMode( int& nMode) const
{
// recupero il modo dell'oggetto
int nObjMode = GDB_MD_STD ;
if ( m_pAttribs != nullptr)
nObjMode = m_pAttribs->GetMode() ;
// se il modo è HIDDEN, non ho bisogno di sapere altro
if ( nObjMode == GDB_MD_HIDDEN) {
nMode = GDB_MD_HIDDEN ;
return true ;
}
// recupero il modo dell'eventuale padre
int nParentMode = GDB_MD_STD ;
if ( GetParent() != nullptr)
GetParent()->GetCalcMode( nParentMode) ;
// calcolo il modo
nMode = ::CalcMode( nObjMode, nParentMode) ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::SetStatus( int nStat)
{
// verifico esistenza (con eventuale creazione) degli attributi
if ( GetSafeAttribs() == nullptr)
return false ;
// assegno lo stato
m_pAttribs->SetStatus( nStat) ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::RevertStatus( void)
{
// se non ci sono attributi non fa alcunchè
if ( m_pAttribs == nullptr)
return true ;
// ripristina il vecchio stato
m_pAttribs->RevertStatus() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetStatus( int& nStat) const
{
// se non ci sono attributi
if ( m_pAttribs == nullptr)
return false ;
// lo stato è definito
nStat = m_pAttribs->GetStatus() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetCalcStatus( int& nStat, int nLev) const
{
// recupero lo stato dell'oggetto
int nObjStat = GDB_ST_ON ;
if ( m_pAttribs != nullptr)
nObjStat = m_pAttribs->GetStatus() ;
// se lo stato è OFF, non ho bisogno di sapere altro
if ( nObjStat == GDB_ST_OFF) {
nStat = GDB_ST_OFF ;
return true ;
}
// recupero lo stato dell'eventuale padre
int nParentStat = GDB_ST_ON ;
if ( GetParent() != nullptr)
GetParent()->GetCalcStatus( nParentStat, ( nLev + 1)) ;
// calcolo lo stato
nStat = ::CalcStatus( nObjStat, nParentStat) ;
// se sono alla chiamata iniziale, devo aggiustare lo stato con il modo
if ( nLev == 0) {
int nMode = GDB_MD_STD ;
GetCalcMode( nMode) ;
nStat = ::AdjustStatusWithMode( nStat, nMode) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::SetColor( Color cCol)
{
// recupero gli attributi (se non ci sono, vengono creati)
Attribs* pAttribs = GetSafeAttribs() ;
if ( pAttribs == nullptr)
// verifico esistenza (con eventuale creazione) degli attributi
if ( GetSafeAttribs() == nullptr)
return false ;
// assegno il colore
pAttribs->SetColor( cCol) ;
m_pAttribs->SetColor( cCol) ;
return true ;
}
@@ -256,33 +456,43 @@ GdbObj::GetColor( Color& cCol) const
{
// se non ci sono attributi o ci si deve riferire al padre
if ( m_pAttribs == nullptr ||
m_pAttribs->GetMaterial() == Attribs::MAT_PARENT) {
if ( GetParent() != nullptr)
return GetParent()->GetColor( cCol) ;
else
return false ;
}
m_pAttribs->GetMaterial() == GDB_MT_PARENT)
return false ;
// se il colore è definito
if ( m_pAttribs->GetMaterial() != Attribs::MAT_NULL) {
cCol = m_pAttribs->GetColor() ;
// il colore è definito
cCol = m_pAttribs->GetColor() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetCalcColor( Color& cCol) const
{
// se non ci sono attributi o ci si deve riferire al padre
if ( m_pAttribs == nullptr ||
m_pAttribs->GetMaterial() == GDB_MT_PARENT) {
if ( GetParent() != nullptr)
GetParent()->GetCalcColor( cCol) ;
else
cCol.Set() ;
return true ;
}
return false ;
// il colore è definito
cCol = m_pAttribs->GetColor() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::SetName( const string& sName)
{
// recupero gli attributi (se non ci sono, vengono creati)
Attribs* pAttribs = GetSafeAttribs() ;
if ( pAttribs == nullptr)
// verifico esistenza (con eventuale creazione) degli attributi
if ( GetSafeAttribs() == nullptr)
return false ;
// assegno il nome
return pAttribs->SetName( sName) ;
return m_pAttribs->SetName( sName) ;
}
//----------------------------------------------------------------------------
@@ -313,13 +523,12 @@ GdbObj::RemoveName( void)
bool
GdbObj::SetInfo( const string& sKey, const string& sInfo)
{
// recupero gli attributi (se non ci sono, vengono creati)
Attribs* pAttribs = GetSafeAttribs() ;
if ( pAttribs == nullptr)
// verifico esistenza (con eventuale creazione) degli attributi
if ( GetSafeAttribs() == nullptr)
return false ;
// assegno il nome
return pAttribs->SetInfo( sKey, sInfo) ;
return m_pAttribs->SetInfo( sKey, sInfo) ;
}
//----------------------------------------------------------------------------