EgtExecutor :

- aggiunta funzione Exe e Lua CurveMedialAxis.
This commit is contained in:
DarioS
2022-08-23 11:23:08 +02:00
parent 130f40d2bc
commit ea0a0be9ed
2 changed files with 52 additions and 0 deletions
+34
View File
@@ -29,6 +29,7 @@
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkMedialAxis.h"
#include "/EgtDev/Include/EGkChainCurves.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkExtTExt.h"
@@ -145,6 +146,39 @@ ExeOffsetCurveAdv( int nId, double dDist, int nType, int* pnCount)
return nFirstId ;
}
//----------------------------------------------------------------------------
int
ExeCurveMedialAxis( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// eseguo il calcolo
PolyLine PL ;
if ( ! CurveSimpleMedialAxis( pCurve, PL))
return GDB_ID_NULL ;
// creo la curva
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return GDB_ID_NULL ;
// la inserisco nel DB geometrico
int nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pCompo)) ;
// copio gli attributi
pGeomDB->CopyAttributes( nId, nNewId) ;
// notifico la modifica
if ( nNewId != GDB_ID_NULL)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
sLua = "EgtCurveMedialAxis(" + ToString( nId) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nNewId ;
}
//-------------------------------------------------------------------------------
bool
ExeApproxCurve( int nId, int nApprType, double dLinTol)