diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-01-17 09:48:56 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-01-17 09:48:56 -0500 |
commit | 3ee9482af36577554f3311bea78a99d2d1298fce (patch) | |
tree | 7162bab452294d15dcf3aa6897542ac143dc6a8c | |
parent | 1f95586bb3a21ee01d2a4f15a0f31e571b077a26 (diff) | |
download | gpsd-3ee9482af36577554f3311bea78a99d2d1298fce.tar.gz |
Chen Wei's nautical-style display is fully merged.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | gps.xml | 7 | ||||
-rwxr-xr-x | xgpsspeed | 32 |
3 files changed, 26 insertions, 16 deletions
@@ -2,7 +2,8 @@ Fix various minor errors in the AIVDM/AIVDO description. Repair the xmlto support in the build system. Add two more regression tests. Significant improvements to NMEA2000 support. Upgrade the PHP client to v3 of the - Google Maps API. Support for the Telit SL869 chipset. + Google Maps API. Support for the Telit SL869 chipset. Added a nautical-style + display to xgpsspeed. * Mon 02 Jul Eric S. Raymond <esr@snark.thyrsus.com> - 3.7 Snap release to get the midnight change in the default leap-second @@ -228,11 +228,18 @@ position information from the GPS. It accepts an -h option and optional argument as for <application>gps</application>, or a -V option to dump the package version and exit.</para> +<para>The default display mode resembles a car speedometer. With the +option --nautical you get a more elaborate speed and track presentation +modeled after a marine navigation display.</para> + <para>The -speedunits option can be used to set the speed units for display; follow the keyword with knots for nautical miles per hour, kph for kilometres per hour, or mph for miles per hour. The default is miles per hour. </para> +<para>In the nautical mode only, --maxspeed sets the maximum on the +speedometer.</para> + </refsect2> <refsect2><title>cgps</title> @@ -26,8 +26,6 @@ __version__ = '0.0.8' # testing! # cleanup and sanitize code -chenwei = False - class Speedometer(gtk.DrawingArea): def __init__(self, speed_unit=None): gtk.DrawingArea.__init__(self) @@ -247,8 +245,6 @@ class Speedometer(gtk.DrawingArea): def get_radius(self, width, height): return min(width / 2.0, height / 2.0) - 20 -# Experimental insertion of Chen Wei's code - HEADING_SAT_GAP = 0.8 GPS_PRNMAX = 32 # Above this number are SBAS satellites SAT_SIZE = 10 # radius of the satellite circle in skyview @@ -265,7 +261,7 @@ def polar2xy(radius, angle, polex, poley): return (polex + cos(angle) * radius, poley - sin(angle) * radius) -class Speedometer2(gtk.DrawingArea): +class SpeedAndTrack(gtk.DrawingArea): def __init__(self, speed_unit=None, maxspeed=100): gtk.DrawingArea.__init__(self) self.connect('expose_event', self.expose_event) @@ -549,26 +545,24 @@ class Speedometer2(gtk.DrawingArea): def get_radius(self, width, height): return min(width / 2.0, height / 2.0) - 70 - -# Experimental insertion ends - class Main(object): def __init__(self, host='localhost', port='2947', device=None, debug=0, - speed_unit=None, maxspeed=0): + speed_unit=None, maxspeed=0, nautical=False): self.host = host self.port = port self.device = device self.debug = debug self.speed_unit = speed_unit self.maxspeed = maxspeed + self.nautical = nautical self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) - if chenwei: + if self.nautical: self.window.set_size_request(500, 550) if not self.window.get_display(): raise Exception("Can't open display") self.window.set_title('xgpsspeed') - if chenwei: - self.widget = Speedometer2(speed_unit=self.speed_unit, + if self.nautical: + self.widget = SpeedAndTrack(speed_unit=self.speed_unit, maxspeed=self.maxspeed) else: self.widget = Speedometer(speed_unit=self.speed_unit) @@ -642,7 +636,7 @@ class Main(object): self.handle_hangup(source, condition) if self.daemon.data['class'] == 'TPV': self.update_speed(self.daemon.data) - if chenwei and self.daemon.data['class'] == 'SKY': + if self.nautical and self.daemon.data['class'] == 'SKY': self.update_skyview(self.daemon.data) return True @@ -664,7 +658,7 @@ class Main(object): if hasattr(data, 'speed'): self.widget.last_speed = data.speed self.widget.queue_draw() - if chenwei and hasattr(data, 'track'): + if self.nautical and hasattr(data, 'track'): self.widget.last_heading = data.track self.widget.queue_draw() @@ -674,7 +668,7 @@ class Main(object): self.widget.satellites = data.satellites self.widget.queue_draw() - # Used for Speedometer2 only + # Used for SpeedAndTrack only def update_skyview(self, data): "Update the satellite list and skyview." if hasattr(data, 'satellites'): @@ -756,6 +750,13 @@ if __name__ == '__main__': help='max speed of the speedmeter [Default 50]' ) parser.add_option( + '--nautical', + dest='nautical', + default=False, + action='store_true', + help='Enable nautical-style speed and track display.' + ) + parser.add_option( '--debug', dest='debug', default=0, @@ -793,5 +794,6 @@ if __name__ == '__main__': device=options.device, speed_unit=options.speedunits, maxspeed=options.maxspeed, + nautical=options.nautical, debug=options.debug ).run() |