bruce-cesium 3.4.1 → 3.4.2

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.
@@ -8146,6 +8146,10 @@
8146
8146
  }
8147
8147
  ];
8148
8148
  }
8149
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
8150
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
8151
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
8152
+ }
8149
8153
  var isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
8150
8154
  var tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
8151
8155
  if (!tagsToRender) {
@@ -8329,6 +8333,10 @@
8329
8333
  }
8330
8334
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
8331
8335
  this.item.CameraZoomSettings = CameraZoomSettings;
8336
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
8337
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
8338
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
8339
+ }
8332
8340
  this.setGetter();
8333
8341
  }
8334
8342
  if (queueRerender != false) {
@@ -8423,11 +8431,11 @@
8423
8431
  var _a;
8424
8432
  if (force === void 0) { force = false; }
8425
8433
  return __awaiter(this, void 0, void 0, function () {
8426
- var typeId_1, e_3;
8434
+ var typeId_1, zoomItem, e_3;
8427
8435
  return __generator(this, function (_b) {
8428
8436
  switch (_b.label) {
8429
8437
  case 0:
8430
- _b.trys.push([0, 5, , 6]);
8438
+ _b.trys.push([0, 8, , 9]);
8431
8439
  if (this.disposed || this.viewer.isDestroyed()) {
8432
8440
  return [2 /*return*/];
8433
8441
  }
@@ -8435,21 +8443,30 @@
8435
8443
  if (typeId_1) {
8436
8444
  entities = entities.filter(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId_1; });
8437
8445
  }
8438
- if (!this.useGeojson) return [3 /*break*/, 2];
8439
- return [4 /*yield*/, this.renderAsGeojson(entities, force)];
8446
+ if (!this.useGeojson) return [3 /*break*/, 5];
8447
+ zoomItem = this.item.CameraZoomSettings[0];
8448
+ if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
8449
+ // We'll just render these as individuals since we don't support point geojson.
8450
+ return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
8440
8451
  case 1:
8452
+ // We'll just render these as individuals since we don't support point geojson.
8441
8453
  _b.sent();
8442
8454
  return [3 /*break*/, 4];
8443
- case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
8455
+ case 2: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
8444
8456
  case 3:
8445
8457
  _b.sent();
8446
8458
  _b.label = 4;
8447
- case 4: return [3 /*break*/, 6];
8448
- case 5:
8459
+ case 4: return [3 /*break*/, 7];
8460
+ case 5: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
8461
+ case 6:
8462
+ _b.sent();
8463
+ _b.label = 7;
8464
+ case 7: return [3 /*break*/, 9];
8465
+ case 8:
8449
8466
  e_3 = _b.sent();
8450
8467
  console.error(e_3);
8451
- return [3 /*break*/, 6];
8452
- case 6: return [2 /*return*/];
8468
+ return [3 /*break*/, 9];
8469
+ case 9: return [2 /*return*/];
8453
8470
  }
8454
8471
  });
8455
8472
  });
@@ -8461,12 +8478,12 @@
8461
8478
  * @param force TODO: This should re-render entities that are already rendered.
8462
8479
  */
