1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "SOCC_ViewWindow.h"
25 #include "OCCViewer_ViewPort3d.h"
27 #include "SUIT_Accel.h"
33 ::SOCC_ViewWindow( SUIT_Desktop* theDesktop,
34 OCCViewer_Viewer* theModel)
35 : OCCViewer_ViewWindow( theDesktop, theModel )
49 \param theAction - type of action
53 ::action( const int theAction )
57 if ( theAction == SUIT_Accel::ZoomIn || theAction == SUIT_Accel::ZoomOut ||
58 theAction == SUIT_Accel::RotateLeft || theAction == SUIT_Accel::RotateRight ||
59 theAction == SUIT_Accel::RotateUp || theAction == SUIT_Accel::RotateDown ) {
60 cx = myViewPort->width() / 2;
61 cy = myViewPort->height() / 2;
63 switch ( theAction ) {
64 case SUIT_Accel::PanLeft :
65 myViewPort->pan( -inc, 0 );
67 case SUIT_Accel::PanRight :
68 myViewPort->pan( inc, 0 );
70 case SUIT_Accel::PanUp :
71 myViewPort->pan( 0, inc );
73 case SUIT_Accel::PanDown :
74 myViewPort->pan( 0, -inc );
76 case SUIT_Accel::ZoomIn :
77 myViewPort->zoom( cx, cy, cx + inc, cy + inc );
79 case SUIT_Accel::ZoomOut :
80 myViewPort->zoom( cx, cy, cx - inc, cy - inc );
82 case SUIT_Accel::ZoomFit :
85 case SUIT_Accel::RotateLeft :
86 myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint );
87 myViewPort->rotate( cx - inc, cy, myCurrPointType, mySelectedPoint );
88 myViewPort->endRotation();
90 case SUIT_Accel::RotateRight :
91 myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint );
92 myViewPort->rotate( cx + inc, cy, myCurrPointType, mySelectedPoint );
93 myViewPort->endRotation();
95 case SUIT_Accel::RotateUp :
96 myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint );
97 myViewPort->rotate( cx, cy - inc, myCurrPointType, mySelectedPoint );
98 myViewPort->endRotation();
100 case SUIT_Accel::RotateDown :
101 myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint );
102 myViewPort->rotate( cx, cy + inc, myCurrPointType, mySelectedPoint );
103 myViewPort->endRotation();