zh-mapbox 0.1.36 → 0.1.39
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 +47 -7
- package/dist/index.d.ts +30 -0
- package/dist/index.js +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -82,6 +82,8 @@ RegisterMapBoxModel(THREE,GLTFLoader)
|
|
|
82
82
|
| **MapMenu**(options)-(0.1.0) | options:{<br />move:false 菜单是否跟随移动<br />className:string <br />} | 右键菜单 |
|
|
83
83
|
| **MapMeasure**(options)-(0.1.1) | options:{...} | 地图测量 |
|
|
84
84
|
| **MapTileClusterCustom**(options)-(0.1.6) | options:{} | 切片聚合 |
|
|
85
|
+
| **MapLabelByGeoJson**()-(0.0.39) | | 过滤地图标签 |
|
|
86
|
+
| **MapImageByGeoJson**(options)-(0.0.39) | options:{sourceConfig:{}} | 图像图层 |
|
|
85
87
|
|
|
86
88
|
### Map.Style
|
|
87
89
|
|
|
@@ -196,14 +198,14 @@ layerConfig:{
|
|
|
196
198
|
| **destroy**() | - | 销毁 |
|
|
197
199
|
| **visible**(show)-(0.0.71) | show:boolean | 显示隐藏 |
|
|
198
200
|
|
|
199
|
-
**AnimateLine**
|
|
201
|
+
##### **AnimateLine**
|
|
200
202
|
|
|
201
203
|
| 方法名 | 参数 | 描述 |
|
|
202
204
|
| ------------- | ---- | -------- |
|
|
203
205
|
| **animate**() | - | 开始动画 |
|
|
204
206
|
| **destroy**() | - | 销毁动画 |
|
|
205
207
|
|
|
206
|
-
**MapClusterMarker**
|
|
208
|
+
##### **MapClusterMarker**
|
|
207
209
|
|
|
208
210
|
| 方法名 | 参数 | 描述 |
|
|
209
211
|
| ----------------------------------------- | --------------------------------------------------------- | ---------- |
|
|
@@ -211,14 +213,14 @@ layerConfig:{
|
|
|
211
213
|
| **destroy**() | - | 销毁 |
|
|
212
214
|
| **visible**(show) | show:boolean | 显示隐藏 |
|
|
213
215
|
|
|
214
|
-
**MapSourceEvent**
|
|
216
|
+
##### **MapSourceEvent**
|
|
215
217
|
|
|
216
218
|
| 方法名 | 参数 | 描述 |
|
|
217
219
|
| -------------------- | --------------------- | -------- |
|
|
218
220
|
| **open**(callback) | callback 结果返回方法 | 开启事件 |
|
|
219
221
|
| **destroy**() | - | 销毁事件 |
|
|
220
222
|
|
|
221
|
-
**TileByGeoJson**
|
|
223
|
+
##### **TileByGeoJson**
|
|
222
224
|
|
|
223
225
|
| 方法名 | 参数 | 描述 |
|
|
224
226
|
| --------------------- | ------------------------------------ | -------- |
|
|
@@ -226,7 +228,7 @@ layerConfig:{
|
|
|
226
228
|
| **destroy**() | | 销毁 |
|
|
227
229
|
| **visible**(show) | show:boolean | 显示隐藏 |
|
|
228
230
|
|
|
229
|
-
**MapMenu**
|
|
231
|
+
##### **MapMenu**
|
|
230
232
|
|
|
231
233
|
| 方法名 | 参数 | 描述 |
|
|
232
234
|
| ----------------------------- | -------------------------- | ------------ |
|
|
@@ -235,7 +237,7 @@ layerConfig:{
|
|
|
235
237
|
| **updateXY**(xy) | xy:{x:number,y:number} | 更新坐标 |
|
|
236
238
|
| **destroy**() | | 销毁 |
|
|
237
239
|
|
|
238
|
-
**MapMeasure**
|
|
240
|
+
##### **MapMeasure**
|
|
239
241
|
|
|
240
242
|
options:
|
|
241
243
|
|
|
@@ -278,7 +280,7 @@ options:
|
|
|
278
280
|
| **visible**(show) | show:boolean | 显示隐藏 |
|
|
279
281
|
| **destroy**() | | 销毁 |
|
|
280
282
|
|
|
281
|
-
**MapTileClusterCustom**
|
|
283
|
+
##### **MapTileClusterCustom**
|
|
282
284
|
|
|
283
285
|
| 方法名 | 参数 | 描述 |
|
|
284
286
|
| -------------------------------------------------- | ------------------------------------------------------------ | -------- |
|
|
@@ -286,6 +288,43 @@ options:
|
|
|
286
288
|
| **visible**(show) | show:boolean | 显示隐藏 |
|
|
287
289
|
| **destroy**() | | 销毁 |
|
|
288
290
|
|
|
291
|
+
##### **MapLabelByGeoJson**
|
|
292
|
+
|
|
293
|
+
| 方法名 | 参数 | 描述 |
|
|
294
|
+
| --------------------------------------- | --------------------------------------------------- | ---------------- |
|
|
295
|
+
| **draw**( json, sourceName,<br>options) | json:遮罩json sourceName:源 options:{sourceLayer?} | 绘制 |
|
|
296
|
+
| **visible**(show) | show:boolean | 显示隐藏 |
|
|
297
|
+
| **visibleOrigin**(show) | | 原始图层显示隐藏 |
|
|
298
|
+
| **destroy**() | | 销毁 |
|
|
299
|
+
|
|
300
|
+
##### MapImageByGeoJson
|
|
301
|
+
|
|
302
|
+
| 方法名 | 参数 | 描述 |
|
|
303
|
+
| ------------------------------ | ----------------------------------- | -------- |
|
|
304
|
+
| **draw**( json, key, callback) | json key:图像字段 callback 绘制参数 | 绘制 |
|
|
305
|
+
| **visible**(show) | show:boolean | 显示隐藏 |
|
|
306
|
+
| **destroy**() | | 销毁 |
|
|
307
|
+
|
|
308
|
+
```js
|
|
309
|
+
const layer = map.MapImageByGeoJson()
|
|
310
|
+
// url 优先取callback值 没有则取properties.url
|
|
311
|
+
layer.draw(polygonJson, 'url', (e) => {
|
|
312
|
+
return {
|
|
313
|
+
url: e.properties.url,
|
|
314
|
+
distance: 0,//平移距离
|
|
315
|
+
direction: 0,//平移方向 正北
|
|
316
|
+
rotation: 30,//旋转角度
|
|
317
|
+
pivot: null,//旋转中心 [number,number]
|
|
318
|
+
factor: 1.0,//缩放比例
|
|
319
|
+
origin: null,//缩放锚点 [number,number]
|
|
320
|
+
//raster style
|
|
321
|
+
paint: {
|
|
322
|
+
'raster-hue-rotate': 45
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
```
|
|
327
|
+
|
|
289
328
|
|
|
290
329
|
|
|
291
330
|
#### 公共方法
|
|
@@ -320,6 +359,7 @@ options:
|
|
|
320
359
|
| **pointNearOnLine** | | 距离目标点最近的线上的点 |
|
|
321
360
|
| **polygonCenter** | | 面中心点 |
|
|
322
361
|
| **invertMask** | | 反转区域 |
|
|
362
|
+
| **judgePointInPolygon** | | 点是否在多边形内 |
|
|
323
363
|
|
|
324
364
|
|
|
325
365
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MapImageByGeoJson } from '../src/mapBox/class/MapImageByGeoJson'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 注册Mapbox扩展方法
|
|
3
5
|
* @param {Object} mapbox - Mapbox对象
|
|
@@ -248,6 +250,14 @@ export function polygonCenter(geojson: any): any | null;
|
|
|
248
250
|
*/
|
|
249
251
|
export function invertMask(geojson: any, maskArray: any[]): any | null;
|
|
250
252
|
|
|
253
|
+
/**
|
|
254
|
+
* 判断点是否在多边形内
|
|
255
|
+
* @param {Object|[number,number]} point - 点坐标对象
|
|
256
|
+
* @param {Object} geojson - 多边形对象,可以是FeatureCollection或Feature格式
|
|
257
|
+
* @returns {boolean} 如果点在多边形内返回true,否则返回false
|
|
258
|
+
*/
|
|
259
|
+
export function judgePointInPolygon(point: [number, number] | { lng: number, lat: number }, geojson: any): boolean;
|
|
260
|
+
|
|
251
261
|
/**
|
|
252
262
|
* 创建一个闪烁点符号,用于在地图上显示动画效果的点标记
|
|
253
263
|
* @param {Object} options - 配置选项
|
|
@@ -719,5 +729,25 @@ declare module 'mapbox-gl' {
|
|
|
719
729
|
*/
|
|
720
730
|
MapTileClusterCustom(options?: { custom?: boolean }): any;
|
|
721
731
|
|
|
732
|
+
/**
|
|
733
|
+
* 根据GeoJSON范围过滤地图要素
|
|
734
|
+
* 返回 MapLabelByGeoJson 实例,提供以下方法:
|
|
735
|
+
* - draw(json,sourceName,options): 设置数据
|
|
736
|
+
* - visible(visible): 设置可见性
|
|
737
|
+
* - visibleOrigin(visible): 设置原始图层可见性
|
|
738
|
+
* - destroy(): 销毁图层
|
|
739
|
+
* @returns MapLabelByGeoJson 实例
|
|
740
|
+
*/
|
|
741
|
+
MapLabelByGeoJson(): any;
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* 根据 GeoJSON 数据渲染图像图层
|
|
745
|
+
* 返回 MapImageByGeoJson 实例,提供以下方法:
|
|
746
|
+
* - draw(json,key,callback): 设置数据
|
|
747
|
+
* - visible(visible): 设置可见性
|
|
748
|
+
* - destroy(): 销毁图层
|
|
749
|
+
* @returns MapImageByGeoJson 实例
|
|
750
|
+
*/
|
|
751
|
+
MapImageByGeoJson(options?: { sourceConfig?: any }): any;
|
|
722
752
|
}
|
|
723
753
|
}
|