EgtGeomKernel 1.5d5 :
- aggiunta scrittura binaria - tolte GetKey, Load e Save da interfaccia IGeoObj.
This commit is contained in:
+23
-10
@@ -16,6 +16,7 @@
|
||||
#include "CurveComposite.h"
|
||||
#include "GeoConst.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
@@ -25,7 +26,7 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GEOOBJ_REGISTER( CRV_COMPO, "C_CMP", CurveComposite) ;
|
||||
GEOOBJ_REGISTER( CRV_COMPO, NGE_C_CMP, CurveComposite) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
CurveComposite::CurveComposite( void)
|
||||
@@ -235,6 +236,13 @@ CurveComposite::Copy( const CurveComposite& ccSrc)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GeoObjType
|
||||
CurveComposite::GetType( void) const
|
||||
{
|
||||
return static_cast<GeoObjType>( GEOOBJ_GETTYPE( CurveComposite)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
CurveComposite::GetTitle( void) const
|
||||
@@ -266,29 +274,33 @@ CurveComposite::Dump( string& sOut, const char* szNewLine) const
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
CurveComposite::GetKey( void) const
|
||||
int
|
||||
CurveComposite::GetNgeId( void) const
|
||||
{
|
||||
return GEOOBJ_GETKEY( CurveComposite) ;
|
||||
return GEOOBJ_GETNGEID( CurveComposite) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::Save( ostream& osOut) const
|
||||
CurveComposite::Save( NgeWriter& ngeOut) const
|
||||
{
|
||||
// numero di curve
|
||||
osOut << ToString( m_nCounter) << endl ;
|
||||
ngeOut.WriteInt( m_nCounter, nullptr, true) ;
|
||||
// ciclo sulle curve componenti
|
||||
int i = 0 ;
|
||||
const ICurve* pCrvSmpl = GetFirstCurve() ;
|
||||
while ( pCrvSmpl != nullptr) {
|
||||
// recupero il gestore di lettura/scrittura dell'entità
|
||||
const IGeoObjRW* pCSmplRW = dynamic_cast<const IGeoObjRW*>( pCrvSmpl) ;
|
||||
if ( pCSmplRW == nullptr)
|
||||
return false ;
|
||||
// emetto tipo della curva semplice
|
||||
osOut << pCrvSmpl->GetKey() << endl ;
|
||||
ngeOut.WriteKey( pCSmplRW->GetNgeId(), true) ;
|
||||
// assegno ed emetto nome della curva semplice
|
||||
string sCrvName = "#" + ToString( ++i) ;
|
||||
osOut << sCrvName << endl ;
|
||||
ngeOut.WriteString( sCrvName, nullptr, true) ;
|
||||
// salvataggio della curva semplice
|
||||
if ( ! pCrvSmpl->Save( osOut))
|
||||
if ( ! pCSmplRW->Save( ngeOut))
|
||||
return false ;
|
||||
// passo alla successiva
|
||||
pCrvSmpl = GetNextCurve() ;
|
||||
@@ -330,7 +342,8 @@ CurveComposite::Load( Scanner& TheScanner)
|
||||
// recupero la linea con il nome
|
||||
bool bOk = TheScanner.GetLine( sLine) ;
|
||||
// ne leggo i dati
|
||||
bOk = bOk && pGeoO->Load( TheScanner) ;
|
||||
IGeoObjRW* pGObjRW = dynamic_cast<IGeoObjRW*>( pGeoO) ;
|
||||
bOk = bOk && ( pGObjRW != nullptr && pGObjRW->Load( TheScanner)) ;
|
||||
// verifico sia una curva
|
||||
ICurve* pCrv = ::GetCurve( pGeoO) ;
|
||||
bOk = bOk && ( pCrv != nullptr && pCrv->IsSimple()) ;
|
||||
|
||||
Reference in New Issue
Block a user