@angular-helpers/openlayers 0.1.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.
@@ -0,0 +1,215 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable, input, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import VectorLayer from 'ol/layer/Vector';
4
+ import TileLayer from 'ol/layer/Tile';
5
+ import ImageLayer from 'ol/layer/Image';
6
+ import VectorSource from 'ol/source/Vector';
7
+ import OSM from 'ol/source/OSM';
8
+ import XYZ from 'ol/source/XYZ';
9
+ import TileWMS from 'ol/source/TileWMS';
10
+ import ImageWMS from 'ol/source/ImageWMS';
11
+ import { OlMapService } from '@angular-helpers/openlayers/core';
12
+
13
+ // OlLayerService
14
+ class OlLayerService {
15
+ mapService = inject(OlMapService);
16
+ layerCache = new Map();
17
+ addLayer(config) {
18
+ // If layer already exists, return it (idempotent for retries)
19
+ if (this.layerCache.has(config.id)) {
20
+ return { id: config.id };
21
+ }
22
+ const map = this.mapService.getMap();
23
+ if (!map) {
24
+ // Map not ready yet - caller should retry
25
+ return { id: config.id };
26
+ }
27
+ switch (config.type) {
28
+ case 'vector':
29
+ return this.createVectorLayer(config, map);
30
+ case 'tile':
31
+ return this.createTileLayer(config, map);
32
+ case 'image':
33
+ return this.createImageLayer(config, map);
34
+ default:
35
+ return { id: config.id };
36
+ }
37
+ }
38
+ removeLayer(id) {
39
+ const map = this.mapService.getMap();
40
+ const layer = this.layerCache.get(id);
41
+ if (map && layer) {
42
+ map.removeLayer(layer);
43
+ this.layerCache.delete(id);
44
+ }
45
+ }
46
+ setVisibility(id, visible) {
47
+ this.layerCache.get(id)?.setVisible(visible);
48
+ }
49
+ setOpacity(id, opacity) {
50
+ this.layerCache.get(id)?.setOpacity(opacity);
51
+ }
52
+ createVectorLayer(config, map) {
53
+ const layer = new VectorLayer({
54
+ source: new VectorSource(),
55
+ visible: config.visible ?? true,
56
+ opacity: config.opacity ?? 1,
57
+ zIndex: config.zIndex,
58
+ });
59
+ layer.set('id', config.id);
60
+ map.addLayer(layer);
61
+ this.layerCache.set(config.id, layer);
62
+ return { id: config.id };
63
+ }
64
+ createTileLayer(config, map) {
65
+ let source;
66
+ switch (config.source.type) {
67
+ case 'osm':
68
+ source = new OSM({ attributions: config.source.attributions });
69
+ break;
70
+ case 'xyz':
71
+ source = new XYZ({ url: config.source.url, attributions: config.source.attributions });
72
+ break;
73
+ case 'wms':
74
+ source = new TileWMS({
75
+ url: config.source.url,
76
+ params: config.source.params,
77
+ attributions: config.source.attributions,
78
+ });
79
+ break;
80
+ default:
81
+ source = new OSM();
82
+ }
83
+ const layer = new TileLayer({
84
+ source,
85
+ visible: config.visible ?? true,
86
+ opacity: config.opacity ?? 1,
87
+ zIndex: config.zIndex,
88
+ });
89
+ layer.set('id', config.id);
90
+ map.addLayer(layer);
91
+ this.layerCache.set(config.id, layer);
92
+ return { id: config.id };
93
+ }
94
+ createImageLayer(config, map) {
95
+ const source = new ImageWMS({ url: config.source.url, params: config.source.params });
96
+ const layer = new ImageLayer({
97
+ source,
98
+ visible: config.visible ?? true,
99
+ opacity: config.opacity ?? 1,
100
+ zIndex: config.zIndex,
101
+ });
102
+ layer.set('id', config.id);
103
+ map.addLayer(layer);
104
+ this.layerCache.set(config.id, layer);
105
+ return { id: config.id };
106
+ }
107
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlLayerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
108
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlLayerService });
109
+ }
110
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlLayerService, decorators: [{
111
+ type: Injectable
112
+ }] });
113
+
114
+ // OlVectorLayerComponent
115
+ class OlVectorLayerComponent {
116
+ layerService = inject(OlLayerService);
117
+ id = input.required(...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
118
+ features = input([], ...(ngDevMode ? [{ debugName: "features" }] : /* istanbul ignore next */ []));
119
+ zIndex = input(0, ...(ngDevMode ? [{ debugName: "zIndex" }] : /* istanbul ignore next */ []));
120
+ opacity = input(1, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
121
+ visible = input(true, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
122
+ style = input(...(ngDevMode ? [undefined, { debugName: "style" }] : /* istanbul ignore next */ []));
123
+ ngOnInit() {
124
+ this.layerService.addLayer({
125
+ id: this.id(),
126
+ type: 'vector',
127
+ features: this.features(),
128
+ zIndex: this.zIndex(),
129
+ opacity: this.opacity(),
130
+ visible: this.visible(),
131
+ style: this.style(),
132
+ });
133
+ }
134
+ ngOnDestroy() {
135
+ this.layerService.removeLayer(this.id());
136
+ }
137
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlVectorLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
138
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: OlVectorLayerComponent, isStandalone: true, selector: "ol-vector-layer", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, features: { classPropertyName: "features", publicName: "features", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlVectorLayerComponent, decorators: [{
141
+ type: Component,
142
+ args: [{
143
+ selector: 'ol-vector-layer',
144
+ template: '',
145
+ changeDetection: ChangeDetectionStrategy.OnPush,
146
+ }]
147
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], features: [{ type: i0.Input, args: [{ isSignal: true, alias: "features", required: false }] }], zIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIndex", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }] } });
148
+
149
+ // OlTileLayerComponent
150
+ class OlTileLayerComponent {
151
+ layerService = inject(OlLayerService);
152
+ id = input.required(...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
153
+ source = input.required(...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
154
+ url = input(...(ngDevMode ? [undefined, { debugName: "url" }] : /* istanbul ignore next */ []));
155
+ attributions = input(...(ngDevMode ? [undefined, { debugName: "attributions" }] : /* istanbul ignore next */ []));
156
+ params = input(...(ngDevMode ? [undefined, { debugName: "params" }] : /* istanbul ignore next */ []));
157
+ zIndex = input(0, ...(ngDevMode ? [{ debugName: "zIndex" }] : /* istanbul ignore next */ []));
158
+ opacity = input(1, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
159
+ visible = input(true, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
160
+ ngOnInit() {
161
+ // Retry adding layer if map is not ready yet
162
+ this.tryAddLayer();
163
+ }
164
+ tryAddLayer(retryCount = 0) {
165
+ const result = this.layerService.addLayer({
166
+ id: this.id(),
167
+ type: 'tile',
168
+ source: {
169
+ type: this.source(),
170
+ url: this.url(),
171
+ attributions: this.attributions(),
172
+ params: this.params(),
173
+ },
174
+ zIndex: this.zIndex(),
175
+ opacity: this.opacity(),
176
+ visible: this.visible(),
177
+ });
178
+ // If layer wasn't added (map not ready), retry with exponential backoff
179
+ if (retryCount < 10) {
180
+ setTimeout(() => {
181
+ // Check if layer was actually added by trying again
182
+ this.tryAddLayer(retryCount + 1);
183
+ }, Math.min(50 * (retryCount + 1), 500));
184
+ }
185
+ }
186
+ ngOnDestroy() {
187
+ this.layerService.removeLayer(this.id());
188
+ }
189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
190
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: OlTileLayerComponent, isStandalone: true, selector: "ol-tile-layer", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: false, transformFunction: null }, attributions: { classPropertyName: "attributions", publicName: "attributions", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
191
+ }
192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlTileLayerComponent, decorators: [{
193
+ type: Component,
194
+ args: [{
195
+ selector: 'ol-tile-layer',
196
+ template: '',
197
+ changeDetection: ChangeDetectionStrategy.OnPush,
198
+ }]
199
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: true }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], attributions: [{ type: i0.Input, args: [{ isSignal: true, alias: "attributions", required: false }] }], params: [{ type: i0.Input, args: [{ isSignal: true, alias: "params", required: false }] }], zIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIndex", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }] } });
200
+
201
+ // Provider functions
202
+ function withLayers() {
203
+ return { kind: 'layers', providers: [OlLayerService] };
204
+ }
205
+ function provideLayers() {
206
+ return withLayers();
207
+ }
208
+
209
+ // @angular-helpers/openlayers/layers
210
+
211
+ /**
212
+ * Generated bundle index. Do not edit.
213
+ */
214
+
215
+ export { OlLayerService, OlTileLayerComponent, OlVectorLayerComponent, provideLayers, withLayers };
@@ -0,0 +1,38 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable } from '@angular/core';
3
+
4
+ // OlMilitaryService
5
+ class OlMilitaryService {
6
+ createEllipse(config) {
7
+ return { id: 'ellipse-1', geometry: { type: 'Polygon', coordinates: [] } };
8
+ }
9
+ createSector(config) {
10
+ return { id: 'sector-1', geometry: { type: 'Polygon', coordinates: [] } };
11
+ }
12
+ addMilSymbol(config) {
13
+ return {
14
+ id: `symbol-${config.sidc}`,
15
+ geometry: { type: 'Point', coordinates: config.position },
16
+ };
17
+ }
18
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlMilitaryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
19
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlMilitaryService });
20
+ }
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlMilitaryService, decorators: [{
22
+ type: Injectable
23
+ }] });
24
+
25
+ function withMilitary() {
26
+ return { kind: 'military', providers: [OlMilitaryService] };
27
+ }
28
+ function provideMilitary() {
29
+ return withMilitary();
30
+ }
31
+
32
+ // @angular-helpers/openlayers/military
33
+
34
+ /**
35
+ * Generated bundle index. Do not edit.
36
+ */
37
+
38
+ export { OlMilitaryService, provideMilitary, withMilitary };
@@ -0,0 +1,31 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable } from '@angular/core';
3
+
4
+ // OlPopupService
5
+ class OlPopupService {
6
+ showPopup(options) {
7
+ return 'popup-id';
8
+ }
9
+ hidePopup(id) { }
10
+ hideAllPopups() { }
11
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlPopupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
12
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlPopupService });
13
+ }
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: OlPopupService, decorators: [{
15
+ type: Injectable
16
+ }] });
17
+
18
+ function withOverlays() {
19
+ return { kind: 'overlays', providers: [OlPopupService] };
20
+ }
21
+ function provideOverlays() {
22
+ return withOverlays();
23
+ }
24
+
25
+ // @angular-helpers/openlayers/overlays
26
+
27
+ /**
28
+ * Generated bundle index. Do not edit.
29
+ */
30
+
31
+ export { OlPopupService, provideOverlays, withOverlays };
@@ -0,0 +1,3 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@angular-helpers/openlayers",
3
+ "version": "0.1.0",
4
+ "description": "Modern Angular wrapper for OpenLayers with modular architecture, standalone components, and hybrid template/programmatic API",
5
+ "homepage": "https://gaspar1992.github.io/angular-helpers/docs/openlayers",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/Gaspar1992/angular-helpers"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/Gaspar1992/angular-helpers/issues"
12
+ },
13
+ "keywords": [
14
+ "angular",
15
+ "openlayers",
16
+ "ol",
17
+ "mapping",
18
+ "gis",
19
+ "cartography",
20
+ "standalone",
21
+ "signals",
22
+ "modular",
23
+ "military",
24
+ "milsymbol"
25
+ ],
26
+ "author": "",
27
+ "license": "MIT",
28
+ "sideEffects": false,
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "peerDependencies": {
33
+ "@angular/core": "^21.0.0",
34
+ "@angular/common": "^21.0.0",
35
+ "ol": "^10.0.0"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "ol": {
39
+ "optional": false
40
+ }
41
+ },
42
+ "module": "fesm2022/angular-helpers-openlayers.mjs",
43
+ "typings": "types/angular-helpers-openlayers.d.ts",
44
+ "exports": {
45
+ "./package.json": {
46
+ "default": "./package.json"
47
+ },
48
+ ".": {
49
+ "types": "./types/angular-helpers-openlayers.d.ts",
50
+ "default": "./fesm2022/angular-helpers-openlayers.mjs"
51
+ },
52
+ "./controls": {
53
+ "types": "./types/angular-helpers-openlayers-controls.d.ts",
54
+ "default": "./fesm2022/angular-helpers-openlayers-controls.mjs"
55
+ },
56
+ "./core": {
57
+ "types": "./types/angular-helpers-openlayers-core.d.ts",
58
+ "default": "./fesm2022/angular-helpers-openlayers-core.mjs"
59
+ },
60
+ "./interactions": {
61
+ "types": "./types/angular-helpers-openlayers-interactions.d.ts",
62
+ "default": "./fesm2022/angular-helpers-openlayers-interactions.mjs"
63
+ },
64
+ "./layers": {
65
+ "types": "./types/angular-helpers-openlayers-layers.d.ts",
66
+ "default": "./fesm2022/angular-helpers-openlayers-layers.mjs"
67
+ },
68
+ "./military": {
69
+ "types": "./types/angular-helpers-openlayers-military.d.ts",
70
+ "default": "./fesm2022/angular-helpers-openlayers-military.mjs"
71
+ },
72
+ "./overlays": {
73
+ "types": "./types/angular-helpers-openlayers-overlays.d.ts",
74
+ "default": "./fesm2022/angular-helpers-openlayers-overlays.mjs"
75
+ }
76
+ },
77
+ "dependencies": {
78
+ "tslib": "^2.3.0"
79
+ }
80
+ }
@@ -0,0 +1,77 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnInit, OnDestroy } from '@angular/core';
3
+ import { OlFeature } from '@angular-helpers/openlayers/core';
4
+
5
+ declare class OlZoomControlComponent implements OnInit, OnDestroy {
6
+ private mapService;
7
+ private ngZone;
8
+ delta: _angular_core.InputSignal<number>;
9
+ duration: _angular_core.InputSignal<number>;
10
+ private control?;
11
+ ngOnInit(): void;
12
+ private tryAddControl;
13
+ ngOnDestroy(): void;
14
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlZoomControlComponent, never>;
15
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<OlZoomControlComponent, "ol-zoom-control", never, { "delta": { "alias": "delta"; "required": false; "isSignal": true; }; "duration": { "alias": "duration"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
16
+ }
17
+
18
+ declare class OlAttributionControlComponent implements OnInit, OnDestroy {
19
+ private mapService;
20
+ private ngZone;
21
+ collapsible: _angular_core.InputSignal<boolean>;
22
+ collapsed: _angular_core.InputSignal<boolean>;
23
+ private control?;
24
+ ngOnInit(): void;
25
+ private tryAddControl;
26
+ ngOnDestroy(): void;
27
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlAttributionControlComponent, never>;
28
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<OlAttributionControlComponent, "ol-attribution-control", never, { "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
29
+ }
30
+
31
+ declare class OlScaleLineControlComponent implements OnInit, OnDestroy {
32
+ private mapService;
33
+ private ngZone;
34
+ units: _angular_core.InputSignal<"metric" | "imperial" | "nautical" | "us">;
35
+ bar: _angular_core.InputSignal<boolean>;
36
+ steps: _angular_core.InputSignal<number>;
37
+ private control?;
38
+ ngOnInit(): void;
39
+ private tryAddControl;
40
+ ngOnDestroy(): void;
41
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlScaleLineControlComponent, never>;
42
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<OlScaleLineControlComponent, "ol-scale-line-control", never, { "units": { "alias": "units"; "required": false; "isSignal": true; }; "bar": { "alias": "bar"; "required": false; "isSignal": true; }; "steps": { "alias": "steps"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
43
+ }
44
+
45
+ declare class OlFullscreenControlComponent implements OnInit, OnDestroy {
46
+ private mapService;
47
+ private ngZone;
48
+ source: _angular_core.InputSignal<HTMLElement>;
49
+ label: _angular_core.InputSignal<string>;
50
+ labelActive: _angular_core.InputSignal<string>;
51
+ tipLabel: _angular_core.InputSignal<string>;
52
+ private control?;
53
+ ngOnInit(): void;
54
+ private tryAddControl;
55
+ ngOnDestroy(): void;
56
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlFullscreenControlComponent, never>;
57
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<OlFullscreenControlComponent, "ol-fullscreen-control", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelActive": { "alias": "labelActive"; "required": false; "isSignal": true; }; "tipLabel": { "alias": "tipLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
58
+ }
59
+
60
+ type ControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center' | 'left-center' | 'right-center';
61
+ interface ControlConfig {
62
+ position?: ControlPosition;
63
+ className?: string;
64
+ }
65
+
66
+ declare class OlControlService {
67
+ addCustomControl(element: HTMLElement, position: ControlPosition): void;
68
+ removeCustomControl(element: HTMLElement): void;
69
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlControlService, never>;
70
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<OlControlService>;
71
+ }
72
+
73
+ declare function withControls(): OlFeature<'controls'>;
74
+ declare function provideControls(): OlFeature<'controls'>;
75
+
76
+ export { OlAttributionControlComponent, OlControlService, OlFullscreenControlComponent, OlScaleLineControlComponent, OlZoomControlComponent, provideControls, withControls };
77
+ export type { ControlConfig, ControlPosition };
@@ -0,0 +1,144 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { AfterViewInit, OnDestroy, ElementRef, Provider, EnvironmentProviders } from '@angular/core';
3
+ import OLMap from 'ol/Map';
4
+ import { View } from 'ol';
5
+
6
+ type Coordinate = [number, number];
7
+ type Extent = [number, number, number, number];
8
+ type Pixel = [number, number];
9
+ type FeatureId = string;
10
+ interface Feature {
11
+ id: FeatureId;
12
+ geometry: Geometry;
13
+ properties?: Record<string, unknown>;
14
+ style?: Style;
15
+ }
16
+ type GeometryType = 'Point' | 'LineString' | 'Polygon' | 'Circle' | 'Ellipse' | 'Sector';
17
+ interface Geometry {
18
+ type: GeometryType;
19
+ coordinates: Coordinate | Coordinate[] | Coordinate[][];
20
+ }
21
+ interface Style {
22
+ fill?: {
23
+ color?: string;
24
+ };
25
+ stroke?: {
26
+ color?: string;
27
+ width?: number;
28
+ };
29
+ image?: {
30
+ radius?: number;
31
+ fill?: {
32
+ color?: string;
33
+ };
34
+ stroke?: {
35
+ color?: string;
36
+ width?: number;
37
+ };
38
+ };
39
+ text?: {
40
+ text?: string;
41
+ font?: string;
42
+ fill?: {
43
+ color?: string;
44
+ };
45
+ stroke?: {
46
+ color?: string;
47
+ width?: number;
48
+ };
49
+ };
50
+ }
51
+ interface Layer {
52
+ id: string;
53
+ visible?: boolean;
54
+ opacity?: number;
55
+ zIndex?: number;
56
+ }
57
+ interface ViewState {
58
+ center: Coordinate;
59
+ zoom: number;
60
+ rotation?: number;
61
+ }
62
+ type ProjectionCode = 'EPSG:4326' | 'EPSG:3857' | string;
63
+ interface MapConfig {
64
+ target?: string | HTMLElement;
65
+ view?: Partial<ViewState>;
66
+ projection?: ProjectionCode;
67
+ }
68
+
69
+ interface MapClickEvent {
70
+ coordinate: Coordinate;
71
+ pixel: Pixel;
72
+ }
73
+ declare class OlMapComponent implements AfterViewInit, OnDestroy {
74
+ private mapService;
75
+ private ngZone;
76
+ center: _angular_core.InputSignal<Coordinate>;
77
+ zoom: _angular_core.InputSignal<number>;
78
+ rotation: _angular_core.InputSignal<number>;
79
+ projection: _angular_core.InputSignal<string>;
80
+ viewChange: _angular_core.OutputEmitterRef<ViewState>;
81
+ mapClick: _angular_core.OutputEmitterRef<MapClickEvent>;
82
+ mapDblClick: _angular_core.OutputEmitterRef<MapClickEvent>;
83
+ mapContainerRef: _angular_core.Signal<ElementRef<HTMLDivElement>>;
84
+ private map?;
85
+ constructor();
86
+ ngAfterViewInit(): void;
87
+ ngOnDestroy(): void;
88
+ private initMap;
89
+ private destroyMap;
90
+ private updateCenter;
91
+ private updateZoom;
92
+ private updateRotation;
93
+ private emitViewChange;
94
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlMapComponent, never>;
95
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<OlMapComponent, "ol-map", never, { "center": { "alias": "center"; "required": false; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; "rotation": { "alias": "rotation"; "required": false; "isSignal": true; }; "projection": { "alias": "projection"; "required": false; "isSignal": true; }; }, { "viewChange": "viewChange"; "mapClick": "mapClick"; "mapDblClick": "mapDblClick"; }, never, ["*"], true, never>;
96
+ }
97
+
98
+ interface AnimationOptions {
99
+ center?: Coordinate;
100
+ zoom?: number;
101
+ rotation?: number;
102
+ duration?: number;
103
+ }
104
+ interface FitOptions {
105
+ padding?: [number, number, number, number];
106
+ maxZoom?: number;
107
+ duration?: number;
108
+ }
109
+ interface MapViewOptions {
110
+ center?: Coordinate;
111
+ zoom?: number;
112
+ minZoom?: number;
113
+ maxZoom?: number;
114
+ rotation?: number;
115
+ projection?: string;
116
+ }
117
+ declare class OlMapService {
118
+ private ngZone;
119
+ private map;
120
+ setMap(map: OLMap): void;
121
+ getMap(): OLMap | null;
122
+ getView(): View | null;
123
+ setCenter(coordinate: Coordinate): void;
124
+ setZoom(level: number): void;
125
+ fitExtent(extent: Extent, options?: FitOptions): void;
126
+ animateView(options: AnimationOptions): Promise<void>;
127
+ getViewState(): {
128
+ center: Coordinate;
129
+ zoom: number;
130
+ rotation: number;
131
+ };
132
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<OlMapService, never>;
133
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<OlMapService>;
134
+ }
135
+
136
+ type OlFeatureKind = 'layers' | 'controls' | 'interactions' | 'overlays' | 'military';
137
+ interface OlFeature<Kind extends OlFeatureKind> {
138
+ kind: Kind;
139
+ providers: Provider[];
140
+ }
141
+ declare function provideOpenLayers(...features: OlFeature<OlFeatureKind>[]): EnvironmentProviders;
142
+
143
+ export { OlMapComponent, OlMapService, provideOpenLayers };
144
+ export type { AnimationOptions, Coordinate, Extent, Feature, FitOptions, Geometry, GeometryType, Layer, MapClickEvent, MapConfig, MapViewOptions, OlFeature, OlFeatureKind, Pixel, ProjectionCode, Style, ViewState };
@@ -0,0 +1,35 @@
1
+ import { Observable } from 'rxjs';
2
+ import { Feature, OlFeature } from '@angular-helpers/openlayers/core';
3
+ import * as i0 from '@angular/core';
4
+
5
+ type InteractionType = 'select' | 'draw' | 'modify' | 'dragAndDrop';
6
+ interface InteractionConfig {
7
+ active?: boolean;
8
+ }
9
+ interface SelectConfig extends InteractionConfig {
10
+ layers?: string[];
11
+ multi?: boolean;
12
+ }
13
+ interface DrawConfig extends InteractionConfig {
14
+ type: 'Point' | 'LineString' | 'Polygon' | 'Circle';
15
+ source?: string;
16
+ freehand?: boolean;
17
+ }
18
+ interface SelectEvent {
19
+ feature: Feature;
20
+ selected: boolean;
21
+ }
22
+
23
+ declare class OlInteractionService {
24
+ enableInteraction(type: InteractionType, config: unknown): unknown;
25
+ disableInteraction(id: string): void;
26
+ startDrawing(type: string, options?: DrawConfig): Observable<Feature>;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<OlInteractionService, never>;
28
+ static ɵprov: i0.ɵɵInjectableDeclaration<OlInteractionService>;
29
+ }
30
+
31
+ declare function withInteractions(): OlFeature<'interactions'>;
32
+ declare function provideInteractions(): OlFeature<'interactions'>;
33
+
34
+ export { OlInteractionService, provideInteractions, withInteractions };
35
+ export type { DrawConfig, InteractionConfig, InteractionType, SelectConfig, SelectEvent };