EgtInterface 1.6e2 :
- esecutore e lua scorporato in EgtExecutor.
This commit is contained in:
+33
-409
@@ -14,114 +14,66 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetLevel( int nId, int nLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// imposto il livello
|
||||
bool bOk = pGeomDB->SetLevel( nId, nLevel) ;
|
||||
EgtSetModified() ;
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeSetLevel( nId, nLevel) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRevertLevel( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// porto il livello allo stato precedente
|
||||
bool bOk = pGeomDB->RevertLevel( nId) ;
|
||||
EgtSetModified() ;
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeRevertLevel( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetLevel( int nId, int* pnLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pnLevel == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il livello
|
||||
return ( pGeomDB->GetLevel( nId, *pnLevel) ? TRUE : FALSE) ;
|
||||
return ( ExeGetLevel( nId, pnLevel) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetCalcLevel( int nId, int* pnLevel)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pnLevel == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetCalcLevel( nId, *pnLevel) ? TRUE : FALSE) ;
|
||||
return ( ExeGetCalcLevel( nId, pnLevel) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetMode( int nId, int nMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// imposto il modo
|
||||
bool bOk = pGeomDB->SetMode( nId, nMode) ;
|
||||
EgtSetModified() ;
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeSetMode( nId, nMode) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRevertMode( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// porto il modo allo stato precedente
|
||||
bool bOk = pGeomDB->RevertMode( nId) ;
|
||||
EgtSetModified() ;
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeRevertMode( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetMode( int nId, int* pnMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pnMode == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetMode( nId, *pnMode) ? TRUE : FALSE) ;
|
||||
return ( ExeGetMode( nId, pnMode) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetCalcMode( int nId, int* pnMode)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pnMode == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetCalcMode( nId, *pnMode) ? TRUE : FALSE) ;
|
||||
return ( ExeGetCalcMode( nId, pnMode) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -130,149 +82,56 @@ __stdcall EgtSetStatus( int nId, int nStat)
|
||||
{
|
||||
INTVECTOR vIds ;
|
||||
vIds.push_back( nId) ;
|
||||
return ( EgtSetStatus( vIds, nStat) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtSetStatus( const INTVECTOR& vIds, int nStat)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero pezzo e layer correnti
|
||||
bool bCurrPartOff = false ;
|
||||
bool bCurrLayerOff = false ;
|
||||
int nCurrPartId = EgtGetCurrPart() ;
|
||||
int nCurrLayerId = EgtGetCurrLayer() ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
|
||||
// impostazione stato
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// imposto il modo
|
||||
if ( ! pGeomDB->SetStatus( nId, nStat))
|
||||
bOk = false ;
|
||||
// se nascosto pezzo corrente o layer corrente
|
||||
if ( nStat == GDB_ST_OFF) {
|
||||
if ( nId == nCurrPartId)
|
||||
bCurrPartOff = true ;
|
||||
else if ( nId == nCurrLayerId)
|
||||
bCurrLayerOff = true ;
|
||||
}
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
// se pezzo o layer correnti da rideterminare
|
||||
if ( bCurrPartOff)
|
||||
EgtResetCurrPartLayer() ;
|
||||
else if ( bCurrLayerOff)
|
||||
EgtSetCurrPartLayer( nCurrPartId, EgtGetFirstLayer( nCurrPartId, true)) ;
|
||||
// dichiaro progetto modificato
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sStat = "GDB_ST.ON" ;
|
||||
if ( nStat == GDB_ST_SEL)
|
||||
sStat = "GDB_ST.SEL" ;
|
||||
else if ( nStat == GDB_ST_OFF)
|
||||
sStat = "GDB_ST.OFF" ;
|
||||
string sLua = "EgtSetStatus({" + IdListToString( vIds) + "}," +
|
||||
sStat + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeSetStatus( vIds, nStat) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRevertStatus( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// porto lo stato al valore precedente
|
||||
bool bOk = pGeomDB->RevertStatus( nId) ;
|
||||
EgtSetModified() ;
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeRevertStatus( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetStatus( int nId, int* pnStat)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pnStat == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetStatus( nId, *pnStat) ? TRUE : FALSE) ;
|
||||
return ( ExeGetStatus( nId, pnStat) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetCalcStatus( int nId, int* pnStat)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pnStat == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetCalcStatus( nId, *pnStat) ? TRUE : FALSE) ;
|
||||
return ( ExeGetCalcStatus( nId, pnStat) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetMark( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// imposto l'evidenziazione
|
||||
bool bOk = pGeomDB->SetMark( nId) ;
|
||||
// non produce modifica perchè mark ignorato in salvataggio
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeSetMark( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtResetMark( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// cancello l'evidenziazione
|
||||
bool bOk = pGeomDB->ResetMark( nId) ;
|
||||
// non produce modifica perchè mark ignorato in salvataggio
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeResetMark( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetMark( int nId, BOOL* pbMark)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pbMark == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetMark( nId, *pbMark) ? TRUE : FALSE) ;
|
||||
return ( ExeGetMark( nId, pbMark) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetCalcMark( int nId, BOOL* pbMark)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico il parametro
|
||||
if ( pbMark == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il modo
|
||||
return ( pGeomDB->GetCalcMark( nId, *pbMark) ? TRUE : FALSE) ;
|
||||
return ( ExeGetCalcMark( nId, pbMark) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -280,7 +139,7 @@ BOOL
|
||||
__stdcall EgtStdColor( const wchar_t* wsName, int StdCol[4])
|
||||
{
|
||||
Color ColStd ;
|
||||
if ( GetStdColor( wstrztoA( wsName), ColStd)) {
|
||||
if ( ExeStdColor( wstrztoA( wsName), ColStd)) {
|
||||
StdCol[0] = ColStd.GetIntRed() ;
|
||||
StdCol[1] = ColStd.GetIntGreen() ;
|
||||
StdCol[2] = ColStd.GetIntBlue() ;
|
||||
@@ -300,49 +159,7 @@ __stdcall EgtSetColor( int nId, const int ObjCol[4], BOOL bSetAlpha)
|
||||
// sistemo il colore
|
||||
Color cCol( ObjCol) ;
|
||||
// eseguo
|
||||
return ( EgtSetColor( vIds, cCol, (bSetAlpha != FALSE)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtSetColor( const INTVECTOR& vIds, const Color& cCol, bool bSetAlpha)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// assegno il colore
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
Color cNew = cCol ;
|
||||
// se richiesto, recupero alpha originale
|
||||
if ( ! bSetAlpha) {
|
||||
Color cOri ;
|
||||
if ( pGeomDB->GetCalcMaterial( nId, cOri))
|
||||
cNew.SetAlpha( cOri.GetIntAlpha()) ;
|
||||
}
|
||||
// eseguo assegnazione
|
||||
if ( ! pGeomDB->SetMaterial( nId, cNew))
|
||||
bOk = false ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sIds ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i)
|
||||
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") + "," ;
|
||||
sIds.pop_back() ;
|
||||
string sLua = "EgtSetColor({" + sIds + "},{" +
|
||||
ToString( cCol) + "}," +
|
||||
( bSetAlpha ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeSetColor( vIds, cCol, (bSetAlpha != FALSE)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -353,40 +170,7 @@ __stdcall EgtSetAlpha( int nId, int nAlpha)
|
||||
INTVECTOR vIds ;
|
||||
vIds.push_back( nId) ;
|
||||
// eseguo
|
||||
return ( EgtSetAlpha( vIds, nAlpha) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtSetAlpha( const INTVECTOR& vIds, int nAlpha)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// assegno la trasparenza
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// recupero il colore originale
|
||||
Color cCol ;
|
||||
bOk = bOk && pGeomDB->GetCalcMaterial( nId, cCol) ;
|
||||
cCol.SetAlpha( nAlpha) ;
|
||||
// eseguo assegnazione
|
||||
bOk = bOk && pGeomDB->SetMaterial( nId, cCol) ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetAlpha({" + IdListToString( vIds) + "}," +
|
||||
ToString( nAlpha) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeSetAlpha( vIds, nAlpha) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -397,46 +181,16 @@ __stdcall EgtResetColor( int nId)
|
||||
INTVECTOR vIds ;
|
||||
vIds.push_back( nId) ;
|
||||
// eseguo
|
||||
return ( EgtResetColor( vIds) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtResetColor( const INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// tolgo il colore
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
if ( ! pGeomDB->SetMaterial( nId, GDB_MT_PARENT))
|
||||
bOk = false ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetNextSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtResetColor({" + IdListToString( vIds) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeResetColor( vIds) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetColor( int nId, int ObjCol[4])
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
if ( pGeomDB->GetMaterial( nId, cCol)) {
|
||||
if ( ExeGetColor( nId, cCol)) {
|
||||
ObjCol[0] = cCol.GetIntRed() ;
|
||||
ObjCol[1] = cCol.GetIntGreen() ;
|
||||
ObjCol[2] = cCol.GetIntBlue() ;
|
||||
@@ -451,11 +205,9 @@ __stdcall EgtGetColor( int nId, int ObjCol[4])
|
||||
BOOL
|
||||
__stdcall EgtGetCalcColor( int nId, int ObjCol[4])
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il colore
|
||||
Color cCol ;
|
||||
if ( pGeomDB->GetCalcMaterial( nId, cCol)) {
|
||||
if ( ExeGetCalcColor( nId, cCol)) {
|
||||
ObjCol[0] = cCol.GetIntRed() ;
|
||||
ObjCol[1] = cCol.GetIntGreen() ;
|
||||
ObjCol[2] = cCol.GetIntBlue() ;
|
||||
@@ -470,27 +222,7 @@ __stdcall EgtGetCalcColor( int nId, int ObjCol[4])
|
||||
BOOL
|
||||
__stdcall EgtSetName( int nId, const wchar_t* wsName)
|
||||
{
|
||||
return ( EgtSetName( nId, wstrztoA( wsName)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtSetName( int nId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// assegno il nome
|
||||
bool bOk = pGeomDB->SetName( nId, sName) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetName(" + ToString( nId) + ",'" +
|
||||
sName + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeSetName( nId, wstrztoA( wsName)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -500,96 +232,38 @@ __stdcall EgtGetName( int nId, wchar_t*& wsName)
|
||||
if ( &wsName == nullptr)
|
||||
return FALSE ;
|
||||
string sName ;
|
||||
if ( ! EgtGetName( nId, sName))
|
||||
if ( ! ExeGetName( nId, sName))
|
||||
return FALSE ;
|
||||
wsName = _wcsdup( stringtoW( sName)) ;
|
||||
return (( wsName == nullptr) ? FALSE : TRUE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetName( int nId, string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il nome
|
||||
return pGeomDB->GetName( nId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExistsName( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico esistenza del nome
|
||||
return ( pGeomDB->ExistsName( nId) ? TRUE : FALSE) ;
|
||||
return ( ExeExistsName( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRemoveName( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// rimuovo il nome
|
||||
bool bOk = pGeomDB->RemoveName( nId) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemoveName(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeRemoveName( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetInfo( int nId, const wchar_t* wsKey, const wchar_t* wsInfo)
|
||||
{
|
||||
return ( EgtSetInfo( nId, wstrztoA( wsKey), wstrztoA( wsInfo)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtSetInfo( int nId, const string& sKey, const string& sInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// assegno la info
|
||||
bool bOk = pGeomDB->SetInfo( nId, sKey, sInfo) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSetInfo(" + ToString( nId) + ",'" +
|
||||
sKey + "','" +
|
||||
sInfo + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeSetInfo( nId, wstrztoA( wsKey), wstrztoA( wsInfo)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSetInfoInt( int nId, const wchar_t* wsKey, int nInfo)
|
||||
{
|
||||
return ( EgtSetInfo( nId, wstrztoA( wsKey), nInfo) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtSetInfo( int nId, const string& sKey, int nInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// assegno la info
|
||||
bool bOk = pGeomDB->SetInfo( nId, sKey, nInfo) ;
|
||||
EgtSetModified() ;
|
||||
return bOk ;
|
||||
return ( ExeSetInfo( nId, wstrztoA( wsKey), nInfo) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -597,22 +271,12 @@ BOOL
|
||||
__stdcall EgtGetInfo( int nId, const wchar_t* wsKey, wchar_t*& wsInfo)
|
||||
{
|
||||
string sInfo ;
|
||||
if ( ! EgtGetInfo( nId, wstrztoA( wsKey), sInfo))
|
||||
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), sInfo))
|
||||
return FALSE ;
|
||||
wsInfo = _wcsdup( stringtoW( sInfo)) ;
|
||||
return (( wsInfo == nullptr) ? FALSE : TRUE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetInfo( int nId, const string& sKey, string& sInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero info
|
||||
return pGeomDB->GetInfo( nId, sKey, sInfo) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetInfoInt( int nId, const wchar_t* wsKey, int* pnInfo)
|
||||
@@ -621,59 +285,19 @@ __stdcall EgtGetInfoInt( int nId, const wchar_t* wsKey, int* pnInfo)
|
||||
if ( pnInfo == nullptr)
|
||||
return FALSE ;
|
||||
// recupero info
|
||||
return ( EgtGetInfo( nId, wstrztoA( wsKey), *pnInfo) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetInfo( int nId, const string& sKey, int& nInfo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero la info
|
||||
return pGeomDB->GetInfo( nId, sKey, nInfo) ;
|
||||
return ( ExeGetInfo( nId, wstrztoA( wsKey), *pnInfo) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExistsInfo( int nId, const wchar_t* wsKey)
|
||||
{
|
||||
return ( EgtExistsInfo( nId, wstrztoA( wsKey)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtExistsInfo( int nId, const string& sKey)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico esistenza info
|
||||
return pGeomDB->ExistsInfo( nId, sKey) ;
|
||||
return ( ExeExistsInfo( nId, wstrztoA( wsKey)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRemoveInfo( int nId, const wchar_t* wsKey)
|
||||
{
|
||||
return ( EgtRemoveInfo( nId, wstrztoA( wsKey)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtRemoveInfo( int nId, const string& sKey)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// rimuovo la info
|
||||
bool bOk = pGeomDB->RemoveInfo( nId, sKey) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtRemoveInfo(" + ToString( nId) + ",'" +
|
||||
sKey + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeRemoveInfo( nId, wstrztoA( wsKey)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user