bruce-cesium 2.3.9 → 2.4.0

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.
@@ -1640,6 +1640,42 @@
1640
1640
  }
1641
1641
  return obj;
1642
1642
  }
1643
+ function getName(api, entity) {
1644
+ return __awaiter(this, void 0, void 0, function () {
1645
+ var typeId, type, name_1, e_1;
1646
+ return __generator(this, function (_a) {
1647
+ switch (_a.label) {
1648
+ case 0:
1649
+ _a.trys.push([0, 3, , 4]);
1650
+ typeId = entity.Bruce["EntityType.ID"];
1651
+ type = null;
1652
+ if (!typeId) return [3 /*break*/, 2];
1653
+ return [4 /*yield*/, bruceModels.EntityType.Get({
1654
+ api: api,
1655
+ entityTypeId: typeId
1656
+ })];
1657
+ case 1:
1658
+ type = (_a.sent()).entityType;
1659
+ _a.label = 2;
1660
+ case 2:
1661
+ if (type) {
1662
+ name_1 = bruceModels.Entity.CalculateName({
1663
+ entity: entity,
1664
+ type: type,
1665
+ defaultToId: false
1666
+ });
1667
+ return [2 /*return*/, name_1 ? name_1 : "Unnamed entity"];
1668
+ }
1669
+ return [3 /*break*/, 4];
1670
+ case 3:
1671
+ e_1 = _a.sent();
1672
+ console.error(e_1);
1673
+ return [3 /*break*/, 4];
1674
+ case 4: return [2 /*return*/, "Unknown entity"];
1675
+ }
1676
+ });
1677
+ });
1678
+ }
1643
1679
  function getStyle(api, entity, styleId) {
1644
1680
  return __awaiter(this, void 0, void 0, function () {
1645
1681
  var style, typeId, type;
@@ -1972,7 +2008,7 @@
1972
2008
  (function (Point) {
1973
2009
  function Render(params) {
1974
2010
  return __awaiter(this, void 0, void 0, function () {
1975
- var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, res, e_1, iconScale, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, outlineHeight, bOutline, fillHeight, exHeightRef, pos, bColor, cColor, size, heightRef;
2011
+ var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, res, e_2, iconScale, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, outlineHeight, bOutline, fillHeight, exHeightRef, pos, bColor, cColor, size, heightRef;
1976
2012
  return __generator(this, function (_a) {
1977
2013
  switch (_a.label) {
1978
2014
  case 0:
@@ -2025,7 +2061,7 @@
2025
2061
  _a.label = 4;
2026
2062
  case 4: return [3 /*break*/, 6];
2027
2063
  case 5:
2028
- e_1 = _a.sent();
2064
+ e_2 = _a.sent();
2029
2065
  iconUrl = null;
2030
2066
  return [3 /*break*/, 6];
2031
2067
  case 6:
@@ -2170,7 +2206,7 @@
2170
2206
  function RenderGroup(params) {
2171
2207
  var _a, _b, _c;
2172
2208
  return __awaiter(this, void 0, void 0, function () {
2173
- var api, cEntities, i, entity, zoomItem, style, tagIds, tags, pStyle, cEntity;
2209
+ var api, cEntities, i, entity, zoomItem, style, tagIds, tags, pStyle, cEntity, name_2;
2174
2210
  return __generator(this, function (_d) {
2175
2211
  switch (_d.label) {
2176
2212
  case 0:
@@ -2179,7 +2215,7 @@
2179
2215
  i = 0;
2180
2216
  _d.label = 1;
2181
2217
  case 1:
2182
- if (!(i < params.entities.length)) return [3 /*break*/, 7];
2218
+ if (!(i < params.entities.length)) return [3 /*break*/, 9];
2183
2219
  entity = params.entities[i];
2184
2220
  zoomItem = params.zoomItems[entity.Bruce.ID];
2185
2221
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
@@ -2208,15 +2244,20 @@
2208
2244
  })];
2209
2245
  case 5:
2210
2246
  cEntity = _d.sent();
2211
- if (cEntity) {
2212
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
2213
- }
2214
- cEntities[entity.Bruce.ID] = cEntity;
2215
- _d.label = 6;
2247
+ if (!cEntity) return [3 /*break*/, 7];
2248
+ return [4 /*yield*/, getName(api, entity)];
2216
2249
  case 6:
2250
+ name_2 = _d.sent();
2251
+ cEntity.name = name_2;
2252
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
2253
+ _d.label = 7;
2254
+ case 7:
2255
+ cEntities[entity.Bruce.ID] = cEntity;
2256
+ _d.label = 8;
2257
+ case 8:
2217
2258
  i++;
2218
2259
  return [3 /*break*/, 1];
2219
- case 7: return [2 /*return*/, cEntities];
2260
+ case 9: return [2 /*return*/, cEntities];
2220
2261
  }
2221
2262
  });
2222
2263
  });
@@ -2313,7 +2354,7 @@
2313
2354
  function RenderGroup(params) {
2314
2355
  var _a, _b, _c;
2315
2356
  return __awaiter(this, void 0, void 0, function () {
2316
- var api, cEntities, i, entity, zoomItem, style, tagIds, tags, lStyle, cEntity;
2357
+ var api, cEntities, i, entity, zoomItem, style, tagIds, tags, lStyle, cEntity, name_3;
2317
2358
  return __generator(this, function (_d) {
2318
2359
  switch (_d.label) {
2319
2360
  case 0:
@@ -2322,7 +2363,7 @@
2322
2363
  i = 0;
2323
2364
  _d.label = 1;
2324
2365
  case 1:
2325
- if (!(i < params.entities.length)) return [3 /*break*/, 6];
2366
+ if (!(i < params.entities.length)) return [3 /*break*/, 7];
2326
2367
  entity = params.entities[i];
2327
2368
  zoomItem = params.zoomItems[entity.Bruce.ID];
2328
2369
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
@@ -2348,15 +2389,18 @@
2348
2389
  maxDistance: zoomItem.MaxZoom,
2349
2390
  minDistance: zoomItem.MinZoom
2350
2391
  });
2351
- if (cEntity) {
2352
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
2353
- cEntities[entity.Bruce.ID] = cEntity;
2354
- }
2355
- _d.label = 5;
2392
+ if (!cEntity) return [3 /*break*/, 6];
2393
+ return [4 /*yield*/, getName(api, entity)];
2356
2394
  case 5:
2395
+ name_3 = _d.sent();
2396
+ cEntity.name = name_3;
2397
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
2398
+ cEntities[entity.Bruce.ID] = cEntity;
2399
+ _d.label = 6;
2400
+ case 6:
2357
2401
  i++;
2358
2402
  return [3 /*break*/, 1];
2359
- case 6: return [2 /*return*/, cEntities];
2403
+ case 7: return [2 /*return*/, cEntities];
2360
2404
  }
2361
2405
  });
2362
2406
  });
@@ -2480,7 +2524,7 @@
2480
2524
  function RenderGroup(params) {
2481
2525
  var _a, _b, _c;
2482
2526
  return __awaiter(this, void 0, void 0, function () {
2483
- var api, cEntities, i, entity, zoomItem, style, tagIds, tags, pStyle, cEntity;
2527
+ var api, cEntities, i, entity, zoomItem, style, tagIds, tags, pStyle, cEntity, name_4;
2484
2528
  return __generator(this, function (_d) {
2485
2529
  switch (_d.label) {
2486
2530
  case 0:
@@ -2489,7 +2533,7 @@
2489
2533
  i = 0;
2490
2534
  _d.label = 1;
2491
2535
  case 1:
2492
- if (!(i < params.entities.length)) return [3 /*break*/, 6];
2536
+ if (!(i < params.entities.length)) return [3 /*break*/, 7];
2493
2537
  entity = params.entities[i];
2494
2538
  zoomItem = params.zoomItems[entity.Bruce.ID];
2495
2539
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
@@ -2515,15 +2559,18 @@
2515
2559
  maxDistance: zoomItem.MaxZoom,
2516
2560
  minDistance: zoomItem.MinZoom
2517
2561
  });
2518
- if (cEntity) {
2519
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
2520
- cEntities[entity.Bruce.ID] = cEntity;
2521
- }
2522
- _d.label = 5;
2562
+ if (!cEntity) return [3 /*break*/, 6];
2563
+ return [4 /*yield*/, getName(api, entity)];
2523
2564
  case 5:
2565
+ name_4 = _d.sent();
2566
+ cEntity.name = name_4;
2567
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
2568
+ cEntities[entity.Bruce.ID] = cEntity;
2569
+ _d.label = 6;
2570
+ case 6:
2524
2571
  i++;
2525
2572
  return [3 /*break*/, 1];
2526
- case 6: return [2 /*return*/, cEntities];
2573
+ case 7: return [2 /*return*/, cEntities];
2527
2574
  }
2528
2575
  });
2529
2576
  });
@@ -2671,7 +2718,7 @@
2671
2718
  case 7:
2672
2719
  lodData = (_f.sent()).lods;
2673
2720
  _loop_2 = function (i) {
2674
- var entity, zoomItem, style, tagIds, tags, lod, mStyle, cEntity;
2721
+ var entity, zoomItem, style, tagIds, tags, lod, mStyle, cEntity, name_5;
2675
2722
  return __generator(this, function (_g) {
2676
2723
  switch (_g.label) {
2677
2724
  case 0:
@@ -2709,11 +2756,15 @@
2709
2756
  maxDistance: zoomItem.MaxZoom,
2710
2757
  minDistance: zoomItem.MinZoom
2711
2758
  });
2712
- if (cEntity) {
2713
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_e = params.viewer) === null || _e === void 0 ? void 0 : _e.terrainProvider);
2714
- cEntities[entity.Bruce.ID] = cEntity;
2715
- }
2716
- return [2 /*return*/];
2759
+ if (!cEntity) return [3 /*break*/, 5];
2760
+ return [4 /*yield*/, getName(api, entity)];
2761
+ case 4:
2762
+ name_5 = _g.sent();
2763
+ cEntity.name = name_5;
2764
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_e = params.viewer) === null || _e === void 0 ? void 0 : _e.terrainProvider);
2765
+ cEntities[entity.Bruce.ID] = cEntity;
2766
+ _g.label = 5;
2767
+ case 5: return [2 /*return*/];
2717
2768
  }
2718
2769
  });
2719
2770
  };
@@ -3893,7 +3944,8 @@
3893
3944
  entityTypeId: entity.Bruce["EntityType.ID"],
3894
3945
  accountId: this.apiGetter.accountId,
3895
3946
  tagIds: tagIds ? [].concat(tagIds) : [],
3896
- suppressShow: wasClustered
3947
+ suppressShow: wasClustered,
3948
+ name: cEntity.name
3897
3949
  };
