EgtGeomKernel 1.5c5 :

- IGdbIterator può utilizzare un altro IGdbIterator per andare sul gruppo
- aggiunta gestione nomi di colori standard
- Aggiunte ToString e FromString per Color
- TSC ora accetta colori standard da nome.
This commit is contained in:
Dario Sassi
2014-03-12 21:19:47 +00:00
parent 0b9c1a8fc5
commit 01ce6ea4a4
18 changed files with 391 additions and 119 deletions
+58 -49
View File
@@ -14,7 +14,8 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "Attribs.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ;
@@ -60,10 +61,15 @@ Attribs::Dump( string& sOut, const char* szNewLine) const
// eventuale colore
if ( m_Material != MAT_PARENT && m_Material != MAT_NULL) {
sOut += " Col=" ;
sOut += ToString( m_Color.GetIntRed()) + "," ;
sOut += ToString( m_Color.GetIntGreen()) + "," ;
sOut += ToString( m_Color.GetIntBlue()) + "," ;
sOut += ToString( m_Color.GetIntAlpha()) ;
string sColName ;
if ( GetNameOfStdColor( m_Color, sColName))
sOut += sColName ;
sOut += "(" + ToString( m_Color.GetIntRed()) ;
sOut += "," + ToString( m_Color.GetIntGreen()) ;
sOut += "," + ToString( m_Color.GetIntBlue()) ;
if ( m_Color.GetIntAlpha() != 100)
sOut += "," + ToString( m_Color.GetIntAlpha()) ;
sOut += ")" ;
}
sOut += szNewLine ;
// eventuali nome e stringhe informative
@@ -82,22 +88,19 @@ Attribs::Save( ostream& osOut) const
osOut << "A" << endl ;
// livello
osOut << ToString( m_Data[LEVEL]) ;
osOut << ToString( m_Data[LEVEL]) << "," ;
// modo
osOut << "," << ToString( m_Data[MODE]) ;
osOut << ToString( m_Data[MODE]) << "," ;
// stato
osOut << "," << ToString( m_Data[STATUS]) ;
osOut << ToString( m_Data[STATUS]) << "," ;
// altro
osOut << "," << ToString( m_Data[OTHER]) ;
osOut << ToString( m_Data[OTHER]) << ";" ;
// materiale
osOut << ";" << ToString( m_Material) ;
osOut << ToString( m_Material) << ";" ;
// colore
osOut << ";" << ToString( m_Color.GetIntRed()) ;
osOut << "," << ToString( m_Color.GetIntGreen()) ;
osOut << "," << ToString( m_Color.GetIntBlue()) ;
osOut << "," << ToString( m_Color.GetIntAlpha()) ;
osOut << ToString( m_Color) << ";" ;
// numero di stringhe di info (nelle linee successive)
osOut << ";" << ToString( int( m_slInfo.size())) << ";" << endl ;
osOut << ToString( int( m_slInfo.size())) << ";" << endl ;
// stringhe di info
STRLIST::const_iterator iIter ;
for ( iIter = m_slInfo.begin() ; iIter != m_slInfo.end() ; ++ iIter)
@@ -116,9 +119,46 @@ Attribs::Load( Scanner& TheScanner)
return false ;
// la divido in parametri
STRVECTOR vsParams ;
Tokenize( sLine, ",;", vsParams) ;
// 10 parametri
if ( vsParams.size() != 10)
Tokenize( sLine, ";", vsParams) ;
// 4 parametri
if ( vsParams.size() != 4)
return false ;
// Data (Level,Mode,Status,Other)
if ( ! DataFromString( vsParams[0]))
return false ;
// materiale
int nMat ;
if ( ! FromString( vsParams[1], nMat))
return false ;
m_Material = __max( nMat, MAT_PARENT) ;
// colore
if ( ! FromString( vsParams[2], m_Color))
return false ;
// numero di stringhe (nelle linee successive)
int nNext ;
if ( ! FromString( vsParams[3], nNext))
return false ;
// leggo le eventuali stringhe
for ( int i = 0 ; i < nNext ; ++i) {
// leggo la linea
if ( ! TheScanner.GetLine( sLine))
return false ;
// la carico in lista
m_slInfo.push_back( sLine) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Attribs::DataFromString( const string& sParam)
{
// il primo parametro è diviso in 4 parti
STRVECTOR vsParams ;
Tokenize( sParam, ",", vsParams) ;
// 4 parti
if ( vsParams.size() != 4)
return false ;
// livello
int nLev ;
@@ -140,37 +180,6 @@ Attribs::Load( Scanner& TheScanner)
if ( ! FromString( vsParams[3], nOther))
return false ;
m_Data[OTHER] = CLIP( nOther, 0, 255) ;
// materiale
int nMat ;
if ( ! FromString( vsParams[4], nMat))
return false ;
m_Material = __max( nMat, MAT_PARENT) ;
// colore
int nRed ;
if ( ! FromString( vsParams[5], nRed))
return false ;
int nGreen ;
if ( ! FromString( vsParams[6], nGreen))
return false ;
int nBlue ;
if ( ! FromString( vsParams[7], nBlue))
return false ;
int nAlpha ;
if ( ! FromString( vsParams[8], nAlpha))
return false ;
m_Color.Set( nRed, nGreen, nBlue, nAlpha) ;
// numero di stringhe (nelle linee successive)
int nNext ;
if ( ! FromString( vsParams[9], nNext))
return false ;
// leggo le eventuali stringhe
for ( int i = 0 ; i < nNext ; ++i) {
// leggo la linea
if ( ! TheScanner.GetLine( sLine))
return false ;
// la carico in lista
m_slInfo.push_back( sLine) ;
}
return true ;
}