EgtExecutor 1.8l3 :
- aggiunte funzioni Exe e Lua AddPicture - migliorie alla gestione di Photo.
This commit is contained in:
+46
-6
@@ -16,16 +16,18 @@
|
||||
#include "PhotoObj.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddPhoto( const string& sName, const string& sPath,
|
||||
const Point3d& ptOri, const Point3d& ptCen, double dMMxPixel,
|
||||
int nParentId, const Point3d& ptMin, const Point3d& ptMax)
|
||||
MyAddPhoto( const string& sName, const string& sPath,
|
||||
const Point3d& ptOri, const Point3d& ptCen, double dMMxPixel,
|
||||
int nParentId, const Point3d& ptMin, const Point3d& ptMax)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -59,12 +61,38 @@ ExeAddPhoto( const string& sName, const string& sPath,
|
||||
// Installo e inizializzo il gestore della foto
|
||||
PhotoObj* pPhoto = new( nothrow) PhotoObj ;
|
||||
if ( pPhoto == nullptr) {
|
||||
pGeomDB->Erase( nId) ;
|
||||
pScene->UnloadTexture( sName) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
pPhoto->Set( sName, sPath, ptOri, ptCen, dDimX, dDimY) ;
|
||||
pGeomDB->SetUserObj( nId, pPhoto) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddPhoto( const string& sName, const string& sPath,
|
||||
const Point3d& ptOri, const Point3d& ptCen, double dMMxPixel,
|
||||
int nParentId, const Point3d& ptMin, const Point3d& ptMax)
|
||||
{
|
||||
// lancio esecuzione
|
||||
int nId = MyAddPhoto( sName, sPath, ptOri, ptCen, dMMxPixel, nParentId, ptMin, ptMax) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtAddPhoto('" + StringToLuaString( sName) + "','" +
|
||||
StringToLuaString( sPath) + "',{" +
|
||||
ToString( ptOri) + "},{" +
|
||||
ToString( ptCen) + "}," +
|
||||
ToString( dMMxPixel) + "," +
|
||||
IdToString( nParentId) + ",{" +
|
||||
ToString( ptMin) + "},{" +
|
||||
ToString( ptMax) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nId ;
|
||||
}
|
||||
|
||||
@@ -103,6 +131,7 @@ ExeAddPhoto( const string& sName, const string& sPath,
|
||||
// Installo e inizializzo il gestore della foto
|
||||
PhotoObj* pPhoto = new( nothrow) PhotoObj ;
|
||||
if ( pPhoto == nullptr) {
|
||||
pGeomDB->Erase( nId) ;
|
||||
pScene->UnloadTexture( sName) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
@@ -137,6 +166,7 @@ ExeMovePhoto( int nId, const Vector3d& vtMove)
|
||||
pPhoto->GetOrigin( ptOrig) ;
|
||||
ptOrig.Translate( vtMove) ;
|
||||
pPhoto->ChangeOrigin( ptOrig) ;
|
||||
ExeSetModified() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -165,6 +195,7 @@ ExeRotatePhoto( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngD
|
||||
pPhoto->GetOrigin( ptOrig) ;
|
||||
ptOrig.Rotate( ptAx, vtAx, dAngDeg) ;
|
||||
pPhoto->ChangeOrigin( ptOrig) ;
|
||||
ExeSetModified() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -190,10 +221,19 @@ ExeChangePhotoPath( int nId, const string& sPath)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il gestore dei dati della fotografia dell'oggetto
|
||||
PhotoObj* pPhoto = dynamic_cast<PhotoObj*>( pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pPhoto == nullptr)
|
||||
return false ;
|
||||
bool bOk = ( pPhoto != nullptr) ;
|
||||
// imposto la nuova path della fotografia
|
||||
return pPhoto->ChangePath( sPath) ;
|
||||
bOk = bOk && pPhoto->ChangePath( sPath) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChangePhotoPath(" + IdToString( nId) + ",'" +
|
||||
StringToLuaString( sPath) + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user