EgtGeomKernel 1.5j6 :
- corretta e migliorata gestione ID delle entità.
This commit is contained in:
+16
-8
@@ -14,6 +14,7 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "GdbGroup.h"
|
||||
#include "GeomDB.h"
|
||||
#include "IdManager.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
@@ -39,16 +40,16 @@ GdbGroup::~GdbGroup( void)
|
||||
bool
|
||||
GdbGroup::Clear( void)
|
||||
{
|
||||
// disalloco gli oggetti
|
||||
// disalloco gli oggetti (dal fondo)
|
||||
GdbObj* pObj ;
|
||||
pObj = GetFirstObj() ;
|
||||
pObj = GetLastObj() ;
|
||||
while ( pObj != nullptr) {
|
||||
// lo rimuovo dalla lista
|
||||
pObj->Remove() ;
|
||||
// lo disalloco
|
||||
delete pObj ;
|
||||
// passo al nuovo primo
|
||||
pObj = GetFirstObj() ;
|
||||
// passo al nuovo ultimo
|
||||
pObj = GetLastObj() ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -56,8 +57,12 @@ GdbGroup::Clear( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GdbGroup*
|
||||
GdbGroup::Clone( int nId, IdManager& IdMgr) const
|
||||
GdbGroup::Clone( int nId) const
|
||||
{
|
||||
// verifico validità riferimento a DB geometrico
|
||||
if ( m_pGDB == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
// alloco gruppo Gdb
|
||||
GdbGroup* pGdbGroup = new(nothrow) GdbGroup ;
|
||||
if ( pGdbGroup == nullptr)
|
||||
@@ -68,7 +73,10 @@ GdbGroup::Clone( int nId, IdManager& IdMgr) const
|
||||
|
||||
// assegno nuovo Id
|
||||
pGdbGroup->m_nId = nId ;
|
||||
IdMgr.UpdateMaxId( nId) ;
|
||||
m_pGDB->m_IdManager.UpdateMaxId( nId) ;
|
||||
|
||||
// assegno il riferimento al DB geometrico
|
||||
pGdbGroup->SetGeomDB( m_pGDB) ;
|
||||
|
||||
// copio dati gruppo
|
||||
pGdbGroup->m_frF = m_frF ;
|
||||
@@ -77,7 +85,7 @@ GdbGroup::Clone( int nId, IdManager& IdMgr) const
|
||||
const GdbObj* pObj = GetFirstObj() ;
|
||||
while ( pObj != nullptr) {
|
||||
// eseguo copia
|
||||
GdbObj* pNewObj = pObj->Clone( IdMgr.GetNewId(), IdMgr) ;
|
||||
GdbObj* pNewObj = pObj->Clone( m_pGDB->m_IdManager.GetNewId()) ;
|
||||
if ( pNewObj == nullptr) {
|
||||
delete pGdbGroup ;
|
||||
return nullptr ;
|
||||
@@ -89,7 +97,7 @@ GdbGroup::Clone( int nId, IdManager& IdMgr) const
|
||||
return nullptr ;
|
||||
}
|
||||
// lo inserisco nella mappa degli Id
|
||||
if ( ! IdMgr.AddObj( pNewObj->m_nId, pNewObj)) {
|
||||
if ( ! m_pGDB->m_IdManager.AddObj( pNewObj->m_nId, pNewObj)) {
|
||||
delete pGdbGroup ;
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user