File indexing completed on 2025-03-09 03:50:40
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-05-16 0007 * Description : a tool to export GPS data to KML file. 0008 * 0009 * SPDX-FileCopyrightText: 2006-2007 by Stephane Pontier <shadow dot walker at free dot fr> 0010 * SPDX-FileCopyrightText: 2008-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_KML_GPS_DATA_PARSER_H 0017 #define DIGIKAM_KML_GPS_DATA_PARSER_H 0018 0019 // Qt includes 0020 0021 #include <QDomDocument> 0022 0023 // Local includes 0024 0025 #include "geodataparser.h" 0026 0027 namespace DigikamGenericGeolocationEditPlugin 0028 { 0029 0030 /*! a class derivated from GeoDataParser mainly to transform GPS data to KML 0031 * @author Stéphane Pontier shadow.walker@free.fr 0032 */ 0033 class KMLGeoDataParser : public GeoDataParser 0034 { 0035 0036 public: 0037 0038 explicit KMLGeoDataParser(); 0039 ~KMLGeoDataParser(); 0040 0041 /*! KMLGeoDataParser::KMLGeoDataParser::lineString() 0042 * @return the string containing the time ordered point (lon,lat,alt) 0043 */ 0044 QString lineString(); 0045 0046 /*! Create a KML Element that will contain the linetrace of the GPS 0047 * @param parent the QDomElement to which the track will be added 0048 * @param root the QDomDocument used to create all elements 0049 * @param altitudeMode altitude mode of the line and points 0050 */ 0051 void CreateTrackLine(QDomElement& parent, QDomDocument& root, int altitudeMode); 0052 0053 /*! Create a KML Element that will contain the points and of the GPS 0054 * @param parent the QDomElement to which the track will be added 0055 * @param root the QDomDocument used to create all elements 0056 * @param timeZone the Timezone of the pictures 0057 * @param altitudeMode altitude mode of the line and points 0058 */ 0059 void CreateTrackPoints(QDomElement& parent, QDomDocument& root, int timeZone, int altitudeMode); 0060 0061 private: 0062 0063 /*! 0064 * @brief Add a new element 0065 * @param target the parent element to which add the element 0066 * @param tag the new element name 0067 * @return the New element 0068 */ 0069 QDomElement addKmlElement(QDomElement& target, const QString& tag) 0070 { 0071 QDomElement kmlElement = kmlDocument->createElement( tag ); 0072 target.appendChild( kmlElement ); 0073 0074 return kmlElement; 0075 } 0076 0077 /** 0078 * @brief Add a new element with a text 0079 * @param target the parent element to which add the element 0080 * @param tag the new element name 0081 * @param text the text content of the new element 0082 * @return the New element 0083 */ 0084 QDomElement addKmlTextElement(QDomElement& target, const QString& tag, const QString& text) 0085 { 0086 QDomElement kmlElement = kmlDocument->createElement( tag ); 0087 target.appendChild( kmlElement ); 0088 QDomText kmlTextElement = kmlDocument->createTextNode( text ); 0089 kmlElement.appendChild( kmlTextElement ); 0090 0091 return kmlElement; 0092 } 0093 0094 private: 0095 0096 /*! @todo maybe initialize it in the constructor */ 0097 /*! the root document, used to create all QDomElements */ 0098 QDomDocument* kmlDocument; 0099 }; 0100 0101 } // namespace DigikamGenericGeolocationEditPlugin 0102 0103 #endif // DIGIKAM_KML_GPS_DATA_PARSER_H