icao should be part of the source, not the location

This commit is contained in:
Jakob Ketterl 2023-09-06 15:53:08 +02:00
parent 26896cf2d5
commit abc5cd177e
3 changed files with 7 additions and 10 deletions

View file

@ -481,7 +481,7 @@ $(function(){
distance = " at " + distanceKm(receiverMarker.position, marker.position) + " km";
}
var title;
if (marker.icao) {
if (marker.source.icao || marker.source.flight) {
title = linkifyAircraft(source, marker.identification);
if ('altitude' in marker) {
commentString += '<div>Altitude: ' + marker.altitude + ' ft</div>';

View file

@ -23,11 +23,10 @@ class AirplaneLocation(IncrementalUpdate, LatLngLocation):
"heading",
]
def __init__(self, icao, message):
def __init__(self, message):
self.history = []
self.timestamp = datetime.now()
self.props = message
self.icao = icao
if "lat" in message and "lon" in message:
super().__init__(message["lat"], message["lon"])
else:
@ -55,10 +54,9 @@ class AirplaneLocation(IncrementalUpdate, LatLngLocation):
self.lon = merged["lon"]
def __dict__(self):
dict = super().__dict__()
dict.update(self.props)
dict["icao"] = self.icao
return dict
res = super().__dict__()
res.update(self.props)
return res
class AdsbLocation(AirplaneLocation):
@ -283,7 +281,7 @@ class ModeSParser(PickleModule):
if "icao" in message and AirplaneLocation.mapKeys & message.keys():
data = {k: message[k] for k in AirplaneLocation.mapKeys if k in message}
loc = AdsbLocation(message["icao"], data)
loc = AdsbLocation(data)
Map.getSharedInstance().updateLocation({"icao": message['icao']}, loc, "ADS-B", None)
return message

View file

@ -6,8 +6,7 @@ from owrx.map import Map
class HfdlAirplaneLocation(AirplaneLocation):
def __init__(self, message):
super().__init__(None, message)
pass
class DumpHFDLModule(ExecModule):