Adding direct/indirect APRS indicator to map markers.
This commit is contained in:
parent
4ed3fea080
commit
2f0bd16e24
|
|
@ -142,6 +142,7 @@ $(function(){
|
|||
}, aprsOptions, getMarkerOpacityOptions(update.lastseen) ));
|
||||
marker.lastseen = update.lastseen;
|
||||
marker.mode = update.mode;
|
||||
marker.direct = update.direct;
|
||||
marker.band = update.band;
|
||||
marker.comment = update.location.comment;
|
||||
marker.weather = update.location.weather;
|
||||
|
|
@ -446,6 +447,7 @@ $(function(){
|
|||
var commentString = "";
|
||||
var weatherString = "";
|
||||
var detailsString = "";
|
||||
var indirect = "";
|
||||
var distance = "";
|
||||
|
||||
if (marker.comment) {
|
||||
|
|
@ -546,10 +548,15 @@ $(function(){
|
|||
distance = " at " + distanceKm(receiverMarker.position, marker.position) + " km";
|
||||
}
|
||||
|
||||
if (!marker.direct) {
|
||||
indirect = '<b>indirect</b> ';
|
||||
}
|
||||
|
||||
infowindow.setContent(
|
||||
'<h3>' + linkifyCallsign(callsign) + distance + '</h3>' +
|
||||
'<div align="center">' + timestring + ' using ' + marker.mode + ( marker.band ? ' on ' + marker.band : '' ) + '</div>' +
|
||||
commentString + weatherString + detailsString
|
||||
'<div align="center">' + timestring + ' using ' + indirect +
|
||||
marker.mode + ( marker.band ? ' on ' + marker.band : '' ) +
|
||||
'</div>' + commentString + weatherString + detailsString
|
||||
);
|
||||
|
||||
infowindow.open(map, marker);
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ class AprsParser(PickleModule):
|
|||
return self.metrics[category]
|
||||
|
||||
def isDirect(self, aprsData):
|
||||
if "source" in aprsData and aprsData["source"] == "AIS":
|
||||
return True;
|
||||
if "path" in aprsData and len(aprsData["path"]) > 0:
|
||||
hops = [host for host in aprsData["path"] if widePattern.match(host) is None]
|
||||
if len(hops) > 0:
|
||||
|
|
@ -206,6 +208,7 @@ class AprsParser(PickleModule):
|
|||
|
||||
def updateMap(self, mapData):
|
||||
mode = mapData["mode"] if "mode" in mapData else "APRS"
|
||||
direct = self.isDirect(mapData)
|
||||
if "type" in mapData and mapData["type"] == "thirdparty" and "data" in mapData:
|
||||
mapData = mapData["data"]
|
||||
if "lat" in mapData and "lon" in mapData:
|
||||
|
|
@ -216,7 +219,7 @@ class AprsParser(PickleModule):
|
|||
source = mapData["item"]
|
||||
elif mapData["type"] == "object":
|
||||
source = mapData["object"]
|
||||
Map.getSharedInstance().updateLocation(source, loc, mode, self.band)
|
||||
Map.getSharedInstance().updateLocation(source, loc, mode, self.band, direct)
|
||||
|
||||
def hasCompressedCoordinates(self, raw):
|
||||
return raw[0] == "/" or raw[0] == "\\"
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class Map(object):
|
|||
except ValueError:
|
||||
pass
|
||||
|
||||
def updateLocation(self, callsign, loc: Location, mode: str, band: Band = None):
|
||||
def updateLocation(self, callsign, loc: Location, mode: str, band: Band = None, direct: bool = True):
|
||||
ts = datetime.now()
|
||||
with self.positionsLock:
|
||||
self.positions[callsign] = {"location": loc, "updated": ts, "mode": mode, "band": band}
|
||||
|
|
@ -89,6 +89,7 @@ class Map(object):
|
|||
"lastseen": ts.timestamp() * 1000,
|
||||
"mode": mode,
|
||||
"band": band.getName() if band is not None else None,
|
||||
"direct": direct,
|
||||
}
|
||||
]
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue