71254e1c04
- estensione e razionalizzazione della interfaccia.
94 lines
2.6 KiB
C++
94 lines
2.6 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 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
|
|
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) ;
|
|
}
|
|
|