Include :

- aggiunti prototipi per ShortestPath
- aggiornamenti vari.
This commit is contained in:
Dario Sassi
2015-12-28 10:40:11 +00:00
parent b8d3c218b9
commit 00cfc86860
7 changed files with 124 additions and 3 deletions
+27
View File
@@ -392,3 +392,30 @@ LuaSetParam( lua_State* L, const Color& colPar)
}
return true ;
}
//-------------------------------------------------------------------------------
inline bool
LuaSetParam( lua_State* L, const SELVECTOR& vSel)
{
try {
// recupero dimensione
int nDim = int( vSel.size()) ;
// creo tavola per vSel
lua_createtable( L, nDim, 0) ;
// creo e inserisco tavola per ogni componente
for ( int i = 1 ; i <= nDim ; ++ i) {
// creo tavola
lua_createtable( L, 2, 0) ;
lua_pushnumber( L, vSel[i-1].nId) ;
lua_rawseti( L, -2, 1) ;
lua_pushnumber( L, vSel[i-1].nSub) ;
lua_rawseti( L, -2, 2) ;
// la metto nel vettore
lua_rawseti( L, -2, i) ;
}
}
catch( ...) {
return false ;
}
return true ;
}
+14 -1
View File
@@ -91,7 +91,20 @@ bool
LuaMgr::CallFunction( const std::string& sFunName, int nRets, const Args&... params)
{
// recupero la funzione
lua_getglobal( m_pL, sFunName.c_str()) ;
if ( sFunName.find( '.') == std::string::npos) {
// è direttamente il nome
lua_getglobal( m_pL, sFunName.c_str()) ;
}
else {
// è in una tavola
std::string sTab, sField ;
SplitFirst( sFunName, ".", sTab, sField) ;
lua_getglobal( m_pL, sTab.c_str()) ;
lua_getfield( m_pL, -1, sField.c_str()) ;
// porto la funzione uno slot sotto e diminuisco lo stack di uno (per essere come caso sopra)
lua_copy( m_pL, -1, -2) ;
lua_pop( m_pL, 1) ;
}
// numero di parametri
int nParNbr = sizeof...( Args) ;
// inserisco i parametri sullo stack
+2 -1
View File
@@ -98,6 +98,7 @@ EIN_EXPORT BOOL __stdcall EgtTscExecFile( const wchar_t* wsFilePath) ;
EIN_EXPORT BOOL __stdcall EgtTscExecLine( const wchar_t* wsLine) ;
// LUA Executor
EIN_EXPORT BOOL __stdcall EgtLuaCreateGlobTable( const wchar_t* wsVar) ;
EIN_EXPORT BOOL __stdcall EgtLuaSetGlobBoolVar( const wchar_t* wsVar, BOOL bVal) ;
EIN_EXPORT BOOL __stdcall EgtLuaSetGlobIntVar( const wchar_t* wsVar, int nVal) ;
EIN_EXPORT BOOL __stdcall EgtLuaSetGlobNumVar( const wchar_t* wsVar, double dVal) ;
@@ -107,7 +108,7 @@ EIN_EXPORT BOOL __stdcall EgtLuaGetGlobIntVar( const wchar_t* wsVar, int* pnVal)
EIN_EXPORT BOOL __stdcall EgtLuaGetGlobNumVar( const wchar_t* wsVar, double* pdVal) ;
EIN_EXPORT BOOL __stdcall EgtLuaGetGlobStringVar( const wchar_t* wsVar, wchar_t*& wsVal) ;
EIN_EXPORT BOOL __stdcall EgtLuaResetGlobVar( const wchar_t* wsVar) ;
EIN_EXPORT BOOL __stdcall EgtLuaCreateGlobTable( const wchar_t* wsVar) ;
EIN_EXPORT BOOL __stdcall EgtLuaCallFunction( const wchar_t* wsFun) ;
EIN_EXPORT BOOL __stdcall EgtLuaEvalNumExpr( const wchar_t* wsExpr, double* pdVal) ;
EIN_EXPORT BOOL __stdcall EgtLuaEvalStringExpr( const wchar_t* wsExpr, wchar_t*& wsVal) ;
EIN_EXPORT BOOL __stdcall EgtLuaExecLine( const wchar_t* wsLine) ;
+1
View File
@@ -157,6 +157,7 @@ class __declspec( novtable) IMachMgr
virtual bool GetMachiningParam( int nType, int& dVal) const = 0 ;
virtual bool GetMachiningParam( int nType, double& dVal) const = 0 ;
virtual bool GetMachiningParam( int nType, std::string& sVal) const = 0 ;
virtual bool GetMachiningGeometry( SELVECTOR& vIds) const = 0 ;
// Simulation
virtual bool SimStart( void) = 0 ;
virtual bool SimMove( int& nStatus) = 0 ;
+2
View File
@@ -74,6 +74,8 @@ enum MpaType { MPA_NONE = 0,
MPA_LOPERP = ( MPA_DOU + 26),
MPA_LOELEV = ( MPA_DOU + 27),
MPA_LOCOMPLEN = ( MPA_DOU + 28),
MPA_STARTADDLEN = ( MPA_DOU + 29),
MPA_ENDADDLEN = ( MPA_DOU + 30),
MPA_NAME = ( MPA_STR + 0),
MPA_TOOL = ( MPA_STR + 1),
MPA_DEPTH_STR = ( MPA_STR + 2),
+62
View File
@@ -0,0 +1,62 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : ENkShortestPath.h Data : 22.12.15 Versione : 1.6l3
// Contenuto : Classe per calcolo del percorso minimo di visita di
// un insieme di oggetti.
//
//
// Modifiche : 22.12.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EgtNumCollection.h"
//----------------------- Macro per import/export ----------------------------
#undef ENK_EXPORT
#if defined( I_AM_ENK) // da definirsi solo nella DLL
#define ENK_EXPORT __declspec( dllexport)
#else
#define ENK_EXPORT __declspec( dllimport)
#endif
//----------------------------------------------------------------------------
class __declspec( novtable) IShortestPath
{
public :
virtual ~IShortestPath( void) {}
virtual bool AddPoint( double dX, double dY) = 0 ;
virtual bool AddPoint( double dXi, double dYi, double dXf, double dYf) = 0 ;
virtual bool AddPoint( double dXi, double dYi, double dZi, double dHi, double dVi,
double dXf, double dYf, double dZf, double dHf, double dVf) = 0 ;
virtual bool SetOpenBound( bool bStartVsEnd, int nFlag, double dX, double dY) = 0 ;
virtual bool SetOpenBound( bool bStartVsEnd, int nFlag, double dX, double dY, double dZ, double dH, double dV) = 0 ;
virtual bool SetAngularParams( double dAngHAdd, double dAngHMul, double dAngVAdd, double dAngVMul) = 0 ;
virtual bool SetZzOwStep( double dStep) = 0 ;
virtual bool Calculate( int nType) = 0 ;
virtual bool GetOrder( INTVECTOR& vOrder) = 0 ;
virtual bool GetMinLength( double& dMinLen) = 0 ;
public :
enum SpType{ SP_NONE = 0,
SP_CLOSED = 1,
SP_OPEN = 2,
SP_ZIGZAG_X = 3,
SP_ZIGZAG_Y = 4,
SP_ONEWAY_XP = 5,
SP_ONEWAY_XM = 6,
SP_ONEWAY_YP = 7,
SP_ONEWAY_YM = 8} ;
enum ObType{ OB_NONE = 0,
OB_NEAR_PNT = 1,
OB_XMIN = 2,
OB_XMAX = 3,
OB_YMIN = 4,
OB_YMAX = 5} ;
} ;
//-----------------------------------------------------------------------------
ENK_EXPORT IShortestPath* CreateShortestPath( void) ;
+16 -1
View File
@@ -100,6 +100,7 @@ EXE_EXPORT bool ExeTscExecFile( const std::string& sFilePath) ;
EXE_EXPORT bool ExeTscExecLine( const std::string& sLine) ;
// LUA Executor
EXE_EXPORT bool ExeLuaCreateGlobTable( const std::string& sVar) ;
EXE_EXPORT bool ExeLuaSetGlobBoolVar( const std::string& sVar, bool bVal) ;
EXE_EXPORT bool ExeLuaSetGlobIntVar( const std::string& sVar, int nVal) ;
EXE_EXPORT bool ExeLuaSetGlobNumVar( const std::string& sVar, double dVal) ;
@@ -109,7 +110,7 @@ EXE_EXPORT bool ExeLuaGetGlobIntVar( const std::string& sVar, int* pnVal) ;
EXE_EXPORT bool ExeLuaGetGlobNumVar( const std::string& sVar, double* pdVal) ;
EXE_EXPORT bool ExeLuaGetGlobStringVar( const std::string& sVar, std::string& sVal) ;
EXE_EXPORT bool ExeLuaResetGlobVar( const std::string& sVar) ;
EXE_EXPORT bool ExeLuaCreateGlobTable( const std::string& sVar) ;
EXE_EXPORT bool ExeLuaCallFunction( const std::string& sFun) ;
EXE_EXPORT bool ExeLuaEvalNumExpr( const std::string& sExpr, double* pdVal) ;
EXE_EXPORT bool ExeLuaEvalStringExpr( const std::string& sExpr, std::string& sVal) ;
EXE_EXPORT bool ExeLuaExecLine( const std::string& sLine) ;
@@ -120,6 +121,19 @@ EXE_EXPORT bool ExeLuaGetLastError( std::string& sError) ;
// LUA Base
EXE_EXPORT bool LuaInstallEgtFunctions( LuaMgr& LuaMgr) ;
// ShortestPath
EXE_EXPORT bool ExeSpInit( void) ;
EXE_EXPORT bool ExeSpTerminate( void) ;
EXE_EXPORT bool ExeSpAddPoint( double dXi, double dYi, double dZi, double dHi, double dVi,
double dXf, double dYf, double dZf, double dHf, double dVf) ;
EXE_EXPORT bool ExeSpSetOpenBound( bool bStartVsEnd, int nFlag,
double dX, double dY, double dZ, double dH, double dV) ;
EXE_EXPORT bool ExeSpSetAngularParams( double dAngHAdd, double dAngHMul, double dAngVAdd, double dAngVMul) ;
EXE_EXPORT bool ExeSpSetZzOwStep( double dStep) ;
EXE_EXPORT bool ExeSpCalculate( int nType) ;
EXE_EXPORT bool ExeSpGetOrder( INTVECTOR& vOrder) ;
EXE_EXPORT bool ExeSpGetMinLength( double& dMinLen) ;
// GeomDB Create
EXE_EXPORT int ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType) ;
EXE_EXPORT int ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType) ;
@@ -577,6 +591,7 @@ EXE_EXPORT bool ExeGetMachiningParam( int nType, bool& bVal) ;
EXE_EXPORT bool ExeGetMachiningParam( int nType, int& nVal) ;
EXE_EXPORT bool ExeGetMachiningParam( int nType, double& dVal) ;
EXE_EXPORT bool ExeGetMachiningParam( int nType, std::string& sVal) ;
EXE_EXPORT bool ExeGetMachiningGeometry( SELVECTOR& vIds) ;
// Simulation
EXE_EXPORT bool ExeSimStart( void) ;
EXE_EXPORT bool ExeSimMove( int& nStatus) ;