8463
8480
  Manager.prototype.renderAsGeojson = function (entities, force) {
8464
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
8481
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8465
8482
  return __awaiter(this, void 0, void 0, function () {
8466
- var zoomItem, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
8483
+ var zoomItem, lods, withLods_1, individuals, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
8467
8484
  var _this = this;
8468
- return __generator(this, function (_m) {
8469
- switch (_m.label) {
8485
+ return __generator(this, function (_o) {
8486
+ switch (_o.label) {
8470
8487
  case 0:
8471
8488
  entities = entities.filter(function (entity) {
8472
8489
  var _a;
@@ -8478,52 +8495,93 @@
8478
8495
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
8479
8496
  });
8480
8497
  zoomItem = this.item.CameraZoomSettings[0];
8481
- style = null;
8482
- if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
8483
- _m.label = 1;
8498
+ if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
8499
+ return [4 /*yield*/, bruceModels.EntityLod.GetLods({
8500
+ api: this.apiGetter.getApi(),
8501
+ filter: {
8502
+ externalSources: false,
8503
+ Items: entities.map(function (x) {
8504
+ var _a, _b;
8505
+ return {
8506
+ entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
8507
+ categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
8508
+ group: "DEFAULT",
8509
+ level: Number(zoomItem.LODLevel)
8510
+ };
8511
+ }),
8512
+ strict: false
8513
+ }
8514
+ })];
8484
8515
  case 1:
8485
- _m.trys.push([1, 3, , 4]);
8516
+ lods = (_o.sent()).lods;
8517
+ if (this.disposed) {
8518
+ this.doDispose();
8519
+ return [2 /*return*/];
8520
+ }
8521
+ withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
8522
+ individuals = entities.filter(function (entity) {
8523
+ var _a;
8524
+ return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
8525
+ });
8526
+ if (individuals.length) {
8527
+ this.renderAsIndividuals(individuals, force);
8528
+ }
8529
+ // Now we proceed with what is left.
8530
+ entities = entities.filter(function (entity) {
8531
+ var _a;
8532
+ return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
8533
+ });
8534
+ _o.label = 2;
8535
+ case 2:
8536
+ if (!entities.length) {
8537
+ return [2 /*return*/];
8538
+ }
8539
+ style = null;
8540
+ if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
8541
+ _o.label = 3;
8542
+ case 3:
8543
+ _o.trys.push([3, 5, , 6]);
8486
8544
  return [4 /*yield*/, bruceModels.Style.Get({
8487
8545
  api: this.apiGetter.getApi(),
8488
8546
  styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
8489
8547
  })];
8490
- case 2:
8491
- style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
8492
- return [3 /*break*/, 4];
8493
- case 3:
8494
- e_4 = _m.sent();
8495
- console.error(e_4);
8496
- return [3 /*break*/, 4];
8497
8548
  case 4:
8549
+ style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
8550
+ return [3 /*break*/, 6];
8551
+ case 5:
8552
+ e_4 = _o.sent();
8553
+ console.error(e_4);
8554
+ return [3 /*break*/, 6];
8555
+ case 6:
8498
8556
  entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
8499
8557
  if (!entityTypeId) {
8500
8558
  entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
8501
8559
  }
8502
- if (!entityTypeId) return [3 /*break*/, 10];
8503
- _m.label = 5;
8504
- case 5:
8505
- _m.trys.push([5, 9, , 10]);
8560
+ if (!entityTypeId) return [3 /*break*/, 12];
8561
+ _o.label = 7;
8562
+ case 7:
8563
+ _o.trys.push([7, 11, , 12]);
8506
8564
  return [4 /*yield*/, bruceModels.EntityType.Get({
8507
8565
  entityTypeId: entityTypeId,
8508
8566
  api: this.apiGetter.getApi()
8509
8567
  })];
8510
- case 6:
8511
- entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
8512
- if (!(!style && entityType)) return [3 /*break*/, 8];
8513
- if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
8568
+ case 8:
8569
+ entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
8570
+ if (!(!style && entityType)) return [3 /*break*/, 10];
8571
+ if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
8514
8572
  return [4 /*yield*/, bruceModels.Style.Get({
8515
8573
  api: this.apiGetter.getApi(),
8516
8574
  styleId: entityType["DisplaySetting.ID"]
8517
8575
  })];
8518
- case 7:
8519
- style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
8520
- _m.label = 8;
8521
- case 8: return [3 /*break*/, 10];
8522
8576
  case 9:
8523
- e_5 = _m.sent();
8577
+ style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
8578
+ _o.label = 10;
8579
+ case 10: return [3 /*break*/, 12];
8580
+ case 11:
8581
+ e_5 = _o.sent();
8524
8582
  console.error(e_5);
8525
- return [3 /*break*/, 10];
8526
- case 10:
8583
+ return [3 /*break*/, 12];
8584
+ case 12:
8527
8585
  pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
8528
8586
  lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
8529
8587
  polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
@@ -8548,7 +8606,16 @@
8548
8606
  // No points.
8549
8607
  allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
8550
8608
  });
8551
- if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
8609
+ notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
8610
+ return !geojson.features.some(function (feature) {
8611
+ var _a, _b, _c;
8612
+ return ((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID);
8613
+ });
8614
+ });
8615
+ if (notRendered.length) {
8616
+ this.renderAsIndividuals(notRendered, force);
8617
+ }
8618
+ if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
8552
8619
  return [2 /*return*/];
8553
8620
  }
8554
8621
  return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
@@ -8557,8 +8624,8 @@
8557
8624
  strokeWidth: lineWidthPx,
8558
8625
  clampToGround: lineWidthPx <= 0 && polygonsClamped
8559
8626
  })];
8560
- case 11:
8561
- source = _m.sent();
8627
+ case 13:
8628
+ source = _o.sent();
8562
8629
  this.viewer.dataSources.add(source);
8563
8630
  this.sources.push(source);
8564
8631
  if (this.disposed) {
@@ -8998,6 +9065,10 @@
8998
9065
  }
8999
9066
  ];
9000
9067
  }
