@zhangdali1996/lr-map-viewer 0.0.10 → 0.0.12
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 +55 -3
- package/dist/lr-map-viewer.css +1 -1
- package/dist/lr-map-viewer.js +52301 -1413
- package/dist/monitor-points-CdIaI2Nx.js +139 -0
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
- 支持通过运行时配置传入二维图纸参数。
|
|
12
12
|
- 支持通过运行时配置传入云 GIS 参数。
|
|
13
13
|
- 支持通过运行时配置显式传入三维场景 `basePoint`。
|
|
14
|
-
-
|
|
14
|
+
- 支持按需显示区域显隐面板、调试面板和监测点面板。
|
|
15
15
|
- 支持通过组件实例调用 `moveView(x, y, z)` 移动三维视角。
|
|
16
|
+
- 支持通过组件实例保存/恢复视角,以及控制演示人员的初始化、运动和聚焦。
|
|
16
17
|
- 支持通过组件实例注册 `registerModelInfoQuery(callback)` 查询点击模型信息。
|
|
17
18
|
|
|
18
19
|
## 安装
|
|
@@ -23,6 +24,8 @@ npm install @zhangdali1996/lr-map-viewer
|
|
|
23
24
|
|
|
24
25
|
`vue` 和 `element-plus` 作为 `peerDependencies` 提供,要求使用方项目自行安装。
|
|
25
26
|
|
|
27
|
+
二维图纸依赖的 `@longruan/lr-map` 已随当前组件库构建产物内置,客户项目安装本包时不需要再额外访问公司内网 npm 拉取这个依赖。
|
|
28
|
+
|
|
26
29
|
安装后请显式引入组件库样式:
|
|
27
30
|
|
|
28
31
|
```js
|
|
@@ -242,6 +245,16 @@ import App from './App.vue'
|
|
|
242
245
|
createApp(App).use(LrMapViewerPlugin).mount('#app')
|
|
243
246
|
```
|
|
244
247
|
|
|
248
|
+
## 命名导出
|
|
249
|
+
|
|
250
|
+
除默认导出的插件对象外,包入口还提供以下命名导出:
|
|
251
|
+
|
|
252
|
+
- 组件:`LrMapViewer`、`Lr2dViewer`、`Lr3dViewer`
|
|
253
|
+
- 2D 配置工具:`getDefaultLr2dConfig`、`getLr2dConfig`、`getLr2dMapOptions`、`setLr2dConfig`、`resetLr2dConfig`、`resolveLr2dConfig`、`getMissingLr2dOptionFields`、`getRequiredLr2dOptionFields`、`isLr2dConfigReady`
|
|
254
|
+
- 3D 配置工具:`getDefaultLr3dConfig`、`getLr3dConfig`、`setLr3dConfig`、`resetLr3dConfig`、`resolveLr3dConfig`
|
|
255
|
+
- 模式工具:`getSupportedMapModes`、`normalizeMapMode`、`resolveMapModes`、`resolveInitialMapMode`、`canSwitchMapMode`
|
|
256
|
+
- 2D/3D 适配与数据方法:同时导出 `adapters/lr2d`、`adapters/lr3d` 和 `services/gis` 中的方法,适合在需要直接操作底层地图实例或手动加载云 GIS 数据时使用
|
|
257
|
+
|
|
245
258
|
## 公开能力
|
|
246
259
|
|
|
247
260
|
组件 Props:
|
|
@@ -260,6 +273,21 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
|
|
|
260
273
|
是否显示区域显隐面板,默认 `false`。
|
|
261
274
|
- `showDebugPanel`
|
|
262
275
|
是否显示调试面板,默认 `false`。
|
|
276
|
+
- `showMonitorPanel`
|
|
277
|
+
是否显示监测点面板,默认 `false`。
|
|
278
|
+
|
|
279
|
+
组件事件:
|
|
280
|
+
|
|
281
|
+
- `mode-change`
|
|
282
|
+
当前显示模式切换时触发,回调参数结构如下:
|
|
283
|
+
|
|
284
|
+
```js
|
|
285
|
+
{
|
|
286
|
+
mode: '2d' | '3d',
|
|
287
|
+
previousMode: '2d' | '3d',
|
|
288
|
+
supportedModes: ['2d', '3d'],
|
|
289
|
+
}
|
|
290
|
+
```
|
|
263
291
|
|
|
264
292
|
组件 expose:
|
|
265
293
|
|
|
@@ -270,6 +298,13 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
|
|
|
270
298
|
- `get3dInstance()`
|
|
271
299
|
- `resize()`
|
|
272
300
|
- `refreshScene()`
|
|
301
|
+
- `saveView()`
|
|
302
|
+
- `restoreView(viewState)`
|
|
303
|
+
- `initializeDemoPerson()`
|
|
304
|
+
- `startDemoPersonMotion(x, y, z)`
|
|
305
|
+
- `stopDemoPersonMotion()`
|
|
306
|
+
- `toggleDemoPersonMotion(x, y, z)`
|
|
307
|
+
- `focusDemoPerson()`
|
|
273
308
|
- `moveView(x, y, z)`
|
|
274
309
|
- `registerModelInfoQuery(callback)`
|
|
275
310
|
|
|
@@ -278,6 +313,8 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
|
|
|
278
313
|
- `switchMode(mode)` 支持在 `2d / 3d` 间切换当前显示引擎。
|
|
279
314
|
- `get2dInstance()` 返回当前二维 adapter 实例,其中包含 `map`、`options`、`behavior`、`layerTree` 等信息。
|
|
280
315
|
- `refreshScene()` 仅对三维场景有效。
|
|
316
|
+
- `saveView()` 用于保存当前三维视角快照,返回结果可直接交给 `restoreView(viewState)` 复原。
|
|
317
|
+
- `initializeDemoPerson()`、`startDemoPersonMotion()`、`stopDemoPersonMotion()`、`toggleDemoPersonMotion()`、`focusDemoPerson()` 仅对三维场景有效,用于控制示例人员对象。
|
|
281
318
|
- `moveView(x, y, z)` 传入的是绝对三维坐标,组件内部会自动换算成相对 `basePoint` 坐标后调用聚焦接口。
|
|
282
319
|
- `registerModelInfoQuery(callback)` 会在用户点击三维中的模型对象时触发回调。
|
|
283
320
|
- 模型信息查询返回 4 个字段:`id`、`name`、`layerName`、`position`。
|
|
@@ -310,7 +347,14 @@ const map2dConfig = {
|
|
|
310
347
|
}
|
|
311
348
|
```
|
|
312
349
|
|
|
313
|
-
|
|
350
|
+
推荐接入方式分为两种:
|
|
351
|
+
|
|
352
|
+
- 通过 `credentialKey` 接入:
|
|
353
|
+
组件会自动补齐 `ygis_url`、`map_server_url/Url`、`ygis_username`、`ygis_password`,此时你通常只需要传业务相关字段,例如 `ygis_dsGuid`、`layerName`、`layerCode`。
|
|
354
|
+
- 不通过 `credentialKey`,直接手动传完整二维配置:
|
|
355
|
+
需要自行补齐地址和认证信息。
|
|
356
|
+
|
|
357
|
+
手动直传完整二维配置时的必填字段:
|
|
314
358
|
|
|
315
359
|
- `map2dConfig.options.ygis_dsGuid`
|
|
316
360
|
二维图纸数据源 guid。
|
|
@@ -324,6 +368,7 @@ const map2dConfig = {
|
|
|
324
368
|
认证兼容说明:
|
|
325
369
|
|
|
326
370
|
- 如果没有 `token`,则需要同时传入 `map2dConfig.options.ygis_username` 和 `map2dConfig.options.ygis_password`。
|
|
371
|
+
- `map2dConfig.options.map_server_url` 与 `map2dConfig.options.Url` 在组件内部会自动对齐,二者传一个即可。
|
|
327
372
|
- 当 `map2dConfig.behavior.autoShowLayer` 为 `true` 时,`map2dConfig.options.layerName` 也属于必填项。
|
|
328
373
|
|
|
329
374
|
常用可选字段:
|
|
@@ -464,7 +509,14 @@ const lr3dConfig = {
|
|
|
464
509
|
}
|
|
465
510
|
```
|
|
466
511
|
|
|
467
|
-
|
|
512
|
+
推荐接入方式同样分为两种:
|
|
513
|
+
|
|
514
|
+
- 通过 `credentialKey` 接入:
|
|
515
|
+
组件会自动补齐 `cloud.server`、`cloud.username`、`cloud.password`,此时你通常只需要传 `autoLoad`、`cloud.dsGuid`、`cloud.basePoint` 以及业务图层参数。
|
|
516
|
+
- 不通过 `credentialKey`,直接手动传完整三维配置:
|
|
517
|
+
需要自行补齐三维服务地址和认证信息。
|
|
518
|
+
|
|
519
|
+
手动直传完整三维配置时的必填字段:
|
|
468
520
|
|
|
469
521
|
- `autoLoad`
|
|
470
522
|
是否在场景初始化成功后自动加载云 GIS 数据。
|