@ndwnu/map 0.0.1-beta.1 → 0.0.1-beta.2
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/README.md +297 -4
- package/fesm2022/ndwnu-map.mjs +43 -14
- package/fesm2022/ndwnu-map.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/map/map-config.interface.d.ts +34 -0
- package/lib/map/map.component.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,300 @@
|
|
|
1
|
-
# map
|
|
1
|
+
# @ndwnu/map
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A facade pattern library for MapLibre GL that simplifies the management of complex map sources and layers. Built by NDW (Nationaal Dataportaan Wegverkeer) for easier development with MapLibre.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This library provides a structured approach to managing MapLibre GL maps by introducing the **MapElement** pattern - a container that groups related sources and layers as a single logical unit. MapElements use a generic type (typically an enum) for identification. Instead of managing individual MapLibre sources and layers, you work with MapElements that can be toggled on/off from the UI perspective while handling multiple underlying sources and layers automatically.
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **MapElement Pattern**: Groups multiple sources and layers into logical units
|
|
12
|
+
- **Visibility Management**: Easy show/hide functionality for complex map elements
|
|
13
|
+
- **Repository Pattern**: Centralized management of all map elements
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @ndwnu/map maplibre-gl
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### CSS Setup
|
|
22
|
+
|
|
23
|
+
Add MapLibre GL CSS to your `angular.json` styles array:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"styles": ["node_modules/maplibre-gl/dist/maplibre-gl.css"]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Development Process
|
|
32
|
+
|
|
33
|
+
### 1. Create Map Elements
|
|
34
|
+
|
|
35
|
+
Create a folder structure for your map elements and define an enum for element identification:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// map-element.enum.ts
|
|
39
|
+
export enum MapElementEnum {
|
|
40
|
+
MyElement = 'my-element',
|
|
41
|
+
AnotherElement = 'another-element',
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
src/
|
|
47
|
+
map-elements/
|
|
48
|
+
map-element.enum.ts
|
|
49
|
+
my-element/
|
|
50
|
+
my-element.element.ts
|
|
51
|
+
my-element.source.ts
|
|
52
|
+
my-element.layer.ts
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Example MapElement:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { MapElement, MapElementConfig, MapSource } from '@ndwnu/map';
|
|
59
|
+
import { MapElementEnum } from '../map-element.enum';
|
|
60
|
+
|
|
61
|
+
export class MyElement extends MapElement<MapElementEnum> {
|
|
62
|
+
constructor(config: MapElementConfig<MapElementEnum>) {
|
|
63
|
+
super(config);
|
|
64
|
+
this.sources = [new MyElementSource(config)];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Create Element Repository
|
|
70
|
+
|
|
71
|
+
Extend the MapElementRepository to manage your elements:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { Injectable } from '@angular/core';
|
|
75
|
+
import { MapElementRepository } from '@ndwnu/map';
|
|
76
|
+
import { Map } from 'maplibre-gl';
|
|
77
|
+
import { MapElementEnum } from './map-element.enum';
|
|
78
|
+
|
|
79
|
+
@Injectable({ providedIn: 'root' })
|
|
80
|
+
export class MyMapElementRepository extends MapElementRepository<MapElementEnum> {
|
|
81
|
+
registerMapElements(map: Map) {
|
|
82
|
+
const config = {
|
|
83
|
+
map,
|
|
84
|
+
mapElementRepository: this,
|
|
85
|
+
maplibreCursorService: this.maplibreCursorService,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
[
|
|
89
|
+
new MyElement({ ...config, elementId: MapElementEnum.MyElement, elementOrder: 0 }),
|
|
90
|
+
// Add more elements...
|
|
91
|
+
].forEach((element) => this.addMapElement(element));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 3. Create Map Component
|
|
97
|
+
|
|
98
|
+
Extend the base MapComponent and optionally provide configuration:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Component, inject } from '@angular/core';
|
|
102
|
+
import { MapComponent, MapConfig } from '@ndwnu/map';
|
|
103
|
+
import { MyMapElementRepository } from './map-elements/my-map-element.repository';
|
|
104
|
+
|
|
105
|
+
@Component({
|
|
106
|
+
selector: 'app-map',
|
|
107
|
+
template: `<div class="map-container"><!-- Map renders here --></div>`,
|
|
108
|
+
styleUrls: ['./map.component.scss'],
|
|
109
|
+
})
|
|
110
|
+
export class MyMapComponent extends MapComponent {
|
|
111
|
+
readonly #repository = inject(MyMapElementRepository);
|
|
112
|
+
|
|
113
|
+
protected onLoadMap() {
|
|
114
|
+
this.#repository.registerMapElements(this.map);
|
|
115
|
+
// Show initial elements
|
|
116
|
+
this.#repository.showMapElement(MapElementEnum.MyElement);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
protected onRemoveMap() {
|
|
120
|
+
this.#repository.removeAllMapElements();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
protected onIdle() {
|
|
124
|
+
// Handle map idle events
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
toggleElement(elementId: MapElementEnum) {
|
|
128
|
+
this.#repository.toggleMapElement(elementId);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 4. Configure Map (Optional)
|
|
134
|
+
|
|
135
|
+
You can customize the map behavior by passing a configuration object:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
// In your parent component template
|
|
139
|
+
@Component({
|
|
140
|
+
template: ` <app-map [config]="mapConfig"></app-map> `,
|
|
141
|
+
})
|
|
142
|
+
export class ParentComponent {
|
|
143
|
+
mapConfig: Partial<MapConfig> = {
|
|
144
|
+
maxZoom: 20,
|
|
145
|
+
minZoom: 8,
|
|
146
|
+
dragRotate: true,
|
|
147
|
+
center: [5.387827, 52.155172],
|
|
148
|
+
zoom: 12,
|
|
149
|
+
scrollZoom: false, // Disable scroll zoom
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Available configuration options:
|
|
155
|
+
|
|
156
|
+
- `center`: Initial map center position
|
|
157
|
+
- `zoom`: Initial zoom level
|
|
158
|
+
- `maxZoom`/`minZoom`: Zoom level constraints
|
|
159
|
+
- `bounds`: Initial bounds to fit (overrides center/zoom if provided)
|
|
160
|
+
- `interactive`: Enable/disable all interactions
|
|
161
|
+
- `dragRotate`: Enable/disable rotation via drag
|
|
162
|
+
- `doubleClickZoom`: Enable/disable double-click zoom
|
|
163
|
+
- `scrollZoom`: Enable/disable scroll wheel zoom
|
|
164
|
+
- `boxZoom`: Enable/disable shift+drag box zoom
|
|
165
|
+
- `dragPan`: Enable/disable drag to pan
|
|
166
|
+
- `keyboard`: Enable/disable keyboard navigation
|
|
167
|
+
- `touchZoomRotate`: Enable/disable touch gestures
|
|
168
|
+
|
|
169
|
+
**Note**: If `bounds` is provided, it will override `center` and `zoom` settings.
|
|
170
|
+
|
|
171
|
+
You can use predefined bounds:
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
import { COMMON_BOUNDS } from '@ndwnu/map';
|
|
175
|
+
|
|
176
|
+
mapConfig: Partial<MapConfig> = {
|
|
177
|
+
bounds: COMMON_BOUNDS.NETHERLANDS, // or COMMON_BOUNDS.AMERSFOORT
|
|
178
|
+
maxZoom: 20,
|
|
179
|
+
dragRotate: true,
|
|
180
|
+
};
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 5. Component Styling
|
|
184
|
+
|
|
185
|
+
**Important**: Set a height for your map component:
|
|
186
|
+
|
|
187
|
+
```css
|
|
188
|
+
.map-container {
|
|
189
|
+
height: 500px; /* or 100vh for full viewport */
|
|
190
|
+
width: 100%;
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 6. Register Map Elements
|
|
195
|
+
|
|
196
|
+
In your `onLoadMap()` method, call `registerMapElements()` to initialize all map elements:
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
protected onLoadMap() {
|
|
200
|
+
this.#repository.registerMapElements(this.map);
|
|
201
|
+
// Set initial visibility
|
|
202
|
+
this.#repository.showMapElement(MapElementEnum.MyElement);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Filtering in MapLibre
|
|
207
|
+
|
|
208
|
+
When working with MapLibre, filters need to be applied to each individual layer, while the filter 'shape' (structure) is tied to the source data. To implement filtering with the current architecture:
|
|
209
|
+
|
|
210
|
+
1. **Provide filter observables** to your MapElement
|
|
211
|
+
2. **Pass filters to sources** during initialization
|
|
212
|
+
3. **Apply filters to layers** within each source's layer definitions
|
|
213
|
+
|
|
214
|
+
Example implementation:
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
// In your MapElement
|
|
218
|
+
export class MyElement extends MapElement<MapElementEnum> {
|
|
219
|
+
constructor(
|
|
220
|
+
config: MapElementConfig<MapElementEnum>,
|
|
221
|
+
private filters$: Observable<FilterObject>,
|
|
222
|
+
) {
|
|
223
|
+
super(config);
|
|
224
|
+
this.sources = [new MyElementSource(config, filters$)];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// In your MapSource
|
|
229
|
+
export class MyElementSource extends MapSource<MapElementEnum> {
|
|
230
|
+
constructor(
|
|
231
|
+
config: MapElementConfig<MapElementEnum>,
|
|
232
|
+
private filters$: Observable<FilterObject>,
|
|
233
|
+
) {
|
|
234
|
+
super(config);
|
|
235
|
+
// Subscribe to filter changes and update layers
|
|
236
|
+
this.filters$.subscribe((filters) => this.updateLayerFilters(filters));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private updateLayerFilters(filters: FilterObject) {
|
|
240
|
+
// Apply filters to each layer in this source
|
|
241
|
+
this.layers.forEach((layer) => {
|
|
242
|
+
layer.applyFilter(filters);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Note**: Filter management may be included in future versions of this library to provide a more streamlined filtering experience.
|
|
249
|
+
|
|
250
|
+
## Example Usage
|
|
251
|
+
|
|
252
|
+
See the [playground application](../../apps/playground/src/app/pages/map) for a complete implementation example.
|
|
253
|
+
|
|
254
|
+
## API
|
|
255
|
+
|
|
256
|
+
### MapComponent (Abstract)
|
|
257
|
+
|
|
258
|
+
Base component that provides MapLibre integration.
|
|
259
|
+
|
|
260
|
+
**Methods:**
|
|
261
|
+
|
|
262
|
+
- `resizeMap()`: Resize the map to fit container
|
|
263
|
+
- `zoomToLevel(level: number, options?)`: Zoom to specific level
|
|
264
|
+
|
|
265
|
+
**Abstract Methods:**
|
|
266
|
+
|
|
267
|
+
- `onLoadMap()`: Called when map is loaded
|
|
268
|
+
- `onRemoveMap()`: Called before map destruction
|
|
269
|
+
- `onIdle()`: Called when map becomes idle
|
|
270
|
+
|
|
271
|
+
### MapElementRepository<T> (Abstract)
|
|
272
|
+
|
|
273
|
+
Manages collection of map elements.
|
|
274
|
+
|
|
275
|
+
**Methods:**
|
|
276
|
+
|
|
277
|
+
- `addMapElement(element)`: Add element to repository
|
|
278
|
+
- `removeMapElement(element)`: Remove and destroy element
|
|
279
|
+
- `showMapElement(id)`: Make element visible
|
|
280
|
+
- `hideMapElement(id)`: Hide element
|
|
281
|
+
- `toggleMapElement(id)`: Toggle element visibility
|
|
282
|
+
|
|
283
|
+
### MapElement<T> (Abstract)
|
|
284
|
+
|
|
285
|
+
Container for related sources and layers.
|
|
286
|
+
|
|
287
|
+
**Properties:**
|
|
288
|
+
|
|
289
|
+
- `id`: Unique identifier
|
|
290
|
+
- `elementOrder`: Display order
|
|
291
|
+
- `sources`: Array of MapSource instances
|
|
292
|
+
- `isVisible`: Current visibility state
|
|
293
|
+
|
|
294
|
+
## License
|
|
295
|
+
|
|
296
|
+
MIT
|
|
297
|
+
|
|
298
|
+
## About NDW
|
|
299
|
+
|
|
300
|
+
NDW (Nationaal Dataportaan Wegverkeer) - Data from and about road traffic are our core business. We collect, monitor quality, enrich data, store it and make it available.
|
package/fesm2022/ndwnu-map.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BehaviorSubject, map, Subject, takeUntil } from 'rxjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { viewChild, Component, ChangeDetectionStrategy, Injectable } from '@angular/core';
|
|
3
|
+
import { viewChild, input, Component, ChangeDetectionStrategy, Injectable } from '@angular/core';
|
|
4
4
|
import { Map } from 'maplibre-gl';
|
|
5
5
|
|
|
6
6
|
const BOUNDS_NL = [
|
|
@@ -12,6 +12,32 @@ const BOUNDS_AMERSFOORT = [
|
|
|
12
12
|
[5.446205917577942, 52.21132028216525],
|
|
13
13
|
];
|
|
14
14
|
|
|
15
|
+
const DEFAULT_MAP_CONFIG = {
|
|
16
|
+
center: [5.387827, 52.155172],
|
|
17
|
+
zoom: 8,
|
|
18
|
+
maxZoom: 18,
|
|
19
|
+
minZoom: 6,
|
|
20
|
+
interactive: true,
|
|
21
|
+
dragRotate: false,
|
|
22
|
+
doubleClickZoom: true,
|
|
23
|
+
scrollZoom: true,
|
|
24
|
+
boxZoom: true,
|
|
25
|
+
dragPan: true,
|
|
26
|
+
keyboard: true,
|
|
27
|
+
touchZoomRotate: true,
|
|
28
|
+
};
|
|
29
|
+
// Common bounds that users can optionally use
|
|
30
|
+
const COMMON_BOUNDS = {
|
|
31
|
+
NETHERLANDS: [
|
|
32
|
+
[3.079667, 50.587611],
|
|
33
|
+
[7.572028, 53.636667],
|
|
34
|
+
],
|
|
35
|
+
AMERSFOORT: [
|
|
36
|
+
[5.34458238242172, 52.11623605695118],
|
|
37
|
+
[5.446205917577942, 52.21132028216525],
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
|
|
15
41
|
/**
|
|
16
42
|
* Repository for managing map elements.
|
|
17
43
|
* Provides methods to add, remove, show, hide, and toggle map elements.
|
|
@@ -348,6 +374,7 @@ class MapSource {
|
|
|
348
374
|
|
|
349
375
|
class MapComponent {
|
|
350
376
|
mapContainer = viewChild.required('mapContainer');
|
|
377
|
+
config = input({});
|
|
351
378
|
map;
|
|
352
379
|
ngAfterViewInit() {
|
|
353
380
|
this.map = this.#createMap(this.mapContainer().nativeElement);
|
|
@@ -368,23 +395,25 @@ class MapComponent {
|
|
|
368
395
|
this.map?.zoomTo(zoomLevel, options);
|
|
369
396
|
}
|
|
370
397
|
#createMap(container) {
|
|
371
|
-
const
|
|
398
|
+
const config = { ...DEFAULT_MAP_CONFIG, ...this.config() };
|
|
399
|
+
const options = {
|
|
372
400
|
container,
|
|
373
401
|
style: {
|
|
374
402
|
version: 8,
|
|
375
403
|
sources: {},
|
|
376
404
|
layers: [],
|
|
377
405
|
},
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
406
|
+
maxZoom: config.maxZoom,
|
|
407
|
+
minZoom: config.minZoom,
|
|
408
|
+
interactive: config.interactive,
|
|
409
|
+
doubleClickZoom: config.doubleClickZoom,
|
|
410
|
+
scrollZoom: config.scrollZoom,
|
|
411
|
+
boxZoom: config.boxZoom,
|
|
412
|
+
dragPan: config.dragPan,
|
|
413
|
+
keyboard: config.keyboard,
|
|
414
|
+
touchZoomRotate: config.touchZoomRotate,
|
|
415
|
+
};
|
|
416
|
+
const map = new Map(options);
|
|
388
417
|
return map;
|
|
389
418
|
}
|
|
390
419
|
#initiateMapLoading() {
|
|
@@ -392,7 +421,7 @@ class MapComponent {
|
|
|
392
421
|
this.resizeMap();
|
|
393
422
|
}
|
|
394
423
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: MapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
395
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.7", type: MapComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "mapContainer", first: true, predicate: ["mapContainer"], descendants: true, isSignal: true }], ngImport: i0, template: '<div #mapContainer class="map"></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
424
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.7", type: MapComponent, isStandalone: true, selector: "ng-component", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mapContainer", first: true, predicate: ["mapContainer"], descendants: true, isSignal: true }], ngImport: i0, template: '<div #mapContainer class="map"></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
396
425
|
}
|
|
397
426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: MapComponent, decorators: [{
|
|
398
427
|
type: Component,
|
|
@@ -499,5 +528,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
499
528
|
* Generated bundle index. Do not edit.
|
|
500
529
|
*/
|
|
501
530
|
|
|
502
|
-
export { BOUNDS_AMERSFOORT, BOUNDS_NL, MapComponent, MapElement, MapElementRepository, MapLayer, MapSource, MaplibreCursorService };
|
|
531
|
+
export { BOUNDS_AMERSFOORT, BOUNDS_NL, COMMON_BOUNDS, DEFAULT_MAP_CONFIG, MapComponent, MapElement, MapElementRepository, MapLayer, MapSource, MaplibreCursorService };
|
|
503
532
|
//# sourceMappingURL=ndwnu-map.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndwnu-map.mjs","sources":["../../../../libs/map/src/lib/map/map-constants.ts","../../../../libs/map/src/lib/map/map-element.repository.ts","../../../../libs/map/src/lib/map/map-element.ts","../../../../libs/map/src/lib/map/map-layer.ts","../../../../libs/map/src/lib/map/map-source.ts","../../../../libs/map/src/lib/map/map.component.ts","../../../../libs/map/src/lib/map/maplibre-cursor.service.ts","../../../../libs/map/src/ndwnu-map.ts"],"sourcesContent":["import { LngLatLike } from 'maplibre-gl';\n\nexport const BOUNDS_NL: [LngLatLike, LngLatLike] = [\n [3.079667, 50.587611],\n [7.572028, 53.636667],\n];\nexport const BOUNDS_AMERSFOORT: [LngLatLike, LngLatLike] = [\n [5.34458238242172, 52.11623605695118],\n [5.446205917577942, 52.21132028216525],\n];\n","import { BehaviorSubject, map } from 'rxjs';\n\nimport { MapElement } from './map-element';\n\n/**\n * Repository for managing map elements.\n * Provides methods to add, remove, show, hide, and toggle map elements.\n * Also tracks element visibility state and provides observable streams for elements.\n *\n * @typeparam TElementType - The type of ID used for the map elements\n */\nexport abstract class MapElementRepository<TElementType> {\n /** Subject that holds the current array of map elements */\n private readonly mapElementsSubject = new BehaviorSubject<MapElement<TElementType>[]>([]);\n\n // mapElements are not directly exposed to prevent circular reference errors when\n // they are used in a template. Because the mapElements$ observable contains MapLibre\n // GL JS map objects, which have circular references.\n\n /** Observable stream of all map elements */\n private readonly mapElements$ = this.mapElementsSubject.asObservable();\n\n /** Observable stream of only visible map elements */\n private readonly visibleMapElements$ = this.mapElements$.pipe(\n map((elements) => elements.filter((element) => element.isVisible)),\n );\n\n /**\n * Gets the ids (TElementType) as an array of all map element\n * @returns Array of TElementType\n */\n mapElementIds$ = this.mapElements$.pipe(map((elements) => elements.map((element) => element.id)));\n\n /**\n * Gets the ids (TElementType) as an array of all visible map element\n * @returns Array of TElementType\n */\n visibleMapElementIds$ = this.visibleMapElements$.pipe(\n map((elements) => elements.map((element) => element.id)),\n );\n\n /**\n * Gets the current array of all map elements\n * @returns Array of map elements\n */\n get mapElements(): MapElement<TElementType>[] {\n return this.mapElementsSubject.getValue();\n }\n\n /**\n * Gets only the currently visible map elements\n * @returns Array of visible map elements\n */\n get visibleMapElements(): MapElement<TElementType>[] {\n return this.mapElements.filter((element) => element.isVisible);\n }\n\n /**\n * Finds a map element by its ID\n *\n * @param elementId - The ID of the element to find\n * @returns The map element if found, undefined otherwise\n */\n getMapElementById(elementId: TElementType): MapElement<TElementType> | undefined {\n return this.mapElements.find((element) => element.id === elementId);\n }\n\n /**\n * Checks if a map element is currently visible\n *\n * @param elementId - The ID of the element to check\n * @returns True if the element is visible, false otherwise\n */\n isMapElementVisible(elementId: TElementType): boolean {\n return this.visibleMapElements.some((element) => element.id === elementId);\n }\n\n /**\n * Adds a new map element to the repository and initializes it.\n * Sets the element's visibility based on its configuration.\n *\n * @param mapElement - The map element to add\n */\n addMapElement(mapElement: MapElement<TElementType>) {\n const currentElements = this.mapElements;\n this.mapElementsSubject.next([...currentElements, mapElement]);\n mapElement.onInit();\n if (mapElement.alwaysVisible || this.isMapElementVisible(mapElement.id)) {\n this.showMapElement(mapElement.id);\n } else {\n this.hideMapElement(mapElement.id);\n }\n }\n\n /**\n * Removes a map element from the repository and destroys it.\n *\n * @param mapElement - The map element to remove\n */\n removeMapElement(mapElement: MapElement<TElementType>) {\n const filteredElements = this.mapElements.filter((element) => element.id !== mapElement.id);\n this.mapElementsSubject.next(filteredElements);\n mapElement.onDestroy();\n }\n\n /**\n * Removes all map elements from the repository and destroys them.\n */\n removeAllMapElements() {\n this.mapElements.forEach((element) => {\n this.removeMapElement(element);\n });\n }\n\n /**\n * Sets the visibility of a map element by its ID and updates the subject with the new state.\n *\n * @param elementId - The ID of the element to update\n * @param visible - Whether the element should be visible or hidden\n */\n private setMapElementVisibility(elementId: TElementType, visible: boolean) {\n const element = this.getMapElementById(elementId);\n if (element) {\n element.setVisible(visible);\n const elements = this.mapElements.filter((el) => el.id !== elementId);\n this.mapElementsSubject.next([...elements, element]);\n }\n }\n\n /**\n * Shows a map element by its ID and updates the subject with the new state.\n *\n * @param elementId - The ID of the element to show\n */\n showMapElement(elementId: TElementType) {\n this.setMapElementVisibility(elementId, true);\n }\n\n /**\n * Hides a map element by its ID and updates the subject with the new state.\n *\n * @param elementId - The ID of the element to hide\n */\n hideMapElement(elementId: TElementType) {\n this.setMapElementVisibility(elementId, false);\n }\n\n /**\n * Toggles the visibility of a map element by its ID.\n * If the element is currently visible, it will be hidden, and vice versa.\n *\n * @param elementId - The ID of the element to toggle visibility\n */\n toggleMapElement(elementId: TElementType) {\n if (this.visibleMapElements.some((element) => element.id === elementId)) {\n this.hideMapElement(elementId);\n } else {\n this.showMapElement(elementId);\n }\n }\n\n /**\n * Gets the ID of the layer that should come before the specified element's layers\n * in the map's layer stack. This is used for maintaining proper layer ordering.\n *\n * @param elementId - The ID of the element to find a \"before\" reference for\n * @returns The ID of the first layer of the next element in order, or undefined if none exists\n */\n getBeforeId(elementId: TElementType): string | undefined {\n const currentElement = this.getMapElementById(elementId);\n if (!currentElement) {\n return undefined;\n }\n\n const nextElement = this.mapElements\n .filter((item) => item.elementOrder > currentElement.elementOrder)\n .sort((a, b) => a.elementOrder - b.elementOrder)[0];\n\n const nextElementLayerIds = nextElement?.sources\n .flatMap((source) => source.layers)\n .filter((layer) => layer.initialized)\n .map((layer) => layer.id);\n\n return nextElement && nextElementLayerIds.length > 0 ? nextElementLayerIds[0] : undefined;\n }\n}\n","import { Map } from 'maplibre-gl';\nimport { Subject } from 'rxjs';\n\nimport { MapElementRepository } from './map-element.repository';\nimport { MapSource } from './map-source';\nimport { MaplibreCursorService } from './maplibre-cursor.service';\n\nexport interface MapElementConfig<TElementType> {\n map: Map;\n mapElementRepository: MapElementRepository<TElementType>;\n maplibreCursorService: MaplibreCursorService;\n elementId: TElementType;\n elementOrder: number;\n}\n\nexport abstract class MapElement<TElementType> {\n id: TElementType;\n elementOrder: number;\n sources: MapSource<TElementType>[] = [];\n alwaysVisible = false;\n isVisible = false;\n\n protected unsubscribe = new Subject<void>();\n\n constructor(protected readonly config: MapElementConfig<TElementType>) {\n this.id = config.elementId;\n this.elementOrder = config.elementOrder;\n }\n\n onInit() {\n this.sources.forEach((source) => source.onInit());\n }\n\n onDestroy() {\n this.sources.forEach((source) => source.onDestroy());\n\n this.unsubscribe.next();\n this.unsubscribe.complete();\n }\n\n setVisible(visible: boolean) {\n this.isVisible = visible;\n this.sources.forEach((source) => source.setVisible(visible));\n }\n}\n","import { Feature } from 'geojson';\nimport { MapElementConfig } from './map-element';\nimport {\n FilterSpecification,\n LayerSpecification,\n MapGeoJSONFeature,\n MapMouseEvent,\n} from 'maplibre-gl';\nimport { Subject } from 'rxjs';\n\nexport abstract class MapLayer<TElementType> {\n initialized = false;\n\n protected unsubscribe = new Subject<void>();\n\n constructor(\n protected readonly config: MapElementConfig<TElementType>,\n protected readonly sourceId: string,\n protected readonly layerIdSuffix?: string,\n ) {}\n\n get id(): string {\n const suffix = this.layerIdSuffix ? `-${this.layerIdSuffix}` : '';\n return `${this.sourceId}${suffix}`;\n }\n\n get styleLayer() {\n return this.config.map.getLayer(this.id);\n }\n\n onInit() {\n // Add the layer to the map, with the correct ordering (beforeId)\n const beforeId = this.config.mapElementRepository.getBeforeId(this.config.elementId);\n this.config.map.addLayer(this.getSpecification() as LayerSpecification, beforeId);\n\n // Keeping track of which layers have been added to the map to allow for beforeId determination\n this.#setupClickHandlers();\n this.initialized = true;\n }\n\n onDestroy() {\n this.initialized = false;\n this.#removeClickHandlers();\n\n this.config.map.removeLayer(this.id);\n\n this.unsubscribe.next();\n this.unsubscribe.complete();\n }\n\n setVisible(visible: boolean) {\n this.config.map.setLayoutProperty(this.id, 'visibility', visible ? 'visible' : 'none');\n }\n\n protected onClick?(features: Feature[]): void;\n\n protected abstract getSpecification(): Partial<LayerSpecification>;\n getFilterSpecification?(): FilterSpecification;\n\n #setupClickHandlers() {\n if (!this.onClick) return;\n\n this.config.map.on('click', this.id, (event) => {\n this.onClick?.(this.#getFeatures(event));\n });\n\n this.config.maplibreCursorService.setMouseCursor(this.config.map, this.id);\n }\n\n #removeClickHandlers() {\n if (!this.onClick) return;\n\n this.config.map.off('click', this.id, (event) => {\n this.onClick?.(this.#getFeatures(event));\n });\n }\n\n #getFeatures(event: ClickEvent): Feature[] {\n if (event.features && event.features.length > 0) {\n return this.#distinctFeatures(event.features);\n }\n return [];\n }\n\n /**\n * Filters an array of features to remove duplicates based on their properties.\n * Two features are considered duplicates if they have identical properties.\n * Particularly vector sources can yield duplicate features due to the way they\n * are rendered in tiles.\n *\n * @param features - Array of GeoJSON features to filter\n * @returns Array of unique features with no property duplicates\n * @private\n */\n #distinctFeatures(features: Feature[]): Feature[] {\n const seen = new Set();\n const uniqueFeatures: Feature[] = [];\n\n features.forEach((feature) => {\n const propertiesString = JSON.stringify(feature.properties);\n if (!seen.has(propertiesString)) {\n seen.add(propertiesString);\n uniqueFeatures.push(feature);\n }\n });\n\n return uniqueFeatures;\n }\n}\n\nexport type ClickEvent = MapMouseEvent & {\n features?: MapGeoJSONFeature[];\n} & object;\n","import { FeatureCollection } from 'geojson';\nimport { GeoJSONSource, SourceSpecification } from 'maplibre-gl';\nimport { Observable, Subject, takeUntil } from 'rxjs';\nimport { MapLayer } from './map-layer';\nimport { MapElementConfig } from './map-element';\n\nexport abstract class MapSource<TElementType> {\n layers: MapLayer<TElementType>[] = [];\n\n protected unsubscribe = new Subject<void>();\n\n #isInitialized = false;\n #featureCollection$?: Observable<FeatureCollection>;\n\n constructor(\n public readonly id: string,\n protected readonly config: MapElementConfig<TElementType>,\n ) {}\n\n onInit() {\n if (!this.config.map.getSource(this.id)) {\n this.config.map.addSource(this.id, this.getSpecification() as SourceSpecification);\n }\n\n this.layers.forEach((layer) => layer.onInit());\n\n this.isInitialized = true;\n }\n\n onDestroy() {\n this.isInitialized = false;\n\n this.layers.forEach((layer) => layer.onDestroy());\n\n this.unsubscribe.next();\n this.unsubscribe.complete();\n }\n\n get featureCollection$(): Observable<FeatureCollection> | undefined {\n return this.#featureCollection$;\n }\n\n set featureCollection$(value: Observable<FeatureCollection> | undefined) {\n this.#featureCollection$ = value;\n this.#subscribeToFeatureCollection();\n }\n\n get isInitialized(): boolean {\n return this.#isInitialized;\n }\n\n set isInitialized(value: boolean) {\n this.#isInitialized = value;\n this.#subscribeToFeatureCollection();\n }\n\n setVisible(visible: boolean) {\n this.layers.forEach((layer) => layer.setVisible(visible));\n }\n\n protected abstract getSpecification(): Partial<SourceSpecification>;\n\n #subscribeToFeatureCollection() {\n if (this.isInitialized && this.featureCollection$) {\n this.featureCollection$.pipe(takeUntil(this.unsubscribe)).subscribe({\n next: (featureCollection) => {\n const source = this.config.map.getSource(this.id);\n\n if (source && source.type === 'geojson') {\n (source as GeoJSONSource).setData(featureCollection);\n } else {\n // not needed because source is always specified as geojson with empty collection\n this.config.map.addSource(this.id, {\n type: 'geojson',\n data: featureCollection,\n });\n }\n },\n error: (error) => {\n console.error('Error updating feature collection', error);\n },\n });\n }\n }\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n viewChild,\n} from '@angular/core';\nimport { AnimationOptions, Map } from 'maplibre-gl';\n\n@Component({\n standalone: true,\n template: '<div #mapContainer class=\"map\"></div>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport abstract class MapComponent implements AfterViewInit, OnDestroy {\n mapContainer = viewChild.required<ElementRef>('mapContainer');\n map!: Map;\n\n ngAfterViewInit() {\n this.map = this.#createMap(this.mapContainer().nativeElement);\n this.map.once('load', () => this.#initiateMapLoading());\n }\n\n ngOnDestroy() {\n // Note: Using `this.map.once('remove', this.onRemoveMap())` does not work correctly because,\n // by the time the `onRemoveMap` event is triggered, it is no longer possible to interact with the map for cleanup.\n // To address this we call `onRemoveMap` explicitly before destroying the MapLibre instance. This\n // ensures that our map elements are cleaned up properly before the map is removed.\n this.onRemoveMap();\n this.map?.remove();\n }\n\n resizeMap() {\n this.map?.resize();\n }\n\n zoomToLevel(zoomLevel: number, options?: AnimationOptions) {\n this.map?.zoomTo(zoomLevel, options);\n }\n\n #createMap(container: HTMLElement): Map {\n const map = new Map({\n container,\n style: {\n version: 8,\n sources: {},\n layers: [],\n },\n interactive: true,\n maxZoom: 18,\n minZoom: 6,\n bounds: [\n [5.34458238242172, 52.11623605695118],\n [5.446205917577942, 52.21132028216525],\n ],\n });\n\n // Prevent map rotation\n map.dragRotate.disable();\n\n return map;\n }\n\n protected abstract onLoadMap(): void;\n protected abstract onRemoveMap(): void;\n protected abstract onIdle(): void;\n\n #initiateMapLoading() {\n this.onLoadMap();\n this.resizeMap();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Map } from 'maplibre-gl';\n\n/**\n * Service for managing MapLibre map cursor interactions.\n *\n * Maplibre has no automatic cursor handling for layers, so when you add a clickHandler\n * to a layer, the user can click on it, but the cursor will not change to a pointer.\n * This service provides methods to set the cursor to pointer when hovering over a layer,\n * and to enable crosshair mode which takes precedence over all other cursor types.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MaplibreCursorService {\n /** Counter to track how many layers currently need a pointer cursor */\n #cursorPointerCount = 0;\n /** Flag indicating if crosshair mode is active */\n #crosshairMode = false;\n\n /**\n * Sets up mouse cursor handling for a map layer.\n * Changes cursor to pointer when mouse enters the layer and resets when leaving.\n *\n * @param map - The MapLibre map instance\n * @param layerId - ID of the layer to apply cursor behavior to\n */\n setMouseCursor(map: Map, layerId: string) {\n const updateCursor = (cursor: string) => {\n if (!this.#crosshairMode) this.#setMouseCursor(map, cursor);\n };\n\n map.on('mouseenter', layerId, () => updateCursor('pointer'));\n map.on('mouseleave', layerId, () => updateCursor(''));\n }\n\n /**\n * Enables or disables crosshair cursor mode for the map.\n * When enabled, crosshair cursor will take precedence over all other cursor types.\n *\n * @param value - True to enable crosshair mode, false to disable\n * @param map - The MapLibre map instance to apply the cursor to\n */\n /**\n * Enables or disables crosshair cursor mode for the map.\n * When enabled, crosshair cursor will take precedence over all other cursor types.\n *\n * @param value - True to enable crosshair mode, false to disable\n * @param map - The MapLibre map instance to apply the cursor to\n */\n setCrosshairMode(value: boolean, map: Map) {\n this.#crosshairMode = value;\n\n let cursorType = '';\n if (value) {\n cursorType = 'crosshair';\n } else if (this.#cursorPointerCount > 0) {\n cursorType = 'pointer';\n }\n\n map.getCanvas().style.cursor = cursorType;\n }\n\n /**\n * Internal method to handle mouse cursor state changes.\n * Manages the cursor pointer reference counter to ensure cursor displays correctly\n * when hovering over multiple interactive layers.\n *\n * @param map - The MapLibre map instance\n * @param cursor - Cursor type to set ('pointer' or '' to reset)\n * @private\n */\n #setMouseCursor(map: Map, cursor: string) {\n if (this.#crosshairMode) {\n // Crosshair mode takes precedence, ignore other cursor settings\n map.getCanvas().style.cursor = 'crosshair';\n return;\n }\n\n if (cursor === 'pointer') {\n this.#cursorPointerCount++;\n map.getCanvas().style.cursor = cursor;\n } else if (cursor === '') {\n this.#cursorPointerCount--;\n if (this.#cursorPointerCount < 1) {\n map.getCanvas().style.cursor = '';\n }\n } else {\n console.warn(`Cursor type '${cursor}' is not supported.`);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAEa,MAAA,SAAS,GAA6B;IACjD,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,SAAS,CAAC;;AAEV,MAAA,iBAAiB,GAA6B;IACzD,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IACrC,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;;;ACJxC;;;;;;AAMG;MACmB,oBAAoB,CAAA;;AAEvB,IAAA,kBAAkB,GAAG,IAAI,eAAe,CAA6B,EAAE,CAAC;;;;;AAOxE,IAAA,YAAY,GAAG,IAAI,CAAC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E,MAAc,EAAA;AACtC,QAAA,IAAI,IAAI,CAAC,cAAc,EAAE;;YAEvB,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW;YAC1C;;AAGF,QAAA,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,IAAI,CAAC,mBAAmB,EAAE;YAC1B,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM;;AAChC,aAAA,IAAI,MAAM,KAAK,EAAE,EAAE;YACxB,IAAI,CAAC,mBAAmB,EAAE;AAC1B,YAAA,IAAI,IAAI,CAAC,mBAAmB,GAAG,CAAC,EAAE;gBAChC,GAAG,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE;;;aAE9B;AACL,YAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAA,mBAAA,CAAqB,CAAC;;;uGA1ElD,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAArB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA;;2FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ndwnu-map.mjs","sources":["../../../../libs/map/src/lib/map/map-constants.ts","../../../../libs/map/src/lib/map/map-config.interface.ts","../../../../libs/map/src/lib/map/map-element.repository.ts","../../../../libs/map/src/lib/map/map-element.ts","../../../../libs/map/src/lib/map/map-layer.ts","../../../../libs/map/src/lib/map/map-source.ts","../../../../libs/map/src/lib/map/map.component.ts","../../../../libs/map/src/lib/map/maplibre-cursor.service.ts","../../../../libs/map/src/ndwnu-map.ts"],"sourcesContent":["import { LngLatLike } from 'maplibre-gl';\n\nexport const BOUNDS_NL: [LngLatLike, LngLatLike] = [\n [3.079667, 50.587611],\n [7.572028, 53.636667],\n];\nexport const BOUNDS_AMERSFOORT: [LngLatLike, LngLatLike] = [\n [5.34458238242172, 52.11623605695118],\n [5.446205917577942, 52.21132028216525],\n];\n","import { LngLatBoundsLike, LngLatLike } from 'maplibre-gl';\n\nexport interface MapConfig {\n /** Initial center position of the map */\n center?: LngLatLike;\n\n /** Initial zoom level */\n zoom?: number;\n\n /** Maximum zoom level */\n maxZoom?: number;\n\n /** Minimum zoom level */\n minZoom?: number;\n\n /** Initial bounds to fit the map to */\n bounds?: LngLatBoundsLike;\n\n /** Enable/disable all map interactions */\n interactive?: boolean;\n\n /** Enable/disable map rotation via drag */\n dragRotate?: boolean;\n\n /** Enable/disable double-click to zoom */\n doubleClickZoom?: boolean;\n\n /** Enable/disable scroll wheel zoom */\n scrollZoom?: boolean;\n\n /** Enable/disable shift+drag box zoom */\n boxZoom?: boolean;\n\n /** Enable/disable drag to pan */\n dragPan?: boolean;\n\n /** Enable/disable keyboard navigation */\n keyboard?: boolean;\n\n /** Enable/disable touch zoom and rotation on mobile */\n touchZoomRotate?: boolean;\n}\n\nexport const DEFAULT_MAP_CONFIG: Required<Omit<MapConfig, 'bounds'>> = {\n center: [5.387827, 52.155172],\n zoom: 8,\n maxZoom: 18,\n minZoom: 6,\n interactive: true,\n dragRotate: false,\n doubleClickZoom: true,\n scrollZoom: true,\n boxZoom: true,\n dragPan: true,\n keyboard: true,\n touchZoomRotate: true,\n};\n\n// Common bounds that users can optionally use\nexport const COMMON_BOUNDS = {\n NETHERLANDS: [\n [3.079667, 50.587611],\n [7.572028, 53.636667],\n ] as LngLatBoundsLike,\n AMERSFOORT: [\n [5.34458238242172, 52.11623605695118],\n [5.446205917577942, 52.21132028216525],\n ] as LngLatBoundsLike,\n} as const;\n","import { BehaviorSubject, map } from 'rxjs';\n\nimport { MapElement } from './map-element';\n\n/**\n * Repository for managing map elements.\n * Provides methods to add, remove, show, hide, and toggle map elements.\n * Also tracks element visibility state and provides observable streams for elements.\n *\n * @typeparam TElementType - The type of ID used for the map elements\n */\nexport abstract class MapElementRepository<TElementType> {\n /** Subject that holds the current array of map elements */\n private readonly mapElementsSubject = new BehaviorSubject<MapElement<TElementType>[]>([]);\n\n // mapElements are not directly exposed to prevent circular reference errors when\n // they are used in a template. Because the mapElements$ observable contains MapLibre\n // GL JS map objects, which have circular references.\n\n /** Observable stream of all map elements */\n private readonly mapElements$ = this.mapElementsSubject.asObservable();\n\n /** Observable stream of only visible map elements */\n private readonly visibleMapElements$ = this.mapElements$.pipe(\n map((elements) => elements.filter((element) => element.isVisible)),\n );\n\n /**\n * Gets the ids (TElementType) as an array of all map element\n * @returns Array of TElementType\n */\n mapElementIds$ = this.mapElements$.pipe(map((elements) => elements.map((element) => element.id)));\n\n /**\n * Gets the ids (TElementType) as an array of all visible map element\n * @returns Array of TElementType\n */\n visibleMapElementIds$ = this.visibleMapElements$.pipe(\n map((elements) => elements.map((element) => element.id)),\n );\n\n /**\n * Gets the current array of all map elements\n * @returns Array of map elements\n */\n get mapElements(): MapElement<TElementType>[] {\n return this.mapElementsSubject.getValue();\n }\n\n /**\n * Gets only the currently visible map elements\n * @returns Array of visible map elements\n */\n get visibleMapElements(): MapElement<TElementType>[] {\n return this.mapElements.filter((element) => element.isVisible);\n }\n\n /**\n * Finds a map element by its ID\n *\n * @param elementId - The ID of the element to find\n * @returns The map element if found, undefined otherwise\n */\n getMapElementById(elementId: TElementType): MapElement<TElementType> | undefined {\n return this.mapElements.find((element) => element.id === elementId);\n }\n\n /**\n * Checks if a map element is currently visible\n *\n * @param elementId - The ID of the element to check\n * @returns True if the element is visible, false otherwise\n */\n isMapElementVisible(elementId: TElementType): boolean {\n return this.visibleMapElements.some((element) => element.id === elementId);\n }\n\n /**\n * Adds a new map element to the repository and initializes it.\n * Sets the element's visibility based on its configuration.\n *\n * @param mapElement - The map element to add\n */\n addMapElement(mapElement: MapElement<TElementType>) {\n const currentElements = this.mapElements;\n this.mapElementsSubject.next([...currentElements, mapElement]);\n mapElement.onInit();\n if (mapElement.alwaysVisible || this.isMapElementVisible(mapElement.id)) {\n this.showMapElement(mapElement.id);\n } else {\n this.hideMapElement(mapElement.id);\n }\n }\n\n /**\n * Removes a map element from the repository and destroys it.\n *\n * @param mapElement - The map element to remove\n */\n removeMapElement(mapElement: MapElement<TElementType>) {\n const filteredElements = this.mapElements.filter((element) => element.id !== mapElement.id);\n this.mapElementsSubject.next(filteredElements);\n mapElement.onDestroy();\n }\n\n /**\n * Removes all map elements from the repository and destroys them.\n */\n removeAllMapElements() {\n this.mapElements.forEach((element) => {\n this.removeMapElement(element);\n });\n }\n\n /**\n * Sets the visibility of a map element by its ID and updates the subject with the new state.\n *\n * @param elementId - The ID of the element to update\n * @param visible - Whether the element should be visible or hidden\n */\n private setMapElementVisibility(elementId: TElementType, visible: boolean) {\n const element = this.getMapElementById(elementId);\n if (element) {\n element.setVisible(visible);\n const elements = this.mapElements.filter((el) => el.id !== elementId);\n this.mapElementsSubject.next([...elements, element]);\n }\n }\n\n /**\n * Shows a map element by its ID and updates the subject with the new state.\n *\n * @param elementId - The ID of the element to show\n */\n showMapElement(elementId: TElementType) {\n this.setMapElementVisibility(elementId, true);\n }\n\n /**\n * Hides a map element by its ID and updates the subject with the new state.\n *\n * @param elementId - The ID of the element to hide\n */\n hideMapElement(elementId: TElementType) {\n this.setMapElementVisibility(elementId, false);\n }\n\n /**\n * Toggles the visibility of a map element by its ID.\n * If the element is currently visible, it will be hidden, and vice versa.\n *\n * @param elementId - The ID of the element to toggle visibility\n */\n toggleMapElement(elementId: TElementType) {\n if (this.visibleMapElements.some((element) => element.id === elementId)) {\n this.hideMapElement(elementId);\n } else {\n this.showMapElement(elementId);\n }\n }\n\n /**\n * Gets the ID of the layer that should come before the specified element's layers\n * in the map's layer stack. This is used for maintaining proper layer ordering.\n *\n * @param elementId - The ID of the element to find a \"before\" reference for\n * @returns The ID of the first layer of the next element in order, or undefined if none exists\n */\n getBeforeId(elementId: TElementType): string | undefined {\n const currentElement = this.getMapElementById(elementId);\n if (!currentElement) {\n return undefined;\n }\n\n const nextElement = this.mapElements\n .filter((item) => item.elementOrder > currentElement.elementOrder)\n .sort((a, b) => a.elementOrder - b.elementOrder)[0];\n\n const nextElementLayerIds = nextElement?.sources\n .flatMap((source) => source.layers)\n .filter((layer) => layer.initialized)\n .map((layer) => layer.id);\n\n return nextElement && nextElementLayerIds.length > 0 ? nextElementLayerIds[0] : undefined;\n }\n}\n","import { Map } from 'maplibre-gl';\nimport { Subject } from 'rxjs';\n\nimport { MapElementRepository } from './map-element.repository';\nimport { MapSource } from './map-source';\nimport { MaplibreCursorService } from './maplibre-cursor.service';\n\nexport interface MapElementConfig<TElementType> {\n map: Map;\n mapElementRepository: MapElementRepository<TElementType>;\n maplibreCursorService: MaplibreCursorService;\n elementId: TElementType;\n elementOrder: number;\n}\n\nexport abstract class MapElement<TElementType> {\n id: TElementType;\n elementOrder: number;\n sources: MapSource<TElementType>[] = [];\n alwaysVisible = false;\n isVisible = false;\n\n protected unsubscribe = new Subject<void>();\n\n constructor(protected readonly config: MapElementConfig<TElementType>) {\n this.id = config.elementId;\n this.elementOrder = config.elementOrder;\n }\n\n onInit() {\n this.sources.forEach((source) => source.onInit());\n }\n\n onDestroy() {\n this.sources.forEach((source) => source.onDestroy());\n\n this.unsubscribe.next();\n this.unsubscribe.complete();\n }\n\n setVisible(visible: boolean) {\n this.isVisible = visible;\n this.sources.forEach((source) => source.setVisible(visible));\n }\n}\n","import { Feature } from 'geojson';\nimport { MapElementConfig } from './map-element';\nimport {\n FilterSpecification,\n LayerSpecification,\n MapGeoJSONFeature,\n MapMouseEvent,\n} from 'maplibre-gl';\nimport { Subject } from 'rxjs';\n\nexport abstract class MapLayer<TElementType> {\n initialized = false;\n\n protected unsubscribe = new Subject<void>();\n\n constructor(\n protected readonly config: MapElementConfig<TElementType>,\n protected readonly sourceId: string,\n protected readonly layerIdSuffix?: string,\n ) {}\n\n get id(): string {\n const suffix = this.layerIdSuffix ? `-${this.layerIdSuffix}` : '';\n return `${this.sourceId}${suffix}`;\n }\n\n get styleLayer() {\n return this.config.map.getLayer(this.id);\n }\n\n onInit() {\n // Add the layer to the map, with the correct ordering (beforeId)\n const beforeId = this.config.mapElementRepository.getBeforeId(this.config.elementId);\n this.config.map.addLayer(this.getSpecification() as LayerSpecification, beforeId);\n\n // Keeping track of which layers have been added to the map to allow for beforeId determination\n this.#setupClickHandlers();\n this.initialized = true;\n }\n\n onDestroy() {\n this.initialized = false;\n this.#removeClickHandlers();\n\n this.config.map.removeLayer(this.id);\n\n this.unsubscribe.next();\n this.unsubscribe.complete();\n }\n\n setVisible(visible: boolean) {\n this.config.map.setLayoutProperty(this.id, 'visibility', visible ? 'visible' : 'none');\n }\n\n protected onClick?(features: Feature[]): void;\n\n protected abstract getSpecification(): Partial<LayerSpecification>;\n getFilterSpecification?(): FilterSpecification;\n\n #setupClickHandlers() {\n if (!this.onClick) return;\n\n this.config.map.on('click', this.id, (event) => {\n this.onClick?.(this.#getFeatures(event));\n });\n\n this.config.maplibreCursorService.setMouseCursor(this.config.map, this.id);\n }\n\n #removeClickHandlers() {\n if (!this.onClick) return;\n\n this.config.map.off('click', this.id, (event) => {\n this.onClick?.(this.#getFeatures(event));\n });\n }\n\n #getFeatures(event: ClickEvent): Feature[] {\n if (event.features && event.features.length > 0) {\n return this.#distinctFeatures(event.features);\n }\n return [];\n }\n\n /**\n * Filters an array of features to remove duplicates based on their properties.\n * Two features are considered duplicates if they have identical properties.\n * Particularly vector sources can yield duplicate features due to the way they\n * are rendered in tiles.\n *\n * @param features - Array of GeoJSON features to filter\n * @returns Array of unique features with no property duplicates\n * @private\n */\n #distinctFeatures(features: Feature[]): Feature[] {\n const seen = new Set();\n const uniqueFeatures: Feature[] = [];\n\n features.forEach((feature) => {\n const propertiesString = JSON.stringify(feature.properties);\n if (!seen.has(propertiesString)) {\n seen.add(propertiesString);\n uniqueFeatures.push(feature);\n }\n });\n\n return uniqueFeatures;\n }\n}\n\nexport type ClickEvent = MapMouseEvent & {\n features?: MapGeoJSONFeature[];\n} & object;\n","import { FeatureCollection } from 'geojson';\nimport { GeoJSONSource, SourceSpecification } from 'maplibre-gl';\nimport { Observable, Subject, takeUntil } from 'rxjs';\nimport { MapLayer } from './map-layer';\nimport { MapElementConfig } from './map-element';\n\nexport abstract class MapSource<TElementType> {\n layers: MapLayer<TElementType>[] = [];\n\n protected unsubscribe = new Subject<void>();\n\n #isInitialized = false;\n #featureCollection$?: Observable<FeatureCollection>;\n\n constructor(\n public readonly id: string,\n protected readonly config: MapElementConfig<TElementType>,\n ) {}\n\n onInit() {\n if (!this.config.map.getSource(this.id)) {\n this.config.map.addSource(this.id, this.getSpecification() as SourceSpecification);\n }\n\n this.layers.forEach((layer) => layer.onInit());\n\n this.isInitialized = true;\n }\n\n onDestroy() {\n this.isInitialized = false;\n\n this.layers.forEach((layer) => layer.onDestroy());\n\n this.unsubscribe.next();\n this.unsubscribe.complete();\n }\n\n get featureCollection$(): Observable<FeatureCollection> | undefined {\n return this.#featureCollection$;\n }\n\n set featureCollection$(value: Observable<FeatureCollection> | undefined) {\n this.#featureCollection$ = value;\n this.#subscribeToFeatureCollection();\n }\n\n get isInitialized(): boolean {\n return this.#isInitialized;\n }\n\n set isInitialized(value: boolean) {\n this.#isInitialized = value;\n this.#subscribeToFeatureCollection();\n }\n\n setVisible(visible: boolean) {\n this.layers.forEach((layer) => layer.setVisible(visible));\n }\n\n protected abstract getSpecification(): Partial<SourceSpecification>;\n\n #subscribeToFeatureCollection() {\n if (this.isInitialized && this.featureCollection$) {\n this.featureCollection$.pipe(takeUntil(this.unsubscribe)).subscribe({\n next: (featureCollection) => {\n const source = this.config.map.getSource(this.id);\n\n if (source && source.type === 'geojson') {\n (source as GeoJSONSource).setData(featureCollection);\n } else {\n // not needed because source is always specified as geojson with empty collection\n this.config.map.addSource(this.id, {\n type: 'geojson',\n data: featureCollection,\n });\n }\n },\n error: (error) => {\n console.error('Error updating feature collection', error);\n },\n });\n }\n }\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n OnDestroy,\n viewChild,\n} from '@angular/core';\nimport { AnimationOptions, Map, MapOptions } from 'maplibre-gl';\nimport { MapConfig, DEFAULT_MAP_CONFIG } from './map-config.interface';\n\n@Component({\n standalone: true,\n template: '<div #mapContainer class=\"map\"></div>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport abstract class MapComponent implements AfterViewInit, OnDestroy {\n mapContainer = viewChild.required<ElementRef>('mapContainer');\n config = input<Partial<MapConfig>>({});\n map!: Map;\n\n ngAfterViewInit() {\n this.map = this.#createMap(this.mapContainer().nativeElement);\n this.map.once('load', () => this.#initiateMapLoading());\n }\n\n ngOnDestroy() {\n // Note: Using `this.map.once('remove', this.onRemoveMap())` does not work correctly because,\n // by the time the `onRemoveMap` event is triggered, it is no longer possible to interact with the map for cleanup.\n // To address this we call `onRemoveMap` explicitly before destroying the MapLibre instance. This\n // ensures that our map elements are cleaned up properly before the map is removed.\n this.onRemoveMap();\n this.map?.remove();\n }\n\n resizeMap() {\n this.map?.resize();\n }\n\n zoomToLevel(zoomLevel: number, options?: AnimationOptions) {\n this.map?.zoomTo(zoomLevel, options);\n }\n\n #createMap(container: HTMLElement): Map {\n const config = { ...DEFAULT_MAP_CONFIG, ...this.config() };\n\n const options = {\n container,\n style: {\n version: 8 as const,\n sources: {},\n layers: [],\n },\n maxZoom: config.maxZoom,\n minZoom: config.minZoom,\n interactive: config.interactive,\n doubleClickZoom: config.doubleClickZoom,\n scrollZoom: config.scrollZoom,\n boxZoom: config.boxZoom,\n dragPan: config.dragPan,\n keyboard: config.keyboard,\n touchZoomRotate: config.touchZoomRotate,\n } as MapOptions;\n\n const map = new Map(options);\n\n return map;\n }\n\n protected abstract onLoadMap(): void;\n protected abstract onRemoveMap(): void;\n protected abstract onIdle(): void;\n\n #initiateMapLoading() {\n this.onLoadMap();\n this.resizeMap();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Map } from 'maplibre-gl';\n\n/**\n * Service for managing MapLibre map cursor interactions.\n *\n * Maplibre has no automatic cursor handling for layers, so when you add a clickHandler\n * to a layer, the user can click on it, but the cursor will not change to a pointer.\n * This service provides methods to set the cursor to pointer when hovering over a layer,\n * and to enable crosshair mode which takes precedence over all other cursor types.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MaplibreCursorService {\n /** Counter to track how many layers currently need a pointer cursor */\n #cursorPointerCount = 0;\n /** Flag indicating if crosshair mode is active */\n #crosshairMode = false;\n\n /**\n * Sets up mouse cursor handling for a map layer.\n * Changes cursor to pointer when mouse enters the layer and resets when leaving.\n *\n * @param map - The MapLibre map instance\n * @param layerId - ID of the layer to apply cursor behavior to\n */\n setMouseCursor(map: Map, layerId: string) {\n const updateCursor = (cursor: string) => {\n if (!this.#crosshairMode) this.#setMouseCursor(map, cursor);\n };\n\n map.on('mouseenter', layerId, () => updateCursor('pointer'));\n map.on('mouseleave', layerId, () => updateCursor(''));\n }\n\n /**\n * Enables or disables crosshair cursor mode for the map.\n * When enabled, crosshair cursor will take precedence over all other cursor types.\n *\n * @param value - True to enable crosshair mode, false to disable\n * @param map - The MapLibre map instance to apply the cursor to\n */\n /**\n * Enables or disables crosshair cursor mode for the map.\n * When enabled, crosshair cursor will take precedence over all other cursor types.\n *\n * @param value - True to enable crosshair mode, false to disable\n * @param map - The MapLibre map instance to apply the cursor to\n */\n setCrosshairMode(value: boolean, map: Map) {\n this.#crosshairMode = value;\n\n let cursorType = '';\n if (value) {\n cursorType = 'crosshair';\n } else if (this.#cursorPointerCount > 0) {\n cursorType = 'pointer';\n }\n\n map.getCanvas().style.cursor = cursorType;\n }\n\n /**\n * Internal method to handle mouse cursor state changes.\n * Manages the cursor pointer reference counter to ensure cursor displays correctly\n * when hovering over multiple interactive layers.\n *\n * @param map - The MapLibre map instance\n * @param cursor - Cursor type to set ('pointer' or '' to reset)\n * @private\n */\n #setMouseCursor(map: Map, cursor: string) {\n if (this.#crosshairMode) {\n // Crosshair mode takes precedence, ignore other cursor settings\n map.getCanvas().style.cursor = 'crosshair';\n return;\n }\n\n if (cursor === 'pointer') {\n this.#cursorPointerCount++;\n map.getCanvas().style.cursor = cursor;\n } else if (cursor === '') {\n this.#cursorPointerCount--;\n if (this.#cursorPointerCount < 1) {\n map.getCanvas().style.cursor = '';\n }\n } else {\n console.warn(`Cursor type '${cursor}' is not supported.`);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAEa,MAAA,SAAS,GAA6B;IACjD,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,SAAS,CAAC;;AAEV,MAAA,iBAAiB,GAA6B;IACzD,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IACrC,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;;;ACmC3B,MAAA,kBAAkB,GAAwC;AACrE,IAAA,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;AAC7B,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,eAAe,EAAE,IAAI;;AAGvB;AACa,MAAA,aAAa,GAAG;AAC3B,IAAA,WAAW,EAAE;QACX,CAAC,QAAQ,EAAE,SAAS,CAAC;QACrB,CAAC,QAAQ,EAAE,SAAS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CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA;;2FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACbD;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LngLatBoundsLike, LngLatLike } from 'maplibre-gl';
|
|
2
|
+
export interface MapConfig {
|
|
3
|
+
/** Initial center position of the map */
|
|
4
|
+
center?: LngLatLike;
|
|
5
|
+
/** Initial zoom level */
|
|
6
|
+
zoom?: number;
|
|
7
|
+
/** Maximum zoom level */
|
|
8
|
+
maxZoom?: number;
|
|
9
|
+
/** Minimum zoom level */
|
|
10
|
+
minZoom?: number;
|
|
11
|
+
/** Initial bounds to fit the map to */
|
|
12
|
+
bounds?: LngLatBoundsLike;
|
|
13
|
+
/** Enable/disable all map interactions */
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
/** Enable/disable map rotation via drag */
|
|
16
|
+
dragRotate?: boolean;
|
|
17
|
+
/** Enable/disable double-click to zoom */
|
|
18
|
+
doubleClickZoom?: boolean;
|
|
19
|
+
/** Enable/disable scroll wheel zoom */
|
|
20
|
+
scrollZoom?: boolean;
|
|
21
|
+
/** Enable/disable shift+drag box zoom */
|
|
22
|
+
boxZoom?: boolean;
|
|
23
|
+
/** Enable/disable drag to pan */
|
|
24
|
+
dragPan?: boolean;
|
|
25
|
+
/** Enable/disable keyboard navigation */
|
|
26
|
+
keyboard?: boolean;
|
|
27
|
+
/** Enable/disable touch zoom and rotation on mobile */
|
|
28
|
+
touchZoomRotate?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_MAP_CONFIG: Required<Omit<MapConfig, 'bounds'>>;
|
|
31
|
+
export declare const COMMON_BOUNDS: {
|
|
32
|
+
readonly NETHERLANDS: LngLatBoundsLike;
|
|
33
|
+
readonly AMERSFOORT: LngLatBoundsLike;
|
|
34
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, OnDestroy } from '@angular/core';
|
|
2
2
|
import { AnimationOptions, Map } from 'maplibre-gl';
|
|
3
|
+
import { MapConfig } from './map-config.interface';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare abstract class MapComponent implements AfterViewInit, OnDestroy {
|
|
5
6
|
#private;
|
|
6
7
|
mapContainer: import("@angular/core").Signal<ElementRef<any>>;
|
|
8
|
+
config: import("@angular/core").InputSignal<Partial<MapConfig>>;
|
|
7
9
|
map: Map;
|
|
8
10
|
ngAfterViewInit(): void;
|
|
9
11
|
ngOnDestroy(): void;
|
|
@@ -13,5 +15,5 @@ export declare abstract class MapComponent implements AfterViewInit, OnDestroy {
|
|
|
13
15
|
protected abstract onRemoveMap(): void;
|
|
14
16
|
protected abstract onIdle(): void;
|
|
15
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<MapComponent, never>;
|
|
16
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MapComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MapComponent, "ng-component", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
17
19
|
}
|