bruce-cesium 2.1.7 → 2.1.8
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/dist/bruce-cesium.es5.js +715 -46
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +714 -45
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +66 -13
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/point-clustering.js +602 -0
- package/dist/lib/rendering/render-managers/common/point-clustering.js.map +1 -0
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +18 -10
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +40 -20
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +12 -1
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/entity-render-engine.d.ts +8 -0
- package/dist/types/rendering/render-managers/common/point-clustering.d.ts +97 -0
- package/dist/types/rendering/render-managers/entities/entities-ids-render-manager.d.ts +1 -0
- package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PointClustering = void 0;
|
|
4
|
+
var bruce_models_1 = require("bruce-models");
|
|
5
|
+
var Cesium = require("cesium");
|
|
6
|
+
function GetValue(viewer, obj) {
|
|
7
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
8
|
+
return obj.getValue(viewer.scene.lastRenderTime);
|
|
9
|
+
}
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
var Point = /** @class */ (function () {
|
|
13
|
+
function Point(lon, lat, id) {
|
|
14
|
+
this.lon = lon;
|
|
15
|
+
this.lat = lat;
|
|
16
|
+
this.id = id;
|
|
17
|
+
}
|
|
18
|
+
return Point;
|
|
19
|
+
}());
|
|
20
|
+
var Circle = /** @class */ (function () {
|
|
21
|
+
function Circle(x, y, radius) {
|
|
22
|
+
this.x = x;
|
|
23
|
+
this.y = y;
|
|
24
|
+
this.radius = radius;
|
|
25
|
+
this.width = 2 * radius;
|
|
26
|
+
this.height = 2 * radius;
|
|
27
|
+
}
|
|
28
|
+
Circle.prototype.Intersects = function (range) {
|
|
29
|
+
var xDist = Math.abs(range.x - this.x);
|
|
30
|
+
var yDist = Math.abs(range.y - this.y);
|
|
31
|
+
var r = this.radius;
|
|
32
|
+
var w = range.width;
|
|
33
|
+
var h = range.height;
|
|
34
|
+
if (xDist > (w + r) || yDist > (h + r)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (xDist <= w || yDist <= h) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
var dx = xDist - w;
|
|
41
|
+
var dy = yDist - h;
|
|
42
|
+
return (dx * dx + dy * dy <= this.radius * this.radius);
|
|
43
|
+
};
|
|
44
|
+
Circle.prototype.Contains = function (point) {
|
|
45
|
+
var dx = this.x - point.lon;
|
|
46
|
+
var dy = this.y - point.lat;
|
|
47
|
+
var distance = Math.sqrt(dx * dx + dy * dy);
|
|
48
|
+
return distance <= this.radius;
|
|
49
|
+
};
|
|
50
|
+
return Circle;
|
|
51
|
+
}());
|
|
52
|
+
var Rectangle = /** @class */ (function () {
|
|
53
|
+
function Rectangle(x, y, w, h) {
|
|
54
|
+
this.x = x;
|
|
55
|
+
this.y = y;
|
|
56
|
+
this.w = w;
|
|
57
|
+
this.h = h;
|
|
58
|
+
this.width = 2 * w;
|
|
59
|
+
this.height = 2 * h;
|
|
60
|
+
}
|
|
61
|
+
Rectangle.prototype.Contains = function (point) {
|
|
62
|
+
return (point.lon >= this.x - this.w &&
|
|
63
|
+
point.lon < this.x + this.w &&
|
|
64
|
+
point.lat >= this.y - this.h &&
|
|
65
|
+
point.lat < this.y + this.h);
|
|
66
|
+
};
|
|
67
|
+
Rectangle.prototype.Intersects = function (range) {
|
|
68
|
+
return !(range.x - range.w > this.x + this.w ||
|
|
69
|
+
range.x + range.w < this.x - this.w ||
|
|
70
|
+
range.y - range.h > this.y + this.h ||
|
|
71
|
+
range.y + range.h < this.y - this.h);
|
|
72
|
+
};
|
|
73
|
+
return Rectangle;
|
|
74
|
+
}());
|
|
75
|
+
var Quad = /** @class */ (function () {
|
|
76
|
+
function Quad(boundary, capacity) {
|
|
77
|
+
this.boundary = boundary;
|
|
78
|
+
this.capacity = capacity;
|
|
79
|
+
this.points = [];
|
|
80
|
+
this.divided = false;
|
|
81
|
+
}
|
|
82
|
+
Quad.prototype.Subdivide = function () {
|
|
83
|
+
var x = this.boundary.x;
|
|
84
|
+
var y = this.boundary.y;
|
|
85
|
+
var w = this.boundary.w / 2;
|
|
86
|
+
var h = this.boundary.h / 2;
|
|
87
|
+
var ne = new Rectangle(x + w / 2, y - h / 2, w, h);
|
|
88
|
+
this.northeast = new Quad(ne, this.capacity);
|
|
89
|
+
var nw = new Rectangle(x - w / 2, y - h / 2, w, h);
|
|
90
|
+
this.northwest = new Quad(nw, this.capacity);
|
|
91
|
+
var se = new Rectangle(x + w / 2, y + h / 2, w, h);
|
|
92
|
+
this.southeast = new Quad(se, this.capacity);
|
|
93
|
+
var sw = new Rectangle(x - w / 2, y + h / 2, w, h);
|
|
94
|
+
this.southwest = new Quad(sw, this.capacity);
|
|
95
|
+
this.divided = true;
|
|
96
|
+
};
|
|
97
|
+
Quad.prototype.Insert = function (point) {
|
|
98
|
+
if (!this.boundary.Contains(point)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (this.points.length < this.capacity) {
|
|
102
|
+
this.points.push(point);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (!this.divided) {
|
|
106
|
+
this.Subdivide();
|
|
107
|
+
}
|
|
108
|
+
return (this.northeast.Insert(point) || this.northwest.Insert(point) ||
|
|
109
|
+
this.southeast.Insert(point) || this.southwest.Insert(point));
|
|
110
|
+
};
|
|
111
|
+
Quad.prototype.Query = function (range, found) {
|
|
112
|
+
if (!found) {
|
|
113
|
+
found = [];
|
|
114
|
+
}
|
|
115
|
+
if (!range.Intersects(this.boundary)) {
|
|
116
|
+
return found;
|
|
117
|
+
}
|
|
118
|
+
for (var _i = 0, _a = this.points; _i < _a.length; _i++) {
|
|
119
|
+
var p = _a[_i];
|
|
120
|
+
if (range.Contains(p)) {
|
|
121
|
+
found.push(p);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (this.divided) {
|
|
125
|
+
this.northwest.Query(range, found);
|
|
126
|
+
this.northeast.Query(range, found);
|
|
127
|
+
this.southwest.Query(range, found);
|
|
128
|
+
this.southeast.Query(range, found);
|
|
129
|
+
}
|
|
130
|
+
return found;
|
|
131
|
+
};
|
|
132
|
+
Quad.prototype.Find = function (id) {
|
|
133
|
+
for (var _i = 0, _a = this.points; _i < _a.length; _i++) {
|
|
134
|
+
var point = _a[_i];
|
|
135
|
+
if (point.id === id) {
|
|
136
|
+
return point;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (this.divided) {
|
|
140
|
+
return this.northwest.Find(id) || this.northeast.Find(id) ||
|
|
141
|
+
this.southwest.Find(id) || this.southeast.Find(id);
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
};
|
|
145
|
+
Quad.prototype.Remove = function (point) {
|
|
146
|
+
var index = this.points.indexOf(point);
|
|
147
|
+
if (index !== -1) {
|
|
148
|
+
this.points.splice(index, 1);
|
|
149
|
+
}
|
|
150
|
+
if (this.divided) {
|
|
151
|
+
this.northwest.Remove(point);
|
|
152
|
+
this.northeast.Remove(point);
|
|
153
|
+
this.southwest.Remove(point);
|
|
154
|
+
this.southeast.Remove(point);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
return Quad;
|
|
158
|
+
}());
|
|
159
|
+
var PointClustering = /** @class */ (function () {
|
|
160
|
+
function PointClustering(register, menuItemId) {
|
|
161
|
+
var _this = this;
|
|
162
|
+
this.disposed = false;
|
|
163
|
+
this.registeredEntityIds = new Set();
|
|
164
|
+
this.register = register;
|
|
165
|
+
this.viewer = register.Viewer;
|
|
166
|
+
this.menuItemId = menuItemId;
|
|
167
|
+
this.updateClusterSpacing(0);
|
|
168
|
+
var boundary = new Rectangle(0, 0, 360, 180);
|
|
169
|
+
this.quadTree = new Quad(boundary, 4);
|
|
170
|
+
this.prevClusteredEntities = new Set();
|
|
171
|
+
this.currClusteredEntities = new Set();
|
|
172
|
+
this.clusterEntities = new Map();
|
|
173
|
+
this.updateQueue = new bruce_models_1.DelayQueue(function () {
|
|
174
|
+
_this.doUpdate();
|
|
175
|
+
}, 1000);
|
|
176
|
+
this.listenCamera();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Starts listening to camera changes.
|
|
180
|
+
* This will trigger the clustering update whenever camera is moved.
|
|
181
|
+
*/
|
|
182
|
+
PointClustering.prototype.listenCamera = function () {
|
|
183
|
+
var _this = this;
|
|
184
|
+
var viewer = this.viewer;
|
|
185
|
+
var lastPos3d;
|
|
186
|
+
var hasMoved = function () {
|
|
187
|
+
var _a;
|
|
188
|
+
var cameraPos = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.camera) === null || _a === void 0 ? void 0 : _a.positionCartographic;
|
|
189
|
+
if (!cameraPos) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
var pos3d = Cesium.Cartographic.toCartesian(cameraPos);
|
|
193
|
+
if (!lastPos3d) {
|
|
194
|
+
lastPos3d = pos3d;
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
var distance = Cesium.Cartesian3.distance(pos3d, lastPos3d);
|
|
198
|
+
lastPos3d = pos3d;
|
|
199
|
+
// 50 meter movement at least.
|
|
200
|
+
return distance > 50;
|
|
201
|
+
};
|
|
202
|
+
this.listenCameraRemoval = viewer.scene.camera.changed.addEventListener(function () {
|
|
203
|
+
if (hasMoved()) {
|
|
204
|
+
_this.updateQueue.Call();
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Stops listening to camera changes.
|
|
210
|
+
*/
|
|
211
|
+
PointClustering.prototype.unlistenCamera = function () {
|
|
212
|
+
if (this.listenCameraRemoval) {
|
|
213
|
+
this.listenCameraRemoval();
|
|
214
|
+
this.listenCameraRemoval = null;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Removes all clusters and updates entities to no longer be suppressed.
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
PointClustering.prototype.Dispose = function () {
|
|
222
|
+
if (this.disposed) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
for (var _i = 0, _a = Array.from(this.clusterEntities); _i < _a.length; _i++) {
|
|
226
|
+
var _b = _a[_i], entity = _b[1];
|
|
227
|
+
this.viewer.entities.remove(entity);
|
|
228
|
+
}
|
|
229
|
+
this.clusterEntities.clear();
|
|
230
|
+
this.unlistenCamera();
|
|
231
|
+
this.disposed = true;
|
|
232
|
+
// Restore entities.
|
|
233
|
+
var toUpdateIds = [];
|
|
234
|
+
for (var _c = 0, _d = Array.from(this.registeredEntityIds); _c < _d.length; _c++) {
|
|
235
|
+
var id = _d[_c];
|
|
236
|
+
var rego = this.register.GetRego({
|
|
237
|
+
entityId: id,
|
|
238
|
+
menuItemId: this.menuItemId
|
|
239
|
+
});
|
|
240
|
+
if (rego && rego.suppressShow) {
|
|
241
|
+
rego.suppressShow = false;
|
|
242
|
+
toUpdateIds.push(id);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (toUpdateIds.length) {
|
|
246
|
+
this.register.ForceUpdate({
|
|
247
|
+
entityIds: toUpdateIds,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Calculates center of given points.
|
|
253
|
+
* @param points
|
|
254
|
+
* @returns
|
|
255
|
+
*/
|
|
256
|
+
PointClustering.prototype.calculateCentroid = function (points) {
|
|
257
|
+
var lonSum = 0;
|
|
258
|
+
var latSum = 0;
|
|
259
|
+
for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
|
|
260
|
+
var point = points_1[_i];
|
|
261
|
+
lonSum += point.lon;
|
|
262
|
+
latSum += point.lat;
|
|
263
|
+
}
|
|
264
|
+
var lonAvg = lonSum / points.length;
|
|
265
|
+
var latAvg = latSum / points.length;
|
|
266
|
+
return new Point(lonAvg, latAvg, "");
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Gathers current clusters and renders them.
|
|
270
|
+
* @returns
|
|
271
|
+
*/
|
|
272
|
+
PointClustering.prototype.doUpdate = function () {
|
|
273
|
+
var _this = this;
|
|
274
|
+
if (this.disposed) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
// 1: Update precision.
|
|
278
|
+
// This defines how far apart these clusters can be.
|
|
279
|
+
var cameraHeight = this.viewer.camera.positionCartographic.height;
|
|
280
|
+
this.updateClusterSpacing(cameraHeight);
|
|
281
|
+
// 2: Get clusters.
|
|
282
|
+
var _a = this.getClusters(), clusters = _a.clusters, noLongerClustered = _a.noLongerClustered;
|
|
283
|
+
// 3: Remove all cesium cluster entities that are no longer clustered.
|
|
284
|
+
for (var _i = 0, _b = Array.from(noLongerClustered); _i < _b.length; _i++) {
|
|
285
|
+
var id = _b[_i];
|
|
286
|
+
this.removeClusterEntity(id);
|
|
287
|
+
}
|
|
288
|
+
// 4: Stop hiding entities that are no longer clustered.
|
|
289
|
+
var previousEntityIds = new Set(this.registeredEntityIds);
|
|
290
|
+
for (var _c = 0, _d = Array.from(previousEntityIds); _c < _d.length; _c++) {
|
|
291
|
+
var id = _d[_c];
|
|
292
|
+
if (!this.currClusteredEntities.has(id)) {
|
|
293
|
+
var rego = this.register.GetRego({
|
|
294
|
+
entityId: id,
|
|
295
|
+
menuItemId: this.menuItemId
|
|
296
|
+
});
|
|
297
|
+
if (rego && rego.suppressShow) {
|
|
298
|
+
rego.suppressShow = false;
|
|
299
|
+
this.register.ForceUpdate({
|
|
300
|
+
entityIds: [id],
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
var getScale = function (count) {
|
|
306
|
+
var baseSize = 20;
|
|
307
|
+
var scalingFactor = 2;
|
|
308
|
+
var scale = baseSize + scalingFactor * (count - 1);
|
|
309
|
+
scale = Math.min(scale, 120);
|
|
310
|
+
return scale;
|
|
311
|
+
};
|
|
312
|
+
var getLabel = function (count) {
|
|
313
|
+
var color = _this.pointColorTxt ? _this.pointColorTxt : "white";
|
|
314
|
+
var canvas = document.createElement("canvas");
|
|
315
|
+
var ctx = canvas.getContext("2d");
|
|
316
|
+
var size = getScale(count);
|
|
317
|
+
canvas.width = size;
|
|
318
|
+
canvas.height = size;
|
|
319
|
+
ctx.font = "bold 20px Arial";
|
|
320
|
+
ctx.fillStyle = color;
|
|
321
|
+
ctx.textAlign = "center";
|
|
322
|
+
ctx.textBaseline = "middle";
|
|
323
|
+
ctx.fillText(String(count), size / 2, size / 2);
|
|
324
|
+
return canvas;
|
|
325
|
+
};
|
|
326
|
+
// 5: iterate over clusters and add/update them as Cesium entities.
|
|
327
|
+
for (var _e = 0, clusters_1 = clusters; _e < clusters_1.length; _e++) {
|
|
328
|
+
var cluster = clusters_1[_e];
|
|
329
|
+
var clusterId = cluster.center.id;
|
|
330
|
+
var clusterEntity = this.clusterEntities.get(clusterId);
|
|
331
|
+
var centroid = this.calculateCentroid(cluster.points);
|
|
332
|
+
var count = cluster.points.length;
|
|
333
|
+
if (clusterEntity) {
|
|
334
|
+
clusterEntity.position = Cesium.Cartesian3.fromDegrees(centroid.lon, centroid.lat, 150);
|
|
335
|
+
clusterEntity.point.pixelSize = getScale(cluster.points.length);
|
|
336
|
+
clusterEntity.billboard.image = getLabel(cluster.points.length);
|
|
337
|
+
clusterEntity.billboard.width = getScale(cluster.points.length);
|
|
338
|
+
clusterEntity.billboard.height = getScale(cluster.points.length);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
clusterEntity = this.viewer.entities.add({
|
|
342
|
+
position: Cesium.Cartesian3.fromDegrees(centroid.lon, centroid.lat, 150),
|
|
343
|
+
point: {
|
|
344
|
+
heightReference: Cesium.HeightReference.NONE,
|
|
345
|
+
pixelSize: getScale(count),
|
|
346
|
+
color: this.pointColorBg ? this.pointColorBg : Cesium.Color.fromCssColorString("#4287f5")
|
|
347
|
+
},
|
|
348
|
+
billboard: {
|
|
349
|
+
heightReference: Cesium.HeightReference.NONE,
|
|
350
|
+
image: getLabel(count),
|
|
351
|
+
width: getScale(count),
|
|
352
|
+
height: getScale(count),
|
|
353
|
+
verticalOrigin: Cesium.VerticalOrigin.CENTER,
|
|
354
|
+
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
355
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
this.clusterEntities.set(clusterId, clusterEntity);
|
|
359
|
+
}
|
|
360
|
+
for (var i = 0; i < cluster.points.length; i++) {
|
|
361
|
+
var entityId = cluster.points[i].id;
|
|
362
|
+
var rego = this.register.GetRego({
|
|
363
|
+
entityId: entityId,
|
|
364
|
+
menuItemId: this.menuItemId
|
|
365
|
+
});
|
|
366
|
+
if (rego && !rego.suppressShow) {
|
|
367
|
+
rego.suppressShow = true;
|
|
368
|
+
this.register.ForceUpdate({
|
|
369
|
+
entityIds: [entityId],
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
var _loop_1 = function (clusterId, clusterEntity) {
|
|
375
|
+
if (!clusters.find(function (x) { return x.center.id == clusterId; })) {
|
|
376
|
+
this_1.viewer.entities.remove(clusterEntity);
|
|
377
|
+
this_1.clusterEntities.delete(clusterId);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
var this_1 = this;
|
|
381
|
+
// 6: Iterate over existing cluster entities and remove those that are no longer clustered.
|
|
382
|
+
for (var _f = 0, _g = Array.from(this.clusterEntities); _f < _g.length; _f++) {
|
|
383
|
+
var _h = _g[_f], clusterId = _h[0], clusterEntity = _h[1];
|
|
384
|
+
_loop_1(clusterId, clusterEntity);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Updates how apart clusters can be based on camera distance.
|
|
389
|
+
* @param cameraHeight
|
|
390
|
+
*/
|
|
391
|
+
PointClustering.prototype.updateClusterSpacing = function (cameraHeight) {
|
|
392
|
+
// Camera height thresholds in meters.
|
|
393
|
+
var cameraHeightThresholds = [2000, 5000, 8000, 13000, 25000, 40000];
|
|
394
|
+
// Distance increments in degrees.
|
|
395
|
+
var distanceIncrements = [0.005, 0.01, 0.02, 0.04, 0.1, 0.5];
|
|
396
|
+
// Find the appropriate spacing based on the camera height.
|
|
397
|
+
var spacing = 0;
|
|
398
|
+
for (var i = 0; i < cameraHeightThresholds.length; i++) {
|
|
399
|
+
if (cameraHeight && cameraHeight < cameraHeightThresholds[i]) {
|
|
400
|
+
spacing += distanceIncrements[i];
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
spacing += distanceIncrements[i];
|
|
404
|
+
}
|
|
405
|
+
this.distanceBetweenClusters = spacing;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* Gathers clusters.
|
|
409
|
+
* @returns
|
|
410
|
+
*/
|
|
411
|
+
PointClustering.prototype.getClusters = function () {
|
|
412
|
+
var _this = this;
|
|
413
|
+
this.currClusteredEntities.clear();
|
|
414
|
+
var clusters = [];
|
|
415
|
+
var processedPoints = new Set();
|
|
416
|
+
var cameraPosition = this.viewer.camera.position;
|
|
417
|
+
for (var _i = 0, _a = this.quadTree.points; _i < _a.length; _i++) {
|
|
418
|
+
var point = _a[_i];
|
|
419
|
+
// Skip points already processed in previous clusters.
|
|
420
|
+
if (processedPoints.has(point.id)) {
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
// Skip points closer than 2000 meters to the camera.
|
|
424
|
+
var cartesian3 = Cesium.Cartesian3.fromDegrees(point.lon, point.lat);
|
|
425
|
+
if (Cesium.Cartesian3.distance(cartesian3, cameraPosition) <= 2000) {
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
var found = [];
|
|
429
|
+
var nearbyPoints = this.quadTree.Query(new Circle(point.lon, point.lat, this.distanceBetweenClusters), found);
|
|
430
|
+
if (nearbyPoints.length > 1) {
|
|
431
|
+
var cluster = { center: point, points: [] };
|
|
432
|
+
for (var _b = 0, nearbyPoints_1 = nearbyPoints; _b < nearbyPoints_1.length; _b++) {
|
|
433
|
+
var nearby = nearbyPoints_1[_b];
|
|
434
|
+
if (!cluster.points.includes(nearby)) {
|
|
435
|
+
cluster.points.push(nearby);
|
|
436
|
+
processedPoints.add(nearby.id);
|
|
437
|
+
this.currClusteredEntities.add(nearby.id);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
clusters.push(cluster);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// Filter out clusters with only one point.
|
|
444
|
+
var validClusters = clusters.filter(function (cluster) { return cluster.points.length > 1; });
|
|
445
|
+
// Merge adjacent clusters.
|
|
446
|
+
var mergedClusters = this.mergeClusters(validClusters);
|
|
447
|
+
// Get the entity IDs that are no longer clustered
|
|
448
|
+
var noLongerClustered = new Set(Array.from(this.prevClusteredEntities).filter(function (id) { return !_this.currClusteredEntities.has(id); }));
|
|
449
|
+
// Update the previous clustered entities ref.
|
|
450
|
+
this.prevClusteredEntities = new Set(this.currClusteredEntities);
|
|
451
|
+
return { clusters: mergedClusters, noLongerClustered: noLongerClustered };
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Merges clusters that are nearby based on the distanceBetweenClusters value.
|
|
455
|
+
* @param clusters
|
|
456
|
+
* @returns
|
|
457
|
+
*/
|
|
458
|
+
PointClustering.prototype.mergeClusters = function (clusters) {
|
|
459
|
+
var _a;
|
|
460
|
+
var mergedClusters = [].concat(clusters);
|
|
461
|
+
// Keep looping while merges keep happening.
|
|
462
|
+
var mergeOccurred = true;
|
|
463
|
+
while (mergeOccurred) {
|
|
464
|
+
mergeOccurred = false;
|
|
465
|
+
for (var i = 0; i < mergedClusters.length - 1; i++) {
|
|
466
|
+
for (var j = i + 1; j < mergedClusters.length; j++) {
|
|
467
|
+
var cluster1 = mergedClusters[i];
|
|
468
|
+
var cluster2 = mergedClusters[j];
|
|
469
|
+
var centerDistance = this.calculateDistance(cluster1.center.lon, cluster1.center.lat, cluster2.center.lon, cluster2.center.lat);
|
|
470
|
+
var distanceThreshold = this.distanceBetweenClusters;
|
|
471
|
+
if (centerDistance <= distanceThreshold) {
|
|
472
|
+
// Merge clusters.
|
|
473
|
+
(_a = cluster1.points).push.apply(_a, cluster2.points);
|
|
474
|
+
mergedClusters.splice(j, 1);
|
|
475
|
+
this.removeClusterEntity(cluster2.center.id);
|
|
476
|
+
mergeOccurred = true;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (mergeOccurred) {
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return mergedClusters;
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Removes Cesium cluster entity.
|
|
489
|
+
* @param clusterId
|
|
490
|
+
*/
|
|
491
|
+
PointClustering.prototype.removeClusterEntity = function (clusterId) {
|
|
492
|
+
var clusterEntity = this.clusterEntities.get(clusterId);
|
|
493
|
+
if (clusterEntity) {
|
|
494
|
+
this.viewer.entities.remove(clusterEntity);
|
|
495
|
+
this.clusterEntities.delete(clusterId);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
PointClustering.prototype.convertCartesianToCartographic = function (cartesian3) {
|
|
499
|
+
var carto = Cesium.Cartographic.fromCartesian(cartesian3);
|
|
500
|
+
var lon = Cesium.Math.toDegrees(carto.longitude);
|
|
501
|
+
var lat = Cesium.Math.toDegrees(carto.latitude);
|
|
502
|
+
var id = lon + ',' + lat;
|
|
503
|
+
return new Point(lon, lat, id);
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* Adds new entity to the clustering logic.
|
|
507
|
+
* @param id Bruce entity ID.
|
|
508
|
+
* @param cartesian3 entity's position.
|
|
509
|
+
*/
|
|
510
|
+
PointClustering.prototype.addPoint = function (id, cartesian3) {
|
|
511
|
+
var point = this.convertCartesianToCartographic(cartesian3);
|
|
512
|
+
point.id = id;
|
|
513
|
+
this.quadTree.Insert(point);
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* Calculates rough distance across earth between two points.
|
|
517
|
+
* @param lon1
|
|
518
|
+
* @param lat1
|
|
519
|
+
* @param lon2
|
|
520
|
+
* @param lat2
|
|
521
|
+
* @returns
|
|
522
|
+
*/
|
|
523
|
+
PointClustering.prototype.calculateDistance = function (lon1, lat1, lon2, lat2) {
|
|
524
|
+
var lonDelta = Math.abs(lon1 - lon2);
|
|
525
|
+
var latDelta = Math.abs(lat1 - lat2);
|
|
526
|
+
// Approximate radius of the Earth in kilometers
|
|
527
|
+
var earthRadius = 6371;
|
|
528
|
+
var distance = 2 * Math.asin(Math.sqrt(Math.sin(latDelta / 2) * Math.sin(latDelta / 2) +
|
|
529
|
+
Math.cos(lat1) * Math.cos(lat2) * Math.sin(lonDelta / 2) * Math.sin(lonDelta / 2))) * earthRadius;
|
|
530
|
+
return distance;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* Adds entity to clustering logic.
|
|
534
|
+
* Will return false if entity could not be clustered and therefor should not be hidden.
|
|
535
|
+
* @param id
|
|
536
|
+
* @param entity
|
|
537
|
+
* @returns
|
|
538
|
+
*/
|
|
539
|
+
PointClustering.prototype.AddEntity = function (id, entity) {
|
|
540
|
+
if (this.disposed) {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
if (!entity) {
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
546
|
+
if (entity.polygon || entity.polyline) {
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
var pos3d = GetValue(this.viewer, entity.position);
|
|
550
|
+
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
if (!this.pointColorBg && entity.point) {
|
|
554
|
+
this.pointColorBg = GetValue(this.viewer, entity.point.color);
|
|
555
|
+
if (this.pointColorBg) {
|
|
556
|
+
var cColor = null;
|
|
557
|
+
if (this.pointColorBg instanceof Object) {
|
|
558
|
+
cColor = new Cesium.Color(this.pointColorBg.red, this.pointColorBg.green, this.pointColorBg.blue, this.pointColorBg.alpha);
|
|
559
|
+
}
|
|
560
|
+
else if (typeof this.pointColorBg === "string") {
|
|
561
|
+
cColor = Cesium.Color.fromCssColorString(this.pointColorBg);
|
|
562
|
+
}
|
|
563
|
+
// Determine if text color should instead be black based on background.
|
|
564
|
+
// cColor contains r,g,b,a values where r,g,b are in the range [0,1].
|
|
565
|
+
if (cColor) {
|
|
566
|
+
var brightness = (cColor.red * 299 + cColor.green * 587 + cColor.blue * 114) / 1000;
|
|
567
|
+
if (brightness > 0.5) {
|
|
568
|
+
this.pointColorTxt = "black";
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
this.pointColorTxt = "white";
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
this.registeredEntityIds.add(id);
|
|
577
|
+
this.addPoint(id, pos3d);
|
|
578
|
+
this.updateQueue.Call();
|
|
579
|
+
return true;
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Removes entity from clustering logic.
|
|
583
|
+
* Warning: This will not reveal the entity, suppressShow will remain true.
|
|
584
|
+
* This is made with the assumption that the entity is being removed from viewer.
|
|
585
|
+
* @param id
|
|
586
|
+
* @returns
|
|
587
|
+
*/
|
|
588
|
+
PointClustering.prototype.RemoveEntity = function (id) {
|
|
589
|
+
if (this.disposed) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
var pointToRemove = this.quadTree.Find(id);
|
|
593
|
+
if (pointToRemove) {
|
|
594
|
+
this.quadTree.Remove(pointToRemove);
|
|
595
|
+
this.updateQueue.Call();
|
|
596
|
+
}
|
|
597
|
+
this.registeredEntityIds.delete(id);
|
|
598
|
+
};
|
|
599
|
+
return PointClustering;
|
|
600
|
+
}());
|
|
601
|
+
exports.PointClustering = PointClustering;
|
|
602
|
+
//# sourceMappingURL=point-clustering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point-clustering.js","sourceRoot":"","sources":["../../../../../src/rendering/render-managers/common/point-clustering.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,+BAAiC;AAGjC,SAAS,QAAQ,CAAI,MAAqB,EAAE,GAA0B;IAClE,IAAK,GAAW,aAAX,GAAG,uBAAH,GAAG,CAAU,QAAQ,EAAE;QACxB,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;KACpD;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAUD;IAKI,eAAY,GAAG,EAAE,GAAG,EAAE,EAAE;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,CAAC;IACL,YAAC;AAAD,CAAC,AAVD,IAUC;AAED;IAOI,gBAAY,CAAS,EAAE,CAAS,EAAE,MAAc;QAC5C,IAAI,CAAC,CAAC,GAA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