From 29f3e208732750d96cb43728633ba939f9942d96 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 20 Sep 2015 08:59:23 +0000 Subject: [PATCH] EgtGeomKernel 1.6i3 : - aggiunta a GeomDB funzione RemoveGeoObjAndErase - aggiunta a SurfFlatRegionByContours funzione GetUnusedCurveTempProps. --- EgtGeomKernel.rc | Bin 11710 -> 11710 bytes GeomDB.cpp | 24 ++++++++++++++++++++++-- GeomDB.h | 3 ++- SfrCreate.cpp | 19 ++++++++++++++++--- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index ca2995d8c3b7fed67172dfac84182c0a9c33a7bc..a74eb3826f19ec0cd188bf8e80a9eb8aad697445 100644 GIT binary patch delta 94 zcmdlNy)SyhFE&Qw&A-_cnHh~ID{|{@_Trkr0u;H;XNwSVW8B;$>;>dw2zN+>g;Df- LFmBFL4&ed-W11TR delta 94 zcmdlNy)SyhFE&P_&A-_cnHh~HD{|{@_Trkr0u;H;XNwSVW8B;$>;>dw2zN+>g;Df- LFmBFL4&ed-Vf-5U diff --git a/GeomDB.cpp b/GeomDB.cpp index 68094f1..cc36d75 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -1209,8 +1209,7 @@ GeomDB::Erase( int nId) return false ; // recupero l'oggetto - GdbObj* pGdbObj ; - pGdbObj = m_IdManager.FindObj( nId) ; + GdbObj* pGdbObj = m_IdManager.FindObj( nId) ; if ( pGdbObj == nullptr) return false ; @@ -1234,6 +1233,27 @@ GeomDB::Erase( GdbObj* pGdbObj) return true ; } +//---------------------------------------------------------------------------- +IGeoObj* +GeomDB::RemoveGeoObjAndErase( int nId) +{ + // non si può cancellare il gruppo radice (escludo anche Id non validi) + if ( nId <= GDB_ID_ROOT) + return nullptr ; + // recupero l'oggetto geometrico + GdbGeo* pGdbGeo = ::GetGdbGeo( m_IdManager.FindObj( nId)) ; + if ( pGdbGeo == nullptr) + return nullptr ; + IGeoObj* pGeoObj = pGdbGeo->m_pGeoObj ; + // annullo il riferimento alla geometria nell'entità + pGdbGeo->m_pGeoObj = nullptr ; + // tolgo dalla lista e disalloco + pGdbGeo->Remove() ; + delete pGdbGeo ; + + return pGeoObj ; +} + //---------------------------------------------------------------------------- bool GeomDB::EmptyGroup( int nId) diff --git a/GeomDB.h b/GeomDB.h index 03e6596..b3b94c9 100644 --- a/GeomDB.h +++ b/GeomDB.h @@ -81,8 +81,9 @@ class GeomDB : public IGeomDB virtual int GetNewId( void) const ; virtual bool ChangeId( int nId, int nNewId) ; virtual bool Erase( int nId) ; + virtual IGeoObj* RemoveGeoObjAndErase( int nId) ; virtual bool EmptyGroup( int nId) ; - // transformations + // Transformations virtual bool Translate( int nId, const Vector3d& vtMove) ; virtual bool TranslateGlob( int nId, const Vector3d& vtMove) ; virtual bool TranslateGroup( int nId, const Vector3d& vtMove) ; diff --git a/SfrCreate.cpp b/SfrCreate.cpp index 9bcdf49..a2a3a95 100644 --- a/SfrCreate.cpp +++ b/SfrCreate.cpp @@ -238,10 +238,23 @@ SurfFlatRegionByContours::GetSurf( void) bool SurfFlatRegionByContours::AllCurvesUsed( void) { - // verifico se cono rimaste delle curve + // verifico se sono rimaste delle curve for ( auto& pCrv : m_vpCrv) { if ( pCrv != nullptr) - return true ; + return false ; } - return false ; + return true ; +} + +//------------------------------------------------------------------------------- +bool +SurfFlatRegionByContours::GetUnusedCurveTempProps( INTVECTOR& vId) +{ + vId.clear() ; + // verifico se sono rimaste delle curve + for ( auto& pCrv : m_vpCrv) { + if ( pCrv != nullptr) + vId.push_back( pCrv->GetTempProp()) ; + } + return ( ! vId.empty()) ; } \ No newline at end of file