@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.
Files changed (87) hide show
  1. package/README.md +51 -124
  2. package/dist/es5/webclient-common.min.js +90 -0
  3. package/dist/es5/webclient-mapboxgl-plugin.min.js +1 -0
  4. package/dist/webclient-mapboxgl-plugin-es6.min.js +1 -0
  5. package/documention/EchartsLayer.html +379 -0
  6. package/documention/MapViewMapboxgl.html +3587 -0
  7. package/documention/Popup.html +1523 -0
  8. package/documention/Screenshot.html +1089 -0
  9. package/documention/SketchEditorMapboxgl.html +3383 -0
  10. package/documention/document_ArcGISVectorTileLayerView.js.html +265 -0
  11. package/documention/document_EchartsLayerView.js.html +246 -0
  12. package/documention/document_GraphicsLayerView.js.html +314 -0
  13. package/documention/document_IGSFeatureLayerView.js.html +218 -0
  14. package/documention/document_IGSMapImageLayerView.js.html +240 -0
  15. package/documention/document_IGSTileLayerView.js.html +236 -0
  16. package/documention/document_IGSVectorTileLayerView.js.html +264 -0
  17. package/documention/document_MapVLayerView.js.html +247 -0
  18. package/documention/document_WMSLayerView.js.html +240 -0
  19. package/documention/document_WMTSLayerView.js.html +234 -0
  20. package/documention/document_WebTileLayerView.js.html +240 -0
  21. package/documention/document_support_FeatureRenderView.js.html +682 -0
  22. package/documention/document_support_MapboxglGraphicsLayer.js.html +1184 -0
  23. package/documention/document_support_SourceMetaData.js.html +223 -0
  24. package/documention/document_support_Utils.js.html +624 -0
  25. package/documention/document_support_mapbox_mapboxCustomUtil.js.html +322 -0
  26. package/documention/global.html +252 -0
  27. package/documention/index.html +251 -0
  28. 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
  29. package/documention/scripts/app.min.js +1 -0
  30. package/documention/scripts/linenumber.js +26 -0
  31. package/documention/scripts/search.js +45 -0
  32. package/documention/scripts/sideBar.js +11 -0
  33. package/documention/sketchEditor_SketchEditorMapboxgl.js.html +875 -0
  34. package/documention/styles/anchor.png +0 -0
  35. package/documention/styles/app.min.css +1 -0
  36. package/documention/styles/c.png +0 -0
  37. package/documention/styles/iframe.css +29 -0
  38. package/documention/styles/m.png +0 -0
  39. package/documention/styles/prettify-jsdoc.css +111 -0
  40. package/documention/styles/prettify-tomorrow.css +132 -0
  41. package/documention/styles/reset.css +44 -0
  42. package/documention/styles/up-arrow.png +0 -0
  43. package/documention/tutorial-1./345/277/253/351/200/237/345/205/245/351/227/250.html +165 -0
  44. package/documention/util_ConvertRendererToStyleLayerUtil.js.html +844 -0
  45. package/documention/util_MapboxglFeatureRender.js.html +225 -0
  46. package/documention/util_MapboxglPlugin.js.html +284 -0
  47. package/documention/view_MapViewMapboxgl.js.html +1882 -0
  48. package/documention/view_utils_ArcGISVectorTileLayerUtil.js.html +382 -0
  49. package/documention/view_utils_EchartsLayerUtil.js.html +194 -0
  50. package/documention/view_utils_IGSMapImageUtil.js.html +373 -0
  51. package/documention/view_utils_IGSTileLayerUtil.js.html +285 -0
  52. package/documention/view_utils_IGSVectorTileLayerUtil.js.html +379 -0
  53. package/documention/view_utils_MapVLayerUtil.js.html +197 -0
  54. package/documention/view_utils_Popup.js.html +525 -0
  55. package/documention/view_utils_Screenshot.js.html +320 -0
  56. package/documention/view_utils_WMSLayerUtil.js.html +337 -0
  57. package/documention/view_utils_WMTSLayerUtil.js.html +331 -0
  58. package/documention/view_utils_WebTileLayerUtil.js.html +284 -0
  59. package/documention/view_utils_echarts_EchartsLayerPlugin.js.html +419 -0
  60. package/documention/view_utils_mapV_MapVLayerPlugin.js.html +527 -0
  61. package/documention/view_utils_mapV_MapvBaseLayer.js.html +477 -0
  62. package/documention/view_utils_support_rasterLayerUtil.js.html +244 -0
  63. package/documention/view_utils_support_vectorLayerUtil.js.html +503 -0
  64. package/package.json +20 -20
  65. package/core/Base.js +0 -7
  66. package/core/index.js +0 -5
  67. package/index.js +0 -6
  68. package/overlay/D3Layer.js +0 -108
  69. package/overlay/EchartsLayer.js +0 -242
  70. package/overlay/ElsCubeLayer.js +0 -125
  71. package/overlay/MapvLayer.js +0 -298
  72. package/overlay/StreamLayer.js +0 -86
  73. package/overlay/TimeSpaceCubeLayer.js +0 -135
  74. package/overlay/dthree/mapbox-d3.css +0 -9
  75. package/overlay/echarts/MapCoordSys.js +0 -105
  76. package/overlay/echarts/MapModel.js +0 -0
  77. package/overlay/echarts/MapView.js +0 -0
  78. package/overlay/echarts/index.js +0 -4
  79. package/overlay/index.js +0 -31
  80. package/overlay/mapv/MapvBaseLayer.js +0 -299
  81. package/overlay/mapv/index.js +0 -5
  82. package/overlay/stream/GeojsonStreamLayer.js +0 -135
  83. package/overlay/stream/MapvStreamLayer.js +0 -79
  84. package/overlay/stream/index.js +0 -3
  85. package/overlay/stream/popup.css +0 -31
  86. package/service/index.js +0 -1
  87. package/service/socket/SocketService.js +0 -90
