File indexing completed on 2025-03-09 03:50:39

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-09-19
0007  * Description : GPS data file parser.
0008  *               (GPX format https://www.topografix.com/gpx.asp).
0009  *
0010  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_GEO_DATA_PARSER_H
0017 #define DIGIKAM_GEO_DATA_PARSER_H
0018 
0019 // Qt includes
0020 
0021 #include <QDateTime>
0022 #include <QMap>
0023 #include <QUrl>
0024 
0025 // Local includes
0026 
0027 #include "geodatacontainer.h"
0028 
0029 namespace DigikamGenericGeolocationEditPlugin
0030 {
0031 
0032 class GeoDataParser
0033 {
0034 
0035 public:
0036 
0037     explicit GeoDataParser();
0038     ~GeoDataParser() {};
0039 
0040     bool loadGPXFile(const QUrl& url);
0041 
0042     void clear();
0043     int  numPoints() const;
0044     bool matchDate(const QDateTime& photoDateTime, int maxGapTime, int secondsOffset,
0045                    bool photoHasSystemTimeZone,
0046                    bool interpolate, int interpolationDstTime,
0047                    GeoDataContainer* const gpsData);
0048 
0049 private:
0050 
0051     /// Methods used to perform interpolation.
0052     QDateTime findNextDate(const QDateTime& dateTime, int secs);
0053     QDateTime findPrevDate(const QDateTime& dateTime, int secs);
0054 
0055 protected:
0056 
0057     typedef QMap<QDateTime, GeoDataContainer> GeoDataMap;
0058 
0059     GeoDataMap                                m_GeoDataMap;
0060 };
0061 
0062 } // namespace DigikamGenericGeolocationEditPlugin
0063 
0064 #endif // DIGIKAM_GEO_DATA_PARSER_H