bruce-cesium 3.3.6 → 3.3.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 +366 -45
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +364 -43
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +79 -4
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +251 -24
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visual-register-culler.js +1 -1
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +32 -11
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +6 -0
- package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +17 -0
- package/dist/types/rendering/visuals-register.d.ts +4 -0
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -3049,7 +3049,7 @@
|
|
|
3049
3049
|
var rego = register.GetRego({
|
|
3050
3050
|
entityId: entityId
|
|
3051
3051
|
});
|
|
3052
|
-
if (!rego || !rego.visual || !(rego.visual instanceof Cesium.Entity) || rego.relation != null || rego.overrideShow != null) {
|
|
3052
|
+
if (!rego || !rego.visual || !(rego.visual instanceof Cesium.Entity) || rego.relation != null || rego.overrideShow != null || rego.collection) {
|
|
3053
3053
|
continue;
|
|
3054
3054
|
}
|
|
3055
3055
|
var parts = exports.EntityUtils.GatherEntity({
|
|
@@ -5607,12 +5607,19 @@
|
|
|
5607
5607
|
// Override to make it draw at a different position.
|
|
5608
5608
|
this._pos3d = null;
|
|
5609
5609
|
this.prePositioned = false;
|
|
5610
|
+
// If the entity name is not loaded-in, we'll wait a moment then request the information.
|
|
5611
|
+
// We wait a moment to avoid the user quickly dragging their mouse over entities and spamming requests.
|
|
5612
|
+
this.loadTimeout = null;
|
|
5613
|
+
this.loadedName = false;
|
|
5610
5614
|
this.rego = params.rego;
|
|
5611
5615
|
this.viewer = params.viewer;
|
|
5612
5616
|
this.api = params.api;
|
|
5613
5617
|
this.visualRegister = params.visualRegister;
|
|
5614
5618
|
this.prePositioned = !isNaN((_a = params.pos3d) === null || _a === void 0 ? void 0 : _a.x);
|
|
5615
5619
|
this.createLabel(params.pos3d);
|
|
5620
|
+
if (!params.api && !bruceModels.ENVIRONMENT.IS_SELF_MANAGED) {
|
|
5621
|
+
params.api = bruceModels.ENVIRONMENT.Api().GetBruceApi();
|
|
5622
|
+
}
|
|
5616
5623
|
}
|
|
5617
5624
|
Object.defineProperty(Label.prototype, "Rego", {
|
|
5618
5625
|
get: function () {
|
|
@@ -5640,6 +5647,48 @@
|
|
|
5640
5647
|
enumerable: false,
|
|
5641
5648
|
configurable: true
|
|
5642
5649
|
});
|
|
5650
|
+
/**
|
|
5651
|
+
* Loads the Entity's name and updates the corresponding visual rego.
|
|
5652
|
+
*/
|
|
5653
|
+
Label.prototype.loadName = function () {
|
|
5654
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5655
|
+
var rego, _a, e_1;
|
|
5656
|
+
return __generator(this, function (_b) {
|
|
5657
|
+
switch (_b.label) {
|
|
5658
|
+
case 0:
|
|
5659
|
+
if (this.loadedName) {
|
|
5660
|
+
return [2 /*return*/];
|
|
5661
|
+
}
|
|
5662
|
+
_b.label = 1;
|
|
5663
|
+
case 1:
|
|
5664
|
+
_b.trys.push([1, 4, , 5]);
|
|
5665
|
+
if (!this.api) return [3 /*break*/, 3];
|
|
5666
|
+
rego = this.rego;
|
|
5667
|
+
_a = this.rego;
|
|
5668
|
+
return [4 /*yield*/, bruceModels.Entity.CalculateNameAsync({
|
|
5669
|
+
api: this.api,
|
|
5670
|
+
entity: null,
|
|
5671
|
+
entityId: rego.entityId,
|
|
5672
|
+
defaultToId: false
|
|
5673
|
+
})];
|
|
5674
|
+
case 2:
|
|
5675
|
+
_a.name = _b.sent();
|
|
5676
|
+
if (!this.rego.name) {
|
|
5677
|
+
this.rego.name = "Unnamed Entity";
|
|
5678
|
+
}
|
|
5679
|
+
_b.label = 3;
|
|
5680
|
+
case 3: return [3 /*break*/, 5];
|
|
5681
|
+
case 4:
|
|
5682
|
+
e_1 = _b.sent();
|
|
5683
|
+
console.error(e_1);
|
|
5684
|
+
return [3 /*break*/, 5];
|
|
5685
|
+
case 5:
|
|
5686
|
+
this.loadedName = true;
|
|
5687
|
+
return [2 /*return*/];
|
|
5688
|
+
}
|
|
5689
|
+
});
|
|
5690
|
+
});
|
|
5691
|
+
};
|
|
5643
5692
|
/**
|
|
5644
5693
|
* Disposes label and marks instance as disposed.
|
|
5645
5694
|
* Recalling will be ignored.
|
|
@@ -5650,6 +5699,8 @@
|
|
|
5650
5699
|
}
|
|
5651
5700
|
this.disposed = true;
|
|
5652
5701
|
this.removeLabel();
|
|
5702
|
+
clearTimeout(this.loadTimeout);
|
|
5703
|
+
this.loadTimeout = null;
|
|
5653
5704
|
};
|
|
5654
5705
|
/**
|
|
5655
5706
|
* Creates cesium entity for the label if one does not exist.
|
|
@@ -5658,7 +5709,7 @@
|
|
|
5658
5709
|
Label.prototype.createLabel = function (starterPos3d) {
|
|
5659
5710
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
5660
5711
|
return __awaiter(this, void 0, void 0, function () {
|
|
5661
|
-
var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, model, size, height, scale, posses, centerIndex, text, type,
|
|
5712
|
+
var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, model, size, height, scale, posses, centerIndex, text, type, e_2, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel, terrTimeout;
|
|
5662
5713
|
var _this = this;
|
|
5663
5714
|
return __generator(this, function (_h) {
|
|
5664
5715
|
switch (_h.label) {
|
|
@@ -5826,7 +5877,7 @@
|
|
|
5826
5877
|
}
|
|
5827
5878
|
this._pos3d = pos3d;
|
|
5828
5879
|
text = "Unknown Entity";
|
|
5829
|
-
if (!this.rego) return [3 /*break*/,
|
|
5880
|
+
if (!this.rego) return [3 /*break*/, 9];
|
|
5830
5881
|
if (!this.rego.relation) return [3 /*break*/, 7];
|
|
5831
5882
|
type = this.rego.relation.RelationType;
|
|
5832
5883
|
if (!(!type && this.rego.relation["Relation.Type.ID"])) return [3 /*break*/, 6];
|
|
@@ -5841,8 +5892,8 @@
|
|
|
5841
5892
|
type = (_h.sent()).relationType;
|
|
5842
5893
|
return [3 /*break*/, 6];
|
|
5843
5894
|
case 5:
|
|
5844
|
-
|
|
5845
|
-
console.error(
|
|
5895
|
+
e_2 = _h.sent();
|
|
5896
|
+
console.error(e_2);
|
|
5846
5897
|
return [3 /*break*/, 6];
|
|
5847
5898
|
case 6:
|
|
5848
5899
|
if (type) {
|
|
@@ -5861,6 +5912,30 @@
|
|
|
5861
5912
|
}
|
|
5862
5913
|
_h.label = 8;
|
|
5863
5914
|
case 8:
|
|
5915
|
+
if (text == "Unnamed Entity" && !this.loadedName) {
|
|
5916
|
+
text = "Loading...";
|
|
5917
|
+
clearTimeout(this.loadTimeout);
|
|
5918
|
+
this.loadTimeout = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5919
|
+
return __generator(this, function (_a) {
|
|
5920
|
+
switch (_a.label) {
|
|
5921
|
+
case 0:
|
|
5922
|
+
if (this.disposed || this.counter != counter) {
|
|
5923
|
+
return [2 /*return*/];
|
|
5924
|
+
}
|
|
5925
|
+
return [4 /*yield*/, this.loadName()];
|
|
5926
|
+
case 1:
|
|
5927
|
+
_a.sent();
|
|
5928
|
+
if (this.disposed || this.counter != counter) {
|
|
5929
|
+
return [2 /*return*/];
|
|
5930
|
+
}
|
|
5931
|
+
this.createLabel(starterPos3d);
|
|
5932
|
+
return [2 /*return*/];
|
|
5933
|
+
}
|
|
5934
|
+
});
|
|
5935
|
+
}); }, 120);
|
|
5936
|
+
}
|
|
5937
|
+
_h.label = 9;
|
|
5938
|
+
case 9:
|
|
5864
5939
|
if (this.disposed || this.counter != counter) {
|
|
5865
5940
|
return [2 /*return*/];
|
|
5866
5941
|
}
|
|
@@ -6098,8 +6173,14 @@
|
|
|
6098
6173
|
}
|
|
6099
6174
|
}
|
|
6100
6175
|
}
|
|
6101
|
-
|
|
6102
|
-
|
|
6176
|
+
var MAX_SHOW_DEPTH = 10;
|
|
6177
|
+
function updateCEntityShow(viewer, visual, rego, show, ignoreParent, depth) {
|
|
6178
|
+
if (depth === void 0) { depth = 0; }
|
|
6179
|
+
if (depth > MAX_SHOW_DEPTH) {
|
|
6180
|
+
console.warn("updateCEntityShow(): Max show depth reached. EntityId = " + rego.entityId);
|
|
6181
|
+
return;
|
|
6182
|
+
}
|
|
6183
|
+
if (show && !rego.relation && !rego.overrideShow && !rego.collection) {
|
|
6103
6184
|
// Culling is controlled by "visual-register-culler.ts".
|
|
6104
6185
|
// When an object is unculled then the 'updateEntityShow' function is re-called to reveal it and related objects.
|
|
6105
6186
|
// A sub-object can be culled while the siblings are not.
|
|
@@ -6107,31 +6188,42 @@
|
|
|
6107
6188
|
show = !isCulled;
|
|
6108
6189
|
}
|
|
6109
6190
|
if (visual._parentEntity && !ignoreParent) {
|
|
6110
|
-
updateCEntityShow(viewer,
|
|
6191
|
+
updateCEntityShow(viewer, visual._parentEntity, rego, show, false, depth + 1);
|
|
6111
6192
|
}
|
|
6112
6193
|
if (visual._siblingGraphics) {
|
|
6113
6194
|
for (var i = 0; i < visual._siblingGraphics.length; i++) {
|
|
6114
6195
|
var sibling = visual._siblingGraphics[i];
|
|
6115
|
-
updateCEntityShow(viewer,
|
|
6196
|
+
updateCEntityShow(viewer, sibling, rego, show, true, depth + 1);
|
|
6116
6197
|
}
|
|
6117
6198
|
}
|
|
6118
6199
|
/**
|
|
6119
6200
|
* Do NOT use ".show" as it causes crashes in Cesium polylines that are clamped to ground.
|
|
6120
6201
|
* We could target them specifically here but we may be getting overall performance gain by just removing stuff from the scene.
|
|
6121
6202
|
*/
|
|
6122
|
-
if (
|
|
6123
|
-
|
|
6203
|
+
if (rego.collection) {
|
|
6204
|
+
if (!show && rego.collection.contains(visual)) {
|
|
6205
|
+
rego.collection.remove(visual);
|
|
6206
|
+
}
|
|
6207
|
+
else if (show && !rego.collection.contains(visual)) {
|
|
6208
|
+
rego.collection.add(visual);
|
|
6209
|
+
}
|
|
6124
6210
|
}
|
|
6125
|
-
else
|
|
6126
|
-
viewer.entities.
|
|
6211
|
+
else {
|
|
6212
|
+
if (!show && viewer.entities.contains(visual)) {
|
|
6213
|
+
viewer.entities.remove(visual);
|
|
6214
|
+
}
|
|
6215
|
+
else if (show && !viewer.entities.contains(visual)) {
|
|
6216
|
+
viewer.entities.add(visual);
|
|
6217
|
+
}
|
|
6127
6218
|
}
|
|
6128
6219
|
}
|
|
6129
|
-
function updateEntityShow(viewer,
|
|
6220
|
+
function updateEntityShow(viewer, rego, show) {
|
|
6221
|
+
var visual = rego.visual;
|
|
6130
6222
|
if (visual instanceof Cesium.Entity) {
|
|
6131
6223
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
6132
6224
|
return;
|
|
6133
6225
|
}
|
|
6134
|
-
updateCEntityShow(viewer,
|
|
6226
|
+
updateCEntityShow(viewer, rego.visual, rego, show, false, 0);
|
|
6135
6227
|
return;
|
|
6136
6228
|
}
|
|
6137
6229
|
if (!isAlive$1(viewer, visual)) {
|
|
@@ -6184,7 +6276,7 @@
|
|
|
6184
6276
|
if (visible == null) {
|
|
6185
6277
|
visible = getShowState(rego);
|
|
6186
6278
|
}
|
|
6187
|
-
updateEntityShow(viewer, rego
|
|
6279
|
+
updateEntityShow(viewer, rego, visible);
|
|
6188
6280
|
if (rego.best) {
|
|
6189
6281
|
var isLabelled = register.GetIsLabelled({
|
|
6190
6282
|
entityId: entityId
|
|
@@ -6301,6 +6393,10 @@
|
|
|
6301
6393
|
enumerable: false,
|
|
6302
6394
|
configurable: true
|
|
6303
6395
|
});
|
|
6396
|
+
Register.prototype.RefreshMark = function (params) {
|
|
6397
|
+
var rego = params.rego;
|
|
6398
|
+
markEntity(this, rego, rego.visual, false);
|
|
6399
|
+
};
|
|
6304
6400
|
Register.prototype.Dispose = function () {
|
|
6305
6401
|
var _a;
|
|
6306
6402
|
(_a = this.cameraCullerDispose) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
@@ -7923,6 +8019,15 @@
|
|
|
7923
8019
|
|
|
7924
8020
|
var BATCH_SIZE = 500;
|
|
7925
8021
|
var CHECK_BATCH_SIZE = 250;
|
|
8022
|
+
function getValue$3(viewer, obj) {
|
|
8023
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
8024
|
+
return obj.getValue(viewer.scene.lastRenderTime);
|
|
8025
|
+
}
|
|
8026
|
+
return obj;
|
|
8027
|
+
}
|
|
8028
|
+
function colorToCColor$2(color) {
|
|
8029
|
+
return new Cesium.Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
8030
|
+
}
|
|
7926
8031
|
(function (EntitiesRenderManager) {
|
|
7927
8032
|
var Manager = /** @class */ (function () {
|
|
7928
8033
|
function Manager(params) {
|
|
@@ -7937,6 +8042,10 @@
|
|
|
7937
8042
|
this.viewMonitorRemoval = null;
|
|
7938
8043
|
this.renderQueue = [];
|
|
7939
8044
|
this.renderQueueInterval = null;
|
|
8045
|
+
this.sources = [];
|
|
8046
|
+
// Highly experimental flag to try improve rendering large sets of polygons and polylines.
|
|
8047
|
+
// Many things are not supported when this is enabled.
|
|
8048
|
+
this.useGeojson = false;
|
|
7940
8049
|
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register, sharedGetters = params.sharedGetters;
|
|
7941
8050
|
this.viewer = viewer;
|
|
7942
8051
|
this.sharedGetters = sharedGetters;
|
|
@@ -7944,6 +8053,7 @@
|
|
|
7944
8053
|
this.apiGetter = apiGetter;
|
|
7945
8054
|
this.item = item;
|
|
7946
8055
|
this.visualsManager = visualsManager;
|
|
8056
|
+
this.useGeojson = item.renderAsGeojson == true;
|
|
7947
8057
|
if (item.enableClustering) {
|
|
7948
8058
|
this.clustering = new PointClustering(this.visualsManager, this.item.id);
|
|
7949
8059
|
}
|
|
@@ -8093,6 +8203,12 @@
|
|
|
8093
8203
|
clearInterval(this.renderQueueInterval);
|
|
8094
8204
|
this.renderQueue = [];
|
|
8095
8205
|
(_c = this.clustering) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
8206
|
+
this.clustering = null;
|
|
8207
|
+
for (var i = 0; i < this.sources.length; i++) {
|
|
8208
|
+
var source = this.sources[i];
|
|
8209
|
+
this.viewer.dataSources.remove(source);
|
|
8210
|
+
}
|
|
8211
|
+
this.sources = [];
|
|
8096
8212
|
};
|
|
8097
8213
|
Manager.prototype.ReRender = function (params) {
|
|
8098
8214
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8244,14 +8360,14 @@
|
|
|
8244
8360
|
}
|
|
8245
8361
|
};
|
|
8246
8362
|
Manager.prototype.renderEntities = function (entities, force) {
|
|
8247
|
-
var _a
|
|
8363
|
+
var _a;
|
|
8248
8364
|
if (force === void 0) { force = false; }
|
|
8249
8365
|
return __awaiter(this, void 0, void 0, function () {
|
|
8250
|
-
var typeId_1,
|
|
8251
|
-
return __generator(this, function (
|
|
8252
|
-
switch (
|
|
8366
|
+
var typeId_1, e_3;
|
|
8367
|
+
return __generator(this, function (_b) {
|
|
8368
|
+
switch (_b.label) {
|
|
8253
8369
|
case 0:
|
|
8254
|
-
|
|
8370
|
+
_b.trys.push([0, 5, , 6]);
|
|
8255
8371
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
8256
8372
|
return [2 /*return*/];
|
|
8257
8373
|
}
|
|
@@ -8259,17 +8375,227 @@
|
|
|
8259
8375
|
if (typeId_1) {
|
|
8260
8376
|
entities = entities.filter(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId_1; });
|
|
8261
8377
|
}
|
|
8262
|
-
return [
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8378
|
+
if (!this.useGeojson) return [3 /*break*/, 2];
|
|
8379
|
+
return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
8380
|
+
case 1:
|
|
8381
|
+
_b.sent();
|
|
8382
|
+
return [3 /*break*/, 4];
|
|
8383
|
+
case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
8384
|
+
case 3:
|
|
8385
|
+
_b.sent();
|
|
8386
|
+
_b.label = 4;
|
|
8387
|
+
case 4: return [3 /*break*/, 6];
|
|
8388
|
+
case 5:
|
|
8389
|
+
e_3 = _b.sent();
|
|
8390
|
+
console.error(e_3);
|
|
8391
|
+
return [3 /*break*/, 6];
|
|
8392
|
+
case 6: return [2 /*return*/];
|
|
8393
|
+
}
|
|
8394
|
+
});
|
|
8395
|
+
});
|
|
8396
|
+
};
|
|
8397
|
+
/**
|
|
8398
|
+
* Our optimized and more stable path.
|
|
8399
|
+
* We construct a geojson that we draw in one go.
|
|
8400
|
+
* @param entities
|
|
8401
|
+
* @param force TODO: This should re-render entities that are already rendered.
|
|
8402
|
+
*/
|
|
8403
|
+
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
8404
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8405
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8406
|
+
var zoomItem, style, e_4, entityType, e_5, pStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, register, sEntities, i, cEntity;
|
|
8407
|
+
var _this = this;
|
|
8408
|
+
return __generator(this, function (_j) {
|
|
8409
|
+
switch (_j.label) {
|
|
8410
|
+
case 0:
|
|
8411
|
+
entities = entities.filter(function (entity) {
|
|
8412
|
+
var _a;
|
|
8413
|
+
return !_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID];
|
|
8414
|
+
});
|
|
8415
|
+
// Mark these as rendered.
|
|
8416
|
+
entities.forEach(function (entity) {
|
|
8417
|
+
var _a;
|
|
8418
|
+
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
8419
|
+
});
|
|
8420
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
8421
|
+
style = null;
|
|
8422
|
+
if (!(zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID)) return [3 /*break*/, 4];
|
|
8423
|
+
_j.label = 1;
|
|
8424
|
+
case 1:
|
|
8425
|
+
_j.trys.push([1, 3, , 4]);
|
|
8426
|
+
return [4 /*yield*/, bruceModels.Style.Get({
|
|
8427
|
+
api: this.apiGetter.getApi(),
|
|
8428
|
+
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
8429
|
+
})];
|
|
8430
|
+
case 2:
|
|
8431
|
+
style = (_a = (_j.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
8432
|
+
return [3 /*break*/, 4];
|
|
8433
|
+
case 3:
|
|
8434
|
+
e_4 = _j.sent();
|
|
8435
|
+
console.error(e_4);
|
|
8436
|
+
return [3 /*break*/, 4];
|
|
8437
|
+
case 4:
|
|
8438
|
+
_j.trys.push([4, 8, , 9]);
|
|
8439
|
+
return [4 /*yield*/, bruceModels.EntityType.Get({
|
|
8440
|
+
entityTypeId: this.item.BruceEntity["EntityType.ID"],
|
|
8441
|
+
api: this.apiGetter.getApi()
|
|
8442
|
+
})];
|
|
8443
|
+
case 5:
|
|
8444
|
+
entityType = (_b = (_j.sent())) === null || _b === void 0 ? void 0 : _b.entityType;
|
|
8445
|
+
if (!(!style && ((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"]))) return [3 /*break*/, 7];
|
|
8446
|
+
if (!entityType["DisplaySetting.ID"]) return [3 /*break*/, 7];
|
|
8447
|
+
return [4 /*yield*/, bruceModels.Style.Get({
|
|
8448
|
+
api: this.apiGetter.getApi(),
|
|
8449
|
+
styleId: entityType["DisplaySetting.ID"]
|
|
8270
8450
|
})];
|
|
8451
|
+
case 6:
|
|
8452
|
+
style = (_d = (_j.sent()).style) === null || _d === void 0 ? void 0 : _d.Settings;
|
|
8453
|
+
_j.label = 7;
|
|
8454
|
+
case 7: return [3 /*break*/, 9];
|
|
8455
|
+
case 8:
|
|
8456
|
+
e_5 = _j.sent();
|
|
8457
|
+
console.error(e_5);
|
|
8458
|
+
return [3 /*break*/, 9];
|
|
8459
|
+
case 9:
|
|
8460
|
+
pStyle = (_e = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _e !== void 0 ? _e : {};
|
|
8461
|
+
polygonsClamped = ((_f = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _f === void 0 ? void 0 : _f.id) == null ? true : ((_g = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _g === void 0 ? void 0 : _g.id) == 0;
|
|
8462
|
+
bFillColor = bruceModels.Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
8463
|
+
cFillColor = bFillColor ? colorToCColor$2(bFillColor) : Cesium.Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
8464
|
+
bLineColor = bruceModels.Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
8465
|
+
cLineColor = bLineColor ? colorToCColor$2(bLineColor) : Cesium.Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
8466
|
+
lineWidthPx = pStyle.lineWidth ? bruceModels.Calculator.GetNumber(pStyle.lineWidth, {}, []) : null;
|
|
8467
|
+
if (lineWidthPx == null) {
|
|
8468
|
+
lineWidthPx = 1;
|
|
8469
|
+
}
|
|
8470
|
+
lineWidthPx = EnsureNumber(lineWidthPx);
|
|
8471
|
+
if (lineWidthPx < 0.01) {
|
|
8472
|
+
lineWidthPx = 0;
|
|
8473
|
+
}
|
|
8474
|
+
lineWidthPx = Math.round(lineWidthPx);
|
|
8475
|
+
geojson = bruceModels.Entity.ToGeoJson({
|
|
8476
|
+
entities: entities,
|
|
8477
|
+
includeUserData: false,
|
|
8478
|
+
excludeAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
8479
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
8480
|
+
// No points.
|
|
8481
|
+
allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
|
|
8482
|
+
});
|
|
8483
|
+
if (!((_h = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _h === void 0 ? void 0 : _h.length)) {
|
|
8484
|
+
return [2 /*return*/];
|
|
8485
|
+
}
|
|
8486
|
+
return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
|
|
8487
|
+
stroke: cLineColor,
|
|
8488
|
+
fill: cFillColor,
|
|
8489
|
+
strokeWidth: lineWidthPx,
|
|
8490
|
+
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
8491
|
+
})];
|
|
8492
|
+
case 10:
|
|
8493
|
+
source = _j.sent();
|
|
8494
|
+
this.viewer.dataSources.add(source);
|
|
8495
|
+
this.sources.push(source);
|
|
8496
|
+
if (this.disposed) {
|
|
8497
|
+
this.doDispose();
|
|
8498
|
+
return [2 /*return*/];
|
|
8499
|
+
}
|
|
8500
|
+
groups = [];
|
|
8501
|
+
register = function (thing) {
|
|
8502
|
+
var _a, _b, _c, _d;
|
|
8503
|
+
// See if the cesium entity already exists in a group.
|
|
8504
|
+
var group = groups.find(function (x) { var _a; return ((_a = x.visual) === null || _a === void 0 ? void 0 : _a.id) == thing.id || x.siblings.find(function (x) { return (x === null || x === void 0 ? void 0 : x.id) == thing.id; }); });
|
|
8505
|
+
if (group) {
|
|
8506
|
+
return;
|
|
8507
|
+
}
|
|
8508
|
+
var metadata = getValue$3(_this.viewer, thing === null || thing === void 0 ? void 0 : thing.properties);
|
|
8509
|
+
var entityId = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
8510
|
+
if (!entityId) {
|
|
8511
|
+
return;
|
|
8512
|
+
}
|
|
8513
|
+
// Find group for the nextspace entity ID.
|
|
8514
|
+
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
8515
|
+
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
8516
|
+
if (!group) {
|
|
8517
|
+
group = {
|
|
8518
|
+
entityId: entityId,
|
|
8519
|
+
visual: thing,
|
|
8520
|
+
tagIds: (_b = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"],
|
|
8521
|
+
entityTypeId: (_c = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _c === void 0 ? void 0 : _c["EntityType.ID"],
|
|
8522
|
+
siblings: [],
|
|
8523
|
+
data: entities.find(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; }),
|
|
8524
|
+
rego: null
|
|
8525
|
+
};
|
|
8526
|
+
groups.push(group);
|
|
8527
|
+
var rego = {
|
|
8528
|
+
entityId: entityId,
|
|
8529
|
+
menuItemId: _this.item.id,
|
|
8530
|
+
visual: thing,
|
|
8531
|
+
priority: 0,
|
|
8532
|
+
entityTypeId: group.entityTypeId,
|
|
8533
|
+
accountId: _this.apiGetter.accountId,
|
|
8534
|
+
tagIds: group.tagIds ? [].concat(group.tagIds) : [],
|
|
8535
|
+
name: (_d = bruceModels.Entity.CalculateName({
|
|
8536
|
+
entity: group.data,
|
|
8537
|
+
type: entityType,
|
|
8538
|
+
defaultToId: false
|
|
8539
|
+
})) !== null && _d !== void 0 ? _d : "Unnamed Entity",
|
|
8540
|
+
cdn: _this.item.cdnEnabled,
|
|
8541
|
+
collection: source.entities
|
|
8542
|
+
};
|
|
8543
|
+
group.rego = rego;
|
|
8544
|
+
_this.visualsManager.AddRego({
|
|
8545
|
+
rego: rego,
|
|
8546
|
+
requestRender: false
|
|
8547
|
+
});
|
|
8548
|
+
}
|
|
8549
|
+
// Found a group. We flag this as a sibling entity of the primary.
|
|
8550
|
+
else {
|
|
8551
|
+
group.siblings.push(thing);
|
|
8552
|
+
group.visual._siblingGraphics = group.siblings;
|
|
8553
|
+
thing._parentEntity = group.visual;
|
|
8554
|
+
if (group.rego) {
|
|
8555
|
+
_this.visualsManager.RefreshMark({
|
|
8556
|
+
rego: group.rego
|
|
8557
|
+
});
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
// Won't do individual styles for now. More stability that way.
|
|
8561
|
+
// applyStyle(thing, entityId, group.data);
|
|
8562
|
+
};
|
|
8563
|
+
sEntities = source.entities.values;
|
|
8564
|
+
for (i = 0; i < sEntities.length; i++) {
|
|
8565
|
+
cEntity = sEntities[i];
|
|
8566
|
+
register(cEntity);
|
|
8567
|
+
}
|
|
8568
|
+
this.viewer.scene.requestRender();
|
|
8569
|
+
return [2 /*return*/];
|
|
8570
|
+
}
|
|
8571
|
+
});
|
|
8572
|
+
});
|
|
8573
|
+
};
|
|
8574
|
+
/**
|
|
8575
|
+
* Our default path.
|
|
8576
|
+
* We render each entity individually.
|
|
8577
|
+
* @param entities
|
|
8578
|
+
* @param force
|
|
8579
|
+
* @returns
|
|
8580
|
+
*/
|
|
8581
|
+
Manager.prototype.renderAsIndividuals = function (entities, force) {
|
|
8582
|
+
var _a, _b, _c;
|
|
8583
|
+
if (force === void 0) { force = false; }
|
|
8584
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8585
|
+
var cEntities, i, entity, id, cEntity, visual, wasClustered, tagIds, rego;
|
|
8586
|
+
return __generator(this, function (_d) {
|
|
8587
|
+
switch (_d.label) {
|
|
8588
|
+
case 0: return [4 /*yield*/, exports.EntityRenderEngine.Render({
|
|
8589
|
+
viewer: this.viewer,
|
|
8590
|
+
apiGetter: this.apiGetter,
|
|
8591
|
+
entities: entities,
|
|
8592
|
+
menuItemId: this.item.id,
|
|
8593
|
+
visualRegister: this.visualsManager,
|
|
8594
|
+
zoomControl: this.item.CameraZoomSettings,
|
|
8595
|
+
force: force
|
|
8596
|
+
})];
|
|
8271
8597
|
case 1:
|
|
8272
|
-
cEntities =
|
|
8598
|
+
cEntities = _d.sent();
|
|
8273
8599
|
if (this.disposed) {
|
|
8274
8600
|
this.doDispose();
|
|
8275
8601
|
return [2 /*return*/];
|
|
@@ -8280,13 +8606,13 @@
|
|
|
8280
8606
|
cEntity = cEntities[id];
|
|
8281
8607
|
this.renderedEntities[id] = !!cEntity;
|
|
8282
8608
|
if (cEntity) {
|
|
8283
|
-
visual = (
|
|
8609
|
+
visual = (_a = this.visualsManager.GetRego({
|
|
8284
8610
|
entityId: id,
|
|
8285
8611
|
menuItemId: this.item.id
|
|
8286
|
-
})) === null ||
|
|
8612
|
+
})) === null || _a === void 0 ? void 0 : _a.visual;
|
|
8287
8613
|
if (!visual || visual != cEntity) {
|
|
8288
8614
|
wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
|
|
8289
|
-
tagIds = (
|
|
8615
|
+
tagIds = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"];
|
|
8290
8616
|
rego = {
|
|
8291
8617
|
entityId: id,
|
|
8292
8618
|
menuItemId: this.item.id,
|
|
@@ -8311,19 +8637,14 @@
|
|
|
8311
8637
|
menuItemId: this.item.id,
|
|
8312
8638
|
requestRender: false
|
|
8313
8639
|
});
|
|
8314
|
-
(
|
|
8640
|
+
(_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(id, false);
|
|
8315
8641
|
}
|
|
8316
8642
|
}
|
|
8317
8643
|
this.viewer.scene.requestRender();
|
|
8318
8644
|
if (this.clustering && entities.length) {
|
|
8319
8645
|
this.clustering.Update();
|
|
8320
8646
|
}
|
|
8321
|
-
return [
|
|
8322
|
-
case 2:
|
|
8323
|
-
e_3 = _e.sent();
|
|
8324
|
-
console.error(e_3);
|
|
8325
|
-
return [3 /*break*/, 3];
|
|
8326
|
-
case 3: return [2 /*return*/];
|
|
8647
|
+
return [2 /*return*/];
|
|
8327
8648
|
}
|
|
8328
8649
|
});
|
|
8329
8650
|
});
|
|
@@ -9192,7 +9513,7 @@
|
|
|
9192
9513
|
EntityRenderManager.Manager = Manager;
|
|
9193
9514
|
})(exports.EntityRenderManager || (exports.EntityRenderManager = {}));
|
|
9194
9515
|
|
|
9195
|
-
function colorToCColor$
|
|
9516
|
+
function colorToCColor$3(color) {
|
|
9196
9517
|
return new Cesium.Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
9197
9518
|
}
|
|
9198
9519
|
/**
|
|
@@ -10007,7 +10328,7 @@
|
|
|
10007
10328
|
}
|
|
10008
10329
|
var bColor = ((_a = style.modelStyle) === null || _a === void 0 ? void 0 : _a.fillColor) ? bruceModels.Calculator.GetColor(style.modelStyle.fillColor, data, []) : null;
|
|
10009
10330
|
if (bColor != null) {
|
|
10010
|
-
var cColor = colorToCColor$
|
|
10331
|
+
var cColor = colorToCColor$3(bColor);
|
|
10011
10332
|
var visual = entity.visual;
|
|
10012
10333
|
if (visual && visual instanceof Cesium.Cesium3DTileFeature) {
|
|
10013
10334
|
visual.color = cColor;
|
|
@@ -19974,7 +20295,7 @@
|
|
|
19974
20295
|
CesiumViewMonitor.Monitor = Monitor;
|
|
19975
20296
|
})(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
|
|
19976
20297
|
|
|
19977
|
-
var VERSION$1 = "3.3.
|
|
20298
|
+
var VERSION$1 = "3.3.8";
|
|
19978
20299
|
|
|
19979
20300
|
exports.VERSION = VERSION$1;
|
|
19980
20301
|
exports.CesiumParabola = CesiumParabola;
|