diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 0e47299..bf8f5a6 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/GdbObj.cpp b/GdbObj.cpp index 9c2b377..ed9fdd3 100644 --- a/GdbObj.cpp +++ b/GdbObj.cpp @@ -67,6 +67,18 @@ GdbObj::CopyFrom( const GdbObj* pSou) // copio Id m_nId = pSou->m_nId ; + // copio gli attributi + return CopyAttribsFrom( pSou) ; +} + +//---------------------------------------------------------------------------- +bool +GdbObj::CopyAttribsFrom( const GdbObj* pSou) +{ + // se l'oggetto sorgente non esiste + if ( pSou == nullptr) + return false ; + // copio gli attributi if ( pSou->m_pAttribs != nullptr) { m_pAttribs = pSou->m_pAttribs->Clone() ; @@ -78,6 +90,12 @@ GdbObj::CopyFrom( const GdbObj* pSou) // marcatura sempre disabilitata m_pAttribs->ResetMark() ; } + // altrimenti li cancello + else { + if ( m_pAttribs != nullptr) + delete m_pAttribs ; + m_pAttribs = nullptr ; + } return true ; } diff --git a/GdbObj.h b/GdbObj.h index 6130bed..96ffe1b 100644 --- a/GdbObj.h +++ b/GdbObj.h @@ -49,6 +49,7 @@ class GdbObj public : GdbObj( void) ; bool CopyFrom( const GdbObj* pSou) ; + bool CopyAttribsFrom( const GdbObj* pSou) ; public : bool SaveAttribs( NgeWriter& ngeOut) const ; diff --git a/GeomDB.cpp b/GeomDB.cpp index 2fb706e..64e9e0a 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -1384,6 +1384,22 @@ GeomDB::DumpAttributes( int nId, string& sOut, const char* szNewLine) const } } +//---------------------------------------------------------------------------- +bool +GeomDB::CopyAttributes( int nIdSou, int nIdDest) +{ + // verifico esistenza del sorgente + GdbObj* pGdOSou = GetGdbObj( nIdSou) ; + if ( pGdOSou == nullptr) + return false ; + // verifico esistenza della destinazione + GdbObj* pGdODest = GetGdbObj( nIdDest) ; + if ( pGdODest == nullptr) + return false ; + // eseguo la copia + return pGdODest->CopyAttribsFrom( pGdOSou) ; +} + //---------------------------------------------------------------------------- bool GeomDB::SetLevel( int nId, int nLevel) diff --git a/GeomDB.h b/GeomDB.h index 650364f..3e255b1 100644 --- a/GeomDB.h +++ b/GeomDB.h @@ -108,6 +108,7 @@ class GeomDB : public IGeomDB virtual bool ClearSelection( void) ; // attributes virtual bool DumpAttributes( int nId, std::string& sOut, const char* szNewLine) const ; + virtual bool CopyAttributes( int nIdSou, int nIdDest) ; virtual bool SetLevel( int nId, int nLevel) ; virtual bool RevertLevel( int nId) ; virtual bool GetLevel( int nId, int& nLevel) const ;