@mapgis/webclient-vue-cesium 10.5.5-1 → 10.5.5-6

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 (124) hide show
  1. package/README.md +46 -49
  2. package/dist-libs/webclient-vue-cesium.common.js +191087 -0
  3. package/dist-libs/webclient-vue-cesium.css +1 -1
  4. package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
  5. package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
  6. package/docs/.vuepress/config.js +47 -46
  7. package/docs/README.md +5 -4
  8. package/docs/api/analysis/Aspect.md +236 -0
  9. package/docs/api/analysis/Contour.md +240 -0
  10. package/docs/api/analysis/CutFill.md +306 -0
  11. package/docs/api/analysis/DynamicSection.md +336 -0
  12. package/docs/api/analysis/Excavate.md +3 -11
  13. package/docs/api/analysis/Flood.md +177 -200
  14. package/docs/api/analysis/HeightLimited.md +7 -4
  15. package/docs/api/analysis/ParticleEffects.md +549 -0
  16. package/docs/api/analysis/Profile.md +464 -0
  17. package/docs/api/analysis/Shadow.md +76 -13
  18. package/docs/api/analysis/Sightline.md +66 -13
  19. package/docs/api/analysis/Skyline.md +144 -29
  20. package/docs/api/analysis/Slope.md +236 -0
  21. package/docs/api/analysis/Viewshed.md +100 -21
  22. package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
  23. package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
  24. package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
  25. package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
  26. package/docs/api/layer/OGC/Wms.png +0 -0
  27. package/docs/api/layer/marker/DynamicMarker.md +81 -0
  28. package/docs/api/layer/marker/dynamicmarker.png +0 -0
  29. package/docs/api/layer/marker/selects.png +0 -0
  30. package/docs/api/layer/vectortile/vectortile.md +10 -0
  31. package/docs/api/m3d/image/layer_control_1.png +0 -0
  32. package/docs/api/m3d/image/layer_control_2.png +0 -0
  33. package/docs/api/m3d/image/layer_control_3.png +0 -0
  34. package/docs/api/m3d/m3d.md +13 -2
  35. package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
  36. package/docs/api/ui/draw.md +68 -40
  37. package/docs/api/ui/link.md +8 -1
  38. package/docs/api/ui/marker.md +19 -1
  39. package/docs/api/ui/measure.md +82 -10
  40. package/docs/api/ui/table.md +6 -6
  41. package/docs/guide/README.md +26 -23
  42. package/docs/guide/basemap.md +35 -33
  43. package/docs/guide/markers&popups.md +46 -53
  44. package/docs/plugin_components/create_storybook.md +241 -0
  45. package/docs/plugin_components/img.png +0 -0
  46. package/docs/plugin_components/img_1.png +0 -0
  47. package/docs/plugin_components/img_10.png +0 -0
  48. package/docs/plugin_components/img_2.png +0 -0
  49. package/docs/plugin_components/img_3.png +0 -0
  50. package/docs/plugin_components/img_4.png +0 -0
  51. package/docs/plugin_components/img_5.png +0 -0
  52. package/docs/plugin_components/img_6.png +0 -0
  53. package/docs/plugin_components/img_7.png +0 -0
  54. package/docs/plugin_components/img_8.png +0 -0
  55. package/docs/version/diff.md +4 -4
  56. package/docs/version/version.md +81 -0
  57. package/package.json +5 -5
  58. package/src/cdn/cdn_component.js +62 -0
  59. package/src/component.js +20 -2
  60. package/src/components/Analysis/Aspect.vue +318 -0
  61. package/src/components/Analysis/Contour.vue +257 -0
  62. package/src/components/Analysis/CutFill.vue +581 -0
  63. package/src/components/Analysis/DynamicCutting.vue +98 -59
  64. package/src/components/Analysis/DynamicSection.vue +494 -0
  65. package/src/components/Analysis/Excavate.vue +133 -87
  66. package/src/components/Analysis/Flood.vue +395 -487
  67. package/src/components/Analysis/Flood.vue-- +630 -0
  68. package/src/components/Analysis/HeightLimited.vue +66 -47
  69. package/src/components/Analysis/ModelFlatten.vue +2 -2
  70. package/src/components/Analysis/Profile.vue +503 -0
  71. package/src/components/Analysis/Shadow.vue +220 -309
  72. package/src/components/Analysis/Sightline.vue +393 -375
  73. package/src/components/Analysis/SkyLine.vue +283 -93
  74. package/src/components/Analysis/Slope.vue +317 -0
  75. package/src/components/Analysis/Viewshed.vue +806 -373
  76. package/src/components/Analysis/skyline2dChartOptions.js +66 -0
  77. package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
  78. package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
  79. package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
  80. package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
  81. package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
  82. package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
  83. package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
  84. package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
  85. package/src/components/M3D/3DTilesetOptions.js +23 -1
  86. package/src/components/M3D/G3D.vue +150 -0
  87. package/src/components/M3D/M3d.vue +142 -32
  88. package/src/components/M3D/M3dSet.vue +118 -0
  89. package/src/components/M3D/M3dType.js +24 -0
  90. package/src/components/Overlay/Mapv3dLayer.vue +2 -0
  91. package/src/components/Overlay/ParticleEffects.vue +545 -0
  92. package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
  93. package/src/components/Overlay/mapv/MapvLayer.js +372 -324
  94. package/src/components/Overlay/mapv/SuperCluster.js +611 -0
  95. package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
  96. package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
  97. package/src/components/UI/Controls/Draw/Draw.vue +320 -92
  98. package/src/components/UI/Controls/Legend/Legend.vue +55 -51
  99. package/src/components/UI/Controls/Link/Link.vue +59 -37
  100. package/src/components/UI/Controls/Measure/Measure.vue +75 -33
  101. package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
  102. package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
  103. package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
  104. package/src/components/UI/Geojson/Popup.vue +101 -0
  105. package/src/components/UI/Marker/Marker.vue +185 -48
  106. package/src/components/UI/Popup/Popup.vue +21 -64
  107. package/src/components/Utils/common/color-util.js +159 -0
  108. package/src/components/Utils/util.js +311 -231
  109. package/src/components/WebGlobe/manager.js +81 -3
  110. package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
  111. package/src/components/WebGlobe/util.js +173 -0
  112. package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
  113. package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
  114. package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
  115. package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
  116. package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
  117. package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
  118. package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
  119. package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
  120. package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
  121. package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
  122. package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
  123. package/src/components/Overlay/Mapv.vue +0 -142
  124. package/src/components/Overlay/MapvHeater.vue +0 -98
