@tic-nova/ngx-mapbox-gl 14.0.0
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 +3 -0
- package/esm2022/index.js +32 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/control/attribution-control.directive.js +39 -0
- package/esm2022/lib/control/attribution-control.directive.js.map +1 -0
- package/esm2022/lib/control/control.component.js +62 -0
- package/esm2022/lib/control/control.component.js.map +1 -0
- package/esm2022/lib/control/fullscreen-control.directive.js +39 -0
- package/esm2022/lib/control/fullscreen-control.directive.js.map +1 -0
- package/esm2022/lib/control/geolocate-control.directive.js +52 -0
- package/esm2022/lib/control/geolocate-control.directive.js.map +1 -0
- package/esm2022/lib/control/navigation-control.directive.js +39 -0
- package/esm2022/lib/control/navigation-control.directive.js.map +1 -0
- package/esm2022/lib/control/scale-control.directive.js +45 -0
- package/esm2022/lib/control/scale-control.directive.js.map +1 -0
- package/esm2022/lib/draggable/draggable.directive.js +121 -0
- package/esm2022/lib/draggable/draggable.directive.js.map +1 -0
- package/esm2022/lib/image/image.component.js +79 -0
- package/esm2022/lib/image/image.component.js.map +1 -0
- package/esm2022/lib/layer/layer.component.js +139 -0
- package/esm2022/lib/layer/layer.component.js.map +1 -0
- package/esm2022/lib/map/map.component.js +381 -0
- package/esm2022/lib/map/map.component.js.map +1 -0
- package/esm2022/lib/map/map.service.js +725 -0
- package/esm2022/lib/map/map.service.js.map +1 -0
- package/esm2022/lib/map/map.types.js +30 -0
- package/esm2022/lib/map/map.types.js.map +1 -0
- package/esm2022/lib/marker/marker.component.js +114 -0
- package/esm2022/lib/marker/marker.component.js.map +1 -0
- package/esm2022/lib/markers-for-clusters/markers-for-clusters.component.js +168 -0
- package/esm2022/lib/markers-for-clusters/markers-for-clusters.component.js.map +1 -0
- package/esm2022/lib/popup/popup.component.js +124 -0
- package/esm2022/lib/popup/popup.component.js.map +1 -0
- package/esm2022/lib/provide-mapbox-gl.js +8 -0
- package/esm2022/lib/provide-mapbox-gl.js.map +1 -0
- package/esm2022/lib/source/canvas-source.component.js +74 -0
- package/esm2022/lib/source/canvas-source.component.js.map +1 -0
- package/esm2022/lib/source/geojson/feature.component.js +42 -0
- package/esm2022/lib/source/geojson/feature.component.js.map +1 -0
- package/esm2022/lib/source/geojson/geojson-source.component.js +204 -0
- package/esm2022/lib/source/geojson/geojson-source.component.js.map +1 -0
- package/esm2022/lib/source/image-source.component.js +58 -0
- package/esm2022/lib/source/image-source.component.js.map +1 -0
- package/esm2022/lib/source/raster-dem-source.component.js +91 -0
- package/esm2022/lib/source/raster-dem-source.component.js.map +1 -0
- package/esm2022/lib/source/raster-source.component.js +85 -0
- package/esm2022/lib/source/raster-source.component.js.map +1 -0
- package/esm2022/lib/source/vector-source.component.js +99 -0
- package/esm2022/lib/source/vector-source.component.js.map +1 -0
- package/esm2022/lib/source/video-source.component.js +80 -0
- package/esm2022/lib/source/video-source.component.js.map +1 -0
- package/esm2022/ngx-mapbox-gl.js +5 -0
- package/esm2022/ngx-mapbox-gl.js.map +1 -0
- package/index.d.ts +24 -0
- package/lib/control/attribution-control.directive.d.ts +11 -0
- package/lib/control/control.component.d.ts +21 -0
- package/lib/control/fullscreen-control.directive.d.ts +11 -0
- package/lib/control/geolocate-control.directive.d.ts +15 -0
- package/lib/control/navigation-control.directive.d.ts +11 -0
- package/lib/control/scale-control.directive.d.ts +12 -0
- package/lib/draggable/draggable.directive.d.ts +20 -0
- package/lib/image/image.component.d.ts +34 -0
- package/lib/layer/layer.component.d.ts +422 -0
- package/lib/map/map.component.d.ts +185 -0
- package/lib/map/map.service.d.ts +123 -0
- package/lib/map/map.types.d.ts +72 -0
- package/lib/marker/marker.component.d.ts +31 -0
- package/lib/markers-for-clusters/markers-for-clusters.component.d.ts +28 -0
- package/lib/popup/popup.component.d.ts +33 -0
- package/lib/provide-mapbox-gl.d.ts +6 -0
- package/lib/source/canvas-source.component.d.ts +23 -0
- package/lib/source/geojson/feature.component.d.ts +16 -0
- package/lib/source/geojson/geojson-source.component.d.ts +63 -0
- package/lib/source/image-source.component.d.ts +22 -0
- package/lib/source/raster-dem-source.component.d.ts +23 -0
- package/lib/source/raster-source.component.d.ts +23 -0
- package/lib/source/vector-source.component.d.ts +24 -0
- package/lib/source/video-source.component.d.ts +24 -0
- package/ngx-mapbox-gl.d.ts +5 -0
- package/package.json +44 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input, } from '@angular/core';
|
|
2
|
+
import { fromEvent, Subscription } from 'rxjs';
|
|
3
|
+
import { filter } from 'rxjs/operators';
|
|
4
|
+
import { MapService } from '../map/map.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
// Typing issue in RasterDEMSourceSpecification
|
|
7
|
+
// type RasterDemSourceInputs = {
|
|
8
|
+
// [K in keyof Omit<RasterDEMSourceSpecification, 'type'>]: InputSignal<
|
|
9
|
+
// Omit<RasterDEMSourceSpecification, 'type'>[K]
|
|
10
|
+
// >;
|
|
11
|
+
// };
|
|
12
|
+
export class RasterDemSourceComponent {
|
|
13
|
+
mapService = inject(MapService);
|
|
14
|
+
/* Init inputs */
|
|
15
|
+
id = input.required(...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
16
|
+
/* Dynamic inputs */
|
|
17
|
+
url = input(...(ngDevMode ? [undefined, { debugName: "url" }] : []));
|
|
18
|
+
tiles = input(...(ngDevMode ? [undefined, { debugName: "tiles" }] : []));
|
|
19
|
+
bounds = input(...(ngDevMode ? [undefined, { debugName: "bounds" }] : []));
|
|
20
|
+
minzoom = input(...(ngDevMode ? [undefined, { debugName: "minzoom" }] : []));
|
|
21
|
+
maxzoom = input(...(ngDevMode ? [undefined, { debugName: "maxzoom" }] : []));
|
|
22
|
+
tileSize = input(...(ngDevMode ? [undefined, { debugName: "tileSize" }] : []));
|
|
23
|
+
attribution = input(...(ngDevMode ? [undefined, { debugName: "attribution" }] : []));
|
|
24
|
+
encoding = input(...(ngDevMode ? [undefined, { debugName: "encoding" }] : []));
|
|
25
|
+
volatile = input(...(ngDevMode ? [undefined, { debugName: "volatile" }] : []));
|
|
26
|
+
sourceAdded = false;
|
|
27
|
+
sub = new Subscription();
|
|
28
|
+
ngOnInit() {
|
|
29
|
+
const sub1 = this.mapService.mapLoaded$.subscribe(() => {
|
|
30
|
+
this.init();
|
|
31
|
+
const sub = fromEvent(this.mapService.mapInstance, 'styledata')
|
|
32
|
+
.pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))
|
|
33
|
+
.subscribe(() => {
|
|
34
|
+
this.init();
|
|
35
|
+
});
|
|
36
|
+
this.sub.add(sub);
|
|
37
|
+
});
|
|
38
|
+
this.sub.add(sub1);
|
|
39
|
+
}
|
|
40
|
+
ngOnChanges(changes) {
|
|
41
|
+
if (!this.sourceAdded) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if ((changes['url'] && !changes['url'].isFirstChange()) ||
|
|
45
|
+
(changes['tiles'] && !changes['tiles'].isFirstChange()) ||
|
|
46
|
+
(changes['bounds'] && !changes['bounds'].isFirstChange()) ||
|
|
47
|
+
(changes['minzoom'] && !changes['minzoom'].isFirstChange()) ||
|
|
48
|
+
(changes['maxzoom'] && !changes['maxzoom'].isFirstChange()) ||
|
|
49
|
+
(changes['tileSize'] && !changes['tileSize'].isFirstChange()) ||
|
|
50
|
+
(changes['attribution'] && !changes['attribution'].isFirstChange()) ||
|
|
51
|
+
(changes['encoding'] && !changes['encoding'].isFirstChange()) ||
|
|
52
|
+
(changes['volatile'] && !changes['volatile'].isFirstChange())) {
|
|
53
|
+
this.ngOnDestroy();
|
|
54
|
+
this.ngOnInit();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
ngOnDestroy() {
|
|
58
|
+
this.sub.unsubscribe();
|
|
59
|
+
if (this.sourceAdded) {
|
|
60
|
+
this.mapService.removeSource(this.id());
|
|
61
|
+
this.sourceAdded = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
init() {
|
|
65
|
+
const source = {
|
|
66
|
+
type: 'raster-dem',
|
|
67
|
+
url: this.url(),
|
|
68
|
+
tiles: this.tiles(),
|
|
69
|
+
bounds: this.bounds(),
|
|
70
|
+
minzoom: this.minzoom(),
|
|
71
|
+
maxzoom: this.maxzoom(),
|
|
72
|
+
tileSize: this.tileSize(),
|
|
73
|
+
attribution: this.attribution(),
|
|
74
|
+
encoding: this.encoding(),
|
|
75
|
+
volatile: this.volatile(),
|
|
76
|
+
};
|
|
77
|
+
this.mapService.addSource(this.id(), source);
|
|
78
|
+
this.sourceAdded = true;
|
|
79
|
+
}
|
|
80
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RasterDemSourceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
81
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: RasterDemSourceComponent, isStandalone: true, selector: "mgl-raster-dem-source", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: false, transformFunction: null }, tiles: { classPropertyName: "tiles", publicName: "tiles", isSignal: true, isRequired: false, transformFunction: null }, bounds: { classPropertyName: "bounds", publicName: "bounds", isSignal: true, isRequired: false, transformFunction: null }, minzoom: { classPropertyName: "minzoom", publicName: "minzoom", isSignal: true, isRequired: false, transformFunction: null }, maxzoom: { classPropertyName: "maxzoom", publicName: "maxzoom", isSignal: true, isRequired: false, transformFunction: null }, tileSize: { classPropertyName: "tileSize", publicName: "tileSize", isSignal: true, isRequired: false, transformFunction: null }, attribution: { classPropertyName: "attribution", publicName: "attribution", isSignal: true, isRequired: false, transformFunction: null }, encoding: { classPropertyName: "encoding", publicName: "encoding", isSignal: true, isRequired: false, transformFunction: null }, volatile: { classPropertyName: "volatile", publicName: "volatile", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
82
|
+
}
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RasterDemSourceComponent, decorators: [{
|
|
84
|
+
type: Component,
|
|
85
|
+
args: [{
|
|
86
|
+
selector: 'mgl-raster-dem-source',
|
|
87
|
+
template: '',
|
|
88
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
89
|
+
}]
|
|
90
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], tiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "tiles", required: false }] }], bounds: [{ type: i0.Input, args: [{ isSignal: true, alias: "bounds", required: false }] }], minzoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "minzoom", required: false }] }], maxzoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxzoom", required: false }] }], tileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tileSize", required: false }] }], attribution: [{ type: i0.Input, args: [{ isSignal: true, alias: "attribution", required: false }] }], encoding: [{ type: i0.Input, args: [{ isSignal: true, alias: "encoding", required: false }] }], volatile: [{ type: i0.Input, args: [{ isSignal: true, alias: "volatile", required: false }] }] } });
|
|
91
|
+
//# sourceMappingURL=raster-dem-source.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raster-dem-source.component.js","sourceRoot":"","sources":["../../../../../../libs/ngx-mapbox-gl/src/lib/source/raster-dem-source.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EAKT,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAg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AAE,CAAC;QACvB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;IAEO,IAAI;QACV,MAAM,MAAM,GAAiC;YAC3C,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;SAC1B,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;uGA3EU,wBAAwB;2FAAxB,wBAAwB,80CAHzB,EAAE;;2FAGD,wBAAwB;kBALpC,SAAS;mBAAC;oBACT,QAAQ,EAAE,uBAAuB;oBACjC,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n inject,\n input,\n} from '@angular/core';\nimport type { RasterDEMSourceSpecification } from 'mapbox-gl';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { MapService } from '../map/map.service';\n\n// Typing issue in RasterDEMSourceSpecification\n// type RasterDemSourceInputs = {\n// [K in keyof Omit<RasterDEMSourceSpecification, 'type'>]: InputSignal<\n// Omit<RasterDEMSourceSpecification, 'type'>[K]\n// >;\n// };\n\n@Component({\n selector: 'mgl-raster-dem-source',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RasterDemSourceComponent implements OnInit, OnDestroy, OnChanges {\n private mapService = inject(MapService);\n /* Init inputs */\n id = input.required<string>();\n\n /* Dynamic inputs */\n url = input<RasterDEMSourceSpecification['url']>();\n tiles = input<RasterDEMSourceSpecification['tiles']>();\n bounds = input<RasterDEMSourceSpecification['bounds']>();\n minzoom = input<RasterDEMSourceSpecification['minzoom']>();\n maxzoom = input<RasterDEMSourceSpecification['maxzoom']>();\n tileSize = input<RasterDEMSourceSpecification['tileSize']>();\n attribution = input<RasterDEMSourceSpecification['attribution']>();\n encoding = input<RasterDEMSourceSpecification['encoding']>();\n volatile = input<RasterDEMSourceSpecification['volatile']>();\n\n private sourceAdded = false;\n private sub = new Subscription();\n\n ngOnInit() {\n const sub1 = this.mapService.mapLoaded$.subscribe(() => {\n this.init();\n const sub = fromEvent(this.mapService.mapInstance, 'styledata')\n .pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))\n .subscribe(() => {\n this.init();\n });\n this.sub.add(sub);\n });\n this.sub.add(sub1);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.sourceAdded) {\n return;\n }\n if (\n (changes['url'] && !changes['url'].isFirstChange()) ||\n (changes['tiles'] && !changes['tiles'].isFirstChange()) ||\n (changes['bounds'] && !changes['bounds'].isFirstChange()) ||\n (changes['minzoom'] && !changes['minzoom'].isFirstChange()) ||\n (changes['maxzoom'] && !changes['maxzoom'].isFirstChange()) ||\n (changes['tileSize'] && !changes['tileSize'].isFirstChange()) ||\n (changes['attribution'] && !changes['attribution'].isFirstChange()) ||\n (changes['encoding'] && !changes['encoding'].isFirstChange()) ||\n (changes['volatile'] && !changes['volatile'].isFirstChange())\n ) {\n this.ngOnDestroy();\n this.ngOnInit();\n }\n }\n\n ngOnDestroy() {\n this.sub.unsubscribe();\n if (this.sourceAdded) {\n this.mapService.removeSource(this.id());\n this.sourceAdded = false;\n }\n }\n\n private init() {\n const source: RasterDEMSourceSpecification = {\n type: 'raster-dem',\n url: this.url(),\n tiles: this.tiles(),\n bounds: this.bounds(),\n minzoom: this.minzoom(),\n maxzoom: this.maxzoom(),\n tileSize: this.tileSize(),\n attribution: this.attribution(),\n encoding: this.encoding(),\n volatile: this.volatile(),\n };\n this.mapService.addSource(this.id(), source);\n this.sourceAdded = true;\n }\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input, } from '@angular/core';
|
|
2
|
+
import { fromEvent, Subscription } from 'rxjs';
|
|
3
|
+
import { filter } from 'rxjs/operators';
|
|
4
|
+
import { MapService } from '../map/map.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class RasterSourceComponent {
|
|
7
|
+
mapService = inject(MapService);
|
|
8
|
+
/* Init inputs */
|
|
9
|
+
id = input.required(...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
10
|
+
/* Dynamic inputs */
|
|
11
|
+
url = input(...(ngDevMode ? [undefined, { debugName: "url" }] : []));
|
|
12
|
+
tiles = input(...(ngDevMode ? [undefined, { debugName: "tiles" }] : []));
|
|
13
|
+
bounds = input(...(ngDevMode ? [undefined, { debugName: "bounds" }] : []));
|
|
14
|
+
minzoom = input(...(ngDevMode ? [undefined, { debugName: "minzoom" }] : []));
|
|
15
|
+
maxzoom = input(...(ngDevMode ? [undefined, { debugName: "maxzoom" }] : []));
|
|
16
|
+
tileSize = input(...(ngDevMode ? [undefined, { debugName: "tileSize" }] : []));
|
|
17
|
+
scheme = input(...(ngDevMode ? [undefined, { debugName: "scheme" }] : []));
|
|
18
|
+
attribution = input(...(ngDevMode ? [undefined, { debugName: "attribution" }] : []));
|
|
19
|
+
volatile = input(...(ngDevMode ? [undefined, { debugName: "volatile" }] : []));
|
|
20
|
+
sourceAdded = false;
|
|
21
|
+
sub = new Subscription();
|
|
22
|
+
ngOnInit() {
|
|
23
|
+
const sub1 = this.mapService.mapLoaded$.subscribe(() => {
|
|
24
|
+
this.init();
|
|
25
|
+
const sub = fromEvent(this.mapService.mapInstance, 'styledata')
|
|
26
|
+
.pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))
|
|
27
|
+
.subscribe(() => {
|
|
28
|
+
this.init();
|
|
29
|
+
});
|
|
30
|
+
this.sub.add(sub);
|
|
31
|
+
});
|
|
32
|
+
this.sub.add(sub1);
|
|
33
|
+
}
|
|
34
|
+
ngOnChanges(changes) {
|
|
35
|
+
if (!this.sourceAdded) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if ((changes['url'] && !changes['url'].isFirstChange()) ||
|
|
39
|
+
(changes['tiles'] && !changes['tiles'].isFirstChange()) ||
|
|
40
|
+
(changes['bounds'] && !changes['bounds'].isFirstChange()) ||
|
|
41
|
+
(changes['minzoom'] && !changes['minzoom'].isFirstChange()) ||
|
|
42
|
+
(changes['maxzoom'] && !changes['maxzoom'].isFirstChange()) ||
|
|
43
|
+
(changes['tileSize'] && !changes['tileSize'].isFirstChange()) ||
|
|
44
|
+
(changes['scheme'] && !changes['scheme'].isFirstChange()) ||
|
|
45
|
+
(changes['attribution'] && !changes['attribution'].isFirstChange()) ||
|
|
46
|
+
(changes['volatile'] && !changes['volatile'].isFirstChange())) {
|
|
47
|
+
this.ngOnDestroy();
|
|
48
|
+
this.ngOnInit();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
ngOnDestroy() {
|
|
52
|
+
this.sub.unsubscribe();
|
|
53
|
+
if (this.sourceAdded) {
|
|
54
|
+
this.mapService.removeSource(this.id());
|
|
55
|
+
this.sourceAdded = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
init() {
|
|
59
|
+
const source = {
|
|
60
|
+
type: 'raster',
|
|
61
|
+
url: this.url(),
|
|
62
|
+
tiles: this.tiles(),
|
|
63
|
+
bounds: this.bounds(),
|
|
64
|
+
minzoom: this.minzoom(),
|
|
65
|
+
maxzoom: this.maxzoom(),
|
|
66
|
+
tileSize: this.tileSize(),
|
|
67
|
+
scheme: this.scheme(),
|
|
68
|
+
attribution: this.attribution(),
|
|
69
|
+
volatile: this.volatile(),
|
|
70
|
+
};
|
|
71
|
+
this.mapService.addSource(this.id(), source);
|
|
72
|
+
this.sourceAdded = true;
|
|
73
|
+
}
|
|
74
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RasterSourceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
75
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: RasterSourceComponent, isStandalone: true, selector: "mgl-raster-source", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: false, transformFunction: null }, tiles: { classPropertyName: "tiles", publicName: "tiles", isSignal: true, isRequired: false, transformFunction: null }, bounds: { classPropertyName: "bounds", publicName: "bounds", isSignal: true, isRequired: false, transformFunction: null }, minzoom: { classPropertyName: "minzoom", publicName: "minzoom", isSignal: true, isRequired: false, transformFunction: null }, maxzoom: { classPropertyName: "maxzoom", publicName: "maxzoom", isSignal: true, isRequired: false, transformFunction: null }, tileSize: { classPropertyName: "tileSize", publicName: "tileSize", isSignal: true, isRequired: false, transformFunction: null }, scheme: { classPropertyName: "scheme", publicName: "scheme", isSignal: true, isRequired: false, transformFunction: null }, attribution: { classPropertyName: "attribution", publicName: "attribution", isSignal: true, isRequired: false, transformFunction: null }, volatile: { classPropertyName: "volatile", publicName: "volatile", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RasterSourceComponent, decorators: [{
|
|
78
|
+
type: Component,
|
|
79
|
+
args: [{
|
|
80
|
+
selector: 'mgl-raster-source',
|
|
81
|
+
template: '',
|
|
82
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
83
|
+
}]
|
|
84
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], tiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "tiles", required: false }] }], bounds: [{ type: i0.Input, args: [{ isSignal: true, alias: "bounds", required: false }] }], minzoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "minzoom", required: false }] }], maxzoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxzoom", required: false }] }], tileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tileSize", required: false }] }], scheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "scheme", required: false }] }], attribution: [{ type: i0.Input, args: [{ isSignal: true, alias: "attribution", required: false }] }], volatile: [{ type: i0.Input, args: [{ isSignal: true, alias: "volatile", required: false }] }] } });
|
|
85
|
+
//# sourceMappingURL=raster-source.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raster-source.component.js","sourceRoot":"","sources":["../../../../../../libs/ngx-mapbox-gl/src/lib/source/raster-source.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EAKT,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;;AAOhD,MAAM,OAAO,qBAAqB;IACxB,UAA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;IACH,CAAC;IAEO,IAAI;QACV,MAAM,MAAM,GAA8B;YACxC,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;SAC1B,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;uGA3EU,qBAAqB;2FAArB,qBAAqB,o0CAHtB,EAAE;;2FAGD,qBAAqB;kBALjC,SAAS;mBAAC;oBACT,QAAQ,EAAE,mBAAmB;oBAC7B,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n inject,\n input,\n} from '@angular/core';\nimport type { RasterSourceSpecification } from 'mapbox-gl';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { MapService } from '../map/map.service';\n\n@Component({\n selector: 'mgl-raster-source',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RasterSourceComponent implements OnInit, OnDestroy, OnChanges {\n private mapService = inject(MapService);\n /* Init inputs */\n id = input.required<string>();\n\n /* Dynamic inputs */\n url = input<RasterSourceSpecification['url']>();\n tiles = input<RasterSourceSpecification['tiles']>();\n bounds = input<RasterSourceSpecification['bounds']>();\n minzoom = input<RasterSourceSpecification['minzoom']>();\n maxzoom = input<RasterSourceSpecification['maxzoom']>();\n tileSize = input<RasterSourceSpecification['tileSize']>();\n scheme = input<RasterSourceSpecification['scheme']>();\n attribution = input<RasterSourceSpecification['attribution']>();\n volatile = input<RasterSourceSpecification['volatile']>();\n\n private sourceAdded = false;\n private sub = new Subscription();\n\n ngOnInit() {\n const sub1 = this.mapService.mapLoaded$.subscribe(() => {\n this.init();\n const sub = fromEvent(this.mapService.mapInstance, 'styledata')\n .pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))\n .subscribe(() => {\n this.init();\n });\n this.sub.add(sub);\n });\n this.sub.add(sub1);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.sourceAdded) {\n return;\n }\n if (\n (changes['url'] && !changes['url'].isFirstChange()) ||\n (changes['tiles'] && !changes['tiles'].isFirstChange()) ||\n (changes['bounds'] && !changes['bounds'].isFirstChange()) ||\n (changes['minzoom'] && !changes['minzoom'].isFirstChange()) ||\n (changes['maxzoom'] && !changes['maxzoom'].isFirstChange()) ||\n (changes['tileSize'] && !changes['tileSize'].isFirstChange()) ||\n (changes['scheme'] && !changes['scheme'].isFirstChange()) ||\n (changes['attribution'] && !changes['attribution'].isFirstChange()) ||\n (changes['volatile'] && !changes['volatile'].isFirstChange())\n ) {\n this.ngOnDestroy();\n this.ngOnInit();\n }\n }\n\n ngOnDestroy() {\n this.sub.unsubscribe();\n if (this.sourceAdded) {\n this.mapService.removeSource(this.id());\n this.sourceAdded = false;\n }\n }\n\n private init() {\n const source: RasterSourceSpecification = {\n type: 'raster',\n url: this.url(),\n tiles: this.tiles(),\n bounds: this.bounds(),\n minzoom: this.minzoom(),\n maxzoom: this.maxzoom(),\n tileSize: this.tileSize(),\n scheme: this.scheme(),\n attribution: this.attribution(),\n volatile: this.volatile(),\n };\n this.mapService.addSource(this.id(), source);\n this.sourceAdded = true;\n }\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input, } from '@angular/core';
|
|
2
|
+
import { fromEvent, Subscription } from 'rxjs';
|
|
3
|
+
import { filter } from 'rxjs/operators';
|
|
4
|
+
import { MapService } from '../map/map.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class VectorSourceComponent {
|
|
7
|
+
mapService = inject(MapService);
|
|
8
|
+
/* Init inputs */
|
|
9
|
+
id = input.required(...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
10
|
+
/* Dynamic inputs */
|
|
11
|
+
url = input(...(ngDevMode ? [undefined, { debugName: "url" }] : []));
|
|
12
|
+
tiles = input(...(ngDevMode ? [undefined, { debugName: "tiles" }] : []));
|
|
13
|
+
bounds = input(...(ngDevMode ? [undefined, { debugName: "bounds" }] : []));
|
|
14
|
+
scheme = input(...(ngDevMode ? [undefined, { debugName: "scheme" }] : []));
|
|
15
|
+
minzoom = input(...(ngDevMode ? [undefined, { debugName: "minzoom" }] : []));
|
|
16
|
+
maxzoom = input(...(ngDevMode ? [undefined, { debugName: "maxzoom" }] : []));
|
|
17
|
+
attribution = input(...(ngDevMode ? [undefined, { debugName: "attribution" }] : []));
|
|
18
|
+
promoteId = input(...(ngDevMode ? [undefined, { debugName: "promoteId" }] : []));
|
|
19
|
+
volatile = input(...(ngDevMode ? [undefined, { debugName: "volatile" }] : []));
|
|
20
|
+
sourceAdded = false;
|
|
21
|
+
sub = new Subscription();
|
|
22
|
+
ngOnInit() {
|
|
23
|
+
const sub1 = this.mapService.mapLoaded$.subscribe(() => {
|
|
24
|
+
this.init();
|
|
25
|
+
const sub = fromEvent(this.mapService.mapInstance, 'styledata')
|
|
26
|
+
.pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))
|
|
27
|
+
.subscribe(() => {
|
|
28
|
+
this.init();
|
|
29
|
+
});
|
|
30
|
+
this.sub.add(sub);
|
|
31
|
+
});
|
|
32
|
+
this.sub.add(sub1);
|
|
33
|
+
}
|
|
34
|
+
ngOnChanges(changes) {
|
|
35
|
+
if (!this.sourceAdded) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if ((changes['bounds'] && !changes['bounds'].isFirstChange()) ||
|
|
39
|
+
(changes['scheme'] && !changes['scheme'].isFirstChange()) ||
|
|
40
|
+
(changes['minzoom'] && !changes['minzoom'].isFirstChange()) ||
|
|
41
|
+
(changes['maxzoom'] && !changes['maxzoom'].isFirstChange()) ||
|
|
42
|
+
(changes['attribution'] && !changes['attribution'].isFirstChange()) ||
|
|
43
|
+
(changes['promoteId'] && !changes['promoteId'].isFirstChange()) ||
|
|
44
|
+
(changes['volatile'] && !changes['volatile'].isFirstChange())) {
|
|
45
|
+
this.ngOnDestroy();
|
|
46
|
+
this.ngOnInit();
|
|
47
|
+
}
|
|
48
|
+
else if ((changes['url'] && !changes['url'].isFirstChange()) ||
|
|
49
|
+
(changes['tiles'] && !changes['tiles'].isFirstChange())) {
|
|
50
|
+
const source = this.mapService.getSource(this.id());
|
|
51
|
+
if (source === undefined) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (changes['url'] && this.url()) {
|
|
55
|
+
source.setUrl(this.url());
|
|
56
|
+
}
|
|
57
|
+
if (changes['tiles'] && this.tiles()) {
|
|
58
|
+
source.setTiles(this.tiles());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
ngOnDestroy() {
|
|
63
|
+
this.sub.unsubscribe();
|
|
64
|
+
if (this.sourceAdded) {
|
|
65
|
+
this.mapService.removeSource(this.id());
|
|
66
|
+
this.sourceAdded = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
reload() {
|
|
70
|
+
this.mapService.getSource(this.id())?.reload();
|
|
71
|
+
}
|
|
72
|
+
init() {
|
|
73
|
+
const source = {
|
|
74
|
+
type: 'vector',
|
|
75
|
+
url: this.url(),
|
|
76
|
+
tiles: this.tiles(),
|
|
77
|
+
bounds: this.bounds(),
|
|
78
|
+
scheme: this.scheme(),
|
|
79
|
+
minzoom: this.minzoom(),
|
|
80
|
+
maxzoom: this.maxzoom(),
|
|
81
|
+
attribution: this.attribution(),
|
|
82
|
+
promoteId: this.promoteId(),
|
|
83
|
+
volatile: this.volatile(),
|
|
84
|
+
};
|
|
85
|
+
this.mapService.addSource(this.id(), source);
|
|
86
|
+
this.sourceAdded = true;
|
|
87
|
+
}
|
|
88
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: VectorSourceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: VectorSourceComponent, isStandalone: true, selector: "mgl-vector-source", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: false, transformFunction: null }, tiles: { classPropertyName: "tiles", publicName: "tiles", isSignal: true, isRequired: false, transformFunction: null }, bounds: { classPropertyName: "bounds", publicName: "bounds", isSignal: true, isRequired: false, transformFunction: null }, scheme: { classPropertyName: "scheme", publicName: "scheme", isSignal: true, isRequired: false, transformFunction: null }, minzoom: { classPropertyName: "minzoom", publicName: "minzoom", isSignal: true, isRequired: false, transformFunction: null }, maxzoom: { classPropertyName: "maxzoom", publicName: "maxzoom", isSignal: true, isRequired: false, transformFunction: null }, attribution: { classPropertyName: "attribution", publicName: "attribution", isSignal: true, isRequired: false, transformFunction: null }, promoteId: { classPropertyName: "promoteId", publicName: "promoteId", isSignal: true, isRequired: false, transformFunction: null }, volatile: { classPropertyName: "volatile", publicName: "volatile", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
90
|
+
}
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: VectorSourceComponent, decorators: [{
|
|
92
|
+
type: Component,
|
|
93
|
+
args: [{
|
|
94
|
+
selector: 'mgl-vector-source',
|
|
95
|
+
template: '',
|
|
96
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
97
|
+
}]
|
|
98
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], tiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "tiles", required: false }] }], bounds: [{ type: i0.Input, args: [{ isSignal: true, alias: "bounds", required: false }] }], scheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "scheme", required: false }] }], minzoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "minzoom", required: false }] }], maxzoom: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxzoom", required: false }] }], attribution: [{ type: i0.Input, args: [{ isSignal: true, alias: "attribution", required: false }] }], promoteId: [{ type: i0.Input, args: [{ isSignal: true, alias: "promoteId", required: false }] }], volatile: [{ type: i0.Input, args: [{ isSignal: true, alias: "volatile", required: false }] }] } });
|
|
99
|
+
//# sourceMappingURL=vector-source.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-source.component.js","sourceRoot":"","sources":["../../../../../../libs/ngx-mapbox-gl/src/lib/source/vector-source.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EAKT,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;;AAOhD,MAAM,OAAO,qBAAqB;IACxB,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAExC,iBAAiB;IAC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2FAGD,qBAAqB;kBALjC,SAAS;mBAAC;oBACT,QAAQ,EAAE,mBAAmB;oBAC7B,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n inject,\n input,\n} from '@angular/core';\nimport type { VectorSourceSpecification, VectorTileSource } from 'mapbox-gl';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { MapService } from '../map/map.service';\n\n@Component({\n selector: 'mgl-vector-source',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class VectorSourceComponent implements OnInit, OnDestroy, OnChanges {\n private mapService = inject(MapService);\n\n /* Init inputs */\n id = input.required<string>();\n\n /* Dynamic inputs */\n url = input<VectorSourceSpecification['url']>();\n tiles = input<VectorSourceSpecification['tiles']>();\n bounds = input<VectorSourceSpecification['bounds']>();\n scheme = input<VectorSourceSpecification['scheme']>();\n minzoom = input<VectorSourceSpecification['minzoom']>();\n maxzoom = input<VectorSourceSpecification['maxzoom']>();\n attribution = input<VectorSourceSpecification['attribution']>();\n promoteId = input<VectorSourceSpecification['promoteId']>();\n volatile = input<VectorSourceSpecification['volatile']>();\n\n private sourceAdded = false;\n private sub = new Subscription();\n\n ngOnInit() {\n const sub1 = this.mapService.mapLoaded$.subscribe(() => {\n this.init();\n const sub = fromEvent(this.mapService.mapInstance, 'styledata')\n .pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))\n .subscribe(() => {\n this.init();\n });\n this.sub.add(sub);\n });\n this.sub.add(sub1);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.sourceAdded) {\n return;\n }\n\n if (\n (changes['bounds'] && !changes['bounds'].isFirstChange()) ||\n (changes['scheme'] && !changes['scheme'].isFirstChange()) ||\n (changes['minzoom'] && !changes['minzoom'].isFirstChange()) ||\n (changes['maxzoom'] && !changes['maxzoom'].isFirstChange()) ||\n (changes['attribution'] && !changes['attribution'].isFirstChange()) ||\n (changes['promoteId'] && !changes['promoteId'].isFirstChange()) ||\n (changes['volatile'] && !changes['volatile'].isFirstChange())\n ) {\n this.ngOnDestroy();\n this.ngOnInit();\n } else if (\n (changes['url'] && !changes['url'].isFirstChange()) ||\n (changes['tiles'] && !changes['tiles'].isFirstChange())\n ) {\n const source = this.mapService.getSource<VectorTileSource>(this.id());\n if (source === undefined) {\n return;\n }\n if (changes['url'] && this.url()) {\n source.setUrl(this.url()!);\n }\n\n if (changes['tiles'] && this.tiles()) {\n source.setTiles(this.tiles()!);\n }\n }\n }\n\n ngOnDestroy() {\n this.sub.unsubscribe();\n if (this.sourceAdded) {\n this.mapService.removeSource(this.id());\n this.sourceAdded = false;\n }\n }\n\n reload() {\n this.mapService.getSource<VectorTileSource>(this.id())?.reload();\n }\n\n private init() {\n const source: VectorSourceSpecification = {\n type: 'vector',\n url: this.url(),\n tiles: this.tiles(),\n bounds: this.bounds(),\n scheme: this.scheme(),\n minzoom: this.minzoom(),\n maxzoom: this.maxzoom(),\n attribution: this.attribution(),\n promoteId: this.promoteId(),\n volatile: this.volatile(),\n };\n this.mapService.addSource(this.id(), source);\n this.sourceAdded = true;\n }\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input, } from '@angular/core';
|
|
2
|
+
import { fromEvent, Subscription } from 'rxjs';
|
|
3
|
+
import { filter } from 'rxjs/operators';
|
|
4
|
+
import { MapService } from '../map/map.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class VideoSourceComponent {
|
|
7
|
+
mapService = inject(MapService);
|
|
8
|
+
/* Init inputs */
|
|
9
|
+
id = input.required(...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
10
|
+
/* Dynamic inputs */
|
|
11
|
+
urls = input.required(...(ngDevMode ? [{ debugName: "urls" }] : []));
|
|
12
|
+
coordinates = input.required(...(ngDevMode ? [{ debugName: "coordinates" }] : []));
|
|
13
|
+
sourceAdded = false;
|
|
14
|
+
sub = new Subscription();
|
|
15
|
+
ngOnInit() {
|
|
16
|
+
const sub1 = this.mapService.mapLoaded$.subscribe(() => {
|
|
17
|
+
this.init();
|
|
18
|
+
const sub = fromEvent(this.mapService.mapInstance, 'styledata')
|
|
19
|
+
.pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))
|
|
20
|
+
.subscribe(() => {
|
|
21
|
+
this.init();
|
|
22
|
+
});
|
|
23
|
+
this.sub.add(sub);
|
|
24
|
+
});
|
|
25
|
+
this.sub.add(sub1);
|
|
26
|
+
}
|
|
27
|
+
ngOnChanges(changes) {
|
|
28
|
+
if (!this.sourceAdded) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (changes['urls'] && !changes['urls'].isFirstChange()) {
|
|
32
|
+
this.ngOnDestroy();
|
|
33
|
+
this.ngOnInit();
|
|
34
|
+
}
|
|
35
|
+
else if (changes['coordinates'] &&
|
|
36
|
+
!changes['coordinates'].isFirstChange()) {
|
|
37
|
+
const source = this.mapService.getSource(this.id());
|
|
38
|
+
if (source === undefined) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
source.setCoordinates(this.coordinates());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
ngOnDestroy() {
|
|
45
|
+
this.sub.unsubscribe();
|
|
46
|
+
if (this.sourceAdded) {
|
|
47
|
+
this.mapService.removeSource(this.id());
|
|
48
|
+
this.sourceAdded = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
pause() {
|
|
52
|
+
this.mapService.getSource(this.id())?.pause();
|
|
53
|
+
}
|
|
54
|
+
play() {
|
|
55
|
+
this.mapService.getSource(this.id())?.play();
|
|
56
|
+
}
|
|
57
|
+
getVideo() {
|
|
58
|
+
return this.mapService.getSource(this.id())?.getVideo();
|
|
59
|
+
}
|
|
60
|
+
init() {
|
|
61
|
+
const source = {
|
|
62
|
+
type: 'video',
|
|
63
|
+
urls: this.urls(),
|
|
64
|
+
coordinates: this.coordinates(),
|
|
65
|
+
};
|
|
66
|
+
this.mapService.addSource(this.id(), source);
|
|
67
|
+
this.sourceAdded = true;
|
|
68
|
+
}
|
|
69
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: VideoSourceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
70
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: VideoSourceComponent, isStandalone: true, selector: "mgl-video-source", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, urls: { classPropertyName: "urls", publicName: "urls", isSignal: true, isRequired: true, transformFunction: null }, coordinates: { classPropertyName: "coordinates", publicName: "coordinates", isSignal: true, isRequired: true, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
71
|
+
}
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: VideoSourceComponent, decorators: [{
|
|
73
|
+
type: Component,
|
|
74
|
+
args: [{
|
|
75
|
+
selector: 'mgl-video-source',
|
|
76
|
+
template: '',
|
|
77
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
78
|
+
}]
|
|
79
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], urls: [{ type: i0.Input, args: [{ isSignal: true, alias: "urls", required: true }] }], coordinates: [{ type: i0.Input, args: [{ isSignal: true, alias: "coordinates", required: true }] }] } });
|
|
80
|
+
//# sourceMappingURL=video-source.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-source.component.js","sourceRoot":"","sources":["../../../../../../libs/ngx-mapbox-gl/src/lib/source/video-source.component.ts"],"names":[],"mappings":"AAAA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;YACvC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;SAChC,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;uGA5EU,oBAAoB;2FAApB,oBAAoB,wdAHrB,EAAE;;2FAGD,oBAAoB;kBALhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n inject,\n input,\n type InputSignal,\n} from '@angular/core';\nimport type { VideoSource, VideoSourceSpecification } from 'mapbox-gl';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { MapService } from '../map/map.service';\n\ntype VideoSourceInputs = {\n [K in keyof Omit<VideoSourceSpecification, 'type'>]: InputSignal<\n Omit<VideoSourceSpecification, 'type'>[K]\n >;\n};\n\n@Component({\n selector: 'mgl-video-source',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class VideoSourceComponent\n implements OnInit, OnDestroy, OnChanges, VideoSourceInputs\n{\n private mapService = inject(MapService);\n\n /* Init inputs */\n id = input.required<string>();\n\n /* Dynamic inputs */\n urls = input.required<VideoSourceSpecification['urls']>();\n coordinates = input.required<VideoSourceSpecification['coordinates']>();\n\n private sourceAdded = false;\n private sub = new Subscription();\n\n ngOnInit() {\n const sub1 = this.mapService.mapLoaded$.subscribe(() => {\n this.init();\n const sub = fromEvent(this.mapService.mapInstance, 'styledata')\n .pipe(filter(() => !this.mapService.mapInstance.getSource(this.id())))\n .subscribe(() => {\n this.init();\n });\n this.sub.add(sub);\n });\n this.sub.add(sub1);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (!this.sourceAdded) {\n return;\n }\n\n if (changes['urls'] && !changes['urls'].isFirstChange()) {\n this.ngOnDestroy();\n this.ngOnInit();\n } else if (\n changes['coordinates'] &&\n !changes['coordinates'].isFirstChange()\n ) {\n const source = this.mapService.getSource<VideoSource>(this.id());\n if (source === undefined) {\n return;\n }\n source.setCoordinates(this.coordinates()!);\n }\n }\n\n ngOnDestroy() {\n this.sub.unsubscribe();\n if (this.sourceAdded) {\n this.mapService.removeSource(this.id());\n this.sourceAdded = false;\n }\n }\n\n pause() {\n this.mapService.getSource<VideoSource>(this.id())?.pause();\n }\n\n play() {\n this.mapService.getSource<VideoSource>(this.id())?.play();\n }\n\n getVideo() {\n return this.mapService.getSource<VideoSource>(this.id())?.getVideo();\n }\n\n private init() {\n const source: VideoSourceSpecification = {\n type: 'video',\n urls: this.urls(),\n coordinates: this.coordinates(),\n };\n this.mapService.addSource(this.id(), source);\n this.sourceAdded = true;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-mapbox-gl.js","sourceRoot":"","sources":["../../../../libs/ngx-mapbox-gl/src/ngx-mapbox-gl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from './lib/provide-mapbox-gl';
|
|
2
|
+
export * from './lib/control/attribution-control.directive';
|
|
3
|
+
export * from './lib/control/control.component';
|
|
4
|
+
export * from './lib/control/fullscreen-control.directive';
|
|
5
|
+
export * from './lib/control/geolocate-control.directive';
|
|
6
|
+
export * from './lib/control/navigation-control.directive';
|
|
7
|
+
export * from './lib/control/scale-control.directive';
|
|
8
|
+
export * from './lib/draggable/draggable.directive';
|
|
9
|
+
export * from './lib/image/image.component';
|
|
10
|
+
export * from './lib/layer/layer.component';
|
|
11
|
+
export * from './lib/map/map.component';
|
|
12
|
+
export * from './lib/map/map.service';
|
|
13
|
+
export * from './lib/map/map.types';
|
|
14
|
+
export * from './lib/marker/marker.component';
|
|
15
|
+
export * from './lib/markers-for-clusters/markers-for-clusters.component';
|
|
16
|
+
export * from './lib/popup/popup.component';
|
|
17
|
+
export * from './lib/source/canvas-source.component';
|
|
18
|
+
export * from './lib/source/geojson/feature.component';
|
|
19
|
+
export * from './lib/source/geojson/geojson-source.component';
|
|
20
|
+
export * from './lib/source/image-source.component';
|
|
21
|
+
export * from './lib/source/raster-dem-source.component';
|
|
22
|
+
export * from './lib/source/raster-source.component';
|
|
23
|
+
export * from './lib/source/vector-source.component';
|
|
24
|
+
export * from './lib/source/video-source.component';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AfterContentInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class AttributionControlDirective implements AfterContentInit {
|
|
4
|
+
private mapService;
|
|
5
|
+
private controlComponent;
|
|
6
|
+
compact: import("@angular/core").InputSignal<boolean | undefined>;
|
|
7
|
+
customAttribution: import("@angular/core").InputSignal<string | string[] | undefined>;
|
|
8
|
+
ngAfterContentInit(): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AttributionControlDirective, never>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AttributionControlDirective, "[mglAttribution]", never, { "compact": { "alias": "compact"; "required": false; "isSignal": true; }; "customAttribution": { "alias": "customAttribution"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AfterContentInit, ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
import { IControl, type ControlPosition } from 'mapbox-gl';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class CustomControl implements IControl {
|
|
5
|
+
private container;
|
|
6
|
+
constructor(container: HTMLElement);
|
|
7
|
+
onAdd(): HTMLElement;
|
|
8
|
+
onRemove(): HTMLElement;
|
|
9
|
+
getDefaultPosition(): ControlPosition;
|
|
10
|
+
}
|
|
11
|
+
export declare class ControlComponent<T extends IControl> implements OnDestroy, AfterContentInit {
|
|
12
|
+
private mapService;
|
|
13
|
+
position: import("@angular/core").InputSignal<"top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined>;
|
|
14
|
+
content: ElementRef;
|
|
15
|
+
control: T | CustomControl;
|
|
16
|
+
private controlAdded;
|
|
17
|
+
ngAfterContentInit(): void;
|
|
18
|
+
ngOnDestroy(): void;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ControlComponent<any>, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ControlComponent<any>, "mgl-control", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AfterContentInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class FullscreenControlDirective implements AfterContentInit {
|
|
4
|
+
private mapService;
|
|
5
|
+
private controlComponent;
|
|
6
|
+
container: import("@angular/core").InputSignal<HTMLElement | undefined>;
|
|
7
|
+
onFullscreen(target: EventTarget | null): void;
|
|
8
|
+
ngAfterContentInit(): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FullscreenControlDirective, never>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FullscreenControlDirective, "[mglFullscreen]", never, { "container": { "alias": "container"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AfterContentInit, EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class GeolocateControlDirective implements AfterContentInit {
|
|
4
|
+
private mapService;
|
|
5
|
+
private controlComponent;
|
|
6
|
+
positionOptions: import("@angular/core").InputSignal<PositionOptions | undefined>;
|
|
7
|
+
fitBoundsOptions: import("@angular/core").InputSignal<import("mapbox-gl").EasingOptions | undefined>;
|
|
8
|
+
trackUserLocation: import("@angular/core").InputSignal<boolean | undefined>;
|
|
9
|
+
showUserLocation: import("@angular/core").InputSignal<boolean | undefined>;
|
|
10
|
+
showUserHeading: import("@angular/core").InputSignal<boolean | undefined>;
|
|
11
|
+
geolocate: EventEmitter<GeolocationPosition>;
|
|
12
|
+
ngAfterContentInit(): void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeolocateControlDirective, never>;
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<GeolocateControlDirective, "[mglGeolocate]", never, { "positionOptions": { "alias": "positionOptions"; "required": false; "isSignal": true; }; "fitBoundsOptions": { "alias": "fitBoundsOptions"; "required": false; "isSignal": true; }; "trackUserLocation": { "alias": "trackUserLocation"; "required": false; "isSignal": true; }; "showUserLocation": { "alias": "showUserLocation"; "required": false; "isSignal": true; }; "showUserHeading": { "alias": "showUserHeading"; "required": false; "isSignal": true; }; }, { "geolocate": "geolocate"; }, never, never, true, never>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AfterContentInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class NavigationControlDirective implements AfterContentInit {
|
|
4
|
+
private mapService;
|
|
5
|
+
private controlComponent;
|
|
6
|
+
showCompass: import("@angular/core").InputSignal<boolean | undefined>;
|
|
7
|
+
showZoom: import("@angular/core").InputSignal<boolean | undefined>;
|
|
8
|
+
ngAfterContentInit(): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NavigationControlDirective, never>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NavigationControlDirective, "[mglNavigation]", never, { "showCompass": { "alias": "showCompass"; "required": false; "isSignal": true; }; "showZoom": { "alias": "showZoom"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AfterContentInit, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ScaleControlDirective implements AfterContentInit, OnChanges {
|
|
4
|
+
private mapService;
|
|
5
|
+
private controlComponent;
|
|
6
|
+
maxWidth: import("@angular/core").InputSignal<number | undefined>;
|
|
7
|
+
unit: import("@angular/core").InputSignal<"imperial" | "metric" | "nautical" | undefined>;
|
|
8
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
9
|
+
ngAfterContentInit(): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScaleControlDirective, never>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ScaleControlDirective, "[mglScale]", never, { "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; "unit": { "alias": "unit"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { MapMouseEvent } from 'mapbox-gl';
|
|
3
|
+
import { LayerComponent } from '../layer/layer.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class DraggableDirective implements OnInit, OnDestroy {
|
|
6
|
+
private mapService;
|
|
7
|
+
private ngZone;
|
|
8
|
+
private featureComponent;
|
|
9
|
+
layer: import("@angular/core").InputSignal<LayerComponent | undefined>;
|
|
10
|
+
featureDragStart: EventEmitter<MapMouseEvent>;
|
|
11
|
+
featureDragEnd: EventEmitter<MapMouseEvent>;
|
|
12
|
+
featureDrag: EventEmitter<MapMouseEvent>;
|
|
13
|
+
private sub;
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
private handleDraggable;
|
|
17
|
+
private filterFeature;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DraggableDirective, never>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DraggableDirective, "[mglDraggable]", never, { "layer": { "alias": "mglDraggable"; "required": false; "isSignal": true; }; }, { "featureDragStart": "featureDragStart"; "featureDragEnd": "featureDragEnd"; "featureDrag": "featureDrag"; }, never, never, true, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ImageComponent implements OnInit, OnDestroy, OnChanges {
|
|
4
|
+
private mapService;
|
|
5
|
+
private zone;
|
|
6
|
+
id: import("@angular/core").InputSignal<string>;
|
|
7
|
+
data: import("@angular/core").InputSignal<HTMLImageElement | ImageBitmap | ImageData | import("mapbox-gl").StyleImageInterface | {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
data: Uint8Array | Uint8ClampedArray;
|
|
11
|
+
} | undefined>;
|
|
12
|
+
options: import("@angular/core").InputSignal<Partial<{
|
|
13
|
+
pixelRatio: number;
|
|
14
|
+
sdf: boolean;
|
|
15
|
+
usvg: boolean;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
stretchX?: Array<[number, number]>;
|
|
19
|
+
stretchY?: Array<[number, number]>;
|
|
20
|
+
content?: [number, number, number, number];
|
|
21
|
+
}> | undefined>;
|
|
22
|
+
url: import("@angular/core").InputSignal<string | undefined>;
|
|
23
|
+
imageError: EventEmitter<Error>;
|
|
24
|
+
imageLoaded: EventEmitter<void>;
|
|
25
|
+
private isAdded;
|
|
26
|
+
private isAdding;
|
|
27
|
+
private sub;
|
|
28
|
+
ngOnInit(): void;
|
|
29
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
30
|
+
ngOnDestroy(): void;
|
|
31
|
+
private init;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ImageComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ImageComponent, "mgl-image", never, { "id": { "alias": "id"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "url": { "alias": "url"; "required": false; "isSignal": true; }; }, { "imageError": "imageError"; "imageLoaded": "imageLoaded"; }, never, never, true, never>;
|
|
34
|
+
}
|