@zhangdali1996/lr-map-viewer 0.0.6 → 0.0.8
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 +44 -17
- package/dist/lr-map-viewer.css +1 -1
- package/dist/lr-map-viewer.js +1376 -1047
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,6 +48,32 @@ public/
|
|
|
48
48
|
|
|
49
49
|
如果客户项目的静态资源目录不是根路径,需要通过 `lr3dConfig.sdk` 自定义覆盖路径。
|
|
50
50
|
|
|
51
|
+
如果客户项目把龙软静态资源统一挂在某个业务前缀下,也可以只传 `sdk.resourcePrefix`,让组件自动给默认的 `/editorapp` 和 `/resource` 路径补前缀。
|
|
52
|
+
|
|
53
|
+
例如:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const lr3dConfig = {
|
|
57
|
+
sdk: {
|
|
58
|
+
resourcePrefix: 'gkpt',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
会自动解析为:
|
|
64
|
+
|
|
65
|
+
- `/gkpt/editorapp/editorapp.bundle.js`
|
|
66
|
+
- `/gkpt/resource/js/three.min.js`
|
|
67
|
+
- `/gkpt/resource/js/vue.2.6.11.js`
|
|
68
|
+
- `/gkpt/resource/js/element_ui.js`
|
|
69
|
+
- `/gkpt/resource/js/jquery-3.1.1.min.js`
|
|
70
|
+
|
|
71
|
+
说明:
|
|
72
|
+
|
|
73
|
+
- 不传 `sdk.resourcePrefix` 时,默认仍然使用 `/editorapp` 和 `/resource`
|
|
74
|
+
- 支持传 `gkpt`、`/gkpt`、`gkpt/`、`/gkpt/`,最终都会归一化为 `/gkpt`
|
|
75
|
+
- 如果你已经显式传了完整的 `sdk.scriptSrc` 或 `sdk.dependencies[].src`,则建议直接传最终路径
|
|
76
|
+
|
|
51
77
|
## 最小接入示例
|
|
52
78
|
|
|
53
79
|
### 三维示例
|
|
@@ -56,16 +82,12 @@ public/
|
|
|
56
82
|
<script setup>
|
|
57
83
|
import { LrMapViewer } from '@zhangdali1996/lr-map-viewer'
|
|
58
84
|
|
|
85
|
+
const credentialKey = 'your_credential_key'
|
|
86
|
+
|
|
59
87
|
const lr3dConfig = {
|
|
60
88
|
// 是否在场景初始化成功后自动加载云 GIS 数据
|
|
61
89
|
autoLoad: true,
|
|
62
90
|
cloud: {
|
|
63
|
-
// 云 GIS 服务地址
|
|
64
|
-
server: 'https://your-cloud-gis-server/',
|
|
65
|
-
// 云 GIS 用户名
|
|
66
|
-
username: 'your_username',
|
|
67
|
-
// 云 GIS 密码
|
|
68
|
-
password: 'your_password',
|
|
69
91
|
// 数据源 guid
|
|
70
92
|
dsGuid: 'your_ds_guid',
|
|
71
93
|
// 三维场景基点
|
|
@@ -88,7 +110,7 @@ const lr3dConfig = {
|
|
|
88
110
|
|
|
89
111
|
<template>
|
|
90
112
|
<div style="height: 100vh;">
|
|
91
|
-
<LrMapViewer :lr3d-config="lr3dConfig" />
|
|
113
|
+
<LrMapViewer :lr3d-config="lr3dConfig" :credential-key="credentialKey" />
|
|
92
114
|
</div>
|
|
93
115
|
</template>
|
|
94
116
|
```
|
|
@@ -99,6 +121,8 @@ const lr3dConfig = {
|
|
|
99
121
|
<script setup>
|
|
100
122
|
import { LrMapViewer } from '@zhangdali1996/lr-map-viewer'
|
|
101
123
|
|
|
124
|
+
const credentialKey = 'your_credential_key'
|
|
125
|
+
|
|
102
126
|
const map2dConfig = {
|
|
103
127
|
behavior: {
|
|
104
128
|
autoInitLayer: true,
|
|
@@ -107,18 +131,20 @@ const map2dConfig = {
|
|
|
107
131
|
},
|
|
108
132
|
options: {
|
|
109
133
|
ygis_dsGuid: 'your_ds_guid',
|
|
110
|
-
ygis_url: 'https://your-cloud-gis-server/',
|
|
111
|
-
Url: 'https://your-map-server/',
|
|
112
134
|
layerName: 'your_layer_name',
|
|
113
135
|
layerCode: '',
|
|
114
|
-
token: 'your_token',
|
|
115
136
|
},
|
|
116
137
|
}
|
|
117
138
|
</script>
|
|
118
139
|
|
|
119
140
|
<template>
|
|
120
141
|
<div style="height: 100vh;">
|
|
121
|
-
<LrMapViewer
|
|
142
|
+
<LrMapViewer
|
|
143
|
+
mode="2d"
|
|
144
|
+
:modes="['2d']"
|
|
145
|
+
:map2d-config="map2dConfig"
|
|
146
|
+
:credential-key="credentialKey"
|
|
147
|
+
/>
|
|
122
148
|
</div>
|
|
123
149
|
</template>
|
|
124
150
|
```
|
|
@@ -131,22 +157,18 @@ import { ref } from 'vue'
|
|
|
131
157
|
import { LrMapViewer } from '@zhangdali1996/lr-map-viewer'
|
|
132
158
|
|
|
133
159
|
const activeMode = ref('2d')
|
|
160
|
+
const credentialKey = 'your_credential_key'
|
|
161
|
+
|
|
134
162
|
const map2dConfig = {
|
|
135
163
|
options: {
|
|
136
164
|
ygis_dsGuid: 'your_ds_guid',
|
|
137
|
-
ygis_url: 'https://your-cloud-gis-server/',
|
|
138
|
-
Url: 'https://your-map-server/',
|
|
139
165
|
layerName: 'your_layer_name',
|
|
140
|
-
token: 'your_token',
|
|
141
166
|
},
|
|
142
167
|
}
|
|
143
168
|
|
|
144
169
|
const lr3dConfig = {
|
|
145
170
|
autoLoad: true,
|
|
146
171
|
cloud: {
|
|
147
|
-
server: 'https://your-cloud-gis-server/',
|
|
148
|
-
username: 'your_username',
|
|
149
|
-
password: 'your_password',
|
|
150
172
|
dsGuid: 'your_ds_guid',
|
|
151
173
|
basePoint: {
|
|
152
174
|
x: 37517614.46684,
|
|
@@ -165,6 +187,7 @@ const lr3dConfig = {
|
|
|
165
187
|
:modes="['2d', '3d']"
|
|
166
188
|
:map2d-config="map2dConfig"
|
|
167
189
|
:lr3d-config="lr3dConfig"
|
|
190
|
+
:credential-key="credentialKey"
|
|
168
191
|
/>
|
|
169
192
|
</div>
|
|
170
193
|
</template>
|
|
@@ -175,6 +198,7 @@ const lr3dConfig = {
|
|
|
175
198
|
```vue
|
|
176
199
|
<LrMapViewer
|
|
177
200
|
:lr3d-config="lr3dConfig"
|
|
201
|
+
:credential-key="credentialKey"
|
|
178
202
|
:show-region-panel="true"
|
|
179
203
|
:show-debug-panel="true"
|
|
180
204
|
/>
|
|
@@ -216,6 +240,8 @@ createApp(App).use(LrMapViewerPlugin).mount('#app')
|
|
|
216
240
|
二维图纸运行时配置。
|
|
217
241
|
- `lr3dConfig`
|
|
218
242
|
龙软三维运行时配置。
|
|
243
|
+
- `credentialKey`
|
|
244
|
+
内部凭证解密 Key,二维与三维都会使用它解析内置认证信息。
|
|
219
245
|
- `showRegionPanel`
|
|
220
246
|
是否显示区域显隐面板,默认 `false`。
|
|
221
247
|
- `showDebugPanel`
|
|
@@ -456,6 +482,7 @@ const lr3dConfig = {
|
|
|
456
482
|
|
|
457
483
|
- 组件内部仍兼容完整的 `lr3dConfig` 写法。
|
|
458
484
|
- `basePoint` 推荐传入 `{ x, y, z }` 对象。
|
|
485
|
+
- `sdk.resourcePrefix` 可用于统一给默认的 `/editorapp` 与 `/resource` 路径增加业务前缀,例如 `gkpt -> /gkpt/editorapp/...`、`/gkpt/resource/...`。
|
|
459
486
|
- 如果你需要覆盖 SDK 路径、容器参数、初始化参数等高级配置,仍然可以继续传入 `sdk`、`scene`、`initOptions`、`dataSource` 完整结构。
|
|
460
487
|
|
|
461
488
|
## 示例配置
|