Skip to content

Commit

Permalink
Keep different track files separate --
Browse files Browse the repository at this point in the history
don't draw lines from the end of one track to the
beginning of the next.
  • Loading branch information
akkana committed Aug 29, 2014
1 parent 2d11a64 commit 059e54b
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions pytopo
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,8 @@ Topo2MapCollection: data from local-area Topo! packages that
_ser7prefix=_prefix, _ser15prefix=None,
_img_ext=".jpg")

START = "start"

class TrackPoints :

"""Parsing and handling of GPS track files.
Expand Down Expand Up @@ -1178,13 +1180,21 @@ class TrackPoints :

# Handle track(s)
trkpts = dom.getElementsByTagName("trkpt")
for i in range (0, len(trkpts), 1) :
self.handleTrackPoint(trkpts[i], False)

# We need to keep different track files separate -- don't
# draw lines from the end of one track to the beginning of the next.
if trkpts:
self.points.append(START)

for i in range (0, len(trkpts), 1) :
self.handleTrackPoint(trkpts[i], False)

# Handle waypoints
waypts = dom.getElementsByTagName("wpt")
for i in range (0, len(waypts), 1) :
self.handleTrackPoint(waypts[i], True)
if waypts:
self.waypoints.append(START)
for i in range (0, len(waypts), 1) :
self.handleTrackPoint(waypts[i], True)

# GPX also allows for routing, rtept, but I don't think we need those.

Expand Down Expand Up @@ -1474,6 +1484,10 @@ that are expected by the MapCollection classes:
self.set_track_color()

for pt in self.trackpoints.points :
if pt == START:
cur_x = None
cur_y = None
continue
x = int((pt[0] - self.center_lon) * self.collection.xscale
+ win_width/2)
y = int((self.center_lat - pt[1]) * self.collection.yscale
Expand All @@ -1497,6 +1511,8 @@ that are expected by the MapCollection classes:
self.xgc.line_style = gtk.gdk.LINE_SOLID
self.xgc.line_width = 2
for pt in self.trackpoints.waypoints :
if pt == START:
continue
x = int((pt[0] - self.center_lon) * self.collection.xscale
+ win_width/2)
y = int((self.center_lat - pt[1]) * self.collection.yscale
Expand Down

0 comments on commit 059e54b

Please sign in to comment.