Files
Dario Sassi 5656595353 EgtExecutor 2.2i2 :
- aggiunta gestione BeamMgr
- aggiunte funzioni ExeInitBeamMgr, ExeBeamCalcSolid, ExeBeamGetSolid, ExeBeamShowSolid.
2020-09-02 17:47:38 +00:00

189 lines
5.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : GseContext.cpp Data : 01.09.14 Versione : 1.5i1
// Contenuto : Gestione contesti GSE ( Geometria, Scena, Esecuzione).
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "GseContext.h"
//----------------------------------------------------------------------------
static int s_nCurrGseCtx = 0 ;
static const int MAX_CTX = 10 ;
static bool s_GseOn[MAX_CTX] = { false, false, false, false, false, false, false, false, false, false} ;
static GseContext s_GseCtx[MAX_CTX] ;
//----------------------------------------------------------------------------
int
CreateGseContext( void)
{
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
if ( ! s_GseOn[i]) {
s_GseCtx[i].Clear() ;
s_GseOn[i] = true ;
return ( i + 1) ;
}
}
return 0 ;
}
//----------------------------------------------------------------------------
bool
DeleteGseContext( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX)
return false ;
s_GseOn[nInd-1] = false ;
s_GseCtx[nInd-1].Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
GetAllGseContextOn( INTVECTOR& vOn)
{
vOn.reserve( MAX_CTX) ;
vOn.clear() ;
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
if ( s_GseOn[i])
vOn.push_back( i + 1) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
ClearAllGseContexts( void)
{
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
s_GseOn[i] = false ;
s_GseCtx[i].Clear() ;
}
return true ;
}
//----------------------------------------------------------------------------
GseContext*
GetGseContext( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
return nullptr ;
return &(s_GseCtx[nInd-1]) ;
}
//----------------------------------------------------------------------------
IGeomDB*
GetGeomDB( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
return nullptr ;
return ( s_GseCtx[nInd-1].m_pGeomDB) ;
}
//----------------------------------------------------------------------------
IEGrScene*
GetScene( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
return nullptr ;
return ( s_GseCtx[nInd-1].m_pScene) ;
}
//----------------------------------------------------------------------------
ICmdParser*
GetTscExecutor( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
return nullptr ;
return ( s_GseCtx[nInd-1].m_pTscExec) ;
}
//----------------------------------------------------------------------------
bool
SetCurrGseContext( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1]) {
s_nCurrGseCtx = 0 ;
return false ;
}
s_nCurrGseCtx = nInd ;
return true ;
}
//----------------------------------------------------------------------------
bool
ResetCurrGseContext( void)
{
s_nCurrGseCtx = 0 ;
return true ;
}
//----------------------------------------------------------------------------
int
GetIndCurrGseContext( void)
{
return s_nCurrGseCtx ;
}
//----------------------------------------------------------------------------
GseContext*
GetCurrGseContext( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return &(s_GseCtx[s_nCurrGseCtx-1]) ;
}
//----------------------------------------------------------------------------
IGeomDB*
GetCurrGeomDB( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return ( s_GseCtx[s_nCurrGseCtx-1].m_pGeomDB) ;
}
//----------------------------------------------------------------------------
IMachMgr*
GetCurrMachMgr( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return ( s_GseCtx[s_nCurrGseCtx-1].m_pMachMgr) ;
}
//----------------------------------------------------------------------------
IBeamMgr*
GetCurrBeamMgr( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return ( s_GseCtx[s_nCurrGseCtx-1].m_pBeamMgr) ;
}
//----------------------------------------------------------------------------
IEGrScene*
GetCurrScene( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return ( s_GseCtx[s_nCurrGseCtx-1].m_pScene) ;
}
//----------------------------------------------------------------------------
ICmdParser*
GetCurrTscExecutor( void)
{
if ( s_nCurrGseCtx < 1 || s_nCurrGseCtx > MAX_CTX || ! s_GseOn[s_nCurrGseCtx-1])
return nullptr ;
return ( s_GseCtx[s_nCurrGseCtx-1].m_pTscExec) ;
}