zh-mapbox 0.1.30 → 0.1.36

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/dist/index.d.ts CHANGED
@@ -1,577 +1,723 @@
1
1
  /**
2
- * 注册mapbox常用方法
3
- * @param mapboxgl
4
- * @param defaultSource
5
- * @constructor
2
+ * 注册Mapbox扩展方法
3
+ * @param {Object} mapbox - Mapbox对象
4
+ * @param {Array<string>} defaultSource - 默认数据源
6
5
  */
7
- export declare function RegisterMapBoxMethod(mapboxgl: any, defaultSource?: string[]): void;
6
+ export function RegisterMapBoxMethod(mapbox: any, defaultSource: Array<string>): void;
8
7
 
9
8
  /**
10
- * 注册mapbox 加载3d模型方法
11
- * @param THREE
12
- * @param GLTFLoader
13
- * @constructor
9
+ * 注册Mapbox模型扩展
10
+ * @param {Object} Three - THREE.js对象
11
+ * @param {Object} GLTFLoader - GLTF加载器
14
12
  */
15
- export declare function RegisterMapBoxModel(THREE: any, GLTFLoader: any): void;
13
+ export function RegisterMapBoxModel(Three: any, GLTFLoader: any): void;
16
14
 
17
15
  /**
18
- * 浅判断对象是否为geojson格式
19
- * @param geojson
16
+ * 注册地图类配置
17
+ * @param {Object} map - 地图实例
18
+ * @param {Object} options - 配置选项
19
+ * @param {string} options.tooltipClass - 提示框CSS类名
20
+ * @param {string} options.popupClass - 弹出框CSS类名
20
21
  */
21
- export declare function isGeoJSON(geojson: any): boolean;
22
+ export function RegisterMapClass(map: any, options: {
23
+ tooltipClass: string;
24
+ popupClass: string;
25
+ }): void;
22
26
 
23
27
  /**
24
- * 对象转geojson
25
- * @param list 对象数组
26
- * @param str 对象哪个字段转geojson
27
- * @param options 给feature 添加key
28
+ * 深度判断数据是否为GeoJson格式
29
+ * @param {Object} data - 待检测的数据
30
+ * @return {boolean} 如果是GeoJSON格式返回true,否则返回false
28
31
  */
29
- export declare function object2Geojson(list: any[], str: string | [string, string] | [string, string, string], options?: { key: string, alias?: string }): any;
32
+ export function isGeoJSONDeep(data: any): boolean;
30
33
 
31
34
  /**
32
- * 反转经纬度
33
- * @param position
34
- * @param isLng 是否经度在前
35
+ * 浅判断数据是否为GeoJson格式
36
+ * @param {Object} data - 待检测的数据
37
+ * @return {boolean} 如果是GeoJSON格式返回true,否则返回false
35
38
  */
36
- export declare function judgeSizeLngLat(position: [number, number], isLng?: boolean): [number, number];
39
+ export function isGeoJSON(data: any): boolean;
37
40
 
38
41
  /**
39
- * 反转多维经纬度数组
40
- * @param position
41
- * @param isLng 是否经度在前
42
+ * 反转经纬度坐标
43
+ * @param {Array|String} position - 坐标数组或JSON字符串
44
+ * @param {boolean} lng=true - 经度是否在前
45
+ * @return {Array} 反转后的坐标数组
42
46
  */
43
- export declare function reversalLngLat(position: string | any[], isLng?: boolean): any[];
47
+ export function reversalLngLat(position: any[] | string, lng?: boolean): any[];
44
48
 
45
49
  /**
46
- * 反转geojson
47
- * @param geojson
48
- * @param isLng 是否经度在前
50
+ * 判断经纬度是否需要反转
51
+ * @param {Array} point - 坐标点 [lng, lat] 或 [lat, lng]
52
+ * @param {boolean} lng=true - 经度是否应在前
53
+ * @return {Array} 处理后的坐标点
49
54
  */
50
- export declare function resversalGeojson(geojson: any, isLng?: boolean): any;
55
+ export function judgeSizeLngLat(point: any[], lng?: boolean): any[];
56
+
51
57
  /**
52
- * 反转geojson
53
- * @param geojson
54
- * @param isLng 是否经度在前
58
+ * 对象转geojson
59
+ * @param {Array} list - 对象数组
60
+ * @param {string|[string,string]|[string,string,string]} str - 解析的字段名
61
+ * @param {object} [options] - 配置选项
62
+ * @param {string} [options.key] - 用于添加到feature的属性键名
63
+ * @param {string} [options.alias] - 别名,用于替换key
64
+ * @return {null|{type: string}} 返回GeoJSON对象或null
55
65
  */
56
- export declare function reversalGeojson(geojson: any, isLng?: boolean): any;
66
+ export function object2Geojson(list: any[], str: string | [string, string] | [string, string, string], options?: {
67
+ key?: string;
68
+ alias?: string;
69
+ }): null | {
70
+ type: string;
71
+ };
57
72
 
58
73
  /**
59
- * mapbox symbol 图标
60
- * @param options
61
- * @param options.size 图标大小
62
- * @param options.color 图标颜色
63
- * @param options.duration 动画时间 (1000)
74
+ * 判断经纬度数组类型
75
+ * @param {Array} position - 经纬度数组
76
+ * @return {string|null} 几何类型字符串或null
64
77
  */
