1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Fixed broaken loading of KML files with multitracks and folder element outside document element

This commit is contained in:
Martin Tůma 2017-10-11 22:41:01 +02:00
parent d3193abd0b
commit 57a171ee8c
2 changed files with 19 additions and 0 deletions

View File

@ -251,6 +251,16 @@ void KMLParser::track(TrackData &track)
_reader.raiseError(mismatchError);
}
void KMLParser::multiTrack(TrackData &t)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "Track")
track(t);
else
_reader.skipCurrentElement();
}
}
void KMLParser::multiGeometry(QList<TrackData> &tracks,
QList<Waypoint> &waypoints, const QString &name, const QString &desc,
const QDateTime timestamp)
@ -308,6 +318,12 @@ void KMLParser::placemark(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
t.setName(name);
t.setDescription(desc);
track(t);
} else if (_reader.name() == "MultiTrack") {
tracks.append(TrackData());
TrackData &t = tracks.last();
t.setName(name);
t.setDescription(desc);
multiTrack(t);
} else
_reader.skipCurrentElement();
}
@ -344,6 +360,8 @@ void KMLParser::kml(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
document(tracks, waypoints);
else if (_reader.name() == "Placemark")
placemark(tracks, waypoints);
else if (_reader.name() == "Folder")
folder(tracks, waypoints);
else
_reader.skipCurrentElement();
}

View File

@ -23,6 +23,7 @@ private:
void multiGeometry(QList<TrackData> &tracks, QList<Waypoint> &waypoints,
const QString &name, const QString &desc, const QDateTime timestamp);
void track(TrackData &track);
void multiTrack(TrackData &t);
void lineString(TrackData &track);
void point(Waypoint &waypoint);
bool pointCoordinates(Waypoint &waypoint);