//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : ExcExecutor.cpp Data : 04.04.14 Versione : 1.5d1 // Contenuto : Implementazione della classe ExcExecutor. // // // // Modifiche : 04.04.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "ExcExecutor.h" #include "DllMain.h" #include "/EgtDev/Include/EgnStringUtils.h" #include "/EgtDev/Include/EExImportStl.h" using namespace std ; //---------------------------------------------------------------------------- IExcExecutor* CreateExcExecutor( void) { return static_cast ( new ExcExecutor) ; } //---------------------------------------------------------------------------- ExcExecutor::ExcExecutor( void) { // assegno chiavi a funzioni di esecuzione m_ExecMgr.Init( 4) ; m_ExecMgr.Insert( "IMPORTSTL", &ExcExecutor::ExecuteImportStl) ; } //---------------------------------------------------------------------------- ExcExecutor::~ExcExecutor( void) { } //---------------------------------------------------------------------------- bool ExcExecutor::SetCmdParser( ICmdParser* pParser) { m_pParser = pParser ; return ( m_pParser != nullptr) ; } //---------------------------------------------------------------------------- int ExcExecutor::Execute( const string& sCmd1, const string& sCmd2, const STRVECTOR& vsParams) { // esecuzione comando return m_ExecMgr.Execute( *this, sCmd1, sCmd2, vsParams) ; } //---------------------------------------------------------------------------- bool ExcExecutor::SetGeomDB( IGeomDB* pGdb) { m_pGDB = pGdb ; return ( m_pGDB != nullptr) ; } //---------------------------------------------------------------------------- bool ExcExecutor::ExecuteImportStl( const string& sCmd2, const STRVECTOR& vsParams) { // 2 parametri : nome del file e Id del gruppo if ( vsParams.size() != 2) return false ; // recupero l'Id int nId ; if ( ! FromString( vsParams[1], nId)) return false ; // preparo l'importatore IImportStl* pImpStl = CreateImportStl() ; if ( pImpStl == nullptr) { LOG_ERROR( GetEExLogger(), "Error : CreateImportStl") return false ; } // eseguo l'importazione bool bOk = pImpStl->Import( vsParams[0], m_pGDB, nId) ; // cancello l'importatore delete pImpStl ; return bOk ; }