00001 #ifndef H_VIEWPORT
00002 #define H_VIEWPORT
00003
00004 #include <QWidget>
00005
00006 #include <list>
00007
00008 #include "Layer.h"
00009 #include "FlowData.h"
00010
00011 class ViewPort : public QWidget
00012 {
00013 Q_OBJECT
00014
00015 friend class Main;
00016
00017 public:
00018 ViewPort(QWidget* parent=0);
00019 ~ViewPort(void);
00020 void zoom(QPoint pos, float factor);
00021
00022 void setGuiArea(QWidget *guiArea);
00023 bool saveImage(const QString & fileName);
00024
00025 public slots:
00026 void setFlowData(FlowData *flowData);
00027 void layerChanged(Layer *layer);
00028 void fitToScreen();
00029
00030 signals:
00031 void flowDataChanged(FlowData*);
00032 void sizeChanged(QSize);
00033
00034 protected:
00035 void resizeEvent(QResizeEvent *event);
00036 void paintEvent(QPaintEvent *event);
00037
00038 void wheelEvent(QWheelEvent* event);
00039 void mouseMoveEvent(QMouseEvent* event);
00040 void mousePressEvent(QMouseEvent* event);
00041 void mouseReleaseEvent(QMouseEvent* event);
00042
00043 private:
00044 void changeImageSize();
00045
00046 FlowData* flowData;
00047 QSize viewPortSize, imageSize;
00048 DrawInfo drawInfo;
00049
00050 bool setting, changed;
00051 float zoomFactor;
00052 QPoint lastMousePos;
00053 QPointF centerPosition;
00054
00055 std::list<Layer*> layers;
00056
00057
00058
00059
00060
00061
00062
00063
00064 };
00065
00066 #endif