Livebeat is now able to send, store and show beats

This commit is contained in:
2020-10-23 00:39:36 +02:00
parent f722ee9595
commit 13f8437f29
52 changed files with 1948 additions and 442 deletions

View File

@@ -0,0 +1,32 @@
import { AfterViewInit, Component, OnInit } from '@angular/core';
import { Map } from 'mapbox-gl';
import { APIService } from '../api.service';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements AfterViewInit {
map: Map;
data: GeoJSON.FeatureCollection<GeoJSON.LineString> = {
type: 'FeatureCollection', features: [
{
type: 'Feature',
properties: null,
geometry: { type: 'LineString', coordinates: [] }
}]
};
constructor(private api: APIService) { }
async ngAfterViewInit(): Promise<void> {
const beats = await this.api.getBeats();
beats.forEach((beat) => {
this.data.features[0].geometry.coordinates.push([beat.coordinate[1], beat.coordinate[0]]);
});
console.log("Now:", this.data.features);
}
}