digiKam
kmlexport.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2006-05-16
7  * Description : a tool to export GPS data to KML file.
8  *
9  * Copyright (C) 2006-2007 by Stephane Pontier <shadow dot walker at free dot fr>
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_KML_EXPORT_H
25 #define DIGIKAM_KML_EXPORT_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QColor>
31 #include <QList>
32 #include <QUrl>
33 #include <QDir>
34 #include <QDomDocument>
35 #include <QPointer>
36 #include <QImage>
37 
38 // Local includes
39 
40 #include "kmlgpsdataparser.h"
41 #include "dmetadata.h"
42 #include "dinfointerface.h"
43 
44 using namespace Digikam;
45 
47 {
48 
49 class KmlExport : public QObject
50 {
51  Q_OBJECT
52 
53 public:
54 
55  explicit KmlExport(DInfoInterface* const iface);
56 
57  ~KmlExport() override;
58 
59  void setUrls(const QList<QUrl>& urls);
60 
65  void generateImagesthumb(const QUrl&, QDomElement& kmlAlbum);
66 
73  QString webifyFileName(const QString& fileName) const;
74 
80  QImage generateSquareThumbnail(const QImage& fullImage, int size) const;
81 
88  QImage generateBorderedThumbnail(const QImage& fullImage, int size) const;
89 
90  void addTrack(QDomElement& kmlAlbum);
91  void generate();
92 
93 Q_SIGNALS:
94 
95  void signalProgressChanged(const int currentProgress);
96 
97 private:
98 
99  void getConfig();
100  void logInfo(const QString& msg);
101  void logError(const QString& msg);
102  void logWarning(const QString& msg);
103  bool copyDir(const QString& srcFilePath, const QString& dstFilePath);
104 
112  QDomElement addKmlElement(QDomElement& target,
113  const QString& tag) const;
114 
123  QDomElement addKmlTextElement(QDomElement& target,
124  const QString& tag,
125  const QString& text) const;
126 
135  QDomElement addKmlHtmlElement(QDomElement& target,
136  const QString& tag,
137  const QString& text) const;
138 
139 private:
140 
141  bool m_localTarget;
142  bool m_optimize_googlemap;
143  bool m_GPXtracks;
144 
145  int m_iconSize;
146  int m_googlemapSize;
147  int m_size;
148  int m_altitudeMode;
149  int m_TimeZone;
150  int m_LineWidth;
151  int m_GPXOpacity;
152  int m_GPXAltitudeMode;
153 
155  QString m_imageDirBasename;
156  QString m_GPXFile;
157  QString m_UrlDestDir;
158 
163  QDir m_tempDestDir;
164  QDir m_imageDir;
165 
167  QString m_baseDestDir;
168 
169  QString m_imgdir;
170  QString m_KMLFileName;
171 
172  QColor m_GPXColor;
173 
174  QList<QUrl> m_urls;
175  DInfoInterface* m_iface;
176  DMetadata* m_meta;
177 
179  QDomDocument* m_kmlDocument;
180 
182  KMLGeoDataParser m_gpxParser;
183 
185  QStringList m_logData;
186 };
187 
188 } // namespace DigikamGenericGeolocationEditPlugin
189 
190 #endif // DIGIKAM_KML_EXPORT_H
a class derivated from GeoDataParser mainly to transform GPS data to KML
Definition: kmlgpsdataparser.h:42
void signalProgressChanged(const int currentProgress)
Definition: dinfointerface.h:56
Definition: dmetadata.h:55
Definition: geolocationedit.cpp:97
Definition: datefolderview.cpp:43