EgtGeneral 1.4a1 : Aggiunte FromString per Vector3d, Point3d e Point3d+W.
This commit is contained in:
+58
-3
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalS
|
||||
// EgalTech 2013-2013
|
||||
//----------------------------------------------------------------------------
|
||||
// File : StringUtils.cpp Data : 20.01.13 Versione : 1.1a1
|
||||
// File : StringUtils.cpp Data : 02.12.13 Versione : 1.4a1
|
||||
// Contenuto : Implementazione delle funzioni di utilità per le stringhe.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 20.01.13 DS Creazione modulo.
|
||||
//
|
||||
// 02.12.13 DS Agg. FromString per Vector3d, Point3d e Point3d+W.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -17,6 +17,61 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FromString( const std::string& sVal, Vector3d& vtVal)
|
||||
{
|
||||
STRVECTOR vsParams ;
|
||||
|
||||
|
||||
// divido la stringa in parametri
|
||||
Tokenize( sVal, ",", vsParams) ;
|
||||
// devono essere 3 parametri : x, y, z
|
||||
if ( vsParams.size() != 3)
|
||||
return false ;
|
||||
// recupero il punto
|
||||
return ( FromString( vsParams[0], vtVal.x) &&
|
||||
FromString( vsParams[1], vtVal.y) &&
|
||||
FromString( vsParams[2], vtVal.z)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FromString( const std::string& sVal, Point3d& ptVal)
|
||||
{
|
||||
STRVECTOR vsParams ;
|
||||
|
||||
|
||||
// divido la stringa in parametri
|
||||
Tokenize( sVal, ",", vsParams) ;
|
||||
// devono essere 3 parametri : x, y, z
|
||||
if ( vsParams.size() != 3)
|
||||
return false ;
|
||||
// recupero il punto
|
||||
return ( FromString( vsParams[0], ptVal.x) &&
|
||||
FromString( vsParams[1], ptVal.y) &&
|
||||
FromString( vsParams[2], ptVal.z)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
FromString( const std::string& sVal, Point3d& ptVal, double& dW)
|
||||
{
|
||||
STRVECTOR vsParams ;
|
||||
|
||||
|
||||
// divido la stringa in parametri
|
||||
Tokenize( sVal, ",", vsParams) ;
|
||||
// devono essere 4 parametri : x, y, z, w
|
||||
if ( vsParams.size() != 4)
|
||||
return false ;
|
||||
// recupero il punto
|
||||
return ( FromString( vsParams[0], ptVal.x) &&
|
||||
FromString( vsParams[1], ptVal.y) &&
|
||||
FromString( vsParams[2], ptVal.z) &&
|
||||
FromString( vsParams[3], dW)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string
|
||||
ToString( int nVal, int nPrec)
|
||||
|
||||
Reference in New Issue
Block a user