GPX Viewer repository
Revision | 9baed4b20096044986e91fa01a4655694f7f7464 (tree) |
---|---|
Time | 2019-11-09 21:02:00 |
Author | Sergey Salnikov |
Commiter | Sergey Salnikov |
Fixed parsing unusual GPX files.
@@ -703,7 +703,7 @@ | ||
703 | 703 | break |
704 | 704 | if n < 2: |
705 | 705 | for j in range(TheDocument.trkmodel.rowCount()): |
706 | - if TheDocument.trkmodel.index(j, 0).data(gpx.IncludeRole) and TheDocument.trkmodel.index(i, gpx.TRKTIME).data() != '': | |
706 | + if TheDocument.trkmodel.index(j, 0).data(gpx.IncludeRole) and TheDocument.trkmodel.index(j, gpx.TRKTIME).data() != '': | |
707 | 707 | n = 2 |
708 | 708 | break |
709 | 709 | if n < 2: |
@@ -128,7 +128,7 @@ | ||
128 | 128 | elif self.markerStates[index.row()]: |
129 | 129 | return self.MarkerColor |
130 | 130 | else: |
131 | - return QGuiApplication.palette().base().color() | |
131 | + return Qt.transparent | |
132 | 132 | elif role == Qt.FontRole: |
133 | 133 | font = QFont() |
134 | 134 | if self.splitStates[index.row()]: |
@@ -354,12 +354,13 @@ | ||
354 | 354 | point[NAME] = name.strip() if name is not None else '' |
355 | 355 | point[LAT] = float(p.get('lat')) |
356 | 356 | point[LON] = float(p.get('lon')) |
357 | - point[ALT] = int(round(float(p.findtext('{%(ns)s}ele' % ns)))) | |
357 | + ele = p.findtext('{%(ns)s}ele' % ns) | |
358 | + point[ALT] = int(round(float(ele))) if ele is not None else 0 | |
358 | 359 | self.minalt = min(self.minalt, point[ALT]) |
359 | 360 | self.maxalt = max(self.maxalt, point[ALT]) |
360 | 361 | time = p.findtext('{%(ns)s}time' % ns) |
361 | 362 | if time is not None: |
362 | - dt = datetime.strptime(time.strip(), '%Y-%m-%dT%H:%M:%SZ') | |
363 | + dt = datetime.strptime(time[:19].strip(), '%Y-%m-%dT%H:%M:%S') | |
363 | 364 | point[TIME] = dt |
364 | 365 | else: |
365 | 366 | point[TIME] = '' |
@@ -407,12 +408,13 @@ | ||
407 | 408 | point = {} |
408 | 409 | point[LAT] = float(p.get('lat')) |
409 | 410 | point[LON] = float(p.get('lon')) |
410 | - point[ALT] = int(round(float(p.findtext('{%(ns)s}ele' % ns)))) | |
411 | + ele = p.findtext('{%(ns)s}ele' % ns) | |
412 | + point[ALT] = int(round(float(ele))) if ele is not None else 0 | |
411 | 413 | self.minalt = min(self.minalt, point[ALT]) |
412 | 414 | self.maxalt = max(self.maxalt, point[ALT]) |
413 | 415 | time = p.findtext('{%(ns)s}time' % ns) |
414 | 416 | if time is not None: |
415 | - dt = datetime.strptime(time.strip(), '%Y-%m-%dT%H:%M:%SZ') | |
417 | + dt = datetime.strptime(time[:19].strip(), '%Y-%m-%dT%H:%M:%S') | |
416 | 418 | point[TIME] = dt |
417 | 419 | else: |
418 | 420 | point[TIME] = '' |