Files
EgtGeomKernel/ObjUserDefault.cpp
T
Dario Sassi b5e1e40a05 EgtGeomKernel :
- a Frame3d aggiunto Set con angolidi eulero (CAC')
- corretta geometria da disegnare per vettore nullo
- ObjUser ora ha anche puntatore a GeomDB.
2015-05-31 14:04:45 +00:00

112 lines
3.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : ObjUserDefault.h Data : 22.05.15 Versione : 1.6e3
// Contenuto : Oggetto di sostituzione per ObjUser non trovato.
//
//
//
// Modifiche : 22.05.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "ObjUserDefault.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkObjUserFactory.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//----------------------------------------------------------------------------
OBJUSER_REGISTER( "EGkDefault", ObjUserDefault) ;
//----------------------------------------------------------------------------
ObjUserDefault::ObjUserDefault( const string& sName)
{
m_sName = sName ;
m_nOwnerId = GDB_ID_NULL ;
m_pGeomDB = nullptr ;
}
//----------------------------------------------------------------------------
ObjUserDefault*
ObjUserDefault::Clone( void) const
{
// alloco oggetto
ObjUserDefault* pOUD = new(nothrow) ObjUserDefault ;
// 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 std::string&
ObjUserDefault::GetClassName( void) const
{
return m_sName ;
}
//----------------------------------------------------------------------------
bool
ObjUserDefault::Dump( std::string& sOut, const char* szNewLine) const
{
sOut += "ObjUser " + m_sName + 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
ObjUserDefault::Save( STRVECTOR& vString) const
{
vString = m_vData ;
return true ;
}
//----------------------------------------------------------------------------
bool
ObjUserDefault::Load( const STRVECTOR& vString)
{
m_vData = vString ;
return true ;
}
//----------------------------------------------------------------------------
bool
ObjUserDefault::SetOwner( int nId, IGeomDB* pGDB)
{
m_nOwnerId = nId ;
m_pGeomDB = pGDB ;
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
}
//----------------------------------------------------------------------------
int
ObjUserDefault::GetOwner( void) const
{
return m_nOwnerId ;
}
//----------------------------------------------------------------------------
IGeomDB*
ObjUserDefault::GetGeomDB( void) const
{
return m_pGeomDB ;
}