cmap-core 0.0.8 → 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 +1024 -37
- package/dist/index.es.js +5151 -1555
- 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 +23 -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
|
|
|
@@ -29,6 +34,7 @@ export declare class AisShip extends BaseShip<IAisShipOptions> {
|
|
|
29
34
|
getFeature(): GeoJSON_2.Feature<GeoJSON_2.Polygon, IAisShipOptions> | GeoJSON_2.Feature<GeoJSON_2.Point, IAisShipOptions>;
|
|
30
35
|
remove(): void;
|
|
31
36
|
setTooltip(tooltip: Tooltip): void;
|
|
37
|
+
removeTooltip(): void;
|
|
32
38
|
update(options: IAisShipOptions): void;
|
|
33
39
|
select(): void;
|
|
34
40
|
unselect(): void;
|
|
@@ -36,9 +42,13 @@ export declare class AisShip extends BaseShip<IAisShipOptions> {
|
|
|
36
42
|
unfocus(): void;
|
|
37
43
|
icon(): GeoJSON_2.Feature<GeoJSON_2.Point, IAisShipOptions>;
|
|
38
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
|
+
}>;
|
|
39
49
|
render(): void;
|
|
40
50
|
label(): HTMLElement;
|
|
41
|
-
offset():
|
|
51
|
+
offset(): Point_2;
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
declare interface AllAnchor {
|
|
@@ -55,6 +65,18 @@ declare interface AllAnchor {
|
|
|
55
65
|
|
|
56
66
|
declare type Anchor = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
57
67
|
|
|
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>";
|
|
69
|
+
|
|
70
|
+
declare const ARROW_ICON_NAME = "track-arrow";
|
|
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'];
|
|
@@ -76,6 +99,7 @@ export declare abstract class BaseShip<T extends IBaseShipOptions> extends Modul
|
|
|
76
99
|
abstract getFeature(): GeoJSON_2.Feature<GeoJSON_2.Polygon, T> | GeoJSON_2.Feature<GeoJSON_2.Point, T>;
|
|
77
100
|
abstract remove(): void;
|
|
78
101
|
abstract setTooltip(tooltip: Tooltip): void;
|
|
102
|
+
abstract removeTooltip(): void;
|
|
79
103
|
abstract update(options: IAisShipOptions): void;
|
|
80
104
|
abstract select(): void;
|
|
81
105
|
abstract unselect(): void;
|
|
@@ -83,9 +107,13 @@ export declare abstract class BaseShip<T extends IBaseShipOptions> extends Modul
|
|
|
83
107
|
abstract unfocus(): void;
|
|
84
108
|
abstract icon(): GeoJSON_2.Feature<GeoJSON_2.Point, T>;
|
|
85
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
|
+
}>;
|
|
86
114
|
abstract render(): void;
|
|
87
115
|
abstract label(): HTMLElement;
|
|
88
|
-
abstract offset():
|
|
116
|
+
abstract offset(): Point_2;
|
|
89
117
|
setState(states: Record<string, unknown>): void;
|
|
90
118
|
getState(): Record<string, unknown> | null | undefined;
|
|
91
119
|
isSelf(e: MapMouseEvent): boolean;
|
|
@@ -127,6 +155,22 @@ declare interface CacheOptions {
|
|
|
127
155
|
|
|
128
156
|
declare type CacheType = 'sessionstorage' | 'localstorage';
|
|
129
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
|
+
|
|
130
174
|
export declare class CMap extends default_3 {
|
|
131
175
|
readonly map: Map_2;
|
|
132
176
|
private readonly options;
|
|
@@ -137,6 +181,7 @@ export declare class CMap extends default_3 {
|
|
|
137
181
|
static LAND: MapType;
|
|
138
182
|
static SATELLITE: MapType;
|
|
139
183
|
constructor(options: ICMapOptions);
|
|
184
|
+
change(type: MapType): void;
|
|
140
185
|
getMap(): Map_2;
|
|
141
186
|
zoomIn(): void;
|
|
142
187
|
zoomOut(): void;
|
|
@@ -145,7 +190,7 @@ export declare class CMap extends default_3 {
|
|
|
145
190
|
|
|
146
191
|
export declare class Collision {
|
|
147
192
|
_tree: default_2<CollisionItem>;
|
|
148
|
-
_map: Map_2
|
|
193
|
+
_map: Map_2;
|
|
149
194
|
_collisionList: CollisionItem[];
|
|
150
195
|
constructor(map: Map_2, config?: CollisionOptions);
|
|
151
196
|
load(collisions: CollisionItemOptions[]): CollisionItem[];
|
|
@@ -218,20 +263,109 @@ export declare class Context {
|
|
|
218
263
|
readonly register: ResourceRegister;
|
|
219
264
|
readonly iconManage: IconManager;
|
|
220
265
|
readonly focus: Focus;
|
|
266
|
+
readonly eventManager: EventManager;
|
|
221
267
|
constructor(options: IContextOptions);
|
|
222
268
|
destroy(): void;
|
|
223
269
|
}
|
|
224
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
|
+
|
|
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>";
|
|
306
|
+
|
|
307
|
+
declare const END_ICON_NAME = "track-end";
|
|
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
|
+
|
|
225
357
|
declare abstract class EventState extends Module {
|
|
226
|
-
|
|
358
|
+
status: EventStatus;
|
|
227
359
|
static ON: EventStatus;
|
|
228
360
|
static OFF: EventStatus;
|
|
229
361
|
protected constructor(map: Map_2);
|
|
230
362
|
abstract onAdd(): void;
|
|
231
363
|
abstract onRemove(): void;
|
|
232
364
|
switch(): EventStatus;
|
|
233
|
-
|
|
234
|
-
|
|
365
|
+
changeStatus(): void;
|
|
366
|
+
message<T>(e: MapMouseEvent, instance: T): EventMessage<T>;
|
|
367
|
+
abstract enabled(): void;
|
|
368
|
+
abstract disabled(): void;
|
|
235
369
|
}
|
|
236
370
|
|
|
237
371
|
declare enum EventStatus {
|
|
@@ -239,6 +373,118 @@ declare enum EventStatus {
|
|
|
239
373
|
OFF = "Off"
|
|
240
374
|
}
|
|
241
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
|
+
|
|
242
488
|
declare class Focus extends default_3 {
|
|
243
489
|
private readonly map;
|
|
244
490
|
focusItems: FocusItem[];
|
|
@@ -282,11 +528,19 @@ declare interface FocusItem {
|
|
|
282
528
|
options?: IFocusOptions;
|
|
283
529
|
}
|
|
284
530
|
|
|
531
|
+
declare const GAP_PX = 5;
|
|
532
|
+
|
|
533
|
+
declare const GAP_PX_2 = 5;
|
|
534
|
+
|
|
285
535
|
declare interface IAisShipOptions extends IBaseShipOptions {
|
|
286
536
|
outLine?: boolean;
|
|
287
537
|
updateStatus?: UPDATE_STATUS;
|
|
288
538
|
}
|
|
289
539
|
|
|
540
|
+
declare interface IArrowLineOptions extends ILineOptions {
|
|
541
|
+
vertexStyle?: IconPointStyle;
|
|
542
|
+
}
|
|
543
|
+
|
|
290
544
|
declare interface IBaseShipOptions {
|
|
291
545
|
id: string | number;
|
|
292
546
|
name: string;
|
|
@@ -303,7 +557,6 @@ declare interface IBaseShipOptions {
|
|
|
303
557
|
status?: string;
|
|
304
558
|
time: Date;
|
|
305
559
|
tooltip?: boolean;
|
|
306
|
-
immediate?: boolean;
|
|
307
560
|
realZoom?: number;
|
|
308
561
|
top?: number;
|
|
309
562
|
left?: number;
|
|
@@ -317,6 +570,8 @@ declare interface IBaseShipOptions {
|
|
|
317
570
|
|
|
318
571
|
declare interface ICMapOptions extends MapOptions {
|
|
319
572
|
type?: MapType;
|
|
573
|
+
TDTToken?: string;
|
|
574
|
+
http2?: boolean;
|
|
320
575
|
}
|
|
321
576
|
|
|
322
577
|
declare interface Icon {
|
|
@@ -325,42 +580,161 @@ declare interface Icon {
|
|
|
325
580
|
options?: Partial<StyleImageMetadata>;
|
|
326
581
|
}
|
|
327
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
|
+
|
|
328
587
|
export declare class IconManager {
|
|
329
588
|
static SUCCESS: RESULT_CODE;
|
|
330
589
|
static FAIL: RESULT_CODE;
|
|
331
590
|
_map: Map_2;
|
|
332
591
|
_cache: Cache_2;
|
|
592
|
+
private loadingPromises;
|
|
333
593
|
constructor(map: Map_2);
|
|
334
594
|
load(icons: Icon[]): Promise<{
|
|
335
595
|
success: result[];
|
|
336
596
|
error: result[];
|
|
337
597
|
}>;
|
|
338
|
-
|
|
598
|
+
loadSvg(icons: SvgIcon[]): Promise<{
|
|
599
|
+
success: result[];
|
|
600
|
+
error: result[];
|
|
601
|
+
}>;
|
|
602
|
+
addSvg(icon: SvgIcon): Promise<result>;
|
|
339
603
|
add(icon: Icon): Promise<result>;
|
|
340
604
|
has(name: Icon['name']): boolean;
|
|
341
605
|
getImage(name: string): Image_2 | undefined;
|
|
342
606
|
update(icon: Icon): Promise<result>;
|
|
343
607
|
delete(name: string): void;
|
|
344
|
-
success(icon: Icon): result;
|
|
345
|
-
error(icon: Icon, err: string | Error): result;
|
|
608
|
+
success(icon: Icon | SvgIcon): result;
|
|
609
|
+
error(icon: Icon | SvgIcon, err: string | Error): result;
|
|
610
|
+
}
|
|
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
|
+
}
|
|
346
641
|
}
|
|
347
642
|
|
|
348
643
|
declare interface IContextOptions {
|
|
349
644
|
map: Map_2;
|
|
350
645
|
}
|
|
351
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
|
+
|
|
352
658
|
declare interface IFocusOptions {
|
|
353
659
|
size?: number;
|
|
354
660
|
padding?: number;
|
|
355
661
|
armLength?: number;
|
|
356
662
|
}
|
|
357
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
|
+
|
|
358
685
|
declare interface Image_2 {
|
|
359
686
|
width: number;
|
|
360
687
|
height: number;
|
|
361
688
|
image: ImageBitmap | HTMLImageElement | ImageData;
|
|
362
689
|
}
|
|
363
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
|
+
|
|
364
738
|
declare interface IShipOptions {
|
|
365
739
|
plugins?: BaseShipConstructor[];
|
|
366
740
|
}
|
|
@@ -368,34 +742,443 @@ declare interface IShipOptions {
|
|
|
368
742
|
declare interface ITooltipOptions {
|
|
369
743
|
id: string | number;
|
|
370
744
|
visible?: boolean;
|
|
745
|
+
line?: boolean;
|
|
371
746
|
className?: string;
|
|
372
747
|
position: LngLat;
|
|
373
|
-
element
|
|
748
|
+
element: HTMLElement;
|
|
374
749
|
offsetX?: number;
|
|
375
750
|
offsetY?: number;
|
|
376
751
|
anchor?: Anchor;
|
|
377
752
|
}
|
|
378
753
|
|
|
754
|
+
declare interface ITrackOptions {
|
|
755
|
+
startLabel: string;
|
|
756
|
+
endLabel: string;
|
|
757
|
+
}
|
|
758
|
+
|
|
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";
|
|
858
|
+
|
|
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
|
+
}
|
|
944
|
+
|
|
379
945
|
declare enum MapType {
|
|
380
946
|
LAND = "land",
|
|
381
947
|
SATELLITE = "satellite"
|
|
382
948
|
}
|
|
383
949
|
|
|
384
|
-
|
|
950
|
+
declare const MAX_ICON_SIZE = 0.5;
|
|
951
|
+
|
|
952
|
+
declare const MIN_ICON_SIZE = 0.2;
|
|
953
|
+
|
|
954
|
+
export declare abstract class Module extends default_3 {
|
|
385
955
|
protected context: Context;
|
|
386
956
|
/**
|
|
387
957
|
* 构造函数,初始化地图上下文和选项配置
|
|
388
958
|
* @param map - 地图实例对象
|
|
389
959
|
*/
|
|
390
960
|
protected constructor(map: Map_2);
|
|
391
|
-
|
|
961
|
+
mount(): void;
|
|
392
962
|
destroy(): void;
|
|
393
963
|
abstract onAdd(): void;
|
|
394
964
|
abstract onRemove(): void;
|
|
395
965
|
}
|
|
396
966
|
|
|
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";
|
|
978
|
+
|
|
979
|
+
declare const NAME_7 = "Track";
|
|
980
|
+
|
|
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>";
|
|
982
|
+
|
|
983
|
+
declare const NORMAL_ICON_NAME = "track-normal";
|
|
984
|
+
|
|
397
985
|
declare type Orientation = 'static' | 'left' | 'right' | 'straight';
|
|
398
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
|
+
|
|
399
1182
|
declare class ResidentEvent extends EventState {
|
|
400
1183
|
private ships;
|
|
401
1184
|
protected hoverId: IAisShipOptions['id'] | null | undefined;
|
|
@@ -404,8 +1187,8 @@ declare class ResidentEvent extends EventState {
|
|
|
404
1187
|
protected _leave: OmitThisParameter<(e: MapMouseEvent) => void>;
|
|
405
1188
|
protected _zoomEnd: () => void;
|
|
406
1189
|
constructor(map: Map_2, ships?: AisShip[]);
|
|
407
|
-
|
|
408
|
-
|
|
1190
|
+
enabled(): void;
|
|
1191
|
+
disabled(): void;
|
|
409
1192
|
onAdd(): void;
|
|
410
1193
|
onRemove(): void;
|
|
411
1194
|
add(ship: AisShip): void;
|
|
@@ -422,29 +1205,65 @@ declare class ResidentEvent extends EventState {
|
|
|
422
1205
|
|
|
423
1206
|
declare class ResourceRegister {
|
|
424
1207
|
private map;
|
|
1208
|
+
private sourceData;
|
|
1209
|
+
/** Feature 索引,key 为 `${sourceId}:${featureId}` */
|
|
1210
|
+
private featureIndex;
|
|
1211
|
+
private dirtySourceIds;
|
|
1212
|
+
private renderFrameId;
|
|
1213
|
+
private layerList;
|
|
1214
|
+
private destroyed;
|
|
1215
|
+
/** 记录由此类创建的 source id */
|
|
1216
|
+
private managedSourceIds;
|
|
1217
|
+
/** 记录由此类创建的 layer id */
|
|
1218
|
+
private managedLayerIds;
|
|
425
1219
|
constructor(map: Map_2);
|
|
1220
|
+
private checkDestroyed;
|
|
426
1221
|
/**
|
|
427
1222
|
* 幂等地添加 Source
|
|
428
|
-
* 如果已存在,则忽略;如果不存在,则创建。
|
|
429
1223
|
*/
|
|
430
1224
|
addSource(id: string, source: SourceSpecification): void;
|
|
431
1225
|
/**
|
|
432
1226
|
* 幂等地添加 Layer
|
|
433
1227
|
*/
|
|
434
|
-
addLayer(
|
|
1228
|
+
addLayer(sortLayer: SortLayer): void;
|
|
435
1229
|
/**
|
|
436
|
-
*
|
|
1230
|
+
* 移除 Layer
|
|
1231
|
+
*/
|
|
1232
|
+
removeLayer(layerId: string): void;
|
|
1233
|
+
/**
|
|
1234
|
+
* 移除 Source(会先移除关联的 Layer)
|
|
1235
|
+
*/
|
|
1236
|
+
removeSource(sourceId: string): void;
|
|
1237
|
+
findFeature(source: string, featureId: string): GeoJSON_2.Feature | undefined;
|
|
1238
|
+
/**
|
|
1239
|
+
* 获取 Source
|
|
437
1240
|
*/
|
|
438
1241
|
getSource(id: string): Source | undefined;
|
|
439
1242
|
/**
|
|
440
|
-
*
|
|
1243
|
+
* 核心逻辑:更新内存数据 -> 标记为脏 -> 调度渲染
|
|
1244
|
+
* 支持增、删、改
|
|
1245
|
+
*/
|
|
1246
|
+
setGeoJSONData(id: string, data: GeoJSON_2.Feature<GeoJSON_2.Geometry | null> | GeoJSON_2.Feature<GeoJSON_2.Geometry | null>[]): void;
|
|
1247
|
+
/**
|
|
1248
|
+
* 调度器:利用 requestAnimationFrame 防抖
|
|
441
1249
|
*/
|
|
442
|
-
|
|
1250
|
+
private scheduleRender;
|
|
1251
|
+
/**
|
|
1252
|
+
* 执行器:真正调用 Mapbox API
|
|
1253
|
+
*/
|
|
1254
|
+
private flushUpdates;
|
|
1255
|
+
setState(source: string, id: string, states: Record<string, unknown>): void;
|
|
1256
|
+
getState(source: string, id: string): Record<string, unknown> | null | undefined;
|
|
1257
|
+
/**
|
|
1258
|
+
* 销毁清理
|
|
1259
|
+
* @param removeFromMap 是否从地图上移除由此类管理的 Source 和 Layer,默认 false
|
|
1260
|
+
*/
|
|
1261
|
+
destroy(removeFromMap?: boolean): void;
|
|
443
1262
|
}
|
|
444
1263
|
|
|
445
1264
|
declare interface result {
|
|
446
1265
|
code: RESULT_CODE;
|
|
447
|
-
data: Icon;
|
|
1266
|
+
data: Icon | SvgIcon;
|
|
448
1267
|
msg: string | Error;
|
|
449
1268
|
}
|
|
450
1269
|
|
|
@@ -467,16 +1286,16 @@ declare enum Scopes {
|
|
|
467
1286
|
* 方向点 拐点 船首 船首右舷 船尾右舷 右船尾 左船尾 船尾左舷 船首左舷
|
|
468
1287
|
*/
|
|
469
1288
|
declare interface Shape {
|
|
470
|
-
leftDirection:
|
|
471
|
-
rightDirection:
|
|
472
|
-
turn:
|
|
473
|
-
head:
|
|
474
|
-
rightBow:
|
|
475
|
-
rightQuarter:
|
|
476
|
-
rightStern:
|
|
477
|
-
leftStern:
|
|
478
|
-
leftQuarter:
|
|
479
|
-
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;
|
|
480
1299
|
}
|
|
481
1300
|
|
|
482
1301
|
export declare class Ship extends Module {
|
|
@@ -485,6 +1304,7 @@ export declare class Ship extends Module {
|
|
|
485
1304
|
event: ResidentEvent;
|
|
486
1305
|
private pluginRegistry;
|
|
487
1306
|
private collision;
|
|
1307
|
+
private focusId;
|
|
488
1308
|
constructor(map: Map_2, options: IShipOptions);
|
|
489
1309
|
onAdd(): void;
|
|
490
1310
|
onRemove(): void;
|
|
@@ -498,10 +1318,76 @@ export declare class Ship extends Module {
|
|
|
498
1318
|
removeAll(): void;
|
|
499
1319
|
render(): void;
|
|
500
1320
|
get(id: string | number): BaseShip<any> | undefined;
|
|
1321
|
+
focus(id: IBaseShipOptions['id']): void;
|
|
1322
|
+
unfocus(id: IBaseShipOptions['id']): void;
|
|
501
1323
|
select(id: IBaseShipOptions['id']): void;
|
|
502
1324
|
unselect(id: IBaseShipOptions['id']): void;
|
|
503
1325
|
}
|
|
504
1326
|
|
|
1327
|
+
declare enum SHIP_COLOR {
|
|
1328
|
+
ONLINE = "#03CC02",
|
|
1329
|
+
DELAY = "#FFFD6C",
|
|
1330
|
+
OFFLINE = "#999999"
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
declare const SHIP_ICON: SvgIcon[];
|
|
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
|
+
|
|
1339
|
+
declare const SHIP_ICON_LAYER: LayerSpecification;
|
|
1340
|
+
|
|
1341
|
+
declare const SHIP_ICON_LAYER_NAME = "mapbox-gl-ship-icon-layer";
|
|
1342
|
+
|
|
1343
|
+
declare const SHIP_REAL_LAYER: LayerSpecification;
|
|
1344
|
+
|
|
1345
|
+
declare const SHIP_REAL_LAYER_NAME = "mapbox-gl-ship-real-layer";
|
|
1346
|
+
|
|
1347
|
+
declare const SHIP_REAL_OUTLINE_LAYER: LayerSpecification;
|
|
1348
|
+
|
|
1349
|
+
declare const SHIP_REAL_OUTLINE_LAYER_NAME = "mapbox-gl-ship-real-outline-layer";
|
|
1350
|
+
|
|
1351
|
+
declare const SHIP_SOURCE_NAME = "mapbox-gl-ship-source";
|
|
1352
|
+
|
|
1353
|
+
export declare namespace ShipVars {
|
|
1354
|
+
export {
|
|
1355
|
+
NAME_6 as NAME,
|
|
1356
|
+
Z_INDEX_4 as Z_INDEX,
|
|
1357
|
+
SHIP_SOURCE_NAME,
|
|
1358
|
+
SHIP_ICON_LAYER_NAME,
|
|
1359
|
+
SHIP_ICON_DIRECTION_LAYER_NAME,
|
|
1360
|
+
SHIP_REAL_LAYER_NAME,
|
|
1361
|
+
SHIP_REAL_OUTLINE_LAYER_NAME,
|
|
1362
|
+
MIN_ICON_SIZE,
|
|
1363
|
+
MAX_ICON_SIZE,
|
|
1364
|
+
UPDATE_STATUS,
|
|
1365
|
+
SHIP_COLOR,
|
|
1366
|
+
SHIP_ICON_DIRECTION_LAYER,
|
|
1367
|
+
SHIP_ICON_LAYER,
|
|
1368
|
+
SHIP_REAL_LAYER,
|
|
1369
|
+
SHIP_REAL_OUTLINE_LAYER,
|
|
1370
|
+
LAYER_LIST_6 as LAYER_LIST,
|
|
1371
|
+
SHIP_ICON
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
declare interface SimpleAnchor {
|
|
1376
|
+
'top-left': BBox;
|
|
1377
|
+
'top-right': BBox;
|
|
1378
|
+
'bottom-left': BBox;
|
|
1379
|
+
'bottom-right': BBox;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
declare interface SortLayer {
|
|
1383
|
+
zIndex: number;
|
|
1384
|
+
layer: LayerSpecification;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
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>";
|
|
1388
|
+
|
|
1389
|
+
declare const START_ICON_NAME = "track-start";
|
|
1390
|
+
|
|
505
1391
|
declare interface StyleImageMetadata {
|
|
506
1392
|
pixelRatio: number;
|
|
507
1393
|
sdf: boolean;
|
|
@@ -516,29 +1402,120 @@ declare interface SvgIcon {
|
|
|
516
1402
|
svg: string;
|
|
517
1403
|
}
|
|
518
1404
|
|
|
1405
|
+
declare const TEXT_Z_INDEX: number;
|
|
1406
|
+
|
|
1407
|
+
declare const TEXT_Z_INDEX_2: number;
|
|
1408
|
+
|
|
519
1409
|
export declare class Tooltip extends Module {
|
|
1410
|
+
static DEBUG: boolean;
|
|
520
1411
|
options: ITooltipOptions;
|
|
521
|
-
private visible;
|
|
522
1412
|
private mark;
|
|
523
|
-
|
|
524
|
-
zoomEndFunc: () => void;
|
|
1413
|
+
private zoom;
|
|
525
1414
|
constructor(map: Map_2, options: ITooltipOptions);
|
|
526
1415
|
get id(): string | number;
|
|
1416
|
+
get visible(): boolean;
|
|
1417
|
+
get bbox(): BBox;
|
|
527
1418
|
onAdd(): void;
|
|
528
1419
|
onRemove(): void;
|
|
1420
|
+
private debug;
|
|
529
1421
|
hide(): void;
|
|
530
1422
|
show(): void;
|
|
1423
|
+
update(options: ITooltipOptions): void;
|
|
531
1424
|
setAnchor(anchor: ITooltipOptions['anchor']): void;
|
|
1425
|
+
getSimpleBbox(): SimpleAnchor;
|
|
532
1426
|
getAllBbox(): AllAnchor;
|
|
533
1427
|
getBbox(val?: ITooltipOptions['anchor']): BBox;
|
|
1428
|
+
private getOffDOMSize;
|
|
534
1429
|
remove(): void;
|
|
535
1430
|
_create(): void;
|
|
536
|
-
_getOffsetByAnchor():
|
|
1431
|
+
_getOffsetByAnchor(): Point_2;
|
|
537
1432
|
setLngLat(lngLat: LngLat): this;
|
|
538
1433
|
connectLine(): void;
|
|
539
1434
|
connectPoint(): LngLat | null;
|
|
540
1435
|
render(): this;
|
|
541
|
-
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
declare enum TooltipType {
|
|
1439
|
+
START_END = 0,// 起终点 (最高)
|
|
1440
|
+
SHARP_TURN = 1,// 急转弯
|
|
1441
|
+
STOP_GO = 2,// 启停变化
|
|
1442
|
+
TIME_ANCHOR = 3,// 时间锚点
|
|
1443
|
+
NORMAL = 9
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
export declare class Track extends Module {
|
|
1447
|
+
options: ITrackOptions;
|
|
1448
|
+
trackData: Map<string, TrackItemWithLabel[]>;
|
|
1449
|
+
private tooltips;
|
|
1450
|
+
private collision;
|
|
1451
|
+
private event;
|
|
1452
|
+
constructor(map: Map_2, options: ITrackOptions);
|
|
1453
|
+
onAdd(): void;
|
|
1454
|
+
onRemove(): void;
|
|
1455
|
+
load(items: TrackItem[]): void;
|
|
1456
|
+
remove(): void;
|
|
1457
|
+
private markItem;
|
|
1458
|
+
private simplifyTrackBySlope;
|
|
1459
|
+
private simplifyTrackByZoom;
|
|
1460
|
+
getFeature(): GeoJSON_2.Feature[];
|
|
1461
|
+
private collisionTooltip;
|
|
1462
|
+
private createCollisions;
|
|
1463
|
+
private createTooltip;
|
|
1464
|
+
private removeAllTooltip;
|
|
1465
|
+
render(): void;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
declare const TRACK_ARROW_LAYER: LayerSpecification;
|
|
1469
|
+
|
|
1470
|
+
declare const TRACK_ARROW_LAYER_NAME = "mapbox-gl-track-arrow-layer";
|
|
1471
|
+
|
|
1472
|
+
declare const TRACK_ICON_LAYER: LayerSpecification;
|
|
1473
|
+
|
|
1474
|
+
declare const TRACK_ICON_LAYER_NAME = "mapbox-gl-track-icon-layer";
|
|
1475
|
+
|
|
1476
|
+
declare const TRACK_LINE_LAYER: LayerSpecification;
|
|
1477
|
+
|
|
1478
|
+
declare const TRACK_LINE_LAYER_NAME = "mapbox-gl-track-line-layer";
|
|
1479
|
+
|
|
1480
|
+
declare const TRACK_SOURCE_NAME = "mapbox-gl-track-source";
|
|
1481
|
+
|
|
1482
|
+
declare interface TrackItem {
|
|
1483
|
+
id: string;
|
|
1484
|
+
pId: string;
|
|
1485
|
+
index: number;
|
|
1486
|
+
position: LngLat;
|
|
1487
|
+
cog?: number;
|
|
1488
|
+
sog?: number;
|
|
1489
|
+
time: Date;
|
|
1490
|
+
props?: Record<string, any>;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
declare interface TrackItemWithLabel extends TrackItem {
|
|
1494
|
+
type: TooltipType;
|
|
1495
|
+
visible: boolean;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
export declare namespace TrackVars {
|
|
1499
|
+
export {
|
|
1500
|
+
NAME_7 as NAME,
|
|
1501
|
+
Z_INDEX_5 as Z_INDEX,
|
|
1502
|
+
TRACK_SOURCE_NAME,
|
|
1503
|
+
TRACK_ARROW_LAYER_NAME,
|
|
1504
|
+
TRACK_ICON_LAYER_NAME,
|
|
1505
|
+
TRACK_LINE_LAYER_NAME,
|
|
1506
|
+
START_ICON_NAME,
|
|
1507
|
+
START_ICON,
|
|
1508
|
+
END_ICON_NAME,
|
|
1509
|
+
END_ICON,
|
|
1510
|
+
ARROW_ICON_NAME,
|
|
1511
|
+
NORMAL_ICON,
|
|
1512
|
+
NORMAL_ICON_NAME,
|
|
1513
|
+
ARROW_ICON,
|
|
1514
|
+
TRACK_ARROW_LAYER,
|
|
1515
|
+
TRACK_ICON_LAYER,
|
|
1516
|
+
TRACK_LINE_LAYER,
|
|
1517
|
+
LAYER_LIST_7 as LAYER_LIST
|
|
1518
|
+
}
|
|
542
1519
|
}
|
|
543
1520
|
|
|
544
1521
|
declare enum UPDATE_STATUS {
|
|
@@ -547,4 +1524,14 @@ declare enum UPDATE_STATUS {
|
|
|
547
1524
|
OFFLINE = "Offline"
|
|
548
1525
|
}
|
|
549
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
|
+
|
|
550
1537
|
export { }
|