@@ -1,6 +1,6 @@
1
1
  import { MapvBaseLayer } from "./MapvBaseLayer";
2
2
 
3
- var idIndex = 0;
3
+ let idIndex = 0;
4
4
 
5
5
  /**
6
6
  * @author 基础平台/创新中心 潘卓然 ParnDeedlit
@@ -14,13 +14,13 @@ var idIndex = 0;
14
14
  * @param {Boolean} [mapVOptions.cesium.postRender=false] 是否实时渲染
15
15
  * @param {Boolean} [mapVOptionscesium.cesium.postRenderFrame=30] 每间隔多少帧渲染一次
16
16
  * @param container - {Element} 外部传入的div;外接的方式使用mapv
17
- * @example
17
+ * @example
18
18
  * // 构建对应的dataset
19
- var dataSet = new mapv.DataSet(data);
19
+ var dataSet = new mapv.DataSet(data);
20
20
 
21
- // 设置对应的参数
22
- // https://github.com/huiyan-fe/mapv/blob/master/API.md
23
- var options = {
21
+ // 设置对应的参数
22
+ // https://github.com/huiyan-fe/mapv/blob/master/API.md
23
+ var options = {
24
24
  context: '2d', //cesium必须设置画布为2d
25
25
  postRender: false,
26
26
  postRenderFrame: 5,
@@ -48,353 +48,401 @@ var idIndex = 0;
48
48
  max: 100,
49
49
  draw: 'honeycomb' // 绘制蜂窝图
50
50
  }
51
- // 声明cesium的mapv图层并将其显示到三维球上
52
- var mapvLayer = new CesiumZondy.Overlayer.MapvLayer(map, dataSet, options);
51
+ // 声明cesium的mapv图层并将其显示到三维球上
52
+ var mapvLayer = new CesiumZondy.Overlayer.MapvLayer(map, dataSet, options);
53
53
  */
