From 1917a21a7c1848746af42a78db041a1a5acf643f Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 29 Aug 2019 08:59:52 +0000 Subject: [PATCH] EgtExecutor 2.1h2 : - aggiunte funzioni ExeSetSelInfo, ExeGetLastSelInfo e ExeGetPrevSelInfo - aggiunte funzioni lua EgtGetLastSelInfo, EgtGetPrevSelInfo e EgtSurfTmFacetFromTria. --- EXE_GdbObjSelection.cpp | 37 ++++++++++++++++++++++++++++ EXE_GeoSnap.cpp | 28 ++++++++++----------- EgtExecutor.rc | Bin 16176 -> 16176 bytes GseContext.h | 16 ++++++++++++ LUA_GdbObjSelection.cpp | 53 ++++++++++++++++++++++++++++++++++++++++ LUA_GeoSnap.cpp | 22 +++++++++++++++++ 6 files changed, 142 insertions(+), 14 deletions(-) diff --git a/EXE_GdbObjSelection.cpp b/EXE_GdbObjSelection.cpp index 33ac8c8..90aec2c 100644 --- a/EXE_GdbObjSelection.cpp +++ b/EXE_GdbObjSelection.cpp @@ -259,3 +259,40 @@ ExeGetPrevSelectedObj( void) // recupero il precedente oggetto selezionato return pGeomDB->GetPrevSelectedObj() ; } + +//----------------------------------------------------------------------------- +bool +ExeSetSelInfo( int nId, int nSub, const Point3d& ptSel) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX( pGseCtx, false) + // imposto le informazioni ausiliarie di selezione + pGseCtx->m_siSel.Set( nId, nSub, ptSel) ; + return true ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetLastSelInfo( int& nLastId, int& nLastSub, Point3d& ptLastSel) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX( pGseCtx, false) + // recupero le informazioni ausiliarie di selezione dell'ultima entità + nLastId = pGseCtx->m_siSel.nLastId ; + nLastSub = pGseCtx->m_siSel.nLastSub ; + ptLastSel = pGseCtx->m_siSel.ptLastSel ; + return true ; +} + +//----------------------------------------------------------------------------- +bool +ExeGetPrevSelInfo( int& nPrevId, int& nPrevSub, Point3d& ptPrevSel) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX( pGseCtx, false) + // recupero le informazioni ausiliarie di selezione dell'ultima entità + nPrevId = pGseCtx->m_siSel.nPrevId ; + nPrevSub = pGseCtx->m_siSel.nPrevSub ; + ptPrevSel = pGseCtx->m_siSel.ptPrevSel ; + return true ; +} diff --git a/EXE_GeoSnap.cpp b/EXE_GeoSnap.cpp index 328fcf9..78a980b 100644 --- a/EXE_GeoSnap.cpp +++ b/EXE_GeoSnap.cpp @@ -19,21 +19,21 @@ #include "GeoTools.h" #include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EXeConst.h" -#include "/EgtDev/Include/EgkGeoPoint3d.h" -#include "/EgtDev/Include/EgkGeoVector3d.h" -#include "/EgtDev/Include/EgkCurve.h" -#include "/EgtDev/Include/EgkCurveArc.h" -#include "/EgtDev/Include/EgkCurveComposite.h" +#include "/EgtDev/Include/EGkGeoPoint3d.h" +#include "/EgtDev/Include/EGkGeoVector3d.h" +#include "/EgtDev/Include/EGkCurve.h" +#include "/EgtDev/Include/EGkCurveArc.h" +#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveLocal.h" -#include "/EgtDev/Include/EgkSurf.h" -#include "/EgtDev/Include/EgkSurfFlatRegion.h" -#include "/EgtDev/Include/EgkSurfTriMesh.h" +#include "/EgtDev/Include/EGkSurf.h" +#include "/EgtDev/Include/EGkSurfFlatRegion.h" +#include "/EgtDev/Include/EGkSurfTriMesh.h" #include "/EgtDev/Include/EGkSurfLocal.h" -#include "/EgtDev/Include/EgkVolZmap.h" -#include "/EgtDev/Include/EgkExtText.h" -#include "/EgtDev/Include/EgkDistPointCurve.h" +#include "/EgtDev/Include/EGkVolZmap.h" +#include "/EgtDev/Include/EGkExtText.h" +#include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkIntersLineSurfTm.h" -#include "/EgtDev/Include/EgkIntersCurves.h" +#include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EgtPointerOwner.h" #include @@ -1257,8 +1257,8 @@ ExeSurfTmFacetOppositeSideEx( int nId, int nFacet, const Vector3d& vtDir, int nR pCrv = pCrvCompo->GetNextCurve() ; } // la curva gira in senso antiorario attorno al contorno faccia vista dalla normale uscente - // elimino i segmenti che hanno la direzione di riferimento a destra o quasi (45deg) - const double COS_ANG_MAX = cos( 45 * DEGTORAD) ; + // elimino i segmenti che hanno la direzione di riferimento a destra o quasi (46deg) + const double COS_ANG_MAX = cos( 46 * DEGTORAD) ; const double MIN_DIR_LEN = 0.999 ; // cerco primo elemento del contorno non valido e vi pongo inizio/fine della curva int i = 0 ; diff --git a/EgtExecutor.rc b/EgtExecutor.rc index ddf59b6fcc8f2af77786859f920a5b3ce34db001..e600a760a5e383a50d3b6ded7bfcc6875a1d14d0 100644 GIT binary patch delta 79 zcmdl`x1nysFE&P_&A-`PnSqoe*K!sx?>N)s4T4pSMw1=6k~jAW*?>e(i-FY$N+HxV MD8kglDP58Q0C_7LTL1t6 delta 79 zcmdl`x1nysFE&QQ&A-`PnSqoe*K!sx?>N)s4T4pShLat+k~jAW*?>e(i-FY$N+HxV MD8kglDP58Q0C(RTQvd(} diff --git a/GseContext.h b/GseContext.h index 0c937ef..66c4143 100644 --- a/GseContext.h +++ b/GseContext.h @@ -20,6 +20,21 @@ #define NOMINMAX #include +//---------------------------------------------------------------------------- +// Struttura per info aggiuntive di selezione +struct SelInfo { + int nLastId ; + int nLastSub ; + Point3d ptLastSel ; + int nPrevId ; + int nPrevSub ; + Point3d ptPrevSel ; + SelInfo( void) + : nLastId( GDB_ID_NULL), nLastSub( 0), ptLastSel(), nPrevId( GDB_ID_NULL), nPrevSub( 0), ptPrevSel() {} + void Set( int nI, int nS, const Point3d& ptP) + { nPrevId = nLastId ; nPrevSub = nLastSub ; ptPrevSel = ptLastSel ; nLastId = nI ; nLastSub = nS ; ptLastSel = ptP ; } +} ; + //---------------------------------------------------------------------------- class GseContext { @@ -36,6 +51,7 @@ class GseContext int m_nCurrPart ; int m_nCurrLayer ; int m_nObjFilterForSelect ; + SelInfo m_siSel ; public : GseContext( void) diff --git a/LUA_GdbObjSelection.cpp b/LUA_GdbObjSelection.cpp index 68a7d29..2da3c92 100644 --- a/LUA_GdbObjSelection.cpp +++ b/LUA_GdbObjSelection.cpp @@ -223,6 +223,56 @@ LuaGetPrevSelectedObj( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaGetLastSelInfo( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // recupero le informazioni di selezione sull'ultimo oggetto selezionato + int nLastId ; + int nLastSub ; + Point3d ptLastSel ; + bool bOk = ExeGetLastSelInfo( nLastId, nLastSub, ptLastSel) ; + // restituisco il risultato + if ( bOk) { + LuaSetParam( L, nLastId) ; + LuaSetParam( L, nLastSub) ; + LuaSetParam( L, ptLastSel) ; + } + else { + LuaSetParam( L) ; + LuaSetParam( L) ; + LuaSetParam( L) ; + } + return 3 ; +} + +//------------------------------------------------------------------------------- +static int +LuaGetPrevSelInfo( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // recupero le informazioni di selezione sul penultimo oggetto selezionato + int nPrevId ; + int nPrevSub ; + Point3d ptPrevSel ; + bool bOk = ExeGetPrevSelInfo( nPrevId, nPrevSub, ptPrevSel) ; + // restituisco il risultato + if ( bOk) { + LuaSetParam( L, nPrevId) ; + LuaSetParam( L, nPrevSub) ; + LuaSetParam( L, ptPrevSel) ; + } + else { + LuaSetParam( L) ; + LuaSetParam( L) ; + LuaSetParam( L) ; + } + return 3 ; +} + //------------------------------------------------------------------------------- bool LuaInstallGdbObjSelection( LuaMgr& luaMgr) @@ -241,5 +291,8 @@ LuaInstallGdbObjSelection( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextSelectedObj", LuaGetNextSelectedObj) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastSelectedObj", LuaGetLastSelectedObj) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevSelectedObj", LuaGetPrevSelectedObj) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetLastSelInfo", LuaGetLastSelInfo) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevSelInfo", LuaGetPrevSelInfo) ; + return bOk ; } diff --git a/LUA_GeoSnap.cpp b/LUA_GeoSnap.cpp index 9dfcc13..fcf606b 100644 --- a/LUA_GeoSnap.cpp +++ b/LUA_GeoSnap.cpp @@ -15,6 +15,7 @@ #include "stdafx.h" #include "LUA.h" #include "/EgtDev/Include/EXeExecutor.h" +#include "/EgtDev/Include/EGkSurfTriMesh.h" #include "/EgtDev/Include/EGkLuaAux.h" using namespace std ; @@ -718,6 +719,26 @@ LuaSurfTmFacetCount( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +static int +LuaSurfTmFacetFromTria( lua_State* L) +{ + // 2 parametri : nId, nTria + int nId ; + LuaCheckParam( L, 1, nId) + int nTria ; + LuaCheckParam( L, 2, nTria) + LuaClearStack( L) ; + // recupero l'indice della faccia cui appartiene il triangolo della superficie + int nFacet = ExeSurfTmFacetFromTria( nId, nTria) ; + // restituisco il risultato + if ( nFacet != SVT_NULL) + LuaSetParam( L, nFacet) ; + else + LuaSetParam( L) ; + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaSurfTmFacetAdjacencies( lua_State* L) @@ -1089,6 +1110,7 @@ LuaInstallGeoSnap( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrChunkSimpleClassify", LuaSurfFrChunkSimpleClassify) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrTestExternal", LuaSurfFrTestExternal) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;