65
- export declare function getSymbolRipple(options: { size: number, duration?: number, color?: string }): { width: number, height: number, data: any };
78
+ export function getPositionType(position: any[]): string | null;
66
79
 
67
80
  /**
68
- * mapbox gifsymbol 图标
69
- * @param options
70
- * @param [options.width] 图标宽度(50)
71
- * @param [options.height] 图标高度(50)
72
- * @param options.url 图标地址
73
- * @param [options.duration] 动画时间 (null) gif原始间隔
81
+ * 是否闭合图形
82
+ * @param {Array} segments - 线段数组
83
+ * @return {boolean} 是否闭合
74
84
  */
75
- export declare function getGifSymbol(options: { width?: number, height?: number, url: string, duration?: number }): { width: number, height: number, data: any };
85
+ export function isClosedGraph(segments: any[]): boolean;
76
86
 
77
87
  /**
78
- * mapbox apngsymbol 图标
79
- * @param options
80
- * @param [options.width] 图标宽度(50)
81
- * @param [options.height] 图标高度(50)
82
- * @param options.url 图标地址
83
- * @param [options.duration] 动画时间 (null) png原始间隔
88
+ * 获取数组维度
89
+ * @param {Array} arr - 数组
90
+ * @return {number} 数组维度
84
91
  */
85
- export declare function getAPNGSymbol(options: { width?: number, height?: number, url: string, duration?: number }): { width: number, height: number, data: any };
92
+ export function getArrayDepth(arr: any[]): number;
86
93
 
87
94
  /**
88
- * hexrgba
89
- * @param color hex颜色
90
- * @param pure 是否返回数组
95
+ * hex颜色值转rgba
96
+ * @param {string} hexValue - hex颜色值
97
+ * @param {boolean} pure=false - 是否返回纯数组格式
98
+ * @return {string|Array} rgba颜色值或颜色数组
91
99
  */
92
- export declare function hexToRgba(color: string, pure?: boolean): number[] | string;
100
+ export function hexToRgba(hexValue: string, pure?: boolean): string | any[];
93
101
 
94
102
  /**
95
- * 判断一个值是否为数字(包括字符串数字)
96
- * @param value
103
+ * 反转geojson坐标
104
+ * @param {Object} geojson - GeoJSON对象
105
+ * @param {boolean} lng=true - 经度是否在前
106
+ * @return {null|Object} 反转后的GeoJSON对象或null
97
107
  */
98
- export declare function isNumber(value: any): boolean;
108
+ export function resversalGeojson(geojson: any, lng?: boolean): null | any;
99
109
 
100
110
  /**
101
- * 判断一个数字是否为有效数字
102
- * @param value
111
+ * 反转geojson坐标(别名函数)
112
+ * @param {Object} geojson - GeoJSON对象
113
+ * @param {boolean} lng=true - 经度是否在前
114
+ * @return {null|Object} 反转后的GeoJSON对象或null
103
115
  */
104
- export declare function isValidNumber(value: number): boolean;
116
+ export function reversalGeojson(geojson: any, lng?: boolean): null | any;
105
117
 
106
118
  /**
107
- * 深克隆
108
- * @param data
119
+ * 判断是否为数字(包含字符串数字)
120
+ * @param {*} value - 待检测的值
121
+ * @return {boolean} 是否为数字
109
122
  */
110
- export declare function deepClone(data: any): any;
123
+ export function isNumber(value: any): boolean;
111
124
 
112
125
  /**
113
- * 执行长任务
114
- * @param {Array|Number} datas 执行的数据集合或者执行的次数
115
- * @param {Function} consumer 执行的操作
116
- * @param {Function} [chunkSplitor] 是否有时间执行
126
+ * 是否为有效数字
127
+ * @param {*} num - 待检测的数字
128
+ * @return {boolean} 是否为有效数字
117
129
  */
118
- export declare function performChunk(datas: any[] | number, consumer: Function, chunkSplitor?: Function): any;
130
+ export function isValidNumber(num: any): boolean;
119
131
 
120
132
  /**
121
- * geojson 边界线转面
122
- * @param geojson
123
- * @param length
133
+ * 合并多个geojson
134
+ * @param {...Object} args - GeoJSON对象或对象数组
135
+ * @return {{features: Array, type: string}} 合并后的GeoJSON对象
124
136
  */
125
- export declare function convertPolygonToLinePolygon(geojson: any, length: number): any;
137
+ export function mergeGeoJson(...args: any[]): {
138
+ features: any[];
139
+ type: string;
140
+ };
126
141
 
127
142
  /**
128
- * 距离目标点最近的线上的点
129
- * @param point
130
- * @param lines
143
+ * 经度转为Mercator坐标X
144
+ * @param {number} x - Mercator X坐标
145
+ * @return {number} 经度值
131
146
  */
132
- export declare function pointNearOnLine(point: number[], lines: number[]): number[] | null;
147
+ export function lngFromMercatorX(x: number): number;
133
148
 
134
149
  /**
135
- * 获取面中心点
136
- * @param geojson
150
+ * 纬度转为Mercator坐标Y
151
+ * @param {number} y - Mercator Y坐标
152
+ * @return {number} 纬度值
137
153
  */
