1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.kipi-plugins.org
*
* Date : 2006-05-16
* Description : a tool to export GPS data to KML file.
*
* Copyright (C) 2006-2007 by Stephane Pontier <shadow dot walker at free dot fr>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef KIPIGPSSYNCPLUGINKMLGPSDATAPARSER_H
#define KIPIGPSSYNCPLUGINKMLGPSDATAPARSER_H
// Local includes.
#include "gpsdataparser.h"
// TQt includes.
#include <tqdom.h>
namespace KIPIGPSSyncPlugin
{
/*! a classe derivated from GPSDataParser mainly to transform GPS data to KML
* @author Stéphane Pontier shadow.walker@free.fr
*/
class KMLGPSDataParser : public GPSDataParser
{
public:
KMLGPSDataParser();
~KMLGPSDataParser();
/*! KIPIGPSSyncPlugin::KMLGPSDataParser::lineString()
* @return the string containing the time ordered point (lon,lat,alt)
*/
TQString lineString();
/*! Create a KML Element that will contain the linetrace of the GPS
* @param parent the TQDomElement to which the track will be added
* @param root the TQDomDocument used to create all elements
* @param altitudeMode altitude mode of the line and points
*/
void CreateTrackLine(TQDomElement &parent, TQDomDocument &root, int altitudeMode);
/*! Create a KML Element that will contain the points and of the GPS
* @param parent the TQDomElement to which the track will be added
* @param root the TQDomDocument used to create all elements
* @param timeZone the Timezone of the pictures
* @param altitudeMode altitude mode of the line and points
*/
void CreateTrackPoints(TQDomElement &parent, TQDomDocument &root, int timeZone, int altitudeMode);
private:
/*! @todo maybe initialize it in the constructor */
/*! the root document, used to create all TQDomElements */
TQDomDocument *kmlDocument;
/*!
\fn TQDomElement KIPIGPSSyncPlugin::KMLGPSDataParser::addKmlElement(TQDomElement target, TQString tag)
* Add a new element
* @param target the parent element to which add the element
* @param tag the new element name
* @return the New element
*/
TQDomElement addKmlElement(TQDomElement &target, TQString tag)
{
TQDomElement kmlElement = kmlDocument->createElement( tag );
target.appendChild( kmlElement );
return kmlElement;
}
/*!
\fn TQDomElement KIPIGPSSyncPlugin::KMLGPSDataParser::addKmlTextElement(TQDomElement target, TQString tag, TQString text)
* Add a new element with a text
* @param target the parent element to which add the element
* @param tag the new element name
* @param text the text content of the new element
* @return the New element
*/
TQDomElement addKmlTextElement(TQDomElement &target, TQString tag, TQString text)
{
TQDomElement kmlElement = kmlDocument->createElement( tag );
target.appendChild( kmlElement );
TQDomText kmlTextElement = kmlDocument->createTextNode( text );
kmlElement.appendChild( kmlTextElement );
return kmlElement;
}
};
} // namespace KIPIGPSSyncPlugin
#endif // KIPIGPSSYNCPLUGINKMLGPSDATAPARSER_H
|