@zhangdali1996/lr-map-viewer 0.0.11 → 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 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
  ## 安装
@@ -244,6 +245,16 @@ import App from './App.vue'
244
245
  createApp(App).use(LrMapViewerPlugin).mount('#app')
245
246
  ```
246
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
+
247
258
  ## 公开能力
248
259
 
249
260
  组件 Props:
@@ -262,6 +273,21 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
262
273
  是否显示区域显隐面板,默认 `false`。
263
274
  - `showDebugPanel`
264
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
+ ```
265
291
 
266
292
  组件 expose:
267
293
 
@@ -272,6 +298,13 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
272
298
  - `get3dInstance()`
273
299
  - `resize()`
274
300
  - `refreshScene()`
301
+ - `saveView()`
302
+ - `restoreView(viewState)`
303
+ - `initializeDemoPerson()`
304
+ - `startDemoPersonMotion(x, y, z)`
305
+ - `stopDemoPersonMotion()`
306
+ - `toggleDemoPersonMotion(x, y, z)`
307
+ - `focusDemoPerson()`
275
308
  - `moveView(x, y, z)`
276
309
  - `registerModelInfoQuery(callback)`
277
310
 
@@ -280,6 +313,8 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
280
313
  - `switchMode(mode)` 支持在 `2d / 3d` 间切换当前显示引擎。
281
314
  - `get2dInstance()` 返回当前二维 adapter 实例,其中包含 `map`、`options`、`behavior`、`layerTree` 等信息。
282
315
  - `refreshScene()` 仅对三维场景有效。
316
+ - `saveView()` 用于保存当前三维视角快照,返回结果可直接交给 `restoreView(viewState)` 复原。
317
+ - `initializeDemoPerson()`、`startDemoPersonMotion()`、`stopDemoPersonMotion()`、`toggleDemoPersonMotion()`、`focusDemoPerson()` 仅对三维场景有效,用于控制示例人员对象。
283
318
  - `moveView(x, y, z)` 传入的是绝对三维坐标,组件内部会自动换算成相对 `basePoint` 坐标后调用聚焦接口。
284
319
  - `registerModelInfoQuery(callback)` 会在用户点击三维中的模型对象时触发回调。
285
320
  - 模型信息查询返回 4 个字段:`id`、`name`、`layerName`、`position`。
@@ -312,7 +347,14 @@ const map2dConfig = {
312
347
  }
313
348
  ```
314
349
 
315
- 必填字段:
350
+ 推荐接入方式分为两种:
351
+
352
+ - 通过 `credentialKey` 接入:
353
+ 组件会自动补齐 `ygis_url`、`map_server_url/Url`、`ygis_username`、`ygis_password`,此时你通常只需要传业务相关字段,例如 `ygis_dsGuid`、`layerName`、`layerCode`。
354
+ - 不通过 `credentialKey`,直接手动传完整二维配置:
355
+ 需要自行补齐地址和认证信息。
356
+
357
+ 手动直传完整二维配置时的必填字段:
316
358
 
317
359
  - `map2dConfig.options.ygis_dsGuid`
318
360
  二维图纸数据源 guid。
@@ -326,6 +368,7 @@ const map2dConfig = {
326
368
  认证兼容说明:
327
369
 
328
370
  - 如果没有 `token`,则需要同时传入 `map2dConfig.options.ygis_username` 和 `map2dConfig.options.ygis_password`。
371
+ - `map2dConfig.options.map_server_url` 与 `map2dConfig.options.Url` 在组件内部会自动对齐,二者传一个即可。
329
372
  - 当 `map2dConfig.behavior.autoShowLayer` 为 `true` 时,`map2dConfig.options.layerName` 也属于必填项。
330
373
 
331
374
  常用可选字段:
@@ -466,7 +509,14 @@ const lr3dConfig = {
466
509
  }
467
510
  ```
468
511
 
469
- 必填字段:
512
+ 推荐接入方式同样分为两种:
513
+
514
+ - 通过 `credentialKey` 接入:
515
+ 组件会自动补齐 `cloud.server`、`cloud.username`、`cloud.password`,此时你通常只需要传 `autoLoad`、`cloud.dsGuid`、`cloud.basePoint` 以及业务图层参数。
516
+ - 不通过 `credentialKey`,直接手动传完整三维配置:
517
+ 需要自行补齐三维服务地址和认证信息。
518
+
519
+ 手动直传完整三维配置时的必填字段:
470
520
 
471
521
  - `autoLoad`
472
522
  是否在场景初始化成功后自动加载云 GIS 数据。