click-through to selected locator on the map
This commit is contained in:
parent
94afa94428
commit
2201daaa20
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
var expectedCallsign;
|
var expectedCallsign;
|
||||||
if (query.callsign) expectedCallsign = query.callsign;
|
if (query.callsign) expectedCallsign = query.callsign;
|
||||||
|
var expectedLocator;
|
||||||
|
if (query.locator) expectedLocator = query.locator;
|
||||||
|
|
||||||
var ws_url = protocol + "://" + (window.location.origin.split("://")[1]) + "/ws/";
|
var ws_url = protocol + "://" + (window.location.origin.split("://")[1]) + "/ws/";
|
||||||
if (!("WebSocket" in window)) return;
|
if (!("WebSocket" in window)) return;
|
||||||
@ -68,13 +70,15 @@
|
|||||||
var loc = update.location.locator;
|
var loc = update.location.locator;
|
||||||
var lat = (loc.charCodeAt(1) - 65 - 9) * 10 + Number(loc[3]);
|
var lat = (loc.charCodeAt(1) - 65 - 9) * 10 + Number(loc[3]);
|
||||||
var lon = (loc.charCodeAt(0) - 65 - 9) * 20 + Number(loc[2]) * 2;
|
var lon = (loc.charCodeAt(0) - 65 - 9) * 20 + Number(loc[2]) * 2;
|
||||||
|
var center = new google.maps.LatLng({lat: lat + .5, lng: lon + 1});
|
||||||
var rectangle;
|
var rectangle;
|
||||||
if (rectangles[update.callsign]) {
|
if (rectangles[update.callsign]) {
|
||||||
rectangle = rectangles[update.callsign];
|
rectangle = rectangles[update.callsign];
|
||||||
} else {
|
} else {
|
||||||
rectangle = new google.maps.Rectangle();
|
rectangle = new google.maps.Rectangle();
|
||||||
var center = new google.maps.LatLng({lat: lat + .5, lng: lon + 1});
|
rectangle.addListener('click', function(){
|
||||||
rectangle.addListener('click', buildRectangleClick(update.location.locator, center));
|
showInfoWindow(update.location.locator, center);
|
||||||
|
});
|
||||||
rectangles[update.callsign] = rectangle;
|
rectangles[update.callsign] = rectangle;
|
||||||
}
|
}
|
||||||
rectangle.setOptions($.extend({
|
rectangle.setOptions($.extend({
|
||||||
@ -91,6 +95,12 @@
|
|||||||
}, getRectangleOpacityOptions(update.lastseen) ));
|
}, getRectangleOpacityOptions(update.lastseen) ));
|
||||||
rectangle.lastseen = update.lastseen;
|
rectangle.lastseen = update.lastseen;
|
||||||
rectangle.locator = update.location.locator;
|
rectangle.locator = update.location.locator;
|
||||||
|
|
||||||
|
if (expectedLocator && expectedLocator == update.location.locator) {
|
||||||
|
map.panTo(center);
|
||||||
|
showInfoWindow(expectedLocator, center);
|
||||||
|
delete(expectedLocator);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -148,10 +158,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var infowindow;
|
var infowindow;
|
||||||
|
var showInfoWindow = function(locator, pos) {
|
||||||
var buildRectangleClick = function(locator, pos) {
|
|
||||||
if (!infowindow) infowindow = new google.maps.InfoWindow();
|
if (!infowindow) infowindow = new google.maps.InfoWindow();
|
||||||
return function() {
|
|
||||||
var inLocator = $.map(rectangles, function(r, callsign) {
|
var inLocator = $.map(rectangles, function(r, callsign) {
|
||||||
return {callsign: callsign, locator: r.locator}
|
return {callsign: callsign, locator: r.locator}
|
||||||
}).filter(function(d) {
|
}).filter(function(d) {
|
||||||
@ -166,7 +174,6 @@
|
|||||||
);
|
);
|
||||||
infowindow.setPosition(pos);
|
infowindow.setPosition(pos);
|
||||||
infowindow.open(map);
|
infowindow.open(map);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var getScale = function(lastseen) {
|
var getScale = function(lastseen) {
|
||||||
|
@ -1379,7 +1379,11 @@ function update_wsjt_panel(msg) {
|
|||||||
var $b = $('#openwebrx-panel-wsjt-message tbody');
|
var $b = $('#openwebrx-panel-wsjt-message tbody');
|
||||||
var t = new Date(msg['timestamp']);
|
var t = new Date(msg['timestamp']);
|
||||||
var pad = function(i) { return ('' + i).padStart(2, "0"); }
|
var pad = function(i) { return ('' + i).padStart(2, "0"); }
|
||||||
var linkedmsg = msg['msg'].replace(/(.*\s[A-Z0-9]+\s)([A-R]{2}[0-9]{2})$/, '$1<a href="/map?locator=$2" target="_blank">$2</a>');
|
var linkedmsg = msg['msg'];
|
||||||
|
var matches = linkedmsg.match(/(.*\s[A-Z0-9]+\s)([A-R]{2}[0-9]{2})$/);
|
||||||
|
if (matches && matches[2] != 'RR73') {
|
||||||
|
linkedmsg = matches[1] + '<a href="/map?locator=' + matches[2] + '" target="_blank">' + matches[2] + '</a>';
|
||||||
|
}
|
||||||
$b.append($(
|
$b.append($(
|
||||||
'<tr data-timestamp="' + msg['timestamp'] + '">' +
|
'<tr data-timestamp="' + msg['timestamp'] + '">' +
|
||||||
'<td>' + pad(t.getUTCHours()) + pad(t.getUTCMinutes()) + pad(t.getUTCSeconds()) + '</td>' +
|
'<td>' + pad(t.getUTCHours()) + pad(t.getUTCMinutes()) + pad(t.getUTCSeconds()) + '</td>' +
|
||||||
|
Loading…
Reference in New Issue
Block a user