use custom marker class to solve overlay problem (and enable rotation at

a later point)
This commit is contained in:
Jakob Ketterl
2019-09-19 01:35:58 +02:00
parent 996422ff4b
commit 15c28b130d
2 changed files with 82 additions and 15 deletions

View File

@ -98,27 +98,21 @@
case 'latlon':
var pos = new google.maps.LatLng(update.location.lat, update.location.lon);
var marker;
var markerClass = google.maps.Marker;
var iconOptions = {}
if (update.location.symbol) {
markerClass = AprsMarker;
iconOptions.symbol = update.location.symbol;
}
if (markers[update.callsign]) {
marker = markers[update.callsign];
} else {
marker = new google.maps.Marker();
marker = new markerClass();
marker.addListener('click', function(){
showMarkerInfoWindow(update.callsign, pos);
});
markers[update.callsign] = marker;
}
var iconOptions = {}
if (update.location.symbol) {
var index = update.location.symbol.index;
var tableId = update.location.symbol.table == '/' ? 0 : 1;
iconOptions.icon = {
url: '/aprs-symbols/aprs-symbols-24-' + tableId + '@2x.png',
size: new google.maps.Size(24, 24),
origin: new google.maps.Point((index % 16) * 24, Math.floor(index / 16) * 24),
anchor: new google.maps.Point(12, 12),
scaledSize: new google.maps.Size(384, 144),
};
}
marker.setOptions($.extend({
position: pos,
map: map,
@ -220,12 +214,14 @@
},
zoom: 5
});
processUpdates(updateQueue);
updateQueue = [];
$.getScript("/static/lib/nite-overlay.js").done(function(){
nite.init(map);
setInterval(function() { nite.refresh() }, 10000); // every 10s
});
$.getScript('/static/lib/AprsMarker.js').done(function(){
processUpdates(updateQueue);
updateQueue = [];
});
map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push($(".openwebrx-map-legend")[0]);
});
retention_time = config.map_position_retention_time * 1000;