EgtGeomKernel :
- cambiato Load, con uso di NgeReader.
This commit is contained in:
+12
-18
@@ -17,6 +17,7 @@
|
||||
#include "GeoConst.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
@@ -290,12 +291,12 @@ CurveComposite::Save( NgeWriter& ngeOut) const
|
||||
int i = 0 ;
|
||||
const ICurve* pCrvSmpl = GetFirstCurve() ;
|
||||
while ( pCrvSmpl != nullptr) {
|
||||
// recupero il gestore di lettura/scrittura dell'entità
|
||||
// recupero il gestore di lettura/scrittura delle curve
|
||||
const IGeoObjRW* pCSmplRW = dynamic_cast<const IGeoObjRW*>( pCrvSmpl) ;
|
||||
if ( pCSmplRW == nullptr)
|
||||
return false ;
|
||||
// emetto tipo della curva semplice
|
||||
ngeOut.WriteKey( pCSmplRW->GetNgeId(), true) ;
|
||||
ngeOut.WriteKey( pCSmplRW->GetNgeId()) ;
|
||||
// assegno ed emetto nome della curva semplice
|
||||
string sCrvName = "#" + ToString( ++i) ;
|
||||
ngeOut.WriteString( sCrvName, nullptr, true) ;
|
||||
@@ -311,39 +312,32 @@ CurveComposite::Save( NgeWriter& ngeOut) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::Load( Scanner& TheScanner)
|
||||
CurveComposite::Load( NgeReader& ngeIn)
|
||||
{
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
// leggo la prossima linea
|
||||
string sLine ;
|
||||
if ( ! TheScanner.GetLine( sLine))
|
||||
return false ;
|
||||
// la divido in parametri
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sLine, ",", vsParams) ;
|
||||
// 1 parametro : numero di curve componenti
|
||||
if ( vsParams.size() != 1)
|
||||
return false ;
|
||||
// leggo la prossima linea ( 1 parametro)
|
||||
// recupero il numero di curve componenti
|
||||
int nCounter ;
|
||||
if ( ! FromString( vsParams[0], nCounter))
|
||||
if ( ! ngeIn.ReadInt( nCounter, nullptr, true))
|
||||
return false ;
|
||||
// leggo le curve componenti
|
||||
for ( int i = 0 ; i < nCounter ; ++ i) {
|
||||
// recupero la prossima linea (con il tipo di oggetto)
|
||||
if ( ! TheScanner.GetLine( sLine))
|
||||
int nNgeId ;
|
||||
if ( ! ngeIn.ReadKey( nNgeId))
|
||||
return false ;
|
||||
// creo l'oggetto
|
||||
int nType = GEOOBJ_KEYTOTYPE( sLine) ;
|
||||
int nType = GEOOBJ_NGEIDTOTYPE( nNgeId) ;
|
||||
IGeoObj* pGeoO = GEOOBJ_CREATE( nType) ;
|
||||
if ( pGeoO == nullptr)
|
||||
return false ;
|
||||
// recupero la linea con il nome
|
||||
bool bOk = TheScanner.GetLine( sLine) ;
|
||||
string sName ;
|
||||
bool bOk = ngeIn.ReadString( sName, nullptr, true) ;
|
||||
// ne leggo i dati
|
||||
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( pGeoO) ;
|
||||
bOk = bOk && ( pGObjRW != nullptr && pGObjRW->Load( TheScanner)) ;
|
||||
bOk = bOk && ( pGObjRW != nullptr && pGObjRW->Load( ngeIn)) ;
|
||||
// verifico sia una curva
|
||||
ICurve* pCrv = ::GetCurve( pGeoO) ;
|
||||
bOk = bOk && ( pCrv != nullptr && pCrv->IsSimple()) ;
|
||||
|
||||
Reference in New Issue
Block a user