From 6b699bffc385f2368dd921605e6ad4738ab1ac5b Mon Sep 17 00:00:00 2001 From: James Wilson Date: Thu, 26 Jan 2017 11:19:10 -0600 Subject: [PATCH] Change the track for each altitude change to correctly color it based on altitude --- public_html/planeObject.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public_html/planeObject.js b/public_html/planeObject.js index 99fb3fa..0d51d51 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -138,6 +138,7 @@ PlaneObject.prototype.updateTrack = function(estimate_time) { this.track_linesegs.push({ fixed: new ol.geom.LineString([projPrev, projHere]), feature: null, head_update: this.last_position_time, + altitude: 0, estimated: true }); this.history_size += 2; } else { @@ -158,14 +159,15 @@ PlaneObject.prototype.updateTrack = function(estimate_time) { head_update: this.last_position_time, tail_update: this.last_position_time, estimated: false, - ground: (this.altitude === "ground") }; + ground: (this.altitude === "ground"), + altitude: this.altitude }; this.track_linesegs.push(lastseg); this.history_size ++; // continue } if ( (lastseg.ground && this.altitude !== "ground") || - (!lastseg.ground && this.altitude === "ground") ) { + (!lastseg.ground && this.altitude === "ground") || this.altitude !== lastseg.altitude ) { //console.log(this.icao + " ground state changed"); // Create a new segment as the ground state changed. // assume the state changed halfway between the two points @@ -584,7 +586,7 @@ PlaneObject.prototype.updateLines = function() { var lastfixed = lastseg.fixed.getCoordinateAt(1.0); var geom = new ol.geom.LineString([lastfixed, ol.proj.fromLonLat(this.position)]); this.elastic_feature = new ol.Feature(geom); - this.elastic_feature.setStyle(this.altitudeLines(this.altitude)); + this.elastic_feature.setStyle(this.altitudeLines(lastseg.altitude)); if (oldElastic < 0) { PlaneTrailFeatures.push(this.elastic_feature);