vue-openlayers-plugin 1.1.13 → 1.1.15
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 +209 -0
- package/lib/{BasemapPanel-a8d7373d.mjs → BasemapPanel-7664fc20.mjs} +1 -1
- package/lib/{CoordinateLocationDialog-274aff1a.mjs → CoordinateLocationDialog-f505c006.mjs} +1 -1
- package/lib/{MapPrintDialog-97054260.mjs → FilterPanel-4cfbbfeb.mjs} +1 -1
- package/lib/{FilterPanel-ccdaaac3.mjs → LayerPanel-354b6ac7.mjs} +1 -1
- package/lib/{LayerPanel-c716b7cc.mjs → MapPrintDialog-0cf04cae.mjs} +1 -1
- package/lib/{MeasurementDialog-7c08ba58.mjs → MeasurementDialog-4fd11413.mjs} +1 -1
- package/lib/{MyMarkersDialog-89bd594e.mjs → MyMarkersDialog-f413337c.mjs} +1 -1
- package/lib/{QuadCompareDialog-78dd2cf6.mjs → QuadCompareDialog-176a8178.mjs} +1 -1
- package/lib/{RegionNavigationDialog-4b7b4e5f.mjs → RegionNavigationDialog-1edd078f.mjs} +1 -1
- package/lib/{SplitCompareDialog-b51b55c1.mjs → SplitCompareDialog-3fe419de.mjs} +1 -1
- package/lib/{SwipeCompareDialog-2b89b65e.mjs → SwipeCompareDialog-e2c28122.mjs} +1 -1
- package/lib/{ViewBookmarksDialog-7ee33d4e.mjs → ViewBookmarksDialog-9873fb3c.mjs} +1 -1
- package/lib/{index-98c677b7.mjs → index-923f7253.mjs} +549 -48
- package/lib/{index-3699244d.mjs → index-a30f4100.mjs} +1 -1
- package/lib/{index.es-e3be4489.mjs → index.es-b7728855.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +536 -35
- package/lib/style.css +5 -5
- package/package.json +1 -1
- package/types/components/OlDialogs/LayerPanel.vue.d.ts +204 -0
- package/types/components/OlDialogs/LayerPanel.vue.d.ts.map +1 -1
- package/types/components/OlMap.vue.d.ts +413 -0
- package/types/components/OlMap.vue.d.ts.map +1 -1
- package/types/components/OlMapContainer.vue.d.ts +1 -0
- package/types/components/OlMapContainer.vue.d.ts.map +1 -1
- package/types/core/LayerManager.d.ts +5 -0
- package/types/core/LayerManager.d.ts.map +1 -1
- package/types/core/layers/GeoJSONLayerHandler.d.ts +31 -2
- package/types/core/layers/GeoJSONLayerHandler.d.ts.map +1 -1
- package/types/core/layers/interfaces.d.ts +5 -0
- package/types/core/layers/interfaces.d.ts.map +1 -1
- package/types/core/storage.d.ts.map +1 -1
- package/types/lowcode-entry.d.ts +423 -0
- package/types/lowcode-entry.d.ts.map +1 -1
- package/types/types/map.d.ts +64 -0
- package/types/types/map.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -336,6 +336,209 @@ layerManager.addLayer({
|
|
|
336
336
|
})
|
|
337
337
|
```
|
|
338
338
|
|
|
339
|
+
#### GeoJSON 图层请求配置
|
|
340
|
+
|
|
341
|
+
GeoJSON 图层除了支持直接传入 `data` 和 `url`,现在也支持更完整的接口配置,适合通用组件场景下的查询、筛选与动态刷新。
|
|
342
|
+
|
|
343
|
+
最简单的用法仍然保持不变:
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
layerManager.addLayer({
|
|
347
|
+
id: 'geojson-static',
|
|
348
|
+
name: '静态 GeoJSON',
|
|
349
|
+
type: 'geojson',
|
|
350
|
+
visible: true,
|
|
351
|
+
opacity: 1,
|
|
352
|
+
zIndex: 10,
|
|
353
|
+
data: featureCollection
|
|
354
|
+
})
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
如果需要从接口加载数据,推荐使用 `geojsonConfig.request`:
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
layerManager.addLayer({
|
|
361
|
+
id: 'poi-api',
|
|
362
|
+
name: '接口点位',
|
|
363
|
+
type: 'geojson',
|
|
364
|
+
visible: true,
|
|
365
|
+
opacity: 1,
|
|
366
|
+
zIndex: 20,
|
|
367
|
+
projection: 'EPSG:4326',
|
|
368
|
+
geojsonConfig: {
|
|
369
|
+
request: {
|
|
370
|
+
url: '/api/poi/list',
|
|
371
|
+
method: 'GET',
|
|
372
|
+
params: {
|
|
373
|
+
city: 'hangzhou',
|
|
374
|
+
category: 'restaurant'
|
|
375
|
+
},
|
|
376
|
+
headers: {
|
|
377
|
+
Authorization: 'Bearer token'
|
|
378
|
+
},
|
|
379
|
+
dataPath: 'data.list'
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
})
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
也兼容扁平写法,适合快速接入:
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
layerManager.addLayer({
|
|
389
|
+
id: 'geojson-flat',
|
|
390
|
+
name: '快速接入图层',
|
|
391
|
+
type: 'geojson',
|
|
392
|
+
url: '/api/geojson',
|
|
393
|
+
method: 'POST',
|
|
394
|
+
params: {
|
|
395
|
+
cityCode: '330100'
|
|
396
|
+
},
|
|
397
|
+
body: {
|
|
398
|
+
keyword: '商圈'
|
|
399
|
+
},
|
|
400
|
+
dataPath: 'result.features',
|
|
401
|
+
visible: true,
|
|
402
|
+
opacity: 1,
|
|
403
|
+
zIndex: 15
|
|
404
|
+
})
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
#### GeoJSON 配置项说明
|
|
408
|
+
|
|
409
|
+
| 字段 | 类型 | 说明 |
|
|
410
|
+
|------|------|------|
|
|
411
|
+
| data | `object \| string` | 直接传入 GeoJSON 数据,适合本地数据或已拿到结果的场景 |
|
|
412
|
+
| url | `string` | GeoJSON 请求地址,保留原有用法 |
|
|
413
|
+
| method | `'GET' \| 'POST' \| 'PUT' \| 'PATCH' \| 'DELETE'` | 请求方法 |
|
|
414
|
+
| headers | `Record<string, string>` | 请求头 |
|
|
415
|
+
| params | `Record<string, any>` | 请求参数,`GET` 时会自动拼接到 URL |
|
|
416
|
+
| body | `Record<string, any> \| string` | 请求体,适用于 `POST` 等方法 |
|
|
417
|
+
| dataPath | `string` | 响应中 GeoJSON 数据所在路径,例如 `data.list` |
|
|
418
|
+
| geojsonConfig.request | `object` | 推荐写法,统一管理请求配置 |
|
|
419
|
+
| geojsonConfig.refresh | `object` | 刷新配置,支持定时、移动后、缩放后刷新 |
|
|
420
|
+
| geojsonConfig.clearOnError | `boolean` | 请求失败时是否清空当前图层要素 |
|
|
421
|
+
|
|
422
|
+
#### 刷新配置示例
|
|
423
|
+
|
|
424
|
+
```typescript
|
|
425
|
+
layerManager.addLayer({
|
|
426
|
+
id: 'geojson-refresh',
|
|
427
|
+
name: '动态刷新图层',
|
|
428
|
+
type: 'geojson',
|
|
429
|
+
visible: true,
|
|
430
|
+
opacity: 1,
|
|
431
|
+
zIndex: 30,
|
|
432
|
+
projection: 'EPSG:4326',
|
|
433
|
+
geojsonConfig: {
|
|
434
|
+
request: {
|
|
435
|
+
url: '/api/device/query',
|
|
436
|
+
method: 'GET',
|
|
437
|
+
params: {
|
|
438
|
+
status: 'online'
|
|
439
|
+
},
|
|
440
|
+
dataPath: 'data.features'
|
|
441
|
+
},
|
|
442
|
+
refresh: {
|
|
443
|
+
enabled: true,
|
|
444
|
+
interval: 30000,
|
|
445
|
+
onMoveEnd: true,
|
|
446
|
+
onZoomEnd: false,
|
|
447
|
+
debounce: 300,
|
|
448
|
+
useExtent: true,
|
|
449
|
+
extentParamName: 'bbox',
|
|
450
|
+
extentTarget: 'params',
|
|
451
|
+
extentProjection: 'EPSG:4326'
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
})
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
`refresh` 字段说明:
|
|
458
|
+
|
|
459
|
+
| 字段 | 类型 | 说明 |
|
|
460
|
+
|------|------|------|
|
|
461
|
+
| enabled | `boolean` | 是否启用刷新能力,默认开启 |
|
|
462
|
+
| interval | `number` | 定时刷新间隔,单位毫秒 |
|
|
463
|
+
| onMoveEnd | `boolean` | 地图移动结束后自动刷新 |
|
|
464
|
+
| onZoomEnd | `boolean` | 地图缩放结束后自动刷新 |
|
|
465
|
+
| debounce | `number` | 地图事件触发后的防抖时间,单位毫秒 |
|
|
466
|
+
| useExtent | `boolean` | 是否自动将当前地图范围作为查询参数传给接口 |
|
|
467
|
+
| extentParamName | `string` | 视野范围参数名,默认 `bbox` |
|
|
468
|
+
| extentTarget | `'params' \| 'body'` | 将范围写入查询参数还是请求体 |
|
|
469
|
+
| extentProjection | `string` | 范围参数使用的坐标系,默认跟随图层投影 |
|
|
470
|
+
|
|
471
|
+
#### 手动刷新与动态更新参数
|
|
472
|
+
|
|
473
|
+
如果使用的是 `OlMap` / `CustomOpenlayer` 组件实例,也可以直接调用暴露的方法:
|
|
474
|
+
|
|
475
|
+
```vue
|
|
476
|
+
<template>
|
|
477
|
+
<CustomOpenlayer ref="mapRef" :config="mapConfig" />
|
|
478
|
+
</template>
|
|
479
|
+
|
|
480
|
+
<script setup lang="ts">
|
|
481
|
+
import { ref } from 'vue'
|
|
482
|
+
import { CustomOpenlayer } from 'vue-openlayers-plugin'
|
|
483
|
+
|
|
484
|
+
const mapRef = ref<InstanceType<typeof CustomOpenlayer> | null>(null)
|
|
485
|
+
|
|
486
|
+
const reloadLayer = async () => {
|
|
487
|
+
mapRef.value?.updateLayerRequestParams('poi-api', {
|
|
488
|
+
city: 'ningbo',
|
|
489
|
+
category: 'hotel'
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
await mapRef.value?.refreshLayer('poi-api')
|
|
493
|
+
}
|
|
494
|
+
</script>
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
公开方法说明:
|
|
498
|
+
|
|
499
|
+
| 方法 | 参数 | 说明 |
|
|
500
|
+
|------|------|------|
|
|
501
|
+
| refreshLayer | `(layerId, options?)` | 手动刷新指定图层,可临时传入 `params` / `body` |
|
|
502
|
+
| updateLayerRequestParams | `(layerId, params)` | 更新图层默认请求参数,并立即重新拉取数据 |
|
|
503
|
+
|
|
504
|
+
#### 高级响应处理
|
|
505
|
+
|
|
506
|
+
当接口返回结构不固定时,可以通过拦截器或解析器做统一适配:
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
layerManager.addLayer({
|
|
510
|
+
id: 'geojson-advanced',
|
|
511
|
+
name: '高级响应处理',
|
|
512
|
+
type: 'geojson',
|
|
513
|
+
visible: true,
|
|
514
|
+
opacity: 1,
|
|
515
|
+
zIndex: 40,
|
|
516
|
+
geojsonConfig: {
|
|
517
|
+
request: {
|
|
518
|
+
url: '/api/map/search',
|
|
519
|
+
method: 'POST',
|
|
520
|
+
body: {
|
|
521
|
+
keyword: '学校'
|
|
522
|
+
},
|
|
523
|
+
requestInterceptor: async (request) => {
|
|
524
|
+
return {
|
|
525
|
+
...request,
|
|
526
|
+
headers: {
|
|
527
|
+
...request.headers,
|
|
528
|
+
Authorization: 'Bearer token'
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
responseInterceptor: async (response) => response.result,
|
|
533
|
+
responseParser: async (response) => ({
|
|
534
|
+
type: 'FeatureCollection',
|
|
535
|
+
features: response.items
|
|
536
|
+
})
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
})
|
|
540
|
+
```
|
|
541
|
+
|
|
339
542
|
### 标绘工具
|
|
340
543
|
|
|
341
544
|
```typescript
|
|
@@ -435,6 +638,12 @@ MIT License
|
|
|
435
638
|
|
|
436
639
|
## 更新日志
|
|
437
640
|
|
|
641
|
+
### 1.1.14
|
|
642
|
+
|
|
643
|
+
- ✨ 新增 GeoJSON 图层接口配置说明,支持 `method`、`headers`、`params`、`body`、`dataPath`
|
|
644
|
+
- ✨ 新增 GeoJSON 图层动态刷新说明,支持定时刷新、移动后刷新、缩放后刷新与视野范围参数
|
|
645
|
+
- ✨ 新增 `refreshLayer` 与 `updateLayerRequestParams` 用法示例,便于业务侧快速接入
|
|
646
|
+
|
|
438
647
|
### 1.2.0
|
|
439
648
|
|
|
440
649
|
- ✨ 新增图标图例功能,支持 PNG、JPG、SVG、GIF、WebP 等图像格式
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, ref, watch, onMounted, onUnmounted, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString } from "vue";
|
|
2
|
-
import { r as resolveBasemapThumbnail, l as layerEventBus, X, b as _export_sfc } from "./index-
|
|
2
|
+
import { r as resolveBasemapThumbnail, l as layerEventBus, X, b as _export_sfc } from "./index-923f7253.mjs";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|
|
5
5
|
import "proj4";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, ref, reactive, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode } from "vue";
|
|
2
2
|
import { Aim } from "@element-plus/icons-vue";
|
|
3
|
-
import { X, T as TooltipHelper, b as _export_sfc } from "./index-
|
|
3
|
+
import { X, T as TooltipHelper, b as _export_sfc } from "./index-923f7253.mjs";
|
|
4
4
|
import "ol";
|
|
5
5
|
import "proj4";
|
|
6
6
|
import "@supermapgis/iclient-ol";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, ref, watch, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment, renderList, normalizeClass } from "vue";
|
|
2
|
-
import { X, f as formatMeasurementResult, b as _export_sfc } from "./index-
|
|
2
|
+
import { X, f as formatMeasurementResult, b as _export_sfc } from "./index-923f7253.mjs";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|
|
5
5
|
import "proj4";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, ref, reactive, onUnmounted, watch, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, unref, withCtx, createElementVNode, normalizeClass, createTextVNode, toDisplayString, renderList, createBlock, withModifiers, mergeProps } from "vue";
|
|
2
2
|
import { Plus, FolderOpened, Download, Delete, Search, LocationFilled, Edit } from "@element-plus/icons-vue";
|
|
3
3
|
import { ElMessageBox } from "element-plus";
|
|
4
|
-
import { X, M as MarkerDrawingAdapter, h as fromLonLat, t as toLonLat } from "./index-
|
|
4
|
+
import { X, M as MarkerDrawingAdapter, h as fromLonLat, t as toLonLat } from "./index-923f7253.mjs";
|
|
5
5
|
import "ol";
|
|
6
6
|
import "proj4";
|
|
7
7
|
import "@supermapgis/iclient-ol";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, shallowRef, reactive, watch, nextTick, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from "vue";
|
|
2
|
-
import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-
|
|
2
|
+
import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-923f7253.mjs";
|
|
3
3
|
import { u as useMap } from "./useMap-8e3a2de5.mjs";
|
|
4
4
|
import { View, Map } from "ol";
|
|
5
5
|
import "@element-plus/icons-vue";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, reactive, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, normalizeClass } from "vue";
|
|
2
|
-
import { X } from "./index-
|
|
2
|
+
import { X } from "./index-923f7253.mjs";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|
|
5
5
|
import "proj4";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, shallowRef, watch, nextTick, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from "vue";
|
|
2
|
-
import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-
|
|
2
|
+
import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-923f7253.mjs";
|
|
3
3
|
import { u as useMap } from "./useMap-8e3a2de5.mjs";
|
|
4
4
|
import { View, Map } from "ol";
|
|
5
5
|
import "@element-plus/icons-vue";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, shallowRef, watch, nextTick, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, createBlock, createCommentVNode } from "vue";
|
|
2
|
-
import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-
|
|
2
|
+
import { k as layerFactory, i as getUid, m as defaults, X, n as TileLayer, I as ImageLayer, V as VectorTileLayer, H as HeatmapLayer, o as VectorLayer, L as LayerGroup, b as _export_sfc } from "./index-923f7253.mjs";
|
|
3
3
|
import { u as useMap } from "./useMap-8e3a2de5.mjs";
|
|
4
4
|
import { View, Map } from "ol";
|
|
5
5
|
import { DCaret } from "@element-plus/icons-vue";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, ref, watch, reactive, resolveComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, createElementBlock, Fragment, renderList, withModifiers, toDisplayString, createCommentVNode } from "vue";
|
|
2
2
|
import { Plus, Delete, Search, Camera, View, Edit, Location, ZoomIn } from "@element-plus/icons-vue";
|
|
3
3
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
4
|
-
import { X, t as toLonLat, h as fromLonLat, i as getUid } from "./index-
|
|
4
|
+
import { X, t as toLonLat, h as fromLonLat, i as getUid } from "./index-923f7253.mjs";
|
|
5
5
|
import "ol";
|
|
6
6
|
import "proj4";
|
|
7
7
|
import "@supermapgis/iclient-ol";
|