X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ViewPort.h;h=f22cc9d92808d6a4a1cdb951bf4e5f11e57d5793;hb=fc2acc7bd36f7bff6ec1f5095bf7c44be15e2574;hp=10dd2356a6f46b439f8dc1b2308272d8d4dabde0;hpb=9c985b359361fc2eb4a1b746dcb27031bc2c3c06;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ViewPort.h b/src/XGUI/XGUI_ViewPort.h index 10dd2356a..f22cc9d92 100644 --- a/src/XGUI/XGUI_ViewPort.h +++ b/src/XGUI/XGUI_ViewPort.h @@ -1,8 +1,9 @@ - #ifndef XGUI_ViewPort_H #define XGUI_ViewPort_H -#include "XGUI_ViewBackground.h" +#include "XGUI.h" + +#include #include #include @@ -11,76 +12,92 @@ class XGUI_ViewWindow; -class XGUI_ViewPort : public QWidget +class XGUI_EXPORT XGUI_ViewPort : public QWidget { - Q_OBJECT -public: - XGUI_ViewPort(XGUI_ViewWindow* theParent, - const Handle(V3d_Viewer)& theViewer, - V3d_TypeOfView theType = V3d_ORTHOGRAPHIC); - ~XGUI_ViewPort(); +Q_OBJECT + public: + XGUI_ViewPort(XGUI_ViewWindow* theParent, const Handle(V3d_Viewer)& theViewer, + V3d_TypeOfView theType = V3d_ORTHOGRAPHIC); + virtual ~XGUI_ViewPort(); + + virtual QPaintEngine* paintEngine() const + { + return 0; + } + + QImage dumpView(unsigned char*& theData, QRect theRect = QRect(), bool toUpdate = true); + + Handle(V3d_View) getView() const + { + return activeView(); + } + + void startRotation(int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint); + void rotate(int, int, int, const gp_Pnt&); + void endRotation(); + + // TRANSFORMATIONS + void pan(int dx, int dy); + void setCenter(int x, int y); + void fitRect(const QRect& rect); + void startZoomAtPoint(int x, int y); + void zoom(int x0, int y0, int x, int y); + void fitAll(bool theKeepScale = false, bool theWithZ = true, bool theUpd = true); + + void setAdvancedZoomingEnabled(const bool theState) + { + myIsAdvancedZoomingEnabled = theState; + } + bool isAdvancedZoomingEnabled() const + { + return myIsAdvancedZoomingEnabled; + } + + Qtx::BackgroundData background() const + { + return myBackground; + } + + void setBackground(const Qtx::BackgroundData& bgData); + + void syncronizeWith(const XGUI_ViewPort* ref); + +signals: + void vpChangeBackground(const Qtx::BackgroundData&); + void vpClosed(); + void vpMapped(); + void vpTransformed(); + void vpUpdated(); + void resized(); - virtual QPaintEngine* paintEngine() const { return 0; } + protected: + virtual void paintEvent(QPaintEvent*); + virtual void resizeEvent(QResizeEvent*); - QImage dumpView(QRect theRect = QRect(), bool toUpdate = true); + private: + Handle(V3d_View) activeView() const + { + return myActiveView; + } - Handle(V3d_View) getView() const { return activeView(); } + bool mapView(const Handle(V3d_View)& theView); + bool setWindow(const Handle(V3d_View)& theView); + bool mapped(const Handle(V3d_View)& theView) const; + void updateBackground(); + void attachWindow(const Handle(V3d_View)& theView, const Handle(Aspect_Window)& theWnd); - void startRotation( int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint ); - void rotate( int, int, int, const gp_Pnt& ); - void endRotation(); + Handle(V3d_View) myOrthoView;Handle(V3d_View) myPerspView;Handle(V3d_View) myActiveView; - // TRANSFORMATIONS - void pan( int dx, int dy ); - void setCenter( int x, int y ); - void fitRect( const QRect& rect ); - void startZoomAtPoint( int x, int y ); - void zoom( int x0, int y0, int x, int y ); - void fitAll(bool theKeepScale = false, bool theWithZ = true, bool theUpd = true); + Handle(Aspect_Window) myWindow; - void setAdvancedZoomingEnabled( const bool theState ) { myIsAdvancedZoomingEnabled = theState; } - bool isAdvancedZoomingEnabled() const { return myIsAdvancedZoomingEnabled; } + bool myPaintersRedrawing; + bool myIsAdvancedZoomingEnabled; - XGUI_ViewBackground background() const { return myBackground; } - void setBackground( const XGUI_ViewBackground& bgData ); + double myScale; -signals: - void vpChangeBackground( const XGUI_ViewBackground& ); - void vpClosed(); - void vpMapped(); - void vpTransformed( ); - void vpUpdated(); - -protected: - virtual void paintEvent( QPaintEvent* ); - virtual void resizeEvent( QResizeEvent* ); - - -private: - Handle(V3d_View) activeView() const { return myActiveView; } - - bool mapView( const Handle(V3d_View)& theView); - bool setWindow( const Handle(V3d_View)& theView); - bool mapped( const Handle(V3d_View)& theView) const; - void updateBackground(); - void attachWindow( const Handle(V3d_View)& theView, const Handle(Aspect_Window)& theWnd); - - - Handle(V3d_View) myOrthoView; - Handle(V3d_View) myPerspView; - Handle(V3d_View) myActiveView; - - Handle(Aspect_Window) myWindow; - - bool myPaintersRedrawing; - bool myIsAdvancedZoomingEnabled; - - double myScale; - - XGUI_ViewBackground myBackground; - int myBgImgHeight; - int myBgImgWidth; + Qtx::BackgroundData myBackground; + int myBgImgHeight; + int myBgImgWidth; }; - -#endif \ No newline at end of file +#endif