EgtGeomKernel :

- cambiato Load, con uso di NgeReader.
This commit is contained in:
Dario Sassi
2014-04-15 06:48:39 +00:00
parent f956fd20cc
commit 2cbdfc1db9
33 changed files with 492 additions and 330 deletions
+15 -23
View File
@@ -18,6 +18,7 @@
#include "CurveAux.h"
#include "Attribs.h"
#include "NgeWriter.h"
#include "NgeReader.h"
#include "GeoObjRW.h"
#include "/EgtDev/Include/EGkGdbFunct.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -85,13 +86,13 @@ GdbGeo::GetType( void) const
bool
GdbGeo::Save( NgeWriter& ngeOut) const
{
// recupero il gestore di lettura/scrittura dell'entità
// recupero il gestore di lettura/scrittura dell'oggetto
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( m_pGeoObj) ;
if ( pGObjRW == nullptr)
return false ;
// tipo entità e identificativi
ngeOut.WriteKey( pGObjRW->GetNgeId(), true) ;
ngeOut.WriteKey( pGObjRW->GetNgeId()) ;
ngeOut.WriteInt( m_nId, "@") ;
ngeOut.WriteInt( GetParentId(), nullptr, true) ;
@@ -100,60 +101,51 @@ GdbGeo::Save( NgeWriter& ngeOut) const
return false ;
// parametri geometrici
ngeOut.WriteKey( NGE_G, true) ;
ngeOut.WriteKey( NGE_G) ;
return pGObjRW->Save( ngeOut) ;
}
//----------------------------------------------------------------------------
bool
GdbGeo::Load( const std::string& sType, Scanner& TheScanner, int& nParentId)
GdbGeo::Load( int nNgeId, NgeReader& ngeIn, int& nParentId)
{
int nType ;
string sLine ;
STRVECTOR vsParams ;
// creo l'oggetto geometrico corrispondente
nType = GEOOBJ_KEYTOTYPE( sType) ;
int nType = GEOOBJ_NGEIDTOTYPE( nNgeId) ;
m_pGeoObj = GEOOBJ_CREATE( nType) ;
if ( m_pGeoObj == nullptr)
return false ;
// leggo la prossima linea
if ( ! TheScanner.GetLine( sLine))
if ( ! ngeIn.ReadInt( m_nId, "@"))
return false ;
// la divido in parametri
Tokenize( sLine, "@", vsParams) ;
// 2 parametri : Id e ParentId
if ( vsParams.size() != 2)
return false ;
// assegno l'identificativo
if ( ! FromString( vsParams[0], m_nId))
return false ;
// assegno l'Id del padre
if ( ! FromString( vsParams[1], nParentId))
if ( ! ngeIn.ReadInt( nParentId, nullptr, true))
return false ;
// leggo la prossima linea
if ( ! TheScanner.GetLine( sLine))
int nKey ;
if ( ! ngeIn.ReadKey( nKey))
return false ;
// eventuali attributi
if ( sLine == "A") {
if ( ! GdbObj::LoadAttribs( TheScanner))
if ( nKey == NGE_A) {
if ( ! GdbObj::LoadAttribs( ngeIn))
return false ;
// leggo la prossima linea
if ( ! TheScanner.GetLine( sLine))
if ( ! ngeIn.ReadKey( nKey))
return false ;
}
// verifico inizio dati geometrici
if ( sLine != "G")
if ( nKey != NGE_G)
return false ;
// parametri geometrici
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( m_pGeoObj) ;
return ( pGObjRW != nullptr && pGObjRW->Load( TheScanner)) ;
return ( pGObjRW != nullptr && pGObjRW->Load( ngeIn)) ;
}
//----------------------------------------------------------------------------