Change the track for each altitude change to correctly color it based on altitude

This commit is contained in:
James Wilson 2017-01-26 11:19:10 -06:00
parent 6d4300848f
commit 6b699bffc3

View file

@ -138,6 +138,7 @@ PlaneObject.prototype.updateTrack = function(estimate_time) {
this.track_linesegs.push({ fixed: new ol.geom.LineString([projPrev, projHere]), this.track_linesegs.push({ fixed: new ol.geom.LineString([projPrev, projHere]),
feature: null, feature: null,
head_update: this.last_position_time, head_update: this.last_position_time,
altitude: 0,
estimated: true }); estimated: true });
this.history_size += 2; this.history_size += 2;
} else { } else {
@ -158,14 +159,15 @@ PlaneObject.prototype.updateTrack = function(estimate_time) {
head_update: this.last_position_time, head_update: this.last_position_time,
tail_update: this.last_position_time, tail_update: this.last_position_time,
estimated: false, estimated: false,
ground: (this.altitude === "ground") }; ground: (this.altitude === "ground"),
altitude: this.altitude };
this.track_linesegs.push(lastseg); this.track_linesegs.push(lastseg);
this.history_size ++; this.history_size ++;
// continue // continue
} }
if ( (lastseg.ground && this.altitude !== "ground") || 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"); //console.log(this.icao + " ground state changed");
// Create a new segment as the ground state changed. // Create a new segment as the ground state changed.
// assume the state changed halfway between the two points // 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 lastfixed = lastseg.fixed.getCoordinateAt(1.0);
var geom = new ol.geom.LineString([lastfixed, ol.proj.fromLonLat(this.position)]); var geom = new ol.geom.LineString([lastfixed, ol.proj.fromLonLat(this.position)]);
this.elastic_feature = new ol.Feature(geom); 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) { if (oldElastic < 0) {
PlaneTrailFeatures.push(this.elastic_feature); PlaneTrailFeatures.push(this.elastic_feature);