cmap-core 0.0.9 → 0.2.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 +568 -0
- package/dist/cmap-core.css +1 -1
- package/dist/index.es.d.ts +837 -34
- package/dist/index.es.js +4819 -1873
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -61
- package/dist/index.umd.js.map +1 -1
- package/package.json +22 -16
package/dist/index.es.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { BBox } from 'rbush';
|
|
2
|
+
import { ColorSpecification } from 'mapbox-gl';
|
|
3
|
+
import { DataDrivenPropertyValueSpecification } from 'mapbox-gl';
|
|
2
4
|
import { default as default_2 } from 'rbush';
|
|
3
5
|
import { default as default_3 } from 'eventemitter3';
|
|
4
6
|
import { Feature } from 'geojson';
|
|
5
7
|
import type * as GeoJSON_2 from 'geojson';
|
|
6
8
|
import { LayerSpecification } from 'mapbox-gl';
|
|
9
|
+
import { LineString } from 'geojson';
|
|
7
10
|
import { LngLat } from 'mapbox-gl';
|
|
8
11
|
import { Map as Map_2 } from 'mapbox-gl';
|
|
12
|
+
import { MapEventType } from 'mapbox-gl';
|
|
9
13
|
import { MapMouseEvent } from 'mapbox-gl';
|
|
10
14
|
import { MapOptions } from 'mapbox-gl';
|
|
11
15
|
import { MultiLineString } from 'geojson';
|
|
12
|
-
import { Point } from 'mapbox-gl';
|
|
16
|
+
import { Point as Point_2 } from 'mapbox-gl';
|
|
17
|
+
import { Polygon } from 'geojson';
|
|
13
18
|
import { Source } from 'mapbox-gl';
|
|
14
19
|
import { SourceSpecification } from 'mapbox-gl';
|
|
15
20
|
|
|
@@ -37,24 +42,41 @@ export declare class AisShip extends BaseShip<IAisShipOptions> {
|
|
|
37
42
|
unfocus(): void;
|
|
38
43
|
icon(): GeoJSON_2.Feature<GeoJSON_2.Point, IAisShipOptions>;
|
|
39
44
|
real(): GeoJSON_2.Feature<GeoJSON_2.Polygon, IAisShipOptions> | GeoJSON_2.Feature<GeoJSON_2.Point, IAisShipOptions>;
|
|
45
|
+
headingLine(): GeoJSON_2.Feature<GeoJSON_2.LineString | null, {
|
|
46
|
+
meta: 'directionLine';
|
|
47
|
+
'line-color': string;
|
|
48
|
+
}>;
|
|
40
49
|
render(): void;
|
|
41
50
|
label(): HTMLElement;
|
|
42
|
-
offset():
|
|
51
|
+
offset(): Point_2;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
declare interface AllAnchor {
|
|
55
|
+
center: BBox;
|
|
56
|
+
top: BBox;
|
|
57
|
+
bottom: BBox;
|
|
58
|
+
left: BBox;
|
|
59
|
+
right: BBox;
|
|
46
60
|
'top-left': BBox;
|
|
47
61
|
'top-right': BBox;
|
|
48
62
|
'bottom-left': BBox;
|
|
49
63
|
'bottom-right': BBox;
|
|
50
64
|
}
|
|
51
65
|
|
|
52
|
-
declare type Anchor = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
66
|
+
declare type Anchor = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
53
67
|
|
|
54
68
|
declare const ARROW_ICON = "<svg t=\"1769503360247\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"24046\" width=\"64\" height=\"64\"><path d=\"M509.093 894.223l-447.093-761.539 452.861 219.23099999 447.139-222.13799999z\" p-id=\"24047\" fill=\"#d81e06\"></path></svg>";
|
|
55
69
|
|
|
56
70
|
declare const ARROW_ICON_NAME = "track-arrow";
|
|
57
71
|
|
|
72
|
+
export declare class ArrowLine extends Line<IArrowLineOptions> {
|
|
73
|
+
constructor(map: Map_2, options: IArrowLineOptions);
|
|
74
|
+
onAdd(): void;
|
|
75
|
+
createVertex(id: string, index: number, position: LngLat): PointInstance;
|
|
76
|
+
private getIconName;
|
|
77
|
+
private getRotate;
|
|
78
|
+
}
|
|
79
|
+
|
|
58
80
|
export declare abstract class BaseShip<T extends IBaseShipOptions> extends Module {
|
|
59
81
|
options: T;
|
|
60
82
|
readonly SOURCE: string;
|
|
@@ -64,6 +86,7 @@ export declare abstract class BaseShip<T extends IBaseShipOptions> extends Modul
|
|
|
64
86
|
protected constructor(map: Map_2, options: T);
|
|
65
87
|
destroy(): void;
|
|
66
88
|
get isFocus(): boolean;
|
|
89
|
+
get isHover(): boolean;
|
|
67
90
|
abstract onAdd(): void;
|
|
68
91
|
abstract onRemove(): void;
|
|
69
92
|
abstract get id(): IBaseShipOptions['id'];
|
|
@@ -84,9 +107,13 @@ export declare abstract class BaseShip<T extends IBaseShipOptions> extends Modul
|
|
|
84
107
|
abstract unfocus(): void;
|
|
85
108
|
abstract icon(): GeoJSON_2.Feature<GeoJSON_2.Point, T>;
|
|
86
109
|
abstract real(): GeoJSON_2.Feature<GeoJSON_2.Polygon, T> | GeoJSON_2.Feature<GeoJSON_2.Point, T>;
|
|
110
|
+
abstract headingLine(): GeoJSON_2.Feature<GeoJSON_2.LineString | null, {
|
|
111
|
+
meta: 'directionLine';
|
|
112
|
+
'line-color': string;
|
|
113
|
+
}>;
|
|
87
114
|
abstract render(): void;
|
|
88
115
|
abstract label(): HTMLElement;
|
|
89
|
-
abstract offset():
|
|
116
|
+
abstract offset(): Point_2;
|
|
90
117
|
setState(states: Record<string, unknown>): void;
|
|
91
118
|
getState(): Record<string, unknown> | null | undefined;
|
|
92
119
|
isSelf(e: MapMouseEvent): boolean;
|
|
@@ -128,6 +155,22 @@ declare interface CacheOptions {
|
|
|
128
155
|
|
|
129
156
|
declare type CacheType = 'sessionstorage' | 'localstorage';
|
|
130
157
|
|
|
158
|
+
declare interface CalcOffsetParams {
|
|
159
|
+
iconHeight: number;
|
|
160
|
+
iconScale?: number;
|
|
161
|
+
iconAnchor?: IconAnchor;
|
|
162
|
+
textSize?: number;
|
|
163
|
+
gap?: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
declare interface CirclePointStyle {
|
|
167
|
+
'circle-stroke-width'?: number;
|
|
168
|
+
'circle-stroke-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
169
|
+
'circle-radius'?: number;
|
|
170
|
+
'circle-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
171
|
+
'text-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
172
|
+
}
|
|
173
|
+
|
|
131
174
|
export declare class CMap extends default_3 {
|
|
132
175
|
readonly map: Map_2;
|
|
133
176
|
private readonly options;
|
|
@@ -199,6 +242,11 @@ export declare class CollisionItem {
|
|
|
199
242
|
*/
|
|
200
243
|
declare interface CollisionItemOptions {
|
|
201
244
|
id: string | number;
|
|
245
|
+
center: BBox;
|
|
246
|
+
top: BBox;
|
|
247
|
+
bottom: BBox;
|
|
248
|
+
left: BBox;
|
|
249
|
+
right: BBox;
|
|
202
250
|
'top-left': BBox;
|
|
203
251
|
'top-right': BBox;
|
|
204
252
|
'bottom-left': BBox;
|
|
@@ -215,24 +263,109 @@ export declare class Context {
|
|
|
215
263
|
readonly register: ResourceRegister;
|
|
216
264
|
readonly iconManage: IconManager;
|
|
217
265
|
readonly focus: Focus;
|
|
266
|
+
readonly eventManager: EventManager;
|
|
218
267
|
constructor(options: IContextOptions);
|
|
219
268
|
destroy(): void;
|
|
220
269
|
}
|
|
221
270
|
|
|
271
|
+
declare const DEFAULT_CIRCLE_COLOR = "#fff";
|
|
272
|
+
|
|
273
|
+
declare const DEFAULT_CIRCLE_RADIUS = 10;
|
|
274
|
+
|
|
275
|
+
declare const DEFAULT_CIRCLE_STROKE_COLOR = "#f00";
|
|
276
|
+
|
|
277
|
+
declare const DEFAULT_CIRCLE_STROKE_WIDTH = 2;
|
|
278
|
+
|
|
279
|
+
declare const DEFAULT_FILL_COLOR = "#009dff";
|
|
280
|
+
|
|
281
|
+
declare const DEFAULT_FILL_OPACITY = 0.3;
|
|
282
|
+
|
|
283
|
+
declare const DEFAULT_ICON_ANCHOR = "bottom";
|
|
284
|
+
|
|
285
|
+
declare const DEFAULT_ICON_SIZE = 1;
|
|
286
|
+
|
|
287
|
+
declare const DEFAULT_LINE_COLOR = "#f00";
|
|
288
|
+
|
|
289
|
+
declare const DEFAULT_LINE_WIDTH = 3;
|
|
290
|
+
|
|
291
|
+
declare const DEFAULT_TEXT_COLOR = "#333";
|
|
292
|
+
|
|
293
|
+
declare const DEFAULT_TEXT_COLOR_2 = "#333";
|
|
294
|
+
|
|
295
|
+
declare const DEFAULT_TEXT_SIZE = 12;
|
|
296
|
+
|
|
297
|
+
declare const DEFAULT_TEXT_SIZE_2 = 16;
|
|
298
|
+
|
|
299
|
+
declare const DEFAULT_TEXT_SIZE_3 = 12;
|
|
300
|
+
|
|
301
|
+
declare const DOTTED_LINE_LAYER: LayerSpecification;
|
|
302
|
+
|
|
303
|
+
declare const DOTTED_LINE_LAYER_NAME = "mapbox-gl-plot-dotted-line-layer";
|
|
304
|
+
|
|
222
305
|
declare const END_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"74\" height=\"74\" viewBox=\"0 0 74 74\" fill=\"none\"><circle cx=\"37\" cy=\"37\" r=\"32\" stroke=\"rgba(172, 51, 193, 1)\" stroke-width=\"10\" fill=\"#AC33C1\" ></circle><path d=\"M45.6 33.64C49.28 36.12 55.28 38.24 55.28 38.24L54 41.8C50.48 40.32 47.78 38.88 47.78 38.88C45.08 37.44 42.92 35.8 42.92 35.8C38.76 38.84 32.04 41.6 32.04 41.6L30.4 38.4C36.28 36.2 40.24 33.56 40.24 33.56C38.2 31.6 36.12 28.8 36.12 28.8C34.56 30.92 32.68 32.88 32.68 32.88L30.72 30.36C32.88 28.08 35.08 24.52 35.08 24.52C37.28 20.96 38.4 18 38.4 18L41.64 18.92C41.2 19.96 40.24 22.04 40.24 22.04L52.04 22.04L52.04 25.48C50.56 27.96 49.02 29.96 49.02 29.96C47.48 31.96 45.6 33.64 45.6 33.64ZM20.76 33.44C19.96 33.48 19 33.76 19 33.76L18.2 30.24C18.72 30.04 18.98 29.82 18.98 29.82C19.24 29.6 19.56 29.2 19.56 29.2C20.44 28 22.06 24.68 22.06 24.68C23.68 21.36 24.92 18.2 24.92 18.2L28.04 19.4C26.8 22.28 25.24 25.4 25.24 25.4C23.68 28.52 22.6 30.04 22.6 30.04C25.92 29.56 26.76 29.44 26.76 29.44C28.16 26.68 29.28 24.16 29.28 24.16L32.16 25.52C30.52 28.92 28.16 33.22 28.16 33.22C25.8 37.52 24.4 39.48 24.4 39.48L27.36 38.76L29.76 38.16L29.84 41.68C29.28 41.72 26.86 42.2 26.86 42.2C24.44 42.68 22.52 43.08 22.52 43.08C21.96 43.2 20.84 43.52 20.84 43.52L19.92 43.76L19.08 40.12C19.96 39.76 20.34 39.48 20.34 39.48C20.72 39.2 21.2 38.64 21.2 38.64C22.84 36.6 24.92 32.84 24.92 32.84C22.24 33.28 20.76 33.44 20.76 33.44ZM38.08 25.92C40.2 29.2 42.88 31.52 42.88 31.52C45.56 29.16 48.12 25.4 48.12 25.4L38.4 25.4L38.08 25.92ZM37.6 39.4L40.8 40.4L49.4 43.08L48.12 46.52C45.76 45.68 42.22 44.5 42.22 44.5C38.68 43.32 36.64 42.76 36.64 42.76L37.6 39.4ZM18 49.08C18.68 48.96 21.08 48.4 21.08 48.4C23.48 47.84 25.2 47.44 25.2 47.44C30.76 46.2 31.08 46.12 31.08 46.12L31.28 49.6C30.12 49.8 22.24 51.6 22.24 51.6C18.8 52.44 18.48 52.48 18.48 52.48L18 49.08ZM34.4 46.48C37.24 47.24 42.46 48.82 42.46 48.82C47.68 50.4 51.12 51.52 51.12 51.52L49.92 55.04C46.44 53.8 41.38 52.2 41.38 52.2C36.32 50.6 33.44 49.84 33.44 49.84L34.4 46.48Z\" fill=\"#FFFFFF\" ></path></svg>";
|
|
223
306
|
|
|
224
307
|
declare const END_ICON_NAME = "track-end";
|
|
225
308
|
|
|
309
|
+
/**
|
|
310
|
+
* ✅ [新增] 定义通用的事件回调类型
|
|
311
|
+
* 替代原生的 Function 类型
|
|
312
|
+
* 这里定义为接收一个参数(事件对象),没有返回值
|
|
313
|
+
*/
|
|
314
|
+
declare type EventHandler = (e: any) => void;
|
|
315
|
+
|
|
316
|
+
export declare class EventManager {
|
|
317
|
+
private map;
|
|
318
|
+
private listeners;
|
|
319
|
+
private activeLayerListeners;
|
|
320
|
+
private currentHoverIdByLayer;
|
|
321
|
+
constructor(map: Map_2);
|
|
322
|
+
/**
|
|
323
|
+
* 注册事件监听
|
|
324
|
+
* @param id 实例/Feature 的 ID
|
|
325
|
+
* @param layerId Mapbox 图层 ID
|
|
326
|
+
* @param eventType 事件类型 (click, mouseenter, contextmenu 等)
|
|
327
|
+
* @param callback 回调函数
|
|
328
|
+
*/
|
|
329
|
+
on(id: string | number, layerId: string, eventType: MapEventType, callback: EventHandler): void;
|
|
330
|
+
/**
|
|
331
|
+
* 移除事件监听
|
|
332
|
+
* @param id 实例 ID
|
|
333
|
+
* @param eventType (可选) 事件类型,不传则移除该 ID 所有事件
|
|
334
|
+
* @param callback (可选) 指定回调,不传则移除该类型所有回调
|
|
335
|
+
*/
|
|
336
|
+
off(id: string | number, eventType?: MapEventType, callback?: EventHandler): void;
|
|
337
|
+
/**
|
|
338
|
+
* 确保 Mapbox 底层对该图层的该事件进行了监听
|
|
339
|
+
*/
|
|
340
|
+
private ensureMapListener;
|
|
341
|
+
/**
|
|
342
|
+
* 核心分发逻辑
|
|
343
|
+
*/
|
|
344
|
+
private dispatch;
|
|
345
|
+
/**
|
|
346
|
+
* 销毁管理器
|
|
347
|
+
* 必须在地图销毁前调用,防止内存泄漏
|
|
348
|
+
*/
|
|
349
|
+
destroy(): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare interface EventMessage<T> {
|
|
353
|
+
originEvent: MapMouseEvent;
|
|
354
|
+
instance: T;
|
|
355
|
+
}
|
|
356
|
+
|
|
226
357
|
declare abstract class EventState extends Module {
|
|
227
|
-
|
|
358
|
+
status: EventStatus;
|
|
228
359
|
static ON: EventStatus;
|
|
229
360
|
static OFF: EventStatus;
|
|
230
361
|
protected constructor(map: Map_2);
|
|
231
362
|
abstract onAdd(): void;
|
|
232
363
|
abstract onRemove(): void;
|
|
233
364
|
switch(): EventStatus;
|
|
234
|
-
|
|
235
|
-
|
|
365
|
+
changeStatus(): void;
|
|
366
|
+
message<T>(e: MapMouseEvent, instance: T): EventMessage<T>;
|
|
367
|
+
abstract enabled(): void;
|
|
368
|
+
abstract disabled(): void;
|
|
236
369
|
}
|
|
237
370
|
|
|
238
371
|
declare enum EventStatus {
|
|
@@ -240,6 +373,118 @@ declare enum EventStatus {
|
|
|
240
373
|
OFF = "Off"
|
|
241
374
|
}
|
|
242
375
|
|
|
376
|
+
export declare class Fill<T extends IFillOptions = IFillOptions> extends Poi<T, GeoJSON_2.Polygon | null> {
|
|
377
|
+
static NAME: PlotType;
|
|
378
|
+
readonly LAYER: string;
|
|
379
|
+
title: IconPoint | null;
|
|
380
|
+
line: Line | null;
|
|
381
|
+
protected residentEvent: FillResidentEvent;
|
|
382
|
+
protected updateEvent: FillUpdateEvent;
|
|
383
|
+
protected createEvent: FillCreateEvent;
|
|
384
|
+
constructor(map: Map_2, options: T);
|
|
385
|
+
get center(): LngLat | null;
|
|
386
|
+
get geometry(): Polygon | null;
|
|
387
|
+
getFeature(): Feature<Polygon | null>;
|
|
388
|
+
get id(): string;
|
|
389
|
+
move(position: LngLat): void;
|
|
390
|
+
createLine(): void;
|
|
391
|
+
removeLine(): void;
|
|
392
|
+
onAdd(): void;
|
|
393
|
+
onRemove(): void;
|
|
394
|
+
remove(): void;
|
|
395
|
+
show(): void;
|
|
396
|
+
hide(): void;
|
|
397
|
+
render(): void;
|
|
398
|
+
start(): void;
|
|
399
|
+
stop(): void;
|
|
400
|
+
unedit(): void;
|
|
401
|
+
edit(): void;
|
|
402
|
+
focus(): void;
|
|
403
|
+
unfocus(): void;
|
|
404
|
+
select(): void;
|
|
405
|
+
unselect(): void;
|
|
406
|
+
update(options: T): void;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
declare const FILL_CLOSED_LINE_LAYER: LayerSpecification;
|
|
410
|
+
|
|
411
|
+
declare const FILL_CLOSED_LINE_LAYER_NAME = "mapbox-gl-plot-closed-line-layer";
|
|
412
|
+
|
|
413
|
+
declare const FILL_LAYER: LayerSpecification;
|
|
414
|
+
|
|
415
|
+
declare const FILL_LAYER_NAME = "mapbox-gl-plot-fill-layer";
|
|
416
|
+
|
|
417
|
+
declare abstract class FillBaseEvent extends EventState {
|
|
418
|
+
protected fill: Fill;
|
|
419
|
+
protected constructor(map: Map_2, fill: Fill);
|
|
420
|
+
abstract onAdd(): void;
|
|
421
|
+
abstract onRemove(): void;
|
|
422
|
+
abstract enabled(): void;
|
|
423
|
+
abstract disabled(): void;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
declare class FillCreateEvent extends FillBaseEvent {
|
|
427
|
+
private count;
|
|
428
|
+
private drawPoint;
|
|
429
|
+
private onClick;
|
|
430
|
+
private onMousemove;
|
|
431
|
+
private onContextmenu;
|
|
432
|
+
private stop;
|
|
433
|
+
constructor(map: Map_2, fill: Fill);
|
|
434
|
+
setDrawLngLat(position: LngLat | null): void;
|
|
435
|
+
getDrawLngLat(): LngLat | null;
|
|
436
|
+
onAdd(): void;
|
|
437
|
+
onRemove(): void;
|
|
438
|
+
enabled(): void;
|
|
439
|
+
disabled(): void;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare class FillResidentEvent extends FillBaseEvent {
|
|
443
|
+
constructor(map: Map_2, fill: Fill);
|
|
444
|
+
onAdd(): void;
|
|
445
|
+
onRemove(): void;
|
|
446
|
+
enabled(): void;
|
|
447
|
+
disabled(): void;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
declare interface FillStyle {
|
|
451
|
+
'fill-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
452
|
+
'fill-opacity'?: DataDrivenPropertyValueSpecification<number>;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
declare class FillUpdateEvent extends FillBaseEvent {
|
|
456
|
+
protected dragStartLngLat: LngLat | null;
|
|
457
|
+
private onLineUpdate;
|
|
458
|
+
private onLineMidUpdate;
|
|
459
|
+
private onLineMidDoneUpdate;
|
|
460
|
+
private onFillMousedown;
|
|
461
|
+
private onMousemove;
|
|
462
|
+
private onMouseup;
|
|
463
|
+
private onFillMouseenter;
|
|
464
|
+
private onFillMouseLeave;
|
|
465
|
+
constructor(map: Map_2, fill: Fill);
|
|
466
|
+
setDragLngLat(position: LngLat | null): void;
|
|
467
|
+
getDragLngLat(): LngLat | null;
|
|
468
|
+
onAdd(): void;
|
|
469
|
+
onRemove(): void;
|
|
470
|
+
enabled(): void;
|
|
471
|
+
disabled(): void;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export declare namespace FillVars {
|
|
475
|
+
export {
|
|
476
|
+
NAME,
|
|
477
|
+
Z_INDEX,
|
|
478
|
+
FILL_LAYER_NAME,
|
|
479
|
+
FILL_CLOSED_LINE_LAYER_NAME,
|
|
480
|
+
DEFAULT_FILL_COLOR,
|
|
481
|
+
DEFAULT_FILL_OPACITY,
|
|
482
|
+
FILL_LAYER,
|
|
483
|
+
FILL_CLOSED_LINE_LAYER,
|
|
484
|
+
LAYER_LIST
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
243
488
|
declare class Focus extends default_3 {
|
|
244
489
|
private readonly map;
|
|
245
490
|
focusItems: FocusItem[];
|
|
@@ -283,11 +528,19 @@ declare interface FocusItem {
|
|
|
283
528
|
options?: IFocusOptions;
|
|
284
529
|
}
|
|
285
530
|
|
|
531
|
+
declare const GAP_PX = 5;
|
|
532
|
+
|
|
533
|
+
declare const GAP_PX_2 = 5;
|
|
534
|
+
|
|
286
535
|
declare interface IAisShipOptions extends IBaseShipOptions {
|
|
287
536
|
outLine?: boolean;
|
|
288
537
|
updateStatus?: UPDATE_STATUS;
|
|
289
538
|
}
|
|
290
539
|
|
|
540
|
+
declare interface IArrowLineOptions extends ILineOptions {
|
|
541
|
+
vertexStyle?: IconPointStyle;
|
|
542
|
+
}
|
|
543
|
+
|
|
291
544
|
declare interface IBaseShipOptions {
|
|
292
545
|
id: string | number;
|
|
293
546
|
name: string;
|
|
@@ -318,6 +571,7 @@ declare interface IBaseShipOptions {
|
|
|
318
571
|
declare interface ICMapOptions extends MapOptions {
|
|
319
572
|
type?: MapType;
|
|
320
573
|
TDTToken?: string;
|
|
574
|
+
http2?: boolean;
|
|
321
575
|
}
|
|
322
576
|
|
|
323
577
|
declare interface Icon {
|
|
@@ -326,11 +580,16 @@ declare interface Icon {
|
|
|
326
580
|
options?: Partial<StyleImageMetadata>;
|
|
327
581
|
}
|
|
328
582
|
|
|
583
|
+
declare const ICON_ROTATE: DataDrivenPropertyValueSpecification<number>;
|
|
584
|
+
|
|
585
|
+
declare type IconAnchor = 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
586
|
+
|
|
329
587
|
export declare class IconManager {
|
|
330
588
|
static SUCCESS: RESULT_CODE;
|
|
331
589
|
static FAIL: RESULT_CODE;
|
|
332
590
|
_map: Map_2;
|
|
333
591
|
_cache: Cache_2;
|
|
592
|
+
private loadingPromises;
|
|
334
593
|
constructor(map: Map_2);
|
|
335
594
|
load(icons: Icon[]): Promise<{
|
|
336
595
|
success: result[];
|
|
@@ -350,22 +609,132 @@ export declare class IconManager {
|
|
|
350
609
|
error(icon: Icon | SvgIcon, err: string | Error): result;
|
|
351
610
|
}
|
|
352
611
|
|
|
612
|
+
export declare class IconPoint extends Point<IIconPointOptions> {
|
|
613
|
+
static NAME: PlotType;
|
|
614
|
+
readonly LAYER: string;
|
|
615
|
+
constructor(map: Map_2, options: IIconPointOptions);
|
|
616
|
+
onAdd(): void;
|
|
617
|
+
getFeature(): GeoJSON_2.Feature<GeoJSON_2.Point | null>;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare interface IconPointStyle {
|
|
621
|
+
'text-color'?: string;
|
|
622
|
+
'text-size'?: number;
|
|
623
|
+
'icon-size'?: number;
|
|
624
|
+
'icon-rotate'?: number;
|
|
625
|
+
'text-offset'?: [number, number];
|
|
626
|
+
'icon-anchor'?: IconAnchor;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export declare namespace IconPointVars {
|
|
630
|
+
export {
|
|
631
|
+
NAME_2 as NAME,
|
|
632
|
+
POINT_ICON_LAYER_NAME,
|
|
633
|
+
DEFAULT_TEXT_SIZE,
|
|
634
|
+
DEFAULT_ICON_ANCHOR,
|
|
635
|
+
GAP_PX,
|
|
636
|
+
DEFAULT_ICON_SIZE,
|
|
637
|
+
ICON_ROTATE,
|
|
638
|
+
POINT_ICON_LAYER,
|
|
639
|
+
LAYER_LIST_2 as LAYER_LIST
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
353
643
|
declare interface IContextOptions {
|
|
354
644
|
map: Map_2;
|
|
355
645
|
}
|
|
356
646
|
|
|
647
|
+
declare interface IFillOptions extends IPoiOptions {
|
|
648
|
+
position?: PolygonPosition;
|
|
649
|
+
style?: FillStyle;
|
|
650
|
+
icon?: string;
|
|
651
|
+
outLineStyle?: LineStyle;
|
|
652
|
+
vertexStyle?: PointStyle;
|
|
653
|
+
midStyle?: PointStyle;
|
|
654
|
+
titleStyle?: PointStyle;
|
|
655
|
+
properties?: Record<string, any>;
|
|
656
|
+
}
|
|
657
|
+
|
|
357
658
|
declare interface IFocusOptions {
|
|
358
659
|
size?: number;
|
|
359
660
|
padding?: number;
|
|
360
661
|
armLength?: number;
|
|
361
662
|
}
|
|
362
663
|
|
|
664
|
+
declare interface IIconPointOptions extends IPointOptions {
|
|
665
|
+
icon: string;
|
|
666
|
+
style?: IconPointStyle;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
declare interface IIndexLineOptions extends ILineOptions {
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
declare interface IIndexPointOptions extends IPointOptions {
|
|
673
|
+
index: number;
|
|
674
|
+
style?: IndexPointStyle;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
declare interface ILineOptions extends IPoiOptions {
|
|
678
|
+
position?: LineStringPosition;
|
|
679
|
+
style?: LineStyle;
|
|
680
|
+
vertexStyle?: PointStyle;
|
|
681
|
+
midStyle?: PointStyle;
|
|
682
|
+
properties?: Record<string, any>;
|
|
683
|
+
}
|
|
684
|
+
|
|
363
685
|
declare interface Image_2 {
|
|
364
686
|
width: number;
|
|
365
687
|
height: number;
|
|
366
688
|
image: ImageBitmap | HTMLImageElement | ImageData;
|
|
367
689
|
}
|
|
368
690
|
|
|
691
|
+
export declare class IndexLine extends Line<IIndexLineOptions> {
|
|
692
|
+
constructor(map: Map_2, options: IIndexLineOptions);
|
|
693
|
+
createVertex(id: string, index: number, position: LngLat): PointInstance;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
export declare class IndexPoint extends Point<IIndexPointOptions> {
|
|
697
|
+
static NAME: PlotType;
|
|
698
|
+
readonly LAYER: string;
|
|
699
|
+
constructor(map: Map_2, options: IIndexPointOptions);
|
|
700
|
+
onAdd(): void;
|
|
701
|
+
getFeature(): GeoJSON_2.Feature<GeoJSON_2.Point | null>;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
declare interface IndexPointStyle {
|
|
705
|
+
'text-color'?: string;
|
|
706
|
+
'text-size'?: number;
|
|
707
|
+
'circle-stroke-width'?: number;
|
|
708
|
+
'circle-stroke-color'?: ColorSpecification;
|
|
709
|
+
'circle-radius'?: number;
|
|
710
|
+
'circle-color'?: ColorSpecification;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
export declare namespace IndexPointVars {
|
|
714
|
+
export {
|
|
715
|
+
NAME_3 as NAME,
|
|
716
|
+
POINT_INDEX_LAYER_NAME,
|
|
717
|
+
DEFAULT_TEXT_COLOR,
|
|
718
|
+
POINT_INDEX_LAYER,
|
|
719
|
+
LAYER_LIST_3 as LAYER_LIST
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
declare interface IPointOptions extends IPoiOptions {
|
|
724
|
+
position?: PointPosition;
|
|
725
|
+
style?: PointStyle;
|
|
726
|
+
properties?: Record<string, any>;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
declare interface IPoiOptions {
|
|
730
|
+
id: string;
|
|
731
|
+
name?: string;
|
|
732
|
+
visibility: PlotVisibility;
|
|
733
|
+
isName?: boolean;
|
|
734
|
+
style?: any;
|
|
735
|
+
properties?: Record<string, any>;
|
|
736
|
+
}
|
|
737
|
+
|
|
369
738
|
declare interface IShipOptions {
|
|
370
739
|
plugins?: BaseShipConstructor[];
|
|
371
740
|
}
|
|
@@ -373,6 +742,7 @@ declare interface IShipOptions {
|
|
|
373
742
|
declare interface ITooltipOptions {
|
|
374
743
|
id: string | number;
|
|
375
744
|
visible?: boolean;
|
|
745
|
+
line?: boolean;
|
|
376
746
|
className?: string;
|
|
377
747
|
position: LngLat;
|
|
378
748
|
element: HTMLElement;
|
|
@@ -386,37 +756,227 @@ declare interface ITrackOptions {
|
|
|
386
756
|
endLabel: string;
|
|
387
757
|
}
|
|
388
758
|
|
|
389
|
-
declare const LAYER_LIST:
|
|
759
|
+
declare const LAYER_LIST: SortLayer[];
|
|
760
|
+
|
|
761
|
+
declare const LAYER_LIST_2: SortLayer[];
|
|
762
|
+
|
|
763
|
+
declare const LAYER_LIST_3: SortLayer[];
|
|
764
|
+
|
|
765
|
+
declare const LAYER_LIST_4: SortLayer[];
|
|
766
|
+
|
|
767
|
+
declare const LAYER_LIST_5: SortLayer[];
|
|
768
|
+
|
|
769
|
+
declare const LAYER_LIST_6: SortLayer[];
|
|
770
|
+
|
|
771
|
+
declare const LAYER_LIST_7: SortLayer[];
|
|
772
|
+
|
|
773
|
+
export declare class Line<T extends ILineOptions = ILineOptions> extends Poi<T, GeoJSON_2.LineString | null> {
|
|
774
|
+
static NAME: PlotType;
|
|
775
|
+
readonly LAYER: string;
|
|
776
|
+
points: PointInstance[];
|
|
777
|
+
midPoints: Point[];
|
|
778
|
+
titles: GeoJSON_2.Feature<GeoJSON_2.LineString | null>[];
|
|
779
|
+
residentEvent: LineResidentEvent;
|
|
780
|
+
updateEvent: LineUpdateEvent;
|
|
781
|
+
createEvent: LineCreateEvent;
|
|
782
|
+
constructor(map: Map_2, options: T);
|
|
783
|
+
get id(): string;
|
|
784
|
+
get center(): LngLat | null;
|
|
785
|
+
get geometry(): GeoJSON_2.LineString | null;
|
|
786
|
+
onAdd(): void;
|
|
787
|
+
onRemove(): void;
|
|
788
|
+
getFeature(): GeoJSON_2.Feature<GeoJSON_2.LineString | null>;
|
|
789
|
+
start(): void;
|
|
790
|
+
stop(): void;
|
|
791
|
+
show(): void;
|
|
792
|
+
hide(): void;
|
|
793
|
+
edit(): void;
|
|
794
|
+
unedit(): void;
|
|
795
|
+
focus(): void;
|
|
796
|
+
unfocus(): void;
|
|
797
|
+
select(): void;
|
|
798
|
+
unselect(): void;
|
|
799
|
+
move(position: LngLat): void;
|
|
800
|
+
update(options: T): void;
|
|
801
|
+
remove(): void;
|
|
802
|
+
render(): void;
|
|
803
|
+
getMidPoint(index: number): Point | null;
|
|
804
|
+
getPoint(index: number): PointInstance | null;
|
|
805
|
+
createVertex(id: string, index: number, position: LngLat): PointInstance;
|
|
806
|
+
createMid(id: string, index: number, position: LngLat): Point;
|
|
807
|
+
createTitles(): Feature<LineString>[];
|
|
808
|
+
removeTitles(): GeoJSON_2.Feature<null>[];
|
|
809
|
+
createPoint(): void;
|
|
810
|
+
/**
|
|
811
|
+
* 插入一个新节点 (例如: 将中点转为实点时调用)
|
|
812
|
+
* @param index 要插入的位置索引
|
|
813
|
+
* @param position 新节点的坐标
|
|
814
|
+
*/
|
|
815
|
+
insertPoint(index: number, position: LngLat): PointInstance;
|
|
816
|
+
/**
|
|
817
|
+
* 更新某个实点的位置 (例如: 拖拽某个节点)
|
|
818
|
+
* @param index 节点索引
|
|
819
|
+
* @param position 拖拽后的新坐标
|
|
820
|
+
* @param isRender 是否立即渲染
|
|
821
|
+
*/
|
|
822
|
+
updatePoint(index: number, position: LngLat, isRender?: boolean): void;
|
|
823
|
+
/** 更新指定中点的坐标 (例如:拖拽中点时触发,但在松手前它还是个中点) */
|
|
824
|
+
updateMidPoint(index: number, position: LngLat): void;
|
|
825
|
+
removePointAt(index: number): void;
|
|
826
|
+
/** 清空所有点 (替代原有的 removePoint) */
|
|
827
|
+
clearAll(): void;
|
|
828
|
+
removePoint(): void;
|
|
829
|
+
/**
|
|
830
|
+
* 内部机制:全量重新生成所有的中点
|
|
831
|
+
*/
|
|
832
|
+
protected syncMidPoints(): void;
|
|
833
|
+
/**
|
|
834
|
+
* 内部机制:修补数组增减后的索引及属性ID
|
|
835
|
+
*/
|
|
836
|
+
protected reindexPoints(): void;
|
|
837
|
+
/**
|
|
838
|
+
* 内部机制:只更新指定节点相邻的两个中点 (用于优化拖拽时的渲染性能)
|
|
839
|
+
*/
|
|
840
|
+
protected updateAdjacentMidPoints(index: number): void;
|
|
841
|
+
/**
|
|
842
|
+
* 内部计算:获取两点之间的中点坐标
|
|
843
|
+
*/
|
|
844
|
+
protected calcMidPosition(p1: LngLat, p2: LngLat): LngLat;
|
|
845
|
+
/** 内部:当数组发生增删时,修复 properties 中的 index 和 id */
|
|
846
|
+
private _reindexPoints;
|
|
847
|
+
/** 内部:重新计算并全量同步所有中点 */
|
|
848
|
+
private _syncMidPoints;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
declare const LINE_LAYER: LayerSpecification;
|
|
852
|
+
|
|
853
|
+
declare const LINE_LAYER_NAME = "mapbox-gl-plot-line-layer";
|
|
854
|
+
|
|
855
|
+
declare const LINE_TEXT_LAYER: LayerSpecification;
|
|
856
|
+
|
|
857
|
+
declare const LINE_TEXT_LAYER_NAME = "mapbox-gl-plot-line-text-layer";
|
|
390
858
|
|
|
391
|
-
declare
|
|
859
|
+
declare abstract class LineBaseEvent extends EventState {
|
|
860
|
+
protected line: Line;
|
|
861
|
+
protected constructor(map: Map_2, line: Line);
|
|
862
|
+
abstract onAdd(): void;
|
|
863
|
+
abstract onRemove(): void;
|
|
864
|
+
abstract enabled(): void;
|
|
865
|
+
abstract disabled(): void;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
declare class LineCreateEvent extends LineBaseEvent {
|
|
869
|
+
private count;
|
|
870
|
+
private drawPoint;
|
|
871
|
+
private onClick;
|
|
872
|
+
private onMousemove;
|
|
873
|
+
private stop;
|
|
874
|
+
constructor(map: Map_2, line: Line);
|
|
875
|
+
onAdd(): void;
|
|
876
|
+
onRemove(): void;
|
|
877
|
+
setDrawLngLat(position: LngLat | null): void;
|
|
878
|
+
getDrawLngLat(): LngLat | null;
|
|
879
|
+
enabled(): void;
|
|
880
|
+
disabled(): void;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
declare class LineResidentEvent extends LineBaseEvent {
|
|
884
|
+
private onLineMouseenter;
|
|
885
|
+
private onLineMouseLeave;
|
|
886
|
+
private onClick;
|
|
887
|
+
private onLineClick;
|
|
888
|
+
constructor(map: Map_2, line: Line);
|
|
889
|
+
onAdd(): void;
|
|
890
|
+
onRemove(): void;
|
|
891
|
+
enabled(): void;
|
|
892
|
+
disabled(): void;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
declare type LineStringPosition = PointPosition[];
|
|
896
|
+
|
|
897
|
+
declare interface LineStyle {
|
|
898
|
+
'line-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
899
|
+
'line-width'?: DataDrivenPropertyValueSpecification<number>;
|
|
900
|
+
'text-size'?: DataDrivenPropertyValueSpecification<number>;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
declare class LineUpdateEvent extends LineBaseEvent {
|
|
904
|
+
protected dragStartLngLat: LngLat | null;
|
|
905
|
+
protected modifyMid: Point | null;
|
|
906
|
+
private onVertexUpdate;
|
|
907
|
+
private onMidBeforeUpdate;
|
|
908
|
+
private onMidUpdate;
|
|
909
|
+
private onMidDone;
|
|
910
|
+
private onLineMousedown;
|
|
911
|
+
private onLineMouseenter;
|
|
912
|
+
private onLineMouseLeave;
|
|
913
|
+
private onMousemove;
|
|
914
|
+
private onMouseup;
|
|
915
|
+
constructor(map: Map_2, line: Line);
|
|
916
|
+
onAdd(): void;
|
|
917
|
+
onRemove(): void;
|
|
918
|
+
setModifyLngLat(point: Point | null): void;
|
|
919
|
+
getModifyLngLat(): Point | null;
|
|
920
|
+
setDragLngLat(position: LngLat | null): void;
|
|
921
|
+
getDragLngLat(): LngLat | null;
|
|
922
|
+
enabled(): void;
|
|
923
|
+
disabled(): void;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
export declare namespace LineVars {
|
|
927
|
+
export {
|
|
928
|
+
NAME_4 as NAME,
|
|
929
|
+
Z_INDEX_2 as Z_INDEX,
|
|
930
|
+
TEXT_Z_INDEX,
|
|
931
|
+
LINE_LAYER_NAME,
|
|
932
|
+
DOTTED_LINE_LAYER_NAME,
|
|
933
|
+
LINE_TEXT_LAYER_NAME,
|
|
934
|
+
DEFAULT_LINE_COLOR,
|
|
935
|
+
DEFAULT_LINE_WIDTH,
|
|
936
|
+
DEFAULT_TEXT_COLOR_2 as DEFAULT_TEXT_COLOR,
|
|
937
|
+
DEFAULT_TEXT_SIZE_2 as DEFAULT_TEXT_SIZE,
|
|
938
|
+
DOTTED_LINE_LAYER,
|
|
939
|
+
LINE_LAYER,
|
|
940
|
+
LINE_TEXT_LAYER,
|
|
941
|
+
LAYER_LIST_4 as LAYER_LIST
|
|
942
|
+
}
|
|
943
|
+
}
|
|
392
944
|
|
|
393
945
|
declare enum MapType {
|
|
394
946
|
LAND = "land",
|
|
395
|
-
SATELLITE = "satellite"
|
|
396
|
-
CUSTOM = "custom"
|
|
947
|
+
SATELLITE = "satellite"
|
|
397
948
|
}
|
|
398
949
|
|
|
399
950
|
declare const MAX_ICON_SIZE = 0.5;
|
|
400
951
|
|
|
401
952
|
declare const MIN_ICON_SIZE = 0.2;
|
|
402
953
|
|
|
403
|
-
export declare abstract class Module {
|
|
954
|
+
export declare abstract class Module extends default_3 {
|
|
404
955
|
protected context: Context;
|
|
405
956
|
/**
|
|
406
957
|
* 构造函数,初始化地图上下文和选项配置
|
|
407
958
|
* @param map - 地图实例对象
|
|
408
959
|
*/
|
|
409
960
|
protected constructor(map: Map_2);
|
|
410
|
-
emit(): void;
|
|
411
961
|
mount(): void;
|
|
412
962
|
destroy(): void;
|
|
413
963
|
abstract onAdd(): void;
|
|
414
964
|
abstract onRemove(): void;
|
|
415
965
|
}
|
|
416
966
|
|
|
417
|
-
declare const NAME =
|
|
967
|
+
declare const NAME = PlotType.Fill;
|
|
968
|
+
|
|
969
|
+
declare const NAME_2 = PlotType.ICON_POINT;
|
|
970
|
+
|
|
971
|
+
declare const NAME_3 = PlotType.INDEX_POINT;
|
|
972
|
+
|
|
973
|
+
declare const NAME_4 = PlotType.LINE;
|
|
974
|
+
|
|
975
|
+
declare const NAME_5 = PlotType.POINT;
|
|
976
|
+
|
|
977
|
+
declare const NAME_6 = "Ais";
|
|
418
978
|
|
|
419
|
-
declare const
|
|
979
|
+
declare const NAME_7 = "Track";
|
|
420
980
|
|
|
421
981
|
declare const NORMAL_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"74\" height=\"74\" viewBox=\"0 0 74 74\" fill=\"none\"><circle cx=\"37\" cy=\"37\" r=\"32\" stroke=\"rgba(172, 51, 193, 1)\" stroke-width=\"10\" fill=\"#FFFFFF\" ></circle></svg>";
|
|
422
982
|
|
|
@@ -424,6 +984,201 @@ declare const NORMAL_ICON_NAME = "track-normal";
|
|
|
424
984
|
|
|
425
985
|
declare type Orientation = 'static' | 'left' | 'right' | 'straight';
|
|
426
986
|
|
|
987
|
+
declare enum PlotType {
|
|
988
|
+
POINT = "Point",
|
|
989
|
+
INDEX_POINT = "IndexPoint",
|
|
990
|
+
ICON_POINT = "IconPoint",
|
|
991
|
+
LINE = "LineString",
|
|
992
|
+
Fill = "Polygon",
|
|
993
|
+
CIRCLE = "Circle"
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
declare type PlotVisibility = 'visible' | 'none';
|
|
997
|
+
|
|
998
|
+
declare abstract class Poi<T extends IPoiOptions = IPoiOptions, G extends GeoJSON_2.Geometry | null = GeoJSON_2.Geometry> extends Module {
|
|
999
|
+
options: T;
|
|
1000
|
+
readonly SOURCE: string;
|
|
1001
|
+
readonly LAYER: string;
|
|
1002
|
+
protected constructor(map: Map_2, options: T);
|
|
1003
|
+
abstract onAdd(): void;
|
|
1004
|
+
abstract onRemove(): void;
|
|
1005
|
+
abstract get id(): T['id'];
|
|
1006
|
+
get isEdit(): boolean;
|
|
1007
|
+
get isFocus(): boolean;
|
|
1008
|
+
get isCreate(): boolean;
|
|
1009
|
+
get visibility(): PlotVisibility;
|
|
1010
|
+
abstract get center(): LngLat | null;
|
|
1011
|
+
abstract get geometry(): G | null;
|
|
1012
|
+
abstract getFeature(): GeoJSON_2.Feature<G>;
|
|
1013
|
+
abstract start(): void;
|
|
1014
|
+
abstract stop(): void;
|
|
1015
|
+
abstract edit(): void;
|
|
1016
|
+
abstract unedit(): void;
|
|
1017
|
+
abstract focus(): void;
|
|
1018
|
+
abstract unfocus(): void;
|
|
1019
|
+
abstract select(): void;
|
|
1020
|
+
abstract unselect(): void;
|
|
1021
|
+
abstract move(position: LngLat): void;
|
|
1022
|
+
abstract update(options: T): void;
|
|
1023
|
+
abstract remove(): void;
|
|
1024
|
+
abstract render(): void;
|
|
1025
|
+
show(): void;
|
|
1026
|
+
hide(): void;
|
|
1027
|
+
setState(states: Record<string, unknown>): void;
|
|
1028
|
+
getState(): Record<string, unknown> | null | undefined;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export declare class Point<T extends IPointOptions = IPointOptions> extends Poi<T, GeoJSON_2.Point | null> {
|
|
1032
|
+
static NAME: PlotType;
|
|
1033
|
+
readonly LAYER: string;
|
|
1034
|
+
residentEvent: PointResidentEvent;
|
|
1035
|
+
updateEvent: PointUpdateEvent;
|
|
1036
|
+
createEvent: PointCreateEvent;
|
|
1037
|
+
constructor(map: Map_2, options: T);
|
|
1038
|
+
onAdd(): void;
|
|
1039
|
+
onRemove(): void;
|
|
1040
|
+
get id(): string;
|
|
1041
|
+
edit(): void;
|
|
1042
|
+
unedit(): void;
|
|
1043
|
+
focus(): void;
|
|
1044
|
+
unfocus(): void;
|
|
1045
|
+
select(): void;
|
|
1046
|
+
unselect(): void;
|
|
1047
|
+
get center(): LngLat | null;
|
|
1048
|
+
get geometry(): GeoJSON_2.Point | null;
|
|
1049
|
+
getFeature(): GeoJSON_2.Feature<GeoJSON_2.Point | null>;
|
|
1050
|
+
start(): void;
|
|
1051
|
+
stop(): void;
|
|
1052
|
+
move(position: T['position']): void;
|
|
1053
|
+
update(options: T): void;
|
|
1054
|
+
remove(): void;
|
|
1055
|
+
render(): void;
|
|
1056
|
+
/**
|
|
1057
|
+
* 计算文字相对于图标的偏移量
|
|
1058
|
+
* 返回单位为 em (Mapbox text-offset 标准单位)
|
|
1059
|
+
*/
|
|
1060
|
+
protected calculateTextOffset(params: CalcOffsetParams): [number, number];
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
declare const POINT_CIRCLE_LAYER: LayerSpecification;
|
|
1064
|
+
|
|
1065
|
+
declare const POINT_CIRCLE_LAYER_NAME = "mapbox-gl-plot-point-circle-layer";
|
|
1066
|
+
|
|
1067
|
+
declare const POINT_ICON_LAYER: LayerSpecification;
|
|
1068
|
+
|
|
1069
|
+
declare const POINT_ICON_LAYER_NAME = "mapbox-gl-plot-point-icon-layer";
|
|
1070
|
+
|
|
1071
|
+
declare const POINT_INDEX_LAYER: LayerSpecification;
|
|
1072
|
+
|
|
1073
|
+
declare const POINT_INDEX_LAYER_NAME = "mapbox-gl-plot-point-index-layer";
|
|
1074
|
+
|
|
1075
|
+
declare const POINT_TEXT_LAYER: LayerSpecification;
|
|
1076
|
+
|
|
1077
|
+
declare const POINT_TEXT_LAYER_NAME = "mapbox-gl-plot-point-text-layer";
|
|
1078
|
+
|
|
1079
|
+
declare abstract class PointBaseEvent<T extends Point = Point> extends EventState {
|
|
1080
|
+
protected point: T;
|
|
1081
|
+
protected constructor(map: Map_2, point: T);
|
|
1082
|
+
abstract onAdd(): void;
|
|
1083
|
+
abstract onRemove(): void;
|
|
1084
|
+
abstract enabled(): void;
|
|
1085
|
+
abstract disabled(): void;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
declare class PointCreateEvent<T extends Point = Point> extends PointBaseEvent<T> {
|
|
1089
|
+
private onClick;
|
|
1090
|
+
private onMousemove;
|
|
1091
|
+
constructor(map: Map_2, point: T);
|
|
1092
|
+
onAdd(): void;
|
|
1093
|
+
onRemove(): void;
|
|
1094
|
+
enabled(): void;
|
|
1095
|
+
disabled(): void;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
declare interface PointInstance<T extends IPointOptions = IPointOptions> {
|
|
1099
|
+
options: T;
|
|
1100
|
+
readonly SOURCE: string;
|
|
1101
|
+
LAYER: string;
|
|
1102
|
+
residentEvent: PointResidentEvent;
|
|
1103
|
+
updateEvent: PointUpdateEvent;
|
|
1104
|
+
createEvent: PointCreateEvent;
|
|
1105
|
+
readonly id: string;
|
|
1106
|
+
readonly isEdit: boolean;
|
|
1107
|
+
readonly isCreate: boolean;
|
|
1108
|
+
readonly visibility: PlotVisibility;
|
|
1109
|
+
readonly center: LngLat | null;
|
|
1110
|
+
readonly geometry: GeoJSON_2.Point | null;
|
|
1111
|
+
onAdd(): void;
|
|
1112
|
+
onRemove(): void;
|
|
1113
|
+
getFeature(): GeoJSON_2.Feature<GeoJSON_2.Point | null>;
|
|
1114
|
+
start(): void;
|
|
1115
|
+
stop(): void;
|
|
1116
|
+
edit(): void;
|
|
1117
|
+
unedit(): void;
|
|
1118
|
+
focus(): void;
|
|
1119
|
+
unfocus(): void;
|
|
1120
|
+
select(): void;
|
|
1121
|
+
unselect(): void;
|
|
1122
|
+
move(position: T['position']): void;
|
|
1123
|
+
update(options: T): void;
|
|
1124
|
+
remove(): void;
|
|
1125
|
+
render(): void;
|
|
1126
|
+
show(): void;
|
|
1127
|
+
hide(): void;
|
|
1128
|
+
setState(states: Record<string, unknown>): void;
|
|
1129
|
+
getState(): Record<string, unknown> | null | undefined;
|
|
1130
|
+
on<T extends default_3.EventNames<string>>(event: T, fn: default_3.EventListener<string, T>, context?: any): this;
|
|
1131
|
+
off<T extends default_3.EventNames<string>>(event: T, fn?: default_3.EventListener<string, T>, context?: any, once?: boolean): this;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
declare type PointPosition = LngLat;
|
|
1135
|
+
|
|
1136
|
+
declare class PointResidentEvent<T extends Point = Point> extends PointBaseEvent<T> {
|
|
1137
|
+
private onMouseEnter;
|
|
1138
|
+
private onMouseLeave;
|
|
1139
|
+
private onClick;
|
|
1140
|
+
private onDblclick;
|
|
1141
|
+
constructor(map: Map_2, point: T);
|
|
1142
|
+
onAdd(): void;
|
|
1143
|
+
onRemove(): void;
|
|
1144
|
+
enabled(): void;
|
|
1145
|
+
disabled(): void;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
declare type PointStyle = CirclePointStyle | IndexPointStyle | IconPointStyle;
|
|
1149
|
+
|
|
1150
|
+
declare class PointUpdateEvent<T extends Point = Point> extends PointBaseEvent<T> {
|
|
1151
|
+
private onMousedown;
|
|
1152
|
+
private onMousemove;
|
|
1153
|
+
private onMouseup;
|
|
1154
|
+
constructor(map: Map_2, point: T);
|
|
1155
|
+
onAdd(): void;
|
|
1156
|
+
onRemove(): void;
|
|
1157
|
+
enabled(): void;
|
|
1158
|
+
disabled(): void;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
export declare namespace PointVars {
|
|
1162
|
+
export {
|
|
1163
|
+
NAME_5 as NAME,
|
|
1164
|
+
Z_INDEX_3 as Z_INDEX,
|
|
1165
|
+
TEXT_Z_INDEX_2 as TEXT_Z_INDEX,
|
|
1166
|
+
POINT_CIRCLE_LAYER_NAME,
|
|
1167
|
+
POINT_TEXT_LAYER_NAME,
|
|
1168
|
+
DEFAULT_TEXT_SIZE_3 as DEFAULT_TEXT_SIZE,
|
|
1169
|
+
GAP_PX_2 as GAP_PX,
|
|
1170
|
+
DEFAULT_CIRCLE_RADIUS,
|
|
1171
|
+
DEFAULT_CIRCLE_COLOR,
|
|
1172
|
+
DEFAULT_CIRCLE_STROKE_WIDTH,
|
|
1173
|
+
DEFAULT_CIRCLE_STROKE_COLOR,
|
|
1174
|
+
POINT_CIRCLE_LAYER,
|
|
1175
|
+
POINT_TEXT_LAYER,
|
|
1176
|
+
LAYER_LIST_5 as LAYER_LIST
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
declare type PolygonPosition = PointPosition[];
|
|
1181
|
+
|
|
427
1182
|
declare class ResidentEvent extends EventState {
|
|
428
1183
|
private ships;
|
|
429
1184
|
protected hoverId: IAisShipOptions['id'] | null | undefined;
|
|
@@ -432,8 +1187,8 @@ declare class ResidentEvent extends EventState {
|
|
|
432
1187
|
protected _leave: OmitThisParameter<(e: MapMouseEvent) => void>;
|
|
433
1188
|
protected _zoomEnd: () => void;
|
|
434
1189
|
constructor(map: Map_2, ships?: AisShip[]);
|
|
435
|
-
|
|
436
|
-
|
|
1190
|
+
enabled(): void;
|
|
1191
|
+
disabled(): void;
|
|
437
1192
|
onAdd(): void;
|
|
438
1193
|
onRemove(): void;
|
|
439
1194
|
add(ship: AisShip): void;
|
|
@@ -451,9 +1206,18 @@ declare class ResidentEvent extends EventState {
|
|
|
451
1206
|
declare class ResourceRegister {
|
|
452
1207
|
private map;
|
|
453
1208
|
private sourceData;
|
|
1209
|
+
/** Feature 索引,key 为 `${sourceId}:${featureId}` */
|
|
1210
|
+
private featureIndex;
|
|
454
1211
|
private dirtySourceIds;
|
|
455
1212
|
private renderFrameId;
|
|
1213
|
+
private layerList;
|
|
1214
|
+
private destroyed;
|
|
1215
|
+
/** 记录由此类创建的 source id */
|
|
1216
|
+
private managedSourceIds;
|
|
1217
|
+
/** 记录由此类创建的 layer id */
|
|
1218
|
+
private managedLayerIds;
|
|
456
1219
|
constructor(map: Map_2);
|
|
1220
|
+
private checkDestroyed;
|
|
457
1221
|
/**
|
|
458
1222
|
* 幂等地添加 Source
|
|
459
1223
|
*/
|
|
@@ -461,7 +1225,15 @@ declare class ResourceRegister {
|
|
|
461
1225
|
/**
|
|
462
1226
|
* 幂等地添加 Layer
|
|
463
1227
|
*/
|
|
464
|
-
addLayer(
|
|
1228
|
+
addLayer(sortLayer: SortLayer): void;
|
|
1229
|
+
/**
|
|
1230
|
+
* 移除 Layer
|
|
1231
|
+
*/
|
|
1232
|
+
removeLayer(layerId: string): void;
|
|
1233
|
+
/**
|
|
1234
|
+
* 移除 Source(会先移除关联的 Layer)
|
|
1235
|
+
*/
|
|
1236
|
+
removeSource(sourceId: string): void;
|
|
465
1237
|
findFeature(source: string, featureId: string): GeoJSON_2.Feature | undefined;
|
|
466
1238
|
/**
|
|
467
1239
|
* 获取 Source
|
|
@@ -484,8 +1256,9 @@ declare class ResourceRegister {
|
|
|
484
1256
|
getState(source: string, id: string): Record<string, unknown> | null | undefined;
|
|
485
1257
|
/**
|
|
486
1258
|
* 销毁清理
|
|
1259
|
+
* @param removeFromMap 是否从地图上移除由此类管理的 Source 和 Layer,默认 false
|
|
487
1260
|
*/
|
|
488
|
-
destroy(): void;
|
|
1261
|
+
destroy(removeFromMap?: boolean): void;
|
|
489
1262
|
}
|
|
490
1263
|
|
|
491
1264
|
declare interface result {
|
|
@@ -513,16 +1286,16 @@ declare enum Scopes {
|
|
|
513
1286
|
* 方向点 拐点 船首 船首右舷 船尾右舷 右船尾 左船尾 船尾左舷 船首左舷
|
|
514
1287
|
*/
|
|
515
1288
|
declare interface Shape {
|
|
516
|
-
leftDirection:
|
|
517
|
-
rightDirection:
|
|
518
|
-
turn:
|
|
519
|
-
head:
|
|
520
|
-
rightBow:
|
|
521
|
-
rightQuarter:
|
|
522
|
-
rightStern:
|
|
523
|
-
leftStern:
|
|
524
|
-
leftQuarter:
|
|
525
|
-
leftBow:
|
|
1289
|
+
leftDirection: Point_2;
|
|
1290
|
+
rightDirection: Point_2;
|
|
1291
|
+
turn: Point_2;
|
|
1292
|
+
head: Point_2;
|
|
1293
|
+
rightBow: Point_2;
|
|
1294
|
+
rightQuarter: Point_2;
|
|
1295
|
+
rightStern: Point_2;
|
|
1296
|
+
leftStern: Point_2;
|
|
1297
|
+
leftQuarter: Point_2;
|
|
1298
|
+
leftBow: Point_2;
|
|
526
1299
|
}
|
|
527
1300
|
|
|
528
1301
|
export declare class Ship extends Module {
|
|
@@ -545,6 +1318,8 @@ export declare class Ship extends Module {
|
|
|
545
1318
|
removeAll(): void;
|
|
546
1319
|
render(): void;
|
|
547
1320
|
get(id: string | number): BaseShip<any> | undefined;
|
|
1321
|
+
focus(id: IBaseShipOptions['id']): void;
|
|
1322
|
+
unfocus(id: IBaseShipOptions['id']): void;
|
|
548
1323
|
select(id: IBaseShipOptions['id']): void;
|
|
549
1324
|
unselect(id: IBaseShipOptions['id']): void;
|
|
550
1325
|
}
|
|
@@ -557,6 +1332,10 @@ declare enum SHIP_COLOR {
|
|
|
557
1332
|
|
|
558
1333
|
declare const SHIP_ICON: SvgIcon[];
|
|
559
1334
|
|
|
1335
|
+
declare const SHIP_ICON_DIRECTION_LAYER: LayerSpecification;
|
|
1336
|
+
|
|
1337
|
+
declare const SHIP_ICON_DIRECTION_LAYER_NAME = "mapbox-gl-ship-icon-direction-layer";
|
|
1338
|
+
|
|
560
1339
|
declare const SHIP_ICON_LAYER: LayerSpecification;
|
|
561
1340
|
|
|
562
1341
|
declare const SHIP_ICON_LAYER_NAME = "mapbox-gl-ship-icon-layer";
|
|
@@ -573,19 +1352,22 @@ declare const SHIP_SOURCE_NAME = "mapbox-gl-ship-source";
|
|
|
573
1352
|
|
|
574
1353
|
export declare namespace ShipVars {
|
|
575
1354
|
export {
|
|
576
|
-
NAME,
|
|
1355
|
+
NAME_6 as NAME,
|
|
1356
|
+
Z_INDEX_4 as Z_INDEX,
|
|
577
1357
|
SHIP_SOURCE_NAME,
|
|
578
1358
|
SHIP_ICON_LAYER_NAME,
|
|
1359
|
+
SHIP_ICON_DIRECTION_LAYER_NAME,
|
|
579
1360
|
SHIP_REAL_LAYER_NAME,
|
|
580
1361
|
SHIP_REAL_OUTLINE_LAYER_NAME,
|
|
581
1362
|
MIN_ICON_SIZE,
|
|
582
1363
|
MAX_ICON_SIZE,
|
|
583
1364
|
UPDATE_STATUS,
|
|
584
1365
|
SHIP_COLOR,
|
|
1366
|
+
SHIP_ICON_DIRECTION_LAYER,
|
|
585
1367
|
SHIP_ICON_LAYER,
|
|
586
1368
|
SHIP_REAL_LAYER,
|
|
587
1369
|
SHIP_REAL_OUTLINE_LAYER,
|
|
588
|
-
LAYER_LIST,
|
|
1370
|
+
LAYER_LIST_6 as LAYER_LIST,
|
|
589
1371
|
SHIP_ICON
|
|
590
1372
|
}
|
|
591
1373
|
}
|
|
@@ -597,6 +1379,11 @@ declare interface SimpleAnchor {
|
|
|
597
1379
|
'bottom-right': BBox;
|
|
598
1380
|
}
|
|
599
1381
|
|
|
1382
|
+
declare interface SortLayer {
|
|
1383
|
+
zIndex: number;
|
|
1384
|
+
layer: LayerSpecification;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
600
1387
|
declare const START_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"74\" height=\"74\" viewBox=\"0 0 74 74\" fill=\"none\"><circle cx=\"37\" cy=\"37\" r=\"32\" stroke=\"rgba(172, 51, 193, 1)\" stroke-width=\"10\" fill=\"#AC33C1\" ></circle><path d=\"M36.4 50.84C40.84 51.08 45.24 51.08 45.24 51.08C50.52 51.08 55.12 50.8 55.12 50.8L54.48 54.36C50.16 54.64 45.24 54.64 45.24 54.64C40.32 54.64 35.96 54.36 35.96 54.36C31.16 54.08 28.16 52.72 28.16 52.72C25.16 51.36 23.4 48.36 23.4 48.36C22.64 51.96 20.84 55.72 20.84 55.72L18 53.52C19.16 51.04 19.76 48.94 19.76 48.94C20.36 46.84 20.62 44.26 20.62 44.26C20.88 41.68 20.88 37.64 20.88 37.64L24.2 37.64C24.2 40.92 24.04 43.12 24.04 43.12C25.16 46.52 27.28 48.24 27.28 48.24L27.28 35.44L18.68 35.44L18.68 32.08L26.32 32.08L26.32 27.12L20.08 27.12L20.08 23.72L26.32 23.72L26.32 19L29.84 19L29.84 23.72L35.64 23.72L35.64 27.12L29.84 27.12L29.84 32.08L36.76 32.08L36.76 35.44L30.72 35.44L30.72 40.96L36.36 40.96L36.36 44.32L30.72 44.32L30.72 49.96C33 50.64 36.4 50.84 36.4 50.84ZM48.96 30.88L48.96 24.64L37.8 24.64L37.8 21.12L52.44 21.12L52.44 34.4L41.84 34.4L41.84 41.52C41.84 42.72 42.02 43.24 42.02 43.24C42.2 43.76 42.68 43.98 42.68 43.98C43.16 44.2 44.28 44.32 44.28 44.32C44.88 44.36 46 44.36 46 44.36C47.12 44.36 47.72 44.32 47.72 44.32C48.88 44.2 49.44 43.98 49.44 43.98C50 43.76 50.22 43.28 50.22 43.28C50.44 42.8 50.52 41.8 50.52 41.8C50.68 39.72 50.68 38.44 50.68 38.44L54.08 39.24C53.96 41.12 53.8 43 53.8 43C53.6 45.04 53.16 45.98 53.16 45.98C52.72 46.92 51.72 47.3 51.72 47.3C50.72 47.68 48.64 47.8 48.64 47.8C46.8 47.88 45.88 47.88 45.88 47.88C44.96 47.88 43.12 47.8 43.12 47.8C41.2 47.68 40.22 47.2 40.22 47.2C39.24 46.72 38.8 45.64 38.8 45.64C38.36 44.56 38.36 42.44 38.36 42.44L38.36 30.88L48.96 30.88Z\" fill=\"#FFFFFF\" ></path></svg>";
|
|
601
1388
|
|
|
602
1389
|
declare const START_ICON_NAME = "track-start";
|
|
@@ -615,6 +1402,10 @@ declare interface SvgIcon {
|
|
|
615
1402
|
svg: string;
|
|
616
1403
|
}
|
|
617
1404
|
|
|
1405
|
+
declare const TEXT_Z_INDEX: number;
|
|
1406
|
+
|
|
1407
|
+
declare const TEXT_Z_INDEX_2: number;
|
|
1408
|
+
|
|
618
1409
|
export declare class Tooltip extends Module {
|
|
619
1410
|
static DEBUG: boolean;
|
|
620
1411
|
options: ITooltipOptions;
|
|
@@ -629,6 +1420,7 @@ export declare class Tooltip extends Module {
|
|
|
629
1420
|
private debug;
|
|
630
1421
|
hide(): void;
|
|
631
1422
|
show(): void;
|
|
1423
|
+
update(options: ITooltipOptions): void;
|
|
632
1424
|
setAnchor(anchor: ITooltipOptions['anchor']): void;
|
|
633
1425
|
getSimpleBbox(): SimpleAnchor;
|
|
634
1426
|
getAllBbox(): AllAnchor;
|
|
@@ -636,7 +1428,7 @@ export declare class Tooltip extends Module {
|
|
|
636
1428
|
private getOffDOMSize;
|
|
637
1429
|
remove(): void;
|
|
638
1430
|
_create(): void;
|
|
639
|
-
_getOffsetByAnchor():
|
|
1431
|
+
_getOffsetByAnchor(): Point_2;
|
|
640
1432
|
setLngLat(lngLat: LngLat): this;
|
|
641
1433
|
connectLine(): void;
|
|
642
1434
|
connectPoint(): LngLat | null;
|
|
@@ -705,7 +1497,8 @@ declare interface TrackItemWithLabel extends TrackItem {
|
|
|
705
1497
|
|
|
706
1498
|
export declare namespace TrackVars {
|
|
707
1499
|
export {
|
|
708
|
-
|
|
1500
|
+
NAME_7 as NAME,
|
|
1501
|
+
Z_INDEX_5 as Z_INDEX,
|
|
709
1502
|
TRACK_SOURCE_NAME,
|
|
710
1503
|
TRACK_ARROW_LAYER_NAME,
|
|
711
1504
|
TRACK_ICON_LAYER_NAME,
|
|
@@ -721,7 +1514,7 @@ export declare namespace TrackVars {
|
|
|
721
1514
|
TRACK_ARROW_LAYER,
|
|
722
1515
|
TRACK_ICON_LAYER,
|
|
723
1516
|
TRACK_LINE_LAYER,
|
|
724
|
-
|
|
1517
|
+
LAYER_LIST_7 as LAYER_LIST
|
|
725
1518
|
}
|
|
726
1519
|
}
|
|
727
1520
|
|
|
@@ -731,4 +1524,14 @@ declare enum UPDATE_STATUS {
|
|
|
731
1524
|
OFFLINE = "Offline"
|
|
732
1525
|
}
|
|
733
1526
|
|
|
1527
|
+
declare const Z_INDEX = 3;
|
|
1528
|
+
|
|
1529
|
+
declare const Z_INDEX_2 = 5;
|
|
1530
|
+
|
|
1531
|
+
declare const Z_INDEX_3 = 10;
|
|
1532
|
+
|
|
1533
|
+
declare const Z_INDEX_4 = 300;
|
|
1534
|
+
|
|
1535
|
+
declare const Z_INDEX_5 = 290;
|
|
1536
|
+
|
|
734
1537
|
export { }
|