TestEGr 1.5b7 :

- gestione ZoomWin.
This commit is contained in:
Dario Sassi
2014-02-26 13:14:03 +00:00
parent 79a8075abc
commit 58dc80769d
9 changed files with 82 additions and 12 deletions
+33 -3
View File
@@ -233,7 +233,11 @@ TestEgrView::View( UINT nID)
void
TestEgrView::OnMButtonDown( UINT nFlags, CPoint point)
{
if ( nFlags & MK_CONTROL) {
if ( nFlags & MK_SHIFT) {
m_nStatus = ST_ZOOMWIN ;
SetCursor( AfxGetApp()->LoadCursor( IDC_ZOOMWIN)) ;
}
else if ( nFlags & MK_CONTROL) {
m_nStatus = ST_ROT ;
SetCursor( AfxGetApp()->LoadCursor( IDC_ROTATE)) ;
}
@@ -249,7 +253,19 @@ TestEgrView::OnMButtonDown( UINT nFlags, CPoint point)
void
TestEgrView::OnMButtonUp( UINT nFlags, CPoint point)
{
if ( m_nStatus == ST_ROT || m_nStatus == ST_PAN) {
// eseguo ZOOMWINDOWN
if ( m_nStatus == ST_ZOOMWIN) {
// annullo i dati del rettangolo di definizione della nuova vista
if ( m_pScene != nullptr)
m_pScene->ResetWinRect() ;
// eseguo lo zoom
if ( m_pScene != nullptr)
m_pScene->ZoomWin( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ;
// aggiorno il disegno
RedrawWindow() ;
}
// reset dello stato se non NULL
if ( m_nStatus != ST_NULL) {
m_nStatus = ST_NULL ;
SetCursor( AfxGetApp()->LoadCursor( IDC_POINTER)) ;
}
@@ -261,8 +277,18 @@ TestEgrView::OnMouseMove( UINT nFlags, CPoint point)
{
// visualizzo le coordinate del puntatore
ShowCursorCoordinates( Point3d( point.x, point.y)) ;
// se in modalità ZOOMWINDOW
if ( m_nStatus == ST_ZOOMWIN && nFlags & MK_MBUTTON) {
SetCursor( AfxGetApp()->LoadCursor( IDC_ZOOMWIN)) ;
// aggiorno i dati del rettangolo di definizione della nuova vista
if ( m_pScene != nullptr)
m_pScene->SetWinRect( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ;
// aggiorno il disegno
RedrawWindow() ;
// il punto di riferimento deve rimanere quello originale
}
// se in modalità ROTATE
if ( m_nStatus == ST_ROT && nFlags & MK_MBUTTON) {
else if ( m_nStatus == ST_ROT && nFlags & MK_MBUTTON) {
SetCursor( AfxGetApp()->LoadCursor( IDC_ROTATE)) ;
// eseguo la rotazione
if ( m_pScene != nullptr)
@@ -294,6 +320,10 @@ TestEgrView::OnMouseMove( UINT nFlags, CPoint point)
BOOL
TestEgrView::OnMouseWheel( UINT nFlags, short zDelta, CPoint point)
{
// devo essere nello stato NULL
if ( m_nStatus != ST_NULL)
return 0 ;
// calcolo coefficiente
double dCoeff = 1 - 0.1 * abs( zDelta) / WHEEL_DELTA ;
if ( zDelta < 0)