3908e11d18
- modifiche per permettere Mark di tipo 2.
1784 lines
51 KiB
C++
1784 lines
51 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2013
|
|
//----------------------------------------------------------------------------
|
|
// File : GdbIterator.cpp Data : 04.12.13 Versione : 1.4a3
|
|
// Contenuto : Implementazione della classe GdbIterator.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 04.12.13 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "GdbIterator.h"
|
|
#include "Attribs.h"
|
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
#include <new>
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
IGdbIterator*
|
|
CreateGdbIterator( IGeomDB* pGDB)
|
|
{
|
|
if ( static_cast<GeomDB*>( pGDB) == nullptr)
|
|
return nullptr ;
|
|
return static_cast<IGdbIterator*> ( new( nothrow) GdbIterator( pGDB)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// GdbIterator
|
|
//----------------------------------------------------------------------------
|
|
GdbIterator::GdbIterator( IGeomDB* pGDB)
|
|
{
|
|
if ( pGDB != nullptr)
|
|
SetGDB( pGDB) ;
|
|
else
|
|
m_pGDB = nullptr ;
|
|
|
|
m_pCurrObj = nullptr ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
GdbIterator::~GdbIterator( void)
|
|
{
|
|
if ( m_pGDB != nullptr)
|
|
m_pGDB->RemoveGdbIteratorFromList( this) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetGDB( IGeomDB* pGDB)
|
|
{
|
|
m_pGDB = static_cast<GeomDB*>( pGDB) ;
|
|
if ( m_pGDB == nullptr)
|
|
return false ;
|
|
|
|
return m_pGDB->AddGdbIteratorToList( this) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoTo( int nId)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
m_pCurrObj = m_pGDB->GetGdbObj( nId) ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToFirstInGroup( int nIdGroup)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = m_pGDB->GetGdbGroup( nIdGroup) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetFirstObj() ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToFirstInGroup( const IGdbIterator& iIter)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = GetGdbGroup( pIter->m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetFirstObj() ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToNext( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToLastInGroup( int nIdGroup)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = m_pGDB->GetGdbGroup( nIdGroup) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetLastObj() ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToLastInGroup( const IGdbIterator& iIter)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = GetGdbGroup( pIter->m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetLastObj() ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToPrev( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::EraseAndGoToNext( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// passo al successivo
|
|
GdbObj* pObjToErase = m_pCurrObj ;
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
// eseguo cancellazione
|
|
m_pGDB->Erase( pObjToErase) ;
|
|
return ( m_pCurrObj != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::EraseAndGoToPrev( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// passo al precedente
|
|
GdbObj* pObjToErase = m_pCurrObj ;
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
// eseguo cancellazione
|
|
m_pGDB->Erase( pObjToErase) ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToFirstNameInGroup( int nIdGroup, const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = m_pGDB->GetGdbGroup( nIdGroup) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetFirstObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToFirstNameInGroup( const IGdbIterator& iIter, const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// converto in oggetto iteratore di base
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = GetGdbGroup( pIter->m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetFirstObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToNextName( const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// ciclo fino al prossimo gruppo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToLastNameInGroup( int nIdGroup, const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = m_pGDB->GetGdbGroup( nIdGroup) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetLastObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToLastNameInGroup( const IGdbIterator& iIter, const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// converto in oggetto iteratore di base
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = GetGdbGroup( pIter->m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetLastObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToPrevName( const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// ciclo fino al precedente gruppo
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::EraseAndGoToNextName( const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// passo al successivo
|
|
GdbObj* pObjToErase = m_pCurrObj ;
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
// eseguo cancellazione
|
|
m_pGDB->Erase( pObjToErase) ;
|
|
// se corrente non gruppo, passo al successivo gruppo
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::EraseAndGoToPrevName( const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// passo al precedente
|
|
GdbObj* pObjToErase = m_pCurrObj ;
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
// eseguo cancellazione
|
|
m_pGDB->Erase( pObjToErase) ;
|
|
// se corrente non gruppo, passo al precedente gruppo
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se ha il nome cercato
|
|
string sObjName ;
|
|
if ( m_pCurrObj->GetName( sObjName) && sObjName == sName)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToFirstGroupInGroup( int nIdGroup)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = m_pGDB->GetGdbGroup( nIdGroup) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetFirstObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToFirstGroupInGroup( const IGdbIterator& iIter)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// converto in oggetto iteratore di base
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = GetGdbGroup( pIter->m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetFirstObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToNextGroup( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// ciclo fino al prossimo gruppo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToLastGroupInGroup( int nIdGroup)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = m_pGDB->GetGdbGroup( nIdGroup) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetLastObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToLastGroupInGroup( const IGdbIterator& iIter)
|
|
{
|
|
if ( m_pGDB == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// converto in oggetto iteratore di base
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero il gruppo
|
|
GdbGroup* pGdbGroup = GetGdbGroup( pIter->m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr) {
|
|
m_pCurrObj = nullptr ;
|
|
return false ;
|
|
}
|
|
// recupero l'oggetto
|
|
m_pCurrObj = pGdbGroup->GetLastObj() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GoToPrevGroup( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// ciclo fino al precedente gruppo
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::EraseAndGoToNextGroup( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// passo al successivo
|
|
GdbObj* pObjToErase = m_pCurrObj ;
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
// eseguo cancellazione
|
|
m_pGDB->Erase( pObjToErase) ;
|
|
// se corrente non gruppo, passo al successivo gruppo
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al successivo
|
|
m_pCurrObj = m_pCurrObj->GetNext() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::EraseAndGoToPrevGroup( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// passo al precedente
|
|
GdbObj* pObjToErase = m_pCurrObj ;
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
// eseguo cancellazione
|
|
m_pGDB->Erase( pObjToErase) ;
|
|
// se corrente non gruppo, passo al precedente gruppo
|
|
while ( m_pCurrObj != nullptr) {
|
|
// se di tipo gruppo
|
|
if ( GetGdbGroup( m_pCurrObj) != nullptr)
|
|
return true ;
|
|
// passo al precedente
|
|
m_pCurrObj = m_pCurrObj->GetPrev() ;
|
|
}
|
|
// non trovato
|
|
return false ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
GdbIterator::GetGdbType( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return GDB_TY_NONE ;
|
|
return m_pCurrObj->GetGdbType() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
GdbIterator::GetGeoType( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return GEO_NONE ;
|
|
if ( GetGdbGeo( m_pCurrObj) != nullptr)
|
|
return GetGdbGeo( m_pCurrObj)->GetGeoType() ;
|
|
else
|
|
return GEO_NONE ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
IGeoObj*
|
|
GdbIterator::GetGeoObj( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return nullptr ;
|
|
|
|
// recupero l'oggetto Gdb
|
|
GdbGeo* pGdbGeo = GetGdbGeo( m_pCurrObj) ;
|
|
if ( pGdbGeo == nullptr)
|
|
return nullptr ;
|
|
|
|
// restituisco il suo contenuto geometrico
|
|
return pGdbGeo->m_pGeoObj ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const IGeoObj*
|
|
GdbIterator::GetGeoObj( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return nullptr ;
|
|
|
|
// recupero l'oggetto Gdb
|
|
const GdbGeo* pGdbGeo = GetGdbGeo( m_pCurrObj) ;
|
|
if ( pGdbGeo == nullptr)
|
|
return nullptr ;
|
|
|
|
// restituisco il suo contenuto geometrico
|
|
return pGdbGeo->m_pGeoObj ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
Frame3d*
|
|
GdbIterator::GetGroupFrame( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return nullptr ;
|
|
|
|
GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return nullptr ;
|
|
|
|
return &( pGdbGroup->GetFrame()) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const Frame3d*
|
|
GdbIterator::GetGroupFrame( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return nullptr ;
|
|
|
|
const GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return nullptr ;
|
|
|
|
return &( pGdbGroup->GetFrame()) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetGroupFrame( Frame3d& frGlob) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
const GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
|
|
// copio il riferimento
|
|
frGlob = pGdbGroup->GetFrame() ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetGroupGlobFrame( Frame3d& frGlob) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
const GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
|
|
return pGdbGroup->GetGlobFrame( frGlob) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
GdbIterator::GetGroupObjs( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return 0 ;
|
|
|
|
const GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return 0 ;
|
|
|
|
// restituisco il numero di nodi (figli)
|
|
return pGdbGroup->GetObjCount() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
GdbIterator::GetId( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return GDB_ID_NULL ;
|
|
|
|
return m_pCurrObj->m_nId ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
GdbIterator::GetParentId( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return GDB_ID_NULL ;
|
|
|
|
return m_pCurrObj->GetParentId() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetGlobFrame( Frame3d& frGlob) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// eseguo l'operazione
|
|
const GdbGroup* pGdbGroup = m_pCurrObj->GetParent() ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
|
|
return pGdbGroup->GetGlobFrame( frGlob) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// eseguo l'operazione
|
|
return m_pCurrObj->GetLocalBBox( b3Loc, nFlag) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetGlobalBBox( BBox3d& b3Glob, int nFlag) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il riferimento globale del gruppo cui appartiene
|
|
Frame3d frGlob ;
|
|
if ( ! GetGlobFrame( frGlob))
|
|
return false ;
|
|
|
|
// eseguo l'operazione
|
|
return m_pCurrObj->GetBBox( frGlob, b3Glob, nFlag) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetRefBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il riferimento globale del gruppo cui appartiene
|
|
Frame3d frGlob ;
|
|
if ( ! GetGlobFrame( frGlob))
|
|
return false ;
|
|
|
|
// lo porto nel riferimento passato
|
|
frGlob.ToLoc( frRef) ;
|
|
|
|
// eseguo l'operazione
|
|
return m_pCurrObj->GetBBox( frGlob, b3Ref, nFlag) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::Translate( const Vector3d& vtMove)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// eseguo la traslazione
|
|
return m_pCurrObj->Translate( vtMove) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::TranslateGlob( const Vector3d& vtMove)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// recupero il riferimento in cui � immerso l'oggetto
|
|
Frame3d frObj ;
|
|
if ( ! GetGlobFrame( frObj))
|
|
return false ;
|
|
// porto il movimento in locale
|
|
Vector3d vtMoveLoc = vtMove ;
|
|
if ( ! vtMoveLoc.ToLoc( frObj))
|
|
return false ;
|
|
// eseguo la traslazione
|
|
return m_pCurrObj->Translate( vtMoveLoc) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::TranslateGroup( const Vector3d& vtMove)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// deve essere un gruppo di cui utilizzo il riferimento proprio
|
|
GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
// porto il movimento in questo nel riferimento in cui � immerso il gruppo
|
|
Vector3d vtMoveLoc = vtMove ;
|
|
if ( ! vtMoveLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
// eseguo la traslazione
|
|
return m_pCurrObj->Translate( vtMoveLoc) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// eseguo la rotazione
|
|
return m_pCurrObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RotateGlob( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// recupero il riferimento in cui � immerso l'oggetto
|
|
Frame3d frObj ;
|
|
if ( ! GetGlobFrame( frObj))
|
|
return false ;
|
|
// porto i parametri di rotazione in locale
|
|
Point3d ptAxLoc = ptAx ;
|
|
if ( ! ptAxLoc.ToLoc( frObj))
|
|
return false ;
|
|
Vector3d vtAxLoc = vtAx ;
|
|
if ( ! vtAxLoc.ToLoc( frObj))
|
|
return false ;
|
|
// eseguo la rotazione
|
|
return m_pCurrObj->Rotate( ptAxLoc, vtAxLoc, dCosAng, dSinAng) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RotateGroup( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// deve essere un gruppo di cui utilizzo il riferimento proprio
|
|
GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
// porto i parametri di rotazione nel riferimento in cui � immerso il gruppo
|
|
Point3d ptAxLoc = ptAx ;
|
|
if ( ! ptAxLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
Vector3d vtAxLoc = vtAx ;
|
|
if ( ! vtAxLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
// eseguo la rotazione
|
|
return m_pCurrObj->Rotate( ptAxLoc, vtAxLoc, dCosAng, dSinAng) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// eseguo la scalatura
|
|
return m_pCurrObj->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ScaleGlob( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// recupero il riferimento in cui � immerso l'oggetto
|
|
Frame3d frObj ;
|
|
if ( ! GetGlobFrame( frObj))
|
|
return false ;
|
|
// porto il riferimento di scalatura in locale
|
|
Frame3d frRefLoc = frRef ;
|
|
if ( ! frRefLoc.ToLoc( frObj))
|
|
return false ;
|
|
// eseguo la scalatura
|
|
return m_pCurrObj->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ScaleGroup( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// deve essere un gruppo di cui utilizzo il riferimento proprio
|
|
GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
// porto il riferimento di scalatura nel riferimento in cui � immerso il gruppo
|
|
Frame3d frRefLoc = frRef ;
|
|
if ( ! frRefLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
// eseguo la scalatura
|
|
return m_pCurrObj->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// eseguo la specchiatura
|
|
return m_pCurrObj->Mirror( ptOn, vtNorm) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::MirrorGlob( const Point3d& ptOn, const Vector3d& vtNorm)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// recupero il riferimento in cui � immerso l'oggetto
|
|
Frame3d frObj ;
|
|
if ( ! GetGlobFrame( frObj))
|
|
return false ;
|
|
// porto i parametri di mirror in locale
|
|
Point3d ptOnLoc = ptOn ;
|
|
if ( ! ptOnLoc.ToLoc( frObj))
|
|
return false ;
|
|
Vector3d vtNormLoc = vtNorm ;
|
|
if ( ! vtNormLoc.ToLoc( frObj))
|
|
return false ;
|
|
// eseguo la specchiatura
|
|
return m_pCurrObj->Mirror( ptOnLoc, vtNormLoc) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::MirrorGroup( const Point3d& ptOn, const Vector3d& vtNorm)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// deve essere un gruppo di cui utilizzo il riferimento proprio
|
|
GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
// porto i parametri di mirror nel riferimento in cui � immerso il gruppo
|
|
Point3d ptOnLoc = ptOn ;
|
|
if ( ! ptOnLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
Vector3d vtNormLoc = vtNorm ;
|
|
if ( ! vtNormLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
// eseguo la specchiatura
|
|
return m_pCurrObj->Mirror( ptOnLoc, vtNormLoc) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// eseguo la deformazione
|
|
return m_pCurrObj->Shear( ptOn, vtNorm, vtDir, dCoeff) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ShearGlob( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// recupero il riferimento in cui � immerso l'oggetto
|
|
Frame3d frObj ;
|
|
if ( ! GetGlobFrame( frObj))
|
|
return false ;
|
|
// porto i parametri di shear in locale
|
|
Point3d ptOnLoc = ptOn ;
|
|
if ( ! ptOnLoc.ToLoc( frObj))
|
|
return false ;
|
|
Vector3d vtNormLoc = vtNorm ;
|
|
if ( ! vtNormLoc.ToLoc( frObj))
|
|
return false ;
|
|
Vector3d vtDirLoc = vtDir ;
|
|
if ( ! vtDirLoc.ToLoc( frObj))
|
|
return false ;
|
|
// eseguo la deformazione
|
|
return m_pCurrObj->Shear( ptOnLoc, vtNormLoc, vtDirLoc, dCoeff) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ShearGroup( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr || m_pCurrObj->m_nId == GDB_ID_ROOT)
|
|
return false ;
|
|
|
|
// deve essere un gruppo di cui utilizzo il riferimento proprio
|
|
GdbGroup* pGdbGroup = GetGdbGroup( m_pCurrObj) ;
|
|
if ( pGdbGroup == nullptr)
|
|
return false ;
|
|
// porto i parametri di shear nel riferimento in cui � immerso il gruppo
|
|
Point3d ptOnLoc = ptOn ;
|
|
if ( ! ptOnLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
Vector3d vtNormLoc = vtNorm ;
|
|
if ( ! vtNormLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
Vector3d vtDirLoc = vtDir ;
|
|
if ( ! vtDirLoc.ToGlob( pGdbGroup->GetFrame()))
|
|
return false ;
|
|
// eseguo la deformazione
|
|
return m_pCurrObj->Shear( ptOnLoc, vtNormLoc, vtDirLoc, dCoeff) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Attributes
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetLevel( int nLevel)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno il livello
|
|
return m_pCurrObj->SetLevel( nLevel) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RevertLevel( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// ripristino il livello precedente
|
|
return m_pCurrObj->RevertLevel() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetLevel( int& nLevel) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il livello
|
|
return m_pCurrObj->GetLevel( nLevel) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcLevel( int& nLevel) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il livello calcolato
|
|
return m_pCurrObj->GetCalcLevel( nLevel) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetMode( int nMode)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno il modo
|
|
return m_pCurrObj->SetMode( nMode) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RevertMode( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// ripristino il modo precedente
|
|
return m_pCurrObj->RevertMode() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetMode( int& nMode) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il modo
|
|
return m_pCurrObj->GetMode( nMode) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcMode( int& nMode) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il modo calcolato
|
|
return m_pCurrObj->GetCalcMode( nMode) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetStatus( int nStat)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// la funzione chiamata gestisce l'aggiornamento della lista dei selezionati
|
|
return m_pGDB->SetStatus( m_pCurrObj, nStat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RevertStatus( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// la funzione chiamata gestisce l'aggiornamento della lista dei selezionati
|
|
return m_pGDB->RevertStatus( m_pCurrObj) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetStatus( int& nStat) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero lo stato
|
|
return m_pCurrObj->GetStatus( nStat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcStatus( int& nStat) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero lo stato calcolato
|
|
return m_pCurrObj->GetCalcStatus( nStat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetMark( int nMark)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// imposto la marcatura
|
|
return m_pCurrObj->SetMark( nMark) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ResetMark( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// cancello la marcatura
|
|
return m_pCurrObj->ResetMark() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetMark( int& nMark) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero la marcatura
|
|
return m_pCurrObj->GetMark( nMark) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcMark( int& nMark) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero la marcatura calcolata
|
|
return m_pCurrObj->GetCalcMark( nMark) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetMaterial( int nMat)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno il materiale tramite indice
|
|
return m_pGDB->SetMaterial( m_pCurrObj, nMat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetMaterial( int nMat, const string& sMatName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno il materiale tramite nome
|
|
return m_pGDB->SetMaterial( m_pCurrObj, sMatName) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetMaterial( Color cCol)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno il materiale tramite colore
|
|
return m_pCurrObj->SetMaterial( cCol) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetMaterial( int& nMat) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero l'indice del materiale
|
|
return m_pCurrObj->GetMaterial( nMat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetMaterial( Material& mMat) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il materiale
|
|
return m_pGDB->GetMaterial( m_pCurrObj, mMat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetMaterial( Color& cCol) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il colore del materiale
|
|
return m_pCurrObj->GetMaterial( cCol) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcMaterial( int& nMat) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero l'indice del materiale calcolato
|
|
return m_pCurrObj->GetCalcMaterial( nMat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcMaterial( Material& mMat) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il materiale
|
|
return m_pGDB->GetCalcMaterial( m_pCurrObj, mMat) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetCalcMaterial( Color& cCol) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il colore del materiale calcolato
|
|
return m_pCurrObj->GetCalcMaterial( cCol) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetName( const string& sName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno il nome
|
|
return m_pCurrObj->SetName( sName) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetName( string& sName) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero il nome
|
|
return m_pCurrObj->GetName( sName) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ExistsName( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// verifico esistenza del nome
|
|
return m_pCurrObj->ExistsName() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RemoveName( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// rimuovo il nome
|
|
return m_pCurrObj->RemoveName() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const string& sInfo)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// assegno l'Info
|
|
return m_pCurrObj->SetInfo( sKey, sInfo) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, bool bInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( bInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, int nInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( nInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, double dInfo)
|
|
{
|
|
int nErr ;
|
|
return ( SetInfo( sKey, ToString( dInfo, 6, &nErr)) && nErr == 0) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const Point3d& ptInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( ptInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const Vector3d& vtInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( vtInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const Frame3d& frInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( frInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const INTVECTOR& vnInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( vnInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const DBLVECTOR& vdInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( vdInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetInfo( const string& sKey, const STRVECTOR& vsInfo)
|
|
{
|
|
return SetInfo( sKey, ToString( vsInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, string& sInfo) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero l'Info
|
|
return m_pCurrObj->GetInfo( sKey, sInfo) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, bool& bInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, bInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, int& nInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, nInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, double& dInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, dInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, Point3d& ptInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, ptInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, Vector3d& vtInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, vtInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, Frame3d& frInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, frInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, INTVECTOR& vnInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, vnInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, DBLVECTOR& vdInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, vdInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetInfo( const string& sKey, STRVECTOR& vsInfo) const
|
|
{
|
|
string sInfo ;
|
|
return ( GetInfo( sKey, sInfo) && FromString( sInfo, vsInfo)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::ExistsInfo( const string& sKey) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// verifico l'esistenza dell'Info
|
|
return m_pCurrObj->ExistsInfo( sKey) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RemoveInfo( const string& sKey)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// rimuovo l'Info
|
|
return m_pCurrObj->RemoveInfo( sKey) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetAllInfo( STRVECTOR& vsInfo) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero tutte le Info
|
|
return m_pCurrObj->GetAllInfo( vsInfo) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::CopyAllInfoFrom( const IGdbIterator& iIter)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// recupero l'oggetto sorgente
|
|
const GdbIterator* pIter = static_cast<const GdbIterator*> (&iIter) ;
|
|
if ( pIter == nullptr || pIter->m_pGDB != m_pGDB || pIter->m_pCurrObj == nullptr)
|
|
return false ;
|
|
const GdbObj* pGdbObjSou = pIter->m_pCurrObj ;
|
|
|
|
// copio tutte le Info
|
|
if ( m_pCurrObj != pGdbObjSou && pGdbObjSou->m_pAttribs != nullptr) {
|
|
m_pCurrObj->GetSafeAttribs() ;
|
|
return ( m_pCurrObj->m_pAttribs != nullptr && m_pCurrObj->m_pAttribs->CopyAllInfoFrom( *(pGdbObjSou->m_pAttribs))) ;
|
|
}
|
|
else
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Stipple (significativo solo per curve)
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetStipple( int nFactor, int nPattern)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// imposto lo stipple
|
|
return m_pCurrObj->SetStipple( nFactor, nPattern) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetStipple( int& nFactor, int& nPattern) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// recupero lo stipple
|
|
return m_pCurrObj->GetStipple( nFactor, nPattern) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// TextureData
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetTextureName( const string& sTxrName)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// imposto il nome della texture
|
|
return m_pCurrObj->SetTextureName( sTxrName) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetTextureFrame( const Frame3d& frTxrRef)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// imposto il nome della texture
|
|
return m_pCurrObj->SetTextureFrame( frTxrRef) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RemoveTextureData( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// rimuovo i dati della texture
|
|
return m_pCurrObj->RemoveTextureData() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetTextureName( string& sTxrName) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// recupero il nome della texture
|
|
return m_pCurrObj->GetTextureName( sTxrName) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::GetTextureFrame( Frame3d& frTxrRef) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
// recupero il riferimento della texture
|
|
return m_pCurrObj->GetTextureFrame( frTxrRef) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// UserObj
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::SetUserObj( IUserObj* pUserObj)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// cancello eventuale precedente UserObj
|
|
if ( m_pCurrObj->m_pUserObj != nullptr)
|
|
delete m_pCurrObj->m_pUserObj ;
|
|
|
|
// assegno nuovo UserObj
|
|
if ( pUserObj != nullptr)
|
|
pUserObj->SetOwner( m_pCurrObj->m_nId, m_pGDB) ;
|
|
m_pCurrObj->m_pUserObj = pUserObj ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
IUserObj*
|
|
GdbIterator::GetUserObj( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return nullptr ;
|
|
// restituisco il puntatore a IUserObj
|
|
return m_pCurrObj->m_pUserObj ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const IUserObj*
|
|
GdbIterator::GetUserObj( void) const
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return nullptr ;
|
|
// restituisco il puntatore a IUserObj
|
|
return m_pCurrObj->m_pUserObj ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GdbIterator::RemoveUserObj( void)
|
|
{
|
|
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
|
return false ;
|
|
|
|
// cancello eventuale precedente UserObj
|
|
if ( m_pCurrObj->m_pUserObj != nullptr)
|
|
delete m_pCurrObj->m_pUserObj ;
|
|
// reset puntatore a UserObj
|
|
m_pCurrObj->m_pUserObj = nullptr ;
|
|
return true ;
|
|
}
|