Merge branch 'master' of https://gitlab.steamware.net/egaltech/include
This commit is contained in:
@@ -243,5 +243,39 @@ bool SaveVoronoi( const ICRVCOMPOPOVECTOR& vCrvsCompo, const ICURVEPOVECTOR& vBi
|
||||
for ( int i = 0 ; i < int( vIds.size()); ++i)
|
||||
bOk = ( pGeomDB->RemoveGeoObjAndErase( vIds[i]) != nullptr) && bOk ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
bool SaveSfrBooleans( const ISurfFlatRegion* pSfrA, const ISurfFlatRegion* pSfrB,
|
||||
const std::string& sFile, int nFlag = GDB_SV_BIN,
|
||||
Color cColA = Color( 0., .5, .75, .5), Color cColB = Color( 0., .5, 0., .5))
|
||||
{
|
||||
// verifico validità superfici
|
||||
if ( pSfrA == nullptr || ! pSfrA->IsValid() ||
|
||||
pSfrB == nullptr || ! pSfrB->IsValid())
|
||||
return false ;
|
||||
// creo GeomDB temporaneo
|
||||
PtrOwner<IGeomDB> pGeomDB( CreateGeomDB()) ;
|
||||
if ( IsNull( pGeomDB))
|
||||
return false ;
|
||||
// inserisco le superfici nel GeomDB (sotto pezzo/layer)
|
||||
int nPartId = pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
|
||||
int nLayId = pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
|
||||
int nIdSfrA = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, static_cast<IGeoObj*>( CloneSurfFlatRegion( pSfrA))) ;
|
||||
if ( nIdSfrA == GDB_ID_NULL)
|
||||
return false ;
|
||||
pGeomDB->SetMaterial( nIdSfrA, cColA) ;
|
||||
int nIdSfrB = pGeomDB->AddGeoObj( GDB_ID_NULL, nLayId, static_cast<IGeoObj*>( CloneSurfFlatRegion( pSfrB))) ;
|
||||
if ( nIdSfrB == GDB_ID_NULL)
|
||||
return false ;
|
||||
pGeomDB->SetMaterial( nIdSfrB, cColB) ;
|
||||
// vettor di indici aggiunti
|
||||
INTVECTOR vIds = { nIdSfrA, nIdSfrB} ;
|
||||
// eseguo il salvataggio
|
||||
bool bOk = pGeomDB->Save( vIds, sFile, nFlag) ;
|
||||
// rimuovo l'oggetto dal GeomDB
|
||||
for ( int i = 0 ; i < int( vIds.size()) ; ++i)
|
||||
bOk = ( pGeomDB->RemoveGeoObjAndErase( vIds[i]) != nullptr) && bOk ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
Reference in New Issue
Block a user