From 4c68e362190ed290cd7af686d708e280b04dd57f Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 5 Nov 2014 17:00:05 +0000 Subject: [PATCH] EgtGeomKernel 1.5j7 : - aggiunta gestione copia attributi di oggetti. --- EgtGeomKernel.rc | Bin 11718 -> 11718 bytes GdbObj.cpp | 18 ++++++++++++++++++ GdbObj.h | 1 + GeomDB.cpp | 16 ++++++++++++++++ GeomDB.h | 1 + 5 files changed, 36 insertions(+) diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 0e47299c4b2625ab198bc3681f3e398218897666..bf8f5a689439152ffe9edc920e5ce43fbe42c448 100644 GIT binary patch delta 105 zcmX>WeJpyz4>m^g&A0i^Gfl4H(wY20QjO7k@qhsjGHHLdohEhZGjY6*g$9n S3%UqUVUILaAr^DCaRUISOCuft delta 105 zcmX>WeJpyz4>m@#&A0i^Gfl4H(wY20QjO7U@qhsjGHHLdohEhZGjY6*g$9n S3%UqUVUILaAr^DCaRUIQpCc9k 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 ;