EgtExecutor :
- aggiunta funzione Exe e Lua GetAllInGroup.
This commit is contained in:
@@ -74,6 +74,30 @@ ExeGetGroupObjs( int nId)
|
||||
return pGeomDB->GetGroupObjs( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetAllInGroup( int nGroupId, INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il numero di oggetti nel gruppo
|
||||
if ( ! pGeomDB->ExistsObj( nGroupId))
|
||||
return false ;
|
||||
// preparo il riempimento del vettore
|
||||
vIds.clear() ;
|
||||
int nCount = pGeomDB->GetGroupObjs( nGroupId) ;
|
||||
if ( nCount == 0)
|
||||
return true ;
|
||||
vIds.reserve( nCount) ;
|
||||
// eseguo il riempimento
|
||||
int nEntId = pGeomDB->GetFirstInGroup( nGroupId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
vIds.emplace_back( nEntId) ;
|
||||
nEntId = pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
ExeGetFirstInGroup( int nGroupId)
|
||||
|
||||
@@ -117,6 +117,25 @@ LuaGetGroupObjs( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetAllInGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : GroupId
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// determino gli oggetti nel gruppo
|
||||
INTVECTOR vIds ;
|
||||
bool bOk = ExeGetAllInGroup( nGroupId, vIds) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, vIds) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstInGroup( lua_State* L)
|
||||
@@ -608,6 +627,7 @@ LuaInstallGdbObjects( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGlobFrame", LuaGetGlobFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGroupGlobFrame", LuaGetGroupGlobFrame) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetGroupObjs", LuaGetGroupObjs) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllInGroup", LuaGetAllInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstInGroup", LuaGetFirstInGroup) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNext", LuaGetNext) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastInGroup", LuaGetLastInGroup) ;
|
||||
|
||||
Reference in New Issue
Block a user