EgtExecutor :
- aggiunta funzione exe e lua CreateSurfTmByPolygonWithHoles.
This commit is contained in:
+42
-2
@@ -535,10 +535,13 @@ LuaCreateSurfTmByPolygon( lua_State* L)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
PolyLine PL ;
|
||||
// creo una polilinea a partire dai punti
|
||||
for ( size_t i = 0 ; i < vPnt.size() ; ++ i)
|
||||
PolyLine PL ;
|
||||
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
|
||||
if ( ! vPnt[i].IsValid())
|
||||
break ;
|
||||
PL.AddUPoint( double( i), vPnt[i]) ;
|
||||
}
|
||||
PL.Close() ;
|
||||
// creo la SurfTriMesh del poligono
|
||||
int nId = ExeCreateSurfTmByPolygon( nParentId, PL, nRefType) ;
|
||||
@@ -550,6 +553,42 @@ LuaCreateSurfTmByPolygon( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByPolygonWithHoles( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : ParentId, ptPs [, nRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
PNTVECTOR vPnt ;
|
||||
LuaCheckParam( L, 2, vPnt)
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
LuaGetParam( L, 3, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo un vettore di polilinee a partire dai punti
|
||||
POLYLINEVECTOR vPL ;
|
||||
vPL.push_back( {}) ;
|
||||
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
|
||||
if ( vPnt[i].IsValid())
|
||||
vPL.back().AddUPoint( double( i), vPnt[i]) ;
|
||||
else {
|
||||
if ( ! vPL.empty())
|
||||
vPL.back().Close() ;
|
||||
vPL.push_back( {}) ;
|
||||
}
|
||||
}
|
||||
if ( ! vPL.empty())
|
||||
vPL.back().Close() ;
|
||||
// creo la SurfTriMesh del poligono
|
||||
int nId = ExeCreateSurfTmByPolygonWithHoles( nParentId, vPL, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTmByFlatContour( lua_State* L)
|
||||
@@ -1403,6 +1442,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTriangle", LuaCreateSurfTmTriangle) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectangle", LuaCreateSurfTmRectangle) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygon", LuaCreateSurfTmByPolygon) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByPolygonWithHoles", LuaCreateSurfTmByPolygonWithHoles) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByFlatContour", LuaCreateSurfTmByFlatContour) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegion", LuaCreateSurfTmByRegion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByExtrusion", LuaCreateSurfTmByExtrusion) ;
|
||||
|
||||
Reference in New Issue
Block a user