mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
40 lines
727 B
JavaScript
40 lines
727 B
JavaScript
|
|
import { BaseLayer } from './base_layer'
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Tracks layer for saved routes
|
||
|
|
*/
|
||
|
|
export class TracksLayer extends BaseLayer {
|
||
|
|
constructor(map, options = {}) {
|
||
|
|
super(map, { id: 'tracks', ...options })
|
||
|
|
}
|
||
|
|
|
||
|
|
getSourceConfig() {
|
||
|
|
return {
|
||
|
|
type: 'geojson',
|
||
|
|
data: this.data || {
|
||
|
|
type: 'FeatureCollection',
|
||
|
|
features: []
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
getLayerConfigs() {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
id: this.id,
|
||
|
|
type: 'line',
|
||
|
|
source: this.sourceId,
|
||
|
|
layout: {
|
||
|
|
'line-join': 'round',
|
||
|
|
'line-cap': 'round'
|
||
|
|
},
|
||
|
|
paint: {
|
||
|
|
'line-color': ['get', 'color'],
|
||
|
|
'line-width': 4,
|
||
|
|
'line-opacity': 0.7
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
}
|