interpolation fix
This commit is contained in:
parent
aac5b0e77c
commit
69f41be576
@ -389,6 +389,9 @@ export default abstract class LeafletMap {
|
||||
const poly = this.polylines.get(name);
|
||||
if (poly) {
|
||||
this.map.removeLayer(poly.leafletPoly);
|
||||
if (poly.polylineDecorator) {
|
||||
this.map.removeLayer(poly.polylineDecorator);
|
||||
}
|
||||
this.polylines.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,6 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
|
||||
historicalData: FormattedData[][];
|
||||
normalizationStep: number;
|
||||
interpolatedTimeData = [];
|
||||
intervals = [];
|
||||
widgetConfig: WidgetConfig;
|
||||
settings;
|
||||
mainTooltip = '';
|
||||
@ -104,9 +103,10 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
|
||||
if (subscription) subscription.callbacks.onDataUpdated = () => {
|
||||
this.historicalData = parseArray(this.ctx.data).filter(arr => arr.length);
|
||||
if (this.historicalData.length) {
|
||||
if (!this.activeTrip)
|
||||
this.activeTrip = this.historicalData[0][0];
|
||||
this.calculateIntervals();
|
||||
this.timeUpdated(this.minTime);
|
||||
this.timeUpdated(this.currentTime ? this.currentTime : this.minTime);
|
||||
}
|
||||
this.mapWidget.map.map?.invalidateSize();
|
||||
this.cd.detectChanges();
|
||||
@ -122,12 +122,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
|
||||
this.currentTime = time;
|
||||
const currentPosition = this.interpolatedTimeData
|
||||
.map(dataSource => dataSource[time])
|
||||
.filter(ds => ds)
|
||||
.map(ds => {
|
||||
ds.minTime = this.minTimeFormat;
|
||||
ds.maxTime = this.maxTimeFormat;
|
||||
return ds;
|
||||
});
|
||||
.filter(ds => ds);
|
||||
if (isUndefined(currentPosition[0])) {
|
||||
const timePoints = Object.keys(this.interpolatedTimeData[0]).map(item => parseInt(item, 10));
|
||||
for (let i = 1; i < timePoints.length; i++) {
|
||||
@ -138,6 +133,8 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
|
||||
currentPosition[0] = {
|
||||
...beforePosition,
|
||||
time,
|
||||
minTime: this.minTimeFormat,
|
||||
maxTime: this.maxTimeFormat,
|
||||
...interpolateOnLineSegment(beforePosition, afterPosition, this.settings.latKeyName, this.settings.lngKeyName, ratio)
|
||||
}
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user