138
- export declare function polygonCenter(geojson: any): any;
154
+ export function latFromMercatorY(y: number): number;
139
155
 
140
156
  /**
141
- * 反转区域
142
- * @param geojson
143
- * @param position 默认全球
157
+ * 转换geojson坐标
158
+ * @param {Object} json - GeoJSON对象
159
+ * @param {Function} func - 坐标转换函数
160
+ * @return {null|Object} 转换后的GeoJSON对象或null
144
161
  */
145
- export declare function invertMask(geojson: any, position?: number[][][]): any;
162
+ export function transformGeojson(json: any, func: Function): null | any;
146
163
 
147
164
  /**
148
- * 创建一组地图图层
165
+ * 转换经纬度坐标
166
+ * @param {Array|String} position - 坐标数组或JSON字符串
167
+ * @param {Function} func - 坐标转换函数
168
+ * @return {Array} 转换后的坐标数组
149
169
  */
150
- export declare class MapLayer {
151
- /**
152
- *
153
- * @param name 图层名称
154
- * @param options 图层组
155
- * @param prop 其他属性
156
- */
157
- constructor(name: string, options?: { [key: string]: any }, prop?: { [key: string]: any });
158
-
159
- /**
160
- * 图层名称
161
- */
162
- name: string
163
- /**
164
- * 图层组
165
- */
166
- layers: {
167
- layer: any;
168
- tooltip: any;
169
- popup: any;
170
- [key: string]: any
171
- }
172
- /**
173
- * 其他属性
174
- */
175
- prop: { [key: string]: any }
176
-
177
- /**
178
- * 添加图层
179
- * @param layer
180
- */
181
- addLayer(layer: { [key: string]: any }): void;
170
+ export function transformLngLat(position: any[] | string, func: Function): any[];
182
171
 
183
- /**
184
- * 添加属性
185
- * @param prop
186
- */
187
- addProp(prop: { [key: string]: any }): void;
188
- }
172
+ /**
173
+ * 执行长任务,分块处理大量数据以避免阻塞UI
174
+ * @param {Array|Number} datas - 执行的数据集合或者执行的次数
175
+ * @param {Function} consumer - 执行的操作
176
+ * @param {Function} [chunkSplitor] - 分块执行器,用于控制执行时机
177
+ */
178
+ export function performChunk(datas: any[] | number, consumer: Function, chunkSplitor?: Function): void;
189
179
 
190
180
  /**
191
- * 获取经纬度数组类型
192
- * @param position
181
+ * 尝试将值解析为JSON
182
+ * @param {*} value - 待解析的值
183
+ * @return {*} 解析后的值或原始值
193
184
  */
194
- export declare function getPositionType(position: any[]): string;
185
+ export function parseValue(value: any): any;
195
186
 
196
187
  /**
197
- * 获取数组维度
198
- * @param arr
188
+ * 深克隆
189
+ * @param data
199
190
  */
200
- export declare function getArrayDepth(arr: any[]): number;
191
+ export function deepClone(data: any): any;
201
192
 
202
- export declare function mergeGeoJson(...args: any): any;
193
+ /**
194
+ * 判断坐标是否在中国境外,如果在中国境外则不需要进行坐标偏移
195
+ * @param {number} inputLng - 经度
196
+ * @param {number} inputLat - 纬度
197
+ * @returns {boolean} 如果在中国境外返回true,否则返回false
198
+ */
199
+ export function outOfChina(inputLng: number, inputLat: number): boolean;
203
200
 
204
201
  /**
205
- * 设置弹窗默认类名
206
- * @param map
207
- * @param options
208
- * @constructor
202
+ * WGS84坐标系转GCJ02坐标系(火星坐标系)
203
+ * @param {number} inputLng - WGS84经度
204
+ * @param {number} inputLat - WGS84纬度
205
+ * @return {number[]} 转换后的GCJ02坐标 [经度, 纬度]
209
206
  */
210
- export declare function RegisterMapClass(map: any, options?: { tooltipClass?: string, popupClass?: string }): void;
207
+ export function wgs84ToGcj02(inputLng: number, inputLat: number): number[];
211
208
 
212
209
  /**
213
- * 判断坐标是否在国内
214
- * @param lng
215
- * @param lat
210
+ * GCJ02坐标系(火星坐标系)转WGS84坐标系
211
+ * @param {number} lng - GCJ02经度
212
+ * @param {number} lat - GCJ02纬度
213
+ * @return {number[]} 转换后的WGS84坐标 [经度, 纬度]
216
214
  */
215
+ export function gcj02ToWgs84(lng: number, lat: number): number[];
217
216
 
218
- export declare function outOfChina(lng, lat): boolean;
217
+ /**
218
+ * 面转换成带宽度的边界面
219
+ * @param {Object} geojson - GeoJSON对象,包含多边形或线要素
220
+ * @param {number} length - 缓冲区宽度(米)
221
+ * @return {null|{features: Array, type: string}} 返回带缓冲区的面要素集合或null
222
+ */
223
+ export function convertPolygonToLinePolygon(geojson: any, length: number): null | {
224
+ features: any[];
225
+ type: string;
226
+ };
219
227
 
