@smartnet360/svelte-components 0.0.100 → 0.0.102
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/apps/site-check/SiteCheck.svelte +54 -272
- package/dist/apps/site-check/SiteCheckControls.svelte +294 -0
- package/dist/apps/site-check/SiteCheckControls.svelte.d.ts +30 -0
- package/dist/map-v2/demo/DemoMap.svelte +39 -7
- package/dist/map-v2/features/cells/utils/cellGeoJSON.js +1 -0
- package/dist/map-v2/shared/controls/FeatureSelectionControl.svelte +20 -25
- package/dist/map-v2/shared/controls/FeatureSelectionControl.svelte.d.ts +2 -4
- package/dist/map-v3/demo/DemoMap.svelte +31 -5
- package/dist/map-v3/demo/demo-cells.js +51 -22
- package/dist/map-v3/features/cells/layers/CellsLayer.svelte +29 -9
- package/dist/map-v3/features/cells/logic/geometry.js +3 -0
- package/dist/map-v3/features/cells/stores/cell.data.svelte.d.ts +27 -0
- package/dist/map-v3/features/cells/stores/cell.data.svelte.js +65 -0
- package/dist/map-v3/features/selection/components/FeatureSelectionControl.svelte +82 -65
- package/dist/map-v3/features/selection/components/FeatureSelectionControl.svelte.d.ts +5 -9
- package/dist/map-v3/features/selection/index.d.ts +1 -2
- package/dist/map-v3/features/selection/index.js +0 -1
- package/dist/map-v3/features/selection/stores/selection.store.svelte.d.ts +44 -15
- package/dist/map-v3/features/selection/stores/selection.store.svelte.js +163 -40
- package/dist/map-v3/features/selection/types.d.ts +4 -2
- package/dist/shared/ResizableSplitPanel.svelte +175 -0
- package/dist/shared/ResizableSplitPanel.svelte.d.ts +17 -0
- package/package.json +1 -1
- package/dist/map-v3/features/selection/layers/SelectionHighlightLayers.svelte +0 -209
- package/dist/map-v3/features/selection/layers/SelectionHighlightLayers.svelte.d.ts +0 -13
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
import type { MapStore } from '../../../core/stores/map.store.svelte';
|
|
4
|
-
import type { CellDataStore } from '../../cells/stores/cell.data.svelte';
|
|
5
|
-
import type { CellDisplayStore } from '../../cells/stores/cell.display.svelte';
|
|
6
|
-
import type { SelectedFeature } from '../types';
|
|
7
|
-
import { generateCellArc, calculateRadiusInMeters } from '../../cells/logic/geometry';
|
|
8
|
-
import type mapboxgl from 'mapbox-gl';
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
selectedFeatures: SelectedFeature[];
|
|
12
|
-
cellDataStore?: CellDataStore;
|
|
13
|
-
cellDisplayStore?: CellDisplayStore;
|
|
14
|
-
highlightColor?: string;
|
|
15
|
-
highlightWidth?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let {
|
|
19
|
-
selectedFeatures,
|
|
20
|
-
cellDataStore,
|
|
21
|
-
cellDisplayStore,
|
|
22
|
-
highlightColor = '#FF6B00',
|
|
23
|
-
highlightWidth = 4
|
|
24
|
-
}: Props = $props();
|
|
25
|
-
|
|
26
|
-
const mapStore = getContext<MapStore>('MAP_CONTEXT');
|
|
27
|
-
|
|
28
|
-
let cellsSourceId = 'cells-selection-source';
|
|
29
|
-
let cellsLayerId = 'cells-selection-highlight';
|
|
30
|
-
let sitesSourceId = 'sites-selection-source';
|
|
31
|
-
let sitesLayerId = 'sites-selection-highlight';
|
|
32
|
-
|
|
33
|
-
// Track current zoom level for radius calculation
|
|
34
|
-
let currentZoom = $state(13);
|
|
35
|
-
let centerLat = $state(0);
|
|
36
|
-
|
|
37
|
-
// Update zoom level when map changes
|
|
38
|
-
$effect(() => {
|
|
39
|
-
const map = mapStore.map;
|
|
40
|
-
if (!map) return;
|
|
41
|
-
|
|
42
|
-
const updateZoom = () => {
|
|
43
|
-
currentZoom = map.getZoom();
|
|
44
|
-
centerLat = map.getCenter().lat;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
updateZoom();
|
|
48
|
-
map.on('zoom', updateZoom);
|
|
49
|
-
map.on('move', updateZoom);
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
map.off('zoom', updateZoom);
|
|
53
|
-
map.off('move', updateZoom);
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Derive highlighted cells based on selected features
|
|
58
|
-
let highlightedCells = $derived.by(() => {
|
|
59
|
-
if (!cellDataStore) return [];
|
|
60
|
-
|
|
61
|
-
const cellIds = selectedFeatures
|
|
62
|
-
.filter(f => f.layerId === 'cells-layer')
|
|
63
|
-
.map(f => f.id);
|
|
64
|
-
|
|
65
|
-
if (cellIds.length === 0) return [];
|
|
66
|
-
|
|
67
|
-
return cellDataStore.filteredCells.filter(cell =>
|
|
68
|
-
cellIds.includes(cell.siteId) ||
|
|
69
|
-
cellIds.includes(cell.cellName) ||
|
|
70
|
-
cellIds.includes(cell.cellID)
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Derive highlighted sites based on selected features
|
|
75
|
-
// TODO: Add site highlighting when SiteDataStore is available
|
|
76
|
-
let highlightedSites = $derived.by(() => {
|
|
77
|
-
return [];
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Generate GeoJSON for cell highlights
|
|
81
|
-
let cellHighlightGeoJSON = $derived.by(() => {
|
|
82
|
-
if (!cellDisplayStore || highlightedCells.length === 0) {
|
|
83
|
-
return { type: 'FeatureCollection', features: [] };
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Calculate radius for current zoom level (same as CellsLayer does)
|
|
87
|
-
const radiusMeters = calculateRadiusInMeters(centerLat, currentZoom, cellDisplayStore.targetPixelSize);
|
|
88
|
-
|
|
89
|
-
const features = highlightedCells.map(cell =>
|
|
90
|
-
generateCellArc(cell, radiusMeters, 100, highlightColor)
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
type: 'FeatureCollection' as const,
|
|
95
|
-
features
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Generate GeoJSON for site highlights
|
|
100
|
-
let siteHighlightGeoJSON = $derived.by(() => {
|
|
101
|
-
if (highlightedSites.length === 0) {
|
|
102
|
-
return { type: 'FeatureCollection', features: [] };
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const features = highlightedSites.map((site: any) => ({
|
|
106
|
-
type: 'Feature' as const,
|
|
107
|
-
geometry: {
|
|
108
|
-
type: 'Point' as const,
|
|
109
|
-
coordinates: [site.longitude, site.latitude]
|
|
110
|
-
},
|
|
111
|
-
properties: { siteId: site.siteId }
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
type: 'FeatureCollection' as const,
|
|
116
|
-
features
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// Initialize and manage layers
|
|
121
|
-
$effect(() => {
|
|
122
|
-
const map = mapStore.map;
|
|
123
|
-
if (!map) return;
|
|
124
|
-
|
|
125
|
-
const addLayers = () => {
|
|
126
|
-
// Cell Selection Highlight Layer
|
|
127
|
-
if (!map.getSource(cellsSourceId)) {
|
|
128
|
-
map.addSource(cellsSourceId, {
|
|
129
|
-
type: 'geojson',
|
|
130
|
-
data: { type: 'FeatureCollection', features: [] }
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (!map.getLayer(cellsLayerId)) {
|
|
135
|
-
map.addLayer({
|
|
136
|
-
id: cellsLayerId,
|
|
137
|
-
type: 'line',
|
|
138
|
-
source: cellsSourceId,
|
|
139
|
-
paint: {
|
|
140
|
-
'line-color': highlightColor,
|
|
141
|
-
'line-width': highlightWidth,
|
|
142
|
-
'line-opacity': 1
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Site Selection Highlight Layer
|
|
148
|
-
if (!map.getSource(sitesSourceId)) {
|
|
149
|
-
map.addSource(sitesSourceId, {
|
|
150
|
-
type: 'geojson',
|
|
151
|
-
data: { type: 'FeatureCollection', features: [] }
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!map.getLayer(sitesLayerId)) {
|
|
156
|
-
map.addLayer({
|
|
157
|
-
id: sitesLayerId,
|
|
158
|
-
type: 'circle',
|
|
159
|
-
source: sitesSourceId,
|
|
160
|
-
paint: {
|
|
161
|
-
'circle-radius': 12,
|
|
162
|
-
'circle-color': 'transparent',
|
|
163
|
-
'circle-stroke-color': highlightColor,
|
|
164
|
-
'circle-stroke-width': highlightWidth,
|
|
165
|
-
'circle-stroke-opacity': 1
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
// Initial setup
|
|
172
|
-
addLayers();
|
|
173
|
-
|
|
174
|
-
// Events
|
|
175
|
-
map.on('style.load', addLayers);
|
|
176
|
-
|
|
177
|
-
// Cleanup
|
|
178
|
-
return () => {
|
|
179
|
-
map.off('style.load', addLayers);
|
|
180
|
-
|
|
181
|
-
if (map.getLayer(cellsLayerId)) map.removeLayer(cellsLayerId);
|
|
182
|
-
if (map.getLayer(sitesLayerId)) map.removeLayer(sitesLayerId);
|
|
183
|
-
if (map.getSource(cellsSourceId)) map.removeSource(cellsSourceId);
|
|
184
|
-
if (map.getSource(sitesSourceId)) map.removeSource(sitesSourceId);
|
|
185
|
-
};
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// Update cell highlight source
|
|
189
|
-
$effect(() => {
|
|
190
|
-
const map = mapStore.map;
|
|
191
|
-
if (!map) return;
|
|
192
|
-
|
|
193
|
-
const source = map.getSource(cellsSourceId) as mapboxgl.GeoJSONSource;
|
|
194
|
-
if (source) {
|
|
195
|
-
source.setData(cellHighlightGeoJSON as any);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// Update site highlight source
|
|
200
|
-
$effect(() => {
|
|
201
|
-
const map = mapStore.map;
|
|
202
|
-
if (!map) return;
|
|
203
|
-
|
|
204
|
-
const source = map.getSource(sitesSourceId) as mapboxgl.GeoJSONSource;
|
|
205
|
-
if (source) {
|
|
206
|
-
source.setData(siteHighlightGeoJSON as any);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
</script>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CellDataStore } from '../../cells/stores/cell.data.svelte';
|
|
2
|
-
import type { CellDisplayStore } from '../../cells/stores/cell.display.svelte';
|
|
3
|
-
import type { SelectedFeature } from '../types';
|
|
4
|
-
interface Props {
|
|
5
|
-
selectedFeatures: SelectedFeature[];
|
|
6
|
-
cellDataStore?: CellDataStore;
|
|
7
|
-
cellDisplayStore?: CellDisplayStore;
|
|
8
|
-
highlightColor?: string;
|
|
9
|
-
highlightWidth?: number;
|
|
10
|
-
}
|
|
11
|
-
declare const SelectionHighlightLayers: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type SelectionHighlightLayers = ReturnType<typeof SelectionHighlightLayers>;
|
|
13
|
-
export default SelectionHighlightLayers;
|