EgtInterface 1.6e2 :
- esecutore e lua scorporato in EgtExecutor.
This commit is contained in:
+42
-365
@@ -14,45 +14,33 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExistsObj( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// verifico se esiste l'oggetto
|
||||
return ( pGeomDB->ExistsObj( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
__stdcall EgtExistsObj( int nId)
|
||||
{
|
||||
return ( ExeExistsObj( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetParent( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// verifico se esiste l'oggetto
|
||||
return pGeomDB->GetParentId( nId) ;
|
||||
return ExeGetParent( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetGroupGlobFrame( int nId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il riferimento globale del gruppo
|
||||
Frame3d frGlob ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frGlob))
|
||||
if ( ! ExeGetGroupGlobFrame( nId, frGlob))
|
||||
return FALSE ;
|
||||
// aggiorno i parametri del frame
|
||||
VEC_FROM_3D( ptOrig, frGlob.Orig())
|
||||
@@ -64,132 +52,65 @@ __stdcall EgtGetGroupGlobFrame( int nId, double ptOrig[3], double vtX[3], double
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetGroupObjs( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il numero di oggetti nel gruppo
|
||||
return pGeomDB->GetGroupObjs( nId) ;
|
||||
}
|
||||
__stdcall EgtGetGroupObjs( int nId)
|
||||
{
|
||||
return ExeGetGroupObjs( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetFirstInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo oggetto nel gruppo
|
||||
return pGeomDB->GetFirstInGroup( nGroupId) ;
|
||||
return ExeGetFirstInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetNext( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il prossimo oggetto nello stesso gruppo
|
||||
return pGeomDB->GetNext( nId) ;
|
||||
return ExeGetNext( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetLastInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo oggetto nel gruppo
|
||||
return pGeomDB->GetLastInGroup( nGroupId) ;
|
||||
return ExeGetLastInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetPrev( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente oggetto nello stesso gruppo
|
||||
return pGeomDB->GetPrev( nId) ;
|
||||
return ExeGetPrev( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetFirstGroupInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo gruppo nel gruppo
|
||||
return pGeomDB->GetFirstGroupInGroup( nGroupId) ;
|
||||
return ExeGetFirstGroupInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetNextGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il prossimo gruppo nello stesso gruppo
|
||||
return pGeomDB->GetNextGroup( nId) ;
|
||||
return ExeGetNextGroup( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetLastGroupInGroup( int nGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo gruppo nel gruppo
|
||||
return pGeomDB->GetLastGroupInGroup( nGroupId) ;
|
||||
return ExeGetLastGroupInGroup( nGroupId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetPrevGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente gruppo nello stesso gruppo
|
||||
return pGeomDB->GetPrevGroup( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
EgtGetFirstNameInGroup( int nGroupId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il primo oggetto con il nome desiderato nel gruppo
|
||||
return pGeomDB->GetFirstNameInGroup( nGroupId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
EgtGetNextName( int nId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il prossimo oggetto nello stesso gruppo con il nome voluto
|
||||
return pGeomDB->GetNextName( nId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
EgtGetLastNameInGroup( int nGroupId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero l'ultimo oggetto con il nome desiderato nel gruppo
|
||||
return pGeomDB->GetLastNameInGroup( nGroupId, sName) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
EgtGetPrevName( int nId, const string& sName)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il precedente oggetto nello stesso gruppo con il nome voluto
|
||||
return pGeomDB->GetPrevName( nId, sName) ;
|
||||
return ExeGetPrevGroup( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -198,7 +119,7 @@ __stdcall EgtGetBBox( int nId, int nFlag, double ptMin[3], double ptMax[3])
|
||||
{
|
||||
// recupero il bounding box dell'oggetto in locale
|
||||
BBox3d b3Box ;
|
||||
if ( ! EgtGetBBox( nId, nFlag, b3Box))
|
||||
if ( ! ExeGetBBox( nId, nFlag, b3Box))
|
||||
return FALSE ;
|
||||
ptMin[0] = b3Box.GetMin().x ;
|
||||
ptMin[1] = b3Box.GetMin().y ;
|
||||
@@ -209,23 +130,13 @@ __stdcall EgtGetBBox( int nId, int nFlag, double ptMin[3], double ptMax[3])
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetBBox( int nId, int nFlag, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il bounding box dell'oggetto in locale
|
||||
return pGeomDB->GetLocalBBox( nId, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetBBoxGlob( int nId, int nFlag, double ptMin[3], double ptMax[3])
|
||||
{
|
||||
// recupero il bounding box dell'oggetto in globale
|
||||
BBox3d b3Box ;
|
||||
if ( ! EgtGetBBoxGlob( nId, nFlag, b3Box))
|
||||
if ( ! ExeGetBBoxGlob( nId, nFlag, b3Box))
|
||||
return FALSE ;
|
||||
// converto il risultato
|
||||
ptMin[0] = b3Box.GetMin().x ;
|
||||
@@ -237,16 +148,6 @@ __stdcall EgtGetBBoxGlob( int nId, int nFlag, double ptMin[3], double ptMax[3])
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetBBoxGlob( int nId, int nFlag, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il bounding box dell'oggetto in globale
|
||||
return pGeomDB->GetGlobalBBox( nId, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetBBoxRef( int nId, int nFlag, const double ptOrig[3],
|
||||
@@ -259,7 +160,7 @@ __stdcall EgtGetBBoxRef( int nId, int nFlag, const double ptOrig[3],
|
||||
return FALSE ;
|
||||
// recupero il bounding box dell'oggetto nel riferimento
|
||||
BBox3d b3Box ;
|
||||
if ( ! EgtGetBBoxRef( nId, nFlag, frRef, b3Box))
|
||||
if ( ! ExeGetBBoxRef( nId, nFlag, frRef, b3Box))
|
||||
return FALSE ;
|
||||
// converto il risultato
|
||||
ptMin[0] = b3Box.GetMin().x ;
|
||||
@@ -271,148 +172,39 @@ __stdcall EgtGetBBoxRef( int nId, int nFlag, const double ptOrig[3],
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtGetBBoxRef( int nId, int nFlag, const Frame3d& frRef, BBox3d& b3Box)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero il bounding box dell'oggetto nel riferimento
|
||||
return pGeomDB->GetRefBBox( nId, frRef, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCopy( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// eseguo la copia
|
||||
int nNewId = pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopy(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
return ExeCopy( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// eseguo la copia mantenendo la posizione in globale
|
||||
int nNewId = pGeomDB->CopyGlob( nSouId, GDB_ID_NULL, nRefId, nSonBeforeAfter) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
else
|
||||
sLua = "EgtCopyGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return nNewId ;
|
||||
return ExeCopyGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// eseguo la rilocazione
|
||||
bool bOk = pGeomDB->Relocate( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocate(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeRelocate( nSouId, nRefId, nSonBeforeAfter) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// eseguo la rilocazione mantenendo la posizione in globale
|
||||
bool bOk = pGeomDB->RelocateGlob( nSouId, nRefId, nSonBeforeAfter) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( nSonBeforeAfter == GDB_LAST_SON)
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
else
|
||||
sLua = "EgtRelocateGlob(" + ToString( nSouId) + "," +
|
||||
ToString( nRefId) + "," +
|
||||
InsToString( nSonBeforeAfter) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeRelocateGlob( nSouId, nRefId, nSonBeforeAfter) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtChangeId( int nId, int nNewId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// eseguo cambio di Id
|
||||
bool bOk = pGeomDB->ChangeId( nId, nNewId) ;
|
||||
// se pezzo corrente o layer corrente
|
||||
if ( bOk) {
|
||||
if ( nId == EgtGetCurrPart())
|
||||
EgtSetCurrPartLayer( nNewId, EgtGetCurrLayer()) ;
|
||||
else if ( nId == EgtGetCurrLayer())
|
||||
EgtSetCurrPartLayer( EgtGetCurrPart(), nNewId) ;
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtChangeId(" + ToString( nId) + "," +
|
||||
ToString( nNewId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeChangeId( nId, nNewId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -421,112 +213,33 @@ __stdcall EgtErase( int nId)
|
||||
{
|
||||
INTVECTOR vIds ;
|
||||
vIds.push_back( nId) ;
|
||||
return ( EgtErase( vIds) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EgtErase( const INTVECTOR& vIds)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// eseguo cancellazione
|
||||
bool bOk = true ;
|
||||
bool bErasedCurrPart = false ;
|
||||
bool bErasedCurrLayer = false ;
|
||||
int nCurrPartId = EgtGetCurrPart() ;
|
||||
int nCurrLayerId = EgtGetCurrLayer() ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
int nId = (( vIds[i] != GDB_ID_SEL) ? vIds[i] : pGeomDB->GetFirstSelectedObj()) ;
|
||||
while ( nId != GDB_ID_NULL) {
|
||||
// cancello
|
||||
if ( ! pGeomDB->Erase( nId))
|
||||
bOk = false ;
|
||||
// verifico se cancellato pezzo corrente o layer corrente
|
||||
if ( nId == nCurrPartId)
|
||||
bErasedCurrPart = true ;
|
||||
else if ( nId == nCurrLayerId)
|
||||
bErasedCurrLayer = true ;
|
||||
// passo al successivo
|
||||
nId = (( vIds[i] != GDB_ID_SEL) ? GDB_ID_NULL : pGeomDB->GetFirstSelectedObj()) ;
|
||||
}
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtErase({" + IdListToString( vIds) + "})" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// se cancellato pezzo corrente o layer corrente (va qui perchè salva altro comando che è successivo)
|
||||
if ( bErasedCurrPart)
|
||||
EgtResetCurrPartLayer() ;
|
||||
else if ( bErasedCurrLayer)
|
||||
EgtSetCurrPartLayer( nCurrPartId, EgtGetFirstLayer( nCurrPartId, true)) ;
|
||||
// restituisco risultato
|
||||
return bOk ;
|
||||
return ( ExeErase( vIds) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtEmptyGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// svuoto il gruppo
|
||||
bool bOk = pGeomDB->EmptyGroup( nId) ;
|
||||
// se cancellato pezzo corrente o layer corrente
|
||||
int nCurrPartId = EgtGetCurrPart() ;
|
||||
int nCurrLayerId = EgtGetCurrLayer() ;
|
||||
if ( ! pGeomDB->ExistsObj( nCurrPartId))
|
||||
EgtResetCurrPartLayer() ;
|
||||
else if ( ! pGeomDB->ExistsObj( nCurrLayerId))
|
||||
EgtSetCurrPartLayer( nCurrPartId, EgtGetFirstLayer( nCurrPartId, true)) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtEmptyGroup(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
return ( ExeEmptyGroup( nId) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetType( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_TY_NONE)
|
||||
// recupero il tipo GDB
|
||||
int nType = pGeomDB->GetGdbType( nId) ;
|
||||
if ( nType == GDB_TY_GEO) {
|
||||
// recupero il tipo Geo
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return GDB_TY_NONE ;
|
||||
else
|
||||
return pGeoObj->GetType() ;
|
||||
}
|
||||
else if ( nType == GDB_TY_GROUP)
|
||||
return GDB_TY_GROUP ;
|
||||
else
|
||||
return GDB_TY_NONE ;
|
||||
return ExeGetType( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtGetTitle( int nId, wchar_t*& wsTitle)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return FALSE ;
|
||||
// recupero la stringa del titolo
|
||||
wsTitle = _wcsdup( stringtoW( pGeoObj->GetTitle())) ;
|
||||
string sTitle ;
|
||||
if ( ! ExeGetTitle( nId, sTitle))
|
||||
return FALSE ;
|
||||
// alloco buffer di ritorno ed eseguo copia
|
||||
wsTitle = _wcsdup( stringtoW( sTitle)) ;
|
||||
return (( wsTitle == nullptr) ? FALSE : TRUE) ;
|
||||
}
|
||||
|
||||
@@ -534,37 +247,10 @@ __stdcall EgtGetTitle( int nId, wchar_t*& wsTitle)
|
||||
BOOL
|
||||
__stdcall EgtGroupDump( int nId, wchar_t*& wsDump)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// preparo l'intestazione
|
||||
string sDump = "Group " + ToString( nId) + "\r\n" ;
|
||||
// preparo gli attributi
|
||||
pGeomDB->DumpAttributes( nId, sDump, "\r\n") ;
|
||||
// numero di nodi (figli)
|
||||
int nNodes = pGeomDB->GetGroupObjs( nId) ;
|
||||
sDump += "Nodes : " + ToString( nNodes) + "\r\n" ;
|
||||
// riferimento in globale
|
||||
Frame3d frGlob ;
|
||||
if ( pGeomDB->GetGroupGlobFrame( nId, frGlob)) {
|
||||
sDump += "GlobFrame :\r\n" ;
|
||||
sDump += " O(" + ToString( frGlob.Orig()) + ")\r\n" ;
|
||||
sDump += " X(" + ToString( frGlob.VersX()) + ")\r\n" ;
|
||||
sDump += " Y(" + ToString( frGlob.VersY()) + ")\r\n" ;
|
||||
sDump += " Z(" + ToString( frGlob.VersZ()) + ")\r\n" ;
|
||||
}
|
||||
// ingombro in globale
|
||||
BBox3d b3Glob ;
|
||||
if ( pGeomDB->GetGlobalBBox( nId, b3Glob, BBF_EXACT)) {
|
||||
sDump += "GlobBBox :\r\n" ;
|
||||
Point3d ptMin, ptMax ;
|
||||
if ( b3Glob.GetMinMax( ptMin, ptMax)) {
|
||||
sDump += " m(" + ToString( ptMin) + ")\r\n" ;
|
||||
sDump += " M(" + ToString( ptMax) + ")\r\n" ;
|
||||
}
|
||||
else {
|
||||
sDump += " Empty\r\n" ;
|
||||
}
|
||||
}
|
||||
// recupero la stringa di dump
|
||||
string sDump ;
|
||||
if ( ! ExeGroupDump( nId, sDump))
|
||||
return FALSE ;
|
||||
// alloco buffer di ritorno ed eseguo copia
|
||||
wsDump = _wcsdup( stringtoW( sDump)) ;
|
||||
return (( wsDump == nullptr) ? FALSE : TRUE) ;
|
||||
@@ -574,18 +260,9 @@ __stdcall EgtGroupDump( int nId, wchar_t*& wsDump)
|
||||
BOOL
|
||||
__stdcall EgtGeoObjDump( int nId, wchar_t*& wsDump)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero l'oggetto geometrico
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nId) ;
|
||||
if ( pGeoObj == nullptr)
|
||||
return FALSE ;
|
||||
// preparo l'intestazione
|
||||
string sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ;
|
||||
// preparo gli attributi
|
||||
pGeomDB->DumpAttributes( nId, sDump, "\r\n") ;
|
||||
// recupero i dati geometrici
|
||||
if ( ! pGeoObj->Dump( sDump, "\r\n"))
|
||||
// recupero la stringa di dump
|
||||
string sDump ;
|
||||
if ( ! ExeGeoObjDump( nId, sDump))
|
||||
return FALSE ;
|
||||
// alloco buffer di ritorno ed eseguo copia
|
||||
wsDump = _wcsdup( stringtoW( sDump)) ;
|
||||
|
||||
Reference in New Issue
Block a user