Files
EgtExecutor/LUA_Photo.cpp
T
Dario Sassi f33513bdc5 EgtExecutor 1.8l3 :
- aggiunte funzioni Exe e Lua AddPicture
- migliorie alla gestione di Photo.
2017-12-27 17:05:29 +00:00

101 lines
3.0 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : LUA_Photo.cpp Data : 11.10.15 Versione : 1.6j1
// Contenuto : Funzioni sulla fotografia per LUA.
//
//
//
// Modifiche : 11.10.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "LUA.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EgnStringUtils.h"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaAddPhoto( lua_State* L)
{
// 8 parametri : nome per la texture, path della immagine, ptOri, ptCen, dMMxPixel, nParentId, ptMin, ptMax
string sName ;
LuaCheckParam( L, 1, sName)
string sPath ;
LuaCheckParam( L, 2, sPath)
Point3d ptOri ;
LuaCheckParam( L, 3, ptOri)
Point3d ptCen ;
LuaCheckParam( L, 4, ptCen)
double dMMxPixel ;
LuaCheckParam( L, 5, dMMxPixel)
int nParentId ;
LuaCheckParam( L, 6, nParentId)
Point3d ptMin ;
LuaCheckParam( L, 7, ptMin)
Point3d ptMax ;
LuaCheckParam( L, 8, ptMax)
LuaClearStack( L) ;
// inserisco la foto
int nId = ExeAddPhoto( sName, sPath, ptOri, ptCen, dMMxPixel, nParentId, ptMin, ptMax) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetPhotoPath( lua_State* L)
{
// 1 parametro : nId
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero la path della immagine della foto
string sPath ;
bool bOk = ExeGetPhotoPath( nId, sPath) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, sPath) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaChangePhotoPath( lua_State* L)
{
// 2 parametri : nId, sPath
int nId ;
LuaCheckParam( L, 1, nId)
string sPath ;
LuaCheckParam( L, 2, sPath)
LuaClearStack( L) ;
// assegno la path della immagine della foto
bool bOk = ExeChangePhotoPath( nId, sPath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallPhoto( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddPhoto", LuaAddPhoto) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhotoPath", LuaGetPhotoPath) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtChangePhotoPath", LuaChangePhotoPath) ;
return bOk ;
}