Skip to content

Commit

Permalink
Updates from:
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanem committed Jan 30, 2025
1 parent f1f690f commit b10bbe1
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 47 deletions.
12 changes: 12 additions & 0 deletions web_root-Tar1090/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ function createBaseLayers() {
}));
}

if (0) {
let stylefunction = ol.stylefunction;
let openfreemap = new ol.layer.VectorTile({
type: 'base',
name: 'openfreemap',
title: 'openfreemap',
});
// ol-mapbox-style plugin packed in with ol ... (kinda ugly)
ol.applyStyle(openfreemap, "https://tiles.openfreemap.org/styles/liberty");
world.push(openfreemap);
}

world.push(new ol.layer.Tile({
source: new ol.source.OSM({
maxZoom: 17,
Expand Down
12 changes: 10 additions & 2 deletions web_root-Tar1090/planeObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,11 @@ PlaneObject.prototype.updateIcon = function() {
if (useRouteAPI && this.routeString)
callsign += ' - ' + this.routeString;

if (!extendedLabels && this.type == "ais") {
// show registration instead for ships as callsign is less useful
callsign = this.registration;
}

const unknown = NBSP+NBSP+"?"+NBSP+NBSP;

let alt;
Expand Down Expand Up @@ -1984,7 +1989,10 @@ PlaneObject.prototype.updateLines = function() {
const date = new Date(seg.ts * 1000);
let refDate = showTrace ? traceDate : new Date();
if (replay) { refDate = replay.ts };
if (getDay(refDate) == getDay(date)) {
if (useLocal && historic) {
timestamp1 = lDateString(date);
timestamp1 += '\n';
} else if (getDay(refDate) == getDay(date)) {
timestamp1 = "";
} else {
if (useLocal) {
Expand All @@ -2001,7 +2009,7 @@ PlaneObject.prototype.updateLines = function() {
timestamp2 += zuluTime(date);
}

if (traces_high_res) {
if (traces_high_res || debugTracks) {
timestamp2 += '.' + (Math.floor((seg.ts*10)) % 10);
}

Expand Down
95 changes: 50 additions & 45 deletions web_root-Tar1090/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ let userScale = 1;
let iconScale = 1;
let labelScale = 1;
let newWidth = lineWidth;
let SiteOverride = false;
let SiteOverride = (SiteLat != null && SiteLon != null);
let onJumpInput = null;
let labelFill = null;
let blackFill = null;
Expand Down Expand Up @@ -148,7 +148,6 @@ const renderBuffer = 60;

let shareLink = '';


let CenterLat = 0;
let CenterLon = 0;
let zoomLvl = 5;
Expand Down Expand Up @@ -508,6 +507,7 @@ function afterFirstFetch() {
func();
}


geoMag = geoMagFactory(cof2Obj());

db_load_type_cache().always(function() {
Expand Down Expand Up @@ -712,13 +712,10 @@ function initialize() {
trace_hist_only = true;
if (receiverJson.json_trace_interval < 2)
traces_high_res = true;
if (receiverJson.lat != null) {
if (receiverJson.lat != null && !SiteOverride) {
//console.log("receiver.json lat: " + receiverJson.lat)
SiteLat = receiverJson.lat;
SiteLon = receiverJson.lon;
SitePosition = [SiteLon, SiteLat];
DefaultCenterLat = receiverJson.lat;
DefaultCenterLon = receiverJson.lon;
}
if (receiverJson.jaeroTimeout) {
jaeroTimeout = receiverJson.jaeroTimeout * 60;
Expand All @@ -730,6 +727,13 @@ function initialize() {
altitudeFilter = false;
}
}

if (SiteLat && SiteLon) {
SitePosition = [SiteLon, SiteLat];
DefaultCenterLat = SiteLat;
DefaultCenterLon = SiteLon;
}

configureReceiver = null;

// Initialize stuff
Expand Down Expand Up @@ -836,11 +840,9 @@ function initPage() {
let lat = parseFloat(usp.get('SiteLat'));
let lon = parseFloat(usp.get('SiteLon'));
if (!isNaN(lat) && !isNaN(lon)) {
if (true || usp.has('SiteNosave')) {
SiteLat = CenterLat = DefaultCenterLat = lat;
SiteLon = CenterLon = DefaultCenterLon = lon;
SiteOverride = true;
}
SiteLat = CenterLat = DefaultCenterLat = lat;
SiteLon = CenterLon = DefaultCenterLon = lon;
SiteOverride = true;
loStore['SiteLat'] = lat;
loStore['SiteLon'] = lon;
}
Expand Down Expand Up @@ -1710,12 +1712,8 @@ jQuery('#selected_altitude_geom1')


if (hideButtons) {
jQuery('#header_top').hide();
jQuery('#header_side').hide();
jQuery('#tabs').hide();
jQuery('#filterButton').hide();
jQuery('.ol-control').hide();
jQuery('.ol-attribution').show();
showHideButtons();
runAfterLoad(showHideButtons);
}
}

Expand Down Expand Up @@ -2054,14 +2052,17 @@ function setIntervalTimers() {
}

function updateDrones() {
let req = jQuery.ajax({
url: droneJson,
dataType: 'json',
});
let jsons = Array.isArray(droneJson) ? droneJson : [ droneJson ];
for (let i in jsons) {
let req = jQuery.ajax({
url: jsons[i],
dataType: 'json',
});

req.done(function(data) {
handleDrones(data);
});
req.done(function(data) {
handleDrones(data);
});
}
}

function handleDrones(data) {
Expand All @@ -2084,7 +2085,7 @@ function processDrone(drone, now, last) {
plane = new PlaneObject(hex);
}

let ac = {};
let ac = drone;

ac.type = 'other';
ac.t = 'DRON';
Expand Down Expand Up @@ -2640,6 +2641,25 @@ function initMapEarly() {
});
}

function showHideButtons() {
if (hideButtons) {
jQuery('#header_top').hide();
jQuery('#header_side').hide();
jQuery('#splitter').hide();
jQuery('#tabs').hide();
jQuery('#filterButton').hide();
jQuery('.ol-zoom').hide();
jQuery('.layer-switcher').hide();
} else {
jQuery('#header_top').show();
jQuery('#header_side').show();
jQuery('#splitter').show();
jQuery('#tabs').show();
jQuery('#filterButton').show();
jQuery('.ol-zoom').show();
jQuery('.layer-switcher').show();
}
}

// Initalizes the map and starts up our timers to call various functions
function initMap() {
Expand Down Expand Up @@ -2964,26 +2984,8 @@ function initMap() {
resetMap();
break;
case "H":
if (!hideButtons) {
jQuery('#header_top').hide();
jQuery('#header_side').hide();
jQuery('#splitter').hide();
jQuery('#tabs').hide();
jQuery('#filterButton').hide();
jQuery('.ol-control').hide();
jQuery('.ol-attribution').show();
} else {
jQuery('#header_top').show();
jQuery('#header_side').show();
jQuery('#splitter').show();
jQuery('#tabs').show();
jQuery('#filterButton').show();
jQuery('.ol-control').show();
jQuery('#expand_sidebar_control').hide();
toggles['sidebar_visible'].restore();
TAR.altitudeChart.render();
}
hideButtons = !hideButtons;
showHideButtons();
break;
case "f":
toggleFollow();
Expand Down Expand Up @@ -6661,6 +6663,9 @@ function setLineWidth() {
}
let lastCallLocationChange = 0;
function onLocationChange(position) {
if (SiteOverride) {
return;
}
lastCallLocationChange = new Date().getTime();
changeCenter();
const moveMap = (Math.abs(SiteLat - CenterLat) < 0.000001 && Math.abs(SiteLon - CenterLon) < 0.000001);
Expand Down Expand Up @@ -6829,7 +6834,7 @@ function initSitePos() {
if (SitePosition) {
TAR.planeMan.cols.sitedist.sort();
} else {
planeMan.sortAscending = false;
TAR.planeMan.sortAscending = false;
TAR.planeMan.cols.altitude.sort();
}
}
Expand Down
6 changes: 6 additions & 0 deletions web_root-Tar1090/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ select {
background-color: var(--ACCENT);
color: #FFFFFF;
cursor: pointer;
position: sticky;
top: 0;
z-index: 10;
box-shadow:
0 -2px 2px -1px rgba(0, 0, 0, 0.5),
0 2px 2px -1px rgba(0, 0, 0, 0.7);
}
.aircraft_table_header td {
font-size: smaller;
Expand Down

0 comments on commit b10bbe1

Please sign in to comment.