9068
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9069
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9070
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9071
+ }
9001
9072
  this.recreateGetter();
9002
9073
  };
9003
9074
  /**
@@ -9085,6 +9156,10 @@
9085
9156
  }
9086
9157
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
9087
9158
  this.item.CameraZoomSettings = CameraZoomSettings;
9159
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9160
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9161
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9162
+ }
9088
9163
  }
9089
9164
  if (queueRerender != false) {
9090
9165
  var entityIds = Object.keys(this.renderedEntities);
@@ -9151,12 +9226,12 @@
9151
9226
  Manager.prototype.onGetterUpdate = function (entities, force) {
9152
9227
  if (force === void 0) { force = false; }
9153
9228
  return __awaiter(this, void 0, void 0, function () {
9154
- var isEntityInItem_1, e_2;
9229
+ var isEntityInItem_1, zoomItem, e_2;
9155
9230
  var _this = this;
9156
9231
  return __generator(this, function (_a) {
9157
9232
  switch (_a.label) {
9158
9233
  case 0:
9159
- _a.trys.push([0, 5, , 6]);
9234
+ _a.trys.push([0, 8, , 9]);
9160
9235
  if (this.disposed || this.viewer.isDestroyed()) {
9161
9236
  return [2 /*return*/];
9162
9237
  }
@@ -9170,21 +9245,30 @@
9170
9245
  var _a;
9171
9246
  return isEntityInItem_1((_a = x === null || x === void 0 ? void 0 : x.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9172
9247
  });
9173
- if (!this.useGeojson) return [3 /*break*/, 2];
9174
- return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9248
+ if (!this.useGeojson) return [3 /*break*/, 5];
9249
+ zoomItem = this.item.CameraZoomSettings[0];
9250
+ if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
9251
+ // We'll just render these as individuals since we don't support point geojson.
9252
+ return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9175
9253
  case 1:
9254
+ // We'll just render these as individuals since we don't support point geojson.
9176
9255
  _a.sent();
9177
9256
  return [3 /*break*/, 4];
9178
- case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9257
+ case 2: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9179
9258
  case 3:
9180
9259
  _a.sent();
9181
9260
  _a.label = 4;
9182
- case 4: return [3 /*break*/, 6];
9183
- case 5:
9261
+ case 4: return [3 /*break*/, 7];
9262
+ case 5: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9263
+ case 6:
9264
+ _a.sent();
9265
+ _a.label = 7;
9266
+ case 7: return [3 /*break*/, 9];
9267
+ case 8:
9184
9268
  e_2 = _a.sent();
