EgtExecutor 1.6n7 :

- aggiunte ExeGetPhotoOrigin, ExeGetPhotoCenter, ExeGetPhotoMMxPixel.
This commit is contained in:
Dario Sassi
2016-02-18 18:45:52 +00:00
parent e46bed6d8e
commit 403d3a658d
4 changed files with 95 additions and 2 deletions
+58 -2
View File
@@ -73,7 +73,7 @@ bool
ExeGetPhotoPath( int nId, string& sPath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero il gestore dei dati della fotografia dell'oggetto
PhotoObj* pPhoto = dynamic_cast<PhotoObj*>( pGeomDB->GetUserObj( nId)) ;
if ( pPhoto == nullptr)
@@ -87,7 +87,7 @@ bool
ExeChangePhotoPath( int nId, const string& sPath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, false)
// recupero il gestore dei dati della fotografia dell'oggetto
PhotoObj* pPhoto = dynamic_cast<PhotoObj*>( pGeomDB->GetUserObj( nId)) ;
if ( pPhoto == nullptr)
@@ -95,3 +95,59 @@ ExeChangePhotoPath( int nId, const string& sPath)
// imposto la nuova path della fotografia
return pPhoto->ChangePath( sPath) ;
}
//----------------------------------------------------------------------------
bool
ExeGetPhotoOrigin( int nId, Point3d& ptOri)
{
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 l'origine della fotografia
return pPhoto->GetOrigin( ptOri) ;
}
//----------------------------------------------------------------------------
bool
ExeGetPhotoCenter( int nId, Point3d& ptCen)
{
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 il centro di ripresa della fotografia
return pPhoto->GetCenter( ptCen) ;
}
//----------------------------------------------------------------------------
bool
ExeGetPhotoMMxPixel( int nId, double& dMMxPixel)
{
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 fisiche della fotografia
double dDimX, dDimY ;
if ( ! pPhoto->GetDimensions( dDimX, dDimY))
return false ;
// recupero le dimensioni in pixels della fotografia
string sName ;
if ( ! pPhoto->GetName( sName))
return false ;
int nWidth, nHeight ;
if ( ! pScene->GetTexturePixels( sName, nWidth, nHeight) || nWidth == 0 || nHeight == 0)
return false ;
// calcolo il fattore di scala
dMMxPixel = ( dDimX / nWidth + dDimY / nHeight) / 2 ;
return true ;
}