Skip to content

Commit 1058a5b

Browse files
committed
ui 2
1 parent 34bf2b8 commit 1058a5b

9 files changed

Lines changed: 2738 additions & 34 deletions

File tree

cachebust.list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
images/sprites.png
2+
ui2.js
3+
ui2.css
24
dbloader.js
35
defaults.js
46
early.js

html/early.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,8 @@ Toggle.prototype.toggle = function(override, init) {
800800
}
801801
}
802802

803+
TAR && TAR.newUI && TAR.newUI.active && TAR.newUI.syncToggle(this.key, this.state);
804+
803805
if (!init)
804806
loStore[this.key] = this.state;
805807
}

html/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<link rel="stylesheet" href="libs/ol-8.2.0.css" type="text/css" />
1717
<link rel="stylesheet" href="libs/ol-layerswitcher-4.1.1.css" type="text/css"/>
1818
<link rel="stylesheet" href="style.css" type="text/css" />
19+
<link rel="stylesheet" href="ui2.css" type="text/css" />
1920

2021
<link rel="icon" type="image/png" href="images/tar1090-favicon.png">
2122

@@ -1089,6 +1090,7 @@ <h2>Improve Coverage:<br><a class="largeText" target="_blank" href="https://airp
10891090
<script src="layers.js"></script>
10901091
<script src="geomag2020.js"></script>
10911092
<script src="markers.js"></script>
1093+
<script src="ui2.js"></script>
10921094

10931095
<!-- JS_ANCHOR3 -->
10941096
<script>let spriteSrc = 'images/sprites.png';</script>

