mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed broaken loading of KML files with multitracks and folder element outside document element
This commit is contained in:
parent
d3193abd0b
commit
57a171ee8c
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user