54
54
  export class MapvLayer {
55
- constructor(map, dataSet, mapVOptions, container) {
56
- this.map = map;
57
- this.scene = map.scene;
55
+ constructor(map, dataSet, mapVOptions, container) {
56
+ this.map = map;
57
+ this.scene = map.scene;
58
58
 
59
- this.mapvBaseLayer = new MapvBaseLayer(map, dataSet, mapVOptions, this);
60
- this.mapVOptions = mapVOptions;
59
+ this.mapvBaseLayer = new MapvBaseLayer(map, dataSet, mapVOptions, this);
60
+ this.mapVOptions = mapVOptions;
61
61
 
62
- this.initDevicePixelRatio();
62
+ this.initDevicePixelRatio();
63
63
 
64
- this.canvas = this._creteWidgetCanvas(); //this._createCanvas();
64
+ this.canvas = this._creteWidgetCanvas(); //this._createCanvas();
65
65
 
66
- this.render = this.render.bind(this);
67
- this.handler = undefined;
68
- this.postRenderTime = 0;
66
+ this.render = this.render.bind(this);
67
+ this.handler = undefined;
68
+ this.postRenderTime = 0;
69
69
 
70
- let cesiumOpt = mapVOptions.cesium;
71
- if (cesiumOpt) {
72
- this.postRender = cesiumOpt.postRender || false;
73
- this.postRenderFrame = cesiumOpt.postRenderFrame || 30;
74
- }
75
-
76
- if (container != undefined) {
77
- this.container = container;
78
- container.appendChild(this.canvas);
79
- } else {
80
- var parents = document.getElementsByClassName('cesium-widget');
81
- var parent = parents.length > 0 ? parents[0] : map.container;
82
- this.container = parent;
83
- this.addInnerContainer();
84
- }
85
-
86
- this.bindEvent();
87
-
88
- this._reset();
89
- }
90
-
91
- initDevicePixelRatio() {
92
- this.devicePixelRatio = window.devicePixelRatio || 1;
93
- }
94
-
95
- addInnerContainer() {
96
- //var container = document.createElement('div');
97
- this.container.appendChild(this.canvas);
98
- //container.appendChild(this.canvas);
99
- //return container;
100
- }
101
-
102
- bindEvent() {
103
- let self = this;
104
- let map = this.map;
105
- //下面几个是cesium专属事件,clickEvent和mousemoveEvent是mapv内部自带的方法不放出来
106
- this.innerMoveStart = this.moveStartEvent.bind(this);
107
- this.innerMoveEnd = this.moveEndEvent.bind(this);
108
-
109
- this.innnerZoomStart = this.zoomStartEvent.bind(this);
110
- this.innnerZoomEnd = this.zoomEndEvent.bind(this);
111
-
112
- this.postEventHandle = this.postEvent.bind(this);
113
- this.postStartEvent = this.postStartEvent.bind(this);
114
- this.postEndEvent = this.postEndEvent.bind(this);
115
-
116
- //handler.setInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
117
- if (this.postRender) {
118
- // this.scene.postRender.addEventListener(this.postEventHandle);
119
- this.scene.camera.moveStart.addEventListener(this.postStartEvent, this);
120
- this.scene.camera.moveEnd.addEventListener(this.postEndEvent, this);
121
- } else {
122
- var handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
123
-
124
- handler.setInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.WHEEL);
125
- handler.setInputAction(this.innerMoveStart, Cesium.ScreenSpaceEventType.LEFT_DOWN);
126
- handler.setInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.LEFT_UP);
127
- handler.setInputAction(this.innerMoveStart, Cesium.ScreenSpaceEventType.RIGHT_DOWN);
128
- handler.setInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.RIGHT_UP);
129
-
130
- map.scene.camera.moveEnd.addEventListener(this.innerMoveEnd(), this);
131
-
132
- this.handler = handler;
133
- }
134
- }
135
-
136
- unbindEvent() {
137
- let map = this.map;
138
- if (this.postRender) {
139
- this.scene.camera.moveStart.removeEventListener(this.postStartEvent, this);
140
- this.scene.camera.moveEnd.removeEventListener(this.postEndEvent, this);
141
- } else {
142
- let handler = this.handler;
143
- if (handler) {
144
- handler.removeInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.WHEEL);
145
- handler.removeInputAction(this.innerMoveStart, Cesium.ScreenSpaceEventType.LEFT_DOWN);
146
- handler.removeInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.LEFT_UP);
147
- handler.removeInputAction(this.innerMoveStart, Cesium.ScreenSpaceEventType.RIGHT_DOWN);
148
- handler.removeInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.RIGHT_UP);
149
- handler.destroy();
150
- }
151
- map.scene.camera.moveEnd.removeEventListener(this.innerMoveEnd(), this);
152
- }
153
- }
154
-
155
- postStartEvent() {
156
- if (this.mapvBaseLayer) {
157
- this.mapvBaseLayer.animatorMovestartEvent();
158
- this.scene.postRender.addEventListener(this._reset, this);
159
- }
160
- this._visiable();
161
- }
162
-
163
- postEndEvent() {
164
- if (this.mapvBaseLayer) {
165
- this.mapvBaseLayer.animatorMoveendEvent();
166
- this.scene.postRender.removeEventListener(this._reset, this);
167
- }
168
- this._reset();
169
- this._visiable();
170
- }
171
-
172
- moveStartEvent() {
173
- if (this.mapvBaseLayer) {
174
- this.mapvBaseLayer.animatorMovestartEvent();
175
- }
176
- this._unvisiable();
177
- }
178
-
179
- moveEndEvent() {
180
- if (this.mapvBaseLayer) {
181
- this.mapvBaseLayer.animatorMoveendEvent();
182
- }
183
- this._reset();
184
- this._visiable();
185
- }
186
-
187
- zoomStartEvent() {
188
- this._unvisiable();
189
- }
190
- zoomEndEvent() {
191
- this._unvisiable();
70
+ let cesiumOpt = mapVOptions.cesium;
71
+ if (cesiumOpt) {
72
+ this.postRender = cesiumOpt.postRender || false;
73
+ this.postRenderFrame = cesiumOpt.postRenderFrame || 30;
192
74
  }
193
75
 
194
- postEvent() {
195
- this.postRenderTime++;
196
- if (this.postRenderTime % this.postRenderFrame === 0) this.moveEndEvent();
76
+ if (container != undefined) {
77
+ this.container = container;
78
+ container.appendChild(this.canvas);
79
+ } else {
80
+ var parents = document.getElementsByClassName("cesium-widget");
81
+ var parent = parents.length > 0 ? parents[0] : map.container;
82
+ this.container = parent;
83
+ this.addInnerContainer();
197
84
  }
198
85
 
199
- //-----------------------------------Start Data Operation---------------------------------
200
-
201
- /**
202
- * 增加数据
203
- * @function module:客户端可视化.MapVLayer.prototype.addData
204
- *
205
- * @param data - {Array} 数据.
206
- * @param options - {Object} 只做额外增加的字段作用
207
- * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
208
- */
209
- addData(data, options) {
210
- if (this.mapvBaseLayer == undefined) return;
211
- this.mapvBaseLayer.addData(data, options);
86
+ this.bindEvent();
87
+
88
+ this._reset();
89
+ }
90
+
91
+ initDevicePixelRatio() {
92
+ this.devicePixelRatio = window.devicePixelRatio || 1;
93
+ }
94
+
95
+ addInnerContainer() {
96
+ //var container = document.createElement('div');
97
+ this.container.appendChild(this.canvas);
98
+ //container.appendChild(this.canvas);
99
+ //return container;
100
+ }
101
+
102
+ bindEvent() {
103
+ let self = this;
104
+ let map = this.map;
105
+ //下面几个是cesium专属事件,clickEvent和mousemoveEvent是mapv内部自带的方法不放出来
106
+ this.innerMoveStart = this.moveStartEvent.bind(this);
107
+ this.innerMoveEnd = this.moveEndEvent.bind(this);
108
+
109
+ this.innnerZoomStart = this.zoomStartEvent.bind(this);
110
+ this.innnerZoomEnd = this.zoomEndEvent.bind(this);
111
+
112
+ this.postEventHandle = this.postEvent.bind(this);
113
+ this.postStartEvent = this.postStartEvent.bind(this);
114
+ this.postEndEvent = this.postEndEvent.bind(this);
115
+
116
+ //handler.setInputAction(this.innerMoveEnd, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
117
+ if (this.postRender) {
118
+ // this.scene.postRender.addEventListener(this.postEventHandle);
119
+ this.scene.camera.moveStart.addEventListener(this.postStartEvent, this);
120
+ this.scene.camera.moveEnd.addEventListener(this.postEndEvent, this);
121
+ } else {
122
+ var handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
123
+
124
+ handler.setInputAction(
125
+ this.innerMoveEnd,
126
+ Cesium.ScreenSpaceEventType.WHEEL
127
+ );
128
+ handler.setInputAction(
129
+ this.innerMoveStart,
130
+ Cesium.ScreenSpaceEventType.LEFT_DOWN
131
+ );
132
+ handler.setInputAction(
133
+ this.innerMoveEnd,
134
+ Cesium.ScreenSpaceEventType.LEFT_UP
135
+ );
136
+ handler.setInputAction(
137
+ this.innerMoveStart,
138
+ Cesium.ScreenSpaceEventType.RIGHT_DOWN
139
+ );
140
+ handler.setInputAction(
141
+ this.innerMoveEnd,
142
+ Cesium.ScreenSpaceEventType.RIGHT_UP
143
+ );
144
+
145
+ map.scene.camera.moveEnd.addEventListener(this.innerMoveEnd(), this);
146
+
147
+ this.handler = handler;
212
148
  }
213
-
214
- /**
215
- * 更新数据
216
- * @function module:客户端可视化.MapVLayer.prototype.updateData
217
- *
218
- * @param data - {Array} 数据.
219
- * @param options - {Object} 只做额外增加的字段作用
220
- * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
221
- */
222
- updateData(data, options) {
223
- if (this.mapvBaseLayer == undefined) return;
224
- this.mapvBaseLayer.updateData(data, options);
149
+ }
150
+
151
+ unbindEvent() {
152
+ let map = this.map;
153
+ if (this.postRender) {
154
+ this.scene.camera.moveStart.removeEventListener(
155
+ this.postStartEvent,
156
+ this
157
+ );
158
+ this.scene.camera.moveEnd.removeEventListener(this.postEndEvent, this);
159
+ } else {
160
+ let handler = this.handler;
161
+ if (handler) {
162
+ handler.removeInputAction(
163
+ this.innerMoveEnd,
164
+ Cesium.ScreenSpaceEventType.WHEEL
165
+ );
166
+ handler.removeInputAction(
167
+ this.innerMoveStart,
168
+ Cesium.ScreenSpaceEventType.LEFT_DOWN
169
+ );
170
+ handler.removeInputAction(
171
+ this.innerMoveEnd,
172
+ Cesium.ScreenSpaceEventType.LEFT_UP
173
+ );
174
+ handler.removeInputAction(
175
+ this.innerMoveStart,
176
+ Cesium.ScreenSpaceEventType.RIGHT_DOWN
177
+ );
178
+ handler.removeInputAction(
179
+ this.innerMoveEnd,
180
+ Cesium.ScreenSpaceEventType.RIGHT_UP
181
+ );
182
+ handler.destroy();
183
+ }
184
+ map.scene.camera.moveEnd.removeEventListener(this.innerMoveEnd(), this);
225
185
  }
186
+ }
226
187
 
227
- /**
228
- * 获取数据
229
- * @function module:客户端可视化.MapVLayer.prototype.getData
230
- *
231
- * @param data - {Array} 数据.
232
- * @param options - {Object} 只做额外增加的字段作用
233
- * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
234
- */
235
- getData() {
236
- if (this.mapvBaseLayer) {
237
- this.dataSet = this.mapvBaseLayer.getData();
238
- }
239
- return this.dataSet;
188
+ postStartEvent() {
189
+ if (this.mapvBaseLayer) {
190
+ this.mapvBaseLayer.animatorMovestartEvent();
191
+ this.scene.postRender.addEventListener(this._reset, this);
240
192
  }
193
+ this._visiable();
194
+ }
241
195
 
242
- removeData(filter) {
243
- if (this.mapvBaseLayer == undefined) return;
244
- this.mapvBaseLayer && this.mapvBaseLayer.removeData(filter);
196
+ postEndEvent() {
197
+ if (this.mapvBaseLayer) {
198
+ this.mapvBaseLayer.animatorMoveendEvent();
199
+ this.scene.postRender.removeEventListener(this._reset, this);
245
200
  }
201
+ this._reset();
202
+ this._visiable();
203
+ }
246
204
 
247
- /**
248
- * 删除数据
249
- * @function module:客户端可视化.MapVLayer.prototype.removeAllData
250
- */
251
- removeAllData() {
252
- if (this.mapvBaseLayer == undefined) return;
253
- this.mapvBaseLayer.clearData();
254
- }
255
- //-----------------------------------End Data Operation---------------------------------
256
- _visiable() {
257
- this.canvas.style.display = 'block';
258
- return this;
205
+ moveStartEvent() {
206
+ if (this.mapvBaseLayer) {
207
+ this.mapvBaseLayer.animatorMovestartEvent();
259
208
  }
209
+ this._unvisiable();
210
+ }
260
211
 
261
- _unvisiable() {
262
- this.canvas.style.display = 'none';
263
- return this;
212
+ moveEndEvent() {
213
+ if (this.mapvBaseLayer) {
214
+ this.mapvBaseLayer.animatorMoveendEvent();
264
215
  }
265
-
266
- _createCanvas() {
267
- var canvas = document.createElement('canvas');
268
- canvas.id = this.mapVOptions.layerid || 'mapv' + idIndex++;
269
- canvas.style.position = 'absolute';
270
- canvas.style.top = '0px';
271
- canvas.style.left = '0px';
272
-
273
- canvas.style.pointerEvents = 'none';
274
- canvas.style.zIndex = this.mapVOptions.zIndex || 100;
275
-
276
- canvas.width = parseInt(this.map.canvas.width);
277
- canvas.height = parseInt(this.map.canvas.height);
278
- canvas.style.width = this.map.canvas.style.width;
279
- canvas.style.height = this.map.canvas.style.height;
280
- var devicePixelRatio = this.devicePixelRatio;
281
- if (this.mapVOptions.context == '2d') {
282
- canvas.getContext(this.mapVOptions.context).scale(devicePixelRatio, devicePixelRatio);
283
- }
284
- return canvas;
216
+ this._reset();
217
+ this._visiable();
218
+ }
219
+
220
+ zoomStartEvent() {
221
+ this._unvisiable();
222
+ }
223
+ zoomEndEvent() {
224
+ this._unvisiable();
225
+ }
226
+
227
+ postEvent() {
228
+ this.postRenderTime++;
229
+ if (this.postRenderTime % this.postRenderFrame === 0) this.moveEndEvent();
230
+ }
231
+
232
+ //-----------------------------------Start Data Operation---------------------------------
233
+
234
+ /**
235
+ * 增加数据
236
+ * @function module:客户端可视化.MapVLayer.prototype.addData
237
+ *
238
+ * @param data - {Array} 数据.
239
+ * @param options - {Object} 只做额外增加的字段作用
240
+ * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
241
+ */
242
+ addData(data, options) {
243
+ if (this.mapvBaseLayer == undefined) return;
244
+ this.mapvBaseLayer.addData(data, options);
245
+ }
246
+
247
+ /**
248
+ * 更新数据
249
+ * @function module:客户端可视化.MapVLayer.prototype.updateData
250
+ *
251
+ * @param data - {Array} 数据.
252
+ * @param options - {Object} 只做额外增加的字段作用
253
+ * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
254
+ */
255
+ updateData(data, options) {
256
+ if (this.mapvBaseLayer == undefined) return;
257
+ this.mapvBaseLayer.updateData(data, options);
258
+ }
259
+
260
+ /**
261
+ * 获取数据
262
+ * @function module:客户端可视化.MapVLayer.prototype.getData
263
+ *
264
+ * @param data - {Array} 数据.
265
+ * @param options - {Object} 只做额外增加的字段作用
266
+ * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
267
+ */
268
+ getData() {
269
+ if (this.mapvBaseLayer) {
270
+ this.dataSet = this.mapvBaseLayer.getData();
285
271
  }
286
-
287
- _creteWidgetCanvas() {
288
- var canvas = document.createElement('canvas');
289
-
290
- canvas.id = this.mapVOptions.layerid || 'mapv' + idIndex++;
291
- canvas.style.position = 'absolute';
292
- canvas.style.top = '0px';
293
- canvas.style.left = '0px';
294
-
295
- canvas.style.pointerEvents = 'none';
296
- canvas.style.zIndex = this.mapVOptions.zIndex || 100;
297
-
298
- canvas.width = parseInt(this.map.canvas.width);
299
- canvas.height = parseInt(this.map.canvas.height);
300
- canvas.style.width = this.map.canvas.style.width;
301
- canvas.style.height = this.map.canvas.style.height;
302
- var devicePixelRatio = this.devicePixelRatio;
303
- if (this.mapVOptions.context == '2d') {
304
- canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
305
- }
306
-
307
- return canvas;
272
+ return this.dataSet;
273
+ }
274
+
275
+ removeData(filter) {
276
+ if (this.mapvBaseLayer == undefined) return;
277
+ this.mapvBaseLayer && this.mapvBaseLayer.removeData(filter);
278
+ }
279
+
280
+ /**
281
+ * 删除数据
282
+ * @function module:客户端可视化.MapVLayer.prototype.removeAllData
283
+ */
284
+ removeAllData() {
285
+ if (this.mapvBaseLayer == undefined) return;
286
+ this.mapvBaseLayer.clearData();
287
+ }
288
+ //-----------------------------------End Data Operation---------------------------------
289
+ _visiable() {
290
+ this.canvas.style.display = "block";
291
+ return this;
292
+ }
293
+
294
+ _unvisiable() {
295
+ this.canvas.style.display = "none";
296
+ return this;
297
+ }
298
+
299
+ _createCanvas() {
300
+ var canvas = document.createElement("canvas");
301
+ canvas.id = this.mapVOptions.layerid || "mapv" + idIndex++;
302
+ canvas.style.position = "absolute";
303
+ canvas.style.top = "0px";
304
+ canvas.style.left = "0px";
305
+
306
+ canvas.style.pointerEvents = "none";
307
+ canvas.style.zIndex = this.mapVOptions.zIndex || 100;
308
+
309
+ canvas.width =
310
+ parseInt(this.map.canvas.width) ||
311
+ parseInt(this.map.container.offsetWidth) * this.devicePixelRatio;
312
+ canvas.height =
313
+ parseInt(this.map.canvas.height) ||
314
+ parseInt(this.map.container.offsetHeight) * this.devicePixelRatio;
315
+ canvas.style.width = parseInt(this.map.container.offsetWidth) + "px";
316
+ canvas.style.height = parseInt(this.map.container.offsetHeight) + "px";
317
+
318
+ var devicePixelRatio = this.devicePixelRatio;
319
+ if (this.mapVOptions.context == "2d") {
320
+ canvas
321
+ .getContext(this.mapVOptions.context)
322
+ .scale(devicePixelRatio, devicePixelRatio);
308
323
  }
309
-
310
- _reset() {
311
- this.resizeCanvas();
312
- this.fixPosition();
313
- this.onResize();
314
- this.render();
324
+ return canvas;
325
+ }
326
+
327
+ _creteWidgetCanvas() {
328
+ var canvas = document.createElement("canvas");
329
+
330
+ canvas.id = this.mapVOptions.layerid || "mapv" + idIndex++;
331
+ canvas.style.position = "absolute";
332
+ canvas.style.top = "0px";
333
+ canvas.style.left = "0px";
334
+
335
+ canvas.style.pointerEvents = "none";
336
+ canvas.style.zIndex = this.mapVOptions.zIndex || 100;
337
+
338
+ canvas.width =
339
+ parseInt(this.map.canvas.width) ||
340
+ parseInt(this.map.container.offsetWidth) * this.devicePixelRatio;
341
+ canvas.height =
342
+ parseInt(this.map.canvas.height) ||
343
+ parseInt(this.map.container.offsetHeight) * this.devicePixelRatio;
344
+ canvas.style.width = parseInt(this.map.container.offsetWidth) + "px";
345
+ canvas.style.height = parseInt(this.map.container.offsetHeight) + "px";
346
+ var devicePixelRatio = this.devicePixelRatio;
347
+ if (this.mapVOptions.context == "2d") {
348
+ canvas.getContext("2d").scale(devicePixelRatio, devicePixelRatio);
315
349
  }
316
350
 
317
- /**
318
- * 强制重回图层
319
- * @function module:客户端可视化.MapVLayer.prototype.draw
320
- */
321
- draw() {
322
- this._reset();
351
+ return canvas;
352
+ }
353
+
354
+ _reset() {
355
+ this.resizeCanvas();
356
+ this.fixPosition();
357
+ this.onResize();
358
+ this.render();
359
+ }
360
+
361
+ /**
362
+ * 强制重回图层
363
+ * @function module:客户端可视化.MapVLayer.prototype.draw
364
+ */
365
+ draw() {
366
+ this._reset();
367
+ }
368
+
369
+ /**
370
+ * 显示图层
371
+ * @function module:客户端可视化.MapVLayer.prototype.show
372
+ */
373
+ show() {
374
+ this._visiable();
375
+ }
376
+ /**
377
+ * 隐藏图层
378
+ * @function module:客户端可视化.MapVLayer.prototype.hide
379
+ */
380
+ hide() {
381
+ this._unvisiable();
382
+ }
383
+
384
+ /**
385
+ * 销毁图层-实际调用remove,为了接口保持一致
386
+ * @function module:客户端可视化.MapVLayer.prototype.destroy
387
+ */
388
+ destroy() {
389
+ this.remove();
390
+ }
391
+
392
+ /**
393
+ * 销毁图层
394
+ * @function module:客户端可视化.MapVLayer.prototype.remove
395
+ */
396
+ remove() {
397
+ if (this.mapvBaseLayer == undefined) return;
398
+ this.unbindEvent();
399
+ this.removeAllData();
400
+ this.mapvBaseLayer.clear(this.mapvBaseLayer.getContext());
401
+ this.mapvBaseLayer = undefined;
402
+ var parent = this.canvas.parentElement;
403
+ parent.removeChild(this.canvas);
404
+ }
405
+
406
+ /**
407
+ * 更新图层
408
+ * @function module:客户端可视化.MapVLayer.prototype.update
409
+ */
410
+ update(opt) {
411
+ if (opt == undefined) {
412
+ return;
323
413
  }
324
-
325
- /**
326
- * 显示图层
327
- * @function module:客户端可视化.MapVLayer.prototype.show
328
- */
329
- show() {
330
- this._visiable();
331
- }
332
- /**
333
- * 隐藏图层
334
- * @function module:客户端可视化.MapVLayer.prototype.hide
335
- */
336
- hide() {
337
- this._unvisiable();
338
- }
339
-
340
- /**
341
- * 销毁图层-实际调用remove,为了接口保持一致
342
- * @function module:客户端可视化.MapVLayer.prototype.destroy
343
- */
344
- destroy() {
345
- this.remove();
346
- }
347
-
348
- /**
349
- * 销毁图层
350
- * @function module:客户端可视化.MapVLayer.prototype.remove
351
- */
352
- remove() {
353
- if (this.mapvBaseLayer == undefined) return;
354
- this.unbindEvent();
355
- this.removeAllData();
356
- this.mapvBaseLayer.clear(this.mapvBaseLayer.getContext());
357
- this.mapvBaseLayer = undefined;
358
- var parent = this.canvas.parentElement;
359
- parent.removeChild(this.canvas);
414
+ this.updateData(opt.data, opt.options);
415
+ }
416
+
417
+ resizeCanvas() {
418
+ //this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
419
+ if (this.canvas == undefined || this.canvas == null) return;
420
+ var canvas = this.canvas;
421
+ canvas.style.position = "absolute";
422
+ canvas.style.top = "0px";
423
+ canvas.style.left = "0px";
424
+ canvas.width =
425
+ parseInt(this.map.canvas.width) ||
426
+ parseInt(this.map.container.offsetWidth) * this.devicePixelRatio;
427
+ canvas.height =
428
+ parseInt(this.map.canvas.height) ||
429
+ parseInt(this.map.container.offsetHeight) * this.devicePixelRatio;
430
+ canvas.style.width = parseInt(this.map.container.offsetWidth) + "px";
431
+ canvas.style.height = parseInt(this.map.container.offsetHeight) + "px";
432
+ var devicePixelRatio = this.devicePixelRatio;
433
+ if (this.mapVOptions.context == "2d") {
434
+ canvas.getContext("2d").scale(devicePixelRatio, devicePixelRatio);
360
435
  }
436
+ }
361
437
 
362
- /**
363
- * 更新图层
364
- * @function module:客户端可视化.MapVLayer.prototype.update
365
- */
366
- update(opt) {
367
- if (opt == undefined) {
368
- return;
369
- }
370
- this.updateData(opt.data, opt.options);
371
- }
372
-
373
- resizeCanvas() {
374
- //this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
375
- if (this.canvas == undefined || this.canvas == null) return;
376
- var canvas = this.canvas;
377
- canvas.style.position = 'absolute';
378
- canvas.style.top = '0px';
379
- canvas.style.left = '0px';
380
- canvas.width = parseInt(this.map.canvas.width);
381
- canvas.height = parseInt(this.map.canvas.height);
382
- //canvas.style.width = this.map.canvas.style.width;
383
- //canvas.style.height = this.map.canvas.style.height;
384
- var devicePixelRatio = this.devicePixelRatio;
385
- if (this.mapVOptions.context == '2d') {
386
- canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
387
- }
388
- }
438
+ fixPosition() {}
389
439
 
390
- fixPosition() {}
440
+ onResize() {}
391
441
 
392
- onResize() {}
393
-
394
- render() {
395
- if (this.mapvBaseLayer == undefined) return;
396
- this.mapvBaseLayer._canvasUpdate();
397
- }
442
+ render() {
443
+ if (this.mapvBaseLayer == undefined) return;
444
+ this.mapvBaseLayer._canvasUpdate();
445
+ }
398
446
  }
399
447
 
400
- export default MapvLayer;
448
+ export default MapvLayer;