bruce-cesium 2.7.8 → 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 +428 -242
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +427 -241
- 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-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/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/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;
|
|
@@ -8249,135 +8280,129 @@
|
|
|
8249
8280
|
configurable: true
|
|
8250
8281
|
});
|
|
8251
8282
|
Manager.prototype.Init = function (params) {
|
|
8283
|
+
var _this = this;
|
|
8252
8284
|
var _a;
|
|
8253
|
-
|
|
8254
|
-
|
|
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;
|
|
8255
8299
|
var _this = this;
|
|
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
|
-
|
|
8327
|
-
|
|
8328
|
-
tileset: tileset,
|
|
8329
|
-
viewer: this.viewer,
|
|
8330
|
-
accountId: accountId,
|
|
8331
|
-
viaCdn: this.item.cdnEnabled
|
|
8332
|
-
})];
|
|
8333
|
-
case 8:
|
|
8334
|
-
cTileset = _a.cTileset = _e.sent();
|
|
8335
|
-
if (this.disposed) {
|
|
8336
|
-
this.doDispose();
|
|
8337
|
-
return [2 /*return*/];
|
|
8338
|
-
}
|
|
8339
|
-
this.viewer.scene.requestRender();
|
|
8340
|
-
cTileset.readyPromise.then(function () {
|
|
8341
|
-
try {
|
|
8342
|
-
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
8343
|
-
return;
|
|
8344
|
-
}
|
|
8345
|
-
_this.onCTilesetLoad();
|
|
8346
|
-
_this.viewer.scene.requestRender();
|
|
8347
|
-
}
|
|
8348
|
-
catch (e) {
|
|
8349
|
-
console.error(e);
|
|
8350
|
-
}
|
|
8351
|
-
});
|
|
8352
|
-
cTileset.tileLoad.addEventListener(function (tile) {
|
|
8353
|
-
_this.mapCTile(tile);
|
|
8354
|
-
});
|
|
8355
|
-
_e.label = 9;
|
|
8356
|
-
case 9:
|
|
8357
|
-
attenuation = this.item.attenuation;
|
|
8358
|
-
if (!attenuation && attenuation != false) {
|
|
8359
|
-
attenuation = true;
|
|
8360
|
-
}
|
|
8361
|
-
attenuationMax = this.item.attenuationMax;
|
|
8362
|
-
if (isNaN(attenuationMax)) {
|
|
8363
|
-
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;
|
|
8364
8372
|
}
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
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;
|
|
8375
8388
|
}
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
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
|
+
}
|
|
8379
8404
|
});
|
|
8380
|
-
});
|
|
8405
|
+
}); })();
|
|
8381
8406
|
};
|
|
8382
8407
|
Manager.prototype.Dispose = function () {
|
|
8383
8408
|
if (this.disposed) {
|
|
@@ -9064,6 +9089,8 @@
|
|
|
9064
9089
|
(function (RelationsRenderManager) {
|
|
9065
9090
|
var Manager = /** @class */ (function () {
|
|
9066
9091
|
function Manager(params) {
|
|
9092
|
+
// If true, this menu item is disposed and should not be used.
|
|
9093
|
+
// Any rendering will be ignored.
|
|
9067
9094
|
this.disposed = false;
|
|
9068
9095
|
var apiGetter = params.apiGetter, item = params.item, register = params.register, viewer = params.viewer;
|
|
9069
9096
|
this.apiGetter = apiGetter;
|
|
@@ -9078,56 +9105,62 @@
|
|
|
9078
9105
|
enumerable: false,
|
|
9079
9106
|
configurable: true
|
|
9080
9107
|
});
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
var
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
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"]);
|
|
9093
9148
|
}
|
|
9094
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
|
+
}
|
|
9095
9156
|
};
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
api: api,
|
|
9100
|
-
entityId: entityId,
|
|
9101
|
-
filter: {
|
|
9102
|
-
oneWayOnly: false,
|
|
9103
|
-
loadEntityData: false
|
|
9104
|
-
}
|
|
9105
|
-
}).then(function (data) {
|
|
9106
|
-
var _a;
|
|
9107
|
-
var relations = data.relations;
|
|
9108
|
-
var _loop_1 = function (j) {
|
|
9109
|
-
var relation = relations[j];
|
|
9110
|
-
if (((_a = _this.item.relationTypeIds) === null || _a === void 0 ? void 0 : _a.length) && !_this.item.relationTypeIds.includes(relation["Relation.Type.ID"])) {
|
|
9111
|
-
return "continue";
|
|
9112
|
-
}
|
|
9113
|
-
var key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9114
|
-
if (!drawn.find(function (x) { return x == key; })) {
|
|
9115
|
-
drawn.push(key);
|
|
9116
|
-
drawBatch.push(relation);
|
|
9117
|
-
if (drawBatch.length >= BATCH_SIZE) {
|
|
9118
|
-
_this.onGetterUpdate(drawBatch);
|
|
9119
|
-
drawBatch = [];
|
|
9120
|
-
}
|
|
9121
|
-
}
|
|
9122
|
-
};
|
|
9123
|
-
for (var j = 0; j < relations.length; j++) {
|
|
9124
|
-
_loop_1(j);
|
|
9125
|
-
}
|
|
9126
|
-
onResolve();
|
|
9127
|
-
}).catch(function (e) {
|
|
9128
|
-
onResolve();
|
|
9129
|
-
});
|
|
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);
|
|
9130
9160
|
}
|
|
9161
|
+
this.renderEntityIds({
|
|
9162
|
+
entityIds: toDrawIds
|
|
9163
|
+
});
|
|
9131
9164
|
};
|
|
9132
9165
|
Manager.prototype.Dispose = function () {
|
|
9133
9166
|
if (this.disposed) {
|
|
@@ -9138,19 +9171,154 @@
|
|
|
9138
9171
|
menuItemId: this.item.id
|
|
9139
9172
|
});
|
|
9140
9173
|
};
|
|
9174
|
+
/**
|
|
9175
|
+
* Re-renders specific entity relationships.
|
|
9176
|
+
* @TODO: This should re-render all relationships when entityIds=null.
|
|
9177
|
+
* @param params
|
|
9178
|
+
*/
|
|
9141
9179
|
Manager.prototype.ReRender = function (params) {
|
|
9142
9180
|
return __awaiter(this, void 0, void 0, function () {
|
|
9143
9181
|
var entityIds, force;
|
|
9144
9182
|
return __generator(this, function (_a) {
|
|
9145
9183
|
entityIds = params.entityIds, force = params.force;
|
|
9184
|
+
if (entityIds == null) ;
|
|
9185
|
+
else {
|
|
9186
|
+
this.renderEntityIds({
|
|
9187
|
+
dataEntityIds: entityIds
|
|
9188
|
+
});
|
|
9189
|
+
}
|
|
9146
9190
|
return [2 /*return*/];
|
|
9147
9191
|
});
|
|
9148
9192
|
});
|
|
9149
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
|
+
*/
|
|
9150
9317
|
Manager.prototype.onGetterUpdate = function (relations) {
|
|
9151
9318
|
var _a, _b;
|
|
9152
9319
|
return __awaiter(this, void 0, void 0, function () {
|
|
9153
|
-
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;
|
|
9154
9322
|
return __generator(this, function (_c) {
|
|
9155
9323
|
switch (_c.label) {
|
|
9156
9324
|
case 0:
|
|
@@ -9158,6 +9326,12 @@
|
|
|
9158
9326
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9159
9327
|
return [2 /*return*/];
|
|
9160
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
|
+
};
|
|
9161
9335
|
return [4 /*yield*/, RelationRenderEngine.Render({
|
|
9162
9336
|
apiGetter: this.apiGetter,
|
|
9163
9337
|
menuItemId: this.item.id,
|
|
@@ -9171,13 +9345,16 @@
|
|
|
9171
9345
|
this.register.RemoveRegos({
|
|
9172
9346
|
menuItemId: this.item.id
|
|
9173
9347
|
});
|
|
9348
|
+
for (key in cEntities) {
|
|
9349
|
+
killCEntity(cEntities[key]);
|
|
9350
|
+
}
|
|
9174
9351
|
return [2 /*return*/];
|
|
9175
9352
|
}
|
|
9176
9353
|
for (i = 0; i < relations.length; i++) {
|
|
9177
9354
|
relation = relations[i];
|
|
9178
9355
|
key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9179
9356
|
cEntity = cEntities[key];
|
|
9180
|
-
if (cEntity) {
|
|
9357
|
+
if (cEntity && this.shouldRenderRelation(relation)) {
|
|
9181
9358
|
visual = (_a = this.register.GetRego({
|
|
9182
9359
|
entityId: key,
|
|
9183
9360
|
menuItemId: this.item.id
|
|
@@ -9203,6 +9380,7 @@
|
|
|
9203
9380
|
menuItemId: this.item.id,
|
|
9204
9381
|
requestRender: false
|
|
9205
9382
|
});
|
|
9383
|
+
killCEntity(cEntity);
|
|
9206
9384
|
}
|
|
9207
9385
|
}
|
|
9208
9386
|
this.viewer.scene.requestRender();
|
|
@@ -9397,6 +9575,14 @@
|
|
|
9397
9575
|
});
|
|
9398
9576
|
rItem.item = params.item;
|
|
9399
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
|
+
}
|
|
9400
9586
|
}
|
|
9401
9587
|
else {
|
|
9402
9588
|
rItem = {
|
|
@@ -12298,7 +12484,7 @@
|
|
|
12298
12484
|
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
12299
12485
|
id = curEnabled_1[_i];
|
|
12300
12486
|
if (newItemIds.indexOf(id) === -1 ||
|
|
12301
|
-
id == RELATION_MENU_ITEM_ID) {
|
|
12487
|
+
(id == RELATION_MENU_ITEM_ID && !renderedRelationEntityIds.length)) {
|
|
12302
12488
|
params.manager.RemoveItemById({
|
|
12303
12489
|
menuItemId: id
|
|
12304
12490
|
});
|
|
@@ -12318,7 +12504,7 @@
|
|
|
12318
12504
|
}
|
|
12319
12505
|
_6.label = 4;
|
|
12320
12506
|
case 4:
|
|
12321
|
-
if (!
|
|
12507
|
+
if (!renderedRelationEntityIds.length) return [3 /*break*/, 6];
|
|
12322
12508
|
menuItem = {
|
|
12323
12509
|
id: RELATION_MENU_ITEM_ID,
|
|
12324
12510
|
Caption: "Entity relations",
|
|
@@ -15242,7 +15428,7 @@
|
|
|
15242
15428
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15243
15429
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
15244
15430
|
|
|
15245
|
-
var VERSION$1 = "2.7.
|
|
15431
|
+
var VERSION$1 = "2.7.9";
|
|
15246
15432
|
|
|
15247
15433
|
exports.VERSION = VERSION$1;
|
|
15248
15434
|
exports.CesiumViewMonitor = CesiumViewMonitor;
|