EgtExecutor :

- aggiunte ExeGetPhotoDimensions e ExeGetPhotoPixels
- in import piccole modifiche in aggiornamento FilePath progetto corrente.
This commit is contained in:
Dario Sassi
2017-01-14 11:17:37 +00:00
parent 54d5fcbc63
commit 4dfd039637
2 changed files with 43 additions and 5 deletions
+10 -5
View File
@@ -87,7 +87,8 @@ ExeImportDxf( const string& sFilePath, double dScaleFactor)
// eseguo l'importazione
bOk = bOk && pImpDxf->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, dScaleFactor) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -117,7 +118,8 @@ ExeImportStl( const string& sFilePath, double dScaleFactor)
// eseguo l'importazione
bOk = bOk && pImpStl->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -146,7 +148,8 @@ ExeImportCnc( const string& sFilePath, int nFlag)
// eseguo l'importazione
bOk = bOk && pImpCnc->Import( sFilePath, pGseCtx->m_pGeomDB, nPartId, nFlag) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -172,7 +175,8 @@ ExeImportCsf( const string& sFilePath)
// eseguo l'importazione (direttamente nella radice)
bOk = bOk && pImpCsf->Import( sFilePath, pGseCtx->m_pGeomDB) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -198,7 +202,8 @@ ExeImportBtl( const string& sFilePath, bool bFlatPos, bool bSpecialTrim)
// eseguo l'importazione (direttamente nella radice)
bOk = bOk && pImpBtl->Import( sFilePath, pGseCtx->m_pGeomDB, bFlatPos, bSpecialTrim) ;
// aggiorno stato file corrente
pGseCtx->m_sFilePath = sFilePath ;
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
+33
View File
@@ -151,3 +151,36 @@ ExeGetPhotoMMxPixel( int nId, double& dMMxPixel)
dMMxPixel = ( dDimX / nWidth + dDimY / nHeight) / 2 ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExeGetPhotoDimensions( int nId, double& dDimX, double& dDimY)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
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 ;
// recupero le dimensioni fisiche della fotografia
return pPhoto->GetDimensions( dDimX, dDimY) ;
}
//----------------------------------------------------------------------------
bool
ExeGetPhotoPixels( int nId, int& nPixelX, int& nPixelY)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, false)
// recupero il gestore dei dati della fotografia dell'oggetto
PhotoObj* pPhoto = dynamic_cast<PhotoObj*>( pGeomDB->GetUserObj( nId)) ;
if ( pPhoto == nullptr)
return false ;
// recupero le dimensioni in pixels della fotografia
string sName ;
if ( ! pPhoto->GetName( sName))
return false ;
return ( pScene->GetTexturePixels( sName, nPixelX, nPixelY) && nPixelX > 0 && nPixelY > 0) ;
}