bruce-cesium 2.7.7 → 2.7.9
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 +448 -259
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +447 -258
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/menu-item-manager.js +8 -0
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/relation-render-engine.js +94 -55
- package/dist/lib/rendering/relation-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/cesium-parabola.js +3 -11
- package/dist/lib/rendering/render-managers/common/cesium-parabola.js.map +1 -1
- package/dist/lib/rendering/render-managers/other/relations-render-manager.js +198 -48
- package/dist/lib/rendering/render-managers/other/relations-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +17 -16
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +118 -124
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +3 -1
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/rendering/view-render-engine.js +2 -2
- package/dist/lib/rendering/view-render-engine.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/other/relations-render-manager.d.ts +30 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-entities-render-manager.d.ts +1 -1
- package/dist/types/rendering/tileset-render-engine.d.ts +1 -0
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -3157,15 +3157,15 @@
|
|
|
3157
3157
|
var siblings = [p1Entity, p2Entity];
|
|
3158
3158
|
this.parabola = parabola;
|
|
3159
3159
|
this.siblings = siblings;
|
|
3160
|
+
this.viewer.entities.add(this.parabola);
|
|
3161
|
+
this.viewer.entities.add(p1Entity);
|
|
3162
|
+
this.viewer.entities.add(p2Entity);
|
|
3160
3163
|
};
|
|
3161
3164
|
CesiumParabola.prototype.Animate = function () {
|
|
3162
3165
|
var _this = this;
|
|
3163
3166
|
if (this.disposed) {
|
|
3164
3167
|
return null;
|
|
3165
3168
|
}
|
|
3166
|
-
if (this.parabola && !this.viewer.entities.contains(this.parabola)) {
|
|
3167
|
-
this.viewer.entities.add(this.parabola);
|
|
3168
|
-
}
|
|
3169
3169
|
var retry = false;
|
|
3170
3170
|
if (!this.curPos1 || !this.curPos2 || !bruceModels.Cartes.ValidateCartes3(this.curPos1) || !bruceModels.Cartes.ValidateCartes3(this.curPos2)) {
|
|
3171
3171
|
retry = true;
|
|
@@ -3183,14 +3183,6 @@
|
|
|
3183
3183
|
siblings: this.siblings
|
|
3184
3184
|
};
|
|
3185
3185
|
}
|
|
3186
|
-
var cEntities = [
|
|
3187
|
-
this.parabola
|
|
3188
|
-
].concat(this.siblings);
|
|
3189
|
-
cEntities.forEach(function (e) {
|
|
3190
|
-
if (e && !_this.viewer.entities.contains(e)) {
|
|
3191
|
-
_this.viewer.entities.add(e);
|
|
3192
|
-
}
|
|
3193
|
-
});
|
|
3194
3186
|
var RATE_PER_SECOND = 1000 / 40;
|
|
3195
3187
|
var SEC_DURATION = this.duration;
|
|
3196
3188
|
var HEIGHT_DISTANCE_RATIO = this.heightDistanceRatio;
|
|
@@ -3443,6 +3435,67 @@
|
|
|
3443
3435
|
function colorToCColor$1(color) {
|
|
3444
3436
|
return new Cesium.Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
3445
3437
|
}
|
|
3438
|
+
function getStyle$1(api, typeId, styleId) {
|
|
3439
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3440
|
+
var style, e_1, type, e_2, hideError, error, code;
|
|
3441
|
+
return __generator(this, function (_a) {
|
|
3442
|
+
switch (_a.label) {
|
|
3443
|
+
case 0:
|
|
3444
|
+
style = null;
|
|
3445
|
+
if (!styleId) return [3 /*break*/, 4];
|
|
3446
|
+
_a.label = 1;
|
|
3447
|
+
case 1:
|
|
3448
|
+
_a.trys.push([1, 3, , 4]);
|
|
3449
|
+
return [4 /*yield*/, bruceModels.Style.Get({
|
|
3450
|
+
api: api,
|
|
3451
|
+
styleId: styleId
|
|
3452
|
+
})];
|
|
3453
|
+
case 2:
|
|
3454
|
+
style = (_a.sent()).style;
|
|
3455
|
+
return [3 /*break*/, 4];
|
|
3456
|
+
case 3:
|
|
3457
|
+
e_1 = _a.sent();
|
|
3458
|
+
console.error(e_1);
|
|
3459
|
+
return [3 /*break*/, 4];
|
|
3460
|
+
case 4:
|
|
3461
|
+
if (!(!style && typeId)) return [3 /*break*/, 9];
|
|
3462
|
+
return [4 /*yield*/, bruceModels.EntityType.Get({
|
|
3463
|
+
api: api,
|
|
3464
|
+
entityTypeId: typeId
|
|
3465
|
+
})];
|
|
3466
|
+
case 5:
|
|
3467
|
+
type = (_a.sent()).entityType;
|
|
3468
|
+
if (!type["DisplaySetting.ID"]) return [3 /*break*/, 9];
|
|
3469
|
+
_a.label = 6;
|
|
3470
|
+
case 6:
|
|
3471
|
+
_a.trys.push([6, 8, , 9]);
|
|
3472
|
+
return [4 /*yield*/, bruceModels.Style.Get({
|
|
3473
|
+
api: api,
|
|
3474
|
+
styleId: type["DisplaySetting.ID"]
|
|
3475
|
+
})];
|
|
3476
|
+
case 7:
|
|
3477
|
+
style = (_a.sent()).style;
|
|
3478
|
+
return [3 /*break*/, 9];
|
|
3479
|
+
case 8:
|
|
3480
|
+
e_2 = _a.sent();
|
|
3481
|
+
hideError = false;
|
|
3482
|
+
// TODO: we need a util for extracting code + message rather than writing all this every time.
|
|
3483
|
+
if (e_2 && typeof e_2 == "object" && e_2.ERROR) {
|
|
3484
|
+
error = e_2.ERROR;
|
|
3485
|
+
code = error && typeof error == "object" ? error.Code : "";
|
|
3486
|
+
// Avoiding logging a common error.
|
|
3487
|
+
// This happens when rendering entities that don't have records.
|
|
3488
|
+
hideError = String(code).toLowerCase() == "notfound";
|
|
3489
|
+
}
|
|
3490
|
+
if (!hideError) {
|
|
3491
|
+
console.error(e_2);
|
|
3492
|
+
}
|
|
3493
|
+
return [3 /*break*/, 9];
|
|
3494
|
+
case 9: return [2 /*return*/, style];
|
|
3495
|
+
}
|
|
3496
|
+
});
|
|
3497
|
+
});
|
|
3498
|
+
}
|
|
3446
3499
|
var RelationRenderEngine;
|
|
3447
3500
|
(function (RelationRenderEngine) {
|
|
3448
3501
|
function GetRenderGroupId(relation) {
|
|
@@ -3451,81 +3504,55 @@
|
|
|
3451
3504
|
RelationRenderEngine.GetRenderGroupId = GetRenderGroupId;
|
|
3452
3505
|
function Render(params) {
|
|
3453
3506
|
return __awaiter(this, void 0, void 0, function () {
|
|
3454
|
-
var apiGetter, viewer, visualRegister, menuItemId, relations, api, rendered, i, relation, fromEntity, toEntity, dataEntity, _a, relationType,
|
|
3455
|
-
return __generator(this, function (
|
|
3456
|
-
switch (
|
|
3507
|
+
var apiGetter, viewer, visualRegister, menuItemId, relations, api, rendered, i, relation, fromEntity, toEntity, dataEntity, _a, relationType, style, cEntity, e_3;
|
|
3508
|
+
return __generator(this, function (_b) {
|
|
3509
|
+
switch (_b.label) {
|
|
3457
3510
|
case 0:
|
|
3458
3511
|
apiGetter = params.apiGetter, viewer = params.viewer, visualRegister = params.visualRegister, menuItemId = params.menuItemId, relations = params.relations;
|
|
3459
3512
|
api = apiGetter.getApi(apiGetter.accountId);
|
|
3460
3513
|
rendered = {};
|
|
3461
3514
|
i = 0;
|
|
3462
|
-
|
|
3515
|
+
_b.label = 1;
|
|
3463
3516
|
case 1:
|
|
3464
|
-
if (!(i < relations.length)) return [3 /*break*/,
|
|
3517
|
+
if (!(i < relations.length)) return [3 /*break*/, 13];
|
|
3518
|
+
_b.label = 2;
|
|
3519
|
+
case 2:
|
|
3520
|
+
_b.trys.push([2, 11, , 12]);
|
|
3465
3521
|
relation = relations[i];
|
|
3466
3522
|
return [4 /*yield*/, bruceModels.Entity.Get({
|
|
3467
3523
|
api: api,
|
|
3468
3524
|
entityId: relation["Principal.Entity.ID"],
|
|
3469
3525
|
})];
|
|
3470
|
-
case
|
|
3471
|
-
fromEntity = (
|
|
3526
|
+
case 3:
|
|
3527
|
+
fromEntity = (_b.sent()).entity;
|
|
3472
3528
|
return [4 /*yield*/, bruceModels.Entity.Get({
|
|
3473
3529
|
api: api,
|
|
3474
3530
|
entityId: relation["Related.Entity.ID"],
|
|
3475
3531
|
})];
|
|
3476
|
-
case
|
|
3477
|
-
toEntity = (
|
|
3478
|
-
if (!relation["Data.Entity.ID"]) return [3 /*break*/,
|
|
3532
|
+
case 4:
|
|
3533
|
+
toEntity = (_b.sent()).entity;
|
|
3534
|
+
if (!relation["Data.Entity.ID"]) return [3 /*break*/, 6];
|
|
3479
3535
|
return [4 /*yield*/, bruceModels.Entity.Get({
|
|
3480
3536
|
api: api,
|
|
3481
3537
|
entityId: relation["Data.Entity.ID"]
|
|
3482
3538
|
})];
|
|
3483
|
-
case 4:
|
|
3484
|
-
_a = (_d.sent()).entity;
|
|
3485
|
-
return [3 /*break*/, 6];
|
|
3486
3539
|
case 5:
|
|
3487
|
-
_a =
|
|
3488
|
-
|
|
3540
|
+
_a = (_b.sent()).entity;
|
|
3541
|
+
return [3 /*break*/, 7];
|
|
3489
3542
|
case 6:
|
|
3543
|
+
_a = null;
|
|
3544
|
+
_b.label = 7;
|
|
3545
|
+
case 7:
|
|
3490
3546
|
dataEntity = _a;
|
|
3491
3547
|
return [4 /*yield*/, bruceModels.EntityRelationType.Get({
|
|
3492
3548
|
api: api,
|
|
3493
3549
|
relationTypeId: relation["Relation.Type.ID"]
|
|
3494
3550
|
})];
|
|
3495
|
-
case 7:
|
|
3496
|
-
relationType = (_d.sent()).relationType;
|
|
3497
|
-
styleId = Number(relationType === null || relationType === void 0 ? void 0 : relationType.EntityDisplaySettingID);
|
|
3498
|
-
if (!!styleId) return [3 /*break*/, 11];
|
|
3499
|
-
typeId = relationType === null || relationType === void 0 ? void 0 : relationType["Relation.EntityType.ID"];
|
|
3500
|
-
if (!typeId) return [3 /*break*/, 9];
|
|
3501
|
-
return [4 /*yield*/, bruceModels.EntityType.Get({
|
|
3502
|
-
api: api,
|
|
3503
|
-
entityTypeId: typeId
|
|
3504
|
-
})];
|
|
3505
3551
|
case 8:
|
|
3506
|
-
|
|
3507
|
-
return [
|
|
3552
|
+
relationType = (_b.sent()).relationType;
|
|
3553
|
+
return [4 /*yield*/, getStyle$1(api, relationType === null || relationType === void 0 ? void 0 : relationType["Relation.EntityType.ID"], Number(relationType === null || relationType === void 0 ? void 0 : relationType.EntityDisplaySettingID))];
|
|
3508
3554
|
case 9:
|
|
3509
|
-
|
|
3510
|
-
_d.label = 10;
|
|
3511
|
-
case 10:
|
|
3512
|
-
entityType = _b;
|
|
3513
|
-
styleId = entityType === null || entityType === void 0 ? void 0 : entityType["DisplaySetting.ID"];
|
|
3514
|
-
_d.label = 11;
|
|
3515
|
-
case 11:
|
|
3516
|
-
if (!styleId) return [3 /*break*/, 13];
|
|
3517
|
-
return [4 /*yield*/, bruceModels.Style.Get({
|
|
3518
|
-
api: api,
|
|
3519
|
-
styleId: styleId
|
|
3520
|
-
})];
|
|
3521
|
-
case 12:
|
|
3522
|
-
_c = (_d.sent()).style;
|
|
3523
|
-
return [3 /*break*/, 14];
|
|
3524
|
-
case 13:
|
|
3525
|
-
_c = null;
|
|
3526
|
-
_d.label = 14;
|
|
3527
|
-
case 14:
|
|
3528
|
-
style = _c;
|
|
3555
|
+
style = _b.sent();
|
|
3529
3556
|
return [4 /*yield*/, Parabola.Render({
|
|
3530
3557
|
dataEntity: dataEntity,
|
|
3531
3558
|
fromEntity: fromEntity,
|
|
@@ -3536,15 +3563,19 @@
|
|
|
3536
3563
|
visualRegister: visualRegister,
|
|
3537
3564
|
apiGetter: apiGetter
|
|
3538
3565
|
})];
|
|
3539
|
-
case
|
|
3540
|
-
cEntity =
|
|
3566
|
+
case 10:
|
|
3567
|
+
cEntity = _b.sent();
|
|
3541
3568
|
cEntity._renderGroup = GetRenderGroupId(relation);
|
|
3542
3569
|
rendered[GetRenderGroupId(relation)] = cEntity;
|
|
3543
|
-
|
|
3544
|
-
case
|
|
3570
|
+
return [3 /*break*/, 12];
|
|
3571
|
+
case 11:
|
|
3572
|
+
e_3 = _b.sent();
|
|
3573
|
+
console.error(e_3);
|
|
3574
|
+
return [3 /*break*/, 12];
|
|
3575
|
+
case 12:
|
|
3545
3576
|
i++;
|
|
3546
3577
|
return [3 /*break*/, 1];
|
|
3547
|
-
case
|
|
3578
|
+
case 13: return [2 /*return*/, rendered];
|
|
3548
3579
|
}
|
|
3549
3580
|
});
|
|
3550
3581
|
});
|
|
@@ -3572,7 +3603,7 @@
|
|
|
3572
3603
|
toPos = null;
|
|
3573
3604
|
updatingPosses = false;
|
|
3574
3605
|
updatePosses = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3575
|
-
var
|
|
3606
|
+
var e_4;
|
|
3576
3607
|
return __generator(this, function (_a) {
|
|
3577
3608
|
switch (_a.label) {
|
|
3578
3609
|
case 0:
|
|
@@ -3609,8 +3640,8 @@
|
|
|
3609
3640
|
toPos = _a.sent();
|
|
3610
3641
|
return [3 /*break*/, 5];
|
|
3611
3642
|
case 4:
|
|
3612
|
-
|
|
3613
|
-
console.error(
|
|
3643
|
+
e_4 = _a.sent();
|
|
3644
|
+
console.error(e_4);
|
|
3614
3645
|
return [3 /*break*/, 5];
|
|
3615
3646
|
case 5:
|
|
3616
3647
|
updatingPosses = false;
|
|
@@ -6902,7 +6933,9 @@
|
|
|
6902
6933
|
etc = settings.etc;
|
|
6903
6934
|
etc = __assign({}, etc);
|
|
6904
6935
|
if (!ionId) return [3 /*break*/, 2];
|
|
6905
|
-
return [4 /*yield*/, Cesium.IonResource.fromAssetId(EnsureNumber(ionId)
|
|
6936
|
+
return [4 /*yield*/, Cesium.IonResource.fromAssetId(EnsureNumber(ionId), {
|
|
6937
|
+
accessToken: params.ionAccessToken ? params.ionAccessToken : Cesium.Ion.defaultAccessToken
|
|
6938
|
+
})];
|
|
6906
6939
|
case 1:
|
|
6907
6940
|
loadUrl = (_a.sent());
|
|
6908
6941
|
return [3 /*break*/, 3];
|
|
@@ -8247,135 +8280,129 @@
|
|
|
8247
8280
|
configurable: true
|
|
8248
8281
|
});
|
|
8249
8282
|
Manager.prototype.Init = function (params) {
|
|
8283
|
+
var _this = this;
|
|
8250
8284
|
var _a;
|
|
8251
|
-
|
|
8252
|
-
|
|
8285
|
+
this.initCounter += 1;
|
|
8286
|
+
var counter = this.initCounter;
|
|
8287
|
+
if (this.disposed) {
|
|
8288
|
+
return;
|
|
8289
|
+
}
|
|
8290
|
+
if (params === null || params === void 0 ? void 0 : params.item) {
|
|
8291
|
+
this.item = params.item;
|
|
8292
|
+
}
|
|
8293
|
+
var tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
|
|
8294
|
+
if (!tilesetId) {
|
|
8295
|
+
return;
|
|
8296
|
+
}
|
|
8297
|
+
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8298
|
+
var canAccess, e_1, accountId, api, tileset, cTileset, _a, attenuation, attenuationMax;
|
|
8253
8299
|
var _this = this;
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
tileset: tileset,
|
|
8327
|
-
viewer: this.viewer,
|
|
8328
|
-
accountId: accountId,
|
|
8329
|
-
viaCdn: this.item.cdnEnabled
|
|
8330
|
-
})];
|
|
8331
|
-
case 8:
|
|
8332
|
-
cTileset = _a.cTileset = _e.sent();
|
|
8333
|
-
if (this.disposed) {
|
|
8334
|
-
this.doDispose();
|
|
8335
|
-
return [2 /*return*/];
|
|
8336
|
-
}
|
|
8337
|
-
this.viewer.scene.requestRender();
|
|
8338
|
-
cTileset.readyPromise.then(function () {
|
|
8339
|
-
try {
|
|
8340
|
-
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
8341
|
-
return;
|
|
8342
|
-
}
|
|
8343
|
-
_this.onCTilesetLoad();
|
|
8344
|
-
_this.viewer.scene.requestRender();
|
|
8345
|
-
}
|
|
8346
|
-
catch (e) {
|
|
8347
|
-
console.error(e);
|
|
8348
|
-
}
|
|
8349
|
-
});
|
|
8350
|
-
cTileset.tileLoad.addEventListener(function (tile) {
|
|
8351
|
-
_this.mapCTile(tile);
|
|
8352
|
-
});
|
|
8353
|
-
_e.label = 9;
|
|
8354
|
-
case 9:
|
|
8355
|
-
attenuation = this.item.attenuation;
|
|
8356
|
-
if (!attenuation && attenuation != false) {
|
|
8357
|
-
attenuation = true;
|
|
8358
|
-
}
|
|
8359
|
-
attenuationMax = this.item.attenuationMax;
|
|
8360
|
-
if (isNaN(attenuationMax)) {
|
|
8361
|
-
attenuationMax = 20;
|
|
8300
|
+
var _b, _c, _d;
|
|
8301
|
+
return __generator(this, function (_e) {
|
|
8302
|
+
switch (_e.label) {
|
|
8303
|
+
case 0:
|
|
8304
|
+
if (!!this.cTileset) return [3 /*break*/, 9];
|
|
8305
|
+
if (!tilesetId) return [3 /*break*/, 5];
|
|
8306
|
+
canAccess = false;
|
|
8307
|
+
_e.label = 1;
|
|
8308
|
+
case 1:
|
|
8309
|
+
_e.trys.push([1, 3, , 4]);
|
|
8310
|
+
return [4 /*yield*/, bruceModels.Tileset.Publish.IsAccessAllowed({
|
|
8311
|
+
sourceAccountId: (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID,
|
|
8312
|
+
tilesetId: tilesetId,
|
|
8313
|
+
forAccountId: this.getters.GetAccountId(),
|
|
8314
|
+
api: this.getters.GetGlobalApi()
|
|
8315
|
+
})];
|
|
8316
|
+
case 2:
|
|
8317
|
+
canAccess = _e.sent();
|
|
8318
|
+
return [3 /*break*/, 4];
|
|
8319
|
+
case 3:
|
|
8320
|
+
e_1 = _e.sent();
|
|
8321
|
+
console.error(e_1);
|
|
8322
|
+
return [3 /*break*/, 4];
|
|
8323
|
+
case 4:
|
|
8324
|
+
if (!canAccess) {
|
|
8325
|
+
console.warn("Cannot access tileset: ".concat(tilesetId, ", from account: ").concat((_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.ClientAccountID, "."));
|
|
8326
|
+
return [2 /*return*/];
|
|
8327
|
+
}
|
|
8328
|
+
return [3 /*break*/, 6];
|
|
8329
|
+
case 5:
|
|
8330
|
+
console.warn("No tileset id found. Skipping access check.");
|
|
8331
|
+
_e.label = 6;
|
|
8332
|
+
case 6:
|
|
8333
|
+
if (this.disposed || counter !== this.initCounter) {
|
|
8334
|
+
return [2 /*return*/];
|
|
8335
|
+
}
|
|
8336
|
+
accountId = (_d = this.item.tileset) === null || _d === void 0 ? void 0 : _d.ClientAccountID;
|
|
8337
|
+
if (!accountId) {
|
|
8338
|
+
accountId = this.getters.GetAccountId();
|
|
8339
|
+
}
|
|
8340
|
+
api = this.getters.GetBruceApi({
|
|
8341
|
+
accountId: accountId
|
|
8342
|
+
});
|
|
8343
|
+
return [4 /*yield*/, bruceModels.Tileset.Get({
|
|
8344
|
+
api: api,
|
|
8345
|
+
tilesetId: tilesetId
|
|
8346
|
+
})];
|
|
8347
|
+
case 7:
|
|
8348
|
+
tileset = (_e.sent()).tileset;
|
|
8349
|
+
if (!tileset || this.disposed || counter !== this.initCounter) {
|
|
8350
|
+
return [2 /*return*/];
|
|
8351
|
+
}
|
|
8352
|
+
this.typeId = tileset.settings.entityTypeId;
|
|
8353
|
+
_a = this;
|
|
8354
|
+
return [4 /*yield*/, exports.TilesetRenderEngine.Render({
|
|
8355
|
+
apiGetter: this.getters.GetBruceGetter(),
|
|
8356
|
+
tileset: tileset,
|
|
8357
|
+
viewer: this.viewer,
|
|
8358
|
+
accountId: accountId,
|
|
8359
|
+
viaCdn: this.item.cdnEnabled
|
|
8360
|
+
})];
|
|
8361
|
+
case 8:
|
|
8362
|
+
cTileset = _a.cTileset = _e.sent();
|
|
8363
|
+
if (this.disposed) {
|
|
8364
|
+
this.doDispose();
|
|
8365
|
+
return [2 /*return*/];
|
|
8366
|
+
}
|
|
8367
|
+
this.viewer.scene.requestRender();
|
|
8368
|
+
cTileset.readyPromise.then(function () {
|
|
8369
|
+
try {
|
|
8370
|
+
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
8371
|
+
return;
|
|
8362
8372
|
}
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
+
_this.onCTilesetLoad();
|
|
8374
|
+
_this.viewer.scene.requestRender();
|
|
8375
|
+
}
|
|
8376
|
+
catch (e) {
|
|
8377
|
+
console.error(e);
|
|
8378
|
+
}
|
|
8379
|
+
});
|
|
8380
|
+
cTileset.tileLoad.addEventListener(function (tile) {
|
|
8381
|
+
_this.mapCTile(tile);
|
|
8382
|
+
});
|
|
8383
|
+
_e.label = 9;
|
|
8384
|
+
case 9:
|
|
8385
|
+
attenuation = this.item.attenuation;
|
|
8386
|
+
if (!attenuation && attenuation != false) {
|
|
8387
|
+
attenuation = true;
|
|
8373
8388
|
}
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8389
|
+
attenuationMax = this.item.attenuationMax;
|
|
8390
|
+
if (isNaN(attenuationMax)) {
|
|
8391
|
+
attenuationMax = 20;
|
|
8392
|
+
}
|
|
8393
|
+
this.cTileset.readyPromise.then(function () {
|
|
8394
|
+
exports.TilesetRenderEngine.ApplySettings({
|
|
8395
|
+
cTileset: _this.cTileset,
|
|
8396
|
+
settings: {
|
|
8397
|
+
attenuation: attenuation,
|
|
8398
|
+
maximumAttenuation: attenuationMax
|
|
8399
|
+
}
|
|
8400
|
+
});
|
|
8401
|
+
});
|
|
8402
|
+
return [2 /*return*/];
|
|
8403
|
+
}
|
|
8377
8404
|
});
|
|
8378
|
-
});
|
|
8405
|
+
}); })();
|
|
8379
8406
|
};
|
|
8380
8407
|
Manager.prototype.Dispose = function () {
|
|
8381
8408
|
if (this.disposed) {
|
|
@@ -8807,15 +8834,15 @@
|
|
|
8807
8834
|
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8808
8835
|
var canAccess, e_3, _a, tileset, type, _b, LEGACY_TYPES, legacyTileset, _c, accountId, _d, _e;
|
|
8809
8836
|
var _this = this;
|
|
8810
|
-
var _f, _g, _h, _j, _k, _l, _m;
|
|
8811
|
-
return __generator(this, function (
|
|
8812
|
-
switch (
|
|
8837
|
+
var _f, _g, _h, _j, _k, _l, _m, _o;
|
|
8838
|
+
return __generator(this, function (_p) {
|
|
8839
|
+
switch (_p.label) {
|
|
8813
8840
|
case 0:
|
|
8814
8841
|
if (!tilesetId) return [3 /*break*/, 5];
|
|
8815
8842
|
canAccess = false;
|
|
8816
|
-
|
|
8843
|
+
_p.label = 1;
|
|
8817
8844
|
case 1:
|
|
8818
|
-
|
|
8845
|
+
_p.trys.push([1, 3, , 4]);
|
|
8819
8846
|
return [4 /*yield*/, bruceModels.Tileset.Publish.IsAccessAllowed({
|
|
8820
8847
|
sourceAccountId: (_f = this.item.tileset) === null || _f === void 0 ? void 0 : _f.ClientAccountID,
|
|
8821
8848
|
tilesetId: tilesetId,
|
|
@@ -8823,10 +8850,10 @@
|
|
|
8823
8850
|
api: this.getters.GetGlobalApi()
|
|
8824
8851
|
})];
|
|
8825
8852
|
case 2:
|
|
8826
|
-
canAccess =
|
|
8853
|
+
canAccess = _p.sent();
|
|
8827
8854
|
return [3 /*break*/, 4];
|
|
8828
8855
|
case 3:
|
|
8829
|
-
e_3 =
|
|
8856
|
+
e_3 = _p.sent();
|
|
8830
8857
|
console.error(e_3);
|
|
8831
8858
|
return [3 /*break*/, 4];
|
|
8832
8859
|
case 4:
|
|
@@ -8837,7 +8864,7 @@
|
|
|
8837
8864
|
return [3 /*break*/, 6];
|
|
8838
8865
|
case 5:
|
|
8839
8866
|
console.warn("No tileset id found. Skipping access check.");
|
|
8840
|
-
|
|
8867
|
+
_p.label = 6;
|
|
8841
8868
|
case 6:
|
|
8842
8869
|
if (!tilesetId) return [3 /*break*/, 8];
|
|
8843
8870
|
return [4 /*yield*/, getTileset({
|
|
@@ -8845,11 +8872,11 @@
|
|
|
8845
8872
|
menuItem: this.item
|
|
8846
8873
|
})];
|
|
8847
8874
|
case 7:
|
|
8848
|
-
_b =
|
|
8875
|
+
_b = _p.sent();
|
|
8849
8876
|
return [3 /*break*/, 9];
|
|
8850
8877
|
case 8:
|
|
8851
8878
|
_b = { tileset: null, type: null };
|
|
8852
|
-
|
|
8879
|
+
_p.label = 9;
|
|
8853
8880
|
case 9:
|
|
8854
8881
|
_a = _b, tileset = _a.tileset, type = _a.type;
|
|
8855
8882
|
if (this.disposed) {
|
|
@@ -8872,11 +8899,11 @@
|
|
|
8872
8899
|
tileset: tileset
|
|
8873
8900
|
})];
|
|
8874
8901
|
case 10:
|
|
8875
|
-
_c =
|
|
8902
|
+
_c = _p.sent();
|
|
8876
8903
|
return [3 /*break*/, 12];
|
|
8877
8904
|
case 11:
|
|
8878
8905
|
_c = null;
|
|
8879
|
-
|
|
8906
|
+
_p.label = 12;
|
|
8880
8907
|
case 12:
|
|
8881
8908
|
legacyTileset = _c;
|
|
8882
8909
|
if (this.disposed) {
|
|
@@ -8892,12 +8919,13 @@
|
|
|
8892
8919
|
tileset: legacyTileset,
|
|
8893
8920
|
viewer: this.viewer,
|
|
8894
8921
|
ionId: (_k = this.item.IonResource) === null || _k === void 0 ? void 0 : _k.AssetID,
|
|
8922
|
+
ionAccessToken: (_l = this.item.IonResource) === null || _l === void 0 ? void 0 : _l.AccessToken,
|
|
8895
8923
|
loadUrl: loadUrlOverride,
|
|
8896
8924
|
accountId: accountId,
|
|
8897
8925
|
viaCdn: true
|
|
8898
8926
|
})];
|
|
8899
8927
|
case 13:
|
|
8900
|
-
_d.cTileset =
|
|
8928
|
+
_d.cTileset = _p.sent();
|
|
8901
8929
|
return [3 /*break*/, 16];
|
|
8902
8930
|
case 14:
|
|
8903
8931
|
if (!tileset) return [3 /*break*/, 16];
|
|
@@ -8907,13 +8935,13 @@
|
|
|
8907
8935
|
tileset: tileset,
|
|
8908
8936
|
viewer: this.viewer,
|
|
8909
8937
|
coords: null,
|
|
8910
|
-
accountId: (
|
|
8938
|
+
accountId: (_o = (_m = this.item.tileset) === null || _m === void 0 ? void 0 : _m.ClientAccountID) !== null && _o !== void 0 ? _o : this.getters.GetAccountId(),
|
|
8911
8939
|
// Not doing viaCDN here because I fear it'll break something since this is a legacy menu item type.
|
|
8912
8940
|
viaCdn: false
|
|
8913
8941
|
})];
|
|
8914
8942
|
case 15:
|
|
8915
|
-
_e.cTileset =
|
|
8916
|
-
|
|
8943
|
+
_e.cTileset = _p.sent();
|
|
8944
|
+
_p.label = 16;
|
|
8917
8945
|
case 16:
|
|
8918
8946
|
if (this.disposed) {
|
|
8919
8947
|
this.doDispose();
|
|
@@ -9061,6 +9089,8 @@
|
|
|
9061
9089
|
(function (RelationsRenderManager) {
|
|
9062
9090
|
var Manager = /** @class */ (function () {
|
|
9063
9091
|
function Manager(params) {
|
|
9092
|
+
// If true, this menu item is disposed and should not be used.
|
|
9093
|
+
// Any rendering will be ignored.
|
|
9064
9094
|
this.disposed = false;
|
|
9065
9095
|
var apiGetter = params.apiGetter, item = params.item, register = params.register, viewer = params.viewer;
|
|
9066
9096
|
this.apiGetter = apiGetter;
|
|
@@ -9075,56 +9105,62 @@
|
|
|
9075
9105
|
enumerable: false,
|
|
9076
9106
|
configurable: true
|
|
9077
9107
|
});
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
var
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9108
|
+
/**
|
|
9109
|
+
* Starts rendering the menu item.
|
|
9110
|
+
* Re-call with an updated menu item to re-render. It will auto-cleanup old relations.
|
|
9111
|
+
* @param params
|
|
9112
|
+
* @returns
|
|
9113
|
+
*/
|
|
9114
|
+
Manager.prototype.Init = function (params) {
|
|
9115
|
+
var _a;
|
|
9116
|
+
if (this.disposed) {
|
|
9117
|
+
return;
|
|
9118
|
+
}
|
|
9119
|
+
if (params === null || params === void 0 ? void 0 : params.item) {
|
|
9120
|
+
this.item = params.item;
|
|
9121
|
+
}
|
|
9122
|
+
// Remove relationships we no longer want to render.
|
|
9123
|
+
// We'll have to get regos by the menu item ID then run a check on the related rego relationship.
|
|
9124
|
+
var regos = this.register.GetRegos({
|
|
9125
|
+
menuItemId: this.item.id
|
|
9126
|
+
});
|
|
9127
|
+
var drawnIds = [];
|
|
9128
|
+
var toDrawIds = [];
|
|
9129
|
+
var entityIds = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.EntityIds;
|
|
9130
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
9131
|
+
entityIds = [];
|
|
9132
|
+
}
|
|
9133
|
+
for (var i = 0; i < regos.length; i++) {
|
|
9134
|
+
var rego = regos[i];
|
|
9135
|
+
if (!this.shouldRenderRelation(rego.relation)) {
|
|
9136
|
+
this.register.RemoveRegos({
|
|
9137
|
+
relation: rego.relation,
|
|
9138
|
+
entityId: rego.entityId,
|
|
9139
|
+
menuItemId: this.item.id,
|
|
9140
|
+
requestRender: false
|
|
9141
|
+
});
|
|
9142
|
+
}
|
|
9143
|
+
else {
|
|
9144
|
+
drawnIds.push(rego.entityId);
|
|
9145
|
+
if (rego.relation) {
|
|
9146
|
+
drawnIds.push(rego.relation["Principal.Entity.ID"]);
|
|
9147
|
+
drawnIds.push(rego.relation["Related.Entity.ID"]);
|
|
9090
9148
|
}
|
|
9091
9149
|
}
|
|
9150
|
+
}
|
|
9151
|
+
this.viewer.scene.requestRender();
|
|
9152
|
+
var _loop_1 = function (i) {
|
|
9153
|
+
if (!drawnIds.find(function (x) { return x == entityIds[i]; })) {
|
|
9154
|
+
toDrawIds.push(entityIds[i]);
|
|
9155
|
+
}
|
|
9092
9156
|
};
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
api: api,
|
|
9097
|
-
entityId: entityId,
|
|
9098
|
-
filter: {
|
|
9099
|
-
oneWayOnly: false,
|
|
9100
|
-
loadEntityData: false
|
|
9101
|
-
}
|
|
9102
|
-
}).then(function (data) {
|
|
9103
|
-
var _a;
|
|
9104
|
-
var relations = data.relations;
|
|
9105
|
-
var _loop_1 = function (j) {
|
|
9106
|
-
var relation = relations[j];
|
|
9107
|
-
if (((_a = _this.item.relationTypeIds) === null || _a === void 0 ? void 0 : _a.length) && !_this.item.relationTypeIds.includes(relation["Relation.Type.ID"])) {
|
|
9108
|
-
return "continue";
|
|
9109
|
-
}
|
|
9110
|
-
var key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9111
|
-
if (!drawn.find(function (x) { return x == key; })) {
|
|
9112
|
-
drawn.push(key);
|
|
9113
|
-
drawBatch.push(relation);
|
|
9114
|
-
if (drawBatch.length >= BATCH_SIZE) {
|
|
9115
|
-
_this.onGetterUpdate(drawBatch);
|
|
9116
|
-
drawBatch = [];
|
|
9117
|
-
}
|
|
9118
|
-
}
|
|
9119
|
-
};
|
|
9120
|
-
for (var j = 0; j < relations.length; j++) {
|
|
9121
|
-
_loop_1(j);
|
|
9122
|
-
}
|
|
9123
|
-
onResolve();
|
|
9124
|
-
}).catch(function (e) {
|
|
9125
|
-
onResolve();
|
|
9126
|
-
});
|
|
9157
|
+
// We'll call a re-render on entity ids that are not drawn.
|
|
9158
|
+
for (var i = 0; i < entityIds.length; i++) {
|
|
9159
|
+
_loop_1(i);
|
|
9127
9160
|
}
|
|
9161
|
+
this.renderEntityIds({
|
|
9162
|
+
entityIds: toDrawIds
|
|
9163
|
+
});
|
|
9128
9164
|
};
|
|
9129
9165
|
Manager.prototype.Dispose = function () {
|
|
9130
9166
|
if (this.disposed) {
|
|
@@ -9135,19 +9171,154 @@
|
|
|
9135
9171
|
menuItemId: this.item.id
|
|
9136
9172
|
});
|
|
9137
9173
|
};
|
|
9174
|
+
/**
|
|
9175
|
+
* Re-renders specific entity relationships.
|
|
9176
|
+
* @TODO: This should re-render all relationships when entityIds=null.
|
|
9177
|
+
* @param params
|
|
9178
|
+
*/
|
|
9138
9179
|
Manager.prototype.ReRender = function (params) {
|
|
9139
9180
|
return __awaiter(this, void 0, void 0, function () {
|
|
9140
9181
|
var entityIds, force;
|
|
9141
9182
|
return __generator(this, function (_a) {
|
|
9142
9183
|
entityIds = params.entityIds, force = params.force;
|
|
9184
|
+
if (entityIds == null) ;
|
|
9185
|
+
else {
|
|
9186
|
+
this.renderEntityIds({
|
|
9187
|
+
dataEntityIds: entityIds
|
|
9188
|
+
});
|
|
9189
|
+
}
|
|
9143
9190
|
return [2 /*return*/];
|
|
9144
9191
|
});
|
|
9145
9192
|
});
|
|
9146
9193
|
};
|
|
9194
|
+
/**
|
|
9195
|
+
* Gets relationship records corresponding to provided IDs and requests a render for them.
|
|
9196
|
+
*/
|
|
9197
|
+
Manager.prototype.renderEntityIds = function (params) {
|
|
9198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9199
|
+
var entityIds, dataEntityIds, drawn, api, BATCH_SIZE, drawBatch, pending, onResolve, i, entityId, i, entityId;
|
|
9200
|
+
var _this = this;
|
|
9201
|
+
return __generator(this, function (_a) {
|
|
9202
|
+
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9203
|
+
return [2 /*return*/];
|
|
9204
|
+
}
|
|
9205
|
+
entityIds = params.entityIds, dataEntityIds = params.dataEntityIds;
|
|
9206
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
9207
|
+
entityIds = [];
|
|
9208
|
+
}
|
|
9209
|
+
if (!(dataEntityIds === null || dataEntityIds === void 0 ? void 0 : dataEntityIds.length)) {
|
|
9210
|
+
dataEntityIds = [];
|
|
9211
|
+
}
|
|
9212
|
+
drawn = [];
|
|
9213
|
+
api = this.apiGetter.getApi(this.apiGetter.accountId);
|
|
9214
|
+
BATCH_SIZE = 5;
|
|
9215
|
+
drawBatch = [];
|
|
9216
|
+
pending = entityIds.length + dataEntityIds.length;
|
|
9217
|
+
onResolve = function () {
|
|
9218
|
+
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
9219
|
+
return;
|
|
9220
|
+
}
|
|
9221
|
+
pending -= 1;
|
|
9222
|
+
if (pending <= 0) {
|
|
9223
|
+
if (drawBatch === null || drawBatch === void 0 ? void 0 : drawBatch.length) {
|
|
9224
|
+
_this.onGetterUpdate(drawBatch);
|
|
9225
|
+
}
|
|
9226
|
+
}
|
|
9227
|
+
};
|
|
9228
|
+
// Get relationships by their data entity ID.
|
|
9229
|
+
for (i = 0; i < dataEntityIds.length; i++) {
|
|
9230
|
+
entityId = dataEntityIds[i];
|
|
9231
|
+
bruceModels.EntityRelation.GetByDataEntityId({
|
|
9232
|
+
entityId: entityId,
|
|
9233
|
+
api: api
|
|
9234
|
+
}).then(function (data) {
|
|
9235
|
+
if (data.relation) {
|
|
9236
|
+
var relation = data.relation;
|
|
9237
|
+
var key_1 = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9238
|
+
if (!drawn.find(function (x) { return x == key_1; })) {
|
|
9239
|
+
drawn.push(key_1);
|
|
9240
|
+
drawBatch.push(relation);
|
|
9241
|
+
if (drawBatch.length >= BATCH_SIZE) {
|
|
9242
|
+
_this.onGetterUpdate(drawBatch);
|
|
9243
|
+
drawBatch = [];
|
|
9244
|
+
}
|
|
9245
|
+
}
|
|
9246
|
+
}
|
|
9247
|
+
onResolve();
|
|
9248
|
+
}).catch(function (e) {
|
|
9249
|
+
onResolve();
|
|
9250
|
+
});
|
|
9251
|
+
}
|
|
9252
|
+
// Get relationships by either the parent or child ID.
|
|
9253
|
+
for (i = 0; i < entityIds.length; i++) {
|
|
9254
|
+
entityId = entityIds[i];
|
|
9255
|
+
bruceModels.EntityRelation.GetList({
|
|
9256
|
+
api: api,
|
|
9257
|
+
entityId: entityId,
|
|
9258
|
+
filter: {
|
|
9259
|
+
oneWayOnly: false,
|
|
9260
|
+
loadEntityData: false
|
|
9261
|
+
}
|
|
9262
|
+
}).then(function (data) {
|
|
9263
|
+
var relations = data.relations;
|
|
9264
|
+
var _loop_2 = function (j) {
|
|
9265
|
+
var relation = relations[j];
|
|
9266
|
+
var key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9267
|
+
if (!drawn.find(function (x) { return x == key; })) {
|
|
9268
|
+
drawn.push(key);
|
|
9269
|
+
drawBatch.push(relation);
|
|
9270
|
+
if (drawBatch.length >= BATCH_SIZE) {
|
|
9271
|
+
_this.onGetterUpdate(drawBatch);
|
|
9272
|
+
drawBatch = [];
|
|
9273
|
+
}
|
|
9274
|
+
}
|
|
9275
|
+
};
|
|
9276
|
+
for (var j = 0; j < relations.length; j++) {
|
|
9277
|
+
_loop_2(j);
|
|
9278
|
+
}
|
|
9279
|
+
onResolve();
|
|
9280
|
+
}).catch(function (e) {
|
|
9281
|
+
onResolve();
|
|
9282
|
+
});
|
|
9283
|
+
}
|
|
9284
|
+
return [2 /*return*/];
|
|
9285
|
+
});
|
|
9286
|
+
});
|
|
9287
|
+
};
|
|
9288
|
+
/**
|
|
9289
|
+
* Returns if a relation should be rendered.
|
|
9290
|
+
* This is in case the menu item was updated and the relation is no longer relevant.
|
|
9291
|
+
* @param relation
|
|
9292
|
+
*/
|
|
9293
|
+
Manager.prototype.shouldRenderRelation = function (relation) {
|
|
9294
|
+
var _a, _b, _c;
|
|
9295
|
+
if (((_a = this.item.relationTypeIds) === null || _a === void 0 ? void 0 : _a.length) && !this.item.relationTypeIds.includes(relation["Relation.Type.ID"])) {
|
|
9296
|
+
return false;
|
|
9297
|
+
}
|
|
9298
|
+
var renderedIds = (_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.BruceEntity) === null || _c === void 0 ? void 0 : _c.EntityIds;
|
|
9299
|
+
if (!renderedIds) {
|
|
9300
|
+
return false;
|
|
9301
|
+
}
|
|
9302
|
+
var ids = [
|
|
9303
|
+
relation["Principal.Entity.ID"],
|
|
9304
|
+
relation["Related.Entity.ID"]
|
|
9305
|
+
];
|
|
9306
|
+
if (relation["Data.Entity.ID"]) {
|
|
9307
|
+
ids.push(relation["Data.Entity.ID"]);
|
|
9308
|
+
}
|
|
9309
|
+
return ids.some(function (x) { return renderedIds.includes(x); });
|
|
9310
|
+
};
|
|
9311
|
+
/**
|
|
9312
|
+
* Renders batch of entity relationships.
|
|
9313
|
+
* This will check if a relationship SHOULD be rendered before rendering it.
|
|
9314
|
+
* It will also handle already rendered relations to avoid re-rendering them.
|
|
9315
|
+
* @param relations
|
|
9316
|
+
*/
|
|
9147
9317
|
Manager.prototype.onGetterUpdate = function (relations) {
|
|
9148
9318
|
var _a, _b;
|
|
9149
9319
|
return __awaiter(this, void 0, void 0, function () {
|
|
9150
|
-
var cEntities, i, relation, key, cEntity, visual, e_1;
|
|
9320
|
+
var killCEntity, cEntities, key, i, relation, key, cEntity, visual, e_1;
|
|
9321
|
+
var _this = this;
|
|
9151
9322
|
return __generator(this, function (_c) {
|
|
9152
9323
|
switch (_c.label) {
|
|
9153
9324
|
case 0:
|
|
@@ -9155,6 +9326,12 @@
|
|
|
9155
9326
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9156
9327
|
return [2 /*return*/];
|
|
9157
9328
|
}
|
|
9329
|
+
relations = relations.filter(function (x) { return _this.shouldRenderRelation(x); });
|
|
9330
|
+
killCEntity = function (cEntity) {
|
|
9331
|
+
if (cEntity && !_this.viewer.isDestroyed() && _this.viewer.entities.contains(cEntity)) {
|
|
9332
|
+
_this.viewer.entities.remove(cEntity);
|
|
9333
|
+
}
|
|
9334
|
+
};
|
|
9158
9335
|
return [4 /*yield*/, RelationRenderEngine.Render({
|
|
9159
9336
|
apiGetter: this.apiGetter,
|
|
9160
9337
|
menuItemId: this.item.id,
|
|
@@ -9168,13 +9345,16 @@
|
|
|
9168
9345
|
this.register.RemoveRegos({
|
|
9169
9346
|
menuItemId: this.item.id
|
|
9170
9347
|
});
|
|
9348
|
+
for (key in cEntities) {
|
|
9349
|
+
killCEntity(cEntities[key]);
|
|
9350
|
+
}
|
|
9171
9351
|
return [2 /*return*/];
|
|
9172
9352
|
}
|
|
9173
9353
|
for (i = 0; i < relations.length; i++) {
|
|
9174
9354
|
relation = relations[i];
|
|
9175
9355
|
key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9176
9356
|
cEntity = cEntities[key];
|
|
9177
|
-
if (cEntity) {
|
|
9357
|
+
if (cEntity && this.shouldRenderRelation(relation)) {
|
|
9178
9358
|
visual = (_a = this.register.GetRego({
|
|
9179
9359
|
entityId: key,
|
|
9180
9360
|
menuItemId: this.item.id
|
|
@@ -9200,6 +9380,7 @@
|
|
|
9200
9380
|
menuItemId: this.item.id,
|
|
9201
9381
|
requestRender: false
|
|
9202
9382
|
});
|
|
9383
|
+
killCEntity(cEntity);
|
|
9203
9384
|
}
|
|
9204
9385
|
}
|
|
9205
9386
|
this.viewer.scene.requestRender();
|
|
@@ -9394,6 +9575,14 @@
|
|
|
9394
9575
|
});
|
|
9395
9576
|
rItem.item = params.item;
|
|
9396
9577
|
}
|
|
9578
|
+
// This means we're updating a rendered relationships menu item.
|
|
9579
|
+
// Eg: different entities need to be rendered, or one of the relationship data entities changed.
|
|
9580
|
+
else if (rItem.type == bruceModels.MenuItem.EType.Relations && params.item.Type == bruceModels.MenuItem.EType.Relations) {
|
|
9581
|
+
rItem.renderManager.Init({
|
|
9582
|
+
item: params.item,
|
|
9583
|
+
});
|
|
9584
|
+
rItem.item = params.item;
|
|
9585
|
+
}
|
|
9397
9586
|
}
|
|
9398
9587
|
else {
|
|
9399
9588
|
rItem = {
|
|
@@ -12295,7 +12484,7 @@
|
|
|
12295
12484
|
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
12296
12485
|
id = curEnabled_1[_i];
|
|
12297
12486
|
if (newItemIds.indexOf(id) === -1 ||
|
|
12298
|
-
id == RELATION_MENU_ITEM_ID) {
|
|
12487
|
+
(id == RELATION_MENU_ITEM_ID && !renderedRelationEntityIds.length)) {
|
|
12299
12488
|
params.manager.RemoveItemById({
|
|
12300
12489
|
menuItemId: id
|
|
12301
12490
|
});
|
|
@@ -12315,7 +12504,7 @@
|
|
|
12315
12504
|
}
|
|
12316
12505
|
_6.label = 4;
|
|
12317
12506
|
case 4:
|
|
12318
|
-
if (!
|
|
12507
|
+
if (!renderedRelationEntityIds.length) return [3 /*break*/, 6];
|
|
12319
12508
|
menuItem = {
|
|
12320
12509
|
id: RELATION_MENU_ITEM_ID,
|
|
12321
12510
|
Caption: "Entity relations",
|
|
@@ -15239,7 +15428,7 @@
|
|
|
15239
15428
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15240
15429
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
15241
15430
|
|
|
15242
|
-
var VERSION$1 = "2.7.
|
|
15431
|
+
var VERSION$1 = "2.7.9";
|
|
15243
15432
|
|
|
15244
15433
|
exports.VERSION = VERSION$1;
|
|
15245
15434
|
exports.CesiumViewMonitor = CesiumViewMonitor;
|