gis-common 5.1.16 → 5.1.17

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.
Files changed (46) hide show
  1. package/dist/gis-common.es.js +1634 -1707
  2. package/dist/gis-common.umd.js +1 -1
  3. package/dist/index.d.ts +1639 -4
  4. package/package.json +4 -4
  5. package/dist/constant/CaseType.d.ts +0 -8
  6. package/dist/constant/ErrorType.d.ts +0 -31
  7. package/dist/constant/EventType.d.ts +0 -24
  8. package/dist/constant/FormType.d.ts +0 -6
  9. package/dist/constant/GraphicTypes.d.ts +0 -26
  10. package/dist/constant/LayerType.d.ts +0 -10
  11. package/dist/constant/index.d.ts +0 -6
  12. package/dist/core/AudioPlayer.d.ts +0 -20
  13. package/dist/core/CanvasDrawer.d.ts +0 -37
  14. package/dist/core/Color.d.ts +0 -65
  15. package/dist/core/Cookie.d.ts +0 -5
  16. package/dist/core/DateTime.d.ts +0 -43
  17. package/dist/core/EventDispatcher.d.ts +0 -13
  18. package/dist/core/FullScreen.d.ts +0 -16
  19. package/dist/core/HashMap.d.ts +0 -20
  20. package/dist/core/MqttClient.d.ts +0 -32
  21. package/dist/core/Storage.d.ts +0 -51
  22. package/dist/core/WebGL.d.ts +0 -31
  23. package/dist/core/WebSocketClient.d.ts +0 -15
  24. package/dist/core/index.d.ts +0 -12
  25. package/dist/types.d.ts +0 -101
  26. package/dist/utils/AjaxUtil.d.ts +0 -109
  27. package/dist/utils/ArrayUtil.d.ts +0 -45
  28. package/dist/utils/AssertUtil.d.ts +0 -15
  29. package/dist/utils/BrowserUtil.d.ts +0 -85
  30. package/dist/utils/CommUtil.d.ts +0 -105
  31. package/dist/utils/CoordsUtil.d.ts +0 -43
  32. package/dist/utils/DomUtil.d.ts +0 -90
  33. package/dist/utils/ExceptionUtil.d.ts +0 -15
  34. package/dist/utils/FileUtil.d.ts +0 -33
  35. package/dist/utils/GeoJsonUtil.d.ts +0 -76
  36. package/dist/utils/GeoUtil.d.ts +0 -151
  37. package/dist/utils/ImageUtil.d.ts +0 -43
  38. package/dist/utils/MathUtil.d.ts +0 -37
  39. package/dist/utils/MessageUtil.d.ts +0 -34
  40. package/dist/utils/ObjectUtil.d.ts +0 -30
  41. package/dist/utils/OptimizeUtil.d.ts +0 -43
  42. package/dist/utils/StringUtil.d.ts +0 -34
  43. package/dist/utils/TreeUtil.d.ts +0 -25
  44. package/dist/utils/UrlUtil.d.ts +0 -18
  45. package/dist/utils/ValidateUtil.d.ts +0 -26
  46. package/dist/utils/index.d.ts +0 -20
