EgtMachKernel 1.6e1 :
- aggiunta prima versione di caricamento delle macchine.
This commit is contained in:
+55
-2
@@ -17,6 +17,7 @@
|
||||
#include "MachMgr.h"
|
||||
#include "MachConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgnFileUtils.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include <new>
|
||||
@@ -53,17 +54,22 @@ MachMgr::MachMgr( void)
|
||||
{
|
||||
m_pGeomDB = nullptr ;
|
||||
m_nMachBaseId = GDB_ID_NULL ;
|
||||
m_nMachAuxId = GDB_ID_NULL ;
|
||||
m_nCurrMGrpId = GDB_ID_NULL ;
|
||||
m_nCurrMGeoId = GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::Init( IGeomDB* pGeomDB)
|
||||
MachMgr::Init( IGeomDB* pGeomDB, const string& sMachinesDir)
|
||||
{
|
||||
m_pGeomDB = pGeomDB ;
|
||||
m_sMachinesDir = sMachinesDir ;
|
||||
m_nMachBaseId = GDB_ID_NULL ;
|
||||
m_nMachAuxId = GDB_ID_NULL ;
|
||||
m_nCurrMGrpId = GDB_ID_NULL ;
|
||||
return ( m_pGeomDB != nullptr) ;
|
||||
m_nCurrMGeoId = GDB_ID_NULL ;
|
||||
return ( m_pGeomDB != nullptr && ExistsDirectory( m_sMachinesDir)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -190,3 +196,50 @@ MachMgr::CreateMachBase( void)
|
||||
m_pGeomDB->SetLevel( m_nMachBaseId, GDB_LV_SYSTEM) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::IsMachAux( int nId) const
|
||||
{
|
||||
int nLevel ;
|
||||
std::string sName ;
|
||||
return ( m_pGeomDB != nullptr &&
|
||||
m_pGeomDB->GetLevel( nId, nLevel) && nLevel == GDB_LV_TEMP &&
|
||||
m_pGeomDB->GetName( nId, sName) && sName == MACH_AUX) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::VerifyMachAux( void) const
|
||||
{
|
||||
// verifica collegamento a DB geometrico
|
||||
if ( m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// verifica validità indice del gruppo base
|
||||
if ( m_nMachAuxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// verifica esistenza gruppo di base per macchinate
|
||||
if ( ! IsMachAux( m_nMachAuxId)) {
|
||||
const_cast<int&>( m_nMachAuxId) = GDB_ID_NULL ;
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::CreateMachAux( void)
|
||||
{
|
||||
// se già esiste, esco con successo
|
||||
if ( VerifyMachAux())
|
||||
return true ;
|
||||
// non trovato, devo creare il gruppo di base delle lavorazioni
|
||||
m_nMachAuxId = m_pGeomDB->InsertGroup( GDB_ID_NULL, GDB_ID_ROOT, GDB_FIRST_SON, GLOB_FRM) ;
|
||||
if ( m_nMachAuxId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// imposto nome del gruppo
|
||||
m_pGeomDB->SetName( m_nMachAuxId, MACH_AUX) ;
|
||||
// imposto livello del gruppo a Temp
|
||||
m_pGeomDB->SetLevel( m_nMachAuxId, GDB_LV_TEMP) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user