From e0c2b9dacd8bc5d65cbace04960ed0dadea210a4 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 23 Dec 2025 15:36:20 +0100 Subject: [PATCH] EgtExecutor : - aggiunta funzione exe/lua DuplicateGeomDB. --- EXE_GdbObjects.cpp | 23 +++++++++++++++++++++++ LUA_GdbObjects.cpp | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/EXE_GdbObjects.cpp b/EXE_GdbObjects.cpp index eeed41a..382adad 100644 --- a/EXE_GdbObjects.cpp +++ b/EXE_GdbObjects.cpp @@ -393,6 +393,29 @@ ExeCopyGlobEx( int nSouCtx, int nSouId, int nDestCtx, int nRefId, int nSonBefore return nNewId ; } +//----------------------------------------------------------------------------- +bool +ExeDuplicateGeomDB( int nSouCtx, int nDestCtx, bool bSkipTemp) +{ + // recupero i due GeomDB + IGeomDB* pSouGeomDB = GetGeomDB( nSouCtx) ; + VERIFY_GEOMDB( pSouGeomDB, GDB_ID_NULL) + IGeomDB* pDstGeomDB = GetGeomDB( nDestCtx) ; + VERIFY_GEOMDB( pDstGeomDB, GDB_ID_NULL) + // eseguo la duplicazione del primo GeomDB nel secondo + bool bOk = DuplicateGeomDB( pSouGeomDB, pDstGeomDB, bSkipTemp) ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtDuplicateGeomDB(" + ToString( nSouCtx) + "," + + ToString( nDestCtx) + "," + + ( bSkipTemp ? "true" : "false") + ")" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco risultato + return bOk ; +} + //----------------------------------------------------------------------------- bool ExeRelocate( int nSouId, int nRefId, int nSonBeforeAfter) diff --git a/LUA_GdbObjects.cpp b/LUA_GdbObjects.cpp index 442394f..3cc87e6 100644 --- a/LUA_GdbObjects.cpp +++ b/LUA_GdbObjects.cpp @@ -563,6 +563,25 @@ LuaCopyGlobEx( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaDuplicateGeomDB( lua_State* L) +{ + // 2 o 3 parametri : nSouCtx, nDestCtx [, bSkipTemp] + int nSouCtx ; + LuaCheckParam( L, 1, nSouCtx) + int nDestCtx ; + LuaCheckParam( L, 2, nDestCtx) + bool bSkipTemp = false ; + LuaGetParam( L, 3, bSkipTemp) ; + LuaClearStack( L) ; + // eseguo la copia + bool bOk = ExeDuplicateGeomDB( nSouCtx, nDestCtx, bSkipTemp) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaRelocate( lua_State* L) @@ -718,6 +737,7 @@ LuaInstallGdbObjects( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtCopyEx", LuaCopyEx) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlob", LuaCopyGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyGlobEx", LuaCopyGlobEx) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtDuplicateGeomDB", LuaDuplicateGeomDB) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRelocate", LuaRelocate) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRelocateGlob", LuaRelocateGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGroupSwap", LuaGroupSwap) ;