source: subversion/applications/editors/merkaartor/GeoImageDock.h @ 13954

Last change on this file since 13954 was 13926, checked in by schluessler, 11 years ago

FIX : If there is only one opened layer, GeoImage? uses it automatically (without asking the user) (fixes #1450)
FIX : Long image filenames are cutted to fit the GeoImageDock? (fixes #1452)
FIX : ImageView? in GeoImageDock? draws images using an antialiasing painter and images are not copied when displaying them which results in faster drawing. (fixes #1452)
FIX : Much better zoom (and image-moving) for ImageView? in GeoImageDock?
FIX : trackpoints which are associated with an image are highlighted according to the Style's settings (but not by painting an reactangle in paintEvent manually)

File size: 2.2 KB
Line 
1
2#include "MapView.h"
3#include "MainWindow.h"
4#include "Map/MapDocument.h"
5
6#include <QtGui/QPainter>
7#include <QtGui/QDockWidget>
8#include <QtGui/QMouseEvent>
9#include <QtGui/QShortcut>
10#include <exiv2/image.hpp>
11#include <exiv2/exif.hpp>
12
13
14#define WARNING(title, message) { \
15        if (QMessageBox::warning(this, title, message.arg(file), \
16         QMessageBox::Ignore | QMessageBox::Cancel, QMessageBox::Ignore) == QMessageBox::Ignore) \
17                continue; \
18        else { \
19                theView->invalidate(true, false); \
20                return; \
21        } \
22}
23
24#define QUESTION(title, message, always) { \
25        if (always == 0) { \
26                int replyButton = QMessageBox::question(this, title, message, \
27                 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Abort, QMessageBox::Yes ); \
28                if (replyButton == QMessageBox::No) \
29                        continue; \
30                else if (replyButton == QMessageBox::Abort) { \
31                        theView->invalidate(true, false); \
32                        return; \
33                } \
34                else if (replyButton != QMessageBox::Yes) \
35                        always = replyButton; \
36        } \
37        if (always == QMessageBox::NoToAll) \
38                continue; \
39}
40       
41class ImageView;
42
43class GeoImageDock : public QDockWidget
44{
45        Q_OBJECT
46
47public:
48        GeoImageDock(MainWindow *aMain);
49        ~GeoImageDock(void);
50
51        void loadImages(QStringList fileNames);
52        void setImage(TrackPoint *Pt);
53
54        void addGeoDataToImage(Coord pos, const QString & file);
55
56private slots:
57        void removeImages(void);
58        void toClipboard(void);
59
60private:
61        QStringList Images;
62        int curImage;
63
64        ImageView *Image;
65
66        // first: TrackPoint::id(); second.first: image filename; second.second: true if we have to delete the TrackPoint
67        QList<QPair<QString, QPair<QString, bool> > > usedTrackPoints;
68        MainWindow *Main;
69
70};
71
72class ImageView : public QWidget
73{
74public:
75        ImageView(QWidget *parent);
76        ~ImageView();
77
78        void setImage(QString filename);
79
80protected:
81        void paintEvent(QPaintEvent *e);
82        void mousePressEvent(QMouseEvent *e);
83        void mouseMoveEvent(QMouseEvent *e);
84        void wheelEvent(QWheelEvent *e);
85        void mouseDoubleClickEvent(QMouseEvent *e);
86        void resizeEvent(QResizeEvent *e);
87
88private:
89        QImage image;
90        QString name;
91        QPoint mousePos;
92        QRect rect;
93        QRectF area;
94
95        double zoomLevel; // zoom in percent
96
97        void zoom(double levelStep); // zoom levelStep steps
98
99};
Note: See TracBrowser for help on using the repository browser.