00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MAPBOX_H
00021 #define MAPBOX_H
00022
00023 #include <QColor>
00024 #include <QImage>
00025
00026 #include <QWidget>
00027 #include <QPixmap>
00028
00029
00030 using namespace std;
00031
00033
00039 class MapBox : public QWidget {
00040 Q_OBJECT
00041
00042 public:
00043 MapBox(QWidget *parent = 0);
00044 int getLayerIndex(QString layerName_h="");
00045
00046 public slots:
00047 void updatePixel(QString layerName_h, int x_h, int y_h, QColor color_h);
00048 void updateImage(QString layerName_h, const QImage& image_h);
00049 void switchToLayer(QString layerName_h);
00050 void addLayer(QString layerName_h);
00051 void fitInWindow();
00052 void zoom(double zoomFactor);
00053 void scroll(int deltaX, int deltaY);
00054
00055 signals:
00056 void queryRequestOnPx(int px_ID, int currentLayerIndex, bool newRequest);
00057
00058 private:
00059 void updatePixmap(const QImage &image, bool reFit=false);
00060 void paintEvent(QPaintEvent *event);
00061 void prepareQueryEvent(QPoint click);
00062 void keyPressEvent(QKeyEvent *event);
00063 void wheelEvent(QWheelEvent *event);
00064 void mousePressEvent(QMouseEvent *event);
00065 void mouseMoveEvent(QMouseEvent *event);
00066 vector <QImage> layersVector;
00067 vector <QString> layersNameVector;
00068 QImage currentLayer;
00069 QString currentLayerName;
00070 QPoint lastDragPos;
00071 double sx1, sy1, sx2, sy2;
00072 double dx1, dy1, dx2, dy2;
00073
00074 };
00075
00076 #endif