aur-openlayers 19.6.4 → 19.6.6
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 -63
- package/fesm2022/aur-openlayers.mjs +389 -11
- package/fesm2022/aur-openlayers.mjs.map +1 -1
- package/lib/map-framework/public/types.d.ts +52 -0
- package/lib/map-framework/runtime/decorations/arrow-decoration-manager.d.ts +27 -0
- package/lib/map-framework/runtime/decorations/buffer-decoration-manager.d.ts +27 -0
- package/lib/map-framework/runtime/decorations/generate-buffer-polygon.d.ts +9 -0
- package/lib/map-framework/runtime/layer-manager.d.ts +1 -0
- package/package.json +1 -1
|
@@ -456,6 +456,53 @@ export type MapController = {
|
|
|
456
456
|
/** Освободить ресурсы при отвязке (опционально). */
|
|
457
457
|
unbind?: () => void;
|
|
458
458
|
};
|
|
459
|
+
/**
|
|
460
|
+
* Конфигурация стрелок направления вдоль LineString.
|
|
461
|
+
*/
|
|
462
|
+
export type ArrowDecoration = {
|
|
463
|
+
/**
|
|
464
|
+
* Расстояние между стрелками в метрах.
|
|
465
|
+
* Функция — для адаптации интервала к масштабу.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* interval: (view) => Math.max(100, view.resolution * 80)
|
|
469
|
+
*/
|
|
470
|
+
interval: MaybeFn<number, [view: StyleView]>;
|
|
471
|
+
/**
|
|
472
|
+
* Стиль стрелки.
|
|
473
|
+
* Получает rotation (радианы, по часовой от севера — конвенция OL)
|
|
474
|
+
* и текущий вид карты.
|
|
475
|
+
*/
|
|
476
|
+
style: (args: {
|
|
477
|
+
rotation: number;
|
|
478
|
+
view: StyleView;
|
|
479
|
+
}) => Style | Style[];
|
|
480
|
+
/**
|
|
481
|
+
* Смещение первой стрелки от начала линии как доля интервала (0–1).
|
|
482
|
+
* По умолчанию: 0.5.
|
|
483
|
+
*/
|
|
484
|
+
offsetRatio?: number;
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Конфигурация буферного полигона (коридора) вдоль LineString.
|
|
488
|
+
*/
|
|
489
|
+
export type BufferDecoration = {
|
|
490
|
+
/** Ширина буфера в метрах (в одну сторону — полная ширина = distance * 2). */
|
|
491
|
+
distance: number;
|
|
492
|
+
/** Стиль буферного полигона (OL Style). */
|
|
493
|
+
style: Style | Style[];
|
|
494
|
+
/** Форма торцов. По умолчанию: 'round'. */
|
|
495
|
+
cap?: 'round' | 'flat';
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* Декоративные элементы вдоль LineString-геометрий.
|
|
499
|
+
*/
|
|
500
|
+
export type LineDecorations = {
|
|
501
|
+
/** Стрелки направления вдоль линии. */
|
|
502
|
+
arrows?: ArrowDecoration;
|
|
503
|
+
/** Буферный полигон (коридор) вокруг линии. */
|
|
504
|
+
buffer?: BufferDecoration;
|
|
505
|
+
};
|
|
459
506
|
/**
|
|
460
507
|
* Описание фичи: геометрия, стиль, взаимодействия и popup.
|
|
461
508
|
*
|
|
@@ -668,6 +715,11 @@ export interface FeatureDescriptor<M, G extends Geometry, OPTS extends object> {
|
|
|
668
715
|
event?: MapBrowserEvent<UIEvent>;
|
|
669
716
|
}) => PopupItem<M>;
|
|
670
717
|
};
|
|
718
|
+
/**
|
|
719
|
+
* Декоративные элементы вдоль LineString-геометрий.
|
|
720
|
+
* Игнорируется для не-LineString геометрий.
|
|
721
|
+
*/
|
|
722
|
+
decorations?: LineDecorations;
|
|
671
723
|
}
|
|
672
724
|
/**
|
|
673
725
|
* Конфигурация кластеризации слоя.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
2
|
+
import type OlMap from 'ol/Map';
|
|
3
|
+
import type { ArrowDecoration, VectorLayerApi } from '../../public/types';
|
|
4
|
+
export type ArrowDecorationManagerOptions = {
|
|
5
|
+
map: OlMap;
|
|
6
|
+
parentLayer: VectorLayer;
|
|
7
|
+
parentApi: VectorLayerApi<any, any>;
|
|
8
|
+
config: ArrowDecoration;
|
|
9
|
+
};
|
|
10
|
+
export declare class ArrowDecorationManager {
|
|
11
|
+
private readonly source;
|
|
12
|
+
private readonly layer;
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly map;
|
|
15
|
+
private readonly parentLayer;
|
|
16
|
+
private readonly parentApi;
|
|
17
|
+
private readonly moveEndKey;
|
|
18
|
+
private readonly unsubCollection;
|
|
19
|
+
private readonly unsubChanges;
|
|
20
|
+
private rafId;
|
|
21
|
+
constructor(options: ArrowDecorationManagerOptions);
|
|
22
|
+
private scheduleUpdate;
|
|
23
|
+
private rebuild;
|
|
24
|
+
private syncVisibility;
|
|
25
|
+
private syncOpacity;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
2
|
+
import type OlMap from 'ol/Map';
|
|
3
|
+
import type { BufferDecoration, VectorLayerApi } from '../../public/types';
|
|
4
|
+
export type BufferDecorationManagerOptions = {
|
|
5
|
+
map: OlMap;
|
|
6
|
+
parentLayer: VectorLayer;
|
|
7
|
+
parentApi: VectorLayerApi<any, any>;
|
|
8
|
+
config: BufferDecoration;
|
|
9
|
+
};
|
|
10
|
+
export declare class BufferDecorationManager {
|
|
11
|
+
private readonly source;
|
|
12
|
+
private readonly layer;
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly map;
|
|
15
|
+
private readonly parentLayer;
|
|
16
|
+
private readonly parentApi;
|
|
17
|
+
private readonly moveEndKey;
|
|
18
|
+
private readonly unsubCollection;
|
|
19
|
+
private readonly unsubChanges;
|
|
20
|
+
private rafId;
|
|
21
|
+
constructor(options: BufferDecorationManagerOptions);
|
|
22
|
+
private scheduleUpdate;
|
|
23
|
+
private rebuild;
|
|
24
|
+
private syncVisibility;
|
|
25
|
+
private syncOpacity;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a closed polygon ring representing a buffer around a polyline.
|
|
3
|
+
*
|
|
4
|
+
* @param coords Line vertices in EPSG:3857.
|
|
5
|
+
* @param distance Buffer width in meters (one side).
|
|
6
|
+
* @param cap End cap style: 'round' or 'flat'.
|
|
7
|
+
* @returns Closed ring (first == last point), or empty array if line is degenerate.
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateBufferPolygon(coords: number[][], distance: number, cap: 'round' | 'flat'): number[][];
|
|
@@ -9,6 +9,7 @@ export declare class LayerManager<Layers extends readonly VectorLayerDescriptor<
|
|
|
9
9
|
private readonly scheduler;
|
|
10
10
|
private readonly popupHost;
|
|
11
11
|
private readonly ctx;
|
|
12
|
+
private readonly decorationManagers;
|
|
12
13
|
private constructor();
|
|
13
14
|
static create<Layers extends readonly VectorLayerDescriptor<any, any, any, any>[]>(map: OlMap, schema: MapSchema<Layers>): LayerManager<Layers>;
|
|
14
15
|
getLayer(id: string): VectorLayer | undefined;
|