mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-21 10:10:49 +01:00
Compare commits
No commits in common. "579d8a5c6e3a9c4e42204cc6fa09a2b9b5758a4d" and "ad2f108fa8ffc0f427472bc75de5667a0d3b489d" have entirely different histories.
579d8a5c6e
...
ad2f108fa8
@ -2,7 +2,7 @@
|
|||||||
<map xmlns="http://www.gpxsee.org/map/1.4">
|
<map xmlns="http://www.gpxsee.org/map/1.4">
|
||||||
<name>USGS Imagery</name>
|
<name>USGS Imagery</name>
|
||||||
<url>https://basemap.nationalmap.gov/ArcGIS/rest/services/USGSImageryOnly/MapServer/tile/$z/$y/$x</url>
|
<url>https://basemap.nationalmap.gov/ArcGIS/rest/services/USGSImageryOnly/MapServer/tile/$z/$y/$x</url>
|
||||||
<zoom min="2" max="16"/>
|
<zoom min="2" max="15"/>
|
||||||
<bounds bottom="0" top="74"/>
|
<bounds bottom="0" top="74"/>
|
||||||
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
||||||
</map>
|
</map>
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
<map xmlns="http://www.gpxsee.org/map/1.4">
|
<map xmlns="http://www.gpxsee.org/map/1.4">
|
||||||
<name>USGS Topo</name>
|
<name>USGS Topo</name>
|
||||||
<url>https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/$z/$y/$x</url>
|
<url>https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/$z/$y/$x</url>
|
||||||
<zoom min="2" max="16"/>
|
<zoom min="2" max="15"/>
|
||||||
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
||||||
</map>
|
</map>
|
||||||
|
@ -32,12 +32,7 @@ static bool isZIP(QFile *file)
|
|||||||
qreal KMLParser::number()
|
qreal KMLParser::number()
|
||||||
{
|
{
|
||||||
bool res;
|
bool res;
|
||||||
QString str(_reader.readElementText());
|
qreal ret = _reader.readElementText().toDouble(&res);
|
||||||
|
|
||||||
if (str.isEmpty())
|
|
||||||
return NAN;
|
|
||||||
|
|
||||||
qreal ret = str.toDouble(&res);
|
|
||||||
if (!res)
|
if (!res)
|
||||||
_reader.raiseError(QString("Invalid %1").arg(
|
_reader.raiseError(QString("Invalid %1").arg(
|
||||||
_reader.name().toString()));
|
_reader.name().toString()));
|
||||||
@ -64,8 +59,6 @@ bool KMLParser::coord(Trackpoint &trackpoint)
|
|||||||
qreal val[3];
|
qreal val[3];
|
||||||
bool res;
|
bool res;
|
||||||
|
|
||||||
if (data.isEmpty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
sp = data.constData();
|
sp = data.constData();
|
||||||
ep = sp + data.size();
|
ep = sp + data.size();
|
||||||
@ -338,9 +331,9 @@ void KMLParser::point(Waypoint &waypoint)
|
|||||||
_reader.raiseError("Missing Point coordinates");
|
_reader.raiseError("Missing Point coordinates");
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::heartRate(SegmentData &segment)
|
void KMLParser::heartRate(SegmentData &segment, int start)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = start;
|
||||||
const char error[] = "Heartrate data count mismatch";
|
const char error[] = "Heartrate data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
@ -355,13 +348,13 @@ void KMLParser::heartRate(SegmentData &segment)
|
|||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_reader.error() && i != segment.size())
|
if (i != segment.size())
|
||||||
_reader.raiseError(error);
|
_reader.raiseError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::cadence(SegmentData &segment)
|
void KMLParser::cadence(SegmentData &segment, int start)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = start;
|
||||||
const char error[] = "Cadence data count mismatch";
|
const char error[] = "Cadence data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
@ -376,13 +369,13 @@ void KMLParser::cadence(SegmentData &segment)
|
|||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_reader.error() && i != segment.size())
|
if (i != segment.size())
|
||||||
_reader.raiseError(error);
|
_reader.raiseError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::speed(SegmentData &segment)
|
void KMLParser::speed(SegmentData &segment, int start)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = start;
|
||||||
const char error[] = "Speed data count mismatch";
|
const char error[] = "Speed data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
@ -397,13 +390,13 @@ void KMLParser::speed(SegmentData &segment)
|
|||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_reader.error() && i != segment.size())
|
if (i != segment.size())
|
||||||
_reader.raiseError(error);
|
_reader.raiseError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::temperature(SegmentData &segment)
|
void KMLParser::temperature(SegmentData &segment, int start)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = start;
|
||||||
const char error[] = "Temperature data count mismatch";
|
const char error[] = "Temperature data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
@ -418,49 +411,25 @@ void KMLParser::temperature(SegmentData &segment)
|
|||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_reader.error() && i != segment.size())
|
if (i != segment.size())
|
||||||
_reader.raiseError(error);
|
_reader.raiseError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::power(SegmentData &segment)
|
void KMLParser::schemaData(SegmentData &segment, int start)
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
const char error[] = "Power data count mismatch";
|
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
|
||||||
if (_reader.name() == QLatin1String("value")) {
|
|
||||||
if (i < segment.size())
|
|
||||||
segment[i++].setPower(number());
|
|
||||||
else {
|
|
||||||
_reader.raiseError(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
_reader.skipCurrentElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_reader.error() && i != segment.size())
|
|
||||||
_reader.raiseError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KMLParser::schemaData(SegmentData &segment)
|
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == QLatin1String("SimpleArrayData")) {
|
if (_reader.name() == QLatin1String("SimpleArrayData")) {
|
||||||
QXmlStreamAttributes attr = _reader.attributes();
|
QXmlStreamAttributes attr = _reader.attributes();
|
||||||
// There are files using capitalized names in the wild!
|
QString name(attr.value("name").toString());
|
||||||
QString name(attr.value("name").toString().toLower());
|
|
||||||
|
|
||||||
if (name == QLatin1String("heartrate"))
|
if (name == QLatin1String("Heartrate"))
|
||||||
heartRate(segment);
|
heartRate(segment, start);
|
||||||
else if (name == QLatin1String("cadence"))
|
else if (name == QLatin1String("Cadence"))
|
||||||
cadence(segment);
|
cadence(segment, start);
|
||||||
else if (name == QLatin1String("speed"))
|
else if (name == QLatin1String("Speed"))
|
||||||
speed(segment);
|
speed(segment, start);
|
||||||
else if (name == QLatin1String("temperature"))
|
else if (name == QLatin1String("Temperature"))
|
||||||
temperature(segment);
|
temperature(segment, start);
|
||||||
else if (name == QLatin1String("power"))
|
|
||||||
power(segment);
|
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
} else
|
} else
|
||||||
@ -468,11 +437,11 @@ void KMLParser::schemaData(SegmentData &segment)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::extendedData(SegmentData &segment)
|
void KMLParser::extendedData(SegmentData &segment, int start)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == QLatin1String("SchemaData"))
|
if (_reader.name() == QLatin1String("SchemaData"))
|
||||||
schemaData(segment);
|
schemaData(segment, start);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
@ -481,7 +450,8 @@ void KMLParser::extendedData(SegmentData &segment)
|
|||||||
void KMLParser::track(SegmentData &segment)
|
void KMLParser::track(SegmentData &segment)
|
||||||
{
|
{
|
||||||
const char error[] = "gx:coord/when element count mismatch";
|
const char error[] = "gx:coord/when element count mismatch";
|
||||||
int i = 0;
|
int first = segment.size();
|
||||||
|
int i = first;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == QLatin1String("when")) {
|
if (_reader.name() == QLatin1String("when")) {
|
||||||
@ -497,20 +467,13 @@ void KMLParser::track(SegmentData &segment)
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} else if (_reader.name() == QLatin1String("ExtendedData"))
|
} else if (_reader.name() == QLatin1String("ExtendedData"))
|
||||||
extendedData(segment);
|
extendedData(segment, first);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != segment.size()) {
|
if (i != segment.size())
|
||||||
_reader.raiseError(error);
|
_reader.raiseError(error);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// empty (invalid) coordinates are allowed per KML specification!
|
|
||||||
for (int i = 0; i < segment.size(); i++)
|
|
||||||
if (segment.at(i).coordinates().isNull())
|
|
||||||
segment.remove(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KMLParser::multiTrack(TrackData &t)
|
void KMLParser::multiTrack(TrackData &t)
|
||||||
|
@ -53,13 +53,12 @@ private:
|
|||||||
bool lineCoordinates(SegmentData &segment);
|
bool lineCoordinates(SegmentData &segment);
|
||||||
bool polygonCoordinates(QVector<Coordinates> &points);
|
bool polygonCoordinates(QVector<Coordinates> &points);
|
||||||
bool coord(Trackpoint &trackpoint);
|
bool coord(Trackpoint &trackpoint);
|
||||||
void extendedData(SegmentData &segment);
|
void extendedData(SegmentData &segment, int start);
|
||||||
void schemaData(SegmentData &segment);
|
void schemaData(SegmentData &segment, int start);
|
||||||
void heartRate(SegmentData &segment);
|
void heartRate(SegmentData &segment, int start);
|
||||||
void cadence(SegmentData &segment);
|
void cadence(SegmentData &segment, int start);
|
||||||
void speed(SegmentData &segment);
|
void speed(SegmentData &segment, int start);
|
||||||
void temperature(SegmentData &segment);
|
void temperature(SegmentData &segment, int start);
|
||||||
void power(SegmentData &segment);
|
|
||||||
QDateTime timeStamp();
|
QDateTime timeStamp();
|
||||||
qreal number();
|
qreal number();
|
||||||
QDateTime time();
|
QDateTime time();
|
||||||
|
@ -61,9 +61,6 @@ bool PLTParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
}
|
}
|
||||||
} else if (_errorLine == 5) {
|
} else if (_errorLine == 5) {
|
||||||
QList<QByteArray> list = line.split(',');
|
QList<QByteArray> list = line.split(',');
|
||||||
if (list.size() >= 3 && !list.at(2).isEmpty())
|
|
||||||
track.setStyle(LineStyle(QColor(list.at(2).toUInt()),
|
|
||||||
list.at(1).toUInt()));
|
|
||||||
if (list.size() >= 4)
|
if (list.size() >= 4)
|
||||||
track.setName(list.at(3));
|
track.setName(list.at(3));
|
||||||
} else if (_errorLine > 6) {
|
} else if (_errorLine > 6) {
|
||||||
@ -169,9 +166,6 @@ bool RTEParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
QByteArray description(list.at(3).trimmed());
|
QByteArray description(list.at(3).trimmed());
|
||||||
routes.last().setDescription(decode(description));
|
routes.last().setDescription(decode(description));
|
||||||
}
|
}
|
||||||
if (list.size() >= 5 && !list.at(4).isEmpty())
|
|
||||||
routes.last().setStyle(
|
|
||||||
LineStyle(QColor(list.at(4).toUInt())));
|
|
||||||
} else if (list.at(0).trimmed() == "W") {
|
} else if (list.at(0).trimmed() == "W") {
|
||||||
if (!record || list.size() < 7) {
|
if (!record || list.size() < 7) {
|
||||||
_errorString = "Parse error";
|
_errorString = "Parse error";
|
||||||
@ -288,8 +282,6 @@ bool WPTParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
delphi2unixMS(date)));
|
delphi2unixMS(date)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.size() >= 9 && !list.at(8).isEmpty())
|
|
||||||
wp.setStyle(PointStyle(QColor(list.at(8).toUInt())));
|
|
||||||
if (list.size() >= 11) {
|
if (list.size() >= 11) {
|
||||||
QByteArray description(list.at(10).trimmed());
|
QByteArray description(list.at(10).trimmed());
|
||||||
if (!description.isEmpty())
|
if (!description.isEmpty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user