1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #include "SOCC_ViewWindow.h"
21 #include "OCCViewer_ViewPort3d.h"
23 #include "SUIT_Accel.h"
25 //----------------------------------------------------------------------------
27 ::SOCC_ViewWindow( SUIT_Desktop* theDesktop,
28 OCCViewer_Viewer* theModel)
29 : OCCViewer_ViewWindow( theDesktop, theModel )
33 //----------------------------------------------------------------------------
39 //----------------------------------------------------------------------------
42 ::action( const int theAction )
46 if ( theAction == SUIT_Accel::ZoomIn || theAction == SUIT_Accel::ZoomOut ||
47 theAction == SUIT_Accel::RotateLeft || theAction == SUIT_Accel::RotateRight ||
48 theAction == SUIT_Accel::RotateUp || theAction == SUIT_Accel::RotateDown ) {
49 cx = myViewPort->width() / 2;
50 cy = myViewPort->height() / 2;
52 switch ( theAction ) {
53 case SUIT_Accel::PanLeft :
54 myViewPort->pan( -inc, 0 );
56 case SUIT_Accel::PanRight :
57 myViewPort->pan( inc, 0 );
59 case SUIT_Accel::PanUp :
60 myViewPort->pan( 0, inc );
62 case SUIT_Accel::PanDown :
63 myViewPort->pan( 0, -inc );
65 case SUIT_Accel::ZoomIn :
66 myViewPort->zoom( cx, cy, cx + inc, cy + inc );
68 case SUIT_Accel::ZoomOut :
69 myViewPort->zoom( cx, cy, cx - inc, cy - inc );
71 case SUIT_Accel::ZoomFit :
74 case SUIT_Accel::RotateLeft :
75 myViewPort->startRotation( cx, cy );
76 myViewPort->rotate( cx - inc, cy );
77 myViewPort->endRotation();
79 case SUIT_Accel::RotateRight :
80 myViewPort->startRotation( cx, cy );
81 myViewPort->rotate( cx + inc, cy );
82 myViewPort->endRotation();
84 case SUIT_Accel::RotateUp :
85 myViewPort->startRotation( cx, cy );
86 myViewPort->rotate( cx, cy - inc );
87 myViewPort->endRotation();
89 case SUIT_Accel::RotateDown :
90 myViewPort->startRotation( cx, cy );
91 myViewPort->rotate( cx, cy + inc );
92 myViewPort->endRotation();