@record-evolution/widget-mapbox 1.4.11 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/widget-mapbox.d.ts +5 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-mapbox.js +229 -197
- package/dist/widget-mapbox.js.map +1 -1
- package/package.json +5 -3
- package/src/default-data.json +384 -383
- package/src/definition-schema.d.ts +254 -0
- package/src/definition-schema.json +134 -5
- package/src/widget-mapbox.ts +539 -498
- package/dist/src/types.d.ts +0 -28
- package/src/types.ts +0 -33
package/dist/widget-mapbox.js
CHANGED
|
@@ -2092,25 +2092,23 @@ function validateWCAG2Parms(parms) {
|
|
|
2092
2092
|
class WidgetMapbox extends s$1 {
|
|
2093
2093
|
constructor() {
|
|
2094
2094
|
super();
|
|
2095
|
-
this.inputData = undefined;
|
|
2096
2095
|
this.map = undefined;
|
|
2097
2096
|
this.dataSets = [];
|
|
2098
2097
|
this.dataSources = new Map();
|
|
2099
2098
|
this.colors = new Map();
|
|
2100
|
-
this.version = '1.4.
|
|
2099
|
+
this.version = '1.4.13';
|
|
2101
2100
|
this.resizeObserver = new ResizeObserver(() => {
|
|
2102
2101
|
var _a;
|
|
2103
2102
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.resize();
|
|
2104
2103
|
this.fitBounds();
|
|
2105
2104
|
});
|
|
2106
|
-
mapboxgl.accessToken =
|
|
2105
|
+
mapboxgl.accessToken =
|
|
2106
|
+
'pk.eyJ1IjoibWFya29wZSIsImEiOiJjazc1OWlsNjkwN2pyM2VxajV1eGRnYzgwIn0.3lVksk1nej_0KnWjCkBDAA';
|
|
2107
2107
|
}
|
|
2108
2108
|
update(changedProperties) {
|
|
2109
|
-
changedProperties.
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
}
|
|
2113
|
-
});
|
|
2109
|
+
if (changedProperties.has('inputData')) {
|
|
2110
|
+
this.transformInputData();
|
|
2111
|
+
}
|
|
2114
2112
|
super.update(changedProperties);
|
|
2115
2113
|
}
|
|
2116
2114
|
firstUpdated() {
|
|
@@ -2122,7 +2120,7 @@ class WidgetMapbox extends s$1 {
|
|
|
2122
2120
|
fitBounds() {
|
|
2123
2121
|
const bounds = new mapboxgl.LngLatBounds();
|
|
2124
2122
|
this.dataSources.forEach((col) => {
|
|
2125
|
-
col.features.forEach(f => {
|
|
2123
|
+
col.features.forEach((f) => {
|
|
2126
2124
|
var _a;
|
|
2127
2125
|
// @ts-ignore
|
|
2128
2126
|
if ((_a = f.geometry.coordinates) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -2130,7 +2128,7 @@ class WidgetMapbox extends s$1 {
|
|
|
2130
2128
|
});
|
|
2131
2129
|
});
|
|
2132
2130
|
if (!bounds.isEmpty()) {
|
|
2133
|
-
this.map.fitBounds(bounds, { maxZoom: 14, padding: 16, duration: 100
|
|
2131
|
+
this.map.fitBounds(bounds, { maxZoom: 14, padding: 16, duration: 100 });
|
|
2134
2132
|
}
|
|
2135
2133
|
}
|
|
2136
2134
|
transformInputData() {
|
|
@@ -2141,7 +2139,7 @@ class WidgetMapbox extends s$1 {
|
|
|
2141
2139
|
this.createMap();
|
|
2142
2140
|
}
|
|
2143
2141
|
// choose random color if dataseries has none and store it for furure updates
|
|
2144
|
-
this.inputData.dataseries.forEach(ds => {
|
|
2142
|
+
this.inputData.dataseries.forEach((ds) => {
|
|
2145
2143
|
var _a;
|
|
2146
2144
|
if (!this.colors.has(ds.label)) {
|
|
2147
2145
|
ds.color = (_a = ds.color) !== null && _a !== void 0 ? _a : tinycolor.random().toString();
|
|
@@ -2151,39 +2149,45 @@ class WidgetMapbox extends s$1 {
|
|
|
2151
2149
|
// console.log('The input data', this.inputData.dataseries[0], this.inputData.dataseries[1])
|
|
2152
2150
|
// Pivot inputData if required
|
|
2153
2151
|
this.dataSets = [];
|
|
2154
|
-
this.inputData.dataseries.forEach(ds => {
|
|
2155
|
-
var _a;
|
|
2152
|
+
this.inputData.dataseries.forEach((ds) => {
|
|
2153
|
+
var _a, _b;
|
|
2156
2154
|
const color = this.colors.get(ds.label);
|
|
2157
|
-
const distincts = [...new Set(ds.data.map((d) => d.pivot))];
|
|
2158
|
-
const derivedColors = tinycolor(color)
|
|
2155
|
+
const distincts = [...new Set((_a = ds.data) === null || _a === void 0 ? void 0 : _a.map((d) => d.pivot))];
|
|
2156
|
+
const derivedColors = tinycolor(color)
|
|
2157
|
+
.monochromatic(distincts.length)
|
|
2158
|
+
.map((c) => c.toHexString());
|
|
2159
2159
|
if (distincts.length > 1) {
|
|
2160
2160
|
distincts.forEach((piv, i) => {
|
|
2161
|
+
var _a, _b;
|
|
2161
2162
|
const pds = {
|
|
2162
|
-
label: `${ds.label
|
|
2163
|
+
label: `${piv}-${(_a = ds.label) !== null && _a !== void 0 ? _a : ''}`,
|
|
2163
2164
|
order: ds.order,
|
|
2164
2165
|
type: ds.type,
|
|
2165
2166
|
latestValues: ds.latestValues,
|
|
2166
2167
|
color: derivedColors[i],
|
|
2167
2168
|
config: ds.config,
|
|
2168
|
-
data: ds.data.filter(d => d.pivot === piv)
|
|
2169
|
+
data: (_b = ds.data) === null || _b === void 0 ? void 0 : _b.filter((d) => d.pivot === piv)
|
|
2169
2170
|
};
|
|
2170
2171
|
this.dataSets.push(pds);
|
|
2171
2172
|
});
|
|
2172
2173
|
}
|
|
2173
2174
|
else {
|
|
2174
|
-
ds.color = (
|
|
2175
|
+
ds.color = (_b = ds.color) !== null && _b !== void 0 ? _b : this.colors[ds.label];
|
|
2175
2176
|
this.dataSets.push(ds);
|
|
2176
2177
|
}
|
|
2177
2178
|
});
|
|
2178
2179
|
this.inputData.dataseries = [];
|
|
2179
2180
|
// Filter for latest Values
|
|
2180
|
-
this.dataSets.forEach(ds => {
|
|
2181
|
-
|
|
2182
|
-
|
|
2181
|
+
this.dataSets.forEach((ds) => {
|
|
2182
|
+
var _a;
|
|
2183
|
+
if ((ds === null || ds === void 0 ? void 0 : ds.latestValues) && (ds === null || ds === void 0 ? void 0 : ds.latestValues) > 0)
|
|
2184
|
+
ds.data = (_a = ds.data) === null || _a === void 0 ? void 0 : _a.splice(-ds.latestValues);
|
|
2183
2185
|
});
|
|
2184
2186
|
// console.log('mapbox datasets', this.dataSets)
|
|
2185
2187
|
// create geojson sources
|
|
2186
|
-
this.dataSets
|
|
2188
|
+
this.dataSets
|
|
2189
|
+
// .sort((a, b) => b.order - a.order)
|
|
2190
|
+
.forEach((ds) => {
|
|
2187
2191
|
this.dataSources.set('input:' + ds.label, {
|
|
2188
2192
|
type: 'FeatureCollection',
|
|
2189
2193
|
features: this.createGEOJson(ds)
|
|
@@ -2194,15 +2198,23 @@ class WidgetMapbox extends s$1 {
|
|
|
2194
2198
|
});
|
|
2195
2199
|
}
|
|
2196
2200
|
createGEOJson(ds) {
|
|
2201
|
+
var _a, _b, _c, _d, _e;
|
|
2202
|
+
(_a = ds.data) === null || _a === void 0 ? void 0 : _a.forEach((p) => {
|
|
2203
|
+
p = {
|
|
2204
|
+
lon: Number(p.lon),
|
|
2205
|
+
lat: Number(p.lat),
|
|
2206
|
+
alt: Number(p.alt),
|
|
2207
|
+
value: Number(p.value),
|
|
2208
|
+
pivot: p.pivot
|
|
2209
|
+
};
|
|
2210
|
+
});
|
|
2197
2211
|
if (ds.type !== 'line') {
|
|
2198
|
-
const features = ds.data
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
&& typeof p.value === 'number')
|
|
2205
|
-
.map(p => {
|
|
2212
|
+
const features = (_b = ds.data) === null || _b === void 0 ? void 0 : _b.filter((p) => p.lon !== undefined &&
|
|
2213
|
+
p.lat !== undefined &&
|
|
2214
|
+
p.value !== undefined &&
|
|
2215
|
+
typeof p.lon === 'number' &&
|
|
2216
|
+
typeof p.lat === 'number' &&
|
|
2217
|
+
typeof p.value === 'number').map((p) => {
|
|
2206
2218
|
const point = {
|
|
2207
2219
|
type: 'Feature',
|
|
2208
2220
|
geometry: {
|
|
@@ -2210,16 +2222,14 @@ class WidgetMapbox extends s$1 {
|
|
|
2210
2222
|
coordinates: [p.lon, p.lat]
|
|
2211
2223
|
},
|
|
2212
2224
|
properties: {
|
|
2213
|
-
value: Math.round(p.value)
|
|
2225
|
+
value: p.value ? Math.round(p.value) : undefined
|
|
2214
2226
|
}
|
|
2215
2227
|
};
|
|
2216
2228
|
return point;
|
|
2217
2229
|
});
|
|
2218
2230
|
return features;
|
|
2219
2231
|
}
|
|
2220
|
-
const line = ds.data.reverse()
|
|
2221
|
-
.filter(p => p.lon !== undefined && p.lat !== undefined)
|
|
2222
|
-
.map(p => [p.lon, p.lat, p.alt]);
|
|
2232
|
+
const line = (_e = (_d = (_c = ds === null || ds === void 0 ? void 0 : ds.data) === null || _c === void 0 ? void 0 : _c.reverse()) === null || _d === void 0 ? void 0 : _d.filter((p) => p.lon !== undefined && p.lat !== undefined)) === null || _e === void 0 ? void 0 : _e.map((p) => [p.lon, p.lat, p === null || p === void 0 ? void 0 : p.alt]);
|
|
2223
2233
|
const feature = {
|
|
2224
2234
|
type: 'Feature',
|
|
2225
2235
|
geometry: {
|
|
@@ -2231,99 +2241,100 @@ class WidgetMapbox extends s$1 {
|
|
|
2231
2241
|
return [feature];
|
|
2232
2242
|
}
|
|
2233
2243
|
addCircleLayer(dataSet) {
|
|
2234
|
-
var _a, _b;
|
|
2244
|
+
var _a, _b, _c, _d;
|
|
2235
2245
|
if (!dataSet)
|
|
2236
2246
|
return;
|
|
2237
2247
|
const layerConfig = {
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
...dataSet.config['circle'],
|
|
2243
|
-
|
|
2244
|
-
|
|
2248
|
+
id: dataSet.label + ':circle',
|
|
2249
|
+
type: 'circle',
|
|
2250
|
+
source: 'input:' + dataSet.label,
|
|
2251
|
+
paint: {
|
|
2252
|
+
...(_a = dataSet.config) === null || _a === void 0 ? void 0 : _a['circle'],
|
|
2253
|
+
'circle-radius': ['get', 'value'],
|
|
2254
|
+
'circle-radius-transition': {
|
|
2245
2255
|
duration: 1000,
|
|
2246
2256
|
delay: 0
|
|
2247
2257
|
},
|
|
2248
|
-
|
|
2249
|
-
}
|
|
2258
|
+
'circle-color': dataSet.color
|
|
2259
|
+
}
|
|
2250
2260
|
// Place polygons under labels, roads and buildings.
|
|
2251
2261
|
// 'aeroway-polygon'
|
|
2252
2262
|
};
|
|
2253
|
-
(
|
|
2254
|
-
if (!dataSet.config['symbol'])
|
|
2263
|
+
(_b = this.map) === null || _b === void 0 ? void 0 : _b.addLayer(layerConfig);
|
|
2264
|
+
if (!((_c = dataSet.config) === null || _c === void 0 ? void 0 : _c['symbol']))
|
|
2255
2265
|
return;
|
|
2256
2266
|
const layerConfig2 = {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2267
|
+
id: dataSet.label + ':symbol',
|
|
2268
|
+
type: 'symbol',
|
|
2269
|
+
source: 'input:' + dataSet.label,
|
|
2260
2270
|
layout: {
|
|
2261
2271
|
'text-field': ['get', 'value'],
|
|
2262
2272
|
'text-size': dataSet.config['symbol']['text-size'],
|
|
2263
|
-
'text-anchor': 'center'
|
|
2273
|
+
'text-anchor': 'center'
|
|
2264
2274
|
},
|
|
2265
2275
|
paint: {
|
|
2266
|
-
'text-color': dataSet.config['symbol']['text-color']
|
|
2276
|
+
'text-color': dataSet.config['symbol']['text-color']
|
|
2267
2277
|
}
|
|
2268
2278
|
// Place polygons under labels, roads and buildings.
|
|
2269
2279
|
// 'aeroway-polygon'
|
|
2270
2280
|
};
|
|
2271
|
-
(
|
|
2281
|
+
(_d = this.map) === null || _d === void 0 ? void 0 : _d.addLayer(layerConfig2);
|
|
2272
2282
|
}
|
|
2273
2283
|
addSymbolLayer(dataSet) {
|
|
2274
|
-
var _a;
|
|
2284
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2275
2285
|
if (!dataSet)
|
|
2276
2286
|
return;
|
|
2277
2287
|
const layerConfig = {
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2288
|
+
id: dataSet.label + ':symbol',
|
|
2289
|
+
type: 'symbol',
|
|
2290
|
+
source: 'input:' + dataSet.label,
|
|
2281
2291
|
layout: {
|
|
2282
2292
|
'text-field': ['get', 'value'],
|
|
2283
|
-
'text-size': dataSet.config['symbol']['text-size'],
|
|
2293
|
+
'text-size': (_b = (_a = dataSet.config) === null || _a === void 0 ? void 0 : _a['symbol']) === null || _b === void 0 ? void 0 : _b['text-size'],
|
|
2284
2294
|
'text-anchor': 'center',
|
|
2285
|
-
'icon-image': dataSet.config.symbol['icon-image'],
|
|
2286
|
-
'icon-size': dataSet.config.symbol['icon-size']
|
|
2295
|
+
'icon-image': (_d = (_c = dataSet.config) === null || _c === void 0 ? void 0 : _c.symbol) === null || _d === void 0 ? void 0 : _d['icon-image'],
|
|
2296
|
+
'icon-size': (_f = (_e = dataSet.config) === null || _e === void 0 ? void 0 : _e.symbol) === null || _f === void 0 ? void 0 : _f['icon-size']
|
|
2287
2297
|
},
|
|
2288
2298
|
paint: {
|
|
2289
|
-
'text-color': dataSet.config['symbol']['text-color']
|
|
2299
|
+
'text-color': (_h = (_g = dataSet.config) === null || _g === void 0 ? void 0 : _g['symbol']) === null || _h === void 0 ? void 0 : _h['text-color']
|
|
2290
2300
|
}
|
|
2291
2301
|
// Place polygons under labels, roads and buildings.
|
|
2292
2302
|
// 'aeroway-polygon'
|
|
2293
2303
|
};
|
|
2294
|
-
(
|
|
2304
|
+
(_j = this.map) === null || _j === void 0 ? void 0 : _j.addLayer(layerConfig);
|
|
2295
2305
|
}
|
|
2296
2306
|
addHeatmapLayer(dataSet) {
|
|
2297
|
-
var _a;
|
|
2307
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2298
2308
|
if (!dataSet)
|
|
2299
2309
|
return;
|
|
2300
|
-
const
|
|
2301
|
-
const
|
|
2310
|
+
const values = (_b = (_a = dataSet.data) === null || _a === void 0 ? void 0 : _a.map((p) => p === null || p === void 0 ? void 0 : p.value).filter((v) => v !== undefined)) !== null && _b !== void 0 ? _b : [];
|
|
2311
|
+
const min = Math.min(...values);
|
|
2312
|
+
const max = Math.max(...values);
|
|
2302
2313
|
const layerConfig = {
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2314
|
+
id: dataSet.label + ':heatmap',
|
|
2315
|
+
type: 'heatmap',
|
|
2316
|
+
source: 'input:' + dataSet.label,
|
|
2306
2317
|
paint: {
|
|
2307
|
-
...dataSet.config.heatmap,
|
|
2318
|
+
...(_c = dataSet.config) === null || _c === void 0 ? void 0 : _c.heatmap,
|
|
2308
2319
|
'heatmap-color': [
|
|
2309
|
-
"interpolate",
|
|
2310
|
-
["linear"],
|
|
2311
|
-
["heatmap-density"],
|
|
2312
|
-
0, "rgba(0, 0, 255, 0)",
|
|
2313
|
-
0.1, "royalblue",
|
|
2314
|
-
0.3, "cyan",
|
|
2315
|
-
0.5, "lime",
|
|
2316
|
-
0.7, "yellow",
|
|
2317
|
-
1, "tomato"
|
|
2318
|
-
],
|
|
2319
|
-
// Increase the heatmap weight based on frequency and property magnitude
|
|
2320
|
-
'heatmap-weight': [
|
|
2321
2320
|
'interpolate',
|
|
2322
2321
|
['linear'],
|
|
2323
|
-
['
|
|
2324
|
-
|
|
2325
|
-
|
|
2322
|
+
['heatmap-density'],
|
|
2323
|
+
0,
|
|
2324
|
+
'rgba(0, 0, 255, 0)',
|
|
2325
|
+
0.1,
|
|
2326
|
+
'royalblue',
|
|
2327
|
+
0.3,
|
|
2328
|
+
'cyan',
|
|
2329
|
+
0.5,
|
|
2330
|
+
'lime',
|
|
2331
|
+
0.7,
|
|
2332
|
+
'yellow',
|
|
2333
|
+
1,
|
|
2334
|
+
'tomato'
|
|
2326
2335
|
],
|
|
2336
|
+
// Increase the heatmap weight based on frequency and property magnitude
|
|
2337
|
+
'heatmap-weight': ['interpolate', ['linear'], ['get', 'value'], min, 0, max, 3],
|
|
2327
2338
|
// // Increase the heatmap color weight weight by zoom level
|
|
2328
2339
|
// // heatmap-intensity is a multiplier on top of heatmap-weight
|
|
2329
2340
|
// 'heatmap-intensity': [
|
|
@@ -2338,8 +2349,10 @@ class WidgetMapbox extends s$1 {
|
|
|
2338
2349
|
'interpolate',
|
|
2339
2350
|
['linear'],
|
|
2340
2351
|
['get', 'value'],
|
|
2341
|
-
min,
|
|
2342
|
-
|
|
2352
|
+
min,
|
|
2353
|
+
30,
|
|
2354
|
+
max,
|
|
2355
|
+
30 + ((_f = (_e = (_d = dataSet.config) === null || _d === void 0 ? void 0 : _d.heatmap) === null || _e === void 0 ? void 0 : _e['heatmap-radius']) !== null && _f !== void 0 ? _f : 0)
|
|
2343
2356
|
],
|
|
2344
2357
|
'heatmap-radius-transition': {
|
|
2345
2358
|
duration: 1000,
|
|
@@ -2357,36 +2370,36 @@ class WidgetMapbox extends s$1 {
|
|
|
2357
2370
|
// Place polygons under labels, roads and buildings.
|
|
2358
2371
|
// 'aeroway-polygon'
|
|
2359
2372
|
};
|
|
2360
|
-
(
|
|
2373
|
+
(_g = this.map) === null || _g === void 0 ? void 0 : _g.addLayer(layerConfig);
|
|
2361
2374
|
}
|
|
2362
2375
|
addLineLayer(dataSet) {
|
|
2363
|
-
var _a, _b;
|
|
2376
|
+
var _a, _b, _c, _d, _e;
|
|
2364
2377
|
if (!dataSet)
|
|
2365
2378
|
return;
|
|
2366
2379
|
const layerConfig = {
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2380
|
+
id: dataSet.label + ':line',
|
|
2381
|
+
type: 'line',
|
|
2382
|
+
source: 'input:' + dataSet.label,
|
|
2370
2383
|
layout: {
|
|
2371
|
-
'line-cap': 'round'
|
|
2384
|
+
'line-cap': 'round'
|
|
2372
2385
|
},
|
|
2373
2386
|
paint: {
|
|
2374
|
-
...dataSet.config.line,
|
|
2375
|
-
|
|
2387
|
+
...(_a = dataSet.config) === null || _a === void 0 ? void 0 : _a.line,
|
|
2388
|
+
'line-color': dataSet.color
|
|
2376
2389
|
}
|
|
2377
2390
|
// Place polygons under labels, roads and buildings.
|
|
2378
2391
|
// 'aeroway-polygon'
|
|
2379
2392
|
};
|
|
2380
|
-
(
|
|
2381
|
-
if (!dataSet.config.symbol['icon-image'])
|
|
2393
|
+
(_b = this.map) === null || _b === void 0 ? void 0 : _b.addLayer(layerConfig);
|
|
2394
|
+
if (!((_d = (_c = dataSet.config) === null || _c === void 0 ? void 0 : _c.symbol) === null || _d === void 0 ? void 0 : _d['icon-image']))
|
|
2382
2395
|
return;
|
|
2383
2396
|
const layerConfig2 = {
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2397
|
+
id: dataSet.label + ':symbol',
|
|
2398
|
+
type: 'symbol',
|
|
2399
|
+
source: 'input:' + dataSet.label,
|
|
2387
2400
|
layout: {
|
|
2388
2401
|
'icon-image': dataSet.config.symbol['icon-image'],
|
|
2389
|
-
'icon-size': dataSet.config.symbol['icon-size']
|
|
2402
|
+
'icon-size': dataSet.config.symbol['icon-size']
|
|
2390
2403
|
},
|
|
2391
2404
|
paint: {
|
|
2392
2405
|
'icon-color': dataSet.color
|
|
@@ -2394,7 +2407,7 @@ class WidgetMapbox extends s$1 {
|
|
|
2394
2407
|
// Place polygons under labels, roads and buildings.
|
|
2395
2408
|
// 'aeroway-polygon'
|
|
2396
2409
|
};
|
|
2397
|
-
(
|
|
2410
|
+
(_e = this.map) === null || _e === void 0 ? void 0 : _e.addLayer(layerConfig2);
|
|
2398
2411
|
}
|
|
2399
2412
|
syncDataLayers() {
|
|
2400
2413
|
var _a, _b, _c;
|
|
@@ -2404,14 +2417,17 @@ class WidgetMapbox extends s$1 {
|
|
|
2404
2417
|
mySources.forEach(([label]) => {
|
|
2405
2418
|
if (!this.dataSources.has(label)) {
|
|
2406
2419
|
// remove all layers using this source
|
|
2407
|
-
this.map
|
|
2420
|
+
this.map
|
|
2421
|
+
.getStyle()
|
|
2422
|
+
.layers.filter((la) => la.id === label + ':' + la.type)
|
|
2423
|
+
.forEach((la) => {
|
|
2408
2424
|
this.map.removeLayer(la.id);
|
|
2409
2425
|
});
|
|
2410
2426
|
this.map.removeSource(label);
|
|
2411
2427
|
}
|
|
2412
2428
|
});
|
|
2413
|
-
// add new layers or update the data of existing layers
|
|
2414
|
-
this.dataSets.forEach(ds => {
|
|
2429
|
+
// add new layers or update the data of existing layers
|
|
2430
|
+
this.dataSets.forEach((ds) => {
|
|
2415
2431
|
var _a;
|
|
2416
2432
|
const fc = this.dataSources.get('input:' + ds.label);
|
|
2417
2433
|
const src = this.map.getSource('input:' + ds.label);
|
|
@@ -2452,29 +2468,35 @@ class WidgetMapbox extends s$1 {
|
|
|
2452
2468
|
}
|
|
2453
2469
|
}
|
|
2454
2470
|
this.map.addLayer({
|
|
2455
|
-
|
|
2456
|
-
|
|
2471
|
+
id: '3d-buildings',
|
|
2472
|
+
source: 'composite',
|
|
2457
2473
|
'source-layer': 'building',
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2474
|
+
filter: ['==', 'extrude', 'true'],
|
|
2475
|
+
type: 'fill-extrusion',
|
|
2476
|
+
minzoom: 14,
|
|
2477
|
+
paint: {
|
|
2462
2478
|
'fill-extrusion-color': '#aaa',
|
|
2463
2479
|
// use an 'interpolate' expression to add a smooth transition effect to the
|
|
2464
2480
|
// buildings as the user zooms in
|
|
2465
2481
|
'fill-extrusion-height': [
|
|
2466
|
-
|
|
2467
|
-
[
|
|
2468
|
-
|
|
2469
|
-
14
|
|
2482
|
+
'interpolate',
|
|
2483
|
+
['linear'],
|
|
2484
|
+
['zoom'],
|
|
2485
|
+
14,
|
|
2486
|
+
0,
|
|
2487
|
+
14.05,
|
|
2488
|
+
['get', 'height']
|
|
2470
2489
|
],
|
|
2471
2490
|
'fill-extrusion-base': [
|
|
2472
|
-
|
|
2473
|
-
[
|
|
2474
|
-
|
|
2475
|
-
14
|
|
2491
|
+
'interpolate',
|
|
2492
|
+
['linear'],
|
|
2493
|
+
['zoom'],
|
|
2494
|
+
14,
|
|
2495
|
+
0,
|
|
2496
|
+
14.05,
|
|
2497
|
+
['get', 'min_height']
|
|
2476
2498
|
],
|
|
2477
|
-
'fill-extrusion-opacity': .6
|
|
2499
|
+
'fill-extrusion-opacity': 0.6
|
|
2478
2500
|
}
|
|
2479
2501
|
}, labelLayerId);
|
|
2480
2502
|
}
|
|
@@ -2486,7 +2508,7 @@ class WidgetMapbox extends s$1 {
|
|
|
2486
2508
|
this.map = new mapboxgl.Map({
|
|
2487
2509
|
container: (_c = this.shadowRoot) === null || _c === void 0 ? void 0 : _c.getElementById('map'),
|
|
2488
2510
|
style: `mapbox://styles/mapbox/${(_d = this.mapStyle) !== null && _d !== void 0 ? _d : 'light-v11'}`,
|
|
2489
|
-
center: [8.
|
|
2511
|
+
center: [8.68417, 50.11552],
|
|
2490
2512
|
zoom: 1.8,
|
|
2491
2513
|
attributionControl: false
|
|
2492
2514
|
});
|
|
@@ -2506,96 +2528,106 @@ class WidgetMapbox extends s$1 {
|
|
|
2506
2528
|
render() {
|
|
2507
2529
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2508
2530
|
return x `
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2531
|
+
<link
|
|
2532
|
+
href="https://api.mapbox.com/mapbox-gl-js/v${mapboxgl.version}/mapbox-gl.css"
|
|
2533
|
+
rel="stylesheet"
|
|
2534
|
+
/>
|
|
2535
|
+
<div class="wrapper">
|
|
2536
|
+
<header>
|
|
2537
|
+
<div class="title">
|
|
2538
|
+
<h3 class="paging" ?active=${(_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.title}>
|
|
2539
|
+
${(_d = (_c = this.inputData) === null || _c === void 0 ? void 0 : _c.settings) === null || _d === void 0 ? void 0 : _d.title}
|
|
2540
|
+
</h3>
|
|
2541
|
+
<p class="paging" ?active=${(_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.settings) === null || _f === void 0 ? void 0 : _f.subTitle}>
|
|
2542
|
+
${(_h = (_g = this.inputData) === null || _g === void 0 ? void 0 : _g.settings) === null || _h === void 0 ? void 0 : _h.subTitle}
|
|
2543
|
+
</p>
|
|
2544
|
+
</div>
|
|
2545
|
+
<div class="legend paging" ?active=${(_k = (_j = this === null || this === void 0 ? void 0 : this.inputData) === null || _j === void 0 ? void 0 : _j.settings) === null || _k === void 0 ? void 0 : _k.showLegend}>
|
|
2546
|
+
${c(this.dataSets, (ds) => ds.label, (ds) => {
|
|
2518
2547
|
return x `
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2548
|
+
<div class="label">
|
|
2549
|
+
<div
|
|
2550
|
+
style="background: ${ds.color}; width: 24px; height: 12px;"
|
|
2551
|
+
></div>
|
|
2552
|
+
<div>${ds.label}</div>
|
|
2553
|
+
</div>
|
|
2554
|
+
`;
|
|
2524
2555
|
})}
|
|
2556
|
+
</div>
|
|
2557
|
+
</header>
|
|
2558
|
+
<div id="map"></div>
|
|
2525
2559
|
</div>
|
|
2526
|
-
|
|
2527
|
-
<div id="map"></div>
|
|
2528
|
-
</div>
|
|
2529
|
-
`;
|
|
2560
|
+
`;
|
|
2530
2561
|
}
|
|
2531
2562
|
}
|
|
2532
2563
|
WidgetMapbox.styles = i$3 `
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2564
|
+
:host {
|
|
2565
|
+
display: block;
|
|
2566
|
+
color: var(--re-bar-text-color, #000);
|
|
2567
|
+
font-family: sans-serif;
|
|
2568
|
+
padding: 16px;
|
|
2569
|
+
box-sizing: border-box;
|
|
2570
|
+
margin: auto;
|
|
2571
|
+
}
|
|
2541
2572
|
|
|
2542
|
-
|
|
2573
|
+
.paging:not([active]) {
|
|
2574
|
+
display: none !important;
|
|
2575
|
+
}
|
|
2543
2576
|
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2577
|
+
header {
|
|
2578
|
+
display: flex;
|
|
2579
|
+
margin: 0 0 16px 0;
|
|
2580
|
+
gap: 24px;
|
|
2581
|
+
justify-content: space-between;
|
|
2582
|
+
}
|
|
2583
|
+
h3 {
|
|
2584
|
+
margin: 0;
|
|
2585
|
+
max-width: 300px;
|
|
2586
|
+
overflow: hidden;
|
|
2587
|
+
text-overflow: ellipsis;
|
|
2588
|
+
white-space: nowrap;
|
|
2589
|
+
}
|
|
2590
|
+
p {
|
|
2591
|
+
margin: 10px 0 0 0;
|
|
2592
|
+
max-width: 300px;
|
|
2593
|
+
font-size: 14px;
|
|
2594
|
+
overflow: hidden;
|
|
2595
|
+
text-overflow: ellipsis;
|
|
2596
|
+
white-space: nowrap;
|
|
2597
|
+
line-height: 17px;
|
|
2598
|
+
}
|
|
2566
2599
|
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2600
|
+
.wrapper {
|
|
2601
|
+
display: flex;
|
|
2602
|
+
flex-direction: column;
|
|
2603
|
+
height: 100%;
|
|
2604
|
+
width: 100%;
|
|
2605
|
+
}
|
|
2606
|
+
#map {
|
|
2607
|
+
flex: 1;
|
|
2608
|
+
}
|
|
2576
2609
|
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
.legend {
|
|
2582
|
-
display: flex;
|
|
2583
|
-
flex-wrap: wrap;
|
|
2584
|
-
gap: 12px;
|
|
2585
|
-
}
|
|
2610
|
+
.title {
|
|
2611
|
+
white-space: nowrap;
|
|
2612
|
+
}
|
|
2586
2613
|
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
}
|
|
2614
|
+
.legend {
|
|
2615
|
+
display: flex;
|
|
2616
|
+
flex-wrap: wrap;
|
|
2617
|
+
gap: 12px;
|
|
2618
|
+
}
|
|
2593
2619
|
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2620
|
+
.label {
|
|
2621
|
+
display: flex;
|
|
2622
|
+
align-items: center;
|
|
2623
|
+
font-size: 14px;
|
|
2624
|
+
gap: 8px;
|
|
2625
|
+
}
|
|
2597
2626
|
|
|
2598
|
-
|
|
2627
|
+
a.mapboxgl-ctrl-logo {
|
|
2628
|
+
display: none;
|
|
2629
|
+
}
|
|
2630
|
+
`;
|
|
2599
2631
|
__decorate([
|
|
2600
2632
|
n({ type: Object })
|
|
2601
2633
|
], WidgetMapbox.prototype, "inputData", void 0);
|
|
@@ -2611,7 +2643,7 @@ __decorate([
|
|
|
2611
2643
|
__decorate([
|
|
2612
2644
|
r$1()
|
|
2613
2645
|
], WidgetMapbox.prototype, "colors", void 0);
|
|
2614
|
-
window.customElements.define('widget-mapbox-1.4.
|
|
2646
|
+
window.customElements.define('widget-mapbox-1.4.13', WidgetMapbox);
|
|
2615
2647
|
|
|
2616
2648
|
export { WidgetMapbox };
|
|
2617
2649
|
//# sourceMappingURL=widget-mapbox.js.map
|