Browse Source

Add track colored by time.

debian-sid
Tom Payne 14 years ago
parent
commit
838eedbbe1
  1. 1
      TODO
  2. 29
      igc2kmz/__init__.py
  3. 1
      igc2kmz/track.py

1
TODO

@ -16,6 +16,7 @@ Add competition task support
Clean up air speed track (average)
Improve drift/windspeed algorithm
Graphical thermal analysis
Chart for colored by time
LOW
Support Aircotec TNC files

29
igc2kmz/__init__.py

@ -308,7 +308,7 @@ class Flight(object):
return chart
def make_colored_track(self, globals, values, scale, altitude_mode,
**folder_options):
scale_chart=True, **folder_options):
style_url = globals.stock.check_hide_children_style.url()
folder = kml.Folder(name='Colored by %s' % scale.title,
styleUrl=style_url,
@ -323,14 +323,16 @@ class Flight(object):
style_url = kml.styleUrl(styles[discrete_values[sl.start]].url())
placemark = kml.Placemark(style_url, line_string)
folder.add(placemark)
href = self.make_scale_chart(globals, scale).get_url()
icon = kml.Icon(href=kml.CDATA(href))
overlay_xy = kml.overlayXY(x=0, xunits='fraction',
y=1, yunits='fraction')
screen_xy = kml.screenXY(x=0, xunits='fraction', y=1, yunits='fraction')
size = kml.size(x=0, xunits='fraction', y=0, yunits='fraction')
screen_overlay = kml.ScreenOverlay(icon, overlay_xy, screen_xy, size)
folder.add(screen_overlay)
if scale_chart:
href = self.make_scale_chart(globals, scale).get_url()
icon = kml.Icon(href=kml.CDATA(href))
overlay_xy = kml.overlayXY(x=0, xunits='fraction',
y=1, yunits='fraction')
screen_xy = kml.screenXY(x=0, xunits='fraction',
y=1, yunits='fraction')
size = kml.size(x=0, xunits='fraction', y=0, yunits='fraction')
screen_overlay = kml.ScreenOverlay(icon, overlay_xy, screen_xy, size)
folder.add(screen_overlay)
return kmz.kmz(folder).add_roots(*styles)
def make_track_folder(self, globals):
@ -359,6 +361,12 @@ class Flight(object):
globals.scales.tas,
self.altitude_mode,
visibility=0))
folder.add(self.make_colored_track(globals,
self.track.t,
globals.scales.t,
self.altitude_mode,
scale_chart=False,
visibility=visibility))
style = kml.Style(kml.LineStyle(color=self.color, width=self.width))
folder.add(self.make_solid_track(globals,
style,
@ -892,6 +900,9 @@ def flights2kmz(flights, roots=[], tz_offset=0, task=None):
gradient=default_gradient)
globals.scales.time = TimeScale(globals.bounds.time.tuple(),
tz_offset=globals.tz_offset)
globals.scales.t = Scale(globals.bounds.t.tuple(),
title='time',
gradient=default_gradient)
if hasattr(globals.bounds, 'tas'):
globals.scales.tas = Scale(globals.bounds.tas.tuple(),
title='air speed',

1
igc2kmz/track.py

@ -82,6 +82,7 @@ class Track(object):
self.bounds = util.BoundsSet()
self.bounds.ele = util.Bounds([coord.ele for coord in self.coords])
self.bounds.time = util.Bounds((self.coords[0].dt, self.coords[-1].dt))
self.bounds.t = util.Bounds((self.t[0], self.t[-1]))
if hasattr(self, 'tas'):
self.bounds.tas = util.Bounds(self.tas)
if self.bounds.ele.min != 0 or self.bounds.ele.max != 0:

Loading…
Cancel
Save