From 2b09a8356e0e2442dd72e3d7743d617c72470e44 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 10 Oct 2014 06:40:53 +0000 Subject: [PATCH] EgtInterface 1.5j1 : - aggiunta gestione selezione con mouse. --- API_GdbObjSelection.cpp | 54 +++++++++++++++++++++++++++ API_GdbObjects.cpp | 2 +- API_Scene.cpp | 70 +++++++++++++++++++++++++++++++---- EgtInterface.rc | Bin 11526 -> 11534 bytes EgtInterface.vcxproj | 1 + EgtInterface.vcxproj.filters | 3 ++ 6 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 API_GdbObjSelection.cpp diff --git a/API_GdbObjSelection.cpp b/API_GdbObjSelection.cpp new file mode 100644 index 0000000..96dcfa7 --- /dev/null +++ b/API_GdbObjSelection.cpp @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : API_GdbObjects.cpp Data : 02.09.14 Versione : 1.5i1 +// Contenuto : Funzioni iterazione di DB geometrico per API. +// +// +// +// Modifiche : 02.09.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +//--------------------------- Include ---------------------------------------- +#include "stdafx.h" +#include "API.h" +#include "API_Macro.h" +#include "/EgtDev/Include/EInAPI.h" +#include "/EgtDev/Include/EGkStringUtils3d.h" +#include "/EgtDev/Include/EGnStringConverter.h" +#include "/EgtDev/Include/EgtPointerOwner.h" + +using namespace std ; + + +//----------------------------------------------------------------------------- +BOOL + __stdcall EgtIsSelectedObj( int nGseCtx, int nId) + { + IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ; + VERIFY_GEOMDB( pGeomDB, FALSE) + // verifico se l'oggetto è selezionato + return ( pGeomDB->IsSelectedObj( nId) ? TRUE : FALSE) ; + } + +//----------------------------------------------------------------------------- +BOOL + __stdcall EgtSelectObj( int nGseCtx, int nId) + { + IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ; + VERIFY_GEOMDB( pGeomDB, FALSE) + // seleziono l'oggetto + return ( pGeomDB->SelectObj( nId) ? TRUE : FALSE) ; + } + +//----------------------------------------------------------------------------- +BOOL + __stdcall EgtDeselectObj( int nGseCtx, int nId) + { + IGeomDB* pGeomDB = GetGeomDB( nGseCtx) ; + VERIFY_GEOMDB( pGeomDB, FALSE) + // deseleziono l'oggetto + return ( pGeomDB->DeselectObj( nId) ? TRUE : FALSE) ; + } diff --git a/API_GdbObjects.cpp b/API_GdbObjects.cpp index 6cf313d..8859c6b 100644 --- a/API_GdbObjects.cpp +++ b/API_GdbObjects.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- -// File : API_GdbIterate.cpp Data : 02.09.14 Versione : 1.5i1 +// File : API_GdbObjects.cpp Data : 02.09.14 Versione : 1.5i1 // Contenuto : Funzioni iterazione di DB geometrico per API. // // diff --git a/API_Scene.cpp b/API_Scene.cpp index de9df2d..692079b 100644 --- a/API_Scene.cpp +++ b/API_Scene.cpp @@ -68,6 +68,17 @@ __stdcall EgtSetBackground( int nGseCtx, int nTopRed, int nTopGreen, int nTopBlu return TRUE ; } +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtResize( int nGseCtx, int nW, int nH) +{ + IEGrScene* pScene = GetScene( nGseCtx) ; + VERIFY_SCENE( pScene, FALSE) + // eseguo resize + pScene->Resize( nW, nH) ; + return TRUE ; +} + //----------------------------------------------------------------------------- BOOL __stdcall EgtDraw( int nGseCtx) @@ -84,13 +95,32 @@ __stdcall EgtDraw( int nGseCtx) //----------------------------------------------------------------------------- BOOL -__stdcall EgtResize( int nGseCtx, int nW, int nH) +__stdcall EgtSelect( int nGseCtx, int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel) { - IEGrScene* pScene = GetScene( nGseCtx) ; - VERIFY_SCENE( pScene, FALSE) - // eseguo resize - pScene->Resize( nW, nH) ; - return TRUE ; + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // eseguo la selezione + return ( pGseCtx->m_pScene->Select( Point3d( nWinX, nWinY), nSelW, nSelH, *pnSel) ? TRUE : FALSE) ; +} + +//----------------------------------------------------------------------------- +int +__stdcall EgtGetFirstSelectedObj( int nGseCtx) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // restituisco il primo oggetto selezionato + return pGseCtx->m_pScene->GetFirstSelectedObj() ; +} + +//----------------------------------------------------------------------------- +int +__stdcall EgtGetNextSelectedObj( int nGseCtx) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // restituisco il successivo oggetto selezionato + return pGseCtx->m_pScene->GetNextSelectedObj() ; } //----------------------------------------------------------------------------- @@ -170,6 +200,32 @@ __stdcall EgtZoomOnPoint( int nGseCtx, int nWinX, int nWinY, double dCoeff, BOOL return TRUE ; } +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtSetGeoLine( int nGseCtx, const double ptP1[3], const double ptP2[3], BOOL bRedraw) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // disegno linea per distanza o similari + pGseCtx->m_pScene->SetGeoLine( Point3d( ptP1), Point3d( ptP2)) ; + if ( bRedraw) + pGseCtx->m_pScene->RedrawWindow() ; + return TRUE ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtResetGeoLine( int nGseCtx, BOOL bRedraw) +{ + GseContext* pGseCtx = GetGseContext( nGseCtx) ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // cancello linea per distanza o similari + pGseCtx->m_pScene->ResetGeoLine() ; + if ( bRedraw) + pGseCtx->m_pScene->RedrawWindow() ; + return TRUE ; +} + //----------------------------------------------------------------------------- BOOL __stdcall EgtSetWinRect( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw) @@ -241,7 +297,7 @@ __stdcall EgtSetGenericView( int nGseCtx, double dAngVertDeg, double dAngHorizDe //----------------------------------------------------------------------------- BOOL -__stdcall EgtSetViewCenter( int nGseCtx, double ptP[3], BOOL bRedraw) +__stdcall EgtSetViewCenter( int nGseCtx, const double ptP[3], BOOL bRedraw) { GseContext* pGseCtx = GetGseContext( nGseCtx) ; VERIFY_CTX_SCENE( pGseCtx, FALSE) diff --git a/EgtInterface.rc b/EgtInterface.rc index 68b8e9d11a54f65e851be87f7b800875fac817c8..b264170378bc59685882499e1a6d944be755b1f8 100644 GIT binary patch delta 111 zcmZpR>WkX&iH+Tm!GJ-B!Ep0lzLQLo4{+8nXE7K~W)w=@yo5`H1xePC86>lrQK%4E X6sX5R5}`*$3Q3Qx98^!EVk + diff --git a/EgtInterface.vcxproj.filters b/EgtInterface.vcxproj.filters index 5a0655b..1eb6f78 100644 --- a/EgtInterface.vcxproj.filters +++ b/EgtInterface.vcxproj.filters @@ -125,6 +125,9 @@ File di origine + + File di origine +