EgtInterface 1.5j6 :

- aggiunte numerose funzionalità in API.
This commit is contained in:
Dario Sassi
2014-10-30 08:51:03 +00:00
parent 2e33ab438e
commit e4d952bf32
18 changed files with 559 additions and 107 deletions
+107 -28
View File
@@ -55,14 +55,19 @@ __stdcall EgtInitScene( HWND hWnd, int nDriver, int b2Buff, int nColorBits, int
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetBackground( int nTopRed, int nTopGreen, int nTopBlue,
int nBottomRed, int nBottomGreen, int nBottomBlue, BOOL bRedraw)
__stdcall EgtSetBackground( const int TopCol[4], const int BottomCol[4], BOOL bRedraw)
{
return EgtSetBackground( Color( TopCol), Color( BottomCol), bRedraw) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetBackground( Color TopCol, Color BottomCol, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto lo sfondo
pGseCtx->m_pScene->SetBackground( Color( nTopRed, nTopGreen, nTopBlue),
Color( nBottomRed, nBottomGreen, nBottomBlue)) ;
pGseCtx->m_pScene->SetBackground( TopCol, BottomCol) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
@@ -70,35 +75,115 @@ __stdcall EgtSetBackground( int nTopRed, int nTopGreen, int nTopBlue,
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMarkAttribs( int nRed, int nGreen, int nBlue)
__stdcall EgtSetMarkAttribs( const int MarkCol[4])
{
return EgtSetMarkAttribs( Color( MarkCol)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMarkAttribs( Color MarkCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore del Mark
Color MKcol( nRed, nGreen, nBlue) ;
return ( pGseCtx->m_pScene->SetMark( MKcol) ? TRUE : FALSE) ;
return ( pGseCtx->m_pScene->SetMark( MarkCol) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoLineAttribs( int nRed, int nGreen, int nBlue)
__stdcall EgtSetGeoLineAttribs( const int GlCol[4])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore della linea geometrica gestita direttamente dalla scena
Color Glcol( nRed, nGreen, nBlue) ;
return ( pGseCtx->m_pScene->SetGeoLineAttribs( Glcol) ? TRUE : FALSE) ;
return EgtSetGeoLineAttribs( Color( GlCol)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRectAttribs( BOOL bOutline, int nRed, int nGreen, int nBlue, int nAlpha)
__stdcall EgtSetGeoLineAttribs( Color GlCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore della linea geometrica gestita direttamente dalla scena
Color WRcol( nRed, nGreen, nBlue, nAlpha) ;
return ( pGseCtx->m_pScene->SetWinRectAttribs( ( bOutline != FALSE), WRcol) ? TRUE : FALSE) ;
return ( pGseCtx->m_pScene->SetGeoLineAttribs( GlCol) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRectAttribs( BOOL bOutline, const int WrCol[4])
{
return EgtSetWinRectAttribs( bOutline, Color( WrCol)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRectAttribs( BOOL bOutline, Color WrCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore della linea geometrica gestita direttamente dalla scena
return ( pGseCtx->m_pScene->SetWinRectAttribs( ( bOutline != FALSE), WrCol) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridShow( BOOL bShowGrid, BOOL bShowFrame)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto stato visualizzazione griglia
return ( pGseCtx->m_pScene->SetGridShow( ( bShowGrid != FALSE), ( bShowFrame != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridFrame( const double ptOrig[3], const double vX[3], const double vY[3], const double vZ[3])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// costruisco il riferimento
Frame3d frFrame ;
if ( ! frFrame.Set( ptOrig, vX, vY, vZ))
return GDB_ID_NULL ;
// imposto il riferimento della griglia
return ( pGseCtx->m_pScene->SetGridFrame( frFrame) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetGridFrame( double ptOrig[3], double vX[3], double vY[3], double vZ[3])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero il riferimento della griglia
const Frame3d& frGrid = pGseCtx->m_pScene->GetGridFrame() ;
// assegno i valori di ritorno
VEC_FROM_3D( ptOrig, frGrid.Orig())
VEC_FROM_3D( vX, frGrid.VersX())
VEC_FROM_3D( vY, frGrid.VersY())
VEC_FROM_3D( vZ, frGrid.VersZ())
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtSstep)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto i parametri geometrici di griglia
return ( pGseCtx->m_pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridColor( const int nMinCol[4], const int nMajCol[4])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto i colori di griglia
Color colMin( nMinCol) ;
Color colMaj( nMajCol) ;
return ( pGseCtx->m_pScene->SetGridColor( colMin, colMaj) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
@@ -188,18 +273,16 @@ __stdcall EgtUnselectableClearAll( void)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetSelectedSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,
double ptP[3])
__stdcall EgtGetGraphicSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,
double ptP[3])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// trovo il punto snap da selezione
Point3d ptSnap ;
if ( ! pGseCtx->m_pScene->GetSelectedSnapPoint( nSnap, Point3d( nWinX, nWinY), nSelW, nSelH, ptSnap))
if ( ! pGseCtx->m_pScene->GetGraphicSnapPoint( nSnap, Point3d( nWinX, nWinY), nSelW, nSelH, ptSnap))
return FALSE ;
ptP[0] = ptSnap.x ;
ptP[1] = ptSnap.y ;
ptP[2] = ptSnap.z ;
VEC_FROM_3D( ptP, ptSnap)
return TRUE ;
}
@@ -458,9 +541,7 @@ __stdcall EgtUnProjectPoint( int nWinX, int nWinY, double ptP[3])
Point3d ptWorld ;
if ( ! pScene->UnProject( ptView, ptWorld))
return FALSE ;
ptP[0] = ptWorld.x ;
ptP[1] = ptWorld.y ;
ptP[2] = ptWorld.z ;
VEC_FROM_3D( ptP, ptWorld)
return TRUE ;
}
@@ -474,8 +555,6 @@ __stdcall EgtProjectPoint( const double ptP[3], double ptWin[3])
Point3d ptView ;
if ( ! pScene->Project( ptP, ptView))
return FALSE ;
ptWin[0] = ptView.x ;
ptWin[1] = ptView.y ;
ptWin[2] = ptView.z ;
VEC_FROM_3D( ptWin, ptView)
return TRUE ;
}