]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_ViewPort.h
Salome HOME
cd79d564eb9ac39830d2b60a6fd2581d307e7a21
[modules/shaper.git] / src / XGUI / XGUI_ViewPort.h
1
2 #ifndef XGUI_ViewPort_H
3 #define XGUI_ViewPort_H
4
5 #include "XGUI_ViewBackground.h"
6
7 #include <QWidget>
8 #include <V3d_Viewer.hxx>
9 #include <V3d_View.hxx>
10 #include <gp_Pnt.hxx>
11
12 class XGUI_ViewWindow;
13
14 class XGUI_ViewPort : public QWidget
15 {
16     Q_OBJECT
17 public:
18     XGUI_ViewPort(XGUI_ViewWindow* theParent, 
19                   const Handle(V3d_Viewer)& theViewer, 
20                   V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
21     ~XGUI_ViewPort();
22
23     virtual QPaintEngine* paintEngine() const { return 0; }
24
25     QImage dumpView(QRect theRect = QRect(), bool toUpdate = true);
26
27     Handle(V3d_View) getView() const { return activeView(); }
28
29     void startRotation( int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint );
30     void rotate( int, int, int, const gp_Pnt& );
31     void endRotation();
32
33     // TRANSFORMATIONS
34     void pan( int dx, int dy );
35     void setCenter( int x, int y );
36     void fitRect( const QRect& rect );
37     void startZoomAtPoint( int x, int y );
38     void zoom( int x0, int y0, int x, int y );
39
40     void setAdvancedZoomingEnabled( const bool theState ) { myIsAdvancedZoomingEnabled = theState; }
41     bool isAdvancedZoomingEnabled() const { return myIsAdvancedZoomingEnabled; }
42
43     XGUI_ViewBackground background() const { return myBackground; }
44     void setBackground( const XGUI_ViewBackground& bgData );
45
46 signals:
47     void vpChangeBackground( const XGUI_ViewBackground& );
48     void vpClosed();
49     void vpMapped();
50     void vpTransformed( );
51     void vpUpdated();
52
53 protected:
54     virtual void          paintEvent( QPaintEvent* );
55     virtual void          resizeEvent( QResizeEvent* );
56
57
58 private:
59     Handle(V3d_View)      activeView() const { return myActiveView; }
60
61     bool mapView( const Handle(V3d_View)& theView);
62     bool setWindow( const Handle(V3d_View)& theView);
63     bool mapped( const Handle(V3d_View)& theView) const;
64     void updateBackground();
65     void attachWindow( const Handle(V3d_View)& theView, const Handle(Aspect_Window)& theWnd);
66
67
68     Handle(V3d_View) myOrthoView;
69     Handle(V3d_View) myPerspView;
70     Handle(V3d_View) myActiveView;
71
72     Handle(Aspect_Window) myWindow;
73   
74     bool myPaintersRedrawing;
75     bool myIsAdvancedZoomingEnabled;
76   
77     double myScale;
78   
79     XGUI_ViewBackground myBackground;
80     int                 myBgImgHeight;
81     int                 myBgImgWidth;
82 };
83
84
85 #endif