3898
3950
  this.visualsManager.AddRego({
3899
3951
  rego: rego
@@ -4130,7 +4182,8 @@
4130
4182
  visual: cEntity,
4131
4183
  priority: 0,
4132
4184
  entityTypeId: entity.Bruce["EntityType.ID"],
4133
- accountId: this.apiGetter.accountId
4185
+ accountId: this.apiGetter.accountId,
4186
+ name: cEntity.name
4134
4187
  }
4135
4188
  });
4136
4189
  }
@@ -5695,7 +5748,8 @@
5695
5748
  priority: 0,
5696
5749
  entityTypeId: entity.Bruce["EntityType.ID"],
5697
5750
  accountId: this.apiGetter.accountId,
5698
- suppressShow: clustered
5751
+ suppressShow: clustered,
5752
+ name: cEntity.name
5699
5753
  }
5700
5754
  });
5701
5755
  }
@@ -5879,7 +5933,8 @@
5879
5933
  visual: cEntity,
5880
5934
  priority: 0,
5881
5935
  entityTypeId: entity.Bruce["EntityType.ID"],
5882
- accountId: this.apiGetter.accountId
5936
+ accountId: this.apiGetter.accountId,
5937
+ name: cEntity.name
5883
5938
  }
5884
5939
  });
5885
5940
  }
@@ -6953,6 +7008,7 @@
6953
7008
  if (meta) {
6954
7009
  rego.entityId = meta.id;
6955
7010
  rego.entityTypeId = meta.typeId;
7011
+ rego.name = meta.name;
6956
7012
  }
6957
7013
  }
6958
7014
  }
@@ -7018,7 +7074,7 @@
7018
7074
  path = [].concat(path);
7019
7075
  path.push(branch.id);
7020
7076
  if (branch.geomId == geomId) {
7021
- return { id: path[path.length - 1], typeId: branch.typeId };
7077
+ return { id: path[path.length - 1], typeId: branch.typeId, name: branch.name };
7022
7078
  }
7023
7079
  else if (branch.children) {
7024
7080
  for (var i = 0; i < branch.children.length; i++) {
@@ -14289,7 +14345,7 @@
14289
14345
  ViewerUtils.CreateWidgets = CreateWidgets;
14290
14346
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
14291
14347
 
14292
- var VERSION$1 = "2.3.9";
14348
+ var VERSION$1 = "2.4.0";
14293
14349
 
14294
14350
  exports.VERSION = VERSION$1;
14295
14351
  exports.CesiumViewMonitor = CesiumViewMonitor;