EgtGeomKernel :
- spostato GetIdParam in CmdParser di EgtGeneral.
This commit is contained in:
+11
-30
@@ -37,7 +37,6 @@ using namespace std ;
|
||||
//----------------------------------------------------------------------------
|
||||
static const int ID_SEL = -2 ;
|
||||
static const int ID_NO = -3 ;
|
||||
static const int ID_ERROR = -4 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IGdbExecutor*
|
||||
@@ -132,11 +131,15 @@ GdbExecutor::SetCmdParser( ICmdParser* pParser)
|
||||
bool
|
||||
GdbExecutor::AddStandardVariables( void)
|
||||
{
|
||||
// dovrebbe sempre essere chiamato dallo stesso parser, ma...
|
||||
if ( m_pParser == nullptr)
|
||||
return false ;
|
||||
// imposto variabili predefinite
|
||||
m_pParser->AddVariable( "$ROOT", GDB_ID_ROOT) ;
|
||||
m_pParser->AddVariable( "$SEL", ID_SEL) ;
|
||||
m_pParser->AddVariable( "$NN", ID_NO) ;
|
||||
return true ;
|
||||
// verifico la corrispondenza tra GDB_ID_NULL e CMD_ID_NULL
|
||||
return ( GDB_ID_NULL == CMD_ID_NULL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -145,13 +148,12 @@ GdbExecutor::Execute( const string& sCmd1, const string& sCmd2, const STRVECTOR&
|
||||
{
|
||||
// verifico validita GeomDB
|
||||
if ( m_pGDB == nullptr) {
|
||||
LOG_ERROR( GetEGkLogger(), "Error : null GeomDb.")
|
||||
LOG_ERROR( GetEGkLogger(), "Error : null GeomDb in GdbExecutor.")
|
||||
return ER_ERR ;
|
||||
}
|
||||
|
||||
// verifico validità CmdParser
|
||||
if ( m_pParser == nullptr) {
|
||||
LOG_ERROR( GetEGkLogger(), "Error : null CmdParser.")
|
||||
LOG_ERROR( GetEGkLogger(), "Error : null CmdParser in GdbExecutor.")
|
||||
return ER_ERR ;
|
||||
}
|
||||
|
||||
@@ -334,7 +336,7 @@ GdbExecutor::ExecuteCurveLine( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero l'identificativo del gruppo destinazione
|
||||
int nIdParent ;
|
||||
if ( ( nIdParent = GetIdParam( vsParams[1])) == ID_ERROR)
|
||||
if ( ( nIdParent = GetIdParam( vsParams[1])) == CMD_ID_ERROR)
|
||||
return false ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frPoint ;
|
||||
@@ -346,7 +348,7 @@ GdbExecutor::ExecuteCurveLine( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// recupero l'identificativo della curva
|
||||
int nId ;
|
||||
if ( ( nId = GetIdParam( vsParams[3])) == ID_ERROR)
|
||||
if ( ( nId = GetIdParam( vsParams[3])) == CMD_ID_ERROR)
|
||||
return false ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCurve ;
|
||||
@@ -491,7 +493,7 @@ GdbExecutor::ExecuteCurveBez( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
// per cancellazione eventuale arco di origine
|
||||
bool bErase = false ;
|
||||
int nIdArc = ID_ERROR ;
|
||||
int nIdArc = CMD_ID_ERROR ;
|
||||
|
||||
// curva di Bezier intera (polinomiale)
|
||||
if ( sCmd2 == "I" || sCmd2 == "INTEG") {
|
||||
@@ -898,28 +900,7 @@ GdbExecutor::AddGeoObj( const string& sId, const string& sIdParent, IGeoObj* pGe
|
||||
int
|
||||
GdbExecutor::GetIdParam( const std::string& sParam, bool bNewAllowed)
|
||||
{
|
||||
int nVal ;
|
||||
|
||||
|
||||
// se nome di identificatore numerico
|
||||
if ( sParam[0] == '$') {
|
||||
// se variabile già definita, ne restituisco il valore
|
||||
if ( m_pParser->GetVariable( sParam, nVal))
|
||||
return nVal ;
|
||||
// se ammessa nuova definizione, provo ad inserirlo
|
||||
else if ( bNewAllowed &&
|
||||
m_pParser->AddVariable( sParam, GDB_ID_NULL))
|
||||
return GDB_ID_NULL ;
|
||||
// altrimenti errore
|
||||
else
|
||||
return ID_ERROR ;
|
||||
}
|
||||
// se identificatore numerico
|
||||
else if ( FromString( sParam, nVal))
|
||||
return nVal ;
|
||||
// altrimenti errore
|
||||
else
|
||||
return ID_ERROR ;
|
||||
return m_pParser->GetIdParam( sParam, bNewAllowed) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user