diff --git a/API_GdbObjSelection.cpp b/API_GdbObjSelection.cpp index 539ac56..0e79f2d 100644 --- a/API_GdbObjSelection.cpp +++ b/API_GdbObjSelection.cpp @@ -23,16 +23,6 @@ using namespace std ; -//----------------------------------------------------------------------------- -BOOL - __stdcall EgtIsSelectedObj( int nId) - { - IGeomDB* pGeomDB = GetCurrGeomDB() ; - VERIFY_GEOMDB( pGeomDB, FALSE) - // verifico se l'oggetto è selezionato - return ( pGeomDB->IsSelectedObj( nId) ? TRUE : FALSE) ; - } - //----------------------------------------------------------------------------- BOOL __stdcall EgtSelectObj( int nId) @@ -62,3 +52,33 @@ BOOL // deseleziono tutto return ( pGeomDB->ClearSelection() ? TRUE : FALSE) ; } + +//----------------------------------------------------------------------------- +BOOL + __stdcall EgtIsSelectedObj( int nId) + { + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, FALSE) + // verifico se l'oggetto è selezionato + return ( pGeomDB->IsSelectedObj( nId) ? TRUE : FALSE) ; + } + +//----------------------------------------------------------------------------- +int + __stdcall EgtGetFirstSelectedObj( void) + { + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, FALSE) + // recupero il primo oggetto selezionato + return pGeomDB->GetFirstSelectedObj() ; + } + +//----------------------------------------------------------------------------- +int + __stdcall EgtGetNextSelectedObj( void) + { + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, FALSE) + // recupero il successivo oggetto selezionato + return pGeomDB->GetNextSelectedObj() ; + } diff --git a/API_GeoTransform.cpp b/API_GeoTransform.cpp index f4cfbf4..f088968 100644 --- a/API_GeoTransform.cpp +++ b/API_GeoTransform.cpp @@ -26,8 +26,21 @@ __stdcall EgtMove( int nId, double vVtMove[3]) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo traslazione - return ( pGeomDB->Translate( nId, vVtMove) ? TRUE : FALSE) ; + // eseguo traslazione singola + if ( nId != GDB_ID_SEL) { + return ( pGeomDB->Translate( nId, vVtMove) ? TRUE : FALSE) ; + } + // eseguo traslazione dei selezionati + else { + bool bOk = true ; + int nI = pGeomDB->GetFirstSelectedObj() ; + while ( nI != GDB_ID_NULL && bOk) { + if ( ! pGeomDB->Translate( nI, vVtMove)) + bOk = false ; + nI = pGeomDB->GetNextSelectedObj() ; + } + return ( bOk ? TRUE : FALSE) ; + } } //------------------------------------------------------------------------------- @@ -36,8 +49,21 @@ __stdcall EgtMoveGlob( int nId, double vVtMove[3]) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo traslazione - return ( pGeomDB->TranslateGlob( nId, vVtMove) ? TRUE : FALSE) ; + // eseguo traslazione singola + if ( nId != GDB_ID_SEL) { + return ( pGeomDB->TranslateGlob( nId, vVtMove) ? TRUE : FALSE) ; + } + // eseguo traslazione dei selezionati + else { + bool bOk = true ; + int nI = pGeomDB->GetFirstSelectedObj() ; + while ( nI != GDB_ID_NULL && bOk) { + if ( ! pGeomDB->TranslateGlob( nI, vVtMove)) + bOk = false ; + nI = pGeomDB->GetNextSelectedObj() ; + } + return ( bOk ? TRUE : FALSE) ; + } } //------------------------------------------------------------------------------- @@ -46,8 +72,21 @@ __stdcall EgtMoveGroup( int nId, double vVtMove[3]) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo traslazione - return ( pGeomDB->TranslateGroup( nId, vVtMove) ? TRUE : FALSE) ; + // eseguo traslazione singola + if ( nId != GDB_ID_SEL) { + return ( pGeomDB->TranslateGroup( nId, vVtMove) ? TRUE : FALSE) ; + } + // eseguo traslazione dei selezionati + else { + bool bOk = true ; + int nI = pGeomDB->GetFirstSelectedObj() ; + while ( nI != GDB_ID_NULL && bOk) { + if ( ! pGeomDB->TranslateGroup( nI, vVtMove)) + bOk = false ; + nI = pGeomDB->GetNextSelectedObj() ; + } + return ( bOk ? TRUE : FALSE) ; + } } //------------------------------------------------------------------------------- @@ -56,8 +95,21 @@ __stdcall EgtRotate( int nId, double vPtAx[3], double vVtAx[3], double dAngRotDe { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo rotazione - return ( pGeomDB->Rotate( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; + // eseguo rotazione singola + if ( nId != GDB_ID_SEL) { + return ( pGeomDB->Rotate( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; + } + // eseguo rotazione dei selezionati + else { + bool bOk = true ; + int nI = pGeomDB->GetFirstSelectedObj() ; + while ( nI != GDB_ID_NULL && bOk) { + if ( ! pGeomDB->Rotate( nI, vPtAx, vVtAx, dAngRotDeg)) + bOk = false ; + nI = pGeomDB->GetNextSelectedObj() ; + } + return ( bOk ? TRUE : FALSE) ; + } } //------------------------------------------------------------------------------- @@ -66,8 +118,21 @@ __stdcall EgtRotateGlob( int nId, double vPtAx[3], double vVtAx[3], double dAngR { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo rotazione - return ( pGeomDB->RotateGlob( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; + // eseguo rotazione singola + if ( nId != GDB_ID_SEL) { + return ( pGeomDB->RotateGlob( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; + } + // eseguo rotazione dei selezionati + else { + bool bOk = true ; + int nI = pGeomDB->GetFirstSelectedObj() ; + while ( nI != GDB_ID_NULL && bOk) { + if ( ! pGeomDB->RotateGlob( nI, vPtAx, vVtAx, dAngRotDeg)) + bOk = false ; + nI = pGeomDB->GetNextSelectedObj() ; + } + return ( bOk ? TRUE : FALSE) ; + } } //------------------------------------------------------------------------------- @@ -76,8 +141,21 @@ __stdcall EgtRotateGroup( int nId, double vPtAx[3], double vVtAx[3], double dAng { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo rotazione - return ( pGeomDB->RotateGroup( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; + // eseguo rotazione singola + if ( nId != GDB_ID_SEL) { + return ( pGeomDB->RotateGroup( nId, vPtAx, vVtAx, dAngRotDeg) ? TRUE : FALSE) ; + } + // eseguo rotazione dei selezionati + else { + bool bOk = true ; + int nI = pGeomDB->GetFirstSelectedObj() ; + while ( nI != GDB_ID_NULL && bOk) { + if ( ! pGeomDB->RotateGroup( nI, vPtAx, vVtAx, dAngRotDeg)) + bOk = false ; + nI = pGeomDB->GetNextSelectedObj() ; + } + return ( bOk ? TRUE : FALSE) ; + } } //------------------------------------------------------------------------------- @@ -88,7 +166,7 @@ __stdcall EgtScale( int nId, const double vOrig[3], { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo rotazione + // eseguo scalatura Frame3d frFrame ; if ( ! frFrame.Set( vOrig, vX, vY, vZ)) return FALSE ; @@ -103,7 +181,7 @@ __stdcall EgtScaleGlob( int nId, const double vOrig[3], { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo rotazione + // eseguo scalatura Frame3d frFrame ; if ( ! frFrame.Set( vOrig, vX, vY, vZ)) return FALSE ; @@ -118,7 +196,7 @@ __stdcall EgtScaleGroup( int nId, const double vOrig[3], { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, FALSE) - // eseguo rotazione + // eseguo scalatura Frame3d frFrame ; if ( ! frFrame.Set( vOrig, vX, vY, vZ)) return FALSE ; diff --git a/API_Scene.cpp b/API_Scene.cpp index d2f857b..03a606e 100644 --- a/API_Scene.cpp +++ b/API_Scene.cpp @@ -138,7 +138,7 @@ __stdcall EgtSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel) //----------------------------------------------------------------------------- int -__stdcall EgtGetFirstSelectedObj( void) +__stdcall EgtGetFirstObjInSelWin( void) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_SCENE( pGseCtx, FALSE) @@ -148,7 +148,7 @@ __stdcall EgtGetFirstSelectedObj( void) //----------------------------------------------------------------------------- int -__stdcall EgtGetNextSelectedObj( void) +__stdcall EgtGetNextObjInSelWin( void) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_SCENE( pGseCtx, FALSE) @@ -156,6 +156,36 @@ __stdcall EgtGetNextSelectedObj( void) return pGseCtx->m_pScene->GetNextSelectedObj() ; } +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtUnselectableRemove( int nId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // tolgo dai non selezionabili + return pGseCtx->m_pScene->UnselectableRemove( nId) ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtUnselectableAdd( int nId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // aggiungo ai non selezionabili + return pGseCtx->m_pScene->UnselectableAdd( nId) ; +} + +//----------------------------------------------------------------------------- +BOOL +__stdcall EgtUnselectableClearAll( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_SCENE( pGseCtx, FALSE) + // cancello tutti i non selezionabili + return pGseCtx->m_pScene->UnselectableClearAll() ; +} + //----------------------------------------------------------------------------- BOOL __stdcall EgtGetSelectedSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,