EgtInterface 1.6a2 :
- numerose modifiche e correzioni - aggiunta registrazione comandi in formato lua - aggiunto valutatore di espressioni.
This commit is contained in:
+69
-64
@@ -21,6 +21,7 @@
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
@@ -65,13 +66,35 @@ BOOL
|
||||
__stdcall EgtInvertSurface( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSurf == nullptr)
|
||||
return false ;
|
||||
// la inverto
|
||||
return ( pSurf->Invert() ? TRUE : FALSE) ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
bool bOk = true ;
|
||||
// eseguo inversione singola
|
||||
if ( nId != GDB_ID_SEL) {
|
||||
// recupero la superficie e la inverto
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSurf != nullptr && ! pSurf->Invert())
|
||||
bOk = false ;
|
||||
}
|
||||
// eseguo inversione dei selezionati
|
||||
else {
|
||||
int nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nI != GDB_ID_NULL && bOk) {
|
||||
// recupero la superficie e la inverto
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nI)) ;
|
||||
if ( pSurf != nullptr && ! pSurf->Invert())
|
||||
bOk = false ;
|
||||
// passo alla successiva
|
||||
nI = pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
}
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtInvertSurf(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -144,98 +167,80 @@ __stdcall EgtMirrorText( int nId, BOOL bOnL)
|
||||
return ( pTXT->Mir( ( bOnL ? true : false)) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtTextToOutline( int nId, int nDestGroupId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il riferimento del testo
|
||||
Frame3d frTXT ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frTXT))
|
||||
return FALSE ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGroupId, frDest))
|
||||
return FALSE ;
|
||||
// recupero l'outline del testo
|
||||
ICURVEPLIST lstPCRV ;
|
||||
pTXT->GetOutline( lstPCRV) ;
|
||||
// inserisco le curve nel gruppo destinazione dopo aver sistemato il cambio di riferimento
|
||||
bool bOk = true ;
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
(*iIter)->LocToLoc( frTXT, frDest) ;
|
||||
if ( pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGroupId, (*iIter)) == GDB_ID_NULL) {
|
||||
delete (*iIter) ;
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtExplodeText( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
bool bOk = true ;
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return FALSE ;
|
||||
bOk = false ;
|
||||
// recupero l'outline del testo
|
||||
ICURVEPLIST lstPCRV ;
|
||||
pTXT->GetOutline( lstPCRV) ;
|
||||
bOk = bOk && pTXT->GetOutline( lstPCRV) ;
|
||||
// inserisco le curve nella stessa posizione del testo
|
||||
bool bOk = true ;
|
||||
ICURVEPLIST::iterator iIter ;
|
||||
for ( iIter = lstPCRV.begin() ; iIter != lstPCRV.end() ; ++ iIter) {
|
||||
for ( iIter = lstPCRV.begin() ; bOk && iIter != lstPCRV.end() ; ++ iIter) {
|
||||
// inserisco la curva nello stesso gruppo e nello stesso posto del GeomDB
|
||||
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, (*iIter)) ;
|
||||
if ( nCrvId == GDB_ID_NULL)
|
||||
return FALSE ;
|
||||
bOk = false ;
|
||||
// copio gli attributi
|
||||
if ( ! pGeomDB->CopyAttributes( nId, nCrvId))
|
||||
return FALSE ;
|
||||
bOk = false ;
|
||||
}
|
||||
// elimino il testo originale
|
||||
return ( pGeomDB->Erase( nId) ? TRUE : FALSE) ;
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtExplodeText(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtSplitText( int nId, int nDestGroupId)
|
||||
__stdcall EgtSplitText( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, FALSE)
|
||||
bool bOk = true ;
|
||||
// recupero il testo
|
||||
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pTXT == nullptr)
|
||||
return FALSE ;
|
||||
// recupero il riferimento del testo
|
||||
Frame3d frTXT ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frTXT))
|
||||
return FALSE ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGroupId, frDest))
|
||||
return FALSE ;
|
||||
bOk = false ;
|
||||
// recupero l'esplosione del testo in linee singole
|
||||
IEXTTEXTPVECTOR vTxt ;
|
||||
pTXT->SplitOnLineBreak( vTxt) ;
|
||||
// inserisco i nuovi testi nel gruppo destinazione dopo aver sistemato il cambio di riferimento
|
||||
bool bOk = true ;
|
||||
for ( int i = 0 ; i < int( vTxt.size()) ; ++ i) {
|
||||
vTxt[i]->LocToLoc( frTXT, frDest) ;
|
||||
if ( pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGroupId, vTxt[i]) == GDB_ID_NULL) {
|
||||
bOk = bOk && pTXT->SplitOnLineBreak( vTxt) ;
|
||||
// inserisco i nuovi testi nella stessa posizione del testo
|
||||
for ( int i = 0 ; bOk && i < int( vTxt.size()) ; ++ i) {
|
||||
// inserimento
|
||||
int nCrvId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_BEFORE, vTxt[i]) ;
|
||||
// se errore
|
||||
if ( nCrvId == GDB_ID_NULL) {
|
||||
delete vTxt[i] ;
|
||||
bOk = false ;
|
||||
}
|
||||
// altrimenti copio gli attributi
|
||||
else {
|
||||
if ( ! pGeomDB->CopyAttributes( nId, nCrvId))
|
||||
bOk = false ;
|
||||
}
|
||||
}
|
||||
// elimino il testo originale
|
||||
bOk = bOk && pGeomDB->Erase( nId) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSplitText(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
Reference in New Issue
Block a user