83acce1b41
- aggiunta funzione Exe e Lua VolZmapGetPartMinDist.
91 lines
3.0 KiB
C++
91 lines
3.0 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2020-2020
|
|
//----------------------------------------------------------------------------
|
|
// File : EXE_GeoSnap.cpp Data : 23.03.20 Versione : 2.2c3
|
|
// Contenuto : Funzioni di interrogazione di volumi del DBG per EXE.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 23.03.20 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "EXE.h"
|
|
#include "EXE_Const.h"
|
|
#include "EXE_Macro.h"
|
|
#include "GeoTools.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EXeConst.h"
|
|
#include "/EgtDev/Include/EGkVolZmap.h"
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
ExeVolZmapVolume( int nId, double& dVol)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, false)
|
|
// verifico il parametro
|
|
if ( &dVol == nullptr)
|
|
return false ;
|
|
// recupero il solido Zmap
|
|
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
|
// ne restituisco il volume
|
|
return ( pVZM != nullptr && pVZM->GetVolume( dVol)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
ExeVolZmapPartCount( int nId)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, -1)
|
|
// recupero il solido Zmap
|
|
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
|
if ( pVZM == nullptr)
|
|
return -1 ;
|
|
// recupero il numero di parti
|
|
return pVZM->GetPartCount() ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
ExeVolZmapPartVolume( int nId, int nPart, double& dVol)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, false)
|
|
// verifico il parametro
|
|
if ( &dVol == nullptr)
|
|
return false ;
|
|
// recupero il solido Zmap
|
|
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
|
// restituisco il volume della eventuale parte richiesta
|
|
return ( pVZM != nullptr && pVZM->GetPartVolume( nPart, dVol)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
ExeVolZmapGetPartMinDist( int nId, const Point3d ptNear, int nRefType, int& nPart)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, false)
|
|
// verifico il parametro
|
|
if ( &nPart == nullptr)
|
|
return false ;
|
|
// recupero il solido Zmap
|
|
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
|
if ( pVZM == nullptr)
|
|
return false ;
|
|
// recupero il riferimento del solido
|
|
Frame3d frVol ;
|
|
if ( ! pGeomDB->GetGlobFrame( nId, frVol))
|
|
return false ;
|
|
// porto il punto Near nel riferimento dell'entità
|
|
Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frVol) ;
|
|
// restituisco il volume della eventuale parte richiesta
|
|
nPart = pVZM->GetPartMinDistFromPoint( ptNearL) ;
|
|
return ( nPart >= 0) ;
|
|
}
|