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