diff --git a/htdocs/lib/AprsMarker.js b/htdocs/lib/AprsMarker.js index fd4dde8..1d7bd3d 100644 --- a/htdocs/lib/AprsMarker.js +++ b/htdocs/lib/AprsMarker.js @@ -14,6 +14,16 @@ AprsMarker.prototype.draw = function() { div.style['background-position-y'] = -Math.floor(this.symbol.index / 16) * 24 + 'px'; } + if (this.course) { + if (this.course > 180) { + div.style.transform = 'scalex(-1) rotate(' + (270 - this.course) + 'deg)' + } else { + div.style.transform = 'rotate(' + (this.course - 90) + 'deg)'; + } + } else { + div.style.transform = null; + } + if (this.symbol.table != '/' && this.symbol.table != '\\') { overlay.style.display = 'block'; overlay.style['background-position-x'] = -(this.symbol.tableindex % 16) * 24 + 'px'; @@ -33,8 +43,6 @@ AprsMarker.prototype.draw = function() { AprsMarker.prototype.onAdd = function() { var div = this.div = document.createElement('div'); - div.className = 'marker'; - div.style.position = 'absolute'; div.style.cursor = 'pointer'; div.style.width = '24px'; diff --git a/htdocs/map.js b/htdocs/map.js index 064351d..20d18c1 100644 --- a/htdocs/map.js +++ b/htdocs/map.js @@ -99,10 +99,12 @@ var pos = new google.maps.LatLng(update.location.lat, update.location.lon); var marker; var markerClass = google.maps.Marker; - var iconOptions = {} + var aprsOptions = {} if (update.location.symbol) { markerClass = AprsMarker; - iconOptions.symbol = update.location.symbol; + aprsOptions.symbol = update.location.symbol; + aprsOptions.course = update.location.course; + aprsOptions.speed = update.location.speed; } if (markers[update.callsign]) { marker = markers[update.callsign]; @@ -117,7 +119,7 @@ position: pos, map: map, title: update.callsign - }, iconOptions, getMarkerOpacityOptions(update.lastseen) )); + }, aprsOptions, getMarkerOpacityOptions(update.lastseen) )); marker.lastseen = update.lastseen; marker.mode = update.mode; marker.band = update.band; diff --git a/owrx/aprs.py b/owrx/aprs.py index 2653f9a..3d6ab52 100644 --- a/owrx/aprs.py +++ b/owrx/aprs.py @@ -143,15 +143,13 @@ class WeatherParser(object): class AprsLocation(LatLngLocation): def __init__(self, data): super().__init__(data["lat"], data["lon"]) - self.comment = data["comment"] if "comment" in data else None - self.symbol = data["symbol"] if "symbol" in data else None + self.data = data def __dict__(self): res = super(AprsLocation, self).__dict__() - if self.comment is not None: - res["comment"] = self.comment - if self.symbol is not None: - res["symbol"] = self.symbol + for key in ["comment", "symbol", "course", "speed"]: + if key in self.data: + res[key] = self.data[key] return res