@mapgis/webclient-mapboxgl-plugin 10.3.3 → 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 -7
- 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 -298
- package/overlay/StreamLayer.js +0 -86
- 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/SocketService.js +0 -90
|
@@ -0,0 +1,477 @@
|
|
|
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/MapvBaseLayer.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/MapvBaseLayer.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
|
+
|
|
135
|
+
const mapv = window.mapv || {}
|
|
136
|
+
const { baiduMapLayer, DataSet } = mapv
|
|
137
|
+
|
|
138
|
+
const BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @private
|
|
142
|
+
* @class MapvBaseLayer
|
|
143
|
+
* @classdesc MapV图层渲染
|
|
144
|
+
* @param map - {string} 地图
|
|
145
|
+
* @param layer -{Object} 图层
|
|
146
|
+
* @param dataSet -{Object} 数据集
|
|
147
|
+
* @param options -{Object} 交互时所需可选参数。
|
|
148
|
+
* @extends BaseLayer 百度的mapv导出的baiduMapLayer
|
|
149
|
+
*/
|
|
150
|
+
class MapvBaseLayer extends BaseLayer {
|
|
151
|
+
constructor(map, dataSet, options, mapboxLayer) {
|
|
152
|
+
super(map, dataSet, options)
|
|
153
|
+
|
|
154
|
+
if (!BaseLayer) return
|
|
155
|
+
|
|
156
|
+
this.map = map // 此处的map是外面传入的mapboxgl的map对象
|
|
157
|
+
this.dataSet = dataSet
|
|
158
|
+
|
|
159
|
+
const self = this
|
|
160
|
+
const data = null
|
|
161
|
+
options = options || {}
|
|
162
|
+
|
|
163
|
+
self.init(options)
|
|
164
|
+
self.argCheck(options)
|
|
165
|
+
|
|
166
|
+
this.initDevicePixelRatio()
|
|
167
|
+
|
|
168
|
+
this.canvasLayer = mapboxLayer
|
|
169
|
+
|
|
170
|
+
this.stopAniamation = false
|
|
171
|
+
this.animation = options.animation
|
|
172
|
+
|
|
173
|
+
// this.clickEvent = this.clickEvent.bind(this);
|
|
174
|
+
this.mousemoveEvent = this.mousemoveEvent.bind(this)
|
|
175
|
+
|
|
176
|
+
this.bindEvent()
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @function mapboxgl.zondy.MapvBaseLayer.prototype.initDevicePixelRatio
|
|
181
|
+
* @description window.devicePixelRatio是设备上物理像素和设备独立像素(device-independent pixels (dips))的比例。
|
|
182
|
+
* 公式表示就是:window.devicePixelRatio = 物理像素 / dips,该函数主要应用与移动设备
|
|
183
|
+
*/
|
|
184
|
+
initDevicePixelRatio() {
|
|
185
|
+
this.devicePixelRatio = window.devicePixelRatio || 1
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @function mapboxgl.zondy.MapvBaseLayer.prototype.clickEvent
|
|
190
|
+
* @description 百度mapv原本的事件只有clickEvent和mousemoveEvent
|
|
191
|
+
* @param e 点击事件对象 latlng, layerPoint, containerPoint, originalEvent
|
|
192
|
+
* @example
|
|
193
|
+
* //mapv.map.BaseLayer.clickEvent
|
|
194
|
+
* clickEvent(pixel, e) {
|
|
195
|
+
* var dataItem = this.isPointInPath(this.getContext(), pixel);
|
|
196
|
+
* if (dataItem) {
|
|
197
|
+
* this.options.methods.click(dataItem, e);
|
|
198
|
+
* } else {
|
|
199
|
+
* this.options.methods.click(null, e);
|
|
200
|
+
* }
|
|
201
|
+
* }
|
|
202
|
+
*/
|
|
203
|
+
clickEvent(e) {
|
|
204
|
+
const pixel = e.point
|
|
205
|
+
super.clickEvent(pixel, e)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @function mapboxgl.zondy.MapvBaseLayer.prototype.mousemoveEvent
|
|
210
|
+
* @description 百度mapv原本的事件只有clickEvent和mousemoveEvent
|
|
211
|
+
* @param e 点击事件对象 latlng, layerPoint, containerPoint, originalEvent
|
|
212
|
+
* @example mapv.map.BaseLayer.mousemoveEvent
|
|
213
|
+
* mousemoveEvent(pixel, e) {
|
|
214
|
+
* var dataItem = this.isPointInPath(this.getContext(), pixel);
|
|
215
|
+
* if (dataItem) {
|
|
216
|
+
* this.options.methods.mousemove(dataItem, e);
|
|
217
|
+
* } else {
|
|
218
|
+
* this.options.methods.mousemove(null, e);
|
|
219
|
+
* }
|
|
220
|
+
* }
|
|
221
|
+
*/
|
|
222
|
+
mousemoveEvent(e) {
|
|
223
|
+
const pixel = e.point
|
|
224
|
+
super.mousemoveEvent(pixel, e)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
addAnimatorEvent() {}
|
|
228
|
+
|
|
229
|
+
animatorMovestartEvent() {
|
|
230
|
+
const animationOptions = this.options.animation
|
|
231
|
+
if (this.isEnabledTime() && this.animator) {
|
|
232
|
+
this.steps.step = animationOptions.stepsRange.start
|
|
233
|
+
// this.animator.stop();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
animatorMoveendEvent() {
|
|
238
|
+
if (this.isEnabledTime() && this.animator) {
|
|
239
|
+
// this.animator.start();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
bindEvent() {
|
|
244
|
+
const map = this.map
|
|
245
|
+
if (this.options.methods) {
|
|
246
|
+
if (this.options.methods.click) {
|
|
247
|
+
map.on('click', this.clickEvent)
|
|
248
|
+
}
|
|
249
|
+
if (this.options.methods.mousemove) {
|
|
250
|
+
map.on('mousemove', this.mousemoveEvent)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
unbindEvent() {
|
|
256
|
+
const map = this.map
|
|
257
|
+
|
|
258
|
+
if (this.options.methods) {
|
|
259
|
+
if (this.options.methods.click) {
|
|
260
|
+
map.off('click', this.clickEvent)
|
|
261
|
+
}
|
|
262
|
+
if (this.options.methods.mousemove) {
|
|
263
|
+
map.off('mousemove', this.mousemoveEvent)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
getContext() {
|
|
269
|
+
return this.canvasLayer.canvas.getContext(this.context)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
init(options) {
|
|
273
|
+
const self = this
|
|
274
|
+
|
|
275
|
+
self.options = options
|
|
276
|
+
|
|
277
|
+
this.initDataRange(options)
|
|
278
|
+
|
|
279
|
+
this.context = self.options.context || '2d'
|
|
280
|
+
|
|
281
|
+
if (self.options.zIndex) {
|
|
282
|
+
this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.initAnimator()
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
_canvasUpdate(time) {
|
|
289
|
+
const map = this.map
|
|
290
|
+
if (
|
|
291
|
+
!this.canvasLayer ||
|
|
292
|
+
this.stopAniamation ||
|
|
293
|
+
this.canvasLayer.disposeFlag
|
|
294
|
+
) {
|
|
295
|
+
return
|
|
296
|
+
}
|
|
297
|
+
const self = this
|
|
298
|
+
|
|
299
|
+
const animationOptions = self.options.animation
|
|
300
|
+
|
|
301
|
+
const context = this.getContext()
|
|
302
|
+
|
|
303
|
+
if (self.isEnabledTime()) {
|
|
304
|
+
if (time === undefined) {
|
|
305
|
+
this.clear(context)
|
|
306
|
+
return
|
|
307
|
+
}
|
|
308
|
+
if (this.context === '2d') {
|
|
309
|
+
context.save()
|
|
310
|
+
context.globalCompositeOperation = 'destination-out'
|
|
311
|
+
context.fillStyle = 'rgba(0, 0, 0, .1)'
|
|
312
|
+
context.fillRect(0, 0, context.canvas.width, context.canvas.height)
|
|
313
|
+
context.restore()
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
this.clear(context)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (this.context === '2d') {
|
|
320
|
+
for (const key in self.options) {
|
|
321
|
+
context[key] = self.options[key]
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
context.clear(context.COLOR_BUFFER_BIT)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (
|
|
328
|
+
(self.options.minZoom && map.getZoom() < self.options.minZoom) ||
|
|
329
|
+
(self.options.maxZoom && map.getZoom() > self.options.maxZoom)
|
|
330
|
+
) {
|
|
331
|
+
return
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const dataGetOptions = {
|
|
335
|
+
transferCoordinate(coordinate) {
|
|
336
|
+
const point = map.project(
|
|
337
|
+
new mapboxgl.LngLat(coordinate[0], coordinate[1])
|
|
338
|
+
)
|
|
339
|
+
return [point.x, point.y]
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (time !== undefined) {
|
|
344
|
+
dataGetOptions.filter = function (item) {
|
|
345
|
+
const trails = animationOptions.trails || 10
|
|
346
|
+
if (time && item.time > time - trails && item.time < time) {
|
|
347
|
+
return true
|
|
348
|
+
} else {
|
|
349
|
+
return false
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const data = self.dataSet.get(dataGetOptions)
|
|
355
|
+
|
|
356
|
+
this.processData(data)
|
|
357
|
+
|
|
358
|
+
if (self.options.unit == 'm' && self.options.size) {
|
|
359
|
+
// self.options._size = self.options.size / zoomUnit;
|
|
360
|
+
self.options._size = self.options.size
|
|
361
|
+
} else {
|
|
362
|
+
self.options._size = self.options.size
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const pixel = map.project(new mapboxgl.LngLat(0, 0))
|
|
366
|
+
this.drawContext(context, new DataSet(data), self.options, pixel)
|
|
367
|
+
|
|
368
|
+
self.options.updateCallback && self.options.updateCallback(time)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
updateData(data, options) {
|
|
372
|
+
let _data = data
|
|
373
|
+
if (_data && _data.get) {
|
|
374
|
+
_data = _data.get()
|
|
375
|
+
}
|
|
376
|
+
if (_data != undefined) {
|
|
377
|
+
this.dataSet.set(_data)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
super.update({
|
|
381
|
+
options
|
|
382
|
+
})
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
addData(data, options) {
|
|
386
|
+
let _data = data
|
|
387
|
+
if (data && data.get) {
|
|
388
|
+
_data = data.get()
|
|
389
|
+
}
|
|
390
|
+
this.dataSet.add(_data)
|
|
391
|
+
this.update({
|
|
392
|
+
options
|
|
393
|
+
})
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
getData() {
|
|
397
|
+
return this.dataSet
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
removeData(filter) {
|
|
401
|
+
if (!this.dataSet) {
|
|
402
|
+
return
|
|
403
|
+
}
|
|
404
|
+
const newData = this.dataSet.get({
|
|
405
|
+
filter(data) {
|
|
406
|
+
return filter != null && typeof filter === 'function'
|
|
407
|
+
? !filter(data)
|
|
408
|
+
: true
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
this.dataSet.set(newData)
|
|
412
|
+
this.update({
|
|
413
|
+
options: null
|
|
414
|
+
})
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
clearData() {
|
|
418
|
+
this.dataSet && this.dataSet.clear()
|
|
419
|
+
this.update({
|
|
420
|
+
options: null
|
|
421
|
+
})
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
draw() {
|
|
425
|
+
this.canvasLayer.draw()
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// 该函数从mapv/canvas/clear中提取
|
|
429
|
+
clear(context) {
|
|
430
|
+
context &&
|
|
431
|
+
context.clearRect &&
|
|
432
|
+
context.clearRect(0, 0, context.canvas.width, context.canvas.height)
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export default MapvBaseLayer
|
|
437
|
+
</code></pre>
|
|
438
|
+
</article>
|
|
439
|
+
</section>
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
<footer class="footer">
|
|
447
|
+
<div class="content has-text-centered">
|
|
448
|
+
<p>文档生成<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a></p>
|
|
449
|
+
<p class="sidebar-created-by">
|
|
450
|
+
<a href="http://www.smaryun.com" target="_blank">司马云</a> <span>© 2023 云生态圈</span>
|
|
451
|
+
<a href="http://192.168.82.89:8086/#/index" target="_blank">MapGIS Client for JavaScript</a>
|
|
452
|
+
</p>
|
|
453
|
+
</div>
|
|
454
|
+
</footer>
|
|
455
|
+
|
|
456
|
+
</div>
|
|
457
|
+
<div id="side-nav" class="side-nav">
|
|
458
|
+
<div style="margin-bottom: 10px;">
|
|
459
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#page-title">构造函数</a>
|
|
460
|
+
</div>
|
|
461
|
+
<div style="margin-bottom: 10px;">
|
|
462
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#member">成员变量</a>
|
|
463
|
+
</div>
|
|
464
|
+
<div style="margin-bottom: 10px;">
|
|
465
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#function">方法</a>
|
|
466
|
+
</div>
|
|
467
|
+
<div>
|
|
468
|
+
<img style="vertical-align: middle;margin-right: 10px;width: 30px;" src="./styles/anchor.png"/><a href="#event">事件</a>
|
|
469
|
+
</div>
|
|
470
|
+
</div>
|
|
471
|
+
</div>
|
|
472
|
+
<script src="scripts/linenumber.js"> </script>
|
|
473
|
+
|
|
474
|
+
<script src="scripts/search.js"> </script>
|
|
475
|
+
|
|
476
|
+
</body>
|
|
477
|
+
</html>
|