From 12c92928fa1eb801274100983abbbd9142bedfad Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 11 Aug 2019 18:42:41 +0200 Subject: [PATCH] pass through comments for display on the map --- htdocs/map.js | 8 +++++++- owrx/kiss.py | 3 ++- owrx/map.py | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/map.js b/htdocs/map.js index 7d98f49..d235e07 100644 --- a/htdocs/map.js +++ b/htdocs/map.js @@ -115,6 +115,7 @@ marker.lastseen = update.lastseen; marker.mode = update.mode; marker.band = update.band; + marker.comment = update.location.comment; // TODO the trim should happen on the server side if (expectedCallsign && expectedCallsign == update.callsign.trim()) { @@ -283,9 +284,14 @@ if (!infowindow) infowindow = new google.maps.InfoWindow(); var marker = markers[callsign]; var timestring = moment(marker.lastseen).fromNow(); + var commentString = ""; + if (marker.comment) { + commentString = '
' + marker.comment + '
'; + } infowindow.setContent( '

' + callsign + '

' + - '
' + timestring + ' using ' + marker.mode + '
' + '
' + timestring + ' using ' + marker.mode + '
' + + commentString ); infowindow.open(map, marker); } diff --git a/owrx/kiss.py b/owrx/kiss.py index d153d5b..bc3300b 100644 --- a/owrx/kiss.py +++ b/owrx/kiss.py @@ -91,7 +91,8 @@ class KissClient(object): logger.debug(data) if "lat" in data and "lon" in data: - Map.getSharedInstance().updateLocation(data["source"], LatLngLocation(data["lat"], data["lon"]), "APRS") + loc = LatLngLocation(data["lat"], data["lon"], data["comment"] if "comment" in data else None) + Map.getSharedInstance().updateLocation(data["source"], loc, "APRS") return data def parseAprsData(self, data): diff --git a/owrx/map.py b/owrx/map.py index 9908d7a..a07fd0d 100644 --- a/owrx/map.py +++ b/owrx/map.py @@ -92,12 +92,15 @@ class Map(object): class LatLngLocation(Location): - def __init__(self, lat: float, lon: float): + def __init__(self, lat: float, lon: float, comment = None): self.lat = lat self.lon = lon + self.comment = comment def __dict__(self): - return {"type": "latlon", "lat": self.lat, "lon": self.lon} + res = {"type": "latlon", "lat": self.lat, "lon": self.lon} + if self.comment is not None: res["comment"] = self.comment + return res class LocatorLocation(Location):