@sjvair/monitor-map 3.0.3 → 3.0.5
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/lib/LoadScreen.svelte +68 -0
- package/dist/lib/LoadScreen.svelte.d.ts +25 -0
- package/dist/lib/MainMapView.svelte +1 -0
- package/dist/lib/MainMapView.svelte.d.ts +26 -0
- package/dist/lib/MapLegend.svelte +15 -0
- package/dist/lib/MapLegend.svelte.d.ts +18 -0
- package/dist/lib/MonitorDetailPanel.svelte +152 -0
- package/dist/lib/MonitorDetailPanel.svelte.d.ts +3 -0
- package/dist/lib/MonitorMapLayout.svelte +193 -0
- package/dist/lib/MonitorMapLayout.svelte.d.ts +7 -0
- package/dist/lib/actions.d.ts +3 -0
- package/dist/lib/actions.js +12 -8
- package/dist/lib/assets/icons/adjustment-horizontal.svg +3 -0
- package/dist/lib/assets/logos/airgradient-blue.svg +63 -0
- package/dist/lib/assets/logos/airnow-compact.jpg +0 -0
- package/dist/lib/assets/logos/carb-compact.jpg +0 -0
- package/dist/lib/assets/logos/purpleair-compact.png +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-air.webp +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-icon.webp +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-sjv.webp +0 -0
- package/dist/lib/assets/logos/sjvair-white.svg +115 -0
- package/dist/lib/assets/logos/sjvair.svg +96 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte +98 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte.d.ts +7 -0
- package/dist/lib/collocation-sites/collocation-utils.d.ts +3 -0
- package/dist/lib/collocation-sites/collocation-utils.js +30 -0
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.d.ts +7 -0
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.js +17 -20
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.d.ts +18 -0
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.js +98 -83
- package/dist/lib/collocation-sites/collocations.svelte.d.ts +9 -0
- package/dist/lib/collocation-sites/collocations.svelte.js +17 -26
- package/dist/lib/collocation-sites/types.d.ts +8 -0
- package/dist/lib/collocation-sites/types.js +1 -0
- package/dist/lib/colors.d.ts +17 -0
- package/dist/lib/colors.js +29 -23
- package/dist/lib/components/DataBox.svelte +29 -0
- package/dist/lib/components/DataBox.svelte.d.ts +9 -0
- package/dist/lib/components/DisplayOption.svelte +7 -0
- package/dist/lib/components/DisplayOption.svelte.d.ts +5 -0
- package/dist/lib/components/MapLayersDisplayOptions.svelte +42 -0
- package/dist/lib/components/MapLayersDisplayOptions.svelte.d.ts +18 -0
- package/dist/lib/components/SegmentedControl.svelte +61 -0
- package/dist/lib/components/SegmentedControl.svelte.d.ts +11 -0
- package/dist/lib/components/ToggleSwitch.svelte +93 -0
- package/dist/lib/components/ToggleSwitch.svelte.d.ts +9 -0
- package/dist/lib/components/ui/button/button.svelte +89 -0
- package/dist/lib/components/ui/button/button.svelte.d.ts +70 -0
- package/dist/lib/components/ui/button/index.d.ts +2 -0
- package/dist/lib/components/ui/button/index.js +4 -0
- package/dist/lib/components/ui/range-calendar/index.d.ts +19 -0
- package/dist/lib/components/ui/range-calendar/index.js +21 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.svelte +76 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.svelte.d.ts +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-day.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-day.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.svelte +7 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.svelte +7 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.svelte +12 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.svelte +16 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-header.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-header.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-heading.svelte +16 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-heading.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.svelte +44 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month.svelte +15 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-months.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-months.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.svelte.d.ts +8 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +8 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.svelte +43 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte +112 -0
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte.d.ts +21 -0
- package/dist/lib/data-chart/DataChart.svelte +303 -0
- package/dist/lib/data-chart/DataChart.svelte.d.ts +7 -0
- package/dist/lib/data-chart/DateRange.d.ts +6 -0
- package/dist/lib/data-chart/DateRange.js +15 -14
- package/dist/lib/data-chart/chart-utils.d.ts +3 -0
- package/dist/lib/data-chart/chart-utils.js +157 -93
- package/dist/lib/data-chart/data-chart.svelte.d.ts +7 -0
- package/dist/lib/data-chart/data-chart.svelte.js +7 -28
- package/dist/lib/data-chart/requests.d.ts +3 -0
- package/dist/lib/data-chart/requests.js +36 -28
- package/dist/lib/data-chart/tooltip.d.ts +10 -0
- package/dist/lib/data-chart/tooltip.js +160 -98
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte +16 -0
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte +127 -0
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte +46 -0
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte.d.ts +18 -0
- package/dist/lib/ev-stations/data-maps.d.ts +5 -0
- package/dist/lib/ev-stations/data-maps.js +152 -4
- package/dist/lib/ev-stations/ev-station-icons.d.ts +16 -0
- package/dist/lib/ev-stations/ev-station-icons.js +21 -27
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.d.ts +19 -0
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.js +130 -117
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.d.ts +31 -0
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.js +206 -180
- package/dist/lib/ev-stations/ev-stations.svelte.d.ts +9 -0
- package/dist/lib/ev-stations/ev-stations.svelte.js +54 -32
- package/dist/lib/ev-stations/types.d.ts +53 -0
- package/dist/lib/ev-stations/types.js +1 -0
- package/dist/lib/ev-stations/zip-codes.d.ts +13 -0
- package/dist/lib/ev-stations/zip-codes.js +457 -135
- package/dist/lib/hms/components/HMSFireLegend.svelte +21 -0
- package/dist/lib/hms/components/HMSFireLegend.svelte.d.ts +18 -0
- package/dist/lib/hms/hms-fire-icon-manager.d.ts +5 -0
- package/dist/lib/hms/hms-fire-icon-manager.js +28 -37
- package/dist/lib/hms/hms-fire-map-integration.svelte.d.ts +23 -0
- package/dist/lib/hms/hms-fire-map-integration.svelte.js +94 -97
- package/dist/lib/hms/hms-smoke-map-integration.svelte.d.ts +19 -0
- package/dist/lib/hms/hms-smoke-map-integration.svelte.js +68 -84
- package/dist/lib/hms/hms.svelte.d.ts +19 -0
- package/dist/lib/hms/hms.svelte.js +225 -76
- package/dist/lib/index.d.ts +68 -0
- package/dist/lib/index.js +56 -21
- package/dist/lib/map/Map.svelte +13 -0
- package/dist/lib/map/Map.svelte.d.ts +8 -0
- package/dist/lib/map/MapStyleDisplayOptions.svelte +61 -0
- package/dist/lib/map/MapStyleDisplayOptions.svelte.d.ts +3 -0
- package/dist/lib/map/Menu.svelte +64 -0
- package/dist/lib/map/Menu.svelte.d.ts +5 -0
- package/dist/lib/map/icons.d.ts +7 -0
- package/dist/lib/map/icons.js +24 -22
- package/dist/lib/map/integrations/base-layer-seperator.d.ts +9 -0
- package/dist/lib/map/integrations/base-layer-seperator.js +11 -12
- package/dist/lib/map/integrations/click-manager.d.ts +14 -0
- package/dist/lib/map/integrations/click-manager.js +52 -33
- package/dist/lib/map/integrations/integrations-manager.d.ts +8 -0
- package/dist/lib/map/integrations/integrations-manager.js +20 -12
- package/dist/lib/map/integrations/map-display-option.svelte.d.ts +7 -0
- package/dist/lib/map/integrations/map-display-option.svelte.js +10 -18
- package/dist/lib/map/integrations/map-geojson-integration.svelte.d.ts +13 -0
- package/dist/lib/map/integrations/map-geojson-integration.svelte.js +21 -17
- package/dist/lib/map/integrations/map-icon-manager.d.ts +15 -0
- package/dist/lib/map/integrations/map-icon-manager.js +52 -46
- package/dist/lib/map/integrations/map-integration.svelte.d.ts +6 -0
- package/dist/lib/map/integrations/map-integration.svelte.js +2 -5
- package/dist/lib/map/integrations/map-layer-integration.svelte.d.ts +11 -0
- package/dist/lib/map/integrations/map-layer-integration.svelte.js +36 -23
- package/dist/lib/map/integrations/tooltip.svelte.d.ts +28 -0
- package/dist/lib/map/integrations/tooltip.svelte.js +120 -78
- package/dist/lib/map/integrations/types.d.ts +14 -0
- package/dist/lib/map/integrations/types.js +1 -0
- package/dist/lib/map/map.svelte.d.ts +14 -0
- package/dist/lib/map/map.svelte.js +48 -50
- package/dist/lib/map/utils.d.ts +7 -0
- package/dist/lib/map/utils.js +32 -29
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte +112 -0
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte.d.ts +7 -0
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte +41 -0
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte.d.ts +3 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte +128 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte.d.ts +6 -0
- package/dist/lib/monitors/components/MonitorTooltip.svelte +61 -0
- package/dist/lib/monitors/components/MonitorTooltip.svelte.d.ts +7 -0
- package/dist/lib/monitors/components/MonitorWidgetModal.svelte +100 -0
- package/dist/lib/monitors/components/MonitorWidgetModal.svelte.d.ts +6 -0
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte +79 -0
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte.d.ts +3 -0
- package/dist/lib/monitors/monitor-utils.d.ts +4 -0
- package/dist/lib/monitors/monitor-utils.js +33 -23
- package/dist/lib/monitors/monitors-cluster-renderer.d.ts +33 -0
- package/dist/lib/monitors/monitors-cluster-renderer.js +218 -209
- package/dist/lib/monitors/monitors-icon-manager.svelte.d.ts +13 -0
- package/dist/lib/monitors/monitors-icon-manager.svelte.js +75 -70
- package/dist/lib/monitors/monitors-map-integration.svelte.d.ts +40 -0
- package/dist/lib/monitors/monitors-map-integration.svelte.js +278 -270
- package/dist/lib/monitors/monitors.svelte.d.ts +16 -0
- package/dist/lib/monitors/monitors.svelte.js +38 -63
- package/dist/lib/monitors/types.d.ts +26 -0
- package/dist/lib/monitors/types.js +1 -0
- package/dist/lib/reactivity.svelte.d.ts +0 -0
- package/dist/lib/reactivity.svelte.js +83 -0
- package/dist/lib/router-context.d.ts +27 -0
- package/dist/lib/router-context.js +11 -11
- package/dist/lib/routes.d.ts +2 -0
- package/dist/lib/routes.js +10 -9
- package/dist/lib/search/Search.svelte +189 -0
- package/dist/lib/search/Search.svelte.d.ts +3 -0
- package/dist/lib/search/service.d.ts +17 -0
- package/dist/lib/search/service.js +75 -85
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.js +10 -12
- package/dist/lib/weather.d.ts +1 -0
- package/dist/lib/weather.js +11 -7
- package/dist/lib/wind/wind.svelte.d.ts +10 -0
- package/dist/lib/wind/wind.svelte.js +13 -21
- package/package.json +9 -7
- package/src/lib/LoadScreen.svelte +3 -3
- package/src/lib/hms/components/HMSFireLegend.svelte +1 -1
- package/src/lib/hms/hms.svelte.ts +8 -9
- package/src/lib/index.ts +18 -0
- package/src/lib/routes.ts +6 -1
- package/src/lib/utils.ts +1 -1
- package/dist/lib/LoadScreen.js +0 -73
- package/dist/lib/MainMapView.js +0 -7
- package/dist/lib/MapLegend.js +0 -13
- package/dist/lib/MonitorDetailPanel.js +0 -169
- package/dist/lib/MonitorMapLayout.js +0 -91
- package/dist/lib/_virtual/_rolldown/runtime.js +0 -11
- package/dist/lib/assets/logos/airgradient-blue.js +0 -4
- package/dist/lib/assets/logos/airnow-compact.js +0 -4
- package/dist/lib/assets/logos/carb-compact.js +0 -4
- package/dist/lib/assets/logos/purpleair-compact.js +0 -4
- package/dist/lib/assets/logos/sjvair.js +0 -4
- package/dist/lib/collocation-sites/CollocationTooltip.js +0 -105
- package/dist/lib/components/DataBox.js +0 -30
- package/dist/lib/components/DisplayOption.js +0 -10
- package/dist/lib/components/MapLayersDisplayOptions.js +0 -87
- package/dist/lib/components/SegmentedControl.js +0 -37
- package/dist/lib/components/ToggleSwitch.js +0 -17
- package/dist/lib/components/ui/button/button.js +0 -34
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.js +0 -82
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-day.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.js +0 -27
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.js +0 -27
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-header.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.js +0 -61
- package/dist/lib/components/ui/range-calendar/range-calendar-month.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-months.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.js +0 -58
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.js +0 -58
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.js +0 -59
- package/dist/lib/components/ui/range-calendar/range-calendar.js +0 -272
- package/dist/lib/data-chart/DataChart.js +0 -142
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.js +0 -16
- package/dist/lib/ev-stations/components/EvStationTooltip.js +0 -120
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.js +0 -41
- package/dist/lib/hms/components/HMSFireLegend.js +0 -35
- package/dist/lib/map/Map.js +0 -14
- package/dist/lib/map/MapStyleDisplayOptions.js +0 -43
- package/dist/lib/map/Menu.js +0 -44
- package/dist/lib/monitors/components/MonitorClusterTooltip.js +0 -83
- package/dist/lib/monitors/components/MonitorMarkersLegend.js +0 -35
- package/dist/lib/monitors/components/MonitorSubscriptionManager.js +0 -104
- package/dist/lib/monitors/components/MonitorTooltip.js +0 -59
- package/dist/lib/monitors/components/MonitorWidgetModal.js +0 -40
- package/dist/lib/monitors/components/MonitorsDisplayOptions.js +0 -76
- package/dist/lib/search/Search.js +0 -124
- package/dist/lib/sjvair-air.avif +0 -0
- package/dist/lib/sjvair-air.png +0 -0
- package/dist/lib/sjvair-air.webp +0 -0
- package/dist/lib/sjvair-air2.avif +0 -0
- package/dist/lib/sjvair-air2.png +0 -0
- package/dist/lib/sjvair-air2.webp +0 -0
- package/dist/lib/sjvair-icon.avif +0 -0
- package/dist/lib/sjvair-icon.png +0 -0
- package/dist/lib/sjvair-icon.webp +0 -0
- package/dist/lib/sjvair-icon2.avif +0 -0
- package/dist/lib/sjvair-icon2.png +0 -0
- package/dist/lib/sjvair-icon2.webp +0 -0
- package/dist/lib/sjvair-sjv.avif +0 -0
- package/dist/lib/sjvair-sjv.png +0 -0
- package/dist/lib/sjvair-sjv.webp +0 -0
- package/dist/lib/sjvair-sjv2.avif +0 -0
- package/dist/lib/sjvair-sjv2.png +0 -0
- package/dist/lib/sjvair-sjv2.webp +0 -0
|
@@ -1,212 +1,221 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { clickManager
|
|
4
|
-
import { getTypeShape
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
"max",
|
|
13
|
-
["get", "point_count"],
|
|
14
|
-
1
|
|
15
|
-
]
|
|
1
|
+
import { mapManager } from "../map/map.svelte.ts";
|
|
2
|
+
import { mountPopup } from "../map/utils.ts";
|
|
3
|
+
import { clickManager } from "../map/integrations/click-manager.ts";
|
|
4
|
+
import { getTypeShape } from "./monitor-utils.ts";
|
|
5
|
+
import MonitorTooltip from "./components/MonitorTooltip.svelte";
|
|
6
|
+
import MonitorClusterTooltip from "./components/MonitorClusterTooltip.svelte";
|
|
7
|
+
const AVG_EXPR = [
|
|
8
|
+
"/",
|
|
9
|
+
["get", "sumValues"],
|
|
10
|
+
["max", ["get", "point_count"], 1]
|
|
16
11
|
];
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
export function monitorTooltip(evt) {
|
|
13
|
+
const features = evt.features;
|
|
14
|
+
const feature = features?.sort((a, b) => b.properties.order - a.properties.order)[0];
|
|
15
|
+
if (!feature)
|
|
16
|
+
return;
|
|
17
|
+
return mountPopup(MonitorTooltip, { feature }, evt.lngLat);
|
|
20
18
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
function clusterTooltip(evt) {
|
|
20
|
+
const feature = evt.features?.[0];
|
|
21
|
+
if (!feature)
|
|
22
|
+
return;
|
|
23
|
+
return mountPopup(MonitorClusterTooltip, { feature }, evt.lngLat);
|
|
24
|
+
}
|
|
25
|
+
export class MonitorsClusterRenderer {
|
|
26
|
+
ctx;
|
|
27
|
+
_clusterTypes = [];
|
|
28
|
+
constructor(ctx) {
|
|
29
|
+
this.ctx = ctx;
|
|
30
|
+
}
|
|
31
|
+
apply(monitorClickHandler) {
|
|
32
|
+
if (!mapManager.map)
|
|
33
|
+
return;
|
|
34
|
+
const sortedEntries = Object.entries(this.ctx.featuresByType).sort(([, a], [, b]) => {
|
|
35
|
+
const maxOrder = (fs) => fs.reduce((m, f) => Math.max(m, f.properties.order), 0);
|
|
36
|
+
return maxOrder(a) - maxOrder(b);
|
|
37
|
+
});
|
|
38
|
+
for (const [[type, features], index] of sortedEntries.map((e, i) => [e, i])) {
|
|
39
|
+
const sourceId = `${this.ctx.referenceId}-${type}`;
|
|
40
|
+
mapManager.map.addSource(sourceId, {
|
|
41
|
+
type: "geojson",
|
|
42
|
+
promoteId: "id",
|
|
43
|
+
data: { type: "FeatureCollection", features },
|
|
44
|
+
cluster: true,
|
|
45
|
+
clusterRadius: 40,
|
|
46
|
+
clusterMaxZoom: 9,
|
|
47
|
+
clusterProperties: {
|
|
48
|
+
sumValues: ["+", ["to-number", ["get", "value"]], 0]
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
this.monitorTypeIconsLayer(sourceId, AVG_EXPR, getTypeShape(type));
|
|
52
|
+
this.clusterCountLayer(sourceId, AVG_EXPR);
|
|
53
|
+
this.unclusteredLayer(sourceId);
|
|
54
|
+
const { icon, unclustered } = this.clusterLayerIds(sourceId);
|
|
55
|
+
if (!this.ctx.tooltipManager.has(icon)) {
|
|
56
|
+
this.ctx.tooltipManager.register(icon, clusterTooltip, index);
|
|
57
|
+
}
|
|
58
|
+
if (!this.ctx.tooltipManager.has(unclustered)) {
|
|
59
|
+
this.ctx.tooltipManager.register(unclustered, monitorTooltip, index);
|
|
60
|
+
}
|
|
61
|
+
clickManager.register([unclustered], monitorClickHandler);
|
|
62
|
+
clickManager.register([icon], this.makeClusterClickHandler(sourceId));
|
|
63
|
+
this._clusterTypes.push(type);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
remove() {
|
|
67
|
+
if (!mapManager.map)
|
|
68
|
+
return;
|
|
69
|
+
for (const type of this._clusterTypes) {
|
|
70
|
+
const sourceId = `${this.ctx.referenceId}-${type}`;
|
|
71
|
+
const layers = this.clusterLayerIds(sourceId);
|
|
72
|
+
clickManager.unregister([layers.unclustered]);
|
|
73
|
+
clickManager.unregister([layers.icon]);
|
|
74
|
+
for (const layerId of Object.values(layers)) {
|
|
75
|
+
if (mapManager.map.getLayer(layerId)) {
|
|
76
|
+
mapManager.map.removeLayer(layerId);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (mapManager.map.getSource(sourceId)) {
|
|
80
|
+
mapManager.map.removeSource(sourceId);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
this._clusterTypes = [];
|
|
84
|
+
}
|
|
85
|
+
get unclusteredLayerIds() {
|
|
86
|
+
return this._clusterTypes.map((type) => `${this.ctx.referenceId}-${type}-unclustered`);
|
|
87
|
+
}
|
|
88
|
+
syncFeatures() {
|
|
89
|
+
if (!mapManager.map)
|
|
90
|
+
return;
|
|
91
|
+
for (const type of this._clusterTypes) {
|
|
92
|
+
const sourceId = `${this.ctx.referenceId}-${type}`;
|
|
93
|
+
mapManager.setDataSource(sourceId, this.ctx.featuresByType[type] ?? []);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
syncFilter() {
|
|
97
|
+
if (!mapManager.map)
|
|
98
|
+
return;
|
|
99
|
+
for (const type of this._clusterTypes) {
|
|
100
|
+
const sourceId = `${this.ctx.referenceId}-${type}`;
|
|
101
|
+
const { unclustered } = this.clusterLayerIds(sourceId);
|
|
102
|
+
if (mapManager.map.getLayer(unclustered)) {
|
|
103
|
+
mapManager.map.setFilter(unclustered, [
|
|
104
|
+
"all",
|
|
105
|
+
this.ctx.filters,
|
|
106
|
+
["!", ["has", "point_count"]]
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
syncThresholds() {
|
|
112
|
+
if (!mapManager.map)
|
|
113
|
+
return;
|
|
114
|
+
for (const type of this._clusterTypes) {
|
|
115
|
+
const sourceId = `${this.ctx.referenceId}-${type}`;
|
|
116
|
+
const { icon, average } = this.clusterLayerIds(sourceId);
|
|
117
|
+
if (mapManager.map.getLayer(icon)) {
|
|
118
|
+
mapManager.map.setLayoutProperty(icon, "icon-image", this.buildClusterIconExpression(AVG_EXPR, getTypeShape(type)));
|
|
119
|
+
}
|
|
120
|
+
if (mapManager.map.getLayer(average)) {
|
|
121
|
+
mapManager.map.setPaintProperty(average, "text-color", this.clusterTextColorExpr(AVG_EXPR));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
makeClusterClickHandler(sourceId) {
|
|
126
|
+
return async (features) => {
|
|
127
|
+
try {
|
|
128
|
+
const feature = features[0];
|
|
129
|
+
if (!feature?.properties?.cluster_id)
|
|
130
|
+
return;
|
|
131
|
+
const source = mapManager.map?.getSource(sourceId);
|
|
132
|
+
if (!source)
|
|
133
|
+
return;
|
|
134
|
+
const zoom = await source.getClusterExpansionZoom(feature.properties.cluster_id);
|
|
135
|
+
const coords = feature.geometry.coordinates;
|
|
136
|
+
mapManager.map?.easeTo({ center: coords, zoom });
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
console.error("ClickManager: cluster expansion zoom failed", err);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
clusterLayerIds(sourceId) {
|
|
144
|
+
return {
|
|
145
|
+
icon: `${sourceId}-cluster-icon`,
|
|
146
|
+
average: `${sourceId}-cluster-average`,
|
|
147
|
+
unclustered: `${sourceId}-unclustered`
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
get clusterTextColorThreshold() {
|
|
151
|
+
// Use the max of the 3rd level (unhealthy_sensitive) so text flips to white at unhealthy+
|
|
152
|
+
return this.ctx.clusterIconThresholds[2]?.range[1] ?? 150.5;
|
|
153
|
+
}
|
|
154
|
+
clusterTextColorExpr(avgExpr) {
|
|
155
|
+
return ["case", ["<=", avgExpr, this.clusterTextColorThreshold], "#000000", "#FFFFFF"];
|
|
156
|
+
}
|
|
157
|
+
buildClusterIconExpression(avgExpr, shape) {
|
|
158
|
+
const thresholds = this.ctx.clusterIconThresholds;
|
|
159
|
+
if (!thresholds.length)
|
|
160
|
+
return `outside-default-${shape}`;
|
|
161
|
+
const expr = ["case"];
|
|
162
|
+
for (const level of thresholds.slice(0, -1)) {
|
|
163
|
+
expr.push(["<=", avgExpr, level.range[1]], `outside-${level.name}-${shape}`);
|
|
164
|
+
}
|
|
165
|
+
expr.push(`outside-${thresholds.at(-1).name}-${shape}`);
|
|
166
|
+
return expr;
|
|
167
|
+
}
|
|
168
|
+
monitorTypeIconsLayer(sourceId, avgExpr, shape) {
|
|
169
|
+
const { icon } = this.clusterLayerIds(sourceId);
|
|
170
|
+
mapManager.map?.addLayer({
|
|
171
|
+
id: icon,
|
|
172
|
+
type: "symbol",
|
|
173
|
+
source: sourceId,
|
|
174
|
+
filter: ["has", "point_count"],
|
|
175
|
+
layout: {
|
|
176
|
+
"icon-image": this.buildClusterIconExpression(avgExpr, shape),
|
|
177
|
+
"icon-size": ["step", ["get", "point_count"], 1.3, 10, 1.6, 25, 2.0],
|
|
178
|
+
"icon-ignore-placement": true,
|
|
179
|
+
"icon-allow-overlap": true
|
|
180
|
+
},
|
|
181
|
+
paint: {
|
|
182
|
+
"icon-opacity": 0.8
|
|
183
|
+
}
|
|
184
|
+
}, this.ctx.beforeLayer);
|
|
185
|
+
}
|
|
186
|
+
clusterCountLayer(sourceId, avgExpr) {
|
|
187
|
+
const { average } = this.clusterLayerIds(sourceId);
|
|
188
|
+
mapManager.map?.addLayer({
|
|
189
|
+
id: average,
|
|
190
|
+
type: "symbol",
|
|
191
|
+
source: sourceId,
|
|
192
|
+
filter: ["has", "point_count"],
|
|
193
|
+
layout: {
|
|
194
|
+
"text-field": ["to-string", ["round", avgExpr]],
|
|
195
|
+
"text-size": 12,
|
|
196
|
+
"text-ignore-placement": true,
|
|
197
|
+
"text-allow-overlap": true
|
|
198
|
+
},
|
|
199
|
+
paint: {
|
|
200
|
+
"text-color": this.clusterTextColorExpr(avgExpr)
|
|
201
|
+
}
|
|
202
|
+
}, this.ctx.beforeLayer);
|
|
203
|
+
}
|
|
204
|
+
unclusteredLayer(sourceId) {
|
|
205
|
+
const { unclustered } = this.clusterLayerIds(sourceId);
|
|
206
|
+
mapManager.map?.addLayer({
|
|
207
|
+
id: unclustered,
|
|
208
|
+
type: "symbol",
|
|
209
|
+
source: sourceId,
|
|
210
|
+
filter: ["all", this.ctx.filters, ["!", ["has", "point_count"]]],
|
|
211
|
+
layout: {
|
|
212
|
+
"symbol-sort-key": ["coalesce", ["get", "order"], 0],
|
|
213
|
+
"icon-allow-overlap": true,
|
|
214
|
+
"icon-ignore-placement": true,
|
|
215
|
+
"icon-image": ["get", "icon"],
|
|
216
|
+
"icon-size": 1
|
|
217
|
+
},
|
|
218
|
+
paint: {}
|
|
219
|
+
}, this.ctx.beforeLayer);
|
|
220
|
+
}
|
|
24
221
|
}
|
|
25
|
-
var l = class {
|
|
26
|
-
ctx;
|
|
27
|
-
_clusterTypes = [];
|
|
28
|
-
constructor(e) {
|
|
29
|
-
this.ctx = e;
|
|
30
|
-
}
|
|
31
|
-
apply(e) {
|
|
32
|
-
if (!t.map) return;
|
|
33
|
-
let i = Object.entries(this.ctx.featuresByType).sort(([, e], [, t]) => {
|
|
34
|
-
let n = (e) => e.reduce((e, t) => Math.max(e, t.properties.order), 0);
|
|
35
|
-
return n(e) - n(t);
|
|
36
|
-
});
|
|
37
|
-
for (let [[a, l], u] of i.map((e, t) => [e, t])) {
|
|
38
|
-
let i = `${this.ctx.referenceId}-${a}`;
|
|
39
|
-
t.map.addSource(i, {
|
|
40
|
-
type: "geojson",
|
|
41
|
-
promoteId: "id",
|
|
42
|
-
data: {
|
|
43
|
-
type: "FeatureCollection",
|
|
44
|
-
features: l
|
|
45
|
-
},
|
|
46
|
-
cluster: !0,
|
|
47
|
-
clusterRadius: 40,
|
|
48
|
-
clusterMaxZoom: 9,
|
|
49
|
-
clusterProperties: { sumValues: [
|
|
50
|
-
"+",
|
|
51
|
-
["to-number", ["get", "value"]],
|
|
52
|
-
0
|
|
53
|
-
] }
|
|
54
|
-
}), this.monitorTypeIconsLayer(i, o, r(a)), this.clusterCountLayer(i, o), this.unclusteredLayer(i);
|
|
55
|
-
let { icon: d, unclustered: f } = this.clusterLayerIds(i);
|
|
56
|
-
this.ctx.tooltipManager.has(d) || this.ctx.tooltipManager.register(d, c, u), this.ctx.tooltipManager.has(f) || this.ctx.tooltipManager.register(f, s, u), n.register([f], e), n.register([d], this.makeClusterClickHandler(i)), this._clusterTypes.push(a);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
remove() {
|
|
60
|
-
if (t.map) {
|
|
61
|
-
for (let e of this._clusterTypes) {
|
|
62
|
-
let r = `${this.ctx.referenceId}-${e}`, i = this.clusterLayerIds(r);
|
|
63
|
-
n.unregister([i.unclustered]), n.unregister([i.icon]);
|
|
64
|
-
for (let e of Object.values(i)) t.map.getLayer(e) && t.map.removeLayer(e);
|
|
65
|
-
t.map.getSource(r) && t.map.removeSource(r);
|
|
66
|
-
}
|
|
67
|
-
this._clusterTypes = [];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
get unclusteredLayerIds() {
|
|
71
|
-
return this._clusterTypes.map((e) => `${this.ctx.referenceId}-${e}-unclustered`);
|
|
72
|
-
}
|
|
73
|
-
syncFeatures() {
|
|
74
|
-
if (t.map) for (let e of this._clusterTypes) {
|
|
75
|
-
let n = `${this.ctx.referenceId}-${e}`;
|
|
76
|
-
t.setDataSource(n, this.ctx.featuresByType[e] ?? []);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
syncFilter() {
|
|
80
|
-
if (t.map) for (let e of this._clusterTypes) {
|
|
81
|
-
let n = `${this.ctx.referenceId}-${e}`, { unclustered: r } = this.clusterLayerIds(n);
|
|
82
|
-
t.map.getLayer(r) && t.map.setFilter(r, [
|
|
83
|
-
"all",
|
|
84
|
-
this.ctx.filters,
|
|
85
|
-
["!", ["has", "point_count"]]
|
|
86
|
-
]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
syncThresholds() {
|
|
90
|
-
if (t.map) for (let e of this._clusterTypes) {
|
|
91
|
-
let n = `${this.ctx.referenceId}-${e}`, { icon: i, average: a } = this.clusterLayerIds(n);
|
|
92
|
-
t.map.getLayer(i) && t.map.setLayoutProperty(i, "icon-image", this.buildClusterIconExpression(o, r(e))), t.map.getLayer(a) && t.map.setPaintProperty(a, "text-color", this.clusterTextColorExpr(o));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
makeClusterClickHandler(e) {
|
|
96
|
-
return async (n) => {
|
|
97
|
-
try {
|
|
98
|
-
let r = n[0];
|
|
99
|
-
if (!r?.properties?.cluster_id) return;
|
|
100
|
-
let i = t.map?.getSource(e);
|
|
101
|
-
if (!i) return;
|
|
102
|
-
let a = await i.getClusterExpansionZoom(r.properties.cluster_id), o = r.geometry.coordinates;
|
|
103
|
-
t.map?.easeTo({
|
|
104
|
-
center: o,
|
|
105
|
-
zoom: a
|
|
106
|
-
});
|
|
107
|
-
} catch (e) {
|
|
108
|
-
console.error("ClickManager: cluster expansion zoom failed", e);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
clusterLayerIds(e) {
|
|
113
|
-
return {
|
|
114
|
-
icon: `${e}-cluster-icon`,
|
|
115
|
-
average: `${e}-cluster-average`,
|
|
116
|
-
unclustered: `${e}-unclustered`
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
get clusterTextColorThreshold() {
|
|
120
|
-
return this.ctx.clusterIconThresholds[2]?.range[1] ?? 150.5;
|
|
121
|
-
}
|
|
122
|
-
clusterTextColorExpr(e) {
|
|
123
|
-
return [
|
|
124
|
-
"case",
|
|
125
|
-
[
|
|
126
|
-
"<=",
|
|
127
|
-
e,
|
|
128
|
-
this.clusterTextColorThreshold
|
|
129
|
-
],
|
|
130
|
-
"#000000",
|
|
131
|
-
"#FFFFFF"
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
buildClusterIconExpression(e, t) {
|
|
135
|
-
let n = this.ctx.clusterIconThresholds;
|
|
136
|
-
if (!n.length) return `outside-default-${t}`;
|
|
137
|
-
let r = ["case"];
|
|
138
|
-
for (let i of n.slice(0, -1)) r.push([
|
|
139
|
-
"<=",
|
|
140
|
-
e,
|
|
141
|
-
i.range[1]
|
|
142
|
-
], `outside-${i.name}-${t}`);
|
|
143
|
-
return r.push(`outside-${n.at(-1).name}-${t}`), r;
|
|
144
|
-
}
|
|
145
|
-
monitorTypeIconsLayer(e, n, r) {
|
|
146
|
-
let { icon: i } = this.clusterLayerIds(e);
|
|
147
|
-
t.map?.addLayer({
|
|
148
|
-
id: i,
|
|
149
|
-
type: "symbol",
|
|
150
|
-
source: e,
|
|
151
|
-
filter: ["has", "point_count"],
|
|
152
|
-
layout: {
|
|
153
|
-
"icon-image": this.buildClusterIconExpression(n, r),
|
|
154
|
-
"icon-size": [
|
|
155
|
-
"step",
|
|
156
|
-
["get", "point_count"],
|
|
157
|
-
1.3,
|
|
158
|
-
10,
|
|
159
|
-
1.6,
|
|
160
|
-
25,
|
|
161
|
-
2
|
|
162
|
-
],
|
|
163
|
-
"icon-ignore-placement": !0,
|
|
164
|
-
"icon-allow-overlap": !0
|
|
165
|
-
},
|
|
166
|
-
paint: { "icon-opacity": .8 }
|
|
167
|
-
}, this.ctx.beforeLayer);
|
|
168
|
-
}
|
|
169
|
-
clusterCountLayer(e, n) {
|
|
170
|
-
let { average: r } = this.clusterLayerIds(e);
|
|
171
|
-
t.map?.addLayer({
|
|
172
|
-
id: r,
|
|
173
|
-
type: "symbol",
|
|
174
|
-
source: e,
|
|
175
|
-
filter: ["has", "point_count"],
|
|
176
|
-
layout: {
|
|
177
|
-
"text-field": ["to-string", ["round", n]],
|
|
178
|
-
"text-size": 12,
|
|
179
|
-
"text-ignore-placement": !0,
|
|
180
|
-
"text-allow-overlap": !0
|
|
181
|
-
},
|
|
182
|
-
paint: { "text-color": this.clusterTextColorExpr(n) }
|
|
183
|
-
}, this.ctx.beforeLayer);
|
|
184
|
-
}
|
|
185
|
-
unclusteredLayer(e) {
|
|
186
|
-
let { unclustered: n } = this.clusterLayerIds(e);
|
|
187
|
-
t.map?.addLayer({
|
|
188
|
-
id: n,
|
|
189
|
-
type: "symbol",
|
|
190
|
-
source: e,
|
|
191
|
-
filter: [
|
|
192
|
-
"all",
|
|
193
|
-
this.ctx.filters,
|
|
194
|
-
["!", ["has", "point_count"]]
|
|
195
|
-
],
|
|
196
|
-
layout: {
|
|
197
|
-
"symbol-sort-key": [
|
|
198
|
-
"coalesce",
|
|
199
|
-
["get", "order"],
|
|
200
|
-
0
|
|
201
|
-
],
|
|
202
|
-
"icon-allow-overlap": !0,
|
|
203
|
-
"icon-ignore-placement": !0,
|
|
204
|
-
"icon-image": ["get", "icon"],
|
|
205
|
-
"icon-size": 1
|
|
206
|
-
},
|
|
207
|
-
paint: {}
|
|
208
|
-
}, this.ctx.beforeLayer);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
//#endregion
|
|
212
|
-
export { l as MonitorsClusterRenderer, s as monitorTooltip };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MonitorData, SJVAirEntryLevel } from "@sjvair/sdk";
|
|
2
|
+
import { MapIconManager } from "../map/integrations/map-icon-manager.ts";
|
|
3
|
+
export declare function getIconId<T extends MonitorData>(monitor: T, level: SJVAirEntryLevel): string;
|
|
4
|
+
export declare abstract class MonitorShapeIconManager extends MapIconManager {
|
|
5
|
+
protected abstract get idPrefix(): string;
|
|
6
|
+
protected abstract transformSvg(svg: string): string;
|
|
7
|
+
protected get iconSize(): number;
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export declare class MonitorsIconManager extends MonitorShapeIconManager {
|
|
11
|
+
protected get idPrefix(): string;
|
|
12
|
+
protected transformSvg(svg: string): string;
|
|
13
|
+
}
|
|
@@ -1,71 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { asDataURI, circle, square, triangle } from "../map/icons.ts";
|
|
2
|
+
import { MapIconManager } from "../map/integrations/map-icon-manager.ts";
|
|
3
|
+
import { mapManager } from "../map/map.svelte.ts";
|
|
4
|
+
import { monitorsManager } from "./monitors.svelte.ts";
|
|
5
|
+
const MONITOR_ICONS = { circle, square, triangle };
|
|
6
|
+
const MONITOR_ICON_BORDER_WIDTH = 2;
|
|
7
|
+
const MONITOR_ICON_DEFAULT_COLOR = "#969696"; // light gray
|
|
8
|
+
const MONITOR_ICON_DISPLAY_COLOR = "#48c78e"; // light gray
|
|
9
|
+
export function getIconId(monitor, level) {
|
|
10
|
+
const id = `${monitor.location}-${monitor.is_active ? level.name : "default"}`;
|
|
11
|
+
switch (monitor.type) {
|
|
12
|
+
case "airgradient":
|
|
13
|
+
return `${id}-circle`;
|
|
14
|
+
case "airnow":
|
|
15
|
+
case "aqview":
|
|
16
|
+
case "bam1022":
|
|
17
|
+
return `${id}-triangle`;
|
|
18
|
+
case "purpleair":
|
|
19
|
+
return `${id}-${monitor.is_sjvair ? "circle" : "square"}`;
|
|
20
|
+
default:
|
|
21
|
+
throw new Error(`Map icon for ${monitor.device} has not been set`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class MonitorShapeIconManager extends MapIconManager {
|
|
25
|
+
get iconSize() {
|
|
26
|
+
return 24;
|
|
27
|
+
}
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
$effect.root(() => {
|
|
31
|
+
$effect(() => {
|
|
32
|
+
if (monitorsManager.levels) {
|
|
33
|
+
const iconLevels = [
|
|
34
|
+
...monitorsManager.levels,
|
|
35
|
+
{ name: "default", color: MONITOR_ICON_DEFAULT_COLOR },
|
|
36
|
+
{ name: "display", color: MONITOR_ICON_DISPLAY_COLOR }
|
|
37
|
+
];
|
|
38
|
+
for (const location of ["inside", "outside"]) {
|
|
39
|
+
for (const [shapeName, shape] of Object.entries(MONITOR_ICONS)) {
|
|
40
|
+
for (const level of iconLevels) {
|
|
41
|
+
const parts = [this.idPrefix, location, level.name, shapeName].filter(Boolean);
|
|
42
|
+
const id = parts.join("-");
|
|
43
|
+
const src = asDataURI(this.transformSvg(shape(level.color, MONITOR_ICON_BORDER_WIDTH, location === "inside" ? "#000000" : undefined)));
|
|
44
|
+
if (this.icons.has(id)) {
|
|
45
|
+
const icon = this.icons.get(id);
|
|
46
|
+
if (icon.image.src !== src) {
|
|
47
|
+
icon.image.src = src;
|
|
48
|
+
if (mapManager.map?.hasImage(id)) {
|
|
49
|
+
this.updateImage(icon, mapManager.map);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const icon = new Image();
|
|
56
|
+
icon.src = src;
|
|
57
|
+
icon.width = this.iconSize;
|
|
58
|
+
icon.height = this.iconSize;
|
|
59
|
+
this.register(id, icon);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export class MonitorsIconManager extends MonitorShapeIconManager {
|
|
70
|
+
get idPrefix() {
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
transformSvg(svg) {
|
|
74
|
+
return svg;
|
|
75
|
+
}
|
|
22
76
|
}
|
|
23
|
-
var p = class extends o {
|
|
24
|
-
get iconSize() {
|
|
25
|
-
return 24;
|
|
26
|
-
}
|
|
27
|
-
constructor() {
|
|
28
|
-
super(), s.effect_root(() => {
|
|
29
|
-
s.user_effect(() => {
|
|
30
|
-
if (t.levels) {
|
|
31
|
-
let r = [
|
|
32
|
-
...t.levels,
|
|
33
|
-
{
|
|
34
|
-
name: "default",
|
|
35
|
-
color: u
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "display",
|
|
39
|
-
color: d
|
|
40
|
-
}
|
|
41
|
-
];
|
|
42
|
-
for (let t of ["inside", "outside"]) for (let [i, a] of Object.entries(c)) for (let o of r) {
|
|
43
|
-
let r = [
|
|
44
|
-
this.idPrefix,
|
|
45
|
-
t,
|
|
46
|
-
o.name,
|
|
47
|
-
i
|
|
48
|
-
].filter(Boolean).join("-"), s = n(this.transformSvg(a(o.color, l, t === "inside" ? "#000000" : void 0)));
|
|
49
|
-
if (this.icons.has(r)) {
|
|
50
|
-
let t = this.icons.get(r);
|
|
51
|
-
t.image.src !== s && (t.image.src = s, e.map?.hasImage(r) && this.updateImage(t, e.map));
|
|
52
|
-
continue;
|
|
53
|
-
} else {
|
|
54
|
-
let e = new Image();
|
|
55
|
-
e.src = s, e.width = this.iconSize, e.height = this.iconSize, this.register(r, e);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, m = class extends p {
|
|
63
|
-
get idPrefix() {
|
|
64
|
-
return "";
|
|
65
|
-
}
|
|
66
|
-
transformSvg(e) {
|
|
67
|
-
return e;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
//#endregion
|
|
71
|
-
export { p as MonitorShapeIconManager, m as MonitorsIconManager, f as getIconId };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type FilterSpecification, type Map as MaptilerMap } from "@maptiler/sdk";
|
|
2
|
+
import type { SJVAirEntryLevel } from "@sjvair/sdk";
|
|
3
|
+
import { MapIconLayerIntegration } from "../map/integrations/map-geojson-integration.svelte.ts";
|
|
4
|
+
import { MonitorsIconManager } from "./monitors-icon-manager.svelte.ts";
|
|
5
|
+
import { TooltipManager } from "../map/integrations/tooltip.svelte.ts";
|
|
6
|
+
import { MapDisplayOption } from "../map/integrations/map-display-option.svelte.ts";
|
|
7
|
+
import type { MonitorMapFeature, MonitorMarkerProperties } from "./types.ts";
|
|
8
|
+
declare class MonitorsMapIntegration extends MapIconLayerIntegration<MonitorMarkerProperties> {
|
|
9
|
+
referenceId: string;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
clustered: boolean;
|
|
12
|
+
icons: MonitorsIconManager;
|
|
13
|
+
tooltipManager: TooltipManager;
|
|
14
|
+
private renderer;
|
|
15
|
+
displayOptions: {
|
|
16
|
+
purpleair: MapDisplayOption;
|
|
17
|
+
sjvair: MapDisplayOption;
|
|
18
|
+
aqview: MapDisplayOption;
|
|
19
|
+
bam1022: MapDisplayOption;
|
|
20
|
+
airnow: MapDisplayOption;
|
|
21
|
+
inactive: MapDisplayOption;
|
|
22
|
+
inside: MapDisplayOption;
|
|
23
|
+
};
|
|
24
|
+
/** Set by the app to handle navigation when a monitor is clicked. Receives the monitor ID. */
|
|
25
|
+
onMonitorClick: ((id: string) => void) | null;
|
|
26
|
+
selectedMonitorId: string | null;
|
|
27
|
+
private handleMonitorClick;
|
|
28
|
+
features: Array<MonitorMapFeature>;
|
|
29
|
+
filters: FilterSpecification;
|
|
30
|
+
featuresByType: Record<string, MonitorMapFeature[]>;
|
|
31
|
+
clusterIconThresholds: Array<SJVAirEntryLevel>;
|
|
32
|
+
get mapLayer(): Parameters<MaptilerMap["addLayer"]>[0];
|
|
33
|
+
get mapSource(): Parameters<MaptilerMap["addSource"]>[1];
|
|
34
|
+
constructor();
|
|
35
|
+
apply(): void;
|
|
36
|
+
remove(): void;
|
|
37
|
+
private applySelectedState;
|
|
38
|
+
}
|
|
39
|
+
export declare const monitorsMapIntegration: MonitorsMapIntegration;
|
|
40
|
+
export type { MonitorsMapIntegration };
|