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"
29 ::SOCC_ViewWindow( SUIT_Desktop* theDesktop,
30 OCCViewer_Viewer* theModel)
31 : OCCViewer_ViewWindow( theDesktop, theModel )
45 \param theAction - type of action
49 ::action( const int theAction )
53 if ( theAction == SUIT_Accel::ZoomIn || theAction == SUIT_Accel::ZoomOut ||
54 theAction == SUIT_Accel::RotateLeft || theAction == SUIT_Accel::RotateRight ||
55 theAction == SUIT_Accel::RotateUp || theAction == SUIT_Accel::RotateDown ) {
56 cx = myViewPort->width() / 2;
57 cy = myViewPort->height() / 2;
59 switch ( theAction ) {
60 case SUIT_Accel::PanLeft :
61 myViewPort->pan( -inc, 0 );
63 case SUIT_Accel::PanRight :
64 myViewPort->pan( inc, 0 );
66 case SUIT_Accel::PanUp :
67 myViewPort->pan( 0, inc );
69 case SUIT_Accel::PanDown :
70 myViewPort->pan( 0, -inc );
72 case SUIT_Accel::ZoomIn :
73 myViewPort->zoom( cx, cy, cx + inc, cy + inc );
75 case SUIT_Accel::ZoomOut :
76 myViewPort->zoom( cx, cy, cx - inc, cy - inc );
78 case SUIT_Accel::ZoomFit :
81 case SUIT_Accel::RotateLeft :
82 myViewPort->startRotation( cx, cy );
83 myViewPort->rotate( cx - inc, cy );
84 myViewPort->endRotation();
86 case SUIT_Accel::RotateRight :
87 myViewPort->startRotation( cx, cy );
88 myViewPort->rotate( cx + inc, cy );
89 myViewPort->endRotation();
91 case SUIT_Accel::RotateUp :
92 myViewPort->startRotation( cx, cy );
93 myViewPort->rotate( cx, cy - inc );
94 myViewPort->endRotation();
96 case SUIT_Accel::RotateDown :
97 myViewPort->startRotation( cx, cy );
98 myViewPort->rotate( cx, cy + inc );
99 myViewPort->endRotation();