@mapgis/webclient-mapboxgl-plugin 10.3.4 → 17.0.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 +51 -124
- package/dist/es5/webclient-common.min.js +90 -0
- package/dist/es5/webclient-mapboxgl-plugin.min.js +1 -0
- package/dist/webclient-mapboxgl-plugin-es6.min.js +1 -0
- package/documention/EchartsLayer.html +379 -0
- package/documention/MapViewMapboxgl.html +3587 -0
- package/documention/Popup.html +1523 -0
- package/documention/Screenshot.html +1089 -0
- package/documention/SketchEditorMapboxgl.html +3383 -0
- package/documention/document_ArcGISVectorTileLayerView.js.html +265 -0
- package/documention/document_EchartsLayerView.js.html +246 -0
- package/documention/document_GraphicsLayerView.js.html +314 -0
- package/documention/document_IGSFeatureLayerView.js.html +218 -0
- package/documention/document_IGSMapImageLayerView.js.html +240 -0
- package/documention/document_IGSTileLayerView.js.html +236 -0
- package/documention/document_IGSVectorTileLayerView.js.html +264 -0
- package/documention/document_MapVLayerView.js.html +247 -0
- package/documention/document_WMSLayerView.js.html +240 -0
- package/documention/document_WMTSLayerView.js.html +234 -0
- package/documention/document_WebTileLayerView.js.html +240 -0
- package/documention/document_support_FeatureRenderView.js.html +682 -0
- package/documention/document_support_MapboxglGraphicsLayer.js.html +1184 -0
- package/documention/document_support_SourceMetaData.js.html +223 -0
- package/documention/document_support_Utils.js.html +624 -0
- package/documention/document_support_mapbox_mapboxCustomUtil.js.html +322 -0
- package/documention/global.html +252 -0
- package/documention/index.html +251 -0
- package/documention/module-%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%8F%AF%E8%A7%86%E5%8C%96.MapvLayer.html +445 -0
- package/documention/scripts/app.min.js +1 -0
- package/documention/scripts/linenumber.js +26 -0
- package/documention/scripts/search.js +45 -0
- package/documention/scripts/sideBar.js +11 -0
- package/documention/sketchEditor_SketchEditorMapboxgl.js.html +875 -0
- package/documention/styles/anchor.png +0 -0
- package/documention/styles/app.min.css +1 -0
- package/documention/styles/c.png +0 -0
- package/documention/styles/iframe.css +29 -0
- package/documention/styles/m.png +0 -0
- package/documention/styles/prettify-jsdoc.css +111 -0
- package/documention/styles/prettify-tomorrow.css +132 -0
- package/documention/styles/reset.css +44 -0
- package/documention/styles/up-arrow.png +0 -0
- package/documention/tutorial-1./345/277/253/351/200/237/345/205/245/351/227/250.html +165 -0
- package/documention/util_ConvertRendererToStyleLayerUtil.js.html +844 -0
- package/documention/util_MapboxglFeatureRender.js.html +225 -0
- package/documention/util_MapboxglPlugin.js.html +284 -0
- package/documention/view_MapViewMapboxgl.js.html +1882 -0
- package/documention/view_utils_ArcGISVectorTileLayerUtil.js.html +382 -0
- package/documention/view_utils_EchartsLayerUtil.js.html +194 -0
- package/documention/view_utils_IGSMapImageUtil.js.html +373 -0
- package/documention/view_utils_IGSTileLayerUtil.js.html +285 -0
- package/documention/view_utils_IGSVectorTileLayerUtil.js.html +379 -0
- package/documention/view_utils_MapVLayerUtil.js.html +197 -0
- package/documention/view_utils_Popup.js.html +525 -0
- package/documention/view_utils_Screenshot.js.html +320 -0
- package/documention/view_utils_WMSLayerUtil.js.html +337 -0
- package/documention/view_utils_WMTSLayerUtil.js.html +331 -0
- package/documention/view_utils_WebTileLayerUtil.js.html +284 -0
- package/documention/view_utils_echarts_EchartsLayerPlugin.js.html +419 -0
- package/documention/view_utils_mapV_MapVLayerPlugin.js.html +527 -0
- package/documention/view_utils_mapV_MapvBaseLayer.js.html +477 -0
- package/documention/view_utils_support_rasterLayerUtil.js.html +244 -0
- package/documention/view_utils_support_vectorLayerUtil.js.html +503 -0
- package/package.json +20 -20
- package/core/Base.js +0 -15
- package/core/index.js +0 -5
- package/index.js +0 -6
- package/overlay/D3Layer.js +0 -108
- package/overlay/EchartsLayer.js +0 -242
- package/overlay/ElsCubeLayer.js +0 -125
- package/overlay/MapvLayer.js +0 -296
- package/overlay/StreamLayer.js +0 -83
- package/overlay/TimeSpaceCubeLayer.js +0 -135
- package/overlay/dthree/mapbox-d3.css +0 -9
- package/overlay/echarts/MapCoordSys.js +0 -105
- package/overlay/echarts/MapModel.js +0 -0
- package/overlay/echarts/MapView.js +0 -0
- package/overlay/echarts/index.js +0 -4
- package/overlay/index.js +0 -31
- package/overlay/mapv/MapvBaseLayer.js +0 -299
- package/overlay/mapv/index.js +0 -5
- package/overlay/stream/GeojsonStreamLayer.js +0 -135
- package/overlay/stream/MapvStreamLayer.js +0 -79
- package/overlay/stream/index.js +0 -3
- package/overlay/stream/popup.css +0 -31
- package/service/index.js +0 -1
- package/service/socket/ISocketService.js +0 -121
- package/service/socket/SocketEvent.js +0 -50
- package/service/socket/SocketService.js +0 -90
- package/util/Evented.js +0 -295
- package/util/Util.js +0 -348
|
@@ -0,0 +1,527 @@
|
|
|
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/mapV/MapVLayerPlugin.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/mapV/MapVLayerPlugin.js</span>
|
|
125
|
+
</header>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
<section>
|
|
132
|
+
<article>
|
|
133
|
+
<pre class="prettyprint source linenums"><code>import mapboxgl from '@mapgis/mapbox-gl'
|
|
134
|
+
import MapvBaseLayer from './MapvBaseLayer'
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @origin author kyle / http://nikai.us/
|
|
138
|
+
* @author 基础平台/创新中心 潘卓然 ParnDeedlit
|
|
139
|
+
* @class module:客户端可视化.MapvLayer
|
|
140
|
+
* @classdesc 基于mapboxgl的Layer对象进行的拓展
|
|
141
|
+
* @param map - {Object} 传入的mapboxgl的地图对象
|
|
142
|
+
* @param dataset - {MapvDataSet} 传入的mapv的属性。 <br>
|
|
143
|
+
* @param mapvoption - {MapvOption} 可选参数。<br>
|
|
144
|
+
* @see https://github.com/huiyan-fe/mapv/blob/master/API.md
|
|
145
|
+
* @example
|
|
146
|
+
* var options = {
|
|
147
|
+
size: 13,
|
|
148
|
+
gradient: {
|
|
149
|
+
0.25: "rgb(0,0,255)",
|
|
150
|
+
0.55: "rgb(0,255,0)",
|
|
151
|
+
0.85: "yellow",
|
|
152
|
+
1.0: "rgb(255,0,0)"
|
|
153
|
+
},
|
|
154
|
+
max: 60,
|
|
155
|
+
animation: {
|
|
156
|
+
type: 'time',
|
|
157
|
+
stepsRange: {
|
|
158
|
+
start: 0,
|
|
159
|
+
end: 100
|
|
160
|
+
},
|
|
161
|
+
trails: 10,
|
|
162
|
+
duration: 4,
|
|
163
|
+
},
|
|
164
|
+
draw: 'heatmap'
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var mapvLayer = new mapboxgl.zondy.MapvLayer(map, dataSet, options);
|
|
168
|
+
*/
|
|
169
|
+
class MapvLayer {
|
|
170
|
+
constructor(map, dataSet, mapVOptions) {
|
|
171
|
+
this.map = map
|
|
172
|
+
this.layerID = mapVOptions.layerID
|
|
173
|
+
delete mapVOptions['layerID']
|
|
174
|
+
this.mapvBaseLayer = new MapvBaseLayer(map, dataSet, mapVOptions, this)
|
|
175
|
+
this.mapVOptions = mapVOptions
|
|
176
|
+
|
|
177
|
+
this.initDevicePixelRatio()
|
|
178
|
+
|
|
179
|
+
this.canvas = this._createCanvas()
|
|
180
|
+
|
|
181
|
+
this.render = this.render.bind(this)
|
|
182
|
+
|
|
183
|
+
this.bindEvent()
|
|
184
|
+
|
|
185
|
+
this.mapContainer = map.getCanvasContainer()
|
|
186
|
+
this.mapContainer.appendChild(this.canvas)
|
|
187
|
+
// this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
|
|
188
|
+
|
|
189
|
+
this._reset()
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
initDevicePixelRatio() {
|
|
193
|
+
this.devicePixelRatio = window.devicePixelRatio || 1
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// -----------------------------------Event Methods----------------------------------------
|
|
197
|
+
bindEvent() {
|
|
198
|
+
const map = this.map
|
|
199
|
+
// 下面几个是mapboxgl专属事件,clickEvent和mousemoveEvent是mapv内部自带的方法不放出来
|
|
200
|
+
this.innerMoveStart = this.moveStartEvent.bind(this)
|
|
201
|
+
this.innerMoveEnd = this.moveEndEvent.bind(this)
|
|
202
|
+
|
|
203
|
+
this.innnerZoomStart = this.zoomStartEvent.bind(this)
|
|
204
|
+
this.innnerZoomEnd = this.zoomEndEvent.bind(this)
|
|
205
|
+
|
|
206
|
+
this.innnerRotateStart = this.rotateStartEvent.bind(this)
|
|
207
|
+
this.innnerRotateEnd = this.rotateEndEvent.bind(this)
|
|
208
|
+
|
|
209
|
+
this.innerResize = this.resizeEvent.bind(this)
|
|
210
|
+
|
|
211
|
+
this.innerRemove = this.removeEvent.bind(this)
|
|
212
|
+
|
|
213
|
+
map.on('resize', this.innerResize)
|
|
214
|
+
|
|
215
|
+
map.on('zoomstart', this.innnerZoomStart)
|
|
216
|
+
map.on('zoomend', this.innnerZoomEnd)
|
|
217
|
+
|
|
218
|
+
map.on('rotatestart', this.innnerRotateStart)
|
|
219
|
+
map.on('rotateend', this.innnerRotateEnd)
|
|
220
|
+
|
|
221
|
+
map.on('movestart', this.innerMoveStart)
|
|
222
|
+
map.on('moveend', this.innerMoveEnd)
|
|
223
|
+
|
|
224
|
+
this.map.on('remove', this.innerRemove)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
unbindEvent() {
|
|
228
|
+
const map = this.map
|
|
229
|
+
map.off('resize', this.innerResize)
|
|
230
|
+
|
|
231
|
+
map.off('zoomstart', this.innnerZoomStart)
|
|
232
|
+
map.off('zoomend', this.innnerZoomEnd)
|
|
233
|
+
|
|
234
|
+
map.off('rotatestart', this.innnerRotateStart)
|
|
235
|
+
map.off('rotateend', this.innnerRotateEnd)
|
|
236
|
+
|
|
237
|
+
map.off('movestart', this.innerMoveStart)
|
|
238
|
+
map.off('moveend', this.innerMoveEnd)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
moveStartEvent() {
|
|
242
|
+
this.mapvBaseLayer.animatorMovestartEvent()
|
|
243
|
+
this._unvisiable()
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
moveEndEvent() {
|
|
247
|
+
this.mapvBaseLayer.animatorMoveendEvent()
|
|
248
|
+
this._reset()
|
|
249
|
+
this._visiable()
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
zoomStartEvent() {
|
|
253
|
+
this._unvisiable()
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
zoomEndEvent() {
|
|
257
|
+
this._unvisiable()
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
rotateStartEvent() {
|
|
261
|
+
this.mapvBaseLayer.animatorMovestartEvent()
|
|
262
|
+
this._unvisiable()
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
rotateEndEvent() {
|
|
266
|
+
this.mapvBaseLayer.animatorMoveendEvent()
|
|
267
|
+
this._reset()
|
|
268
|
+
this._visiable()
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
resizeEvent() {
|
|
272
|
+
this._reset()
|
|
273
|
+
this._visiable()
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
removeEvent() {
|
|
277
|
+
this.mapContainer.removeChild(this.canvas)
|
|
278
|
+
}
|
|
279
|
+
// -----------------------------------Event Methods----------------------------------------
|
|
280
|
+
|
|
281
|
+
// -----------------------------------Start Data Operation---------------------------------
|
|
282
|
+
/**
|
|
283
|
+
* 增加数据
|
|
284
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.addData
|
|
285
|
+
*
|
|
286
|
+
* @param data - {Array} 数据.
|
|
287
|
+
* @param options - {Object} 只做额外增加的字段作用
|
|
288
|
+
*/
|
|
289
|
+
addData(data, options) {
|
|
290
|
+
this.mapvBaseLayer.addData(data, options)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 更新数据
|
|
295
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.updateData
|
|
296
|
+
*
|
|
297
|
+
* @param data - {Array} 数据.
|
|
298
|
+
* @param options - {Object} 只做额外增加的字段作用
|
|
299
|
+
*/
|
|
300
|
+
updateData(data, options) {
|
|
301
|
+
this.mapvBaseLayer.updateData(data, options)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
getData() {
|
|
305
|
+
if (this.mapvBaseLayer) {
|
|
306
|
+
this.dataSet = this.mapvBaseLayer.getData()
|
|
307
|
+
}
|
|
308
|
+
return this.dataSet
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.removeData
|
|
313
|
+
* @param filter - {Function} 过滤函数,返回true的保留
|
|
314
|
+
* @description 移除满足过滤条件的数据
|
|
315
|
+
* @example
|
|
316
|
+
* filter: function(item){
|
|
317
|
+
if (item.count > 10 && item.count < 50) {
|
|
318
|
+
return true;
|
|
319
|
+
} else {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
*/
|
|
324
|
+
removeData(filter) {
|
|
325
|
+
this.mapvBaseLayer && this.mapvBaseLayer.removeData(filter)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.removeAllData
|
|
330
|
+
* @description 移除全部数据
|
|
331
|
+
*/
|
|
332
|
+
removeAllData() {
|
|
333
|
+
this.mapvBaseLayer.clearData()
|
|
334
|
+
}
|
|
335
|
+
// -----------------------------------End Data Operation---------------------------------
|
|
336
|
+
|
|
337
|
+
_visiable() {
|
|
338
|
+
this.canvas.style.display = 'block'
|
|
339
|
+
return this
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
_unvisiable() {
|
|
343
|
+
this.canvas.style.display = 'none'
|
|
344
|
+
return this
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
_createCanvas() {
|
|
348
|
+
const canvas = document.createElement('canvas')
|
|
349
|
+
const devicePixelRatio = this.devicePixelRatio
|
|
350
|
+
canvas.id = this.layerID
|
|
351
|
+
canvas.style.position = 'absolute'
|
|
352
|
+
canvas.style.top = '0px'
|
|
353
|
+
canvas.style.left = '0px'
|
|
354
|
+
canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio
|
|
355
|
+
canvas.height =
|
|
356
|
+
parseInt(this.map.getCanvas().style.height) * devicePixelRatio
|
|
357
|
+
if (!this.mapVOptions.context || this.mapVOptions.context == '2d') {
|
|
358
|
+
canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio)
|
|
359
|
+
}
|
|
360
|
+
canvas.style.width = this.map.getCanvas().style.width
|
|
361
|
+
canvas.style.height = this.map.getCanvas().style.height
|
|
362
|
+
return canvas
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
_reset() {
|
|
366
|
+
if (this.canvas == null) {
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
this.resizeCanvas()
|
|
370
|
+
this.fixPosition()
|
|
371
|
+
this.onResize()
|
|
372
|
+
this.render()
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
draw() {
|
|
376
|
+
return this._reset()
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* 显示图层
|
|
381
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.show
|
|
382
|
+
*/
|
|
383
|
+
show() {
|
|
384
|
+
this._visiable()
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* 隐藏图层
|
|
389
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.hide
|
|
390
|
+
*/
|
|
391
|
+
hide() {
|
|
392
|
+
this._unvisiable()
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* 更新图层
|
|
397
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.update
|
|
398
|
+
* @param opt.data - {Array} 需要更新的数据
|
|
399
|
+
* @param opt.options - {Object} 需要更新的样式
|
|
400
|
+
*/
|
|
401
|
+
update(opt) {
|
|
402
|
+
if (opt == undefined) {
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
this.updateData(opt.data, opt.options)
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
resizeCanvas() {
|
|
409
|
+
this.mapContainer.style.perspective = `${this.map.transform.cameraToCenterDistance}px`
|
|
410
|
+
if (this.canvas == undefined || this.canvas == null) return
|
|
411
|
+
const canvas = this.canvas
|
|
412
|
+
const devicePixelRatio = this.devicePixelRatio
|
|
413
|
+
canvas.style.position = 'absolute'
|
|
414
|
+
canvas.style.top = '0px'
|
|
415
|
+
canvas.style.left = '0px'
|
|
416
|
+
canvas.width = parseInt(this.map.getCanvas().style.width) * devicePixelRatio
|
|
417
|
+
canvas.height =
|
|
418
|
+
parseInt(this.map.getCanvas().style.height) * devicePixelRatio
|
|
419
|
+
// canvas.style.width = this.map.getCanvas().style.width;
|
|
420
|
+
// canvas.style.height = this.map.getCanvas().style.height;
|
|
421
|
+
if (!this.mapVOptions.context || this.mapVOptions.context == '2d') {
|
|
422
|
+
canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio)
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
fixPosition() {}
|
|
427
|
+
|
|
428
|
+
onResize() {}
|
|
429
|
+
|
|
430
|
+
originPosition() {
|
|
431
|
+
this.originPitch = this.map.getPitch()
|
|
432
|
+
this.originBearing = this.map.getBearing()
|
|
433
|
+
const origin = this.map.project(new mapboxgl.LngLat(0, 0))
|
|
434
|
+
this.originX = origin.x
|
|
435
|
+
this.originY = origin.y
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
render() {
|
|
439
|
+
if (this.mapvBaseLayer == undefined) return
|
|
440
|
+
this.mapvBaseLayer._canvasUpdate()
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
moveTo(layerID, before) {
|
|
444
|
+
const layer = document.getElementById(this.layerID)
|
|
445
|
+
before = before !== undefined ? before : true
|
|
446
|
+
if (before) {
|
|
447
|
+
const beforeLayer = document.getElementById(layerID)
|
|
448
|
+
if (layer && beforeLayer) {
|
|
449
|
+
beforeLayer.parentNode.insertBefore(layer, beforeLayer)
|
|
450
|
+
}
|
|
451
|
+
return
|
|
452
|
+
}
|
|
453
|
+
const nextLayer = document.getElementById(layerID)
|
|
454
|
+
if (layer) {
|
|
455
|
+
if (nextLayer.nextSibling) {
|
|
456
|
+
nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling)
|
|
457
|
+
return
|
|
458
|
+
}
|
|
459
|
+
nextLayer.parentNode.appendChild(layer)
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* 移除图层,清空所有的事件与数据,与destroy效果一致,保持接口与mapboxgl本身一致
|
|
465
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.remove
|
|
466
|
+
*/
|
|
467
|
+
remove() {
|
|
468
|
+
this.removeAllData()
|
|
469
|
+
this.unbindEvent()
|
|
470
|
+
this.mapContainer.removeChild(this.canvas)
|
|
471
|
+
this.disposeFlag = true
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* 销毁图层,清空所有的事件与数据,与remove效果一致
|
|
476
|
+
* @function mapboxgl.zondy.MapvLayer.prototype.destroy
|
|
477
|
+
*/
|
|
478
|
+
destroy() {
|
|
479
|
+
this.removeAllData()
|
|
480
|
+
this.unbindEvent()
|
|
481
|
+
this.mapContainer.removeChild(this.canvas)
|
|
482
|
+
this.disposeFlag = true
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export default MapvLayer
|
|
487
|
+
</code></pre>
|
|
488
|
+
</article>
|
|
489
|
+
</section>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
<footer class="footer">
|
|
497
|
+
<div class="content has-text-centered">
|
|
498
|
+
<p>文档生成<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a></p>
|
|
499
|
+
<p class="sidebar-created-by">
|
|
500
|
+
<a href="http://www.smaryun.com" target="_blank">司马云</a> <span>© 2023 云生态圈</span>
|
|
501
|
+
<a href="http://192.168.82.89:8086/#/index" target="_blank">MapGIS Client for JavaScript</a>
|
|
502
|
+
</p>
|
|
503
|
+
</div>
|
|
504
|
+
</footer>
|
|
505
|
+
|
|
506
|
+
</div>
|
|
507
|
+
<div id="side-nav" class="side-nav">
|
|
508
|
+
<div style="margin-bottom: 10px;">
|
|
509
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#page-title">构造函数</a>
|
|
510
|
+
</div>
|
|
511
|
+
<div style="margin-bottom: 10px;">
|
|
512
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#member">成员变量</a>
|
|
513
|
+
</div>
|
|
514
|
+
<div style="margin-bottom: 10px;">
|
|
515
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#function">方法</a>
|
|
516
|
+
</div>
|
|
517
|
+
<div>
|
|
518
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#event">事件</a>
|
|
519
|
+
</div>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
<script src="scripts/linenumber.js"> </script>
|
|
523
|
+
|
|
524
|
+
<script src="scripts/search.js"> </script>
|
|
525
|
+
|
|
526
|
+
</body>
|
|
527
|
+
</html>
|