mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 19:52:09 +01:00
Added support for MultiGeometry objects in KML
This commit is contained in:
parent
d201101587
commit
9f06b042ca
@ -225,7 +225,7 @@ void KMLParser::point(Waypoint &waypoint)
|
|||||||
_reader.raiseError("Missing Point coordinates");
|
_reader.raiseError("Missing Point coordinates");
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::Track(TrackData &track)
|
void KMLParser::track(TrackData &track)
|
||||||
{
|
{
|
||||||
const char mismatchError[] = "gx:coord/when element count mismatch";
|
const char mismatchError[] = "gx:coord/when element count mismatch";
|
||||||
int i = track.size();
|
int i = track.size();
|
||||||
@ -251,6 +251,28 @@ void KMLParser::Track(TrackData &track)
|
|||||||
_reader.raiseError(mismatchError);
|
_reader.raiseError(mismatchError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KMLParser::multiGeometry(const QString &name, const QString &desc,
|
||||||
|
const QDateTime timestamp)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Point") {
|
||||||
|
_waypoints.append(Waypoint());
|
||||||
|
Waypoint &w = _waypoints.last();
|
||||||
|
w.setName(name);
|
||||||
|
w.setDescription(desc);
|
||||||
|
w.setTimestamp(timestamp);
|
||||||
|
point(w);
|
||||||
|
} else if (_reader.name() == "LineString") {
|
||||||
|
_tracks.append(TrackData());
|
||||||
|
TrackData &t = _tracks.last();
|
||||||
|
t.setName(name);
|
||||||
|
t.setDescription(desc);
|
||||||
|
lineString(t);
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KMLParser::placemark()
|
void KMLParser::placemark()
|
||||||
{
|
{
|
||||||
QString name, desc;
|
QString name, desc;
|
||||||
@ -263,25 +285,27 @@ void KMLParser::placemark()
|
|||||||
desc = _reader.readElementText();
|
desc = _reader.readElementText();
|
||||||
else if (_reader.name() == "TimeStamp")
|
else if (_reader.name() == "TimeStamp")
|
||||||
timestamp = timeStamp();
|
timestamp = timeStamp();
|
||||||
|
else if (_reader.name() == "MultiGeometry")
|
||||||
|
multiGeometry(name, desc, timestamp);
|
||||||
else if (_reader.name() == "Point") {
|
else if (_reader.name() == "Point") {
|
||||||
_waypoints.append(Waypoint());
|
_waypoints.append(Waypoint());
|
||||||
Waypoint &waypoint = _waypoints.last();
|
Waypoint &w = _waypoints.last();
|
||||||
waypoint.setName(name);
|
w.setName(name);
|
||||||
waypoint.setDescription(desc);
|
w.setDescription(desc);
|
||||||
waypoint.setTimestamp(timestamp);
|
w.setTimestamp(timestamp);
|
||||||
point(waypoint);
|
point(w);
|
||||||
} else if (_reader.name() == "LineString") {
|
} else if (_reader.name() == "LineString") {
|
||||||
_tracks.append(TrackData());
|
_tracks.append(TrackData());
|
||||||
TrackData &track = _tracks.last();
|
TrackData &t = _tracks.last();
|
||||||
track.setName(name);
|
t.setName(name);
|
||||||
track.setDescription(desc);
|
t.setDescription(desc);
|
||||||
lineString(track);
|
lineString(t);
|
||||||
} else if (_reader.name() == "Track") {
|
} else if (_reader.name() == "Track") {
|
||||||
_tracks.append(TrackData());
|
_tracks.append(TrackData());
|
||||||
TrackData &track = _tracks.last();
|
TrackData &t = _tracks.last();
|
||||||
track.setName(name);
|
t.setName(name);
|
||||||
track.setDescription(desc);
|
t.setDescription(desc);
|
||||||
Track(track);
|
track(t);
|
||||||
} else
|
} else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,9 @@ private:
|
|||||||
void document();
|
void document();
|
||||||
void folder();
|
void folder();
|
||||||
void placemark();
|
void placemark();
|
||||||
void Track(TrackData &track);
|
void multiGeometry(const QString &name, const QString &desc,
|
||||||
|
const QDateTime timestamp);
|
||||||
|
void track(TrackData &track);
|
||||||
void lineString(TrackData &track);
|
void lineString(TrackData &track);
|
||||||
void point(Waypoint &waypoint);
|
void point(Waypoint &waypoint);
|
||||||
bool pointCoordinates(Waypoint &waypoint);
|
bool pointCoordinates(Waypoint &waypoint);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user