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.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, BatchedDataGetter, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, JulianDate, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1,
|
|
3
|
+
import { Cartographic, JulianDate, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, HeadingPitchRange, Cesium3DTileColorBlendMode, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, Ion, EllipsoidTerrainProvider, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, ColorMaterialProperty, GeometryInstance, BoundingSphere } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -3160,15 +3160,15 @@ var CesiumParabola = /** @class */ (function () {
|
|
|
3160
3160
|
var siblings = [p1Entity, p2Entity];
|
|
3161
3161
|
this.parabola = parabola;
|
|
3162
3162
|
this.siblings = siblings;
|
|
3163
|
+
this.viewer.entities.add(this.parabola);
|
|
3164
|
+
this.viewer.entities.add(p1Entity);
|
|
3165
|
+
this.viewer.entities.add(p2Entity);
|
|
3163
3166
|
};
|
|
3164
3167
|
CesiumParabola.prototype.Animate = function () {
|
|
3165
3168
|
var _this = this;
|
|
3166
3169
|
if (this.disposed) {
|
|
3167
3170
|
return null;
|
|
3168
3171
|
}
|
|
3169
|
-
if (this.parabola && !this.viewer.entities.contains(this.parabola)) {
|
|
3170
|
-
this.viewer.entities.add(this.parabola);
|
|
3171
|
-
}
|
|
3172
3172
|
var retry = false;
|
|
3173
3173
|
if (!this.curPos1 || !this.curPos2 || !Cartes.ValidateCartes3(this.curPos1) || !Cartes.ValidateCartes3(this.curPos2)) {
|
|
3174
3174
|
retry = true;
|
|
@@ -3186,14 +3186,6 @@ var CesiumParabola = /** @class */ (function () {
|
|
|
3186
3186
|
siblings: this.siblings
|
|
3187
3187
|
};
|
|
3188
3188
|
}
|
|
3189
|
-
var cEntities = [
|
|
3190
|
-
this.parabola
|
|
3191
|
-
].concat(this.siblings);
|
|
3192
|
-
cEntities.forEach(function (e) {
|
|
3193
|
-
if (e && !_this.viewer.entities.contains(e)) {
|
|
3194
|
-
_this.viewer.entities.add(e);
|
|
3195
|
-
}
|
|
3196
|
-
});
|
|
3197
3189
|
var RATE_PER_SECOND = 1000 / 40;
|
|
3198
3190
|
var SEC_DURATION = this.duration;
|
|
3199
3191
|
var HEIGHT_DISTANCE_RATIO = this.heightDistanceRatio;
|
|
@@ -3446,6 +3438,67 @@ var CesiumParabola = /** @class */ (function () {
|
|
|
3446
3438
|
function colorToCColor$1(color) {
|
|
3447
3439
|
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
3448
3440
|
}
|
|
3441
|
+
function getStyle$1(api, typeId, styleId) {
|
|
3442
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3443
|
+
var style, e_1, type, e_2, hideError, error, code;
|
|
3444
|
+
return __generator(this, function (_a) {
|
|
3445
|
+
switch (_a.label) {
|
|
3446
|
+
case 0:
|
|
3447
|
+
style = null;
|
|
3448
|
+
if (!styleId) return [3 /*break*/, 4];
|
|
3449
|
+
_a.label = 1;
|
|
3450
|
+
case 1:
|
|
3451
|
+
_a.trys.push([1, 3, , 4]);
|
|
3452
|
+
return [4 /*yield*/, Style.Get({
|
|
3453
|
+
api: api,
|
|
3454
|
+
styleId: styleId
|
|
3455
|
+
})];
|
|
3456
|
+
case 2:
|
|
3457
|
+
style = (_a.sent()).style;
|
|
3458
|
+
return [3 /*break*/, 4];
|
|
3459
|
+
case 3:
|
|
3460
|
+
e_1 = _a.sent();
|
|
3461
|
+
console.error(e_1);
|
|
3462
|
+
return [3 /*break*/, 4];
|
|
3463
|
+
case 4:
|
|
3464
|
+
if (!(!style && typeId)) return [3 /*break*/, 9];
|
|
3465
|
+
return [4 /*yield*/, EntityType.Get({
|
|
3466
|
+
api: api,
|
|
3467
|
+
entityTypeId: typeId
|
|
3468
|
+
})];
|
|
3469
|
+
case 5:
|
|
3470
|
+
type = (_a.sent()).entityType;
|
|
3471
|
+
if (!type["DisplaySetting.ID"]) return [3 /*break*/, 9];
|
|
3472
|
+
_a.label = 6;
|
|
3473
|
+
case 6:
|
|
3474
|
+
_a.trys.push([6, 8, , 9]);
|
|
3475
|
+
return [4 /*yield*/, Style.Get({
|
|
3476
|
+
api: api,
|
|
3477
|
+
styleId: type["DisplaySetting.ID"]
|
|
3478
|
+
})];
|
|
3479
|
+
case 7:
|
|
3480
|
+
style = (_a.sent()).style;
|
|
3481
|
+
return [3 /*break*/, 9];
|
|
3482
|
+
case 8:
|
|
3483
|
+
e_2 = _a.sent();
|
|
3484
|
+
hideError = false;
|
|
3485
|
+
// TODO: we need a util for extracting code + message rather than writing all this every time.
|
|
3486
|
+
if (e_2 && typeof e_2 == "object" && e_2.ERROR) {
|
|
3487
|
+
error = e_2.ERROR;
|
|
3488
|
+
code = error && typeof error == "object" ? error.Code : "";
|
|
3489
|
+
// Avoiding logging a common error.
|
|
3490
|
+
// This happens when rendering entities that don't have records.
|
|
3491
|
+
hideError = String(code).toLowerCase() == "notfound";
|
|
3492
|
+
}
|
|
3493
|
+
if (!hideError) {
|
|
3494
|
+
console.error(e_2);
|
|
3495
|
+
}
|
|
3496
|
+
return [3 /*break*/, 9];
|
|
3497
|
+
case 9: return [2 /*return*/, style];
|
|
3498
|
+
}
|
|
3499
|
+
});
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3449
3502
|
var RelationRenderEngine;
|
|
3450
3503
|
(function (RelationRenderEngine) {
|
|
3451
3504
|
function GetRenderGroupId(relation) {
|
|
@@ -3454,81 +3507,55 @@ var RelationRenderEngine;
|
|
|
3454
3507
|
RelationRenderEngine.GetRenderGroupId = GetRenderGroupId;
|
|
3455
3508
|
function Render(params) {
|
|
3456
3509
|
return __awaiter(this, void 0, void 0, function () {
|
|
3457
|
-
var apiGetter, viewer, visualRegister, menuItemId, relations, api, rendered, i, relation, fromEntity, toEntity, dataEntity, _a, relationType,
|
|
3458
|
-
return __generator(this, function (
|
|
3459
|
-
switch (
|
|
3510
|
+
var apiGetter, viewer, visualRegister, menuItemId, relations, api, rendered, i, relation, fromEntity, toEntity, dataEntity, _a, relationType, style, cEntity, e_3;
|
|
3511
|
+
return __generator(this, function (_b) {
|
|
3512
|
+
switch (_b.label) {
|
|
3460
3513
|
case 0:
|
|
3461
3514
|
apiGetter = params.apiGetter, viewer = params.viewer, visualRegister = params.visualRegister, menuItemId = params.menuItemId, relations = params.relations;
|
|
3462
3515
|
api = apiGetter.getApi(apiGetter.accountId);
|
|
3463
3516
|
rendered = {};
|
|
3464
3517
|
i = 0;
|
|
3465
|
-
|
|
3518
|
+
_b.label = 1;
|
|
3466
3519
|
case 1:
|
|
3467
|
-
if (!(i < relations.length)) return [3 /*break*/,
|
|
3520
|
+
if (!(i < relations.length)) return [3 /*break*/, 13];
|
|
3521
|
+
_b.label = 2;
|
|
3522
|
+
case 2:
|
|
3523
|
+
_b.trys.push([2, 11, , 12]);
|
|
3468
3524
|
relation = relations[i];
|
|
3469
3525
|
return [4 /*yield*/, Entity$1.Get({
|
|
3470
3526
|
api: api,
|
|
3471
3527
|
entityId: relation["Principal.Entity.ID"],
|
|
3472
3528
|
})];
|
|
3473
|
-
case
|
|
3474
|
-
fromEntity = (
|
|
3529
|
+
case 3:
|
|
3530
|
+
fromEntity = (_b.sent()).entity;
|
|
3475
3531
|
return [4 /*yield*/, Entity$1.Get({
|
|
3476
3532
|
api: api,
|
|
3477
3533
|
entityId: relation["Related.Entity.ID"],
|
|
3478
3534
|
})];
|
|
3479
|
-
case
|
|
3480
|
-
toEntity = (
|
|
3481
|
-
if (!relation["Data.Entity.ID"]) return [3 /*break*/,
|
|
3535
|
+
case 4:
|
|
3536
|
+
toEntity = (_b.sent()).entity;
|
|
3537
|
+
if (!relation["Data.Entity.ID"]) return [3 /*break*/, 6];
|
|
3482
3538
|
return [4 /*yield*/, Entity$1.Get({
|
|
3483
3539
|
api: api,
|
|
3484
3540
|
entityId: relation["Data.Entity.ID"]
|
|
3485
3541
|
})];
|
|
3486
|
-
case 4:
|
|
3487
|
-
_a = (_d.sent()).entity;
|
|
3488
|
-
return [3 /*break*/, 6];
|
|
3489
3542
|
case 5:
|
|
3490
|
-
_a =
|
|
3491
|
-
|
|
3543
|
+
_a = (_b.sent()).entity;
|
|
3544
|
+
return [3 /*break*/, 7];
|
|
3492
3545
|
case 6:
|
|
3546
|
+
_a = null;
|
|
3547
|
+
_b.label = 7;
|
|
3548
|
+
case 7:
|
|
3493
3549
|
dataEntity = _a;
|
|
3494
3550
|
return [4 /*yield*/, EntityRelationType.Get({
|
|
3495
3551
|
api: api,
|
|
3496
3552
|
relationTypeId: relation["Relation.Type.ID"]
|
|
3497
3553
|
})];
|
|
3498
|
-
case 7:
|
|
3499
|
-
relationType = (_d.sent()).relationType;
|
|
3500
|
-
styleId = Number(relationType === null || relationType === void 0 ? void 0 : relationType.EntityDisplaySettingID);
|
|
3501
|
-
if (!!styleId) return [3 /*break*/, 11];
|
|
3502
|
-
typeId = relationType === null || relationType === void 0 ? void 0 : relationType["Relation.EntityType.ID"];
|
|
3503
|
-
if (!typeId) return [3 /*break*/, 9];
|
|
3504
|
-
return [4 /*yield*/, EntityType.Get({
|
|
3505
|
-
api: api,
|
|
3506
|
-
entityTypeId: typeId
|
|
3507
|
-
})];
|
|
3508
3554
|
case 8:
|
|
3509
|
-
|
|
3510
|
-
return [
|
|
3555
|
+
relationType = (_b.sent()).relationType;
|
|
3556
|
+
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))];
|
|
3511
3557
|
case 9:
|
|
3512
|
-
|
|
3513
|
-
_d.label = 10;
|
|
3514
|
-
case 10:
|
|
3515
|
-
entityType = _b;
|
|
3516
|
-
styleId = entityType === null || entityType === void 0 ? void 0 : entityType["DisplaySetting.ID"];
|
|
3517
|
-
_d.label = 11;
|
|
3518
|
-
case 11:
|
|
3519
|
-
if (!styleId) return [3 /*break*/, 13];
|
|
3520
|
-
return [4 /*yield*/, Style.Get({
|
|
3521
|
-
api: api,
|
|
3522
|
-
styleId: styleId
|
|
3523
|
-
})];
|
|
3524
|
-
case 12:
|
|
3525
|
-
_c = (_d.sent()).style;
|
|
3526
|
-
return [3 /*break*/, 14];
|
|
3527
|
-
case 13:
|
|
3528
|
-
_c = null;
|
|
3529
|
-
_d.label = 14;
|
|
3530
|
-
case 14:
|
|
3531
|
-
style = _c;
|
|
3558
|
+
style = _b.sent();
|
|
3532
3559
|
return [4 /*yield*/, Parabola.Render({
|
|
3533
3560
|
dataEntity: dataEntity,
|
|
3534
3561
|
fromEntity: fromEntity,
|
|
@@ -3539,15 +3566,19 @@ var RelationRenderEngine;
|
|
|
3539
3566
|
visualRegister: visualRegister,
|
|
3540
3567
|
apiGetter: apiGetter
|
|
3541
3568
|
})];
|
|
3542
|
-
case
|
|
3543
|
-
cEntity =
|
|
3569
|
+
case 10:
|
|
3570
|
+
cEntity = _b.sent();
|
|
3544
3571
|
cEntity._renderGroup = GetRenderGroupId(relation);
|
|
3545
3572
|
rendered[GetRenderGroupId(relation)] = cEntity;
|
|
3546
|
-
|
|
3547
|
-
case
|
|
3573
|
+
return [3 /*break*/, 12];
|
|
3574
|
+
case 11:
|
|
3575
|
+
e_3 = _b.sent();
|
|
3576
|
+
console.error(e_3);
|
|
3577
|
+
return [3 /*break*/, 12];
|
|
3578
|
+
case 12:
|
|
3548
3579
|
i++;
|
|
3549
3580
|
return [3 /*break*/, 1];
|
|
3550
|
-
case
|
|
3581
|
+
case 13: return [2 /*return*/, rendered];
|
|
3551
3582
|
}
|
|
3552
3583
|
});
|
|
3553
3584
|
});
|
|
@@ -3575,7 +3606,7 @@ var RelationRenderEngine;
|
|
|
3575
3606
|
toPos = null;
|
|
3576
3607
|
updatingPosses = false;
|
|
3577
3608
|
updatePosses = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3578
|
-
var
|
|
3609
|
+
var e_4;
|
|
3579
3610
|
return __generator(this, function (_a) {
|
|
3580
3611
|
switch (_a.label) {
|
|
3581
3612
|
case 0:
|
|
@@ -3612,8 +3643,8 @@ var RelationRenderEngine;
|
|
|
3612
3643
|
toPos = _a.sent();
|
|
3613
3644
|
return [3 /*break*/, 5];
|
|
3614
3645
|
case 4:
|
|
3615
|
-
|
|
3616
|
-
console.error(
|
|
3646
|
+
e_4 = _a.sent();
|
|
3647
|
+
console.error(e_4);
|
|
3617
3648
|
return [3 /*break*/, 5];
|
|
3618
3649
|
case 5:
|
|
3619
3650
|
updatingPosses = false;
|
|
@@ -6931,7 +6962,9 @@ var TilesetRenderEngine;
|
|
|
6931
6962
|
etc = settings.etc;
|
|
6932
6963
|
etc = __assign({}, etc);
|
|
6933
6964
|
if (!ionId) return [3 /*break*/, 2];
|
|
6934
|
-
return [4 /*yield*/, IonResource.fromAssetId(EnsureNumber(ionId)
|
|
6965
|
+
return [4 /*yield*/, IonResource.fromAssetId(EnsureNumber(ionId), {
|
|
6966
|
+
accessToken: params.ionAccessToken ? params.ionAccessToken : Ion.defaultAccessToken
|
|
6967
|
+
})];
|
|
6935
6968
|
case 1:
|
|
6936
6969
|
loadUrl = (_a.sent());
|
|
6937
6970
|
return [3 /*break*/, 3];
|
|
@@ -8284,135 +8317,129 @@ var TilesetEntitiesRenderManager;
|
|
|
8284
8317
|
configurable: true
|
|
8285
8318
|
});
|
|
8286
8319
|
Manager.prototype.Init = function (params) {
|
|
8320
|
+
var _this = this;
|
|
8287
8321
|
var _a;
|
|
8288
|
-
|
|
8289
|
-
|
|
8322
|
+
this.initCounter += 1;
|
|
8323
|
+
var counter = this.initCounter;
|
|
8324
|
+
if (this.disposed) {
|
|
8325
|
+
return;
|
|
8326
|
+
}
|
|
8327
|
+
if (params === null || params === void 0 ? void 0 : params.item) {
|
|
8328
|
+
this.item = params.item;
|
|
8329
|
+
}
|
|
8330
|
+
var tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
|
|
8331
|
+
if (!tilesetId) {
|
|
8332
|
+
return;
|
|
8333
|
+
}
|
|
8334
|
+
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8335
|
+
var canAccess, e_1, accountId, api, tileset, cTileset, _a, attenuation, attenuationMax;
|
|
8290
8336
|
var _this = this;
|
|
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
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
tileset: tileset,
|
|
8364
|
-
viewer: this.viewer,
|
|
8365
|
-
accountId: accountId,
|
|
8366
|
-
viaCdn: this.item.cdnEnabled
|
|
8367
|
-
})];
|
|
8368
|
-
case 8:
|
|
8369
|
-
cTileset = _a.cTileset = _e.sent();
|
|
8370
|
-
if (this.disposed) {
|
|
8371
|
-
this.doDispose();
|
|
8372
|
-
return [2 /*return*/];
|
|
8373
|
-
}
|
|
8374
|
-
this.viewer.scene.requestRender();
|
|
8375
|
-
cTileset.readyPromise.then(function () {
|
|
8376
|
-
try {
|
|
8377
|
-
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
8378
|
-
return;
|
|
8379
|
-
}
|
|
8380
|
-
_this.onCTilesetLoad();
|
|
8381
|
-
_this.viewer.scene.requestRender();
|
|
8382
|
-
}
|
|
8383
|
-
catch (e) {
|
|
8384
|
-
console.error(e);
|
|
8385
|
-
}
|
|
8386
|
-
});
|
|
8387
|
-
cTileset.tileLoad.addEventListener(function (tile) {
|
|
8388
|
-
_this.mapCTile(tile);
|
|
8389
|
-
});
|
|
8390
|
-
_e.label = 9;
|
|
8391
|
-
case 9:
|
|
8392
|
-
attenuation = this.item.attenuation;
|
|
8393
|
-
if (!attenuation && attenuation != false) {
|
|
8394
|
-
attenuation = true;
|
|
8395
|
-
}
|
|
8396
|
-
attenuationMax = this.item.attenuationMax;
|
|
8397
|
-
if (isNaN(attenuationMax)) {
|
|
8398
|
-
attenuationMax = 20;
|
|
8337
|
+
var _b, _c, _d;
|
|
8338
|
+
return __generator(this, function (_e) {
|
|
8339
|
+
switch (_e.label) {
|
|
8340
|
+
case 0:
|
|
8341
|
+
if (!!this.cTileset) return [3 /*break*/, 9];
|
|
8342
|
+
if (!tilesetId) return [3 /*break*/, 5];
|
|
8343
|
+
canAccess = false;
|
|
8344
|
+
_e.label = 1;
|
|
8345
|
+
case 1:
|
|
8346
|
+
_e.trys.push([1, 3, , 4]);
|
|
8347
|
+
return [4 /*yield*/, Tileset.Publish.IsAccessAllowed({
|
|
8348
|
+
sourceAccountId: (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID,
|
|
8349
|
+
tilesetId: tilesetId,
|
|
8350
|
+
forAccountId: this.getters.GetAccountId(),
|
|
8351
|
+
api: this.getters.GetGlobalApi()
|
|
8352
|
+
})];
|
|
8353
|
+
case 2:
|
|
8354
|
+
canAccess = _e.sent();
|
|
8355
|
+
return [3 /*break*/, 4];
|
|
8356
|
+
case 3:
|
|
8357
|
+
e_1 = _e.sent();
|
|
8358
|
+
console.error(e_1);
|
|
8359
|
+
return [3 /*break*/, 4];
|
|
8360
|
+
case 4:
|
|
8361
|
+
if (!canAccess) {
|
|
8362
|
+
console.warn("Cannot access tileset: ".concat(tilesetId, ", from account: ").concat((_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.ClientAccountID, "."));
|
|
8363
|
+
return [2 /*return*/];
|
|
8364
|
+
}
|
|
8365
|
+
return [3 /*break*/, 6];
|
|
8366
|
+
case 5:
|
|
8367
|
+
console.warn("No tileset id found. Skipping access check.");
|
|
8368
|
+
_e.label = 6;
|
|
8369
|
+
case 6:
|
|
8370
|
+
if (this.disposed || counter !== this.initCounter) {
|
|
8371
|
+
return [2 /*return*/];
|
|
8372
|
+
}
|
|
8373
|
+
accountId = (_d = this.item.tileset) === null || _d === void 0 ? void 0 : _d.ClientAccountID;
|
|
8374
|
+
if (!accountId) {
|
|
8375
|
+
accountId = this.getters.GetAccountId();
|
|
8376
|
+
}
|
|
8377
|
+
api = this.getters.GetBruceApi({
|
|
8378
|
+
accountId: accountId
|
|
8379
|
+
});
|
|
8380
|
+
return [4 /*yield*/, Tileset.Get({
|
|
8381
|
+
api: api,
|
|
8382
|
+
tilesetId: tilesetId
|
|
8383
|
+
})];
|
|
8384
|
+
case 7:
|
|
8385
|
+
tileset = (_e.sent()).tileset;
|
|
8386
|
+
if (!tileset || this.disposed || counter !== this.initCounter) {
|
|
8387
|
+
return [2 /*return*/];
|
|
8388
|
+
}
|
|
8389
|
+
this.typeId = tileset.settings.entityTypeId;
|
|
8390
|
+
_a = this;
|
|
8391
|
+
return [4 /*yield*/, TilesetRenderEngine.Render({
|
|
8392
|
+
apiGetter: this.getters.GetBruceGetter(),
|
|
8393
|
+
tileset: tileset,
|
|
8394
|
+
viewer: this.viewer,
|
|
8395
|
+
accountId: accountId,
|
|
8396
|
+
viaCdn: this.item.cdnEnabled
|
|
8397
|
+
})];
|
|
8398
|
+
case 8:
|
|
8399
|
+
cTileset = _a.cTileset = _e.sent();
|
|
8400
|
+
if (this.disposed) {
|
|
8401
|
+
this.doDispose();
|
|
8402
|
+
return [2 /*return*/];
|
|
8403
|
+
}
|
|
8404
|
+
this.viewer.scene.requestRender();
|
|
8405
|
+
cTileset.readyPromise.then(function () {
|
|
8406
|
+
try {
|
|
8407
|
+
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
8408
|
+
return;
|
|
8399
8409
|
}
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
+
_this.onCTilesetLoad();
|
|
8411
|
+
_this.viewer.scene.requestRender();
|
|
8412
|
+
}
|
|
8413
|
+
catch (e) {
|
|
8414
|
+
console.error(e);
|
|
8415
|
+
}
|
|
8416
|
+
});
|
|
8417
|
+
cTileset.tileLoad.addEventListener(function (tile) {
|
|
8418
|
+
_this.mapCTile(tile);
|
|
8419
|
+
});
|
|
8420
|
+
_e.label = 9;
|
|
8421
|
+
case 9:
|
|
8422
|
+
attenuation = this.item.attenuation;
|
|
8423
|
+
if (!attenuation && attenuation != false) {
|
|
8424
|
+
attenuation = true;
|
|
8410
8425
|
}
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8426
|
+
attenuationMax = this.item.attenuationMax;
|
|
8427
|
+
if (isNaN(attenuationMax)) {
|
|
8428
|
+
attenuationMax = 20;
|
|
8429
|
+
}
|
|
8430
|
+
this.cTileset.readyPromise.then(function () {
|
|
8431
|
+
TilesetRenderEngine.ApplySettings({
|
|
8432
|
+
cTileset: _this.cTileset,
|
|
8433
|
+
settings: {
|
|
8434
|
+
attenuation: attenuation,
|
|
8435
|
+
maximumAttenuation: attenuationMax
|
|
8436
|
+
}
|
|
8437
|
+
});
|
|
8438
|
+
});
|
|
8439
|
+
return [2 /*return*/];
|
|
8440
|
+
}
|
|
8414
8441
|
});
|
|
8415
|
-
});
|
|
8442
|
+
}); })();
|
|
8416
8443
|
};
|
|
8417
8444
|
Manager.prototype.Dispose = function () {
|
|
8418
8445
|
if (this.disposed) {
|
|
@@ -8847,15 +8874,15 @@ var TilesetArbRenderManager;
|
|
|
8847
8874
|
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8848
8875
|
var canAccess, e_3, _a, tileset, type, _b, LEGACY_TYPES, legacyTileset, _c, accountId, _d, _e;
|
|
8849
8876
|
var _this = this;
|
|
8850
|
-
var _f, _g, _h, _j, _k, _l, _m;
|
|
8851
|
-
return __generator(this, function (
|
|
8852
|
-
switch (
|
|
8877
|
+
var _f, _g, _h, _j, _k, _l, _m, _o;
|
|
8878
|
+
return __generator(this, function (_p) {
|
|
8879
|
+
switch (_p.label) {
|
|
8853
8880
|
case 0:
|
|
8854
8881
|
if (!tilesetId) return [3 /*break*/, 5];
|
|
8855
8882
|
canAccess = false;
|
|
8856
|
-
|
|
8883
|
+
_p.label = 1;
|
|
8857
8884
|
case 1:
|
|
8858
|
-
|
|
8885
|
+
_p.trys.push([1, 3, , 4]);
|
|
8859
8886
|
return [4 /*yield*/, Tileset.Publish.IsAccessAllowed({
|
|
8860
8887
|
sourceAccountId: (_f = this.item.tileset) === null || _f === void 0 ? void 0 : _f.ClientAccountID,
|
|
8861
8888
|
tilesetId: tilesetId,
|
|
@@ -8863,10 +8890,10 @@ var TilesetArbRenderManager;
|
|
|
8863
8890
|
api: this.getters.GetGlobalApi()
|
|
8864
8891
|
})];
|
|
8865
8892
|
case 2:
|
|
8866
|
-
canAccess =
|
|
8893
|
+
canAccess = _p.sent();
|
|
8867
8894
|
return [3 /*break*/, 4];
|
|
8868
8895
|
case 3:
|
|
8869
|
-
e_3 =
|
|
8896
|
+
e_3 = _p.sent();
|
|
8870
8897
|
console.error(e_3);
|
|
8871
8898
|
return [3 /*break*/, 4];
|
|
8872
8899
|
case 4:
|
|
@@ -8877,7 +8904,7 @@ var TilesetArbRenderManager;
|
|
|
8877
8904
|
return [3 /*break*/, 6];
|
|
8878
8905
|
case 5:
|
|
8879
8906
|
console.warn("No tileset id found. Skipping access check.");
|
|
8880
|
-
|
|
8907
|
+
_p.label = 6;
|
|
8881
8908
|
case 6:
|
|
8882
8909
|
if (!tilesetId) return [3 /*break*/, 8];
|
|
8883
8910
|
return [4 /*yield*/, getTileset({
|
|
@@ -8885,11 +8912,11 @@ var TilesetArbRenderManager;
|
|
|
8885
8912
|
menuItem: this.item
|
|
8886
8913
|
})];
|
|
8887
8914
|
case 7:
|
|
8888
|
-
_b =
|
|
8915
|
+
_b = _p.sent();
|
|
8889
8916
|
return [3 /*break*/, 9];
|
|
8890
8917
|
case 8:
|
|
8891
8918
|
_b = { tileset: null, type: null };
|
|
8892
|
-
|
|
8919
|
+
_p.label = 9;
|
|
8893
8920
|
case 9:
|
|
8894
8921
|
_a = _b, tileset = _a.tileset, type = _a.type;
|
|
8895
8922
|
if (this.disposed) {
|
|
@@ -8912,11 +8939,11 @@ var TilesetArbRenderManager;
|
|
|
8912
8939
|
tileset: tileset
|
|
8913
8940
|
})];
|
|
8914
8941
|
case 10:
|
|
8915
|
-
_c =
|
|
8942
|
+
_c = _p.sent();
|
|
8916
8943
|
return [3 /*break*/, 12];
|
|
8917
8944
|
case 11:
|
|
8918
8945
|
_c = null;
|
|
8919
|
-
|
|
8946
|
+
_p.label = 12;
|
|
8920
8947
|
case 12:
|
|
8921
8948
|
legacyTileset = _c;
|
|
8922
8949
|
if (this.disposed) {
|
|
@@ -8932,12 +8959,13 @@ var TilesetArbRenderManager;
|
|
|
8932
8959
|
tileset: legacyTileset,
|
|
8933
8960
|
viewer: this.viewer,
|
|
8934
8961
|
ionId: (_k = this.item.IonResource) === null || _k === void 0 ? void 0 : _k.AssetID,
|
|
8962
|
+
ionAccessToken: (_l = this.item.IonResource) === null || _l === void 0 ? void 0 : _l.AccessToken,
|
|
8935
8963
|
loadUrl: loadUrlOverride,
|
|
8936
8964
|
accountId: accountId,
|
|
8937
8965
|
viaCdn: true
|
|
8938
8966
|
})];
|
|
8939
8967
|
case 13:
|
|
8940
|
-
_d.cTileset =
|
|
8968
|
+
_d.cTileset = _p.sent();
|
|
8941
8969
|
return [3 /*break*/, 16];
|
|
8942
8970
|
case 14:
|
|
8943
8971
|
if (!tileset) return [3 /*break*/, 16];
|
|
@@ -8947,13 +8975,13 @@ var TilesetArbRenderManager;
|
|
|
8947
8975
|
tileset: tileset,
|
|
8948
8976
|
viewer: this.viewer,
|
|
8949
8977
|
coords: null,
|
|
8950
|
-
accountId: (
|
|
8978
|
+
accountId: (_o = (_m = this.item.tileset) === null || _m === void 0 ? void 0 : _m.ClientAccountID) !== null && _o !== void 0 ? _o : this.getters.GetAccountId(),
|
|
8951
8979
|
// Not doing viaCDN here because I fear it'll break something since this is a legacy menu item type.
|
|
8952
8980
|
viaCdn: false
|
|
8953
8981
|
})];
|
|
8954
8982
|
case 15:
|
|
8955
|
-
_e.cTileset =
|
|
8956
|
-
|
|
8983
|
+
_e.cTileset = _p.sent();
|
|
8984
|
+
_p.label = 16;
|
|
8957
8985
|
case 16:
|
|
8958
8986
|
if (this.disposed) {
|
|
8959
8987
|
this.doDispose();
|
|
@@ -9102,6 +9130,8 @@ var RelationsRenderManager;
|
|
|
9102
9130
|
(function (RelationsRenderManager) {
|
|
9103
9131
|
var Manager = /** @class */ (function () {
|
|
9104
9132
|
function Manager(params) {
|
|
9133
|
+
// If true, this menu item is disposed and should not be used.
|
|
9134
|
+
// Any rendering will be ignored.
|
|
9105
9135
|
this.disposed = false;
|
|
9106
9136
|
var apiGetter = params.apiGetter, item = params.item, register = params.register, viewer = params.viewer;
|
|
9107
9137
|
this.apiGetter = apiGetter;
|
|
@@ -9116,56 +9146,62 @@ var RelationsRenderManager;
|
|
|
9116
9146
|
enumerable: false,
|
|
9117
9147
|
configurable: true
|
|
9118
9148
|
});
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
var
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9149
|
+
/**
|
|
9150
|
+
* Starts rendering the menu item.
|
|
9151
|
+
* Re-call with an updated menu item to re-render. It will auto-cleanup old relations.
|
|
9152
|
+
* @param params
|
|
9153
|
+
* @returns
|
|
9154
|
+
*/
|
|
9155
|
+
Manager.prototype.Init = function (params) {
|
|
9156
|
+
var _a;
|
|
9157
|
+
if (this.disposed) {
|
|
9158
|
+
return;
|
|
9159
|
+
}
|
|
9160
|
+
if (params === null || params === void 0 ? void 0 : params.item) {
|
|
9161
|
+
this.item = params.item;
|
|
9162
|
+
}
|
|
9163
|
+
// Remove relationships we no longer want to render.
|
|
9164
|
+
// We'll have to get regos by the menu item ID then run a check on the related rego relationship.
|
|
9165
|
+
var regos = this.register.GetRegos({
|
|
9166
|
+
menuItemId: this.item.id
|
|
9167
|
+
});
|
|
9168
|
+
var drawnIds = [];
|
|
9169
|
+
var toDrawIds = [];
|
|
9170
|
+
var entityIds = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.EntityIds;
|
|
9171
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
9172
|
+
entityIds = [];
|
|
9173
|
+
}
|
|
9174
|
+
for (var i = 0; i < regos.length; i++) {
|
|
9175
|
+
var rego = regos[i];
|
|
9176
|
+
if (!this.shouldRenderRelation(rego.relation)) {
|
|
9177
|
+
this.register.RemoveRegos({
|
|
9178
|
+
relation: rego.relation,
|
|
9179
|
+
entityId: rego.entityId,
|
|
9180
|
+
menuItemId: this.item.id,
|
|
9181
|
+
requestRender: false
|
|
9182
|
+
});
|
|
9183
|
+
}
|
|
9184
|
+
else {
|
|
9185
|
+
drawnIds.push(rego.entityId);
|
|
9186
|
+
if (rego.relation) {
|
|
9187
|
+
drawnIds.push(rego.relation["Principal.Entity.ID"]);
|
|
9188
|
+
drawnIds.push(rego.relation["Related.Entity.ID"]);
|
|
9131
9189
|
}
|
|
9132
9190
|
}
|
|
9191
|
+
}
|
|
9192
|
+
this.viewer.scene.requestRender();
|
|
9193
|
+
var _loop_1 = function (i) {
|
|
9194
|
+
if (!drawnIds.find(function (x) { return x == entityIds[i]; })) {
|
|
9195
|
+
toDrawIds.push(entityIds[i]);
|
|
9196
|
+
}
|
|
9133
9197
|
};
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
api: api,
|
|
9138
|
-
entityId: entityId,
|
|
9139
|
-
filter: {
|
|
9140
|
-
oneWayOnly: false,
|
|
9141
|
-
loadEntityData: false
|
|
9142
|
-
}
|
|
9143
|
-
}).then(function (data) {
|
|
9144
|
-
var _a;
|
|
9145
|
-
var relations = data.relations;
|
|
9146
|
-
var _loop_1 = function (j) {
|
|
9147
|
-
var relation = relations[j];
|
|
9148
|
-
if (((_a = _this.item.relationTypeIds) === null || _a === void 0 ? void 0 : _a.length) && !_this.item.relationTypeIds.includes(relation["Relation.Type.ID"])) {
|
|
9149
|
-
return "continue";
|
|
9150
|
-
}
|
|
9151
|
-
var key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9152
|
-
if (!drawn.find(function (x) { return x == key; })) {
|
|
9153
|
-
drawn.push(key);
|
|
9154
|
-
drawBatch.push(relation);
|
|
9155
|
-
if (drawBatch.length >= BATCH_SIZE) {
|
|
9156
|
-
_this.onGetterUpdate(drawBatch);
|
|
9157
|
-
drawBatch = [];
|
|
9158
|
-
}
|
|
9159
|
-
}
|
|
9160
|
-
};
|
|
9161
|
-
for (var j = 0; j < relations.length; j++) {
|
|
9162
|
-
_loop_1(j);
|
|
9163
|
-
}
|
|
9164
|
-
onResolve();
|
|
9165
|
-
}).catch(function (e) {
|
|
9166
|
-
onResolve();
|
|
9167
|
-
});
|
|
9198
|
+
// We'll call a re-render on entity ids that are not drawn.
|
|
9199
|
+
for (var i = 0; i < entityIds.length; i++) {
|
|
9200
|
+
_loop_1(i);
|
|
9168
9201
|
}
|
|
9202
|
+
this.renderEntityIds({
|
|
9203
|
+
entityIds: toDrawIds
|
|
9204
|
+
});
|
|
9169
9205
|
};
|
|
9170
9206
|
Manager.prototype.Dispose = function () {
|
|
9171
9207
|
if (this.disposed) {
|
|
@@ -9176,19 +9212,154 @@ var RelationsRenderManager;
|
|
|
9176
9212
|
menuItemId: this.item.id
|
|
9177
9213
|
});
|
|
9178
9214
|
};
|
|
9215
|
+
/**
|
|
9216
|
+
* Re-renders specific entity relationships.
|
|
9217
|
+
* @TODO: This should re-render all relationships when entityIds=null.
|
|
9218
|
+
* @param params
|
|
9219
|
+
*/
|
|
9179
9220
|
Manager.prototype.ReRender = function (params) {
|
|
9180
9221
|
return __awaiter(this, void 0, void 0, function () {
|
|
9181
9222
|
var entityIds, force;
|
|
9182
9223
|
return __generator(this, function (_a) {
|
|
9183
9224
|
entityIds = params.entityIds, force = params.force;
|
|
9225
|
+
if (entityIds == null) ;
|
|
9226
|
+
else {
|
|
9227
|
+
this.renderEntityIds({
|
|
9228
|
+
dataEntityIds: entityIds
|
|
9229
|
+
});
|
|
9230
|
+
}
|
|
9184
9231
|
return [2 /*return*/];
|
|
9185
9232
|
});
|
|
9186
9233
|
});
|
|
9187
9234
|
};
|
|
9235
|
+
/**
|
|
9236
|
+
* Gets relationship records corresponding to provided IDs and requests a render for them.
|
|
9237
|
+
*/
|
|
9238
|
+
Manager.prototype.renderEntityIds = function (params) {
|
|
9239
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9240
|
+
var entityIds, dataEntityIds, drawn, api, BATCH_SIZE, drawBatch, pending, onResolve, i, entityId, i, entityId;
|
|
9241
|
+
var _this = this;
|
|
9242
|
+
return __generator(this, function (_a) {
|
|
9243
|
+
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9244
|
+
return [2 /*return*/];
|
|
9245
|
+
}
|
|
9246
|
+
entityIds = params.entityIds, dataEntityIds = params.dataEntityIds;
|
|
9247
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
9248
|
+
entityIds = [];
|
|
9249
|
+
}
|
|
9250
|
+
if (!(dataEntityIds === null || dataEntityIds === void 0 ? void 0 : dataEntityIds.length)) {
|
|
9251
|
+
dataEntityIds = [];
|
|
9252
|
+
}
|
|
9253
|
+
drawn = [];
|
|
9254
|
+
api = this.apiGetter.getApi(this.apiGetter.accountId);
|
|
9255
|
+
BATCH_SIZE = 5;
|
|
9256
|
+
drawBatch = [];
|
|
9257
|
+
pending = entityIds.length + dataEntityIds.length;
|
|
9258
|
+
onResolve = function () {
|
|
9259
|
+
if (_this.disposed || _this.viewer.isDestroyed()) {
|
|
9260
|
+
return;
|
|
9261
|
+
}
|
|
9262
|
+
pending -= 1;
|
|
9263
|
+
if (pending <= 0) {
|
|
9264
|
+
if (drawBatch === null || drawBatch === void 0 ? void 0 : drawBatch.length) {
|
|
9265
|
+
_this.onGetterUpdate(drawBatch);
|
|
9266
|
+
}
|
|
9267
|
+
}
|
|
9268
|
+
};
|
|
9269
|
+
// Get relationships by their data entity ID.
|
|
9270
|
+
for (i = 0; i < dataEntityIds.length; i++) {
|
|
9271
|
+
entityId = dataEntityIds[i];
|
|
9272
|
+
EntityRelation.GetByDataEntityId({
|
|
9273
|
+
entityId: entityId,
|
|
9274
|
+
api: api
|
|
9275
|
+
}).then(function (data) {
|
|
9276
|
+
if (data.relation) {
|
|
9277
|
+
var relation = data.relation;
|
|
9278
|
+
var key_1 = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9279
|
+
if (!drawn.find(function (x) { return x == key_1; })) {
|
|
9280
|
+
drawn.push(key_1);
|
|
9281
|
+
drawBatch.push(relation);
|
|
9282
|
+
if (drawBatch.length >= BATCH_SIZE) {
|
|
9283
|
+
_this.onGetterUpdate(drawBatch);
|
|
9284
|
+
drawBatch = [];
|
|
9285
|
+
}
|
|
9286
|
+
}
|
|
9287
|
+
}
|
|
9288
|
+
onResolve();
|
|
9289
|
+
}).catch(function (e) {
|
|
9290
|
+
onResolve();
|
|
9291
|
+
});
|
|
9292
|
+
}
|
|
9293
|
+
// Get relationships by either the parent or child ID.
|
|
9294
|
+
for (i = 0; i < entityIds.length; i++) {
|
|
9295
|
+
entityId = entityIds[i];
|
|
9296
|
+
EntityRelation.GetList({
|
|
9297
|
+
api: api,
|
|
9298
|
+
entityId: entityId,
|
|
9299
|
+
filter: {
|
|
9300
|
+
oneWayOnly: false,
|
|
9301
|
+
loadEntityData: false
|
|
9302
|
+
}
|
|
9303
|
+
}).then(function (data) {
|
|
9304
|
+
var relations = data.relations;
|
|
9305
|
+
var _loop_2 = function (j) {
|
|
9306
|
+
var relation = relations[j];
|
|
9307
|
+
var key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9308
|
+
if (!drawn.find(function (x) { return x == key; })) {
|
|
9309
|
+
drawn.push(key);
|
|
9310
|
+
drawBatch.push(relation);
|
|
9311
|
+
if (drawBatch.length >= BATCH_SIZE) {
|
|
9312
|
+
_this.onGetterUpdate(drawBatch);
|
|
9313
|
+
drawBatch = [];
|
|
9314
|
+
}
|
|
9315
|
+
}
|
|
9316
|
+
};
|
|
9317
|
+
for (var j = 0; j < relations.length; j++) {
|
|
9318
|
+
_loop_2(j);
|
|
9319
|
+
}
|
|
9320
|
+
onResolve();
|
|
9321
|
+
}).catch(function (e) {
|
|
9322
|
+
onResolve();
|
|
9323
|
+
});
|
|
9324
|
+
}
|
|
9325
|
+
return [2 /*return*/];
|
|
9326
|
+
});
|
|
9327
|
+
});
|
|
9328
|
+
};
|
|
9329
|
+
/**
|
|
9330
|
+
* Returns if a relation should be rendered.
|
|
9331
|
+
* This is in case the menu item was updated and the relation is no longer relevant.
|
|
9332
|
+
* @param relation
|
|
9333
|
+
*/
|
|
9334
|
+
Manager.prototype.shouldRenderRelation = function (relation) {
|
|
9335
|
+
var _a, _b, _c;
|
|
9336
|
+
if (((_a = this.item.relationTypeIds) === null || _a === void 0 ? void 0 : _a.length) && !this.item.relationTypeIds.includes(relation["Relation.Type.ID"])) {
|
|
9337
|
+
return false;
|
|
9338
|
+
}
|
|
9339
|
+
var renderedIds = (_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.BruceEntity) === null || _c === void 0 ? void 0 : _c.EntityIds;
|
|
9340
|
+
if (!renderedIds) {
|
|
9341
|
+
return false;
|
|
9342
|
+
}
|
|
9343
|
+
var ids = [
|
|
9344
|
+
relation["Principal.Entity.ID"],
|
|
9345
|
+
relation["Related.Entity.ID"]
|
|
9346
|
+
];
|
|
9347
|
+
if (relation["Data.Entity.ID"]) {
|
|
9348
|
+
ids.push(relation["Data.Entity.ID"]);
|
|
9349
|
+
}
|
|
9350
|
+
return ids.some(function (x) { return renderedIds.includes(x); });
|
|
9351
|
+
};
|
|
9352
|
+
/**
|
|
9353
|
+
* Renders batch of entity relationships.
|
|
9354
|
+
* This will check if a relationship SHOULD be rendered before rendering it.
|
|
9355
|
+
* It will also handle already rendered relations to avoid re-rendering them.
|
|
9356
|
+
* @param relations
|
|
9357
|
+
*/
|
|
9188
9358
|
Manager.prototype.onGetterUpdate = function (relations) {
|
|
9189
9359
|
var _a, _b;
|
|
9190
9360
|
return __awaiter(this, void 0, void 0, function () {
|
|
9191
|
-
var cEntities, i, relation, key, cEntity, visual, e_1;
|
|
9361
|
+
var killCEntity, cEntities, key, i, relation, key, cEntity, visual, e_1;
|
|
9362
|
+
var _this = this;
|
|
9192
9363
|
return __generator(this, function (_c) {
|
|
9193
9364
|
switch (_c.label) {
|
|
9194
9365
|
case 0:
|
|
@@ -9196,6 +9367,12 @@ var RelationsRenderManager;
|
|
|
9196
9367
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9197
9368
|
return [2 /*return*/];
|
|
9198
9369
|
}
|
|
9370
|
+
relations = relations.filter(function (x) { return _this.shouldRenderRelation(x); });
|
|
9371
|
+
killCEntity = function (cEntity) {
|
|
9372
|
+
if (cEntity && !_this.viewer.isDestroyed() && _this.viewer.entities.contains(cEntity)) {
|
|
9373
|
+
_this.viewer.entities.remove(cEntity);
|
|
9374
|
+
}
|
|
9375
|
+
};
|
|
9199
9376
|
return [4 /*yield*/, RelationRenderEngine.Render({
|
|
9200
9377
|
apiGetter: this.apiGetter,
|
|
9201
9378
|
menuItemId: this.item.id,
|
|
@@ -9209,13 +9386,16 @@ var RelationsRenderManager;
|
|
|
9209
9386
|
this.register.RemoveRegos({
|
|
9210
9387
|
menuItemId: this.item.id
|
|
9211
9388
|
});
|
|
9389
|
+
for (key in cEntities) {
|
|
9390
|
+
killCEntity(cEntities[key]);
|
|
9391
|
+
}
|
|
9212
9392
|
return [2 /*return*/];
|
|
9213
9393
|
}
|
|
9214
9394
|
for (i = 0; i < relations.length; i++) {
|
|
9215
9395
|
relation = relations[i];
|
|
9216
9396
|
key = RelationRenderEngine.GetRenderGroupId(relation);
|
|
9217
9397
|
cEntity = cEntities[key];
|
|
9218
|
-
if (cEntity) {
|
|
9398
|
+
if (cEntity && this.shouldRenderRelation(relation)) {
|
|
9219
9399
|
visual = (_a = this.register.GetRego({
|
|
9220
9400
|
entityId: key,
|
|
9221
9401
|
menuItemId: this.item.id
|
|
@@ -9241,6 +9421,7 @@ var RelationsRenderManager;
|
|
|
9241
9421
|
menuItemId: this.item.id,
|
|
9242
9422
|
requestRender: false
|
|
9243
9423
|
});
|
|
9424
|
+
killCEntity(cEntity);
|
|
9244
9425
|
}
|
|
9245
9426
|
}
|
|
9246
9427
|
this.viewer.scene.requestRender();
|
|
@@ -9440,6 +9621,14 @@ var MenuItemManager;
|
|
|
9440
9621
|
});
|
|
9441
9622
|
rItem.item = params.item;
|
|
9442
9623
|
}
|
|
9624
|
+
// This means we're updating a rendered relationships menu item.
|
|
9625
|
+
// Eg: different entities need to be rendered, or one of the relationship data entities changed.
|
|
9626
|
+
else if (rItem.type == MenuItem.EType.Relations && params.item.Type == MenuItem.EType.Relations) {
|
|
9627
|
+
rItem.renderManager.Init({
|
|
9628
|
+
item: params.item,
|
|
9629
|
+
});
|
|
9630
|
+
rItem.item = params.item;
|
|
9631
|
+
}
|
|
9443
9632
|
}
|
|
9444
9633
|
else {
|
|
9445
9634
|
rItem = {
|
|
@@ -12347,7 +12536,7 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12347
12536
|
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
12348
12537
|
id = curEnabled_1[_i];
|
|
12349
12538
|
if (newItemIds.indexOf(id) === -1 ||
|
|
12350
|
-
id == RELATION_MENU_ITEM_ID) {
|
|
12539
|
+
(id == RELATION_MENU_ITEM_ID && !renderedRelationEntityIds.length)) {
|
|
12351
12540
|
params.manager.RemoveItemById({
|
|
12352
12541
|
menuItemId: id
|
|
12353
12542
|
});
|
|
@@ -12367,7 +12556,7 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12367
12556
|
}
|
|
12368
12557
|
_6.label = 4;
|
|
12369
12558
|
case 4:
|
|
12370
|
-
if (!
|
|
12559
|
+
if (!renderedRelationEntityIds.length) return [3 /*break*/, 6];
|
|
12371
12560
|
menuItem = {
|
|
12372
12561
|
id: RELATION_MENU_ITEM_ID,
|
|
12373
12562
|
Caption: "Entity relations",
|
|
@@ -15293,7 +15482,7 @@ var ViewerUtils;
|
|
|
15293
15482
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15294
15483
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
15295
15484
|
|
|
15296
|
-
var VERSION$1 = "2.7.
|
|
15485
|
+
var VERSION$1 = "2.7.9";
|
|
15297
15486
|
|
|
15298
15487
|
export { VERSION$1 as VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
|
|
15299
15488
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|