mapboxgl-tools 1.6.3 → 1.7.2

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 CHANGED
@@ -68,6 +68,8 @@ export default {
68
68
 
69
69
  </script>
70
70
  ```
71
+ *组件效果*
72
+ ![img](./public/imgs/Geoserver.png)
71
73
 
72
74
  ### 2.Contextmenu
73
75
  > 右键菜单项目组件,基于vue2.x
@@ -125,7 +127,8 @@ export default {
125
127
 
126
128
  </script>
127
129
  ```
128
-
130
+ *组件效果*
131
+ ![img](./public/imgs/contextmenu.png)
129
132
 
130
133
  ### 3.GeoserverAside
131
134
  > 继承Geoserver组件,快速弹窗
@@ -194,6 +197,8 @@ export default {
194
197
 
195
198
  </script>
196
199
  ```
200
+ *控制器效果*
201
+ ![img](./public/imgs/PickCoordControl.png)
197
202
 
198
203
  ### 5.MouseRectControl
199
204
  > 框选控制器
@@ -232,6 +237,8 @@ export default {
232
237
 
233
238
  </script>
234
239
  ```
240
+ *控制器效果*
241
+ ![img](./public/imgs/MouseRectControl.png)
235
242
 
236
243
  ### 6.MeasureDistanceControl
237
244
  > 测量距离mapboxgl控制器
@@ -264,6 +271,9 @@ export default {
264
271
  </script>
265
272
  ```
266
273
 
274
+ *控制器效果*
275
+ ![img](./public/imgs/MeasureDistanceControl.png)
276
+
267
277
  ### 7.MeasureAreaControl
268
278
  > 测量面积mapboxgl控制器
269
279
 
@@ -294,6 +304,8 @@ export default {
294
304
 
295
305
  </script>
296
306
  ```
307
+ *控制器效果*
308
+ ![img](./public/imgs/MeasureAreaControl.png)
297
309
 
298
310
  ### 8.PositionControl
299
311
  > mapboxgl定位撒点控制器
@@ -327,4 +339,124 @@ export default {
327
339
  }
328
340
 
329
341
  </script>
330
- ```
342
+ ```
343
+ *控制器效果*
344
+ ![img](./public/imgs/PositionControl.png)
345
+
346
+ ### 9.LayerTreeControl
347
+ > 图层集合控制器
348
+
349
+ | Property | Type | 默认值 | Description |
350
+ | ----- | ------------- | ------------- | ------------------------ |
351
+ | title | String | 地图图层 | 入口按钮title |
352
+ | isAutoShow | Boolean | true | 是否默认展开图层框 |
353
+ | titleWidth | Number | 100 | 图层名称(父级)宽度 |
354
+ | layers | <font color="#f00">Layer</font>[] | [] | 图层配置 |
355
+ | onAfterOrder | Function | | 排序之后的回调,参数({allLayers: 所有图层配置(含未打开的), layers: 打开的图层配置, beforeIdMap: 所有已打开图层按照顺序下beforeId集合}) |
356
+
357
+ ###### <font color="#f00">Layer</font>对象参数
358
+ | Property | Type | 默认值 | Description | 父级字段 | 子级字段 |
359
+ | ----- | ------------- | ------------- | ------------------------ | ----- | ----- |
360
+ | id | String | | 保持唯一,必填! | true | true |
361
+ | title | String | | 名称 | true | true |
362
+ | checked | Boolean | false | 初次是否选中打开 | false | true |
363
+ | radio | Boolean | false | 是否单选,true的时候和同组之间为true的其他图层互斥 | false | true |
364
+ | zIndex | Number | 1 | 当前图层的权重,越大权重越高,显示优先级越高 | false | true |
365
+ | icon | String/Array | | 图片path,使用预制的icon(circle、eye、rect、diamond、star、water、loc),或使用iconfont中图层path的d属性集合| false | true |
366
+ | color | String | | 名称颜色 | false | true |
367
+ | sourceConfig | Object | { type: 'raster', tileSize: 256 } | mapbox中source的配置文件 | false | true |
368
+ | layerConfig | Object | { type: 'raster' } | mapbox中图层的配置文件 | false | true |
369
+ | children | Array | [] | 子集 | true | false |
370
+ | onChange | Function | | 图层打开/关闭的回调 | false | true |
371
+
372
+ ```js
373
+ <template>
374
+ <section id="map" style="width: 90%; height: 700px"></section>
375
+ </template>
376
+
377
+ <script>
378
+ import { LayerTreeControl, transformRequest4326 } from 'mapboxgl-tools'
379
+
380
+ const layerData = [
381
+ {
382
+ title: '基础地图',
383
+ id: 'base',
384
+ children: [
385
+ { title: '底图1', id: '1-1', radio: true, checked: true, color: '#f00', icon: 'water', zIndex: 0,
386
+ sourceConfig: { tiles: ['自己的模板地址']},
387
+ onChange(e) { alert('1-1) },
388
+ },
389
+ { title: '底图2', id: '1-2', radio: true, color: '#f00', icon: 'water', zIndex: 1,
390
+ sourceConfig: { tiles: ['自己的模板地址']},
391
+ onChange(e) { alert('1-2')},
392
+ },
393
+ { title: '资料1-3', id: '1-3', color: '#f00', icon: 'rect', zIndex: 0,
394
+ sourceConfig: { tiles: ['自己的模板地址']},
395
+ onChange(e) { alert('1-3')},
396
+ },
397
+ ]
398
+ },
399
+ {
400
+ title: '基础地图2',
401
+ id: 'base2', // children为空或不传值,则过滤之
402
+ },
403
+ {
404
+ title: '参考资料',
405
+ id: 'geoserver',
406
+ children: [
407
+ { title: '资料2-1', id: '2-1', checked: true, color: '#ff5299', icon: 'circle', zIndex: 2,
408
+ sourceConfig: { tiles: ['自己的模板地址']},
409
+ },
410
+ { title: '资料2-2', id: '2-2', checked: true, color: '#0f5264', icon: 'circle', zIndex: 3,
411
+ sourceConfig: { tiles: ['自己的模板地址']},
412
+ },
413
+ ]
414
+ },
415
+ {
416
+ title: '点图层',
417
+ id: 'point',
418
+ children: [
419
+ { title: '点-1', id: '3-1', color: '#ff5299', zIndex: 5,
420
+ icon: [
421
+ "M831.996366 320.007996c0 163.498143-122.598608 298.396611-280.996809 317.596392-3.999955 0.499994-6.99992 3.899956-6.99992 7.899911V992.000363c0 8.7999-3.599959 16.799809-9.399894 22.599744-5.799934 5.799934-13.799843 9.399893-22.599743 9.399893-17.699799 0-31.999637-14.299838-31.999637-31.999637V645.604298c0-3.999955-2.999966-7.399916-6.99992-7.899911C315.002237 618.404607 192.503629 484.106132 192.003634 321.007984 191.403641 144.509989 332.702036 1.511613 509.200032 0.01163 687.19801-1.488353 831.996366 142.310014 831.996366 320.007996z"
422
+ ],// 使用自定义图标
423
+ sourceConfig: { tiles: ['自己的模板地址']},
424
+
425
+ },
426
+ { title: '点-2', id: '3-2', checked: true, color: '#009', zIndex: 5,
427
+ icon: [
428
+ "M831.996366 320.007996c0 163.498143-122.598608 298.396611-280.996809 317.596392-3.999955 0.499994-6.99992 3.899956-6.99992 7.899911V992.000363c0 8.7999-3.599959 16.799809-9.399894 22.599744-5.799934 5.799934-13.799843 9.399893-22.599743 9.399893-17.699799 0-31.999637-14.299838-31.999637-31.999637V645.604298c0-3.999955-2.999966-7.399916-6.99992-7.899911C315.002237 618.404607 192.503629 484.106132 192.003634 321.007984 191.403641 144.509989 332.702036 1.511613 509.200032 0.01163 687.19801-1.488353 831.996366 142.310014 831.996366 320.007996z"
429
+ ],
430
+ sourceConfig: { tiles: ['自己的模板地址']},
431
+
432
+ },
433
+ { title: '点-3', id: '3-3', checked: true, color: '#a08', zIndex: 6,
434
+ icon: [
435
+ "M831.996366 320.007996c0 163.498143-122.598608 298.396611-280.996809 317.596392-3.999955 0.499994-6.99992 3.899956-6.99992 7.899911V992.000363c0 8.7999-3.599959 16.799809-9.399894 22.599744-5.799934 5.799934-13.799843 9.399893-22.599743 9.399893-17.699799 0-31.999637-14.299838-31.999637-31.999637V645.604298c0-3.999955-2.999966-7.399916-6.99992-7.899911C315.002237 618.404607 192.503629 484.106132 192.003634 321.007984 191.403641 144.509989 332.702036 1.511613 509.200032 0.01163 687.19801-1.488353 831.996366 142.310014 831.996366 320.007996z"
436
+ ],
437
+ sourceConfig: { tiles: ['自己的模板地址']},
438
+ },
439
+ ]
440
+ }
441
+ ]
442
+
443
+ export default {
444
+ mounted() {
445
+ const map = new mapboxgl.Map({
446
+ container: 'map',
447
+ style: 'mapbox://styles/mapbox/light-v11',
448
+ zoom: 18,
449
+ center: [114.26697720786854,30.63091896813168],
450
+ transformRequest: transformRequest4326,
451
+ })
452
+ map.addControl(new LayerTreeControl({
453
+ isAutoShow: true,
454
+ layers: layerData,
455
+ }), 'top-right')
456
+ }
457
+ }
458
+
459
+ </script>
460
+ ```
461
+ *图层控件效果*
462
+ ![img](./public/imgs/layerTreeControl.png)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file