EgtExecutor :

- aggiunta funzione ExeTextGetContent
- in lua modificata EgtSplitString per gestire campi vuoti tra separatori e considerare più spazi, definito spazio come separatore, come un solo separatore
This commit is contained in:
Dario Sassi
2017-02-06 07:49:04 +00:00
parent 79a076aa52
commit 0706264669
2 changed files with 24 additions and 1 deletions
+17
View File
@@ -31,6 +31,9 @@
#include "/EgtDev/Include/EgkDistPointCurve.h"
#include "/EgtDev/Include/EgkIntersCurves.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include <string>
using namespace std ;
//----------------------------------------------------------------------------
bool
@@ -1084,6 +1087,20 @@ ExeTextNormVersor( int nId, int nRefId, Vector3d& vtNorm)
return TrasformVector( pGeomDB, nId, nRefId, vtNorm) ;
}
//----------------------------------------------------------------------------
bool
ExeTextGetContent( int nId, string& sText)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero il testo
const IExtText* pTxt = GetExtText( pGeomDB->GetGeoObj( nId)) ;
if ( pTxt == nullptr)
return false ;
// recupero il contenuto
sText = pTxt->GetText() ;
return true ;
}
//-------------------------------------------------------------------------------
// Geo Transforms
+7 -1
View File
@@ -150,8 +150,14 @@ LuaSplitString( lua_State* L)
bool bFound = LuaGetParam( L, 1, sVal) ;
LuaGetParam( L, 2, sSep) ;
LuaClearStack( L) ;
// se ricevuta stringa, la divido in parti separate da ','
// se ricevuta stringa, la divido in parti separate da sSep
if ( bFound) {
// se tra i separatori c'é ' ', collasso gli spazi consecutivi in uno solo
if ( sSep.find( " ") != string::npos) {
while ( ReplaceString( sVal, " ", " ") > 0)
;
}
// eseguo separazione
STRVECTOR vsVal ;
Tokenize( sVal, sSep, vsVal) ;
// ritorno il risultato