220
228
  /**
221
- * 将GCJ-02坐标转换为WGS-84坐标
222
- * @param lng
223
- * @param lat
229
+ * 获取点到线最近距离的线上的点坐标
230
+ * @param {Array<number>} point - 点坐标 [lng, lat]
231
+ * @param {Array<Array<number>>} lineArray - 线坐标数组 [[lng, lat], ...]
232
+ * @return {Array<number>|null} 最近点的坐标或null
224
233
  */
225
- export declare function gcj02ToWgs84(lng, lat): [number, number];
234
+ export function pointNearOnLine(point: Array<number>, lineArray: Array<Array<number>>): Array<number> | null;
226
235
 
227
236
  /**
228
- * 将WGS84坐标转换为GCJ02坐标
229
- * @param lng
230
- * @param lat
237
+ * 计算多边形中心点(使用最大内切圆圆心)
238
+ * @param {Object} geojson - 包含多边形的GeoJSON对象
239
+ * @return {Object|null} 包含中心点的GeoJSON对象或null
231
240
  */
232
- export declare function wgs84ToGcj02(lng, lat): [number, number];
241
+ export function polygonCenter(geojson: any): any | null;
233
242
 
234
243
  /**
235
- * 墨卡托转纬度
236
- * @param y
244
+ * 创建遮罩区域(反选区域)
245
+ * @param {Object} geojson - GeoJSON对象
246
+ * @param {Array} maskArray - 遮罩区域坐标数组
247
+ * @return {Object|null} 遮罩后的GeoJSON对象或null
237
248
  */
238
- export declare function latFromMercatorY(y: number): number;
249
+ export function invertMask(geojson: any, maskArray: any[]): any | null;
239
250
 
240
251
  /**
241
- * 墨卡托转经度
242
- * @param x
252
+ * 创建一个闪烁点符号,用于在地图上显示动画效果的点标记
253
+ * @param {Object} options - 配置选项
254
+ * @param {number} [options.size=30] - 符号大小(宽度和高度)
255
+ * @param {number} [options.duration=1000] - 动画周期时间(毫秒)
256
+ * @param {string} [options.color='#ff0000'] - 符号颜色(十六进制格式)
257
+ * @param {Function} [options.custom] - 自定义渲染函数
258
+ * @return {Object} 返回包含符号数据和渲染方法的对象
243
259
  */
244
- export declare function lngFromMercatorX(x: number): number;
260
+ export function getSymbolRipple(options: {
261
+ size?: number;
262
+ duration?: number;
263
+ color?: string;
264
+ custom?: Function;
265
+ }): any;
245
266
 
246
267
  /**
247
- * 转换geojson坐标
248
- * @param geojson
249
- * @param func
268
+ * 获取GIF图片数据,用于在地图上显示动画图标
269
+ * @param {Object} options - 配置选项
270
+ * @param {number} [options.width=50] - 图标宽度
271
+ * @param {number} [options.height=50] - 图标高度
272
+ * @param {number|null} [options.duration=null] - 动画帧间隔时间(毫秒),默认使用GIF原始间隔
273
+ * @param {string} options.url - GIF图片URL
274
+ * @return {Promise<Object|null>} 返回包含GIF图像数据的Promise对象,失败时返回null
250
275
  */
251
- export declare function transformGeojson(geojson: any, func: Function): any;
276
+ export function getGifSymbol(options: {
277
+ width?: number;
278
+ height?: number;
279
+ duration?: number | null;
280
+ url: string;
281
+ }): Promise<any | null>;
252
282
 
253
283
  /**
254
- * 字符串转json
255
- * @param value
284
+ * 获取APNG图片数据,用于在地图上显示动画图标
285
+ * @param {Object} options - 配置选项
286
+ * @param {number} [options.width=50] - 图标宽度
287
+ * @param {number} [options.height=50] - 图标高度
288
+ * @param {number|null} [options.duration=null] - 动画帧间隔时间(毫秒),默认使用APNG原始间隔
289
+ * @param {string} options.url - APNG图片URL
290
+ * @return {Promise<Object|null>} 返回包含APNG图像数据的Promise对象,失败时返回null
256
291
  */
257
- export function parseValue(value): any;
292
+ export function getAPNGSymbol(options: {
293
+ width?: number;
294
+ height?: number;
295
+ duration?: number | null;
296
+ url: string;
297
+ }): Promise<any | null>;
258
298
 
259
299
  /**
260
- * 转换数组坐标
261
- * @param position
262
- * @param func
300
+ * 符号效果类
301
+ * 提供各种地图符号的动画效果
263
302
  */
264
- export declare function transformLngLat(position: any, func: Function): any;
303
+ export class SymbolEffect {
304
+ /**
305
+ * 创建波纹点符号效果
306
+ * @param {Object} options - 配置选项
307
+ * @param {number} [options.size=30] - 符号大小(宽度和高度)
308
+ * @param {number} [options.duration=2000] - 动画周期时间(毫秒)
309
+ * @param {string} [options.color='rgba(255,0,0,0.7)'] - 波纹颜色
310
+ * @return {Object} 返回包含符号数据和渲染方法的对象
311
+ */
312
+ static ripple(options: {
313
+ size?: number;
314
+ duration?: number;
315
+ color?: string;
316
+ }): any;
317
+ }
265
318
 
