EgtGeomKernel 1.5a9 : spostate qui da EgtGeneral le conversioni di std::string in Point3d e Vector3d e viceversa.
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : StringUtils3d.cpp Data : 31.01.14 Versione : 1.5a9
|
||||
// Contenuto : Implementazione delle funzioni di utilità 3d per le stringhe.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 31.01.14 DS Creazione modulo (preso da EgtGeneral).
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "/EgtDEv/Include/EgkStringUtils3d.h"
|
||||
|
||||
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)) ;
|
||||
}
|
||||
Reference in New Issue
Block a user