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 #ifndef OCCVIEWER_VIEWWINDOW_H
20 #define OCCVIEWER_VIEWWINDOW_H
22 #include "OCCViewer_ViewModel.h"
24 #include "SUIT_ViewWindow.h"
26 #include "QtxAction.h"
29 #include <qvaluelist.h>
32 class OCCViewer_ViewPort3d;
34 class OCCViewer_ClippingDlg;
37 #pragma warning( disable:4251 )
40 class OCCVIEWER_EXPORT OCCViewer_ViewWindow : public SUIT_ViewWindow
45 enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
46 FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW };
48 OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
49 virtual ~OCCViewer_ViewWindow() {};
51 OCCViewer_ViewPort3d* getViewPort() { return myViewPort; }
53 bool eventFilter(QObject* watched, QEvent* e);
55 QToolBar* getToolBar() { return myToolBar; }
57 void performRestoring( const viewAspect& );
59 virtual void initLayout();
61 void updateEnabledDrawMode();
63 void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
64 const double dx = 0, const double dy = 0, const double dz = 1);
77 void activateWindowFit();
78 void activateRotation();
79 void activatePanning();
80 void activateGlobalPanning();
82 void onClipping( bool on );
83 void onMemorizeView();
85 void onTrihedronShow();
86 void setRestoreFlag();
89 void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type);
90 void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type);
94 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
95 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
98 typedef QMap<int, QtxAction*> ActionsMap;
102 /* Transformation selected but not started yet */
103 bool transformRequested() const { return ( myOperation != NOTHING ); }
104 void setTransformRequested ( OperationType op );
106 /* Transformation is selected and already started */
107 bool transformInProcess() const { return myEventStarted; }
108 void setTransformInProcess( bool bOn ) { myEventStarted = bOn; }
110 void vpMousePressEvent(QMouseEvent* theEvent);
111 void vpMouseReleaseEvent(QMouseEvent* theEvent);
112 void vpMouseMoveEvent(QMouseEvent* theEvent);
117 void createActions();
118 void createToolBar();
120 virtual OperationType getButtonState(QMouseEvent* theEvent);
122 OperationType myOperation;
123 OCCViewer_Viewer* myModel;
124 OCCViewer_ViewPort3d* myViewPort;
133 bool myEventStarted; // set when transformation is in process
135 bool myDrawRect; // set when a rect is used for selection or magnify
136 bool myEnableDrawMode;
137 bool myPaintersRedrawing; // set to draw with external painters
143 ActionsMap myActionsMap;
148 OCCViewer_ClippingDlg* myClippingDlg;
153 #pragma warning( default:4251 )