aur-openlayers 0.0.1
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 +63 -0
- package/fesm2022/aur-openlayers.mjs +2118 -0
- package/fesm2022/aur-openlayers.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/lib.component.d.ts +5 -0
- package/lib/lib.service.d.ts +6 -0
- package/lib/map-framework/index.d.ts +2 -0
- package/lib/map-framework/public/types.d.ts +658 -0
- package/lib/map-framework/runtime/cluster-utils.d.ts +3 -0
- package/lib/map-framework/runtime/clustered-layer.d.ts +17 -0
- package/lib/map-framework/runtime/feature-registry.d.ts +16 -0
- package/lib/map-framework/runtime/fit-layer.utils.d.ts +3 -0
- package/lib/map-framework/runtime/interaction-manager.d.ts +110 -0
- package/lib/map-framework/runtime/layer-manager.d.ts +17 -0
- package/lib/map-framework/runtime/map-context.d.ts +4 -0
- package/lib/map-framework/runtime/plain-layer.d.ts +6 -0
- package/lib/map-framework/runtime/popup-host.d.ts +31 -0
- package/lib/map-framework/runtime/scheduler.d.ts +21 -0
- package/lib/map-framework/runtime/style/feature-states.d.ts +5 -0
- package/lib/map-framework/runtime/style/style-cache.d.ts +7 -0
- package/lib/map-framework/runtime/style/style-pipeline.d.ts +20 -0
- package/lib/map-framework/runtime/vector-layer-base.d.ts +53 -0
- package/package.json +24 -0
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ViewFitOptions, ViewFitPadding } from '../public/types';
|
|
2
|
+
export declare function toOlPadding(p?: ViewFitPadding, fallback?: [number, number, number, number] | undefined): [number, number, number, number] | undefined;
|
|
3
|
+
export declare function toOlFitOptions(opts?: ViewFitOptions): any;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import Feature from 'ol/Feature';
|
|
2
|
+
import type Geometry from 'ol/geom/Geometry';
|
|
3
|
+
import type MapBrowserEvent from 'ol/MapBrowserEvent';
|
|
4
|
+
import type OlMap from 'ol/Map';
|
|
5
|
+
import type VectorLayer from 'ol/layer/Vector';
|
|
6
|
+
import type { HitItem, MapContext, MapSchema, VectorLayerApi, VectorLayerDescriptor } from '../public/types';
|
|
7
|
+
export type HitTestArgs = {
|
|
8
|
+
layerId: string;
|
|
9
|
+
layer: VectorLayer;
|
|
10
|
+
api: VectorLayerApi<any, any>;
|
|
11
|
+
descriptor: VectorLayerDescriptor<any, any, any, any>;
|
|
12
|
+
event: MapBrowserEvent<UIEvent>;
|
|
13
|
+
hitTolerance: number;
|
|
14
|
+
};
|
|
15
|
+
export type ClusterHit = {
|
|
16
|
+
feature: Feature<Geometry>;
|
|
17
|
+
features: Array<Feature<Geometry>>;
|
|
18
|
+
size: number;
|
|
19
|
+
};
|
|
20
|
+
export type HitTestResult = {
|
|
21
|
+
items: Array<HitItem<any, any>>;
|
|
22
|
+
cluster?: ClusterHit;
|
|
23
|
+
};
|
|
24
|
+
export type HitTestFn = (args: HitTestArgs) => HitTestResult;
|
|
25
|
+
export type InteractionManagerOptions<Layers extends readonly VectorLayerDescriptor<any, any, any, any>[]> = {
|
|
26
|
+
ctx: MapContext;
|
|
27
|
+
map: OlMap;
|
|
28
|
+
schema: MapSchema<Layers>;
|
|
29
|
+
layers: Record<string, VectorLayer>;
|
|
30
|
+
apis: Record<string, VectorLayerApi<any, any>>;
|
|
31
|
+
hitTest?: HitTestFn;
|
|
32
|
+
};
|
|
33
|
+
export declare class InteractionManager<Layers extends readonly VectorLayerDescriptor<any, any, any, any>[]> {
|
|
34
|
+
private readonly ctx;
|
|
35
|
+
private readonly map;
|
|
36
|
+
private readonly schema;
|
|
37
|
+
private readonly layers;
|
|
38
|
+
private readonly apis;
|
|
39
|
+
private readonly hitTest;
|
|
40
|
+
private readonly hoverItems;
|
|
41
|
+
private readonly selectedItems;
|
|
42
|
+
private readonly activeTranslates;
|
|
43
|
+
private readonly activeModifies;
|
|
44
|
+
private readonly nativeModifies;
|
|
45
|
+
private readonly popupStack;
|
|
46
|
+
private readonly listenerKeys;
|
|
47
|
+
private readonly enabledState;
|
|
48
|
+
private dragPanLocks;
|
|
49
|
+
private dragPanStates?;
|
|
50
|
+
private currentCursor?;
|
|
51
|
+
constructor(options: InteractionManagerOptions<Layers>);
|
|
52
|
+
refreshEnabled(): void;
|
|
53
|
+
handlePointerDown(event: MapBrowserEvent<UIEvent>): void;
|
|
54
|
+
handlePointerDrag(event: MapBrowserEvent<UIEvent>): void;
|
|
55
|
+
handlePointerUp(event: MapBrowserEvent<UIEvent>): void;
|
|
56
|
+
handlePointerMove(event: MapBrowserEvent<UIEvent>): void;
|
|
57
|
+
handleSingleClick(event: MapBrowserEvent<UIEvent>): void;
|
|
58
|
+
handleDoubleClick(event: MapBrowserEvent<UIEvent>): void;
|
|
59
|
+
private runInteractionMutation;
|
|
60
|
+
private syncListeners;
|
|
61
|
+
private syncNativeModify;
|
|
62
|
+
private teardownNativeModify;
|
|
63
|
+
private handleNativeModifyStart;
|
|
64
|
+
private handleNativeModifyEnd;
|
|
65
|
+
private resolveHitItemsFromFeatures;
|
|
66
|
+
private hasCursorInteraction;
|
|
67
|
+
private toggleListener;
|
|
68
|
+
private removeListener;
|
|
69
|
+
private isListening;
|
|
70
|
+
private applyDisabledCleanup;
|
|
71
|
+
private clearHoverState;
|
|
72
|
+
private clearSelectState;
|
|
73
|
+
private cancelTranslate;
|
|
74
|
+
private cancelModify;
|
|
75
|
+
private updateCursor;
|
|
76
|
+
private getActiveSessionCursor;
|
|
77
|
+
private getLayerCursor;
|
|
78
|
+
private getCursorHitTolerance;
|
|
79
|
+
private setCursor;
|
|
80
|
+
private getTargetElement;
|
|
81
|
+
private getLayerEntry;
|
|
82
|
+
private applyTranslateMove;
|
|
83
|
+
private applyModifyChange;
|
|
84
|
+
private finishTranslate;
|
|
85
|
+
private finishModify;
|
|
86
|
+
private resolveTarget;
|
|
87
|
+
private lockDragPan;
|
|
88
|
+
private unlockDragPan;
|
|
89
|
+
private createTranslateEvent;
|
|
90
|
+
private createModifyEvent;
|
|
91
|
+
private createDefaultHitTest;
|
|
92
|
+
private collectFeaturePopupItems;
|
|
93
|
+
private collectPopupItems;
|
|
94
|
+
private getClusterDedupKey;
|
|
95
|
+
private getOrderedLayers;
|
|
96
|
+
private getHitTolerance;
|
|
97
|
+
private isEnabled;
|
|
98
|
+
private processHover;
|
|
99
|
+
private processSelect;
|
|
100
|
+
private processClick;
|
|
101
|
+
private processDoubleClick;
|
|
102
|
+
private itemsToMap;
|
|
103
|
+
private applyState;
|
|
104
|
+
private isHandled;
|
|
105
|
+
private shouldStopPropagation;
|
|
106
|
+
private shouldContinuePropagation;
|
|
107
|
+
private handleClusterClick;
|
|
108
|
+
private expandCluster;
|
|
109
|
+
private shouldStopClusterPropagation;
|
|
110
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
2
|
+
import type OlMap from 'ol/Map';
|
|
3
|
+
import type { MapContext, MapSchema, VectorLayerApi, VectorLayerDescriptor } from '../public/types';
|
|
4
|
+
export declare class LayerManager<Layers extends readonly VectorLayerDescriptor<any, any, any, any>[]> {
|
|
5
|
+
private readonly map;
|
|
6
|
+
private readonly layers;
|
|
7
|
+
private readonly apis;
|
|
8
|
+
private readonly interactions;
|
|
9
|
+
private readonly ctx;
|
|
10
|
+
private constructor();
|
|
11
|
+
static create<Layers extends readonly VectorLayerDescriptor<any, any, any, any>[]>(map: OlMap, schema: MapSchema<Layers>): LayerManager<Layers>;
|
|
12
|
+
getLayer(id: string): VectorLayer | undefined;
|
|
13
|
+
getApi(id: string): VectorLayerApi<any, any> | undefined;
|
|
14
|
+
getApis(): Record<string, VectorLayerApi<any, any>>;
|
|
15
|
+
getContext(): MapContext;
|
|
16
|
+
refreshEnabled(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type OlMap from 'ol/Map';
|
|
2
|
+
import type { MapContext, PopupHostApi, VectorLayerApi } from '../public/types';
|
|
3
|
+
import { FlushScheduler } from './scheduler';
|
|
4
|
+
export declare const createMapContext: (map: OlMap, layers: Record<string, VectorLayerApi<any, any>>, popupHost?: PopupHostApi, scheduler?: FlushScheduler) => MapContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type Geometry from 'ol/geom/Geometry';
|
|
2
|
+
import { VectorLayerBase, VectorLayerBaseOptions } from './vector-layer-base';
|
|
3
|
+
export type PlainLayerOptions<M, G extends Geometry, OPTS extends object> = VectorLayerBaseOptions<M, G, OPTS>;
|
|
4
|
+
export declare class PlainVectorLayer<M, G extends Geometry, OPTS extends object> extends VectorLayerBase<M, G, OPTS> {
|
|
5
|
+
constructor(options: PlainLayerOptions<M, G, OPTS>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Enabled, PopupHostApi, PopupItem } from '../public/types';
|
|
2
|
+
export type PopupHostOptions = {
|
|
3
|
+
enabled?: Enabled;
|
|
4
|
+
maxItems?: number;
|
|
5
|
+
sort?: (a: PopupItem<any>, b: PopupItem<any>) => number;
|
|
6
|
+
mount?: HTMLElement | (() => HTMLElement);
|
|
7
|
+
};
|
|
8
|
+
export declare class PopupHost implements PopupHostApi {
|
|
9
|
+
private readonly options;
|
|
10
|
+
private items;
|
|
11
|
+
private container;
|
|
12
|
+
private target;
|
|
13
|
+
constructor(options?: PopupHostOptions);
|
|
14
|
+
push(items: PopupItem<any>[]): void;
|
|
15
|
+
set(items: PopupItem<any>[]): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
remove(key: string | number): void;
|
|
18
|
+
getItems(): PopupItem<any>[];
|
|
19
|
+
mount(target: HTMLElement | (() => HTMLElement)): void;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
private ensureEnabled;
|
|
22
|
+
private isEnabled;
|
|
23
|
+
private unmount;
|
|
24
|
+
private prepareItems;
|
|
25
|
+
private dedup;
|
|
26
|
+
private applySort;
|
|
27
|
+
private applyLimit;
|
|
28
|
+
private getDedupKey;
|
|
29
|
+
private defaultSort;
|
|
30
|
+
private render;
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BatchOptions, FlushPolicy } from '../public/types';
|
|
2
|
+
type TaskKey = unknown;
|
|
3
|
+
export declare class FlushScheduler {
|
|
4
|
+
private readonly defaultPolicy;
|
|
5
|
+
private readonly queue;
|
|
6
|
+
private pendingPolicy;
|
|
7
|
+
private scheduledToken;
|
|
8
|
+
private rafId;
|
|
9
|
+
private batchDepth;
|
|
10
|
+
private readonly policyStack;
|
|
11
|
+
constructor(defaultPolicy?: FlushPolicy);
|
|
12
|
+
batch(fn: () => void, options?: BatchOptions): void;
|
|
13
|
+
schedule(key: TaskKey, task: () => void, policy?: FlushPolicy): void;
|
|
14
|
+
private requestFlush;
|
|
15
|
+
private scheduleFlush;
|
|
16
|
+
private flush;
|
|
17
|
+
private currentPolicy;
|
|
18
|
+
private combinePolicies;
|
|
19
|
+
private shouldUpgradePolicy;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type Feature from 'ol/Feature';
|
|
2
|
+
import type Geometry from 'ol/geom/Geometry';
|
|
3
|
+
export declare const getFeatureStates: (feature: Feature<Geometry>) => string[];
|
|
4
|
+
export declare const setFeatureStates: (feature: Feature<Geometry>, states: string[]) => void;
|
|
5
|
+
export declare const clearFeatureStates: (feature: Feature<Geometry>) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Feature from 'ol/Feature';
|
|
2
|
+
import type Geometry from 'ol/geom/Geometry';
|
|
3
|
+
import type OlMap from 'ol/Map';
|
|
4
|
+
import type { StyleFunction } from 'ol/style/Style';
|
|
5
|
+
import type { FeatureDescriptor, LayerClustering, MapContext } from '../../public/types';
|
|
6
|
+
export type StylePipelineOptions<M, G extends Geometry, OPTS extends object> = {
|
|
7
|
+
descriptor: FeatureDescriptor<M, G, OPTS>;
|
|
8
|
+
ctx: MapContext;
|
|
9
|
+
registryGetModel: (feature: Feature<Geometry>) => M | undefined;
|
|
10
|
+
map?: OlMap;
|
|
11
|
+
};
|
|
12
|
+
export declare const createStyleFunction: <M, G extends Geometry, OPTS extends object>(options: StylePipelineOptions<M, G, OPTS>) => StyleFunction;
|
|
13
|
+
export type ClusterStylePipelineOptions<M, G extends Geometry, OPTS extends object> = {
|
|
14
|
+
descriptor: FeatureDescriptor<M, G, OPTS>;
|
|
15
|
+
clustering: LayerClustering<M>;
|
|
16
|
+
ctx: MapContext;
|
|
17
|
+
registryGetModel: (feature: Feature<Geometry>) => M | undefined;
|
|
18
|
+
map?: OlMap;
|
|
19
|
+
};
|
|
20
|
+
export declare const createClusterStyleFunction: <M, G extends Geometry, OPTS extends object>(options: ClusterStylePipelineOptions<M, G, OPTS>) => StyleFunction;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Feature from 'ol/Feature';
|
|
2
|
+
import type Geometry from 'ol/geom/Geometry';
|
|
3
|
+
import type VectorLayer from 'ol/layer/Vector';
|
|
4
|
+
import type VectorSource from 'ol/source/Vector';
|
|
5
|
+
import type { FeatureDescriptor, MapContext, ModelChange, VectorLayerApi, VectorLayerDescriptor, ViewFitOptions } from '../public/types';
|
|
6
|
+
import { FeatureRegistry } from './feature-registry';
|
|
7
|
+
export type VectorLayerBaseOptions<M, G extends Geometry, OPTS extends object> = {
|
|
8
|
+
descriptor: VectorLayerDescriptor<M, G, OPTS>;
|
|
9
|
+
layer: VectorLayer;
|
|
10
|
+
source: VectorSource<G>;
|
|
11
|
+
ctx: MapContext;
|
|
12
|
+
scheduleInvalidate: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare abstract class VectorLayerBase<M, G extends Geometry, OPTS extends object> implements VectorLayerApi<M, G> {
|
|
15
|
+
protected readonly descriptor: FeatureDescriptor<M, G, OPTS>;
|
|
16
|
+
protected readonly layer: VectorLayer;
|
|
17
|
+
protected readonly source: VectorSource<G>;
|
|
18
|
+
protected readonly registry: FeatureRegistry<M, G>;
|
|
19
|
+
protected readonly scheduleInvalidate: () => void;
|
|
20
|
+
protected readonly ctx: MapContext;
|
|
21
|
+
private readonly changeHandlers;
|
|
22
|
+
constructor(options: VectorLayerBaseOptions<M, G, OPTS>);
|
|
23
|
+
setModels(models: readonly M[]): void;
|
|
24
|
+
invalidate(): void;
|
|
25
|
+
syncFeatureFromModel(model: M): void;
|
|
26
|
+
getModelByFeature(feature: Feature<G>): M | undefined;
|
|
27
|
+
mutate(id: string | number, update: (prev: M) => M, reason?: ModelChange<M>['reason']): void;
|
|
28
|
+
mutateMany(ids: Array<string | number>, update: (prev: M) => M, reason?: ModelChange<M>['reason']): void;
|
|
29
|
+
onModelsChanged(cb: (changes: ModelChange<M>[]) => void): () => void;
|
|
30
|
+
/** Fit view to all features on the layer. No-op if extent is empty. */
|
|
31
|
+
centerOnAllModels(opts?: ViewFitOptions): void;
|
|
32
|
+
/** Fit view to a single feature by id. No-op if feature/geometry is missing. */
|
|
33
|
+
centerOnModel(id: string | number, opts?: ViewFitOptions): void;
|
|
34
|
+
/**
|
|
35
|
+
* Fit view to a subset of features by ids (combined extent).
|
|
36
|
+
* Missing ids are ignored. No-op if none found.
|
|
37
|
+
*/
|
|
38
|
+
centerOnModels(ids: ReadonlyArray<string | number>, opts?: ViewFitOptions): void;
|
|
39
|
+
setVisible(visible: boolean): void;
|
|
40
|
+
isVisible(): boolean;
|
|
41
|
+
setOpacity(opacity: number): void;
|
|
42
|
+
getOpacity(): number;
|
|
43
|
+
getZIndex(): number | undefined;
|
|
44
|
+
setZIndex(z: number): void;
|
|
45
|
+
getModelById(id: string | number): M | undefined;
|
|
46
|
+
hasModel(id: string | number): boolean;
|
|
47
|
+
getAllModels(): readonly M[];
|
|
48
|
+
getAllModelIds(): Array<string | number>;
|
|
49
|
+
setFeatureStates(ids: string | number | ReadonlyArray<string | number>, states?: string | string[]): void;
|
|
50
|
+
protected setModelsInternal(models: readonly M[]): void;
|
|
51
|
+
protected getCenterOnAllModelsSource(): VectorSource<G> | null;
|
|
52
|
+
private emitModelChanges;
|
|
53
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aur-openlayers",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^19.2.0",
|
|
6
|
+
"@angular/core": "^19.2.0",
|
|
7
|
+
"ol": "^6.5.0"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"module": "fesm2022/aur-openlayers.mjs",
|
|
14
|
+
"typings": "index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": {
|
|
17
|
+
"default": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"default": "./fesm2022/aur-openlayers.mjs"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
package/public-api.d.ts
ADDED