package/dist/index.d.ts CHANGED
@@ -1,4 +1,1639 @@
1
- export * from './constant';
2
- export * from './core';
3
- export * from './utils';
4
- export * from './types';
1
+ declare type AjaxGetOption = {
2
+ headers?: any;
3
+ responseType?: any;
4
+ credentials?: any;
5
+ jsonp?: any;
6
+ };
7
+
8
+ declare type AjaxPostOption = {
9
+ url?: any;
10
+ headers?: any;
11
+ postData?: any;
12
+ cb?: Callback;
13
+ };
14
+
15
+ export declare const AjaxUtil: {
16
+ /**
17
+ * Get JSON data by jsonp
18
+ * @param url - resource url
19
+ * @param callback - callback function when completed
20
+ */
21
+ jsonp<T>(url: string, callback: (err: null | Error, data: T) => void): void;
22
+ /**
23
+ * Fetch remote resource by HTTP "GET" method
24
+ * @param {String} url - resource url
25
+ * @param {Object} [options=null] - request options
26
+ * @param {Object} [options.headers=null] - HTTP headers
27
+ * @param {String} [options.responseType=null] - responseType
28
+ * @param {String} [options.credentials=null] - if with credentials, set it to "include"
29
+ * @param {Function} cb - callback function when completed
30
+ * @return {Ajax} Ajax
31
+ * @example
32
+ * AjaxUtil.get(
33
+ * 'url/to/resource',
34
+ * (data, err) => {
35
+ * if (err) {
36
+ * throw new Error(err);
37
+ * }
38
+ * // do things with data
39
+ * }
40
+ * );
41
+ */
42
+ get(url: string, options: AjaxGetOption, cb?: any): XMLHttpRequest;
43
+ /**
44
+ * Fetch remote resource by HTTP "POST" method
45
+ * @param {String} url - resource url
46
+ * @param {Object} options - request options
47
+ * @param {String|Object} options.postData - post data
48
+ * @param {Object} [options.headers=null] - HTTP headers
49
+ * @param {Function} cb - callback function when completed
50
+ * @return {Ajax} Ajax
51
+ * @example
52
+ * AjaxUtil.post(
53
+ * 'url/to/post',
54
+ * {
55
+ * postData : {
56
+ * 'param0' : 'val0',
57
+ * 'param1' : 1
58
+ * }
59
+ * },
60
+ * (data, err) => {
61
+ * if (err) {
62
+ * throw new Error(err);
63
+ * }
64
+ * // do things with data
65
+ * }
66
+ * );
67
+ */
68
+ post(url: string, options?: AjaxPostOption, cb?: Callback): XMLHttpRequest;
69
+ _wrapCallback(client: XMLHttpRequest, cb: Callback): () => void;
70
+ _getClient(cb: Callback): XMLHttpRequest;
71
+ /**
72
+ * Fetch resource as arraybuffer.
73
+ * @param {String} url - url
74
+ * @param {Object} [options=null] - options, same as AjaxUtil.get
75
+ * @param {Function} cb - callback function when completed.
76
+ * @example
77
+ * AjaxUtil.getArrayBuffer(
78
+ * 'url/to/resource.bin',
79
+ * (data, err) => {
80
+ * if (err) {
81
+ * throw new Error(err);
82
+ * }
83
+ * // data is a binary array
84
+ * }
85
+ * );
86
+ */
87
+ getArrayBuffer(url: string, options: AjaxGetOption, cb: Callback | AjaxGetOption): XMLHttpRequest;
88
+ getImage(img: any, url: string, options: any): XMLHttpRequest;
89
+ /**
90
+ * Fetch resource as a JSON Object.
91
+ * @param {String} url - json's url
92
+ * @param {Object} [options=null] - optional options
93
+ * @param {String} [options.jsonp=false] - fetch by jsonp, false by default
94
+ * @param {Function} cb - callback function when completed.
95
+ * @example
96
+ * AjaxUtil.getJSON(
97
+ * 'url/to/resource.json',
98
+ * { jsonp : true },
99
+ * (json, err) => {
100
+ * if (err) {
101
+ * throw new Error(err);
102
+ * }
103
+ * // json is a JSON Object
104
+ * console.log(json.foo);
105
+ * }
106
+ * );
107
+ */
108
+ getJSON(url: string, options: AjaxGetOption, cb?: Callback): any;
109
+ };
110
+
111
+ export declare const ArrayUtil: {
112
+ /**
113
+ * 创建指定长度的数组,并返回其索引数组
114
+ *
115
+ * @param length 数组长度
116
+ * @returns 索引数组
117
+ */
118
+ create(length: number): number[];
119
+ /**
120
+ * 合并多个数组,并去重
121
+ *
122
+ * @param args 需要合并的数组
123
+ * @returns 合并后的去重数组
124
+ */
125
+ union<T>(...args: T[][]): T[];
126
+ /**
127
+ * 求多个数组的交集
128
+ *
129
+ * @param args 多个需要求交集的数组
130
+ * @returns 返回多个数组的交集数组
131
+ */
132
+ intersection<T>(...args: T[][]): T[];
133
+ /**
134
+ * 将多个数组拼接为一个数组,并去除其中的空值。
135
+ *
136
+ * @param args 需要拼接的数组列表。
137
+ * @returns 拼接并去空后的数组。
138
+ */
139
+ unionAll(...args: any[]): any[];
140
+ /**
141
+ * 求差集
142
+ *
143
+ * @param args 任意个集合
144
+ * @returns 返回差集结果
145
+ */
146
+ difference(...args: any[]): unknown[];
147
+ /**
148
+ * 对字符串数组进行中文排序
149
+ *
150
+ * @param arr 待排序的字符串数组
151
+ * @returns 排序后的字符串数组
152
+ */
153
+ zhSort(arr: any[], f?: (d: any) => string, reverse?: boolean): any[];
154
+ };
155
+
156
+ /**
157
+ * @description 声音播放类
158
+ * @export
159
+ * @class AudioPlayer
160
+ */
161
+ export declare class AudioPlayer {
162
+ /**
163
+ * Creates an instance of AudioPlayer.
164
+ * @param {*} url
165
+ */
166
+ private audio;
167
+ constructor(url: string);
168
+ play(): void;
169
+ pause(): void;
170
+ get muted(): boolean;
171
+ /**
172
+ * @description 设置静音状态,如果静音,autoplay属性将失效
173
+ */
174
+ set muted(val: boolean);
175
+ }
176
+
177
+ declare interface BrowserType {
178
+ type: string;
179
+ version: string;
180
+ }
181
+
182
+ export declare class BrowserUtil {
183
+ static readonly document: Document;
184
+ static readonly navigator: Navigator;
185
+ static readonly userAgent: string;
186
+ static readonly screen: Screen;
187
+ /**
188
+ * 获取系统类型
189
+ *
190
+ * @returns 返回一个包含系统类型和版本的对象
191
+ */
192
+ static getSystem(): BrowserType;
193
+ /**
194
+ * 获取浏览器类型信息
195
+ *
196
+ * @returns 浏览器类型信息,包含浏览器类型和版本号
197
+ */
198
+ static getExplorer(): BrowserType;
199
+ /**
200
+ * 判断当前浏览器是否支持WebGL
201
+ *
202
+ * @returns 如果支持WebGL则返回true,否则返回false
203
+ */
204
+ static isSupportWebGL(): boolean | null;
205
+ /**
206
+ * 获取GPU信息
207
+ *
208
+ * @returns 返回包含GPU类型和型号的对象
209
+ */
210
+ static getGPU(): {
211
+ type: string;
212
+ model: string;
213
+ spec: {
214
+ maxTextureSize: number;
215
+ maxRenderBufferSize: number;
216
+ maxTextureUnits: number;
217
+ };
218
+ } | {
219
+ type: string;
220
+ model: string;
221
+ spec?: undefined;
222
+ };
223
+ /**
224
+ * 获取当前浏览器设置的语言
225
+ *
226
+ * @returns 返回浏览器设置的语言,格式为 "语言_地区",例如 "zh_CN"。如果获取失败,则返回 "Unknown"。
227
+ */
228
+ static getLanguage(): string;
229
+ /**
230
+ * 获取当前环境的时区。
231
+ *
232
+ * @returns 返回当前环境的时区,若获取失败则返回 undefined。
233
+ */
234
+ static getTimeZone(): string;
235
+ /**
236
+ * 获取屏幕帧率
237
+ *
238
+ * @returns 返回一个Promise,resolve为计算得到的屏幕帧率
239
+ * eg: const fps = await BrowserUtil.getScreenFPS()
240
+ */
241
+ static getScreenFPS(): Promise<unknown>;
242
+ /**
243
+ * 获取IP地址
244
+ *
245
+ * @returns 返回一个Promise,当成功获取到IP地址时resolve,返回IP地址字符串;当获取失败时reject,返回undefined
246
+ */
247
+ static getIPAddress(): Promise<unknown>;
248
+ /**
249
+ * 获取网络状态信息
250
+ *
251
+ * @returns 返回包含网络状态信息的对象,包含以下属性:
252
+ * - network: 网络类型,可能的值为 'wifi'、'4g' 等
253
+ * - isOnline: 是否在线,为 true 或 false
254
+ * - ip: 当前设备的 IP 地址
255
+ */
256
+ static getNetwork(): Promise<{
257
+ network: string;
258
+ isOnline: boolean;
259
+ ip: unknown;
260
+ }>;
261
+ }
262
+
263
+ declare type Callback = (...params: any[]) => any;
264
+
265
+ export declare class CanvasDrawer {
266
+ private ctx;
267
+ constructor(el: HTMLElement | string);
268
+ /**
269
+ * 绘制线条
270
+ *
271
+ * @param start 起始坐标点
272
+ * @param end 终止坐标点
273
+ * @param options 绘制选项,包括线条宽度和颜色
274
+ * @throws 当画布上下文不存在时抛出错误
275
+ */
276
+ drawLine({ x: startX, y: startY }: Coordinate, { x: endX, y: endY }: Coordinate, options?: {
277
+ width?: number;
278
+ color?: string;
279
+ }): void;
280
+ /**
281
+ * 绘制圆弧
282
+ *
283
+ * @param x 圆心x坐标
284
+ * @param y 圆心y坐标
285
+ * @param radius 半径
286
+ * @param startAngle 起始角度(度)
287
+ * @param endAngle 结束角度(度)
288
+ * @param anticlockwise 是否逆时针绘制
289
+ * @param isFill 是否填充
290
+ * @param bgColor 背景颜色
291
+ * @throws 当Canvas context为null或undefined时抛出错误
292
+ */
293
+ drawArc({ x, y }: Coordinate, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean, isFill: boolean, bgColor: string): void;
294
+ drawImage({ x, y }: Coordinate, src: string): void;
295
+ drawText({ x, y }: Coordinate, text: string, options: {
296
+ font: string;
297
+ color: string;
298
+ }): void;
299
+ static createCanvas(width?: number, height?: number): HTMLCanvasElement;
300
+ }
301
+
302
+ export declare interface CanvasStyle {
303
+ color: string;
304
+ fillColor: string;
305
+ lineWidth: number;
306
+ }
307
+
308
+ declare type CanvasStylePartial = Partial<CanvasStyle>;
309
+
310
+ export declare enum CaseType {
311
+ REVERSE_CASE = 0,
312
+ UPPER_CAMEL_CASE = 1,
313
+ LOWER_CAMEL_CASE = 2,
314
+ UPPER_CASE = 3,
315
+ LOWER_CASE = 4
316
+ }
317
+
318
+ /**
319
+ * 基本的颜色类,支持RGB颜色
320
+ */
321
+ export declare class Color {
322
+ _r: number;
323
+ _g: number;
324
+ _b: number;
325
+ _alpha: number;
326
+ constructor(r: number, g: number, b: number, a?: number);
327
+ private _validateColorChannel;
328
+ toArray(): number[];
329
+ toString(): string;
330
+ toJson(): ColorRGBA;
331
+ get rgba(): string;
332
+ get hex(): string;
333
+ setAlpha(a: number): Color;
334
+ setRgb(r: number, g: number, b: number): Color;
335
+ /**
336
+ * 从RGBA字符串创建Color对象
337
+ *
338
+ * @param rgbaValue RGBA颜色值字符串,格式为"rgba(r,g,b,a)"或"rgb(r,g,b)"
339
+ * @returns 返回Color对象
340
+ * @throws 如果rgbaValue不是有效的RGBA颜色值,则抛出错误
341
+ */
342
+ static fromRgba(rgbaValue: string): Color;
343
+ /**
344
+ * 将十六进制颜色值转换为颜色对象
345
+ *
346
+ * @param hexValue 十六进制颜色值,可带或不带#前缀,支持3位和6位表示
347
+ * @returns 返回颜色对象
348
+ */
349
+ static fromHex(hexValue: string, a?: number): Color;
350
+ /**
351
+ * 从 HSL 字符串创建颜色对象
352
+ *
353
+ * @param hsl HSL 字符串,格式为 hsl(h, s%, l%) 或 hsla(h, s%, l%, a)
354
+ * @returns 返回颜色对象,如果 hsl 字符串无效则返回 null
355
+ */
356
+ static fromHsl(hslValue: string): Color;
357
+ static fromName(str: string): Color;
358
+ /**
359
+ * 从字符串中创建颜色对象
360
+ *
361
+ * @param str 字符串类型的颜色值,支持rgba、hex、hsl格式
362
+ * @returns 返回创建的颜色对象
363
+ * @throws 当颜色值无效时,抛出错误
364
+ */
365
+ static from(str: string): Color;
366
+ /**
367
+ * 将RGB颜色值转换为十六进制颜色值
368
+ *
369
+ * @param r 红色分量值,取值范围0-255
370
+ * @param g 绿色分量值,取值范围0-255
371
+ * @param b 蓝色分量值,取值范围0-255
372
+ * @param a 可选参数,透明度分量值,取值范围0-1
373
+ * @returns 十六进制颜色值,格式为#RRGGBB或#RRGGBBAA
374
+ */
375
+ static rgb2hex(r: number, g: number, b: number, a?: number): string;
376
+ static isHex(a: string): boolean;
377
+ static isRgb(a: string): boolean;
378
+ static isHsl(a: string): boolean;
379
+ static isColor(a: string): boolean;
380
+ static random(): Color;
381
+ }
382
+
383
+ export declare interface ColorRGBA {
384
+ r: number;
385
+ g: number;
386
+ b: number;
387
+ a?: number;
388
+ }
389
+
390
+ export declare class Cookie {
391
+ static set(name: string, value: string, days?: number): void;
392
+ static remove(name: string): void;
393
+ static get(name: string): string;
394
+ }
395
+
396
+ export declare interface Coordinate {
397
+ x: number;
398
+ y: number;
399
+ z?: number;
400
+ }
401
+
402
+ export declare type CoordinateArray = [number, number] | [number, number, number];
403
+
404
+ export declare class {
405
+ private static readonly PI;
406
+ private static readonly XPI;
407
+ private static delta;
408
+ /**
409
+ * 判断经纬度是否不在中国境内
410
+ *
411
+ * @param lng 经度
412
+ * @param lat 纬度
413
+ * @returns 如果经纬度不在中国境内则返回true,否则返回false
414
+ */
415
+ static outOfChina(lng: number, lat: number): boolean;
416
+ static gcjEncrypt(wgsLat: number, wgsLon: number): LngLat;
417
+ static gcjDecrypt(gcjLat: number, gcjLon: number): LngLat;
418
+ static gcjDecryptExact(gcjLat: number, gcjLon: number): LngLat;
419
+ static bdEncrypt(gcjLat: number, gcjLon: number): LngLat;
420
+ static bdDecrypt(bdLat: number, bdLon: number): {
421
+ lat: number;
422
+ lng: number;
423
+ };
424
+ static mercatorEncrypt(wgsLat: number, wgsLon: number): LngLat;
425
+ static mercatorDecrypt(mercatorLat: number, mercatorLon: number): LngLat;
426
+ private static transformLat;
427
+ private static transformLon;
428
+ /**
429
+ * 生成一个介于两个坐标之间的随机坐标
430
+ *
431
+ * @param start 起始坐标,包含x和y属性
432
+ * @param end 结束坐标,包含x和y属性
433
+ * @returns 返回一个包含x和y属性的随机坐标
434
+ */
435
+ static random({ x: minX, y: minY }: Coordinate, { x: maxX, y: maxY }: Coordinate): Coordinate;
436
+ /**
437
+ * 对坐标数组进行解构并应用函数处理
438
+ *
439
+ * @param arr 待解构的数组
440
+ * @param fn 处理函数
441
+ * @param context 函数执行上下文,可选
442
+ * @returns 处理后的数组
443
+ */
444
+ static deCompose(arr: any[], fn: (arr: number[]) => number[], context?: any): any[];
445
+ static coordinate2LngLat(coordinate: Coordinate): LngLat;
446
+ static lngLat2Coordinate(lngLat: LngLat): Coordinate;
447
+ }
448
+
449
+ export declare class DateTime extends Date {
450
+ constructor(...val: any);
451
+ format(fmt?: string): string;
452
+ addDate(interval: string, number: number): Date;
453
+ static lastMonth(): DateTime;
454
+ static thisMonth(): DateTime;
455
+ static nextMonth(): DateTime;
456
+ static lastWeek(): DateTime;
457
+ static thisWeek(): DateTime;
458
+ static nextWeek(): DateTime;
459
+ static lastDay(): DateTime;
460
+ static thisDay(): DateTime;
461
+ static nextDay(): DateTime;
462
+ /**
463
+ * 解析日期字符串,并返回对应的Date对象。
464
+ *
465
+ * @param str 日期字符串,格式为"yyyy-MM-dd"、"yyyy-MM-dd HH:mm:ss"或"yyyy-MM-dd HH:mm:ss.SSS"。
466
+ * @returns 返回解析后的Date对象,如果解析失败则返回null。
467
+ */
468
+ static parseDate(str: string): Date | null;
469
+ /**
470
+ * 格式化时间间隔
471
+ *
472
+ * @param startTime 开始时间,可以是字符串、数字或日期类型
473
+ * @param endTime 结束时间,可以是字符串、数字或日期类型
474
+ * @returns 返回格式化后的时间间隔字符串,格式为"天数 天 小时 时 分钟 分 秒 秒"或"少于1秒"
475
+ */
476
+ static formatDateInterval(startTime: string | number | Date, endTime: string | number | Date): string;
477
+ /**
478
+ * 将给定的时间(秒)格式化为时:分:秒格式的字符串
479
+ *
480
+ * @param times 时间(秒)
481
+ * @returns 返回格式化后的字符串
482
+ */
483
+ static formatterCounter(times: number): string;
484
+ /**
485
+ * 静态方法:使当前线程暂停执行指定的毫秒数
486
+ *
487
+ * @param d 需要暂停的毫秒数
488
+ * @returns 无返回值
489
+ */
490
+ static sleep(d: number): void;
491
+ }
492
+
493
+ export declare interface DispatcherEvent {
494
+ type: string;
495
+ message: Record<string, any>;
496
+ target?: any;
497
+ }
498
+
499
+ export declare const DomUtil: {
500
+ /**
501
+ * 获取元素的样式值
502
+ *
503
+ * @param el 元素对象
504
+ * @param style 样式属性名称
505
+ * @returns 元素的样式值,如果获取不到则返回 null
506
+ */
507
+ getStyle(el: HTMLElement, style: keyof CSSStyleDeclaration): any;
508
+ /**
509
+ * 创建一个HTML元素
510
+ *
511
+ * @param tagName 元素标签名
512
+ * @param className 元素类名
513
+ * @param container 父容器,若传入,则新创建的元素会被添加到该容器中
514
+ * @returns 返回新创建的HTML元素
515
+ */
516
+ create(tagName: any, className: string, container?: HTMLElement): any;
517
+ /**
518
+ * 从父节点中移除指定元素。
519
+ *
520
+ * @param el 要移除的元素对象,必须包含parentNode属性。
521
+ */
522
+ remove(el: HTMLElement): void;
523
+ /**
524
+ * 清空给定元素的子节点
525
+ *
526
+ * @param el 要清空子节点的元素,包含firstChild和removeChild属性
527
+ */
528
+ empty(el: HTMLElement): void;
529
+ /**
530
+ * 将元素移到父节点的最前面
531
+ *
532
+ * @param el 要移动的元素,需要包含 parentNode 属性
533
+ */
534
+ toFront(el: HTMLElement): void;
535
+ /**
536
+ * 将元素移动到其父节点的最前面
537
+ *
538
+ * @param el 要移动的元素,需要包含parentNode属性
539
+ */
540
+ toBack(el: HTMLElement): void;
541
+ /**
542
+ * 获取元素的类名
543
+ *
544
+ * @param el 包含对应元素和类名的对象
545
+ * @param el.correspondingElement 对应的元素
546
+ * @param el.className 类名对象
547
+ * @param el.className.baseVal 类名字符串
548
+ * @returns 返回元素的类名字符串
549
+ */
550
+ getClass(el: HTMLElement): string;
551
+ /**
552
+ * 判断元素是否包含指定类名
553
+ *
554
+ * @param el 元素对象,包含classList属性,classList属性包含contains方法
555
+ * @param name 要判断的类名
556
+ * @returns 返回一个布尔值,表示元素是否包含指定类名
557
+ */
558
+ hasClass(el: HTMLElement, name: string): boolean;
559
+ /**
560
+ * 给指定的 HTML 元素添加类名
561
+ *
562
+ * @param el 要添加类名的 HTML 元素
563
+ * @param name 要添加的类名,多个类名之间用空格分隔
564
+ */
565
+ addClass(el: HTMLElement, name: string): void;
566
+ /**
567
+ * 从元素中移除指定类名
568
+ *
569
+ * @param el 要移除类名的元素
570
+ * @param name 要移除的类名,多个类名用空格分隔
571
+ */
572
+ removeClass(el: HTMLElement, name: string): void;
573
+ /**
574
+ * 设置元素的 CSS 类名
575
+ *
576
+ * @param el HTML 或 SVG 元素
577
+ * @param name 要设置的类名,多个类名之间用空格分隔
578
+ */
579
+ setClass(el: HTMLElement | SVGElement, name: string): void;
580
+ /**
581
+ * 从字符串中解析XML文档,并返回根节点
582
+ *
583
+ * @param str 要解析的XML字符串
584
+ * @returns 解析后的XML文档的根节点
585
+ */
586
+ parseFromString(str: string): Element;
587
+ };
588
+
589
+ export declare enum ErrorType {
590
+ LOGIN_EXPIRED = "\u767B\u5F55\u4FE1\u606F\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55",
591
+ INTERNAL_ERROR = "\u5185\u90E8\u9519\u8BEF",
592
+ NETWORK_ERROR = "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u662F\u5426\u5DF2\u8FDE\u63A5",
593
+ PROCESS_FAIL = "\u4EFB\u52A1\u5904\u7406\u5931\u8D25",
594
+ PROCESS_TIMEOUT = "\u4EFB\u52A1\u5904\u7406\u8D85\u65F6",
595
+ AUTH_VERIFY_ERROR = "\u6743\u9650\u9A8C\u8BC1\u5931\u8D25",
596
+ INSTANCE_DUPLICATE = "\u5B9E\u4F8B\u4E3A\u5355\u4F8B\u6A21\u5F0F\uFF0C\u4E0D\u5141\u8BB8\u91CD\u590D\u6784\u5EFA",
597
+ STRING_CHECK_LOSS = "\u5B57\u7B26\u4E32\u7F3A\u5C11\u5173\u952E\u5B57",
598
+ PARAMETER_ERROR = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25",
599
+ PARAMETER_ERROR_ARRAY = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u6570\u7EC4",
600
+ PARAMETER_ERROR_STRING = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u5B57\u7B26",
601
+ PARAMETER_ERROR_FUNCTION = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u51FD\u6570",
602
+ PARAMETER_ERROR_OBJECT = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u5BF9\u8C61",
603
+ PARAMETER_ERROR_INTEGER = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u6574\u578B",
604
+ PARAMETER_ERROR_NUMBER = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u6570\u503C",
605
+ PARAMETER_ERROR_LACK = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u975E\u7A7A",
606
+ PARAMETER_ERROR_ENUM = "\u9A8C\u8BC1\u53C2\u6570\u7C7B\u578B\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u6307\u5B9A\u7684\u503C",
607
+ DATA_ERROR = "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25",
608
+ DATA_ERROR_COORDINATE = "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u5750\u6807",
609
+ DATA_ERROR_COLOR = "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF0C\u5FC5\u987B\u662F\u989C\u8272\u4EE3\u7801",
610
+ DATA_ERROR_JSON = "JSON\u89E3\u6790\u5931\u8D25\uFF0C\u683C\u5F0F\u6709\u8BEF",
611
+ DATA_ERROR_GEOJSON = "\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF0C\u5FC5\u987B\u662FGeoJSON",
612
+ REQUEST_ERROR = "\u8BF7\u6C42\u8D44\u6E90\u5931\u8D25",
613
+ REQUEST_ERROR_CROSS = "\u4E0D\u5141\u8BB8\u8DE8\u7AD9\u70B9\u8BBF\u95EE\u8D44\u6E90",
614
+ REQUEST_ERROR_TIMEOUT = "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC",
615
+ REQUEST_ERROR_NOT_FOUND = "\u8BF7\u6C42\u8D44\u6E90\u4E0D\u5B58\u5728",
616
+ REQUEST_ERROR_FORBIDDEN = "\u8BF7\u6C42\u8D44\u6E90\u7981\u6B62\u8BBF\u95EE",
617
+ REQUEST_ERROR_EMPTY = "\u8BF7\u6C42\u6570\u636E\u8BB0\u5F55\u4E3A\u7A7A"
618
+ }
619
+
620
+ export declare class EventDispatcher {
621
+ private _listeners;
622
+ private _mutex;
623
+ private _context;
624
+ addEventListener(type: string, listener: EventDispatcherHandler, context?: any, mutexStatus?: boolean): EventDispatcher;
625
+ hasEventListener(type: string, listener: EventDispatcherHandler): boolean;
626
+ removeEventListener(type: string, listener: EventDispatcherHandler): void;
627
+ dispatchEvent(event: DispatcherEvent): void;
628
+ removeAllListener(): void;
629
+ on(type: string, listener: EventDispatcherHandler, context?: any, mutexStatus?: boolean): EventDispatcher;
630
+ off(type: string, listener: EventDispatcherHandler): void;
631
+ }
632
+
633
+ export declare type EventDispatcherHandler = (event: DispatcherEvent) => void;
634
+
635
+ declare type EventName = 'change' | 'error';
636
+
637
+ export declare enum EventType {
638
+ MAP_RENDER = "mapRender",
639
+ MAP_READY = "mapReady",
640
+ MOUSE_CLICK = "click",
641
+ MOUSE_DOUBLE_CLICK = "dblclick",
642
+ MOUSE_MOVE = "mousemove",
643
+ MOUSE_IN = "mousein",
644
+ MOUSE_OUT = "mouseout",
645
+ MOUSE_RIGHT_CLICK = "mouseRightClick",
646
+ KEY_DOWN = "keyDown",
647
+ KEY_UP = "keyUp",
648
+ DRAW_ACTIVE = "drawActive",
649
+ DRAW_MOVE = "drawMove",
650
+ DRAW_COMPLETE = "drawComplete",
651
+ MQTT_CONNECT = "mqttConnect",
652
+ MQTT_ERROR = "mqttError",
653
+ MQTT_MESSAGE = "mqttMessage",
654
+ MQTT_CLOSE = "mqttClose",
655
+ WEB_SOCKET_CONNECT = "webSocketConnect",
656
+ WEB_SOCKET_ERROR = "webSocketError",
657
+ WEB_SOCKET_MESSAGE = "webSocketMessage",
658
+ WEB_SOCKET_CLOSE = "webSocketClose"
659
+ }
660
+
661
+ export declare const ExceptionUtil: {
662
+ getException(type: string, message: string): any;
663
+ throwException(msg: string): never;
664
+ throwColorException(msg: string): never;
665
+ throwCoordinateException(msg: string): never;
666
+ throwGeoJsonException(msg: string): never;
667
+ throwEmptyException(msg: string): never;
668
+ throwIntegerException(msg: string): never;
669
+ throwNumberException(msg: string): never;
670
+ throwArrayException(msg: string): never;
671
+ throwFunctionException(msg: string): never;
672
+ throwProcessException(msg: string): never;
673
+ throwNetworkException(msg: string): never;
674
+ };
675
+
676
+ export declare const FileUtil: {
677
+ /**
678
+ * 将Base64编码的字符串转换为Blob对象
679
+ *
680
+ * @param data Base64编码的字符串
681
+ * @returns 转换后的Blob对象
682
+ */
683
+ convertBase64ToBlob(data: string): Blob;
684
+ /**
685
+ * 将base64字符串转换为文件对象
686
+ *
687
+ * @param dataurl 包含base64字符串的数据URL
688
+ * @param filename 文件的名称
689
+ * @returns 返回文件对象
690
+ */
691
+ convertBase64ToFile(dataurl: string, filename: string): File;
692
+ /**
693
+ * 从文件下载数据
694
+ *
695
+ * @param data 要下载的数据,可以是字符串数组、BlobPart 或 MediaSource
696
+ * @param saveName 下载后文件的保存名称
697
+ */
698
+ downloadFromFile(data: string[] | BlobPart | MediaSource, saveName: string): void;
699
+ readFile(file: File | Blob, resolver?: "arrayBuffer" | "text"): Promise<unknown>;
700
+ /**
701
+ * 获取远程文件并读取
702
+ * @param url 远程文件地址
703
+ * @param fileName 文件名
704
+ * @returns Promise<ArrayBuffer>
705
+ */
706
+ readFileFromUrl(url: string, fileName: string, resolver?: "arrayBuffer" | "text"): Promise<unknown>;
707
+ };
708
+
709
+ export declare enum FormType {
710
+ ADD = 0,// 新增
711
+ MODIFY = 1,// 修改
712
+ DETAIL = 2
713
+ }
714
+
715
+ export declare let FullScreen: FullScreenAPI;
716
+
717
+ declare interface FullScreenAPI {
718
+ request(element: HTMLElement | undefined, options?: FullscreenOptions): Promise<void>;
719
+ exit(): Promise<void>;
720
+ toggle(element: HTMLElement, options?: FullscreenOptions): Promise<void>;
721
+ onchange(callback: (event: Event) => void): void;
722
+ onerror(callback: (event: Event) => void): void;
723
+ on(event: EventName, callback: (event: Event) => void): void;
724
+ off(event: EventName, callback: (event: Event) => void): void;
725
+ readonly isFullscreen: boolean;
726
+ readonly element: HTMLElement | undefined;
727
+ readonly isEnabled: boolean;
728
+ raw: any;
729
+ }
730
+
731
+ export declare interface GeoJSONCollection {
732
+ type: 'FeatureCollection';
733
+ features: GeoJSONFeature[];
734
+ bbox?: number[];
735
+ }
736
+
737
+ export declare interface GeoJSONFeature {
738
+ type: 'Feature';
739
+ geometry: GeoJSONPoint | GeoJSONMultiPoint | GeoJSONLineString | GeoJSONMultiLineString | GeoJSONPolygon | GeoJSONMultiPolygon;
740
+ properties?: Record<string, any>;
741
+ }
742
+
743
+ export declare interface GeoJSONLineString {
744
+ type: 'LineString';
745
+ coordinates: Array<CoordinateArray>;
746
+ }
747
+
748
+ export declare interface GeoJSONLineStringFeature {
749
+ type: 'Feature';
750
+ geometry: GeoJSONLineString;
751
+ properties?: Record<string, any>;
752
+ }
753
+
754
+ export declare interface GeoJSONMultiLineString {
755
+ type: 'MultiLineString';
756
+ coordinates: Array<Array<CoordinateArray>>;
757
+ }
758
+
759
+ export declare interface GeoJSONMultiPoint {
760
+ type: 'MultiPoint';
761
+ coordinates: Array<CoordinateArray>;
762
+ }
763
+
764
+ export declare interface GeoJSONMultiPolygon {
765
+ type: 'MultiPolygon';
766
+ coordinates: Array<Array<Array<CoordinateArray>>>;
767
+ }
768
+
769
+ export declare interface GeoJSONMultiPolygonFeature {
770
+ type: 'Feature';
771
+ geometry: GeoJSONMultiPolygon;
772
+ properties?: Record<string, any>;
773
+ }
774
+
775
+ export declare interface GeoJSONMultiStringLineFeature {
776
+ type: 'Feature';
777
+ geometry: GeoJSONMultiLineString;
778
+ properties?: Record<string, any>;
779
+ }
780
+
781
+ export declare interface GeoJSONPoint {
782
+ type: 'Point';
783
+ coordinates: CoordinateArray;
784
+ }
785
+
786
+ export declare interface GeoJSONPolygon {
787
+ type: 'Polygon';
788
+ coordinates: Array<Array<CoordinateArray>>;
789
+ }
790
+
791
+ export declare interface GeoJSONPolygonFeature {
792
+ type: 'Feature';
793
+ geometry: GeoJSONPolygon;
794
+ properties?: Record<string, any>;
795
+ }
796
+
797
+ export declare const GeoJsonUtil: {
798
+ /**
799
+ * 获取GeoJSON要素的几何类型
800
+ *
801
+ * @param feature GeoJSONFeature 类型的要素
802
+ * @returns 返回要素的几何类型,如果要素没有几何属性则返回 null
803
+ */
804
+ getGeoJsonType(feature: GeoJSONFeature): GeometryType | null;
805
+ /**
806
+ * 判断给定的GeoJSON要素是否为有效的GeoJSON格式
807
+ *
808
+ * @param feature 要判断的GeoJSON要素
809
+ * @returns 如果为有效的GeoJSON格式则返回true,否则返回false
810
+ */
811
+ isGeoJson(feature: GeoJSONFeature): boolean;
812
+ /**
813
+ * 判断是否为 GeoJSON 多边形
814
+ *
815
+ * @param feature GeoJSONFeature 对象
816
+ * @returns 返回布尔值,表示是否为 GeoJSON 多边形
817
+ */
818
+ isGeoJsonPolygon(feature: GeoJSONFeature): boolean;
819
+ /**
820
+ * 判断给定的 GeoJSONFeature 是否为 GeoJSON 线
821
+ *
822
+ * @param feature GeoJSONFeature 对象
823
+ * @returns 是 GeoJSON 线返回 true,否则返回 false
824
+ */
825
+ isGeoJsonLine(feature: GeoJSONFeature): boolean;
826
+ /**
827
+ * 判断是否为 GeoJSON 点类型
828
+ *
829
+ * @param feature GeoJSONFeature 对象
830
+ * @returns 是点类型返回 true,否则返回 false
831
+ */
832
+ isGeoJsonPoint(feature: GeoJSONFeature): boolean;
833
+ /**
834
+ * 判断传入的 GeoJSONFeature 是否为 Multi 类型的 GeoJSON。
835
+ *
836
+ * @param feature GeoJSONFeature 类型的参数,待判断是否为 Multi 类型的 GeoJSON。
837
+ * @returns 返回一个布尔值,如果传入的 GeoJSONFeature 是 Multi 类型的 GeoJSON,则返回 true,否则返回 false。
838
+ */
839
+ isGeoJsonMulti(feature: GeoJSONFeature): boolean;
840
+ /**
841
+ * 获取GeoJSON要素的坐标数组
842
+ *
843
+ * @param feature GeoJSONFeature对象
844
+ * @returns 返回一个包含坐标数组的数组,可以是二维、三维或四维数组
845
+ */
846
+ getGeoJsonCoordinates(feature: GeoJSONFeature): CoordinateArray | Array<CoordinateArray> | Array<Array<CoordinateArray>> | Array<Array<Array<CoordinateArray>>>;
847
+ /**
848
+ * 获取GeoJSON要素的中心点坐标
849
+ *
850
+ * @param feature GeoJSON要素
851
+ * @param out 输出坐标对象,默认为null
852
+ * @returns 返回中心点坐标,如果无法获取则返回null
853
+ */
854
+ getGeoJsonCenter(feature: GeoJSONFeature, out?: Coordinate): Coordinate | null;
855
+ /**
856
+ * 将一个包含多个点、线或面的 GeoJSON 特征对象拆分成多个独立的 GeoJSON 特征对象数组。
857
+ *
858
+ * @param feature 包含多个点、线或面的 GeoJSON 特征对象
859
+ * @returns 返回一个 GeoJSON 特征对象数组,如果拆分失败则返回 null
860
+ */
861
+ spliteGeoJsonMulti(feature: GeoJSONFeature): GeoJSONFeature[] | null;
862
+ /**
863
+ * 根据坐标数组生成GeoJSON要素
864
+ *
865
+ * @param coordinates 坐标数组
866
+ * @returns GeoJSONFeature 生成的GeoJSON要素
867
+ * @throws Error 如果coordinates参数格式错误
868
+ */
869
+ getGeoJsonByCoordinates(coordinates: CoordinateArray | Array<CoordinateArray> | Array<Array<CoordinateArray>> | Array<Array<Array<CoordinateArray>>>, properties?: Record<string, any>): GeoJSONFeature;
870
+ };
871
+
872
+ export declare type GeometryType = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon';
873
+
874
+ export declare class {
875
+ static readonly toRadian: number;
876
+ static readonly R = 6371393;
877
+ static readonly R_EQU = 6378137;
878
+ /**
879
+ * 判断给定的经纬度是否合法
880
+ *
881
+ * @param lng 经度值
882
+ * @param lat 纬度值
883
+ * @returns 如果经纬度合法,返回true;否则返回false
884
+ */
885
+ static isLnglat(lng: number | string, lat: number | string): boolean;
886
+ /**
887
+ * 计算两哥平面坐标点间的距离
888
+ *
889
+ * @param p1 坐标点1,包含x和y属性
890
+ * @param p2 坐标点2,包含x和y属性
891
+ * @returns 返回两点间的欧几里得距离
892
+ */
893
+ static distance(p1: Coordinate, p2: Coordinate): number;
894
+ /**
895
+ * 计算两个点之间的距离
896
+ *
897
+ * @param A 点A,包含x和y两个属性
898
+ * @param B 点B,包含x和y两个属性
899
+ * @returns 返回两点之间的距离,单位为米
900
+ */
901
+ static distanceByPoints(A: Coordinate, B: Coordinate): number;
902
+ /**
903
+ * 格式化经纬度为度分秒格式
904
+ *
905
+ * @param lng 经度
906
+ * @param lat 纬度
907
+ * @returns 返回格式化后的经纬度字符串,格式为:经度度分秒,纬度度分秒
908
+ */
909
+ static formatLnglat(lng: any, lat: any): string;
910
+ /**
911
+ * 将经纬度字符串转换为度
912
+ *
913
+ * @param lng 经度字符串
914
+ * @param lat 纬度字符串
915
+ * @returns 转换后的经纬度对象
916
+ */
917
+ static transformLnglat(lng: any, lat: any): any;
918
+ /**
919
+ * 射线法判断点是否在多边形内
920
+ *
921
+ * @param p 点对象,包含x和y属性
922
+ * @param poly 多边形顶点数组,可以是字符串数组或对象数组
923
+ * @returns 返回字符串,表示点相对于多边形的位置:'in'表示在多边形内,'out'表示在多边形外,'on'表示在多边形上
924
+ */
925
+ static rayCasting(p: Coordinate, poly: string | any[]): "on" | "in" | "out";
926
+ /**
927
+ * 旋转点
928
+ *
929
+ * @param p1 旋转前点坐标
930
+ * @param p2 旋转中心坐标
931
+ * @param θ 旋转角度(顺时针旋转为正)
932
+ * @returns 旋转后点坐标
933
+ */
934
+ static rotatePoint(p1: Coordinate, p2: Coordinate, θ: number): {
935
+ x: number;
936
+ y: number;
937
+ };
938
+ /**
939
+ * 根据两个平面坐标点计算方位角和距离
940
+ *
941
+ * @param p1 第一个点的坐标对象
942
+ * @param p2 第二个点的坐标对象
943
+ * @returns 返回一个对象,包含angle和distance属性,分别表示两点之间的角度(以度为单位,取值范围为0~359)和距离
944
+ * 正北为0°,顺时针增加
945
+ */
946
+ static calcBearAndDis(p1: Coordinate, p2: Coordinate): {
947
+ angle: number;
948
+ distance: number;
949
+ };
950
+ /**
951
+ * 根据两个经纬度点计算方位角和距离
952
+ *
953
+ * @param latlng1 第一个经纬度点
954
+ * @param latlng2 第二个经纬度点
955
+ * @returns 包含方位角和距离的对象
956
+ */
957
+ static calcBearAndDisByPoints(latlng1: LngLat, latlng2: LngLat): {
958
+ angle: number;
959
+ distance: number;
960
+ };
961
+ /**
962
+ * 计算点P到线段P1P2的最短距离
963
+ *
964
+ * @param p 点P的坐标
965
+ * @param p1 线段起点P1的坐标
966
+ * @param p2 线段终点P2的坐标
967
+ * @returns 点P到线段P1P2的最短距离
968
+ */
969
+ static distanceToSegment(p: Coordinate, p1: Coordinate, p2: Coordinate): number;
970
+ /**
971
+ * 根据给定的经纬度、角度和距离计算新的经纬度点
972
+ *
973
+ * @param latlng 给定的经纬度点,类型为LngLat
974
+ * @param angle 角度值,单位为度,表示从当前点出发的方向
975
+ * @param distance 距离值,单位为米,表示从当前点出发的距离
976
+ * @returns 返回计算后的新经纬度点,类型为{lat: number, lng: number}
977
+ */
978
+ static calcPointByBearAndDis(latlng: LngLat, angle: number, distance: number): LngLat;
979
+ /**
980
+ * 将墨卡托坐标转换为经纬度坐标
981
+ *
982
+ * @param x 墨卡托坐标的x值
983
+ * @param y 墨卡托坐标的y值
984
+ * @returns 返回包含转换后的经度lng和纬度lat的对象
985
+ */
986
+ static mercatorTolonlat(x: number, y: number): LngLat;
987
+ /**
988
+ * 将经纬度坐标转换为墨卡托坐标
989
+ *
990
+ * @param lng 经度值
991
+ * @param lat 纬度值
992
+ * @returns 墨卡托坐标对象,包含x和y属性
993
+ */
994
+ static lonlatToMercator(lng: number, lat: number): Coordinate;
995
+ /**
996
+ * 计算三角形面积
997
+ *
998
+ * @param a 第一个点的坐标
999
+ * @param b 第二个点的坐标
1000
+ * @param c 第三个点的坐标
1001
+ * @returns 返回三角形的面积
1002
+ */
1003
+ static getTraingleArea(a: Coordinate, b: Coordinate, c: Coordinate): number;
1004
+ /**
1005
+ * 计算多边形的质心坐标
1006
+ *
1007
+ * @param coords 多边形顶点坐标数组,支持Coordinate[]或LngLat[]两种格式
1008
+ * @returns 返回质心坐标,包含x和y属性
1009
+ */
1010
+ static getPolygonCentroid(coords: Coordinate[] | LngLat[]): Coordinate;
1011
+ /**
1012
+ * 根据百分比获取坐标
1013
+ *
1014
+ * @param pA 线段起点,可以是Coordinate类型(包含x,y属性)或LngLat类型(包含lng,lat属性)
1015
+ * @param pB 线段终点,可以是Coordinate类型(包含x,y属性)或LngLat类型(包含lng,lat属性)
1016
+ * @param ratio 插值比例,0表示在起点pA,1表示在终点pB,0-1之间表示两点间的插值点
1017
+ * @returns 返回插值点坐标,类型与输入参数保持一致
1018
+ */
1019
+ static interpolate(pA: Coordinate | LngLat, pB: Coordinate | LngLat, ratio: number): {
1020
+ x: number;
1021
+ y: number;
1022
+ } | undefined;
1023
+ }
1024
+
1025
+ export declare enum GraphicType {
1026
+ POINT = "Point",
1027
+ POLYLINE = "Polyline",
1028
+ POLYGON = "Polygon",
1029
+ RECTANGLE = "Rectangle",
1030
+ BILLBOARD = "Billboard",
1031
+ CYLINDER = "Cylinder",
1032
+ ELLIPSOID = "Ellipsoid",
1033
+ LABEL = "Label",
1034
+ MODEL = "Model",
1035
+ WALL = "Wall",
1036
+ CIRCLE = "Circle"
1037
+ }
1038
+
1039
+ export declare class HashMap<K, V> extends Map<K, V> {
1040
+ isEmpty(): boolean;
1041
+ _values(): V[];
1042
+ _keys(): K[];
1043
+ _entries(): [K, V][];
1044
+ /**
1045
+ * 从键值对数组创建一个HashMap对象
1046
+ *
1047
+ * @param array 键值对数组,默认为空数组
1048
+ * @returns 返回一个新的HashMap对象
1049
+ */
1050
+ static fromEntries<K extends string | number | symbol, V>(array?: Array<[K, V]>): HashMap<K, V>;
1051
+ /**
1052
+ * 从JSON字符串创建HashMap实例
1053
+ *
1054
+ * @param str JSON字符串
1055
+ * @returns HashMap实例
1056
+ */
1057
+ static fromJson<K extends string | number | symbol, V>(str: string): HashMap<K, V>;
1058
+ }
1059
+
1060
+ export declare const ImageUtil: {
1061
+ emptyImageUrl: string;
1062
+ transparentImageUrl: string;
1063
+ createCircle(radius: number, options?: CanvasStylePartial): string;
1064
+ createRectangle(width: number, height: number, options?: CanvasStylePartial): string;
1065
+ /**
1066
+ *
1067
+ * @param image image,类型可以是HTMLCanvasElement、ImageData、Image
1068
+ * @returns
1069
+ */
1070
+ getBase64(image: any): string;
1071
+ /**
1072
+ * 将图片的URL转换为Base64编码
1073
+ *
1074
+ * @param url 图片的URL地址
1075
+ * @param width 图片的宽度,默认为图片原始宽度
1076
+ * @param height 图片的高度,默认为图片原始高度
1077
+ * @returns 返回Promise对象,解析后得到包含Base64编码数据的对象
1078
+ */
1079
+ getBase64FromUrl(url: string): Promise<string>;
1080
+ /**
1081
+ * 解析base64编码
1082
+ *
1083
+ * @param base64 base64编码字符串
1084
+ * @returns 返回一个对象,包含type(类型)、ext(扩展名)和data(数据)字段,如果解析失败则返回null
1085
+ */
1086
+ parseBase64(base64: string): {
1087
+ type: string;
1088
+ ext: string;
1089
+ data: string;
1090
+ } | undefined;
1091
+ /**
1092
+ * 复制图片到剪贴板
1093
+ *
1094
+ * @param url 图片的URL地址
1095
+ * @returns 无返回值
1096
+ * @throws 如果解析base64数据失败,则抛出异常
1097
+ */
1098
+ copyImage(url: string): Promise<void>;
1099
+ };
1100
+
1101
+ export declare enum LayerType {
1102
+ SUPER_MAP_IMAGES = 0,
1103
+ SUPER_MAP_DATA = 1,
1104
+ ARC_GIS_MAP_IMAGES = 2,
1105
+ ARC_GIS_MAP_DATA = 3,
1106
+ OSGB_LAYER = 4,
1107
+ S3M_GROUP = 5,
1108
+ TERRAIN_LAYER = 6
1109
+ }
1110
+
1111
+ export declare enum LineSymbol {
1112
+ SOLID = 0,
1113
+ DASH = "10,5",
1114
+ DOT = "3",
1115
+ DASHDOT = "10,3,3,3",
1116
+ DASHDOTDOT = "10,3,3,3,3,3"
1117
+ }
1118
+
1119
+ export declare interface LngLat {
1120
+ lng: number;
1121
+ lat: number;
1122
+ alt?: number;
1123
+ }
1124
+
1125
+ export declare const MathUtil: {
1126
+ DEG2RAD: number;
1127
+ RAD2DEG: number;
1128
+ randInt(low: number, high: number): number;
1129
+ randFloat(low: number, high: number): number;
1130
+ /**
1131
+ * 角度转弧度
1132
+ *
1133
+ * @param {*} degrees
1134
+ * @returns {*}
1135
+ */
1136
+ deg2Rad(degrees: number): number;
1137
+ /**
1138
+ * 弧度转角度
1139
+ *
1140
+ * @param {*} radians
1141
+ * @returns {*}
1142
+ */
1143
+ rad2Deg(radians: number): number;
1144
+ round(value: number | string, n?: number): number;
1145
+ /**
1146
+ * 将数值限制在指定范围内
1147
+ *
1148
+ * @param val 需要限制的数值
1149
+ * @param min 最小值
1150
+ * @param max 最大值
1151
+ * @returns 返回限制后的数值
1152
+ */
1153
+ clamp(val: number, min: number, max: number): number;
1154
+ formatLength(length: number, options?: {
1155
+ decimal: number;
1156
+ }): string;
1157
+ formatArea(area: number, options?: {
1158
+ decimal: number;
1159
+ }): string;
1160
+ };
1161
+
1162
+ export declare enum MeasureMode {
1163
+ DISTANCE = 0,
1164
+ AREA = 1,
1165
+ HEIGHT = 2,
1166
+ ANGLE = 3
1167
+ }
1168
+
1169
+ declare type MessageType = 'warning' | 'info' | 'success' | 'error';
1170
+
1171
+ export declare class MessageUtil {
1172
+ static LANG: string;
1173
+ private static warned;
1174
+ private static speechSynthesis;
1175
+ private static speechSynthesisUtterance;
1176
+ static resetWarned(): void;
1177
+ private static _call;
1178
+ /**
1179
+ * 播放消息提示音和文字朗读(语音需要有交互)
1180
+ *
1181
+ * @param type 消息类型
1182
+ * @param message 消息内容
1183
+ * @param options 配置选项,可选参数,包括语言、音量、语速和音高
1184
+ * @returns 无返回值
1185
+ */
1186
+ static msg(type: MessageType, message: string, options?: VoiceOptions): void;
1187
+ static stop(e: string): void;
1188
+ static warning(message: string, options?: VoiceOptions): void;
1189
+ static warningOnce(message: string, options?: VoiceOptions): void;
1190
+ static info(message: string, options?: VoiceOptions): void;
1191
+ static infoOnce(message: string, options?: VoiceOptions): void;
1192
+ static error(message: string, options?: VoiceOptions): void;
1193
+ static errorOnce(message: string, options?: VoiceOptions): void;
1194
+ static success(message: string, options?: VoiceOptions): void;
1195
+ static successOnce(message: string, options?: VoiceOptions): void;
1196
+ }
1197
+
1198
+ export declare class MqttClient extends EventDispatcher {
1199
+ /**
1200
+ * Creates an instance of MqttClient.
1201
+ * @param {*} config mqtt实例参数
1202
+ */
1203
+ private static defaultContext;
1204
+ state: State;
1205
+ url: string;
1206
+ context: MqttClientContext;
1207
+ options: any;
1208
+ client: any;
1209
+ topics: string[];
1210
+ private _timer;
1211
+ constructor(url?: string, config?: Partial<MqttClientContext>);
1212
+ _onConnect(): void;
1213
+ _onError(): void;
1214
+ _onMessage(): void;
1215
+ sendMsg(topic: string, msg: string): this | undefined;
1216
+ subscribe(topic: any | string[]): this;
1217
+ unsubscribe(topic: string | string[]): this;
1218
+ unsubscribeAll(): this;
1219
+ unconnect(): void;
1220
+ }
1221
+
1222
+ export declare interface MqttClientContext {
1223
+ MQTT_USERNAME: string;
1224
+ MQTT_PASSWORD: string;
1225
+ MQTT_TIMEOUTM: number;
1226
+ MQTT_MAX_RETRY: number;
1227
+ REJECT_UNAUTHORIZED: boolean;
1228
+ }
1229
+
1230
+ export declare const ObjectUtil: {
1231
+ /**
1232
+ * 浅合并对象,并返回合并后的对象。
1233
+ *
1234
+ * @param dest 目标对象,用于接收复制的属性。
1235
+ * @param args 一个或多个源对象,用于提供要复制的属性。
1236
+ * @returns 返回目标对象,包含所有复制的属性。
1237
+ */
1238
+ assign<T extends Record<string, any>>(dest: Record<string, any>, ...args: any[]): Record<string, any>;
1239
+ /**
1240
+ * 深度合并对象,并返回合并后的对象
1241
+ *
1242
+ * @param target 目标对象
1243
+ * @param sources 待合并的对象列表
1244
+ * @returns 合并后的对象
1245
+ */
1246
+ deepAssign<T extends Record<string, any>>(target: Record<string, any>, ...sources: any[]): any;
1247
+ clone<T>(obj: T): T;
1248
+ /**
1249
+ * 深拷贝一个对象到另一个对象
1250
+ *
1251
+ * @param destObj 目标对象,深拷贝后的对象将存储在该对象中
1252
+ * @param srcObj 源对象,深拷贝的来源对象
1253
+ * @returns 深拷贝后的目标对象
1254
+ */
1255
+ deepClone<T extends Record<string, any>>(destObj: Record<string, any>, srcObj: T): Record<string, any>;
1256
+ isEqual<T>(a: T, b: T): boolean;
1257
+ parse(str: any): any;
1258
+ };
1259
+
1260
+ export declare const OptimizeUtil: {
1261
+ /**
1262
+ * 防抖函数,在指定的等待时间内,如果连续触发事件,则只在最后一次触发后执行函数。适用于像搜索输入框这种需要用户停止输入后才调用的场景
1263
+ *
1264
+ * @param func 需要防抖的函数。
1265
+ * @param wait 等待时间,单位毫秒。
1266
+ * @param immediate 是否立即执行函数,默认为true。
1267
+ * @returns 返回防抖后的函数。
1268
+ */
1269
+ debounce(func: Function, wait: number, immediate?: boolean): (...args: any) => any;
1270
+ /**
1271
+ * 节流函数,适用于像滚动事件、窗口resize事件这种需要限制调用频率的场景
1272
+ *
1273
+ * @param func 需要节流的函数
1274
+ * @param wait 节流间隔,单位为毫秒
1275
+ * @param type 节流类型,1表示时间戳方式,2表示定时器方式
1276
+ * @returns 返回一个新的函数,该函数在节流控制下执行传入的函数
1277
+ */
1278
+ throttle(func: Function, wait: number, type?: number): (...args: any[]) => void;
1279
+ /**
1280
+ * 缓存函数,将传入的函数fn的计算结果缓存,提高重复计算的效率
1281
+ *
1282
+ * @param fn 传入待缓存的函数
1283
+ * @returns 返回缓存后的函数
1284
+ */
1285
+ memoize<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
1286
+ /**
1287
+ * 递归调用函数,以一定的频率和持续时间执行。
1288
+ *
1289
+ * @param fun 要递归调用的函数。
1290
+ * @param frequency 每次调用函数之间的时间间隔,单位为毫秒,默认为500毫秒。
1291
+ * @param duration 函数递归调用的总时长,单位为毫秒,默认为5000毫秒。
1292
+ */
1293
+ recurve(fun: Function, frequency?: number, duration?: number): void;
1294
+ /**
1295
+ * 确保函数只被调用一次
1296
+ *
1297
+ * @param func 要被调用的函数
1298
+ * @returns 返回一个新的函数,该函数在被首次调用时会执行传入的函数,之后再次调用将不再执行
1299
+ */
1300
+ once(func: Function): (...args: any[]) => any;
1301
+ };
1302
+
1303
+ declare enum State {
1304
+ ERROR = 0,
1305
+ READY = 1,
1306
+ CONNECT = 2,
1307
+ TIMEOUT = 3
1308
+ }
1309
+
1310
+ declare class Storage_2 {
1311
+ static prefix: string;
1312
+ private static _getPrefixedKey;
1313
+ /**
1314
+ * 将键值对存储到localStorage中
1315
+ *
1316
+ * @param key 键名
1317
+ * @param value 值,默认为null
1318
+ * @param options 存储选项,可选参数
1319
+ * @param options.expires 过期时间,单位为毫秒,默认为null
1320
+ */
1321
+ static setLocal(key: string, value?: any, options?: {
1322
+ expires?: number;
1323
+ }): void;
1324
+ /**
1325
+ * 将键值对存储到sessionStorage中
1326
+ *
1327
+ * @param key 键名
1328
+ * @param value 值,默认为null
1329
+ * @param options 存储选项,可选参数
1330
+ * @param options.expires 过期时间,单位为毫秒,默认为null
1331
+ */
1332
+ static setSession(key: string, value?: any, options?: {
1333
+ expires?: number;
1334
+ }): void;
1335
+ /**
1336
+ * 从Storage中获取指定key的存储值
1337
+ *
1338
+ * @param key 存储键名
1339
+ * @param missing 当获取不到指定key的存储值时返回的默认值
1340
+ * @param options 其他配置选项
1341
+ * @returns 返回指定key的存储值,若获取不到则返回missing参数指定的默认值
1342
+ */
1343
+ static getLocal(key: string, missing?: any, options?: any): any;
1344
+ /**
1345
+ * 从Storage中获取指定key的存储值
1346
+ *
1347
+ * @param key 存储键名
1348
+ * @param missing 当获取不到指定key的存储值时返回的默认值
1349
+ * @param options 其他配置选项
1350
+ * @returns 返回指定key的存储值,若获取不到则返回missing参数指定的默认值
1351
+ */
1352
+ static getSession(key: string, missing?: any, options?: any): any;
1353
+ static localkeys(): string[];
1354
+ static sessionkeys(): string[];
1355
+ static getAllLocal(includeKeys: string[] | undefined): any[];
1356
+ static getAllSession(includeKeys: string[] | undefined): any[];
1357
+ static remove(key: string, options?: any): void;
1358
+ static clearLocal(options?: any): void;
1359
+ static clearSession(options?: any): void;
1360
+ }
1361
+ export { Storage_2 as Storage }
1362
+
1363
+ export declare const StringUtil: {
1364
+ /**
1365
+ * 转换字符串大小写
1366
+ *
1367
+ * @param str 待转换的字符串
1368
+ * @param type 转换类型,可选值为 0-4,默认为 4
1369
+ * 0:字母大小写反转
1370
+ * 1:首字母大写,其余小写
1371
+ * 2:首字母小写,其余大写
1372
+ * 3:全部大写
1373
+ * 4:全部小写
1374
+ * @returns 转换后的字符串
1375
+ */
1376
+ changeCase(str: string, type: number): string;
1377
+ /**
1378
+ * 计算字符串的字节长度
1379
+ *
1380
+ * @param str 需要计算字节长度的字符串
1381
+ * @returns 返回字符串的字节长度
1382
+ */
1383
+ getByteLength(str: string): number;
1384
+ /**
1385
+ * 截取字符串中指定字节长度的子串
1386
+ *
1387
+ * @param str 字符串对象,包含replace、length和substring方法
1388
+ * @param start 截取起始位置
1389
+ * @param n 截取字节长度
1390
+ * @returns 返回截取后的子串
1391
+ */
1392
+ subStringByte(str: string, start: number, n: number): string;
1393
+ string2Bytes(str: string): Uint8Array<ArrayBuffer>;
1394
+ bytes2String(uint8arr: Uint8Array): string;
1395
+ };
1396
+
1397
+ export declare interface SuperArray<T = any> extends Array<T> {
1398
+ desc(f?: (d: T) => any): SuperArray<T>;
1399
+ asc(f?: (d: T) => any): SuperArray<T>;
1400
+ groupBy(f: (d: T) => any): SuperArray<T>;
1401
+ distinct(f?: (d: T) => any): SuperArray<T>;
1402
+ max(f?: (d: T) => any): T;
1403
+ min(f?: (d: T) => any): T;
1404
+ sum(f?: (d: T) => any): number;
1405
+ avg(f?: (d: T) => any): number;
1406
+ random(): SuperArray<T>;
1407
+ remove(f: (d: T) => any): SuperArray<T>;
1408
+ }
1409
+
1410
+ declare interface TreeNode {
1411
+ id: string;
1412
+ name: string;
1413
+ pid?: string;
1414
+ children?: TreeNode[];
1415
+ }
1416
+
1417
+ export declare const TreeUtil: {
1418
+ /**
1419
+ * 将扁平化数组转换为树形结构数组
1420
+ *
1421
+ * @param data 扁平化数组
1422
+ * @param idPropertyName 数据中标识id的字段名,默认为'id'
1423
+ * @param parentIdPropertyName 数据中标识父节点id的字段名,默认为'parentId'
1424
+ * @returns 转换后的树形结构数组
1425
+ */
1426
+ buildTree(data: TreeNode[], idPropertyName?: string, parentIdPropertyName?: string): TreeNode[];
1427
+ /**
1428
+ * 将树形结构的数据展平成一维数组
1429
+ *
1430
+ * @param data 树形结构的节点数组
1431
+ * @returns 展平后的一维节点数组
1432
+ */
1433
+ flatTree(data: TreeNode[]): TreeNode[];
1434
+ };
1435
+
1436
+ export declare const UrlUtil: {
1437
+ /**
1438
+ * 将json对象转换为查询字符串
1439
+ *
1440
+ * @param json 待转换的json对象
1441
+ * @returns 转换后的查询字符串
1442
+ */
1443
+ json2Query(json: Record<string, string>): string;
1444
+ /**
1445
+ * 从 URL 中解析出查询参数和哈希参数,并以对象的形式返回
1446
+ *
1447
+ * @param href 需要解析的 URL 链接,默认为当前窗口的 URL
1448
+ * @param needDecode 是否需要解码参数值,默认为 true
1449
+ * @returns 返回一个包含解析后参数的对象,其中键为参数名,值为参数值
1450
+ */
1451
+ query2Json(href?: string, needDecode?: boolean): Record<string, string>;
1452
+ };
1453
+
1454
+ export declare const Util: {
1455
+ /**
1456
+ * 获取数据类型
1457
+ *
1458
+ * @param data 待判断的数据
1459
+ * @returns 返回数据类型字符串
1460
+ */
1461
+ getDataType(data: any): string;
1462
+ asArray(obj: any): any[];
1463
+ asNumber(a: any): number;
1464
+ /**
1465
+ * 将值转换为字符串
1466
+ *
1467
+ * @param value 要转换的值
1468
+ * @returns 转换后的字符串,如果值为空,则返回空字符串
1469
+ */
1470
+ asString(value: any): string;
1471
+ /**
1472
+ * 判断传入的值是否为空
1473
+ *
1474
+ * @param value 待判断的值
1475
+ * @returns 返回布尔值,表示是否为空
1476
+ */
1477
+ isEmpty(value: any): boolean;
1478
+ /**
1479
+ * 将JSON对象转换为FormData对象
1480
+ *
1481
+ * @param json 待转换的JSON对象,其属性值为字符串或Blob类型
1482
+ * @returns 转换后的FormData对象
1483
+ */
1484
+ json2form(json: Record<string, any>): FormData;
1485
+ /**
1486
+ * 生成GUID
1487
+ *
1488
+ * @returns 返回一个由8个16进制数组成的GUID字符串
1489
+ */
1490
+ guid(): string;
1491
+ /**
1492
+ * 将参数进行解码并返回解码后的字符串
1493
+ *
1494
+ * @param args 参数
1495
+ * @returns 解码后的字符串
1496
+ */
1497
+ decodeDict(...args: any[]): any;
1498
+ /**
1499
+ * 异步加载script
1500
+ *
1501
+ * @param {*} url
1502
+ */
1503
+ asyncLoadScript(url: string): Promise<HTMLScriptElement>;
1504
+ /**
1505
+ * 加载样式文件
1506
+ *
1507
+ * @param urls 样式文件URL数组
1508
+ * @returns 无返回值
1509
+ */
1510
+ loadStyle(urls: string[]): void;
1511
+ /**
1512
+ * 将模板字符串中的占位符替换为给定对象中的值
1513
+ *
1514
+ * @param str 模板字符串
1515
+ * @param data 包含替换值的对象
1516
+ * @returns 替换后的字符串
1517
+ * @throws 当对象中没有找到与占位符对应的值时,抛出错误
1518
+ */
1519
+ template<T>(str: string, data: Record<string, T>): string;
1520
+ /**
1521
+ * 删除对象中所有值为空的属性
1522
+ *
1523
+ * @param data 待处理的对象
1524
+ * @returns 返回处理后的对象
1525
+ */
1526
+ deleteEmptyProperty(data: Record<string | number, any>): {
1527
+ [k: string]: any;
1528
+ };
1529
+ /**
1530
+ * 复制文本到剪贴板
1531
+ *
1532
+ * @param text 要复制的文本
1533
+ * @returns 返回一个Promise,表示复制操作的结果
1534
+ */
1535
+ handleCopyValue(text: string): Promise<void>;
1536
+ isArray(a: any): a is any[];
1537
+ isObject(a: any): boolean;
1538
+ isNil(a: any): boolean;
1539
+ isNumber(a: any): boolean;
1540
+ isInteger(a: any): boolean;
1541
+ isFunction(obj: Object): boolean;
1542
+ /**
1543
+ * 判断传入参数是否为DOM元素
1544
+ *
1545
+ * @param a 待判断的参数
1546
+ * @returns 返回布尔值,表示是否为DOM元素
1547
+ */
1548
+ isElement(a: any): boolean;
1549
+ /**
1550
+ * 检查版本
1551
+ *
1552
+ * @param currentV 当前版本号
1553
+ * @param targetV 要求版本号
1554
+ * @returns 返回布尔值,表示当前版本是否需要升级到目标版本
1555
+ */
1556
+ checheVersion(currentV: string, targetV: string): boolean;
1557
+ };
1558
+
1559
+ export declare const ValidateUtil: {
1560
+ isUrl(v: string): boolean;
1561
+ /**
1562
+ *
1563
+ * @param path 路径字符串
1564
+ * @returns 是否为外链
1565
+ */
1566
+ isExternal(path: string): boolean;
1567
+ isPhone(v: string): boolean;
1568
+ isTel(v: string): boolean;
1569
+ /**
1570
+ * 判断是否是强密码,至少包含一个大写字母、一个小写字母、一个数字的组合、长度8-20位
1571
+ *
1572
+ * @param v 待检测的密码字符串
1573
+ * @returns 如果是是强密码,则返回 true;否则返回 false
1574
+ */
1575
+ isStrongPwd(v: string): boolean;
1576
+ isEmail(v: string): boolean;
1577
+ isIP(v: string): boolean;
1578
+ isEnglish(v: string): boolean;
1579
+ isChinese(v: string): boolean;
1580
+ isHTML(v: string): boolean;
1581
+ isXML(v: string): boolean;
1582
+ isIDCard(v: string): boolean;
1583
+ };
1584
+
1585
+ declare interface VoiceOptions {
1586
+ lang?: string;
1587
+ volume?: number;
1588
+ rate?: number;
1589
+ pitch?: number;
1590
+ }
1591
+
1592
+ export declare class WebGL {
1593
+ ctx: WebGLRenderingContext;
1594
+ constructor(el: HTMLElement | string);
1595
+ /**
1596
+ * 初始化着色器
1597
+ *
1598
+ * @param gl WebGL渲染上下文
1599
+ * @param vshader 顶点着色器源代码
1600
+ * @param fshader 片段着色器源代码
1601
+ * @returns 如果着色器初始化成功返回true,否则返回false
1602
+ */
1603
+ initShaders(gl: WebGLRenderingContext, vshader: string, fshader: string): boolean;
1604
+ /**
1605
+ * 创建并返回一个 WebGL 程序对象。
1606
+ *
1607
+ * @param gl WebGLRenderingContext 对象,表示 WebGL 渲染上下文。
1608
+ * @param vshader 顶点着色器代码,以字符串形式传入。
1609
+ * @param fshader 片段着色器代码,以字符串形式传入。
1610
+ * @returns 返回创建的 WebGL 程序对象,如果创建失败则返回 null。
1611
+ */
1612
+ createProgram(gl: WebGLRenderingContext, vshader: string, fshader: string): WebGLProgram | null;
1613
+ /**
1614
+ * 加载着色器
1615
+ *
1616
+ * @param gl WebGL渲染上下文对象
1617
+ * @param type 着色器类型(顶点着色器或片段着色器)
1618
+ * @param source 着色器源代码
1619
+ * @returns 加载的着色器对象,如果加载失败则返回null
1620
+ */
1621
+ loadShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader | null;
1622
+ }
1623
+
1624
+ export declare class WebSocketClient extends EventDispatcher {
1625
+ private maxCheckTimes;
1626
+ private url;
1627
+ private checkTimes;
1628
+ connectStatus: boolean;
1629
+ private client;
1630
+ constructor(url?: string);
1631
+ connect(): void;
1632
+ disconnect(): void;
1633
+ connCheckStatus(times: number): void;
1634
+ send(message: string): true | this;
1635
+ heartbeat(): void;
1636
+ get state(): number | undefined;
1637
+ }
1638
+
1639
+ export { }