266
319
  /**
267
- * 是否闭合图形 三维数组
268
- * @param position
320
+ * 地图图层类
321
+ * 用于创建和管理地图图层,包括图层配置、tooltip、popup等组件
269
322
  */
270
- export declare function isClosedGraph(position: any[]): boolean;
323
+ export class MapLayer {
324
+ /**
325
+ * 构造函数
326
+ * @param {string} name - 图层名称
327
+ * @param {Object} [options] - 图层配置选项
328
+ * @param {Object} [options.layer=null] - 图层配置
329
+ * @param {Object} [options.tooltip=null] - 提示框配置
330
+ * @param {Object} [options.popup=null] - 弹出框配置
331
+ * @param {Object} [prop={}] - 其他属性
332
+ * @throws {Error} 当未使用new关键字调用时抛出错误
333
+ */
334
+ constructor(name: string, options?: {
335
+ layer?: any;
336
+ tooltip?: any;
337
+ popup?: any;
338
+ }, prop?: any);
339
+
340
+ /**
341
+ * 添加图层配置
342
+ * @param {Object} layer - 图层配置对象
343
+ */
344
+ addLayer(layer: any): void;
345
+
346
+ /**
347
+ * 添加属性
348
+ * @param {Object} prop - 属性对象
349
+ */
350
+ addProp(prop: any): void;
351
+ }
271
352
 
