EgtExecutor 1.8i3 :

- migliorata selezione e deselezione di tutti gli oggetti in un pezzo o in un layer.
This commit is contained in:
Dario Sassi
2017-09-25 07:09:45 +00:00
parent 33c0b9d638
commit f1a45f3076
2 changed files with 62 additions and 74 deletions
+62 -74
View File
@@ -411,6 +411,52 @@ ExeEraseEmptyParts( void)
return true ;
}
//-----------------------------------------------------------------------------
static bool
MySelectGroupObjs( IGeomDB* pGeomDB, int nGrpId, int nFilter)
{
bool bOk = true ;
// Ciclo sugli oggetti del gruppo
int nId = pGeomDB->GetFirstInGroup( nGrpId) ;
while ( nId != GDB_ID_NULL) {
// Se è gruppo seleziono i suoi componenti (ma non il gruppo)
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
bOk = MySelectGroupObjs( pGeomDB, nId, nFilter) ;
}
// altrimenti, se selezionabile lo seleziono direttamente
else {
if ( ( pGeomDB->GetGeoType( nId) & nFilter) != 0) {
if ( ! pGeomDB->SelectObj( nId))
bOk = false ;
}
}
// Passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
return bOk ;
}
//-----------------------------------------------------------------------------
static bool
MyDeselectGroupObjs( IGeomDB* pGeomDB, int nGrpId)
{
bool bOk = true ;
// Ciclo sugli oggetti del gruppo
int nId = pGeomDB->GetFirstInGroup( nGrpId) ;
while ( nId != GDB_ID_NULL) {
// Se è gruppo deseleziono i suoi componenti
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
bOk = MyDeselectGroupObjs( pGeomDB, nId) ;
}
// Eseguo deselezione (anche del gruppo per maggior sicurezza)
if ( ! pGeomDB->DeselectObj( nId))
bOk = false ;
// Passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeSelectPartObjs( int nPartId)
@@ -418,35 +464,10 @@ ExeSelectPartObjs( int nPartId)
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
bool bOk = true ;
// verifico sia veramente un pezzo
if ( ExeIsPart( nPartId)) {
// ciclo sugli oggetti del pezzo
int nId = pGeomDB->GetFirstInGroup( nPartId) ;
while ( nId != GDB_ID_NULL) {
// se è gruppo seleziono i suoi componenti
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
// ciclo sugli oggetti del layer
int nId2 = pGeomDB->GetFirstInGroup( nId) ;
while ( nId2 != GDB_ID_NULL) {
// se selezionabile, seleziono
if ( ( pGeomDB->GetGeoType( nId2) & pGseCtx->m_nObjFilterForSelect) != 0)
pGeomDB->SelectObj( nId2) ;
// passo al successivo
nId2 = pGeomDB->GetNext( nId2) ;
}
}
// altrimenti, se selezionabile lo seleziono direttamente
else {
if ( ( pGeomDB->GetGeoType( nId) & pGseCtx->m_nObjFilterForSelect) != 0)
pGeomDB->SelectObj( nId) ;
}
// passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
}
else
bOk = false ;
bool bOk = ExeIsPart( nPartId) ;
// eseguo selezione
bOk = bOk && MySelectGroupObjs( pGeomDB, nPartId, pGseCtx->m_nObjFilterForSelect) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSelectPartObjs(" + ToString( nPartId) + ")" +
@@ -463,24 +484,10 @@ ExeDeselectPartObjs( int nPartId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// verifico sia veramente un pezzo
if ( ExeIsPart( nPartId)) {
// ciclo sugli oggetti del pezzo
int nId = pGeomDB->GetFirstInGroup( nPartId) ;
while ( nId != GDB_ID_NULL) {
// se è gruppo deseleziono i suoi componenti
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP)
pGeomDB->DeselectGroupObjs( nId) ;
// altrimenti lo deseleziono direttamente
else
pGeomDB->DeselectObj( nId) ;
// passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
}
else
bOk = false ;
bool bOk = ExeIsPart( nPartId) ;
// eseguo deselezione (anche del pezzo per maggior sicurezza)
bOk = bOk && MyDeselectGroupObjs( pGeomDB, nPartId) && pGeomDB->DeselectObj( nPartId) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtDeselectPartObjs(" + ToString( nPartId) + ")" +
@@ -498,21 +505,11 @@ ExeSelectLayerObjs( int nLayerId)
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
IGeomDB* pGeomDB = pGseCtx->m_pGeomDB ;
bool bOk = true ;
// verifico sia veramente un layer
if ( ExeIsLayer( nLayerId)) {
// ciclo sugli oggetti del layer
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nId != GDB_ID_NULL) {
// se selezionabile, seleziono
if ( ( pGeomDB->GetGeoType( nId) & pGseCtx->m_nObjFilterForSelect) != 0)
pGeomDB->SelectObj( nId) ;
// passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
}
else
bOk = false ;
// verifico sia veramente un layer o almeno un gruppo di un pezzo
bool bOk = ExeIsLayer( nLayerId) ||
( ( pGeomDB->GetGdbType( nLayerId) == GDB_TY_GROUP) && ExeIsPart( pGeomDB->GetParentId( nLayerId))) ;
// eseguo selezione
bOk = bOk && MySelectGroupObjs( pGeomDB, nLayerId, pGseCtx->m_nObjFilterForSelect) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSelectLayerObjs(" + ToString( nLayerId) + ")" +
@@ -529,20 +526,11 @@ ExeDeselectLayerObjs( int nLayerId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// verifico sia veramente un layer
if ( ExeIsLayer( nLayerId)) {
// ciclo sugli oggetti del layer
int nId = pGeomDB->GetFirstInGroup( nLayerId) ;
while ( nId != GDB_ID_NULL) {
// deseleziono
pGeomDB->DeselectObj( nId) ;
// passo al successivo
nId = pGeomDB->GetNext( nId) ;
}
}
else
bOk = false ;
// verifico sia veramente un layer o almeno un gruppo di un pezzo
bool bOk = ExeIsLayer( nLayerId) ||
( ( pGeomDB->GetGdbType( nLayerId) == GDB_TY_GROUP) && ExeIsPart( pGeomDB->GetParentId( nLayerId))) ;
// eseguo deselezione (anche del layer per maggior sicurezza)
bOk = bOk && MyDeselectGroupObjs( pGeomDB, nLayerId) && pGeomDB->DeselectObj( nLayerId) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtDeselectLayerObjs(" + ToString( nLayerId) + ")" +