EgtGeomKernel : completata gestione DB geometrico di base.

Aggiunto esecutore di comandi per script.
This commit is contained in:
Dario Sassi
2013-11-26 15:00:46 +00:00
parent 282b6dde37
commit 81a1e3d994
11 changed files with 1676 additions and 378 deletions
+116
View File
@@ -0,0 +1,116 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : GdbObj.cpp Data : 24.11.13 Versione : 1.3a1
// Contenuto : Implementazione della classe CGdbObj oggetto del DB geometrico.
//
//
//
// Modifiche : 22.01.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include <new>
#include "\EgtDev\Include\EGnStringUtils.h"
#include "GdbObj.h"
#include "GeoObjFactory.h"
using namespace std ;
//----------------------------------------------------------------------------
GdbObj::GdbObj( void)
{
m_pGeoObj = nullptr ;
}
//----------------------------------------------------------------------------
GdbObj::~GdbObj( void)
{
if ( m_pGeoObj != nullptr)
delete m_pGeoObj ;
m_pGeoObj = nullptr ;
}
//----------------------------------------------------------------------------
GdbObj*
GdbObj::Clone( void) const
{
GdbObj* pGdbObj ;
// alloco oggetto Gdb
pGdbObj = new(nothrow) GdbObj ;
if ( pGdbObj != nullptr) {
// copio dati oggetto Gdb
// ...
// copio oggetto Geo
pGdbObj->m_pGeoObj = m_pGeoObj->Clone() ;
}
return pGdbObj ;
}
//----------------------------------------------------------------------------
GeoObjType
GdbObj::GetType( void) const
{
// non esiste l'oggetto geometrico
if ( m_pGeoObj == nullptr)
return GEO_NONE ;
return m_pGeoObj->GetType() ;
}
//----------------------------------------------------------------------------
bool
GdbObj::Save( std::ostream& osOut) const
{
// tipo entità
osOut << m_pGeoObj->GetKey() << endl ;
// nome
osOut << m_sName << endl ;
// parametri geometrici
return m_pGeoObj->Save( osOut) ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::Load( CScan& TheScanner, string& sErrLine)
{
string sLine ;
STRVECTOR vsParams ;
// reset linea errata
sErrLine.clear() ;
// leggo la prossima linea : tipo di entità
if ( ! TheScanner.GetLine( sLine))
return false ;
// creo l'oggetto geometrico corrispondente
m_pGeoObj = GEOOBJ_CREATE( sLine) ;
if ( m_pGeoObj == nullptr) {
sErrLine = sLine ;
return false ;
}
// leggo la prossima linea
if ( ! TheScanner.GetLine( sLine))
return false ;
// la divido in parametri
Tokenize( sLine, ",", vsParams) ;
// 1 parametro : nome
if ( vsParams.size() != 1)
return false ;
// assegno il nome
m_sName = vsParams[0] ;
// parametri geometrici
return m_pGeoObj->Load( TheScanner) ;
}