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
+50 -32
View File
@@ -759,10 +759,10 @@ GdbExecutor::GetVectorParam( const std::string& sParam, Vector3d& vtV)
{
// se insieme di tre componenti
if ( sParam[0] == '(') {
STRVECTOR vsParams ;
STRVECTOR::iterator Iter ;
// divido in parti
STRVECTOR vsParams ;
Tokenize( sParam, ",", vsParams) ;
STRVECTOR::iterator Iter ;
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
Trim( (*Iter), " \t\r\n()") ;
// verifico siano 3 parti e le converto
@@ -788,10 +788,10 @@ GdbExecutor::GetPointParam( const std::string& sParam, Point3d& ptP)
{
// se insieme di tre coordinate
if ( sParam[0] == '(') {
STRVECTOR vsParams ;
STRVECTOR::iterator Iter ;
// divido in parti
STRVECTOR vsParams ;
Tokenize( sParam, ",", vsParams) ;
STRVECTOR::iterator Iter ;
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
Trim( (*Iter), " \t\r\n()") ;
// verifico siano 3 parti e le converto
@@ -815,16 +815,14 @@ GdbExecutor::GetPointParam( const std::string& sParam, Point3d& ptP)
bool
GdbExecutor::GetPointWParam( const std::string& sParam, Point3d& ptP, double& dW)
{
STRVECTOR vsParams ;
STRVECTOR::iterator Iter ;
// deve essere insieme di dati
if ( sParam[0] != '(')
return false ;
// divido in parti
STRVECTOR vsParams ;
Tokenize( sParam, ",", vsParams) ;
STRVECTOR::iterator Iter ;
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
Trim( (*Iter), " \t\r\n()") ;
@@ -888,32 +886,56 @@ GdbExecutor::GetFrameParam( const std::string& sParam, Frame3d& frF)
}
}
//----------------------------------------------------------------------------
bool
GdbExecutor::GetColorParam( const std::string& sParam, Color& cCol)
{
// se insieme di tre o quattro valori
if ( sParam[0] == '(') {
// divido in parti
STRVECTOR vsParams ;
Tokenize( sParam, ",", vsParams) ;
STRVECTOR::iterator Iter ;
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
Trim( (*Iter), " \t\r\n()") ;
// devono essere 3 o 4 parametri ( Red, Green, Blue [, Alpha])
if ( vsParams.size() != 3 && vsParams.size() != 4)
return false ;
int nRed, nGreen, nBlue ;
if ( ! FromString( vsParams[0], nRed) ||
! FromString( vsParams[1], nGreen) ||
! FromString( vsParams[2], nBlue))
return false ;
int nAlpha = 100 ;
if ( vsParams.size() == 4 &&
! FromString( vsParams[3], nAlpha))
return false ;
cCol.Set( nRed, nGreen, nBlue, nAlpha) ;
return true ;
}
// altrimenti colore predefinito
else {
return GetStdColor( sParam, cCol) ;
}
}
//----------------------------------------------------------------------------
bool
GdbExecutor::ExecuteColor( const string& sCmd2, const STRVECTOR& vsParams)
{
// assegnazione colore di oggetto
if ( sCmd2.empty()) {
// 4 o 5 parametri ( Id, Red, Green, Blue, Alpha)
if ( vsParams.size() != 4 && vsParams.size() != 5)
// devono essere 2 parametri ( Id, Colore)
if ( vsParams.size() != 2)
return false ;
// recupero lista Id
STRVECTOR vsNames ;
if ( ! GetNamesParam( vsParams[0], vsNames))
return false ;
// recupero i colori
int nRed ;
int nGreen ;
int nBlue ;
if ( ! FromString( vsParams[1], nRed) ||
! FromString( vsParams[2], nGreen) ||
! FromString( vsParams[3], nBlue))
// recupero il colore
Color cCol ;
if ( ! GetColorParam( vsParams[1], cCol))
return false ;
int nAlpha = 100 ;
if ( vsParams.size() == 5 &&
! FromString( vsParams[4], nAlpha))
return false ;
Color cCol( nRed, nGreen, nBlue, nAlpha) ;
// esecuzione impostazione colore
STRVECTOR::iterator Iter ;
for ( Iter = vsNames.begin() ; Iter != vsNames.end() ; ++Iter) {
@@ -924,18 +946,14 @@ GdbExecutor::ExecuteColor( const string& sCmd2, const STRVECTOR& vsParams)
}
// impostazione colore di default
else if ( sCmd2 == "DEF" || sCmd2 == "DEFAULT") {
// 3 parametri ( Red, Green, Blue)
if ( vsParams.size() != 3)
// 1 parametro ( Colore)
if ( vsParams.size() != 1)
return false ;
// recupero i colori
int nRed ;
int nGreen ;
int nBlue ;
if ( ! FromString( vsParams[0], nRed) ||
! FromString( vsParams[1], nGreen) ||
! FromString( vsParams[2], nBlue))
// recupero il colore
Color cCol ;
if ( ! GetColorParam( vsParams[0], cCol))
return false ;
Color cCol( nRed, nGreen, nBlue) ;
// imposto il colore di default
return m_pGDB->SetDefaultColor( cCol) ;
}