EgtGeomKernel :
- migliorie a IdManager per aggiornamento dopo cancellazione entità.
This commit is contained in:
+6
-11
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2013
|
||||
// EgalTech 2013-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : IdManager.h Data : 02.12.13 Versione : 1.4a3
|
||||
// File : IdManager.h Data : 11.12.18 Versione : 1.9l2
|
||||
// Contenuto : Dichiarazione e implementazione della classe IdManager.
|
||||
//
|
||||
//
|
||||
@@ -14,8 +14,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class IdManager
|
||||
@@ -45,7 +43,6 @@ class IdManager
|
||||
return m_GdbIdMap.emplace( nId, pGObj).second ; }
|
||||
bool RemoveObj( int nId)
|
||||
{ m_GdbIdMap.erase( nId) ;
|
||||
if ( nId == m_nMaxId && m_nMaxId > 0)
|
||||
UpdateMaxId() ;
|
||||
return true ; }
|
||||
int GetNewId( void) const
|
||||
@@ -56,14 +53,12 @@ class IdManager
|
||||
{ if ( nId > m_nMaxId)
|
||||
m_nMaxId = nId ; }
|
||||
void UpdateMaxId( void)
|
||||
{ int nMaxId = 0 ;
|
||||
if ( m_GdbIdMap.find( m_nMaxId - 1) != m_GdbIdMap.end()) {
|
||||
{ while ( m_nMaxId > 0) {
|
||||
if ( m_GdbIdMap.find( m_nMaxId) == m_GdbIdMap.end())
|
||||
-- m_nMaxId ;
|
||||
else
|
||||
return ;
|
||||
}
|
||||
for (const auto& Igdbo : 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