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