FEATURE: Add ability to show marker labels by default.
[wrfxweb.git] / fdds / js / simVars.js
blob053472e96df2d2ff3ceaf72683cd2bdbf24b8015
1 export const simVars = (function createSimVars() {
2 const urlParams = new URLSearchParams(window.location.search);
4 let presetVars = ({
5 zoom: urlParams.get('zoom'),
6 pan: urlParams.get('pan'),
7 jobId: urlParams.get('job_id'),
8 domain: urlParams.get('domain'),
9 timestamp: urlParams.get('timestamp'),
10 rasters: null,
11 startDate: urlParams.get('startDate'),
12 endDate: urlParams.get('endDate'),
13 opacity: urlParams.get('opacity'),
14 });
16 let pan = urlParams.get('pan');
17 if (pan) {
18 pan = pan.split(',').map(coord => Number(coord));
19 presetVars.pan = pan;
22 let rasters = urlParams.get('rasters');
23 if (rasters) {
24 rasters = rasters.split(',');
25 presetVars.rasters = rasters;
28 let simVars = ({
29 currentSimulation: '',
30 currentDescription: '',
31 rasters: [],
32 rasterBase: '',
33 sortedTimestamps: [],
34 noLevels: (function makeNoLevels() {
35 const noLevels = new Set();
36 const makeKey = (layerName, domain, timestamp) => {
37 return layerName + ',' + domain + ',' + timestamp;
39 const addNoLevels = (layerName, domain, timestamp) => {
40 let key = makeKey(layerName, domain, timestamp);
41 noLevels.add(key);
43 const hasNoLevels = (layerName, domain, timestamp) => {
44 let key = makeKey(layerName, domain, timestamp);
45 return noLevels.has(key);
48 return ({
49 add: addNoLevels,
50 has: hasNoLevels,
51 clear: () => noLevels.clear()
52 });
53 })(),
54 overlayOrder: [],
55 startTime: null,
56 endTime: null,
57 displayedColorbar: null,
58 showMarkers: true,
59 organization: 'WIRC',
60 overlayList: ['WINDVEC', 'WINDVEC1000FT', 'WINDVEC4000FT', 'WINDVEC6000FT', 'SMOKE1000FT', 'SMOKE4000FT', 'SMOKE6000FT', 'FIRE_AREA', 'SMOKE_INT', 'FGRNHFX', 'FLINEINT'],
61 baseLayerDict: {
63 'MapQuest': L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
64 attribution: 'Data and imagery by MapQuest',
65 subdomains: ['otile1', 'otile2', 'otile3', 'otile4']}),
67 'MapQuest' : MQ.mapLayer(),
68 /* 'MQ Satellite': L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
69 attribution: 'Data and imagery by MapQuest',
70 subdomains: ['otile1', 'otile2', 'otile3', 'otile4']}),*/
71 'OSM': L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
72 attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'})
74 presets: presetVars,
75 clientWidth: document.body.clientWidth,
76 generateTimeSeriesCallback: () => {},
77 cancelTimeSeriesCallback: () => {},
78 });
80 return simVars;
81 })();