From c8ecb75cf0be94c1ba8acae20260bc3d26dc88c2 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 3 Mar 2020 14:51:34 +0100 Subject: [PATCH] altitude Lines plus draw gradient --- html/planeObject.js | 10 ++++++---- html/script.js | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index 6e8f7a5..b4526d0 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -1363,7 +1363,7 @@ PlaneObject.prototype.updateMarker = function(moved) { // return the styling of the lines based on altitude -PlaneObject.prototype.altitudeLines = function(segment) { +function altitudeLines (segment) { var colorArr = altitudeColor(segment.altitude); if (segment.estimated) colorArr = [colorArr[0], colorArr[1], colorArr[2] * 0.7]; @@ -1386,6 +1386,8 @@ PlaneObject.prototype.altitudeLines = function(segment) { stroke: new ol.style.Stroke({ color: color, width: (2-(noVanish*0.8)) * newWidth * estimatedMult, + lineJoin: 'miter', + lineCap: 'square', }) }); } else { @@ -1433,7 +1435,7 @@ PlaneObject.prototype.updateLines = function() { if (filterTracks && this.altFiltered(lastseg.altitude)) { this.elastic_feature.setStyle(nullStyle); } else { - this.elastic_feature.setStyle(this.altitudeLines(lastseg)); + this.elastic_feature.setStyle(altitudeLines(lastseg)); } // elastic feature is always at index 0 for each aircraft @@ -1446,11 +1448,11 @@ PlaneObject.prototype.updateLines = function() { if (seg.feature && (!trackLabels || seg.label)) break; - if ((filterTracks && this.altFiltered(seg.altitude)) || this.altitudeLines(seg) == nullStyle) { + if ((filterTracks && this.altFiltered(seg.altitude)) || altitudeLines(seg) == nullStyle) { seg.feature = true; } else if (!seg.feature) { seg.feature = new ol.Feature(seg.fixed); - seg.feature.setStyle(this.altitudeLines(seg)); + seg.feature.setStyle(altitudeLines(seg)); seg.feature.hex = this.icao; this.trail_features.push(seg.feature); } diff --git a/html/script.js b/html/script.js index 4315bfe..a941b01 100644 --- a/html/script.js +++ b/html/script.js @@ -1108,6 +1108,8 @@ function parse_history() { loadFinished = true; + //drawAlt(); + if (localStorage['sidebar_visible'] == "false") toggleSidebarVisibility(); @@ -3900,3 +3902,15 @@ function initSitePos() { document.getElementById("distance").style.display = 'none'; // hide distance header } } + +function drawAlt() { + processAircraft({hex: 'c0ffee', }); + var plane = Planes['c0ffee']; + newWidth = 4; + for (var i = 0; i <= 50000; i += 500) { + plane.position = [i/10000, 0]; + plane.altitude = i; + plane.alt_rounded = calcAltitudeRounded(plane.altitude); + plane.updateTrack(now - i, now - i - 5000, { serverTrack: true }); + } +}