@@ -1,135 +0,0 @@
1
- import 'mapbox-gl/dist/mapbox-gl.css'
2
- import './popup.css'
3
- import mapboxgl from 'mapbox-gl';
4
-
5
- /**
6
- * @class GeojsonStreamLayer
7
- * @classdesc SocketLayer GeoJson渲染器。
8
- * @param {string} url - 数据流图层服务地址
9
- * @param {Object} options - 其他参数,先保留。
10
- *
11
- * @param {Object} options.style - 默认的geojson的style。
12
- * @param {Object} options.pointToLayer - geojson针对点图层的样式设置。
13
- * @param {Object} options.onEachFeature - geojson针对常见几何的样式设置。
14
- *
15
- * @param {Object} options.field - geojson的唯一标识字段,请确保该字段的唯一性。
16
- * @param {Object} options.icon - 显示的图片,与sprite配合
17
- */
18
- export class GeojsonStreamLayer {
19
- constructor(map, url, options) {
20
- options = options || {};
21
-
22
- this.map = map
23
- this.url = url
24
- this.options = options
25
- this.icon = options ? options.icon : 'rocket-15'
26
-
27
- this.data = {
28
- "type": "FeatureCollection",
29
- "features": []
30
- }
31
-
32
- this.fieldHash = {}
33
-
34
- this.bindData()
35
- }
36
-
37
- getPopupHtml(e) {
38
- let views = '';
39
- Object.keys(e.features[0].properties).map(key => {
40
- views += `<div class='mapgis-inspect-layer-popup-li'>
41
- <div class='mapgis-inspect-layer-popup-type'>${key}</div>
42
- <div class='mapgis-inspect-layer-popup-value'>${e.features[0].properties[key]}</div>
43
- </div>`
44
- return undefined
45
- });
46
-
47
- return `
48
- <div class='mapgis-inspect-layer-popup-list'>
49
- <div class='mapgis-inspect-layer-popup-li'>
50
- <div class='mapgis-inspect-layer-popup-type'>经度</div>
51
- <div class='mapgis-inspect-layer-popup-value'>${e.lngLat.lng}</div>
52
- </div>
53
- <div class='mapgis-inspect-layer-popup-li'>
54
- <div class='mapgis-inspect-layer-popup-type'>纬度</div>
55
- <div class='mapgis-inspect-layer-popup-value'>${e.lngLat.lat}</div>
56
- </div>
57
- <div class='mapgis-inspect-layer-popup-li'>
58
- <div class='mapgis-inspect-layer-popup-type'>屏幕像素X</div>
59
- <div class='mapgis-inspect-layer-popup-value'>${e.point.x}</div>
60
- </div>
61
- <div class='mapgis-inspect-layer-popup-li'>
62
- <div class='mapgis-inspect-layer-popup-type'>屏幕像素Y</div>
63
- <div class='mapgis-inspect-layer-popup-value'>${e.point.y}</div>
64
- </div>
65
- </div>
66
- `
67
- + views;
68
- }
69
-
70
- bindData() {
71
- let map = this.map
72
- let self = this
73
- map.addSource('webclient-mapboxgl-stream', { type: 'geojson', data: this.data })
74
- map.addLayer({
75
- "id": "webclient-mapboxgl-stream",
76
- "type": "symbol",
77
- "source": "webclient-mapboxgl-stream",
78
- "layout": {
79
- "icon-image": this.icon
80
- }
81
- });
82
- // When a click event occurs on a feature in the states layer, open a popup at the
83
- // location of the click, with description HTML from its properties.
84
- map.on('click', 'webclient-mapboxgl-stream', function (e) {
85
- console.log('stream item', e)
86
- new mapboxgl.Popup()
87
- .setLngLat(e.lngLat)
88
- .setHTML(self.getPopupHtml(e))
89
- .addTo(map);
90
- });
91
-
92
- // Change the cursor to a pointer when the mouse is over the states layer.
93
- map.on('mouseenter', 'webclient-mapboxgl-stream', function () {
94
- map.getCanvas().style.cursor = 'pointer';
95
- });
96
-
97
- // Change it back to a pointer when it leaves.
98
- map.on('mouseleave', 'webclient-mapboxgl-stream', function () {
99
- map.getCanvas().style.cursor = '';
100
- });
101
- }
102
-
103
- unbindData() {
104
- let map = this.map
105
- map.removeLayer('webclient-mapboxgl-stream')
106
- map.removeSource('webclient-mapboxgl-stream')
107
- // map.off()
108
- }
109
-
110
- onMessage(msg) {
111
- const feature = msg.feature
112
- const field = msg.feature.properties[this.options.field]
113
- let layer = feature
114
- if (!field) return
115
-
116
- if (this.fieldHash[field]) {
117
- this.data.features[this.fieldHash[field]] = layer
118
- } else {
119
- this.data.features.push(layer)
120
- this.fieldHash[field] = this.data.features.length - 1
121
- }
122
-
123
- this.map.getSource('webclient-mapboxgl-stream').setData(this.data)
124
-
125
- if (this.options.onEachFeature) {
126
- // this.options.onEachFeature(feature, layer)
127
- }
128
- }
129
-
130
- parasFeature(layer, feature) {
131
-
132
- }
133
- }
134
-
135
-
@@ -1,79 +0,0 @@
1
- import mapboxgl from 'mapbox-gl'
2
- import { MapvLayer } from "../MapvLayer"
3
-
4
- /**
5
- * @class MapvStreamLayer
6
- * @classdesc SocketLayer MapV渲染器
7
- * @author 基础平台/创新中心 潘卓然 ParnDeedlit
8
- * @extends {L.MapVLayer}
9
- * @param {string} url - 数据流图层服务地址
10
- * @param {Object} options - 其他参数,先保留。
11
- *
12
- * @param {Object} options.field - geojson的唯一标识字段,请确保该字段的唯一性。
13
- */
14
- export class MapvStreamLayer {
15
- constructor(map, url, options) {
16
- options = options || {}
17
-
18
- this.mapvOption = options.mapvOption || {}
19
- this.data = []
20
- this.lastDate = new Date()
21
- this.url = url
22
- this.fieldHash = {}
23
-
24
- this.fieldDeg = options.fieldDeg
25
- this.iconUrl = options.iconUrl
26
- this.timeSpeed = options.timeSpeed || 100
27
- this.createIcon()
28
-
29
- this.layer = new MapvLayer(map, new window.mapv.DataSet([]), this.mapvOption, options)
30
- }
31
-
32
- onMessage(msg) {
33
- const feature = msg.feature
34
- const field = msg.feature.properties[this.options.field]
35
-
36
- let layer = this.parasIcon(feature)
37
-
38
- if (field !== undefined && this.fieldHash[field]) {
39
- this.data[this.fieldHash[field]] = layer
40
- } else {
41
- if (field !== undefined) {
42
- this.data.push(layer)
43
- this.fieldHash[field] = this.data.length - 1
44
- }
45
- }
46
-
47
- this.updateLayer()
48
- }
49
-
50
- createIcon() {
51
- var iconUrl =
52
- this.iconUrl || "http://client.snanyun.com:8899/img/leaflet/marker/bike.png"
53
- this.icon = new Image()
54
- this.icon.src = iconUrl
55
- }
56
-
57
- parasIcon(feature) {
58
- this.mapvOption = {
59
- draw: "icon"
60
- }
61
- var deg = feature.properties[this.fieldDeg] || 0
62
- var icon = {
63
- geometry: {
64
- type: "Point",
65
- coordinates: feature.geometry.coordinates
66
- },
67
- deg: deg,
68
- icon: this.icon
69
- }
70
- return icon
71
- }
72
-
73
- updateLayer() {
74
- var currentDate = new Date()
75
- if (currentDate - this.lastDate < this.timeSpeed) return
76
- this.updateData(this.data, this.mapvOption)
77
- this.lastDate = currentDate
78
- }
79
- }
@@ -1,3 +0,0 @@
1
- import {GeojsonStreamLayer} from './GeojsonStreamLayer';
2
-
3
- export {GeojsonStreamLayer};
@@ -1,31 +0,0 @@
1
- .mapboxgl-popup-content {
2
- position: relative;
3
- background: #fff;
4
- border-radius: 5px;
5
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
6
- padding: 8px 10px;
7
- width: 200px;
8
- pointer-events: auto;
9
- }
10
-
11
- .mapgis-inspect-layer-popup-list {
12
- margin-top: 10px;
13
- width: 100%;
14
- border-bottom: 1px solid #1f3349;
15
- padding-top: 10px;
16
- }
17
-
18
- .mapgis-inspect-layer-popup-li {
19
- float: left;
20
- width: 100%;
21
- height: 22px;
22
- }
23
-
24
- .mapgis-inspect-layer-popup-type {
25
- float: left;
26
- margin-left: 10px;
27
- }
28
-
29
- .mapgis-inspect-layer-popup-value {
30
- float: right;
31
- }
package/service/index.js DELETED
@@ -1 +0,0 @@
1
- export { SocketService } from './socket/SocketService.js'
@@ -1,90 +0,0 @@
1
- import mapboxgl from 'mapbox-gl'
2
- import '../../core/Base'
3
-
4
- import {
5
- SubscribeEvent,
6
- BroadcastEvent
7
- } from '../../../common/service/socket/SocketEvent'
8
- import { ISocketService } from '../../../common/service/socket/ISocketService'
9
-
10
- mapboxgl.zondy.SocketService = undefined
11
-
12
- /**
13
- * Socket的代理类,实际上是接受websocket的事件,然后转换成mapbox的事件再进行发送
14
- * @author 潘卓然ParnDeedlit 基础平台/创新中心
15
- *
16
- * @alias SocketService
17
- * @constructor
18
- *
19
- * @param {Object} url Socket流地址的url:
20
- * @param {Number} options 其他预留参数.
21
- *
22
- * @example
23
- * 固定url ws://{ip}:{socket}/websocket/{servicename}
24
- * 服务名 streamdemo
25
- * 消息接收 ws://192.168.91.121:9382/websocket/streamdemo/subscribe
26
- * 消息发送 ws://192.168.91.121:9382/websocket/streamdemo/broadcast
27
- *
28
- * @exception {DeveloperError} options.styleOption 必须是正确的样式.
29
- *
30
- */
31
- export class SocketService extends mapboxgl.Evented {
32
- constructor(url, options) {
33
- super()
34
-
35
- this.url = url || ''
36
- this.options = options || {}
37
-
38
- this.socket = new ISocketService(url, options)
39
- }
40
-
41
- createSubscribe() {
42
- console.log('在使用流图层的时候容易出现回调堆栈溢出的问题,其核心原因是socket通信是双工通信,因此上下文环境context在不同的场景下是不一样的,以leaflet的on为例,其函数原型off(types, fn, context)第三个参数context的默认会是运行时的this而不是绑定时的this,最好在使用on监听的时候主动传入真正的上下文环境this')
43
- this.socket.createSubscribe()
44
- this.socket.evented.on(SubscribeEvent.OPEN, this.mapEvent, this)
45
- this.socket.evented.on(SubscribeEvent.MESSAGE, this.mapEvent, this)
46
- this.socket.evented.on(SubscribeEvent.CLOSE, this.mapEvent, this)
47
- this.socket.evented.on(SubscribeEvent.ERROR, this.mapEvent, this)
48
- }
49
-
50
- createBroadcast() {
51
- this.socket.createBroadcast()
52
- this.socket.evented.on(BroadcastEvent.OPEN, this.mapEvent, this)
53
- this.socket.evented.on(BroadcastEvent.MESSAGE, this.mapEvent, this)
54
- this.socket.evented.on(BroadcastEvent.CLOSE, this.mapEvent, this)
55
- this.socket.evented.on(BroadcastEvent.ERROR, this.mapEvent, this)
56
- }
57
-
58
- mapEvent(event) {
59
- this.fire(event.eventType || event.type, event)
60
- }
61
-
62
- broadcast(data) {
63
- if (!this.socket) {
64
- return
65
- }
66
- this.socket.broadcast(data)
67
- }
68
-
69
- closeSubscribe() {
70
- this.socket.closeSubscribe()
71
- this.socket.evented.off(SubscribeEvent.OPEN, this.mapEvent, this)
72
- this.socket.evented.off(SubscribeEvent.MESSAGE, this.mapEvent, this)
73
- this.socket.evented.off(SubscribeEvent.CLOSE, this.mapEvent, this)
74
- this.socket.evented.off(SubscribeEvent.ERROR, this.mapEvent, this)
75
- }
76
-
77
- closeBroadcast() {
78
- this.socket.closeBroadcast()
79
- this.socket.evented.off(BroadcastEvent.OPEN, this.mapEvent)
80
- this.socket.evented.off(BroadcastEvent.MESSAGE, this.mapEvent)
81
- this.socket.evented.off(BroadcastEvent.CLOSE, this.mapEvent)
82
- this.socket.evented.off(BroadcastEvent.ERROR, this.mapEvent)
83
- }
84
- }
85
-
86
- export var socketService = function (url, options) {
87
- return new SocketService(url, options)
88
- }
89
-
90
- mapboxgl.zondy.SocketService = socketService