@mapgis/webclient-mapboxgl-plugin 17.0.6 → 17.2.0
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 +11 -35
- package/dist/es5/webclient-common.min.js +15 -4
- package/dist/es5/webclient-mapboxgl-plugin.min.js +1 -1
- package/dist/webclient-mapboxgl-plugin-es6.min.js +1 -1
- package/documention/MapViewMapboxgl.html +1233 -8
- package/documention/Popup.html +3 -3
- package/documention/Screenshot.html +0 -11
- package/documention/SketchEditorMapboxgl.html +31 -2
- package/documention/index.html +4 -4
- package/documention/scripts/sideBar.js +16 -2
- package/package.json +3 -4
- package/documention/document_ArcGISVectorTileLayerView.js.html +0 -265
- package/documention/document_EchartsLayerView.js.html +0 -246
- package/documention/document_GraphicsLayerView.js.html +0 -314
- package/documention/document_IGSFeatureLayerView.js.html +0 -218
- package/documention/document_IGSMapImageLayerView.js.html +0 -240
- package/documention/document_IGSTileLayerView.js.html +0 -236
- package/documention/document_IGSVectorTileLayerView.js.html +0 -264
- package/documention/document_MapVLayerView.js.html +0 -247
- package/documention/document_WMSLayerView.js.html +0 -240
- package/documention/document_WMTSLayerView.js.html +0 -234
- package/documention/document_WebTileLayerView.js.html +0 -240
- package/documention/document_support_FeatureRenderView.js.html +0 -682
- package/documention/document_support_MapboxglGraphicsLayer.js.html +0 -1184
- package/documention/document_support_SourceMetaData.js.html +0 -223
- package/documention/document_support_Utils.js.html +0 -624
- package/documention/document_support_mapbox_mapboxCustomUtil.js.html +0 -322
- package/documention/sketchEditor_SketchEditorMapboxgl.js.html +0 -875
- package/documention/util_ConvertRendererToStyleLayerUtil.js.html +0 -844
- package/documention/util_MapboxglFeatureRender.js.html +0 -225
- package/documention/util_MapboxglPlugin.js.html +0 -284
- package/documention/view_MapViewMapboxgl.js.html +0 -1882
- package/documention/view_utils_ArcGISVectorTileLayerUtil.js.html +0 -382
- package/documention/view_utils_EchartsLayerUtil.js.html +0 -194
- package/documention/view_utils_IGSMapImageUtil.js.html +0 -373
- package/documention/view_utils_IGSTileLayerUtil.js.html +0 -285
- package/documention/view_utils_IGSVectorTileLayerUtil.js.html +0 -379
- package/documention/view_utils_MapVLayerUtil.js.html +0 -197
- package/documention/view_utils_Popup.js.html +0 -525
- package/documention/view_utils_Screenshot.js.html +0 -320
- package/documention/view_utils_WMSLayerUtil.js.html +0 -337
- package/documention/view_utils_WMTSLayerUtil.js.html +0 -331
- package/documention/view_utils_WebTileLayerUtil.js.html +0 -284
- package/documention/view_utils_echarts_EchartsLayerPlugin.js.html +0 -419
- package/documention/view_utils_mapV_MapVLayerPlugin.js.html +0 -527
- package/documention/view_utils_mapV_MapvBaseLayer.js.html +0 -477
- package/documention/view_utils_support_rasterLayerUtil.js.html +0 -244
- package/documention/view_utils_support_vectorLayerUtil.js.html +0 -503
|
@@ -1,503 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<!DOCTYPE html>
|
|
4
|
-
<html lang="en">
|
|
5
|
-
|
|
6
|
-
<head>
|
|
7
|
-
|
|
8
|
-
<meta charset="utf-8">
|
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
-
<title>Client for JavaScript view/utils/support/vectorLayerUtil.js</title>
|
|
11
|
-
<!--[if lt IE 9]>
|
|
12
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
-
<![endif]-->
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
|
16
|
-
<link type="text/css" rel="stylesheet" href="">
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</head>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<body class="layout small-header">
|
|
24
|
-
<div id="stickyNavbarOverlay"></div>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<div class="top-nav">
|
|
28
|
-
<div class="inner">
|
|
29
|
-
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
|
30
|
-
<span aria-hidden="true"></span>
|
|
31
|
-
<span aria-hidden="true"></span>
|
|
32
|
-
<span aria-hidden="true"></span>
|
|
33
|
-
</a>
|
|
34
|
-
<div class="logo">
|
|
35
|
-
|
|
36
|
-
<h1> MapGIS Client for JavaScript API</h1>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</div>
|
|
40
|
-
<div class="menu">
|
|
41
|
-
|
|
42
|
-
<div class="navigation">
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<a
|
|
46
|
-
class="link user-link "
|
|
47
|
-
href="/static/modules/common/api/common-mapgis/index.html"
|
|
48
|
-
>
|
|
49
|
-
Common
|
|
50
|
-
</a>
|
|
51
|
-
|
|
52
|
-
<a
|
|
53
|
-
class="link user-link "
|
|
54
|
-
href="/static/modules/cesium/api/cesium-mapgis/index.html"
|
|
55
|
-
>
|
|
56
|
-
Cesium
|
|
57
|
-
</a>
|
|
58
|
-
|
|
59
|
-
<a
|
|
60
|
-
class="link user-link "
|
|
61
|
-
href="/static/modules/mapboxgl/api/mapboxgl-mapgis/index.html"
|
|
62
|
-
>
|
|
63
|
-
MapboxGL
|
|
64
|
-
</a>
|
|
65
|
-
|
|
66
|
-
<a
|
|
67
|
-
class="link user-link "
|
|
68
|
-
href="/static/modules/leaflet/api/leaflet-mapgis/index.html"
|
|
69
|
-
>
|
|
70
|
-
Leaflet
|
|
71
|
-
</a>
|
|
72
|
-
|
|
73
|
-
<a
|
|
74
|
-
class="link user-link "
|
|
75
|
-
href="/static/modules/openlayers/api/openLayers-mapgis/index.html"
|
|
76
|
-
>
|
|
77
|
-
OpenLayers
|
|
78
|
-
</a>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<div id="main">
|
|
88
|
-
<div
|
|
89
|
-
class="sidebar "
|
|
90
|
-
id="sidebarNav"
|
|
91
|
-
>
|
|
92
|
-
<div>
|
|
93
|
-
<span class="mapgis-api-document-span"><a href="index.html">API文档</a></span>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<div class="search-wrapper">
|
|
97
|
-
<input id="search" type="text" placeholder="搜索文档..." class="input">
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<nav>
|
|
101
|
-
|
|
102
|
-
<div class="category"><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">undefined</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Popup.html">Popup</a><span style="display: none;"><p>二维场景信息弹窗(leaflet引擎)
|
|
103
|
-
参考示例:
|
|
104
|
-
<a href='#MapView'>[初始化二维场景视图]</a>
|
|
105
|
-
[ES6引入方式]:<br/>
|
|
106
|
-
import { Popup } from '@mapgis/webclient-leaflet-plugin' <br/>
|
|
107
|
-
自定义样式说明:<br/>
|
|
108
|
-
zondy-popup__content 弹窗容器样式<br/>
|
|
109
|
-
zondy-popup__tip 弹窗对话框箭头样式<br/>
|
|
110
|
-
zondy-popup__header 弹窗头部样式<br/>
|
|
111
|
-
zondy-popup__content 弹窗主体样式<br/>
|
|
112
|
-
zondy-popup__footer 弹窗底部样式<br/></p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">undefined</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="Screenshot.html">Screenshot</a><span style="display: none;"><p>打印工具</p></span></li></ul><div style="font-weight: bold;vertical-align: middle;padding: 0.4rem 0;" class="mapgis-menu-span"><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/m.png" alt="">草图编辑模块</div><ul class="mapgis-sidebar-menus"><li><img style="width: 20px;margin-right: 6px;vertical-align: middle;" src="./styles/c.png" alt=""><a href="SketchEditorMapboxgl.html">SketchEditorMapboxgl</a><span style="display: none;"><p>二维场景草图编辑类<br/>
|
|
113
|
-
<br>[ES5引入方式]:<br/>
|
|
114
|
-
const { SketchEditorMapboxgl } = Zondy <br/>
|
|
115
|
-
[ES6引入方式]:<br/>
|
|
116
|
-
import { SketchEditorMapboxgl } from "@mapgis/webclient-leaflet-plugin" <br/></p></span></li></ul></div>
|
|
117
|
-
|
|
118
|
-
</nav>
|
|
119
|
-
</div>
|
|
120
|
-
<div class="core" id="main-content-wrapper">
|
|
121
|
-
<div class="content">
|
|
122
|
-
<header id="page-title" class="page-title">
|
|
123
|
-
<span class="page-title-main">类名</span>
|
|
124
|
-
<span class="page-title-sub">view/utils/support/vectorLayerUtil.js</span>
|
|
125
|
-
</header>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<section>
|
|
132
|
-
<article>
|
|
133
|
-
<pre class="prettyprint source linenums"><code>/**
|
|
134
|
-
* 设置图层可见性
|
|
135
|
-
* @param {LayerView} layerView 图层视图对象
|
|
136
|
-
* */
|
|
137
|
-
function setVisible(layerView) {
|
|
138
|
-
// 获取矢量瓦片中的所有图层
|
|
139
|
-
const layers = layerView.layer.style.layers
|
|
140
|
-
// 获取地图视图对象
|
|
141
|
-
const innerView = layerView.innerView
|
|
142
|
-
// 循环设置图层可见性
|
|
143
|
-
for (let i = 0; i < layers.length; i++) {
|
|
144
|
-
// 取图层可见性
|
|
145
|
-
const visible = layerView._getLayerViewVisible()
|
|
146
|
-
// 设置图层可见性
|
|
147
|
-
innerView.setLayoutProperty(
|
|
148
|
-
layers[i].id,
|
|
149
|
-
'visibility',
|
|
150
|
-
visible ? 'visible' : 'none'
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* 删除图层
|
|
157
|
-
* @param {LayerView} layerView 图层视图对象
|
|
158
|
-
* */
|
|
159
|
-
function removeLayer(layerView) {
|
|
160
|
-
// 获取矢量瓦片中的所有图层
|
|
161
|
-
const layers = layerView.layer.style.layers
|
|
162
|
-
// 获取矢量瓦片中的所有Source
|
|
163
|
-
const sources = layerView.layer.style.sources
|
|
164
|
-
// 获取地图视图对象
|
|
165
|
-
const innerView = layerView.innerView
|
|
166
|
-
// 先删除图层
|
|
167
|
-
for (let i = 0; i < layers.length; i++) {
|
|
168
|
-
if (innerView.getLayer(layers[i].id)) {
|
|
169
|
-
innerView.removeLayer(layers[i].id)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// 最后删除Source
|
|
173
|
-
Object.keys(sources).forEach((key) => {
|
|
174
|
-
if (innerView.getSource(key)) {
|
|
175
|
-
innerView.removeSource(key)
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* 设置图层透明度
|
|
182
|
-
* @param {LayerView} layerView 图层视图对象
|
|
183
|
-
* */
|
|
184
|
-
function setOpacity(layerView) {
|
|
185
|
-
// 基础图层对象
|
|
186
|
-
const commonLayer = layerView.layer
|
|
187
|
-
// 获取矢量瓦片中的所有图层
|
|
188
|
-
const layers = layerView.layer.style.layers
|
|
189
|
-
// 获取地图视图对象
|
|
190
|
-
const innerView = layerView.innerView
|
|
191
|
-
// 循环设置图层透明度
|
|
192
|
-
for (let i = 0; i < layers.length; i++) {
|
|
193
|
-
// 根据mapbox图层类型设置透明度
|
|
194
|
-
switch (layers[i].type) {
|
|
195
|
-
case 'background':
|
|
196
|
-
innerView.setPaintProperty(
|
|
197
|
-
layers[i].id,
|
|
198
|
-
'background-opacity',
|
|
199
|
-
commonLayer.opacity
|
|
200
|
-
)
|
|
201
|
-
break
|
|
202
|
-
case 'fill':
|
|
203
|
-
default:
|
|
204
|
-
innerView.setPaintProperty(
|
|
205
|
-
layers[i].id,
|
|
206
|
-
'fill-opacity',
|
|
207
|
-
commonLayer.opacity
|
|
208
|
-
)
|
|
209
|
-
break
|
|
210
|
-
case 'line':
|
|
211
|
-
innerView.setPaintProperty(
|
|
212
|
-
layers[i].id,
|
|
213
|
-
'line-opacity',
|
|
214
|
-
commonLayer.opacity
|
|
215
|
-
)
|
|
216
|
-
break
|
|
217
|
-
case 'symbol':
|
|
218
|
-
innerView.setPaintProperty(
|
|
219
|
-
layers[i].id,
|
|
220
|
-
'icon-opacity',
|
|
221
|
-
commonLayer.opacity
|
|
222
|
-
)
|
|
223
|
-
innerView.setPaintProperty(
|
|
224
|
-
layers[i].id,
|
|
225
|
-
'text-opacity',
|
|
226
|
-
commonLayer.opacity
|
|
227
|
-
)
|
|
228
|
-
break
|
|
229
|
-
case 'circle':
|
|
230
|
-
innerView.setPaintProperty(
|
|
231
|
-
layers[i].id,
|
|
232
|
-
'circle-opacity',
|
|
233
|
-
commonLayer.opacity
|
|
234
|
-
)
|
|
235
|
-
break
|
|
236
|
-
case 'sky':
|
|
237
|
-
innerView.setPaintProperty(
|
|
238
|
-
layers[i].id,
|
|
239
|
-
'sky-opacity',
|
|
240
|
-
commonLayer.opacity
|
|
241
|
-
)
|
|
242
|
-
break
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* 获取绘制参数
|
|
249
|
-
* @param {Object} updateContent 事件内容对象
|
|
250
|
-
* @return {Object} 绘制参数
|
|
251
|
-
* */
|
|
252
|
-
function getPaintOptions(updateContent) {
|
|
253
|
-
const args = updateContent.params
|
|
254
|
-
return {
|
|
255
|
-
layerId: args[0],
|
|
256
|
-
paints: args[1]
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* 设置图层的绘制样式属性
|
|
262
|
-
* @param {LayerView} layerView 图层视图对象
|
|
263
|
-
* @param {String} layerId 图层ID
|
|
264
|
-
* @param {Object} options 要改变的样式对象
|
|
265
|
-
* */
|
|
266
|
-
function setPaintProperties(layerView, layerId, options) {
|
|
267
|
-
// 获取地图视图对象
|
|
268
|
-
const innerView = layerView.innerView
|
|
269
|
-
// 图层要存在
|
|
270
|
-
if (innerView.getLayer(layerId) && options instanceof Object) {
|
|
271
|
-
Object.keys(options).forEach((key) => {
|
|
272
|
-
innerView.setPaintProperty(layerId, key, options[key])
|
|
273
|
-
})
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* 设置图层的布局样式属性
|
|
279
|
-
* @param {LayerView} layerView 图层视图对象
|
|
280
|
-
* @param {String} layerId 图层ID
|
|
281
|
-
* @param {Object} options 要改变的样式对象
|
|
282
|
-
* */
|
|
283
|
-
function setLayoutProperties(layerView, layerId, options) {
|
|
284
|
-
// 获取地图视图对象
|
|
285
|
-
const innerView = layerView.innerView
|
|
286
|
-
// 图层要存在
|
|
287
|
-
if (innerView.getLayer(layerId) && options instanceof Object) {
|
|
288
|
-
Object.keys(options).forEach((key) => {
|
|
289
|
-
innerView.setLayoutProperty(layerId, key, options[key])
|
|
290
|
-
})
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* 设置图层的过滤条件
|
|
296
|
-
* @param {IGSTileLayerView} layerView 图层视图对象
|
|
297
|
-
* @param {String} layerId 图层id
|
|
298
|
-
* @param {String} filter 过滤条件
|
|
299
|
-
* */
|
|
300
|
-
function setFilter(layerView, layerId, filter) {
|
|
301
|
-
// 获取地图视图对象
|
|
302
|
-
const innerView = layerView.innerView
|
|
303
|
-
// 设置过滤条件
|
|
304
|
-
if (innerView.getLayer(layerId)) {
|
|
305
|
-
innerView.setFilter(layerId, filter)
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* 设置图层显示范围
|
|
311
|
-
* @param {IGSTileLayerView} layerView 图层视图对象
|
|
312
|
-
* @param {String} layerId 图层id
|
|
313
|
-
* @param {Number} minZoom 最小显示范围
|
|
314
|
-
* @param {Number} maxZoom 最大显示范围
|
|
315
|
-
* */
|
|
316
|
-
function setLayerZoomRange(layerView, layerId, minZoom, maxZoom) {
|
|
317
|
-
// 获取地图视图对象
|
|
318
|
-
const innerView = layerView.innerView
|
|
319
|
-
// 设置显示范围
|
|
320
|
-
if (innerView.getLayer(layerId)) {
|
|
321
|
-
innerView.setLayerZoomRange(layerId, minZoom, maxZoom)
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* 添加矢量瓦片的Source
|
|
327
|
-
* @param {IGSTileLayerView} layerView 图层视图对象
|
|
328
|
-
* */
|
|
329
|
-
function addSources(layerView) {
|
|
330
|
-
// 添加矢量瓦片的Source
|
|
331
|
-
const sources = layerView.layer.style.sources
|
|
332
|
-
Object.keys(sources).forEach((key) => {
|
|
333
|
-
// 添加Source
|
|
334
|
-
layerView.innerView.addSource(
|
|
335
|
-
// SourceID
|
|
336
|
-
key,
|
|
337
|
-
// Source参数
|
|
338
|
-
sources[key]
|
|
339
|
-
)
|
|
340
|
-
})
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* 添加矢量瓦片的Layer
|
|
345
|
-
* @param {IGSTileLayerView} layerView 图层视图对象
|
|
346
|
-
*/
|
|
347
|
-
function addLayers(layerView) {
|
|
348
|
-
// 添加矢量瓦片的Layer
|
|
349
|
-
const layers = layerView.layer.style.layers
|
|
350
|
-
for (let i = 0; i < layers.length; i++) {
|
|
351
|
-
// 取图层可见性
|
|
352
|
-
const visible = layerView._getLayerViewVisible()
|
|
353
|
-
// 设置全图层可见性
|
|
354
|
-
if (layers[i] && layers[i].layout && layers[i].layout instanceof Object) {
|
|
355
|
-
layers[i].layout.visibility = visible ? 'visible' : 'none'
|
|
356
|
-
}
|
|
357
|
-
// 设置全图层透明度
|
|
358
|
-
if (layers[i] && layers[i].paint && layers[i].paint instanceof Object) {
|
|
359
|
-
// 根据mapbox图层类型设置透明度,可能有多个字段名
|
|
360
|
-
const _opacityKeys = []
|
|
361
|
-
switch (layers[i].type) {
|
|
362
|
-
case 'background':
|
|
363
|
-
_opacityKeys.push('background-opacity')
|
|
364
|
-
break
|
|
365
|
-
case 'fill':
|
|
366
|
-
default:
|
|
367
|
-
_opacityKeys.push('fill-opacity')
|
|
368
|
-
break
|
|
369
|
-
case 'line':
|
|
370
|
-
_opacityKeys.push('line-opacity')
|
|
371
|
-
break
|
|
372
|
-
case 'symbol':
|
|
373
|
-
_opacityKeys.push('icon-opacity')
|
|
374
|
-
_opacityKeys.push('text-opacity')
|
|
375
|
-
break
|
|
376
|
-
case 'circle':
|
|
377
|
-
_opacityKeys.push('circle-opacity')
|
|
378
|
-
break
|
|
379
|
-
case 'sky':
|
|
380
|
-
_opacityKeys.push('sky-opacity')
|
|
381
|
-
break
|
|
382
|
-
}
|
|
383
|
-
for (let j = 0; j < _opacityKeys.length; j++) {
|
|
384
|
-
layers[i].paint[_opacityKeys[j]] = layerView.layer.opacity
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
layerView.innerView.addLayer(layers[i])
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* 获取矢量瓦片的所有子图层
|
|
393
|
-
* @param {IGSTileLayerView} layerView 图层视图对象
|
|
394
|
-
* @return {Array<Object>} 矢量瓦片的子图层
|
|
395
|
-
* */
|
|
396
|
-
function getLayers(layerView) {
|
|
397
|
-
const layers = layerView.layer.style.layers
|
|
398
|
-
const subLayers = []
|
|
399
|
-
for (let i = 0; i < layers.length; i++) {
|
|
400
|
-
subLayers.push(layerView.innerView.getLayer(layers[i].id))
|
|
401
|
-
}
|
|
402
|
-
return subLayers
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* 更新所有矢量瓦片子图层
|
|
407
|
-
* @param {IGSTileLayerView} layerView 图层视图对象
|
|
408
|
-
* */
|
|
409
|
-
function updateStyleLayer(layerView) {
|
|
410
|
-
// 先获取地图视图的样式
|
|
411
|
-
const mapStyle = layerView.innerView.getStyle()
|
|
412
|
-
// 真实的图层对象
|
|
413
|
-
const innerLayer = layerView.innerLayer
|
|
414
|
-
// 更新后的图层对象
|
|
415
|
-
const layers = layerView.layer.style.layers
|
|
416
|
-
// 获取改变前的第一个矢量瓦片子图层的位置
|
|
417
|
-
let beganIndex = undefined
|
|
418
|
-
for (let i = 0; i < mapStyle.layers.length; i++) {
|
|
419
|
-
if (mapStyle.layers[i].id === innerLayer[0].id) {
|
|
420
|
-
beganIndex = i
|
|
421
|
-
break
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
// 获取改变前的最后一个矢量瓦片子图层的位置
|
|
425
|
-
let endIndex = undefined
|
|
426
|
-
for (let i = 0; i < mapStyle.layers.length; i++) {
|
|
427
|
-
if (mapStyle.layers[i].id === innerLayer[innerLayer.length - 1].id) {
|
|
428
|
-
endIndex = i
|
|
429
|
-
break
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
// 截取之前的数组
|
|
433
|
-
const layersBefore = mapStyle.layers.slice(0, beganIndex)
|
|
434
|
-
// 截取之后的数组
|
|
435
|
-
const layersAfter = mapStyle.layers.slice(
|
|
436
|
-
endIndex,
|
|
437
|
-
mapStyle.layers.length - 1
|
|
438
|
-
)
|
|
439
|
-
// 开始替换数组
|
|
440
|
-
mapStyle.layers = layersBefore.concat(layers).concat(layersAfter)
|
|
441
|
-
// 强制更新地图视图
|
|
442
|
-
if (layerView.innerView._update) {
|
|
443
|
-
layerView.innerView._update()
|
|
444
|
-
} else if (layerView.innerView.update) {
|
|
445
|
-
layerView.innerView.update()
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
export {
|
|
450
|
-
setVisible,
|
|
451
|
-
removeLayer,
|
|
452
|
-
setOpacity,
|
|
453
|
-
getPaintOptions,
|
|
454
|
-
setPaintProperties,
|
|
455
|
-
setLayoutProperties,
|
|
456
|
-
setFilter,
|
|
457
|
-
setLayerZoomRange,
|
|
458
|
-
addSources,
|
|
459
|
-
addLayers,
|
|
460
|
-
getLayers,
|
|
461
|
-
updateStyleLayer
|
|
462
|
-
}
|
|
463
|
-
</code></pre>
|
|
464
|
-
</article>
|
|
465
|
-
</section>
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
</div>
|
|
471
|
-
|
|
472
|
-
<footer class="footer">
|
|
473
|
-
<div class="content has-text-centered">
|
|
474
|
-
<p>文档生成<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a></p>
|
|
475
|
-
<p class="sidebar-created-by">
|
|
476
|
-
<a href="http://www.smaryun.com" target="_blank">司马云</a> <span>© 2023 云生态圈</span>
|
|
477
|
-
<a href="http://192.168.82.89:8086/#/index" target="_blank">MapGIS Client for JavaScript</a>
|
|
478
|
-
</p>
|
|
479
|
-
</div>
|
|
480
|
-
</footer>
|
|
481
|
-
|
|
482
|
-
</div>
|
|
483
|
-
<div id="side-nav" class="side-nav">
|
|
484
|
-
<div style="margin-bottom: 10px;">
|
|
485
|
-
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#page-title">构造函数</a>
|
|
486
|
-
</div>
|
|
487
|
-
<div style="margin-bottom: 10px;">
|
|
488
|
-
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#member">成员变量</a>
|
|
489
|
-
</div>
|
|
490
|
-
<div style="margin-bottom: 10px;">
|
|
491
|
-
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#function">方法</a>
|
|
492
|
-
</div>
|
|
493
|
-
<div>
|
|
494
|
-
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#event">事件</a>
|
|
495
|
-
</div>
|
|
496
|
-
</div>
|
|
497
|
-
</div>
|
|
498
|
-
<script src="scripts/linenumber.js"> </script>
|
|
499
|
-
|
|
500
|
-
<script src="scripts/search.js"> </script>
|
|
501
|
-
|
|
502
|
-
</body>
|
|
503
|
-
</html>
|