9185
9269
  console.error(e_2);
9186
- return [3 /*break*/, 6];
9187
- case 6: return [2 /*return*/];
9270
+ return [3 /*break*/, 9];
9271
+ case 9: return [2 /*return*/];
9188
9272
  }
9189
9273
  });
9190
9274
  });
@@ -9196,12 +9280,12 @@
9196
9280
  * @param force TODO: This should re-render entities that are already rendered.
9197
9281
  */
9198
9282
  Manager.prototype.renderAsGeojson = function (entities, force) {
9199
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9283
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9200
9284
  return __awaiter(this, void 0, void 0, function () {
9201
- var zoomItem, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
9285
+ var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
9202
9286
  var _this = this;
9203
- return __generator(this, function (_m) {
9204
- switch (_m.label) {
9287
+ return __generator(this, function (_o) {
9288
+ switch (_o.label) {
9205
9289
  case 0:
9206
9290
  entities = entities.filter(function (entity) {
9207
9291
  var _a;
@@ -9213,52 +9297,93 @@
9213
9297
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
9214
9298
  });
9215
9299
  zoomItem = this.item.CameraZoomSettings[0];
9216
- style = null;
9217
- if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
9218
- _m.label = 1;
9300
+ if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
9301
+ return [4 /*yield*/, bruceModels.EntityLod.GetLods({
9302
+ api: this.apiGetter.getApi(),
9303
+ filter: {
9304
+ externalSources: false,
9305
+ Items: entities.map(function (x) {
9306
+ var _a, _b;
9307
+ return {
9308
+ entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
9309
+ categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
9310
+ group: "DEFAULT",
9311
+ level: Number(zoomItem.LODLevel)
9312
+ };
9313
+ }),
9314
+ strict: false
9315
+ }
9316
+ })];
9219
9317
  case 1:
9220
- _m.trys.push([1, 3, , 4]);
9318
+ lods = (_o.sent()).lods;
9319
+ if (this.disposed) {
9320
+ this.doDispose();
9321
+ return [2 /*return*/];
9322
+ }
9323
+ withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
9324
+ individuals = entities.filter(function (entity) {
9325
+ var _a;
9326
+ return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9327
+ });
9328
+ if (individuals.length) {
9329
+ this.renderAsIndividuals(individuals, force);
9330
+ }
9331
+ // Now we proceed with what is left.
9332
+ entities = entities.filter(function (entity) {
9333
+ var _a;
9334
+ return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9335
+ });
9336
+ _o.label = 2;
9337
+ case 2:
9338
+ if (!entities.length) {
9339
+ return [2 /*return*/];
9340
+ }
9341
+ style = null;
9342
+ if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
9343
+ _o.label = 3;
9344
+ case 3:
9345
+ _o.trys.push([3, 5, , 6]);
9221
9346
  return [4 /*yield*/, bruceModels.Style.Get({
9222
9347
  api: this.apiGetter.getApi(),
9223
9348
  styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
9224
9349
  })];
9225
- case 2:
9226
- style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9227
- return [3 /*break*/, 4];
9228
- case 3:
9229
- e_3 = _m.sent();
9230
- console.error(e_3);
9231
- return [3 /*break*/, 4];
9232
9350
  case 4:
9351
+ style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9352
+ return [3 /*break*/, 6];
9353
+ case 5:
9354
+ e_3 = _o.sent();
9355
+ console.error(e_3);
9356
+ return [3 /*break*/, 6];
9357
+ case 6:
9233
9358
  entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
9234
9359
  if (!entityTypeId) {
9235
9360
  entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
9236
9361
  }
9237
- if (!entityTypeId) return [3 /*break*/, 10];
9238
- _m.label = 5;
9239
- case 5:
9240
- _m.trys.push([5, 9, , 10]);
9362
+ if (!entityTypeId) return [3 /*break*/, 12];
9363
+ _o.label = 7;
9364
+ case 7:
9365
+ _o.trys.push([7, 11, , 12]);
9241
9366
  return [4 /*yield*/, bruceModels.EntityType.Get({
9242
9367
  entityTypeId: entityTypeId,
9243
9368
  api: this.apiGetter.getApi()
9244
9369
  })];
9245
- case 6:
9246
- entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9247
- if (!(!style && entityType)) return [3 /*break*/, 8];
9248
- if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
9370
+ case 8:
9371
+ entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9372
+ if (!(!style && entityType)) return [3 /*break*/, 10];
9373
+ if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
9249
9374
  return [4 /*yield*/, bruceModels.Style.Get({
9250
9375
  api: this.apiGetter.getApi(),
9251
9376
  styleId: entityType["DisplaySetting.ID"]
9252
9377
  })];
9253
- case 7:
9254
- style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9255
- _m.label = 8;
9256
- case 8: return [3 /*break*/, 10];
9257
9378
  case 9:
9258
- e_4 = _m.sent();
9379
+ style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9380
+ _o.label = 10;
9381
+ case 10: return [3 /*break*/, 12];
9382
+ case 11:
9383
+ e_4 = _o.sent();
9259
9384
  console.error(e_4);
9260
- return [3 /*break*/, 10];
9261
- case 10:
9385
+ return [3 /*break*/, 12];
9386
+ case 12:
9262
9387
  pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
9263
9388
  lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
9264
9389
  polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
@@ -9283,7 +9408,16 @@
9283
9408
  // No points.
9284
9409
  allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
9285
9410
  });
9286
- if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
9411
+ notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
9412
+ return !geojson.features.some(function (feature) {
9413
+ var _a, _b, _c;
9414
+ return ((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID);
9415
+ });
9416
+ });
9417
+ if (notRendered.length) {
9418
+ this.renderAsIndividuals(notRendered, force);
9419
+ }
9420
+ if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
9287
9421
  return [2 /*return*/];
9288
9422
  }
9289
9423
  return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
@@ -9292,8 +9426,8 @@
9292
9426
  strokeWidth: lineWidthPx,
9293
9427
  clampToGround: lineWidthPx <= 0 && polygonsClamped
9294
9428
  })];
9295
- case 11:
9296
- source = _m.sent();
9429
+ case 13:
9430
+ source = _o.sent();
9297
9431
  this.viewer.dataSources.add(source);
9298
9432
  this.sources.push(source);
9299
9433
  if (this.disposed) {
@@ -9574,6 +9708,10 @@
9574
9708
  }
9575
9709
  ];
9576
9710
  }
