EgtGeomKernel 1.6h1 :

- in GeomDB talto controllo chiave da Load (perdeva 7ms) e aggiunta ReplaceGeoObj
- aggiunta gestione intervalli 1d
- in autointersezioni aggiunta GetNumCrossInters per riconoscere autointersezioni con incrocio.
This commit is contained in:
Dario Sassi
2015-08-04 17:41:57 +00:00
parent 6f472c41ea
commit 8cd29c49ad
8 changed files with 245 additions and 19 deletions
+31 -19
View File
@@ -35,13 +35,22 @@ using namespace std ;
IGeomDB*
CreateGeomDB( void)
{
// verifico la chiave
int nRet = VerifyKey( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV) ;
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKC/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return nullptr ;
return false ;
}
if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKC/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
// creo il GeomDB
return static_cast<IGeomDB*> ( new(nothrow) GeomDB) ;
}
@@ -99,22 +108,6 @@ GeomDB::Clear( void)
bool
GeomDB::Load( const string& sFileIn, int nGroupId)
{
// verifico la chiave e le opzioni
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEGkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK) {
string sErr = "Error on Key (GKL/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
if ( (nOpt1 & KEYOPT_EGK_BASE) == 0 || nOptExpDays < GetCurrDay()) {
string sErr = "Error on Key (GKL/OPT)" ;
LOG_ERROR( GetEGkLogger(), sErr.c_str()) ;
return false ;
}
// recupero massimo Id (diventa Id base per entità da caricare)
int nBaseGdbId = m_IdManager.GetMaxId() ;
@@ -581,6 +574,25 @@ GeomDB::InsertGeoObj( int nId, int nRefId, int nSonBeforeAfter, IGeoObj* pGeoObj
return nId ;
}
//----------------------------------------------------------------------------
bool
GeomDB::ReplaceGeoObj( int nId, IGeoObj* pGeoObj)
{
// assegno GeoObj a gestore puntatore con rilascio automatico
PtrOwner<IGeoObj> pRPGeoObj( pGeoObj) ;
if ( IsNull( pRPGeoObj))
return false ;
// recupero l'oggetto Gdb
GdbGeo* pGdbGeo = GetGdbGeo( nId) ;
if ( pGdbGeo == nullptr)
return false ;
// elimino il vecchio oggetto e lo sostituisco con il nuovo
delete pGdbGeo->m_pGeoObj ;
pGdbGeo->m_pGeoObj = Release( pRPGeoObj) ;
return true ;
}
//----------------------------------------------------------------------------
int
GeomDB::GetFirstInGroup( int nGroupId) const