@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.
- package/README.md +46 -49
- package/dist-libs/webclient-vue-cesium.common.js +191087 -0
- package/dist-libs/webclient-vue-cesium.css +1 -1
- package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
- package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
- package/docs/.vuepress/config.js +47 -46
- package/docs/README.md +5 -4
- package/docs/api/analysis/Aspect.md +236 -0
- package/docs/api/analysis/Contour.md +240 -0
- package/docs/api/analysis/CutFill.md +306 -0
- package/docs/api/analysis/DynamicSection.md +336 -0
- package/docs/api/analysis/Excavate.md +3 -11
- package/docs/api/analysis/Flood.md +177 -200
- package/docs/api/analysis/HeightLimited.md +7 -4
- package/docs/api/analysis/ParticleEffects.md +549 -0
- package/docs/api/analysis/Profile.md +464 -0
- package/docs/api/analysis/Shadow.md +76 -13
- package/docs/api/analysis/Sightline.md +66 -13
- package/docs/api/analysis/Skyline.md +144 -29
- package/docs/api/analysis/Slope.md +236 -0
- package/docs/api/analysis/Viewshed.md +100 -21
- package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
- package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
- package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
- package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
- package/docs/api/layer/OGC/Wms.png +0 -0
- package/docs/api/layer/marker/DynamicMarker.md +81 -0
- package/docs/api/layer/marker/dynamicmarker.png +0 -0
- package/docs/api/layer/marker/selects.png +0 -0
- package/docs/api/layer/vectortile/vectortile.md +10 -0
- package/docs/api/m3d/image/layer_control_1.png +0 -0
- package/docs/api/m3d/image/layer_control_2.png +0 -0
- package/docs/api/m3d/image/layer_control_3.png +0 -0
- package/docs/api/m3d/m3d.md +13 -2
- package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
- package/docs/api/ui/draw.md +68 -40
- package/docs/api/ui/link.md +8 -1
- package/docs/api/ui/marker.md +19 -1
- package/docs/api/ui/measure.md +82 -10
- package/docs/api/ui/table.md +6 -6
- package/docs/guide/README.md +26 -23
- package/docs/guide/basemap.md +35 -33
- package/docs/guide/markers&popups.md +46 -53
- package/docs/plugin_components/create_storybook.md +241 -0
- package/docs/plugin_components/img.png +0 -0
- package/docs/plugin_components/img_1.png +0 -0
- package/docs/plugin_components/img_10.png +0 -0
- package/docs/plugin_components/img_2.png +0 -0
- package/docs/plugin_components/img_3.png +0 -0
- package/docs/plugin_components/img_4.png +0 -0
- package/docs/plugin_components/img_5.png +0 -0
- package/docs/plugin_components/img_6.png +0 -0
- package/docs/plugin_components/img_7.png +0 -0
- package/docs/plugin_components/img_8.png +0 -0
- package/docs/version/diff.md +4 -4
- package/docs/version/version.md +81 -0
- package/package.json +5 -5
- package/src/cdn/cdn_component.js +62 -0
- package/src/component.js +20 -2
- package/src/components/Analysis/Aspect.vue +318 -0
- package/src/components/Analysis/Contour.vue +257 -0
- package/src/components/Analysis/CutFill.vue +581 -0
- package/src/components/Analysis/DynamicCutting.vue +98 -59
- package/src/components/Analysis/DynamicSection.vue +494 -0
- package/src/components/Analysis/Excavate.vue +133 -87
- package/src/components/Analysis/Flood.vue +395 -487
- package/src/components/Analysis/Flood.vue-- +630 -0
- package/src/components/Analysis/HeightLimited.vue +66 -47
- package/src/components/Analysis/ModelFlatten.vue +2 -2
- package/src/components/Analysis/Profile.vue +503 -0
- package/src/components/Analysis/Shadow.vue +220 -309
- package/src/components/Analysis/Sightline.vue +393 -375
- package/src/components/Analysis/SkyLine.vue +283 -93
- package/src/components/Analysis/Slope.vue +317 -0
- package/src/components/Analysis/Viewshed.vue +806 -373
- package/src/components/Analysis/skyline2dChartOptions.js +66 -0
- package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
- package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
- package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
- package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
- package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
- package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
- package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
- package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
- package/src/components/M3D/3DTilesetOptions.js +23 -1
- package/src/components/M3D/G3D.vue +150 -0
- package/src/components/M3D/M3d.vue +142 -32
- package/src/components/M3D/M3dSet.vue +118 -0
- package/src/components/M3D/M3dType.js +24 -0
- package/src/components/Overlay/Mapv3dLayer.vue +2 -0
- package/src/components/Overlay/ParticleEffects.vue +545 -0
- package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
- package/src/components/Overlay/mapv/MapvLayer.js +372 -324
- package/src/components/Overlay/mapv/SuperCluster.js +611 -0
- package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
- package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
- package/src/components/UI/Controls/Draw/Draw.vue +320 -92
- package/src/components/UI/Controls/Legend/Legend.vue +55 -51
- package/src/components/UI/Controls/Link/Link.vue +59 -37
- package/src/components/UI/Controls/Measure/Measure.vue +75 -33
- package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
- package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
- package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
- package/src/components/UI/Geojson/Popup.vue +101 -0
- package/src/components/UI/Marker/Marker.vue +185 -48
- package/src/components/UI/Popup/Popup.vue +21 -64
- package/src/components/Utils/common/color-util.js +159 -0
- package/src/components/Utils/util.js +311 -231
- package/src/components/WebGlobe/manager.js +81 -3
- package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
- package/src/components/WebGlobe/util.js +173 -0
- package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
- package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
- package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
- package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
- package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
- package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
- package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
- package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
- package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
- package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
- package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
- package/src/components/Overlay/Mapv.vue +0 -142
- package/src/components/Overlay/MapvHeater.vue +0 -98
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
baiduMapLayer,
|
|
3
|
+
DataSet,
|
|
4
|
+
utilDataRangeIntensity as Intensity
|
|
5
|
+
} from "mapv";
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
import Supercluster from './SuperCluster'
|
|
8
|
+
|
|
9
|
+
let BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* @private
|
|
@@ -14,34 +20,34 @@ var BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
|
14
20
|
* @extends BaseLayer
|
|
15
21
|
*
|
|
16
22
|
*/
|
|
17
|
-
|
|
23
|
+
export class MapvBaseLayer extends BaseLayer {
|
|
18
24
|
constructor(map, dataSet, options, cesiumLayer) {
|
|
19
|
-
|
|
25
|
+
super(map, dataSet, options);
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
if (!BaseLayer) return;
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
this.map = map; //此处的map是外面传入的cesium的map对象
|
|
30
|
+
this.scene = map.scene;
|
|
31
|
+
this.dataSet = dataSet;
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
let self = this;
|
|
34
|
+
let data = null;
|
|
35
|
+
options = options || {};
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
self.init(options);
|
|
38
|
+
self.argCheck(options);
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
this.initDevicePixelRatio();
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
this.canvasLayer = cesiumLayer;
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
this.stopAniamation = false;
|
|
45
|
+
this.animation = options.animation;
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
this.clickEvent = this.clickEvent.bind(this);
|
|
48
|
+
this.mousemoveEvent = this.mousemoveEvent.bind(this);
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
this.bindEvent();
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
/**
|
|
@@ -50,17 +56,17 @@ var BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
|
50
56
|
* 公式表示就是:window.devicePixelRatio = 物理像素 / dips,该函数主要应用与移动设备
|
|
51
57
|
*/
|
|
52
58
|
initDevicePixelRatio() {
|
|
53
|
-
|
|
59
|
+
this.devicePixelRatio = window.devicePixelRatio || 1;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
/**
|
|
57
63
|
* @function cesium.zondy.MapvBaseLayer.prototype.clickEvent
|
|
58
64
|
* @description 百度mapv原本的事件只有clickEvent和mousemoveEvent
|
|
59
65
|
* @param e 点击事件对象 {latlng, layerPoint, containerPoint, originalEvent}
|
|
60
|
-
* @example
|
|
66
|
+
* @example
|
|
61
67
|
* //mapv.map.BaseLayer.clickEvent
|
|
62
68
|
* clickEvent(pixel, e) {
|
|
63
|
-
*
|
|
69
|
+
* let dataItem = this.isPointInPath(this.getContext(), pixel);
|
|
64
70
|
* if (dataItem) {
|
|
65
71
|
* this.options.methods.click(dataItem, e);
|
|
66
72
|
* } else {
|
|
@@ -69,18 +75,18 @@ var BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
|
69
75
|
* }
|
|
70
76
|
*/
|
|
71
77
|
clickEvent(e) {
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
let pixel = e.point;
|
|
79
|
+
super.clickEvent(pixel, e);
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
/**
|
|
77
83
|
* @function cesium.zondy.MapvBaseLayer.prototype.mousemoveEvent
|
|
78
84
|
* @description 百度mapv原本的事件只有clickEvent和mousemoveEvent
|
|
79
85
|
* @param e 点击事件对象 {latlng, layerPoint, containerPoint, originalEvent}
|
|
80
|
-
* @example
|
|
86
|
+
* @example
|
|
81
87
|
* //mapv.map.BaseLayer.mousemoveEvent
|
|
82
88
|
* mousemoveEvent(pixel, e) {
|
|
83
|
-
*
|
|
89
|
+
* let dataItem = this.isPointInPath(this.getContext(), pixel);
|
|
84
90
|
* if (dataItem) {
|
|
85
91
|
* this.options.methods.mousemove(dataItem, e);
|
|
86
92
|
* } else {
|
|
@@ -89,220 +95,393 @@ var BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
|
89
95
|
* }
|
|
90
96
|
*/
|
|
91
97
|
mousemoveEvent(e) {
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
let pixel = e.point;
|
|
99
|
+
super.mousemoveEvent(pixel, e);
|
|
94
100
|
}
|
|
95
101
|
|
|
96
|
-
addAnimatorEvent() {
|
|
97
|
-
|
|
98
|
-
}
|
|
102
|
+
addAnimatorEvent() {}
|
|
99
103
|
|
|
100
104
|
animatorMovestartEvent() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
let animationOptions = this.options.animation;
|
|
106
|
+
if (this.isEnabledTime() && this.animator) {
|
|
107
|
+
this.steps.step = animationOptions.stepsRange.start;
|
|
108
|
+
//this.animator.stop();
|
|
109
|
+
}
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
animatorMoveendEvent() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
if (this.isEnabledTime() && this.animator) {
|
|
114
|
+
//this.animator.start();
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
bindEvent() {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
119
|
+
let map = this.map;
|
|
120
|
+
if (this.options.methods) {
|
|
121
|
+
if (this.options.methods.click) {
|
|
122
|
+
//map.on('click', this.clickEvent);
|
|
123
|
+
}
|
|
124
|
+
if (this.options.methods.mousemove) {
|
|
125
|
+
//map.on('mousemove', this.mousemoveEvent);
|
|
123
126
|
}
|
|
127
|
+
}
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
unbindEvent() {
|
|
127
|
-
|
|
131
|
+
let map = this.map;
|
|
128
132
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
133
|
+
if (this.options.methods) {
|
|
134
|
+
if (this.options.methods.click) {
|
|
135
|
+
map.off("click", this.clickEvent);
|
|
136
|
+
}
|
|
137
|
+
if (this.options.methods.mousemove) {
|
|
138
|
+
map.off("mousemove", this.mousemoveEvent);
|
|
136
139
|
}
|
|
140
|
+
}
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
getContext() {
|
|
140
|
-
|
|
144
|
+
return this.canvasLayer.canvas.getContext(this.context);
|
|
141
145
|
}
|
|
142
146
|
|
|
147
|
+
getZoom() {
|
|
148
|
+
let zoom = 0;
|
|
149
|
+
if (!this.map) return zoom;
|
|
150
|
+
let tiles = this.map.scene.globe._surface._tilesToRender;
|
|
151
|
+
if (tiles && tiles.length > 0) {
|
|
152
|
+
zoom = this.map.scene.globe._surface._tilesToRender[0].level;
|
|
153
|
+
}
|
|
154
|
+
return zoom;
|
|
155
|
+
}
|
|
143
156
|
|
|
144
157
|
init(options) {
|
|
158
|
+
let self = this;
|
|
145
159
|
|
|
146
|
-
|
|
160
|
+
self.options = options;
|
|
147
161
|
|
|
148
|
-
|
|
162
|
+
this.initDataRange(options);
|
|
149
163
|
|
|
150
|
-
|
|
164
|
+
this.context = self.options.context || "2d";
|
|
151
165
|
|
|
152
|
-
|
|
166
|
+
if (self.options.zIndex) {
|
|
167
|
+
this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
|
|
168
|
+
}
|
|
153
169
|
|
|
154
|
-
|
|
155
|
-
this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
this.initAnimator();
|
|
170
|
+
this.initAnimator();
|
|
159
171
|
}
|
|
160
172
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
173
|
+
// 经纬度左边转换为墨卡托坐标
|
|
174
|
+
transferToMercator(dataSet) {
|
|
175
|
+
if (!dataSet) {
|
|
176
|
+
dataSet = this.dataSet;
|
|
177
|
+
}
|
|
178
|
+
let lnglat2Mkt = poi => {
|
|
179
|
+
let mercator = {};
|
|
180
|
+
let earthRad = 6378137.0;
|
|
181
|
+
mercator.x = ((poi.lng * Math.PI) / 180) * earthRad;
|
|
182
|
+
let a = (poi.lat * Math.PI) / 180;
|
|
183
|
+
mercator.y =
|
|
184
|
+
(earthRad / 2) * Math.log((1.0 + Math.sin(a)) / (1.0 - Math.sin(a)));
|
|
185
|
+
return mercator;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
let map = this.map;
|
|
189
|
+
if (this.options.coordType !== "bd09mc") {
|
|
190
|
+
let data = dataSet.get();
|
|
191
|
+
data = dataSet.transferCoordinate(
|
|
192
|
+
data,
|
|
193
|
+
function(coordinates) {
|
|
194
|
+
if (
|
|
195
|
+
coordinates[0] < -180 ||
|
|
196
|
+
coordinates[0] > 180 ||
|
|
197
|
+
coordinates[1] < -90 ||
|
|
198
|
+
coordinates[1] > 90
|
|
199
|
+
) {
|
|
200
|
+
return coordinates;
|
|
201
|
+
} else {
|
|
202
|
+
let pixel = lnglat2Mkt({
|
|
203
|
+
lng: coordinates[0],
|
|
204
|
+
lat: coordinates[1]
|
|
205
|
+
});
|
|
206
|
+
return [pixel.x, pixel.y];
|
|
184
207
|
}
|
|
185
|
-
|
|
186
|
-
|
|
208
|
+
},
|
|
209
|
+
"coordinates",
|
|
210
|
+
"coordinates_mercator"
|
|
211
|
+
);
|
|
212
|
+
dataSet._set(data);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
dataOptions() {
|
|
217
|
+
const self = this;
|
|
218
|
+
return {
|
|
219
|
+
transferCoordinate: function(coordinate) {
|
|
220
|
+
let pointSphere = Cesium.Cartesian3.fromDegrees(
|
|
221
|
+
coordinate[0],
|
|
222
|
+
coordinate[1]
|
|
223
|
+
);
|
|
224
|
+
let position = self.map.camera.position;
|
|
225
|
+
let cameraHeight = self.map.scene.globe.ellipsoid.cartesianToCartographic(
|
|
226
|
+
position
|
|
227
|
+
).height;
|
|
228
|
+
cameraHeight += self.map.scene.globe.ellipsoid.maximumRadius * 1.2;
|
|
229
|
+
let distance = Cesium.Cartesian3.distance(position, pointSphere);
|
|
230
|
+
if (distance > cameraHeight) {
|
|
231
|
+
return undefined;
|
|
232
|
+
// return [-50, -50];a
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
let car3 = Cesium.Cartesian3.fromDegrees(coordinate[0], coordinate[1]);
|
|
236
|
+
let point = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
|
|
237
|
+
self.map.scene,
|
|
238
|
+
car3
|
|
239
|
+
);
|
|
240
|
+
if (!point) return [0, 0];
|
|
241
|
+
|
|
242
|
+
if (self.options.draw === "cluster") {
|
|
243
|
+
return [
|
|
244
|
+
point.x * self.devicePixelRatio,
|
|
245
|
+
point.y * self.devicePixelRatio
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
return [point.x, point.y];
|
|
187
249
|
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
188
252
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
253
|
+
changeCluster() {
|
|
254
|
+
const self = this;
|
|
255
|
+
let zoom = this.getZoom();
|
|
256
|
+
let dataGetOptions = this.dataOptions();
|
|
257
|
+
let rect = this.map.scene.camera.computeViewRectangle();
|
|
258
|
+
const south = Cesium.Math.toDegrees(rect.south);
|
|
259
|
+
const north = Cesium.Math.toDegrees(rect.north);
|
|
260
|
+
const east = Cesium.Math.toDegrees(rect.east);
|
|
261
|
+
const west = Cesium.Math.toDegrees(rect.west);
|
|
262
|
+
|
|
263
|
+
let clusterData = this.supercluster.getClusters(
|
|
264
|
+
[west, south, east, north],
|
|
265
|
+
zoom
|
|
266
|
+
);
|
|
267
|
+
this.pointCountMax = this.supercluster.trees[zoom].max;
|
|
268
|
+
this.pointCountMin = this.supercluster.trees[zoom].min;
|
|
269
|
+
let intensity = {};
|
|
270
|
+
let color = null;
|
|
271
|
+
let size = null;
|
|
272
|
+
if (this.pointCountMax === this.pointCountMin) {
|
|
273
|
+
color = this.options.fillStyle;
|
|
274
|
+
size = this.options.minSize || 8;
|
|
275
|
+
} else {
|
|
276
|
+
intensity = new Intensity({
|
|
277
|
+
min: this.pointCountMin,
|
|
278
|
+
max: this.pointCountMax,
|
|
279
|
+
minSize: this.options.minSize || 8,
|
|
280
|
+
maxSize: this.options.maxSize || 30,
|
|
281
|
+
gradient: this.options.gradient
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
for (let i = 0; i < clusterData.length; i++) {
|
|
285
|
+
let item = clusterData[i];
|
|
286
|
+
if (item.properties && item.properties.cluster_id) {
|
|
287
|
+
clusterData[i].size =
|
|
288
|
+
size || intensity.getSize(item.properties.point_count);
|
|
289
|
+
clusterData[i].fillStyle =
|
|
290
|
+
color || intensity.getColor(item.properties.point_count);
|
|
193
291
|
} else {
|
|
194
|
-
|
|
292
|
+
clusterData[i].size = self.options.size;
|
|
195
293
|
}
|
|
294
|
+
}
|
|
295
|
+
this.clusterDataSet.set(clusterData);
|
|
296
|
+
this.transferToMercator(self.clusterDataSet);
|
|
297
|
+
let data = self.clusterDataSet.get(dataGetOptions);
|
|
298
|
+
return data;
|
|
299
|
+
}
|
|
196
300
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
301
|
+
refreshCluster(options) {
|
|
302
|
+
options = options || this.options;
|
|
303
|
+
this.supercluster = new Supercluster({
|
|
304
|
+
maxZoom: options.maxZoom || 19,
|
|
305
|
+
radius: options.clusterRadius || 100,
|
|
306
|
+
minPoints: options.minPoints || 2,
|
|
307
|
+
extent: options.extent || 512
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
this.supercluster.load(this.dataSet.get());
|
|
311
|
+
// 拿到每个级别下的最大值最小值
|
|
312
|
+
this.supercluster.trees.forEach(item => {
|
|
313
|
+
let max = 0;
|
|
314
|
+
let min = Infinity;
|
|
315
|
+
item.points.forEach(point => {
|
|
316
|
+
max = Math.max(point.numPoints || 0, max);
|
|
317
|
+
min = Math.min(point.numPoints || Infinity, min);
|
|
318
|
+
});
|
|
319
|
+
item.max = max;
|
|
320
|
+
item.min = min;
|
|
321
|
+
});
|
|
322
|
+
this.clusterDataSet = new DataSet();
|
|
323
|
+
}
|
|
215
324
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
325
|
+
_canvasUpdate(time) {
|
|
326
|
+
let map = this.map;
|
|
327
|
+
let scene = this.scene;
|
|
328
|
+
if (!this.canvasLayer || this.stopAniamation) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
let self = this;
|
|
226
332
|
|
|
227
|
-
|
|
333
|
+
let animationOptions = self.options.animation;
|
|
228
334
|
|
|
229
|
-
|
|
335
|
+
let context = self.getContext();
|
|
230
336
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
self.options._size = self.options.size;
|
|
337
|
+
if (self.isEnabledTime()) {
|
|
338
|
+
if (time === undefined) {
|
|
339
|
+
this.clear(context);
|
|
340
|
+
return;
|
|
236
341
|
}
|
|
342
|
+
if (this.context === "2d") {
|
|
343
|
+
context.save();
|
|
344
|
+
context.globalCompositeOperation = "destination-out";
|
|
345
|
+
context.fillStyle = "rgba(0, 0, 0, .1)";
|
|
346
|
+
context.fillRect(0, 0, context.canvas.width, context.canvas.height);
|
|
347
|
+
context.restore();
|
|
348
|
+
}
|
|
349
|
+
} else {
|
|
350
|
+
this.clear(context);
|
|
351
|
+
}
|
|
237
352
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
353
|
+
if (this.context === "2d") {
|
|
354
|
+
for (let key in self.options) {
|
|
355
|
+
context[key] = self.options[key];
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
context.clear(context.COLOR_BUFFER_BIT);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (
|
|
362
|
+
(self.options.minZoom && self.getZoom() < self.options.minZoom) ||
|
|
363
|
+
(self.options.maxZoom && self.getZoom() > self.options.maxZoom)
|
|
364
|
+
) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
let dataGetOptions = this.dataOptions();
|
|
369
|
+
|
|
370
|
+
if (time !== undefined) {
|
|
371
|
+
dataGetOptions.filter = function(item) {
|
|
372
|
+
let trails = animationOptions.trails || 10;
|
|
373
|
+
if (time && item.time > time - trails && item.time < time) {
|
|
374
|
+
return true;
|
|
375
|
+
} else {
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
let data;
|
|
382
|
+
let zoom = this.getZoom();
|
|
383
|
+
if (
|
|
384
|
+
this.options.draw === "cluster" &&
|
|
385
|
+
(!this.options.maxClusterZoom || this.options.maxClusterZoom >= zoom)
|
|
386
|
+
) {
|
|
387
|
+
data = this.changeCluster();
|
|
388
|
+
} else {
|
|
389
|
+
data = self.dataSet.get(dataGetOptions);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
this.processData(data);
|
|
393
|
+
|
|
394
|
+
if (self.options.unit == "m" && self.options.size) {
|
|
395
|
+
//self.options._size = self.options.size / zoomUnit;
|
|
396
|
+
self.options._size = self.options.size;
|
|
397
|
+
} else {
|
|
398
|
+
self.options._size = self.options.size;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
let pixel = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
|
|
402
|
+
scene,
|
|
403
|
+
Cesium.Cartesian3.fromDegrees(0, 0)
|
|
404
|
+
);
|
|
405
|
+
if (!pixel) pixel = [0, 0];
|
|
406
|
+
this.drawContext(context, new DataSet(data), self.options, pixel);
|
|
407
|
+
|
|
408
|
+
self.options.updateCallback && self.options.updateCallback(time);
|
|
243
409
|
}
|
|
244
410
|
|
|
245
411
|
updateData(data, options) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
412
|
+
let _data = data;
|
|
413
|
+
if (_data && _data.get) {
|
|
414
|
+
_data = _data.get();
|
|
415
|
+
}
|
|
416
|
+
if (_data != undefined) {
|
|
417
|
+
let zoom = this.getZoom();
|
|
418
|
+
if (
|
|
419
|
+
this.options.draw === "cluster" &&
|
|
420
|
+
(!this.options.maxClusterZoom || this.options.maxClusterZoom >= zoom)
|
|
421
|
+
) {
|
|
422
|
+
this.dataSet = data;
|
|
423
|
+
this.refreshCluster(this.options);
|
|
424
|
+
_data = this.changeCluster();
|
|
425
|
+
this.dataSet.set(_data);
|
|
426
|
+
} else {
|
|
427
|
+
this.dataSet.set(_data);
|
|
252
428
|
}
|
|
429
|
+
}
|
|
253
430
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
431
|
+
super.update({
|
|
432
|
+
options: options
|
|
433
|
+
});
|
|
258
434
|
}
|
|
259
435
|
|
|
260
436
|
addData(data, options) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
437
|
+
let _data = data;
|
|
438
|
+
if (data && data.get) {
|
|
439
|
+
_data = data.get();
|
|
440
|
+
}
|
|
441
|
+
this.dataSet.add(_data);
|
|
442
|
+
this.update({
|
|
443
|
+
options: options
|
|
444
|
+
});
|
|
269
445
|
}
|
|
270
446
|
|
|
271
447
|
getData() {
|
|
272
|
-
|
|
448
|
+
return this.dataSet;
|
|
273
449
|
}
|
|
274
450
|
|
|
275
451
|
removeData(filter) {
|
|
276
|
-
|
|
277
|
-
|
|
452
|
+
if (!this.dataSet) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
let newData = this.dataSet.get({
|
|
456
|
+
filter: function(data) {
|
|
457
|
+
return filter != null && typeof filter === "function"
|
|
458
|
+
? !filter(data)
|
|
459
|
+
: true;
|
|
278
460
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
});
|
|
284
|
-
this.dataSet.set(newData);
|
|
285
|
-
this.stopAniamation = true;
|
|
286
|
-
/* this.update({
|
|
461
|
+
});
|
|
462
|
+
this.dataSet.set(newData);
|
|
463
|
+
this.stopAniamation = true;
|
|
464
|
+
/* this.update({
|
|
287
465
|
options: null
|
|
288
466
|
}); */
|
|
289
467
|
}
|
|
290
468
|
|
|
291
469
|
clearData() {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
470
|
+
this.dataSet && this.dataSet.clear();
|
|
471
|
+
this.stopAniamation = true;
|
|
472
|
+
/* this.update({
|
|
295
473
|
options: null
|
|
296
474
|
}); */
|
|
297
475
|
}
|
|
298
476
|
|
|
299
477
|
draw() {
|
|
300
|
-
|
|
478
|
+
this.canvasLayer.draw();
|
|
301
479
|
}
|
|
302
480
|
|
|
303
481
|
//该函数从mapv/canvas/clear中提取
|
|
304
482
|
clear(context) {
|
|
305
|
-
|
|
483
|
+
context &&
|
|
484
|
+
context.clearRect &&
|
|
485
|
+
context.clearRect(0, 0, context.canvas.width, context.canvas.height);
|
|
306
486
|
}
|
|
307
|
-
|
|
308
|
-
}
|
|
487
|
+
}
|