EgtGeomKernel 1.9h3 :
- migliorata gestione aggiornamento IdMax alla cancellazione oggetti.
This commit is contained in:
Binary file not shown.
+1
-1
@@ -81,7 +81,7 @@ GeomDB::Init( void)
|
||||
// pulizia
|
||||
Clear() ;
|
||||
// imposto numero minimo buckets del map degli Id
|
||||
m_IdManager.Init( 1024) ;
|
||||
m_IdManager.Init( 8192) ;
|
||||
// imposto materiale di default
|
||||
m_GrpRadix.SetMaterial( Color()) ;
|
||||
// imposto riferimento griglia standard
|
||||
|
||||
+9
-3
@@ -14,6 +14,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -27,13 +28,13 @@ class IdManager
|
||||
bool Clear( void)
|
||||
{ m_GdbIdMap.clear() ; m_nMaxId = 0 ; return true ; }
|
||||
GdbObj* FindObj( int nId)
|
||||
{ INTPGDBO_UMAP::iterator Iter = m_GdbIdMap.find( nId) ;
|
||||
{ auto Iter = m_GdbIdMap.find( nId) ;
|
||||
if ( Iter != m_GdbIdMap.end())
|
||||
return Iter->second ;
|
||||
else
|
||||
return nullptr ; }
|
||||
const GdbObj* FindObj( int nId) const
|
||||
{ INTPGDBO_UMAP::const_iterator Iter = m_GdbIdMap.find( nId) ;
|
||||
{ auto Iter = m_GdbIdMap.find( nId) ;
|
||||
if ( Iter != m_GdbIdMap.end())
|
||||
return Iter->second ;
|
||||
else
|
||||
@@ -45,7 +46,7 @@ class IdManager
|
||||
bool RemoveObj( int nId)
|
||||
{ m_GdbIdMap.erase( nId) ;
|
||||
if ( nId == m_nMaxId && m_nMaxId > 0)
|
||||
-- m_nMaxId ;
|
||||
UpdateMaxId() ;
|
||||
return true ; }
|
||||
int GetNewId( void) const
|
||||
{ return ( m_nMaxId + 1) ; }
|
||||
@@ -54,6 +55,11 @@ class IdManager
|
||||
void UpdateMaxId( int nId)
|
||||
{ if ( nId > m_nMaxId)
|
||||
m_nMaxId = nId ; }
|
||||
void UpdateMaxId( void)
|
||||
{ int nMaxId = 0 ;
|
||||
for each (const auto& Igdbo in m_GdbIdMap)
|
||||
nMaxId = std::max( nMaxId, Igdbo.first) ;
|
||||
m_nMaxId = nMaxId ; }
|
||||
|
||||
private :
|
||||
typedef std::unordered_map< int, GdbObj*> INTPGDBO_UMAP ;
|
||||
|
||||
Reference in New Issue
Block a user