9711
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9712
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9713
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9714
+ }
9577
9715
  this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
9578
9716
  this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
9579
9717
  _this.onGetterUpdate(ids);
@@ -9642,6 +9780,10 @@
9642
9780
  }
9643
9781
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
9644
9782
  this.item.CameraZoomSettings = CameraZoomSettings;
9783
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9784
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9785
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9786
+ }
9645
9787
  }
9646
9788
  if (queueRerender != false) {
9647
9789
  var entityIds = Object.keys(this.renderedEntities);
@@ -9688,7 +9830,7 @@
9688
9830
  Manager.prototype.renderEntities = function (entities, force) {
9689
9831
  if (force === void 0) { force = false; }
9690
9832
  return __awaiter(this, void 0, void 0, function () {
9691
- var e_2;
9833
+ var zoomItem, e_2;
9692
9834
  return __generator(this, function (_a) {
9693
9835
  switch (_a.label) {
9694
9836
  case 0:
@@ -9697,22 +9839,31 @@
9697
9839
  }
9698
9840
  _a.label = 1;
9699
9841
  case 1:
9700
- _a.trys.push([1, 6, , 7]);
9701
- if (!this.useGeojson) return [3 /*break*/, 3];
9702
- return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9842
+ _a.trys.push([1, 9, , 10]);
9843
+ if (!this.useGeojson) return [3 /*break*/, 6];
9844
+ zoomItem = this.item.CameraZoomSettings[0];
9845
+ if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Point)) return [3 /*break*/, 3];
9846
+ // We'll just render these as individuals since we don't support point geojson.
9847
+ return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9703
9848
  case 2:
9849
+ // We'll just render these as individuals since we don't support point geojson.
9704
9850
  _a.sent();
9705
9851
  return [3 /*break*/, 5];
9706
- case 3: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9852
+ case 3: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9707
9853
  case 4:
9708
9854
  _a.sent();
9709
9855
  _a.label = 5;
9710
- case 5: return [3 /*break*/, 7];
9711
- case 6:
9856
+ case 5: return [3 /*break*/, 8];
9857
+ case 6: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9858
+ case 7:
9859
+ _a.sent();
9860
+ _a.label = 8;
9861
+ case 8: return [3 /*break*/, 10];
9862
+ case 9:
9712
9863
  e_2 = _a.sent();
9713
9864
  console.error(e_2);
9714
- return [3 /*break*/, 7];
9715
- case 7: return [2 /*return*/];
9865
+ return [3 /*break*/, 10];
9866
+ case 10: return [2 /*return*/];
9716
9867
  }
9717
9868
  });
9718
9869
  });
