From aaaa45ef4ea5eedf23a4440447d11f5564a64cf4 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 14 Oct 2014 06:52:48 +0000 Subject: [PATCH] EgtInterface 1.5j2 : - esportate nuove funzioni dalle API. --- API_Scene.cpp | 94 +++++++++++++++++++++++++++++++++++++++++++++--- EgtInterface.rc | Bin 11534 -> 11534 bytes 2 files changed, 90 insertions(+), 4 deletions(-) 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 b264170378bc59685882499e1a6d944be755b1f8..359c21a2291a50b0ea76ce5792f76c12d2487e5a 100644 GIT binary patch delta 96 zcmeB+>WkX&gN@N>^Fh9oOq1Ot1twqO%mZ>Ax$0TKqRz~WMw1=6QYXJte6-m|*Z|0d esjUO6^Jm;FA`KP3$~0L@5vU!cVe>mh1#SRG=O26k delta 96 zcmeB+>WkX&gN@N}^Fh9oOq1Ot1twqO%mZ>Ax$0TKqRz~WhLat+QYXJte6-m|*Z|0d esjUO6^Jm;FA`KP3$~0L@5vU!cVe>mh1#SRFT_1D+