-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
32 lines (23 loc) · 1.02 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { isZoned } from './src/helper';
import { map, addSourceToMap, updateSourceMap, SOURCE_MAP_ID } from './src/mapbox';
import { addLayersToMap } from './src/layer';
import drawApplication from './src/draw';
import applicationMap from './src/applicationMap';
import './style.css';
const getFeaturesWithId = (features) => features.filter(({ properties }) => properties.id);
let filteredFeatures = [];
map.on('load', function () {
// Force resize the make the map fullscreen
window.dispatchEvent(new Event('resize'));
addSourceToMap();
addLayersToMap();
const { mode, featureCollection: { features } } = applicationMap;
// The only features that are needed are the ones who has an ID in its properties
filteredFeatures = getFeaturesWithId(features);
drawApplication(filteredFeatures, mode, applicationMap);
});
document.querySelectorAll('input[type=radio]').forEach(radio => {
radio.addEventListener('change', function ({ target }) {
drawApplication(filteredFeatures, target.value, applicationMap);
});
});