@@ -9724,12 +9875,12 @@
9724
9875
  * @param force TODO: This should re-render entities that are already rendered.
9725
9876
  */
9726
9877
  Manager.prototype.renderAsGeojson = function (entities, force) {
9727
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9878
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9728
9879
  return __awaiter(this, void 0, void 0, function () {
9729
- var zoomItem, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
9880
+ var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
9730
9881
  var _this = this;
9731
- return __generator(this, function (_m) {
9732
- switch (_m.label) {
9882
+ return __generator(this, function (_o) {
9883
+ switch (_o.label) {
9733
9884
  case 0:
9734
9885
  entities = entities.filter(function (entity) {
9735
9886
  var _a;
@@ -9741,52 +9892,93 @@
9741
9892
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
9742
9893
  });
9743
9894
  zoomItem = this.item.CameraZoomSettings[0];
9744
- style = null;
9745
- if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
9746
- _m.label = 1;
9895
+ if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
9896
+ return [4 /*yield*/, bruceModels.EntityLod.GetLods({
9897
+ api: this.apiGetter.getApi(),
9898
+ filter: {
9899
+ externalSources: false,
9900
+ Items: entities.map(function (x) {
9901
+ var _a, _b;
9902
+ return {
9903
+ entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
9904
+ categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
9905
+ group: "DEFAULT",
9906
+ level: Number(zoomItem.LODLevel)
9907
+ };
9908
+ }),
9909
+ strict: false
9910
+ }
9911
+ })];
9747
9912
  case 1:
9748
- _m.trys.push([1, 3, , 4]);
9913
+ lods = (_o.sent()).lods;
9914
+ if (this.disposed) {
9915
+ this.doDispose();
9916
+ return [2 /*return*/];
9917
+ }
9918
+ withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
9919
+ individuals = entities.filter(function (entity) {
9920
+ var _a;
9921
+ return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9922
+ });
9923
+ if (individuals.length) {
9924
+ this.renderAsIndividuals(individuals, force);
9925
+ }
9926
+ // Now we proceed with what is left.
9927
+ entities = entities.filter(function (entity) {
9928
+ var _a;
9929
+ return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9930
+ });
9931
+ _o.label = 2;
9932
+ case 2:
9933
+ if (!entities.length) {
9934
+ return [2 /*return*/];
9935
+ }
9936
+ style = null;
9937
+ if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
9938
+ _o.label = 3;
9939
+ case 3:
9940
+ _o.trys.push([3, 5, , 6]);
9749
9941
  return [4 /*yield*/, bruceModels.Style.Get({
9750
9942
  api: this.apiGetter.getApi(),
9751
9943
  styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
9752
9944
  })];
9753
- case 2:
9754
- style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9755
- return [3 /*break*/, 4];
9756
- case 3:
9757
- e_3 = _m.sent();
9758
- console.error(e_3);
9759
- return [3 /*break*/, 4];
9760
9945
  case 4:
9946
+ style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9947
+ return [3 /*break*/, 6];
9948
+ case 5:
9949
+ e_3 = _o.sent();
9950
+ console.error(e_3);
9951
+ return [3 /*break*/, 6];
9952
+ case 6:
9761
9953
  entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
9762
9954
  if (!entityTypeId) {
9763
9955
  entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
9764
9956
  }
9765
- if (!entityTypeId) return [3 /*break*/, 10];
9766
- _m.label = 5;
9767
- case 5:
9768
- _m.trys.push([5, 9, , 10]);
9957
+ if (!entityTypeId) return [3 /*break*/, 12];
9958
+ _o.label = 7;
9959
+ case 7:
9960
+ _o.trys.push([7, 11, , 12]);
9769
9961
  return [4 /*yield*/, bruceModels.EntityType.Get({
9770
9962
  entityTypeId: entityTypeId,
9771
9963
  api: this.apiGetter.getApi()
9772
9964
  })];
9773
- case 6:
9774
- entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9775
- if (!(!style && entityType)) return [3 /*break*/, 8];
9776
- if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
9965
+ case 8:
9966
+ entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9967
+ if (!(!style && entityType)) return [3 /*break*/, 10];
9968
+ if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
9777
9969
  return [4 /*yield*/, bruceModels.Style.Get({
9778
9970
  api: this.apiGetter.getApi(),
9779
9971
  styleId: entityType["DisplaySetting.ID"]
9780
9972
  })];
9781
- case 7:
9782
- style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9783
- _m.label = 8;
9784
- case 8: return [3 /*break*/, 10];
9785
9973
  case 9:
9786
- e_4 = _m.sent();
9974
+ style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9975
+ _o.label = 10;
9976
+ case 10: return [3 /*break*/, 12];
9977
+ case 11:
9978
+ e_4 = _o.sent();
9787
9979
  console.error(e_4);
9788
- return [3 /*break*/, 10];
9789
- case 10:
9980
+ return [3 /*break*/, 12];
9981
+ case 12:
9790
9982
  pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
9791
9983
  lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
9792
9984
  polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
@@ -9811,7 +10003,16 @@
9811
10003
  // No points.
9812
10004
  allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
9813
10005
  });
9814
- if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
10006
+ notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
10007
+ return !geojson.features.some(function (feature) {
10008
+ var _a, _b, _c;
10009
+ return ((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID);
10010
+ });
10011
+ });
10012
+ if (notRendered.length) {
10013
+ this.renderAsIndividuals(notRendered, force);
10014
+ }
10015
+ if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
9815
10016
  return [2 /*return*/];
9816
10017
  }
9817
10018
  return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
@@ -9820,8 +10021,8 @@
9820
10021
  strokeWidth: lineWidthPx,
9821
10022
  clampToGround: lineWidthPx <= 0 && polygonsClamped
9822
10023
  })];
9823
- case 11:
9824
- source = _m.sent();
10024
+ case 13:
10025
+ source = _o.sent();
9825
10026
  this.viewer.dataSources.add(source);
9826
10027
  this.sources.push(source);
9827
10028
  if (this.disposed) {
@@ -21100,7 +21301,7 @@
21100
21301
  CesiumViewMonitor.Monitor = Monitor;
21101
21302
  })(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
21102
21303
 
21103
- var VERSION$1 = "3.4.1";
21304
+ var VERSION$1 = "3.4.2";
21104
21305
 
21105
21306
  exports.VERSION = VERSION$1;
21106
21307
  exports.CesiumParabola = CesiumParabola;