html/markers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,7 @@ function iconTest() {
14131413
jQuery('#splitter').hide();
14141414
jQuery('#tabs').hide();
14151415
jQuery('#filterButton').hide();
1416+
jQuery('.ui2-chrome').hide();
14161417
jQuery('.ol-control').hide();
14171418
jQuery('.ol-attribution').show();
14181419
jQuery("#loader").addClass("hidden");

html/planeObject.js

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,14 @@ PlaneObject.prototype.getMarkerColor = function(options) {
734734
l += ColorByAlt.mlat.l;
735735
}
736736

737-
if (atcStyle && (this.squawk == '7700' || this.squawk == '7600' || this.squawk == '7500')) {
738-
h = 0;
739-
s = 100;
740-
l = 40;
737+
if (atcStyle) {
738+
h = 120; s = 90; l = 50;
739+
if (this.selected && !SelectedAllPlanes && !onlySelected) {
740+
s = 5; l = 95;
741+
}
742+
if (this.squawk == '7700' || this.squawk == '7600' || this.squawk == '7500') {
743+
h = 0; s = 100; l = 45;
744+
}
741745
}
742746

743747
if (h < 0) {
@@ -875,18 +879,31 @@ PlaneObject.prototype.updateIcon = function() {
875879

876880
labelText = "";
877881
if (atcStyle) {
878-
labelText += callsign + '\n';
879-
labelText += altString + '\n';
880-
labelText += 'x' + this.squawk;
881-
if (this.squawk == '7700' || this.squawk == '7600' || this.squawk == '7500') {
882-
if (this.squawk == '7700') {
883-
labelText += '\nEMERGENCY';
884-
} else if (this.squawk == '7600') {
885-
labelText += '\nNORDO';
886-
} else if (this.squawk == '7500') {
887-
labelText += '\nHIJACK';
888-
}
889-
}
882+
let acid = (this.flight && this.flight.trim()) ? this.flight.trim()
883+
: (this.registration ? this.registration : this.icao.toUpperCase());
884+
let altText;
885+
if (alt === 'ground')
886+
altText = 'GND';
887+
else if (alt == null)
888+
altText = '???';
889+
else
890+
altText = Math.max(0, Math.round(alt / 100)).toString().padStart(3, '0');
891+
let trend = NBSP;
892+
if (this.vert_rate > 245)
893+
trend = UP_TRIANGLE;
894+
else if (this.vert_rate < -245)
895+
trend = DOWN_TRIANGLE;
896+
let spdText = (this.speed == null) ? '??' : Math.round(this.speed / 10).toString().padStart(2, '0');
897+
labelText += acid + '\n';
898+
labelText += altText + trend + NBSP + spdText;
899+
if (this.icaoType)
900+
labelText += '\n' + this.icaoType;
901+
if (this.squawk == '7700')
902+
labelText += '\nEM';
903+
else if (this.squawk == '7600')
904+
labelText += '\nRF';
905+
else if (this.squawk == '7500')
906+
labelText += '\nHJ';
890907
} else if (g.extendedLabels == 3) {
891908
if (!windLabelsSlim) {
892909
labelText += 'Wind' + NBSP;
@@ -968,12 +985,15 @@ PlaneObject.prototype.updateIcon = function() {
968985
if (this.styleKey != styleKey || !this.marker.getStyle()) {
969986
this.styleKey = styleKey;
970987
let style;
988+
let fill = labelFill;
989+
if (atcStyle && (this.squawk == '7700' || this.squawk == '7600' || this.squawk == '7500'))
990+
fill = labelFillEmerg;
971991
if (labelText) {
972992
style = {
973993
image: this.markerIcon,
974994
text: new ol.style.Text({
975995
text: labelText,
976-
fill: labelFill,
996+
fill: fill,
977997
backgroundFill: bgFill,
978998
stroke: labelStrokeNarrow,
979999
textAlign: 'left',
@@ -1322,7 +1342,7 @@ PlaneObject.prototype.processTrace = function() {
13221342

13231343
showTraceExit = false;
13241344

1325-
this.checkForDB(this.recentTrace || this.fullTrace);
1345+
this.checkForDB(this.recentTrace || this.fullTrace, true);
13261346

13271347
this.dataChanged();
13281348

@@ -1799,6 +1819,9 @@ function altitudeLines (segment) {
17991819

18001820
let color = hslToRgb(colorArr);
18011821

1822+
if (atcStyle)
1823+
color = '#0B7A0B';
1824+
18021825
if (monochromeTracks)
18031826
color = monochromeTracks;
18041827

@@ -2779,7 +2802,7 @@ PlaneObject.prototype.setTypeData = function() {
27792802
this.typeDescription = `${desc}`;
27802803
if (wtc != null)
27812804
this.wtc = `${wtc}`;
2782-
if (this.typeLong == null && typeLong != null)
2805+
if (typeLong != null)
27832806
this.typeLong = `${typeLong}`;
27842807
};
27852808

@@ -2799,19 +2822,23 @@ PlaneObject.prototype.setTypeFlagsReg = function(data) {
27992822
if (data.r) this.registration = `${data.r}`;
28002823
}
28012824

2802-
PlaneObject.prototype.checkForDB = function(data) {
2825+
PlaneObject.prototype.checkForDB = function(data, fromTrace) {
28032826
if (!this.dbinfoLoaded && this.icao >= 'ae6620' && this.icao <= 'ae6899') {
28042827
this.icaoType = 'P8 ?';
28052828
this.setTypeData();
28062829
}
28072830
if (data) {
28082831

2809-
if (data.desc) this.typeLong = `${data.desc}`;
2810-
if (data.ownOp) this.ownOp = `${data.ownOp}`;
2811-
if (data.year) this.year = `${data.year}`;
2812-
2832+
// Resolve the ICAO type first so typeLong is populated from the type
2833+
// database (keyed by the live API type code) before the trace's fields.
28132834
this.setTypeFlagsReg(data);
28142835

2836+
// Live API data takes priority over the trace file: trace data may only
2837+
// fill in db fields that aren't already populated.
2838+
if (data.desc && !(fromTrace && this.typeLong)) this.typeLong = `${data.desc}`;
2839+
if (data.ownOp && !(fromTrace && this.ownOp)) this.ownOp = `${data.ownOp}`;
2840+
if (data.year && !(fromTrace && this.year)) this.year = `${data.year}`;
2841+
28152842
if (data.r || data.t) {
28162843
this.dbinfoLoaded = true;
28172844
}

html/script.js

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ let newWidth = lineWidth;
104104
let SiteOverride = (SiteLat != null && SiteLon != null);
105105
let onJumpInput = null;
106106
let labelFill = null;
107+
let labelFillEmerg = null;
107108
let blackFill = null;
108109
let labelStroke = null;
109110
let labelStrokeNarrow = null;
@@ -773,6 +774,8 @@ function initialize() {
773774

774775
processQueryToggles();
775776

777+
TAR.newUI && TAR.newUI.init();
778+
776779
jQuery.when(historyQueued).done(push_history);
777780

778781
if (!nHistoryItems) {
@@ -935,9 +938,10 @@ function earlyInitPage() {
935938
tempTrailsTimeout = 45;
936939
SiteCirclesDistances = new Array(5, 10, 20);
937940
SiteCirclesLineDash = [5, 5];
938-
SiteCirclesColors = ['#2b3436', '#2b3436', '#2b3436'];
939-
MapType_tar1090 = 'carto_light_all';
940-
lineWidth=4;
941+
SiteCirclesColors = ['#446666', '#446666', '#446666'];
942+
MapType_tar1090 = 'carto_dark_nolabels';
943+
lineWidth=2;
944+
labelFamily = "'Consolas', 'Menlo', 'Lucida Console', monospace";
941945
g.enableLabels=true;
942946
}
943947

@@ -2645,6 +2649,7 @@ function ol_map_init() {
26452649
});
26462650

26472651
OLMap.on(['click', 'dblclick'], function(evt) {
2652+
if (TAR.newUI && TAR.newUI.measureActive) return;
26482653
let trailHex = null;
26492654
let trailTS = null;
26502655
let planeHex = null;
@@ -2794,6 +2799,7 @@ function showHideButtons() {
27942799
jQuery('#filterButton').hide();
27952800
jQuery('.ol-zoom').hide();
27962801
jQuery('.layer-switcher').hide();
2802+
jQuery('.ui2-chrome').hide();
27972803
} else {
27982804
jQuery('#header_top').show();
27992805
jQuery('#header_side').show();
@@ -2802,6 +2808,7 @@ function showHideButtons() {
28022808
jQuery('#filterButton').show();
28032809
jQuery('.ol-zoom').show();
28042810
jQuery('.layer-switcher').show();
2811+
jQuery('.ui2-chrome').show();
28052812
}
28062813
}
28072814

@@ -3209,6 +3216,12 @@ function initMap() {
32093216
loStore['noMLAT'] = noMLAT;
32103217
console.log('noMLAT = ' + noMLAT);
32113218
break;
3219+
case "/":
3220+
if (TAR.newUI && TAR.newUI.active) {
3221+
TAR.newUI.focusSearch();
3222+
e.preventDefault();
3223+
}
3224+
break;
32123225
}
32133226
}, true);
32143227

@@ -4968,6 +4981,7 @@ function buttonActive(id, state) {
49684981
jQuery(id).addClass('inActiveButton');
49694982
jQuery(id).removeClass('activeButton');
49704983
}
4984+
TAR.newUI && TAR.newUI.active && TAR.newUI.syncButton(id, state);
49714985
}
49724986

49734987
function toggleIsolation(state, noRefresh) {
@@ -5095,7 +5109,7 @@ function invertMap(evt){
50955109
}
50965110

50975111
altitudeChart.render = function () {
5098-
if (toggles['altitudeChart'].state) {
5112+
if (toggles['altitudeChart'].state && !atcStyle) {
50995113
runAfterLoad(loadLegend);
51005114
} else {
51015115
jQuery('#altitude_chart').hide();
@@ -6446,6 +6460,11 @@ function updateAddressBar() {
64466460
string += ':' + replay.ts.getUTCMinutes().toString().padStart(2,'0');
64476461
}
64486462

6463+
for (const mode of ['atcStyle', 'uk_advisory']) {
6464+
if (usp.has(mode))
6465+
string += (string ? '&' : '?') + mode;
6466+
}
6467+
64496468
if (SelPlanes.length > 0) {
64506469
string += (string ? '&' : '?');
64516470
string += 'icao=' + SelPlanes.map((s) => encodeURIComponent(s.icao)).join(',')
@@ -6926,11 +6945,12 @@ function setLineWidth() {
69266945
}),
69276946
});
69286947

6929-
labelFill = new ol.style.Fill({color: 'white' });
6948+
labelFill = new ol.style.Fill({color: atcStyle ? '#00FF00' : 'white' });
6949+
labelFillEmerg = new ol.style.Fill({color: '#FF3333' });
69306950
blackFill = new ol.style.Fill({color: 'black' });
69316951
labelStroke = new ol.style.Stroke({color: 'rgba(0,0,0,0.7', width: 4 * globalScale});
69326952
labelStrokeNarrow = new ol.style.Stroke({color: 'rgba(0,0,0,0.7', width: 2.5 * globalScale});
6933-
bgFill = new ol.style.Stroke({color: 'rgba(0,0,0,0.25'});
6953+
bgFill = new ol.style.Stroke({color: atcStyle ? 'rgba(0,0,0,0)' : 'rgba(0,0,0,0.25'});
69346954
}
69356955
let lastCallLocationChange = 0;
69366956
function onLocationChange(position) {
@@ -8065,10 +8085,11 @@ function initReplay(chunk, data) {
80658085
}
80668086

80678087
function setReplayTimeHint(date) {
8088+
jQuery('#replayTimeZone').html('');
80688089
if (true || utcTimesHistoric) {
8069-
jQuery("#replayDateHintLocal").html(TIMEZONE + " Date: " + lDateString(date));
8070-
jQuery("#replayDateHint").html("" + zDateString(date));
8071-
jQuery("#replayTimeHint").html("UTC:" + NBSP + zuluTime(date) + ' / ' + TIMEZONE + ":" + NBSP + localTime(date));
8090+
jQuery("#replayDateHint").html("UTC: " + zDateString(date) + '<br/>' + TIMEZONE + ": " + lDateString(date));
8091+
//jQuery("#replayDateHintLocal").html(TIMEZONE + " Date: " + lDateString(date));
8092+
jQuery("#replayTimeHint").html("UTC:" + NBSP + zuluTime(date) + '<br/>' + TIMEZONE + ":" + NBSP + localTime(date));
80728093
} else {
80738094
jQuery("#replayDateHintLocal").html("");
80748095
jQuery("#replayDateHint").html("Date: " + lDateString(date));

0 commit comments

Comments
 (0)