272
353
  declare module 'mapbox-gl' {
273
354
  interface Map {
274
355
  /**
275
- * 获取所有图层和源
276
- * @param defaultSource
277
- * @param save
356
+ * 初始化地图数据
278
357
  */
279
- getAllLayerAndSource(defaultSource?: string[], save?: boolean): { layers: any[], sources: any[] };
358
+ initData(): void;
280
359
 
281
360
  /**
282
- * 删除所有自定义图层
361
+ * 清除地图数据
283
362
  */
284
- removeAllCustomLayer(): void;
363
+ clearData(): void;
285
364
 
286
365
  /**
287
- * 删除所有图层和源
288
- * @param defaultSource
366
+ * 设置图层绘制属性
367
+ * @param id 图层ID
368
+ * @param options 属性配置
289
369
  */
290
- removeAllLayerAndSource(defaultSource?: string[]): { layers: any[], sources: any[] };
370
+ setPaint(id: string, options: any): void;
291
371
 
292
372
  /**
293
- * 移除指定所有事件
294
- * @param events
373
+ * 设置图层布局属性
374
+ * @param id 图层ID
375
+ * @param options 属性配置
295
376
  */
296
- removeEvents(events?: string[]): void;
377
+ setLayout(id: string, options: any): void;
297
378
 
298
379
  /**
299
- * 移除弹出框
300
- * @param type 'tooltip'|'popup
380
+ * 设置自定义样式
381
+ * @param options 样式配置
301
382
  */
302
- removePopup(type?: string): void;
383
+ customStyle(options: object): void;
303
384
 
304
385
  /**
305
- * 查找自定义图层
306
- * @param type 查找图层类型
307
- * @param defaultSource
386
+ * 获取所有图层和源
387
+ * @param defaultSource 默认数据源
388
+ * @param save 是否保存图层和源
308
389
  */
309
- findCustomLayer(type: string | string[], defaultSource?: string[]): any[];
390
+ getAllLayerAndSource(defaultSource?: string[], save?: boolean): { layers: any[], sources: any[] };
310
391
 
311
392
  /**
312
- * 地图提示框
313
- * @param layerName
314
- * @param options
315
- * @constructor
393
+ * 移除所有自定义图层
316
394
  */
317
- MapTooltip(layerName: string | string[], options?: any): any;
395
+ removeAllCustomLayer(): void;
318
396
 
319
397
  /**
320
- * 地图弹出框
321
- * @param layerName
322
- * @param options
323
- * @constructor
398
+ * 删除全部图层和源
399
+ * @param defaultSource 指定不删除源的名称
324
400
  */
325
- MapPopup(layerName: string | string[], options?: any): any;
401
+ removeAllLayerAndSource(defaultSource?: string[]): { layers: any[], sources: any[] };
326
402
 
327
403
  /**
328
- * 绘制线
329
- * @constructor
404
+ * 移除指定类型事件
405
+ * @param array 事件类型数组
330
406
  */
331
- MapLine(): any;
407
+ removeEvents(array?: string[]): void;
332
408
 
333
409
  /**
334
- * 绘制自定义 默认symbol
335
- * @constructor
410
+ * 移除弹出框
411
+ * @param type 弹出框类型
336
412
  */
337
- MapCustom(): any;
413
+ removePopup(type?: string): void;
414
+
415
+ /**
416
+ * 查找自定义图层
417
+ * @param type 查找图层类型
418
+ * @param defaultSource 默认数据源
419
+ */
420
+ findCustomLayer(type: string | string[], defaultSource?: string[]): any[];
421
+
338
422
 
339
423
  /**
340
424
  * 聚焦到geojson
341
- * @param geojson
342
- * @param options
425
+ * @param geojson GeoJSON对象
426
+ * @param options 配置选项
343
427
  */
344
428
  fitBoundsGeoJson(geojson: any, options?: any): void;
345
429
 
346
430
  /**
347
- * 聚焦到四至
348
- * @param position
349
- * @param options
431
+ * 聚焦到四至位置
432
+ * @param position 位置坐标数组
433
+ * @param options 配置选项
350
434
  */
351
435
  fitBoundsPosition(position: any, options?: any): void;
352
436
 
353
437
  /**
354
438
  * 获取反选遮罩
355
- * @param geojson
356
- * @param options
439
+ * @param geojson GeoJSON对象
440
+ * @param options 配置选项
357
441
  */
358
442
  getInvertMask(geojson: any, options?: any): any;
359
443
 
360
444
  /**
361
445
  * 加载多张图片
362
- * @param urls
446
+ * @param urls 图片地址
363
447
  */
364
448
  loadImages(urls: object): Promise<any>;
365
449
 
366
450
  /**
367
451
  * 加载并添加多张图片
368
- * @param urls
452
+ * @param urls 图片地址
369
453
  */
370
454
  loadAddImages(urls: object): Promise<any>;
371
455
 
372
- /**
373
- * 绘制圆形 实质通过fill绘制
374
- * @constructor
375
- */
376
- MapCircle(): any;
377
-
378
- /**
379
- * 自定义地图事件
380
- * @param layerName
381
- * @constructor
382
- */
383
- MapEvent(layerName?: string | string[]): any;
384
-
385
- /**
386
- * 添加多个图层
387
- * @constructor
388
- */
389
- MapMoreCustom(): any;
390
456
 
391
457
  /**
392
458
  * 移除图层和源
393
- * @param options
459
+ * @param options 配置选项
394
460
  */
395
461
  removeLayerSource(options: any): void;
396
462
 
397
463
  /**
398
- * 移除图层及事件
399
- * @param events
400
- * @param clear
464
+ * 移除图层事件
465
+ * @param events 事件对象
466
+ * @param clear 是否清除事件
401
467
  */
402
468
  removeLayerEvent(events: object, clear?: boolean): void;
403
469
 
404
- /**
405
- * 绘制marker
406
- * @param options
407
- * @constructor
408
- */
409
- MapMarker(options?: any): any;
410
470
 
411
471
  /**
412
- * 查找自定义图标
472
+ * 查找添加的图片
413
473
  */
414
474
  findCustomIcon(): any;
415
475
 
416
476
  /**
417
- * 获取自定义图层 type:’custom‘
477
+ * 获取自定义图层
418
478
  */
419
479
  getCustomLayer(): any[];
420
480
 
421
481
  /**
422
- * 获取图层层级
423
- * @param id
482
+ * 获取图层索引
483
+ * @param id 图层ID
424
484
  */
425
485
  getLayerIndex(id: string): any;
426
486
 
427
487
  /**
428
- * 根据层级 及 前后间隔数获取id
429
- * @param index
430
- * @param after
488
+ * 获取图层ID
489
+ * @param index 索引
490
+ * @param after 偏移量
431
491
  */
432
492
  getLayerId(index: number, after?: number): string;
433
493
 
434
494
  /**
435
- * 获取最小层级id
495
+ * 获取最小图层ID
436
496
  */
437
497
  getMinLayerId(): string;
438
498
 
439
499
  /**
440
- * 获取最大层级id
500
+ * 获取最大图层ID
441
501
  */
442
502
  getMaxLayerId(): string;
443
503
 
444
504
  /**
445
- * 获取所有层级id
505
+ * 获取所有图层ID
446
506
  */
447
507
  getAllLayerId(): string[];
448
508
 
449
509
  /**
450
- * 获取所有层级
510
+ * 获取所有图层
451
511
  */
452
512
  getAllLayer(): any[];
453
513
 
454
514
  /**
455
- * 获取所有线图层
515
+ * 获取线图层
456
516
  */
457
517
  getLineLayer(): any[];
458
518
 
519
+
459
520
  /**
460
- * 动态蚂蚁路径
461
- * @param id
462
- * @param options
463
- * @constructor
521
+ * 根据位置获取瓦片坐标
522
+ * @param position 位置坐标 [lng, lat]
523
+ * @param zoom 缩放级别
464
524
  */
465
- AnimateLine(id: string, options?: any): any;
525
+ getTileByPosition(position: [number, number], zoom?: number): [number, number, number];
466
526
 
467
527
  /**
468
- * 更改地图图层颜色和透明度
469
- * 可以使用表达式
470
- * @param options
471
- * @example
472
- customStyle({
473
- 'water-line':'#f00',
474
- 'water-line-fill':['#f00',0.5],
475
- 'water-line-fill-outline':[['case',['==','name','1'],'#f00','#ff0'],['case',['==','name','1'],0.5,1]],
476
- }
528
+ * 根据瓦片获取位置坐标
529
+ * @param tile 瓦片坐标 [x, y, z]
477
530
  */
478
- customStyle(options: object): void;
531
+ getPositionByTile(tile: [number, number, number]): [number, number, number, number];
479
532
 
480
533
  /**
481
- * 设置图层paint样式
482
- * @param id
483
- * @param options
534
+ * 根据边界获取瓦片
535
+ * @param zoom 缩放级别
536
+ * @param options 配置选项
484
537
  */
485
- setPaint(id: string, options: any): void;
538
+ getTilesByBounds(zoom?: number, options?: { expand?: number, reversal?: boolean }): [number, number, number][];
486
539
 
487
540
  /**
488
- * 设置图层layout样式
489
- * @param id
490
- * @param options
541
+ * 加载精灵图
542
+ * @param sprite 精灵图配置
491
543
  */
492
- setLayout(id: string, options: any): void;
544
+ loadSpriteGraph(sprite: { image: string, json: string | object }): Promise<any>;
545
+
493
546
 
494
547
  /**
495
- * 清除图层数据
548
+ * 更新字形
549
+ * @param url 字形URL
496
550
  */
497
- clearData(): void;
551
+ updateGlyphs(url: string): void;
498
552
 
499
553
  /**
500
- * 根据坐标获取瓦片
501
- * @param position
502
- * @param zoom
554
+ * 创建地图提示框
555
+ * 返回 MapTooltip 实例,提供以下方法:
556
+ * - show(htmlCallBack, type): 显示tooltip
557
+ * - setClassName(className, isFull): 更改tooltip样式
558
+ * - destroy(): 销毁提示框
559
+ * - mouseInOut(callback): 鼠标进出方法
560
+ * - showPosition(lnglat, property): 指定位置显示tooltip
561
+ * @param layerName 图层名称
562
+ * @param options 配置选项
503
563
  */
504
- getTileByPosition(position: [number, number], zoom?: number): [number, number, number];
564
+ MapTooltip(layerName: string | string[], options?: any): any;
505
565
 
506
566
  /**
507
- * 根据瓦片获取经纬度四至
508
- * @param tile
509
- * @return [minLng, minLat, maxLng, maxLat]
567
+ * 创建地图弹出框
568
+ * 返回 MapPopup 实例,提供以下方法:
569
+ * - show(componentCallBack, callBack): 显示弹出框
570
+ * - setClassName(className, isFull): 设置弹出框CSS类名
571
+ * - showPosition(lngLat, component, options, callback): 在指定位置显示弹出框
572
+ * - close(): 关闭弹出框
573
+ * - closeBack(callBack): 设置关闭回调函数
574
+ * - destroy(): 销毁弹出框
575
+ * @param layerName 图层名称
576
+ * @param options 配置选项
510
577
  */
511
- getPositionByTile(tile: [number, number, number]): [number, number, number, number];
578
+ MapPopup(layerName: string | string[], options?: any): any;
512
579
 
513
580
  /**
514
- * 获取指定zoom下瓦片集合
515
- * @param zoom
516
- * @param options
517
- * @param options.expand 瓦片扩展范围
518
- * @param options.reversal 是否反转
581
+ * 绘制线
582
+ * 返回 MapLine 实例,提供以下方法:
583
+ * - draw(json, name, options): 绘制线条图层
584
+ * - destroy(): 销毁线条图层
585
+ * - visible(show): 设置线条图层可见性
586
+ * @returns MapLine 实例
519
587
  */
520
- getTilesByBounds(zoom?: number, options?: { expand?: number, reversal?: boolean }): [number, number, number][];
588
+ MapLine(): any;
521
589
 
522
590
  /**
523
- * 加载精灵图
524
- * @param sprite
591
+ * 绘制自定义图层
592
+ * 返回 MapCustom 实例,提供以下方法:
593
+ * - draw(json, name, options): 绘制自定义图形
594
+ * - destroy(): 销毁图层
595
+ * - visible(show): 设置图层可见性
596
+ * @returns MapCustom 实例
525
597
  */
526
- loadSpriteGraph(sprite: { image: string, json: string | object }): Promise<any>;
598
+ MapCustom(): any;
599
+
600
+ /**
601
+ * 绘制圆形
602
+ * 返回 MapCircle 实例,提供以下方法:
603
+ * - draw(json, name, options): 绘制圆形图层
604
+ * - destroy(): 销毁图层
605
+ * - visible(show): 显示隐藏图层
606
+ * @returns MapCircle 实例
607
+ */
608
+ MapCircle(): any;
527
609
 
528
610
  /**
529
- * 聚合marker
611
+ * 自定义地图事件
612
+ * 返回 MapEvent 实例,提供以下方法:
613
+ * - add(events): 添加事件监听
614
+ * - destroy(): 销毁事件监听
615
+ * @param layerName 图层名称
616
+ * @returns MapEvent 实例
617
+ */
618
+ MapEvent(layerName?: string | string[]): any;
619
+
620
+ /**
621
+ * 多图层方法(添加多个图层)
622
+ * 返回 MapMoreCustom 实例,提供以下方法:
623
+ * - draw(json, name, options): 绘制多个图层
624
+ * - destroy(): 销毁图层
625
+ * - visible(show): 设置图层可见性
626
+ * @returns MapMoreCustom 实例
627
+ */
628
+ MapMoreCustom(): any;
629
+
630
+ /**
631
+ * 绘制marker
632
+ * 返回 MapMarker 实例,提供以下方法:
633
+ * - draw(json, callback): 绘制标记
634
+ * - addEvent(events): 添加事件监听
635
+ * - destroy(): 销毁标记
636
+ * - visible(show): 设置标记可见性
530
637
  * @param options marker参数
531
- * @constructor
638
+ * @returns MapMarker 实例
639
+ */
640
+ MapMarker(options?: any): any;
641
+
642
+ /**
643
+ * 创建动画线
644
+ * 返回 AnimateLine 实例,提供以下方法:
645
+ * - animate(): 开始动画
646
+ * - destroy(): 销毁动画线
647
+ * @param id 名称
648
+ * @param options 配置选项
649
+ * @returns AnimateLine 实例
650
+ */
651
+ AnimateLine(id: string, options?: any): any;
652
+
653
+ /**
654
+ * 创建聚合标记
655
+ * 返回 MapClusterMarker 实例,提供以下方法:
656
+ * - draw(name,callback): 开始聚合
657
+ * - visible(visible): 设置可见性
658
+ * - destroy(): 销毁聚合标记
659
+ * @param options 配置选项
660
+ * @returns MapClusterMarker 实例
532
661
  */
533
662
  MapClusterMarker(options?: any): any;
534
663
 
535
664
  /**
536
- * 获取source图层
537
- * @param sourceName
538
- * @param options
539
- * @constructor
665
+ * 创建数据源事件
666
+ * 返回 MapSourceEvent 实例,提供以下方法:
667
+ * - open(callback): 添加事件监听
668
+ * - destroy(): 销毁事件监听
669
+ * @param sourceName 数据源名称
670
+ * @param options 配置选项
671
+ * @returns MapSourceEvent 实例
540
672
  */
541
- MapSourceEvent(sourceName: string, options?: { once?: boolean, sourceLayer?: string, filter?: Array<any>, validate?: boolean })
673
+ MapSourceEvent(sourceName: string, options?: { once?: boolean, sourceLayer?: string, filter?: Array<any>, validate?: boolean }): any;
542
674
 
543
675
  /**
544
- * 裁剪区域
545
- * @param options
546
- * @constructor
676
+ * 创建GeoJSON瓦片
677
+ * 返回 TileByGeoJson 实例,提供以下方法:
678
+ * - draw(json,url,id): 设置数据
679
+ * - visible(visible): 设置可见性
680
+ * - destroy(): 销毁瓦片
681
+ * @param options 配置选项
682
+ * @returns TileByGeoJson 实例
547
683
  */
548
- TileByGeoJson(options?: { maxZoom?: number, minZoom?: number, expand?: number, isGCJ?: boolean, replaceUrl?: Function, isJudgement?: boolean, judgementBox?: Function, judgementPoint?: Function })
684
+ TileByGeoJson(options?: { maxZoom?: number, minZoom?: number, expand?: number, isGCJ?: boolean, replaceUrl?: Function, isJudgement?: boolean, judgementBox?: Function, judgementPoint?: Function }): any;
549
685
 
550
686
  /**
551
- * 右键菜单
552
- * @param options
553
- * @constructor
687
+ * 创建地图菜单
688
+ * 返回 MapMenu 实例,提供以下方法:
689
+ * - init(component, callback): 初始化菜单
690
+ * - visible(show): 显示隐藏菜单
691
+ * - updateXY(xy): 更新位置
692
+ * - destroy(): 销毁菜单
693
+ * @param options 配置选项
694
+ * @returns MapMenu 实例
554
695
  */
555
696
  MapMenu(options?: { move?: boolean, className?: string }): any;
556
697
 
557
698
  /**
558
- * 地图测量
559
- * @constructor
699
+ * 创建地图测量工具
700
+ * 返回 MapMeasure 实例,提供以下方法:
701
+ * - draw(): 开始测量
702
+ * - off(): 关闭监听
703
+ * - remove(): 清除测量
704
+ * - visible(show): 显示隐藏
705
+ * - destroy(): 销毁测量工具
706
+ * @param options 配置选项
707
+ * @returns MapMeasure 实例
560
708
  */
561
709
  MapMeasure(options?: { type?: 'line' | 'circle' | 'polygon' | 'rect' | 'sector', fixed?: number | Array<number>, dash?: boolean, units?: { line?: [string, string], circle?: [string, string], polygon?: [string, string], rect?: [string, string], sector?: [string, string] }, className?: string, point?: { color?: string, radius?: number, strokeWidth?: number, strokeColor?: string }, pointMove?: { opacity?: number, color?: string, radius?: number, strokeWidth?: number, strokeColor?: string, strokeOpacity?: number }, line?: { color?: string, width?: number, dasharray?: [number, number] }, fill?: { color?: string }, calcAll?: boolean }): any;
562
710
 
563
711
  /**
564
- * 切片聚合 vector (circle/symbol)
565
- * @param options
566
- * @constructor
712
+ * 创建瓦片聚合自定义图层
713
+ * 返回 MapTileClusterCustom 实例,提供以下方法:
714
+ * - draw(json,options,callback): 设置数据
715
+ * - visible(visible): 设置可见性
716
+ * - destroy(): 销毁图层
717
+ * @param options 配置选项
718
+ * @returns MapTileClusterCustom 实例
567
719
  */
568
- MapTileClusterCustom(options?: { custom?: boolean }),
720
+ MapTileClusterCustom(options?: { custom?: boolean }): any;
569
721
 
570
- /**
571
- * 更新glyphs
572
- * @param url
573
- */
574
- updateGlyphs(url: string)
575
722
  }
576
723
  }
577
-