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 ;
}
BIN
View File
Binary file not shown.
+33
View File
@@ -199,6 +199,14 @@ PhotoObj::Set( const string& sName, const string& sPath,
return true ;
}
//----------------------------------------------------------------------------
bool
PhotoObj::GetName( string& sName)
{
sName = m_sName ;
return true ;
}
//----------------------------------------------------------------------------
bool
PhotoObj::GetPath( string& sPath)
@@ -214,3 +222,28 @@ PhotoObj::ChangePath( const string& sPath)
m_sPath = sPath ;
return ( ! m_sPath.empty()) ;
}
//----------------------------------------------------------------------------
bool
PhotoObj::GetOrigin( Point3d& ptOri)
{
ptOri = m_ptOri ;
return true ;
}
//----------------------------------------------------------------------------
bool
PhotoObj::GetCenter( Point3d& ptCen)
{
ptCen = m_ptCen ;
return true ;
}
//----------------------------------------------------------------------------
bool
PhotoObj::GetDimensions( double& dDimX, double& dDimY)
{
dDimX = m_dDimX ;
dDimY = m_dDimY ;
return true ;
}
+4
View File
@@ -34,8 +34,12 @@ class PhotoObj : public IUserObj
PhotoObj( void) ;
bool Set( const std::string& sName, const std::string& sPath,
const Point3d& ptOri, const Point3d& ptCen, double dDimX, double dDimY) ;
bool GetName( std::string& sName) ;
bool GetPath( std::string& sPath) ;
bool ChangePath( const std::string& sPath) ;
bool GetOrigin( Point3d& ptOri) ;
bool GetCenter( Point3d& ptCen) ;
bool GetDimensions( double& dDimX, double& dDimY) ;
private :
int m_nOwnerId ;