//---------------------------------------------------------------------------- // EgalTech 2015-2015 //---------------------------------------------------------------------------- // File : UserObjDefault.h Data : 22.05.15 Versione : 1.6e3 // Contenuto : Oggetto di sostituzione per UserObj non trovato. // // // // Modifiche : 22.05.15 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "UserObjDefault.h" #include "/EgtDev/Include/EGkGdbConst.h" #include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGnStringUtils.h" using namespace std ; //---------------------------------------------------------------------------- USEROBJ_REGISTER( "EGkDefault", UserObjDefault) ; //---------------------------------------------------------------------------- UserObjDefault::UserObjDefault( const string& sName) { m_sName = sName ; m_nOwnerId = GDB_ID_NULL ; m_pGeomDB = nullptr ; } //---------------------------------------------------------------------------- UserObjDefault* UserObjDefault::Clone( void) const { // alloco oggetto UserObjDefault* pOUD = new( nothrow) UserObjDefault ; // eseguo copia dei dati if ( pOUD != nullptr) { try { pOUD->m_sName = m_sName ; pOUD->m_vData = m_vData ; pOUD->m_nOwnerId = GDB_ID_NULL ; pOUD->m_pGeomDB = nullptr ; } catch( ...) { delete pOUD ; return nullptr ; } } // ritorno l'oggetto return pOUD ; } //---------------------------------------------------------------------------- const string& UserObjDefault::GetClassName( void) const { return m_sName ; } //---------------------------------------------------------------------------- bool UserObjDefault::Dump( string& sOut, bool bMM, const char* szNewLine) const { sOut += "UserObj " + m_sName + "[mm]" + szNewLine ; sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ; for ( size_t i = 0 ; i < m_vData.size() ; ++ i) sOut += m_vData[i] + szNewLine ; return true ; } //---------------------------------------------------------------------------- bool UserObjDefault::Save( int nBaseId, STRVECTOR& vString) const { vString = m_vData ; return true ; } //---------------------------------------------------------------------------- bool UserObjDefault::Load( const STRVECTOR& vString, int nBaseGdbId) { m_vData = vString ; return true ; } //---------------------------------------------------------------------------- bool UserObjDefault::SetOwner( int nId, IGeomDB* pGDB) { m_nOwnerId = nId ; m_pGeomDB = pGDB ; return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ; } //---------------------------------------------------------------------------- int UserObjDefault::GetOwner( void) const { return m_nOwnerId ; } //---------------------------------------------------------------------------- IGeomDB* UserObjDefault::GetGeomDB( void) const { return m_pGeomDB ; }