Renaming path to hops.
This commit is contained in:
parent
9c1922d309
commit
d04fa40167
|
|
@ -142,7 +142,7 @@ $(function(){
|
|||
}, aprsOptions, getMarkerOpacityOptions(update.lastseen) ));
|
||||
marker.lastseen = update.lastseen;
|
||||
marker.mode = update.mode;
|
||||
marker.path = update.path;
|
||||
marker.hops = update.hops;
|
||||
marker.band = update.band;
|
||||
marker.comment = update.location.comment;
|
||||
marker.weather = update.location.weather;
|
||||
|
|
@ -447,7 +447,7 @@ $(function(){
|
|||
var commentString = "";
|
||||
var weatherString = "";
|
||||
var detailsString = "";
|
||||
var pathString = "";
|
||||
var hopsString = "";
|
||||
var distance = "";
|
||||
|
||||
if (marker.comment) {
|
||||
|
|
@ -548,20 +548,20 @@ $(function(){
|
|||
distance = " at " + distanceKm(receiverMarker.position, marker.position) + " km";
|
||||
}
|
||||
|
||||
if (marker.path && marker.path.length > 0) {
|
||||
var path = marker.path.toString().split(',');
|
||||
path.forEach(function(part, index, path) {
|
||||
path[index] = linkifyCallsign(part);
|
||||
if (marker.hops && marker.hops.length > 0) {
|
||||
var hops = marker.hops.toString().split(',');
|
||||
hops.forEach(function(part, index, hops) {
|
||||
hops[index] = linkifyCallsign(part);
|
||||
});
|
||||
|
||||
pathString = '<p align="right"><i>via ' + path.join(', ') + ' </i></p>';
|
||||
hopsString = '<p align="right"><i>via ' + hops.join(', ') + ' </i></p>';
|
||||
}
|
||||
|
||||
infowindow.setContent(
|
||||
'<h3>' + linkifyCallsign(callsign) + distance + '</h3>' +
|
||||
'<div align="center">' + timestring + ' using ' + marker.mode +
|
||||
( marker.band ? ' on ' + marker.band : '' ) + '</div>' +
|
||||
commentString + weatherString + detailsString + pathString
|
||||
commentString + weatherString + detailsString + hopsString
|
||||
);
|
||||
|
||||
infowindow.open(map, marker);
|
||||
|
|
|
|||
|
|
@ -180,23 +180,23 @@ class AprsParser(PickleModule):
|
|||
return self.metrics[category]
|
||||
|
||||
def isDirect(self, aprsData):
|
||||
return len(self.getPath(aprsData)) == 0
|
||||
return len(self.getHops(aprsData)) == 0
|
||||
|
||||
def getPath(self, aprsData):
|
||||
path = []
|
||||
def getHops(self, aprsData):
|
||||
hops = []
|
||||
if "source" in aprsData:
|
||||
# AIS reports have no path
|
||||
# AIS reports have no hops
|
||||
if aprsData["source"] == "AIS":
|
||||
return path;
|
||||
return hops;
|
||||
# encapsulated messages' path starts with the source callsign
|
||||
if "type" in aprsData and aprsData["type"] in ["thirdparty", "item", "object"]:
|
||||
path += [ aprsData["source"] ]
|
||||
hops += [ aprsData["source"] ]
|
||||
# filter out special aliases and anything without asterisk
|
||||
if "path" in aprsData and len(aprsData["path"]) > 0:
|
||||
path += [hop.strip("*") for hop in aprsData["path"]
|
||||
hops += [hop.strip("*") for hop in aprsData["path"]
|
||||
if hop.endswith("*") and not noHopPattern.match(hop)]
|
||||
# return path with all the asterisks stripped
|
||||
return path
|
||||
# return hops with all the asterisks stripped
|
||||
return hops
|
||||
|
||||
def process(self, data):
|
||||
try:
|
||||
|
|
@ -219,7 +219,7 @@ class AprsParser(PickleModule):
|
|||
|
||||
def updateMap(self, mapData):
|
||||
mode = mapData["mode"] if "mode" in mapData else "APRS"
|
||||
path = self.getPath(mapData)
|
||||
hops = self.getHops(mapData)
|
||||
if "type" in mapData and mapData["type"] == "thirdparty" and "data" in mapData:
|
||||
mapData = mapData["data"]
|
||||
if "lat" in mapData and "lon" in mapData:
|
||||
|
|
@ -230,7 +230,7 @@ class AprsParser(PickleModule):
|
|||
source = mapData["item"]
|
||||
elif mapData["type"] == "object":
|
||||
source = mapData["object"]
|
||||
Map.getSharedInstance().updateLocation(source, loc, mode, self.band, path)
|
||||
Map.getSharedInstance().updateLocation(source, loc, mode, self.band, hops)
|
||||
|
||||
def hasCompressedCoordinates(self, raw):
|
||||
return raw[0] == "/" or raw[0] == "\\"
|
||||
|
|
|
|||
12
owrx/map.py
12
owrx/map.py
|
|
@ -66,7 +66,7 @@ class Map(object):
|
|||
"lastseen": record["updated"].timestamp() * 1000,
|
||||
"mode": record["mode"],
|
||||
"band": record["band"].getName() if record["band"] is not None else None,
|
||||
"path": record["path"],
|
||||
"hops": record["hops"],
|
||||
}
|
||||
for (callsign, record) in self.positions.items()
|
||||
]
|
||||
|
|
@ -78,16 +78,16 @@ class Map(object):
|
|||
except ValueError:
|
||||
pass
|
||||
|
||||
def updateLocation(self, callsign, loc: Location, mode: str, band: Band = None, path: list[str] = []):
|
||||
def updateLocation(self, callsign, loc: Location, mode: str, band: Band = None, hops: list[str] = []):
|
||||
pm = Config.get()
|
||||
preferRecent = pm["map_prefer_recent_reports"]
|
||||
needBroadcast = False
|
||||
ts = datetime.now()
|
||||
|
||||
with self.positionsLock:
|
||||
# prefer messages with shorter path unless preferRecent set
|
||||
if preferRecent or callsign not in self.positions or len(path) <= len(self.positions[callsign]["path"]):
|
||||
self.positions[callsign] = {"location": loc, "updated": ts, "mode": mode, "band": band, "path": path }
|
||||
# prefer messages with shorter hop count unless preferRecent set
|
||||
if preferRecent or callsign not in self.positions or len(hops) <= len(self.positions[callsign]["hops"]):
|
||||
self.positions[callsign] = {"location": loc, "updated": ts, "mode": mode, "band": band, "hops": hops }
|
||||
needBroadcast = True
|
||||
|
||||
if needBroadcast:
|
||||
|
|
@ -99,7 +99,7 @@ class Map(object):
|
|||
"lastseen": ts.timestamp() * 1000,
|
||||
"mode": mode,
|
||||
"band": band.getName() if band is not None else None,
|
||||
"path": path,
|
||||
"hops": hops,
|
||||
}
|
||||
]
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue