diff --git a/API_Scene.cpp b/API_Scene.cpp index 692079b..9781f46 100644 --- a/API_Scene.cpp +++ b/API_Scene.cpp @@ -68,6 +68,39 @@ __stdcall EgtSetBackground( int nGseCtx, int nTopRed, int nTopGreen, int nTopBlu return TRUE ; } +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtSetMarkAttribs( int nGseCtx, int nRed, int nGreen, int nBlue) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // imposto il colore del Mark + Color MKcol( nRed, nGreen, nBlue) ; + return ( pGseCtx->m_pScene->SetMark( MKcol) ? TRUE : FALSE) ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtSetGeoLineAttribs( int nGseCtx, int nRed, int nGreen, int nBlue) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + 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) ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtSetWinRectAttribs( int nGseCtx, BOOL bOutline, int nRed, int nGreen, int nBlue, int nAlpha) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + 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) ; +} + //----------------------------------------------------------------------------- BOOL __stdcall EgtResize( int nGseCtx, int nW, int nH) @@ -123,6 +156,23 @@ __stdcall EgtGetNextSelectedObj( int nGseCtx) return pGseCtx->m_pScene->GetNextSelectedObj() ; } +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtGetSelectedSnapPoint( int nGseCtx, int nSnap, int nWinX, int nWinY, int nSelW, int nSelH, + double ptP[3]) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + 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)) + return FALSE ; + ptP[0] = ptSnap.x ; + ptP[1] = ptSnap.y ; + ptP[2] = ptSnap.z ; + return TRUE ; +} + //----------------------------------------------------------------------------- BOOL __stdcall EgtSetShowMode( int nGseCtx, int nShowMode, BOOL bRedraw) @@ -140,19 +190,39 @@ __stdcall EgtSetShowMode( int nGseCtx, int nShowMode, BOOL bRedraw) return FALSE ; } +//----------------------------------------------------------------------------- +int +__stdcall EgtGetShowMode( int nGseCtx) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // recupero il modo di visualizzazione + return pGseCtx->m_pScene->GetShowMode() ; +} + //----------------------------------------------------------------------------- BOOL -__stdcall EgtSetShowCurveDirection( int nGseCtx, int nShow, BOOL bRedraw) +__stdcall EgtSetShowCurveDirection( int nGseCtx, BOOL bShow, BOOL bRedraw) { GseContext* pGseCtx = GetGseContext( nGseCtx) ; VERIFY_CTX_SCENE( pGseCtx, FALSE) // imposto stato - pGseCtx->m_pScene->SetShowCurveDirection( nShow != 0) ; + pGseCtx->m_pScene->SetShowCurveDirection( bShow != FALSE) ; if ( bRedraw) pGseCtx->m_pScene->RedrawWindow() ; return TRUE ; } +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtGetShowCurveDirection( int nGseCtx) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // recupero lo stato + return pGseCtx->m_pScene->GetShowCurveDirection() ; +} + //----------------------------------------------------------------------------- BOOL __stdcall EgtZoom( int nGseCtx, int nZoom, BOOL bRedraw) @@ -302,7 +372,7 @@ __stdcall EgtSetViewCenter( int nGseCtx, const double ptP[3], BOOL bRedraw) GseContext* pGseCtx = GetGseContext( nGseCtx) ; VERIFY_CTX_SCENE( pGseCtx, FALSE) // imposto vista - pGseCtx->m_pScene->SetCenter( Point3d( ptP[0], ptP[1], ptP[2])) ; + pGseCtx->m_pScene->SetCenter( Point3d( ptP)) ; if ( bRedraw) pGseCtx->m_pScene->RedrawWindow() ; return TRUE ; @@ -357,9 +427,25 @@ __stdcall EgtUnProjectPoint( int nGseCtx, int nWinX, int nWinY, double ptP[3]) Point3d ptView( nWinX, nWinY, pScene->GetProjectedCenter().z) ; Point3d ptWorld ; if ( ! pScene->UnProject( ptView, ptWorld)) - return 0 ; + return FALSE ; ptP[0] = ptWorld.x ; ptP[1] = ptWorld.y ; ptP[2] = ptWorld.z ; return TRUE ; } + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtProjectPoint( int nGseCtx, const double ptP[3], double ptWin[3]) +{ + IEGrScene* pScene = GetScene( nGseCtx) ; + VERIFY_SCENE( pScene, FALSE) + // eseguo la proiezione + Point3d ptView ; + if ( ! pScene->Project( Point3d( ptP), ptView)) + return FALSE ; + ptWin[0] = ptView.x ; + ptWin[1] = ptView.y ; + ptWin[2] = ptView.z ; + return TRUE ; +} diff --git a/EgtInterface.rc b/EgtInterface.rc index b264170..359c21a 100644 Binary files a/EgtInterface.rc and b/EgtInterface.rc differ