bruce-cesium 1.4.1 → 1.4.3

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.
@@ -1,5 +1,5 @@
1
1
  import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, Entity as Entity$1, BatchedDataGetter, EntityRelationType, Tileset, EntityCoords, EntityFilterGetter, EntitySource, EntityRelation, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
2
- import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, JulianDate, Matrix4, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
2
+ import { Cartesian2, Cartographic, Math as Math$1, Cartesian3, Entity, Primitive, Cesium3DTileFeature, Color, HeightReference, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, HeadingPitchRange, Cesium3DTileColorBlendMode, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, OrthographicFrustum, JulianDate, Matrix4, Cesium3DTileset, IonResource, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -4485,9 +4485,8 @@ var TilesetRenderEngine;
4485
4485
  }
4486
4486
  TilesetRenderEngine.RenderLegacy = RenderLegacy;
4487
4487
  var CadStyler = /** @class */ (function () {
4488
- function CadStyler(api, cTileset, fallbackStyleId, styleMapping) {
4488
+ function CadStyler(api, cTileset, fallbackStyleId, styleMapping, menuItemId, register) {
4489
4489
  this.disposed = false;
4490
- this.loadedEntities = {};
4491
4490
  this.styleMappingLoaded = false;
4492
4491
  this.styleMappingsLoaded = {};
4493
4492
  this.fallbackStyle = null;
@@ -4498,6 +4497,8 @@ var TilesetRenderEngine;
4498
4497
  this.cTileset = cTileset;
4499
4498
  this.fallbackStyleId = fallbackStyleId;
4500
4499
  this.styleMapping = styleMapping;
4500
+ this.register = register;
4501
+ this.menuItemId = menuItemId;
4501
4502
  this.loadStyles();
4502
4503
  }
4503
4504
  Object.defineProperty(CadStyler.prototype, "Disposed", {
@@ -4517,11 +4518,12 @@ var TilesetRenderEngine;
4517
4518
  }
4518
4519
  };
4519
4520
  CadStyler.prototype.processQueue = function () {
4521
+ var _a;
4520
4522
  return __awaiter(this, void 0, void 0, function () {
4521
- var MAX_BATCHES, BATCH_DELAY, batch, rerun, entityIds, entities, _loop_1, this_1, i;
4523
+ var MAX_BATCHES, BATCH_DELAY, batch, rerun, entities, i, record, feature;
4522
4524
  var _this = this;
4523
- return __generator(this, function (_a) {
4524
- switch (_a.label) {
4525
+ return __generator(this, function (_b) {
4526
+ switch (_b.label) {
4525
4527
  case 0:
4526
4528
  MAX_BATCHES = 2;
4527
4529
  BATCH_DELAY = 200;
@@ -4534,31 +4536,26 @@ var TilesetRenderEngine;
4534
4536
  this.runningQueues += 1;
4535
4537
  batch = [];
4536
4538
  rerun = false;
4537
- _a.label = 1;
4539
+ _b.label = 1;
4538
4540
  case 1:
4539
- _a.trys.push([1, , 4, 5]);
4540
- batch = this.getEntitiesForQueue();
4541
- entityIds = batch.map(function (x) { return x.entityId; });
4542
- if (!(entityIds.length > 0)) return [3 /*break*/, 3];
4541
+ _b.trys.push([1, , 4, 5]);
4542
+ batch = this.getEntityIdsForQueue();
4543
+ if (!(batch.length > 0)) return [3 /*break*/, 3];
4543
4544
  return [4 /*yield*/, Entity$1.GetListByIds({
4544
4545
  api: this.api,
4545
- entityIds: entityIds
4546
+ entityIds: batch
4546
4547
  })];
4547
4548
  case 2:
4548
- entities = (_a.sent()).entities;
4549
- _loop_1 = function (i) {
4550
- var record = entities[i];
4551
- var feature = batch.find(function (x) { var _a; return (x === null || x === void 0 ? void 0 : x.entityId) == ((_a = record === null || record === void 0 ? void 0 : record.Bruce) === null || _a === void 0 ? void 0 : _a.ID); });
4549
+ entities = (_b.sent()).entities;
4550
+ for (i = 0; i < entities.length; i++) {
4551
+ record = entities[i];
4552
+ feature = this.getEntityRego((_a = record.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
4552
4553
  if (feature) {
4553
- this_1.styleTilesetFeatureFullData(feature, record);
4554
+ this.styleTilesetFeatureFullData(feature, record);
4554
4555
  }
4555
- };
4556
- this_1 = this;
4557
- for (i = 0; i < entities.length; i++) {
4558
- _loop_1(i);
4559
4556
  }
4560
4557
  rerun = batch.length > 0;
4561
- _a.label = 3;
4558
+ _b.label = 3;
4562
4559
  case 3: return [3 /*break*/, 5];
4563
4560
  case 4:
4564
4561
  setTimeout(function () {
@@ -4573,18 +4570,15 @@ var TilesetRenderEngine;
4573
4570
  });
4574
4571
  });
4575
4572
  };
4576
- CadStyler.prototype.getEntitiesForQueue = function () {
4573
+ CadStyler.prototype.getEntityIdsForQueue = function () {
4577
4574
  var BATCH_SIZE = 30;
4578
- var batchHashes = this.recordLoadQueue.splice(0, BATCH_SIZE);
4579
- var entities = [];
4580
- for (var i = 0; i < batchHashes.length; i++) {
4581
- var id = batchHashes[i];
4582
- var entity = this.loadedEntities[id];
4583
- if (entity) {
4584
- entities.push(entity);
4585
- }
4586
- }
4587
- return entities;
4575
+ return this.recordLoadQueue.splice(0, BATCH_SIZE);
4576
+ };
4577
+ CadStyler.prototype.getEntityRego = function (entityId) {
4578
+ return this.register.GetRego({
4579
+ entityId: entityId,
4580
+ menuItemId: this.menuItemId
4581
+ });
4588
4582
  };
4589
4583
  CadStyler.prototype.Dispose = function () {
4590
4584
  if (this.disposed) {
@@ -4597,7 +4591,7 @@ var TilesetRenderEngine;
4597
4591
  CadStyler.prototype.loadStyles = function () {
4598
4592
  var _a, _b;
4599
4593
  return __awaiter(this, void 0, void 0, function () {
4600
- var fallbackStyleId, data, e_1, styleMapping, modelTree, entityTypeIds, _loop_2, i, i, styleMap, styleId, entityType, e_2, data, e_3;
4594
+ var fallbackStyleId, data, e_1, styleMapping, modelTree, entityTypeIds, _loop_1, i, i, styleMap, styleId, entityType, e_2, data, e_3;
4601
4595
  return __generator(this, function (_c) {
4602
4596
  switch (_c.label) {
4603
4597
  case 0:
@@ -4631,7 +4625,7 @@ var TilesetRenderEngine;
4631
4625
  modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
4632
4626
  if (modelTree) {
4633
4627
  entityTypeIds = this.getEntityTypeIdsFromModelTree(modelTree);
4634
- _loop_2 = function (i) {
4628
+ _loop_1 = function (i) {
4635
4629
  var entityTypeId = entityTypeIds[i];
4636
4630
  if (styleMapping.findIndex(function (x) { return x.EntityTypeID == entityTypeId; }) <= -1) {
4637
4631
  styleMapping.push({
@@ -4642,7 +4636,7 @@ var TilesetRenderEngine;
4642
4636
  }
4643
4637
  };
4644
4638
  for (i = 0; i < entityTypeIds.length; i++) {
4645
- _loop_2(i);
4639
+ _loop_1(i);
4646
4640
  }
4647
4641
  }
4648
4642
  }
@@ -4759,13 +4753,13 @@ var TilesetRenderEngine;
4759
4753
  }
4760
4754
  else {
4761
4755
  for (var i = 0; i < _this.recordCheckQueue.length; i++) {
4762
- var hash = _this.recordCheckQueue[i];
4763
- var entity = _this.loadedEntities[hash];
4756
+ var entityId = _this.recordCheckQueue[i];
4757
+ var entity = _this.getEntityRego(entityId);
4764
4758
  if (entity) {
4765
4759
  var entityTypeId = entity.entityTypeId;
4766
4760
  if (entityTypeId) {
4767
4761
  if (_this.styleMappingsLoaded[entityTypeId] == true) {
4768
- batch.push(hash);
4762
+ batch.push(entityId);
4769
4763
  }
4770
4764
  }
4771
4765
  }
@@ -4773,7 +4767,7 @@ var TilesetRenderEngine;
4773
4767
  break;
4774
4768
  }
4775
4769
  }
4776
- var _loop_3 = function (i) {
4770
+ var _loop_2 = function (i) {
4777
4771
  var hash = batch[i];
4778
4772
  var index = _this.recordCheckQueue.findIndex(function (x) { return x == hash; });
4779
4773
  if (index > -1) {
@@ -4781,13 +4775,13 @@ var TilesetRenderEngine;
4781
4775
  }
4782
4776
  };
4783
4777
  for (var i = 0; i < batch.length; i++) {
4784
- _loop_3(i);
4778
+ _loop_2(i);
4785
4779
  }
4786
4780
  }
4787
4781
  if (batch.length) {
4788
4782
  for (var i = 0; i < batch.length; i++) {
4789
- var item = batch[i];
4790
- var entity = _this.loadedEntities[item];
4783
+ var entityId = batch[i];
4784
+ var entity = _this.getEntityRego(entityId);
4791
4785
  if (entity) {
4792
4786
  _this.queueTilesetFeatureStyle(entity);
4793
4787
  }
@@ -4806,7 +4800,7 @@ var TilesetRenderEngine;
4806
4800
  if (this.styleMappingLoaded || this.styleMappingsLoaded[entity.entityTypeId] == true) {
4807
4801
  var needsData = this.getTilesetFeatureNeedsFullData(entity.entityId, entity.entityTypeId);
4808
4802
  if (needsData) {
4809
- if (this.recordLoadQueue.findIndex(function (x) { return x == entity.entityId; })) {
4803
+ if (!this.recordLoadQueue.find(function (x) { return x == entity.entityId; })) {
4810
4804
  this.recordLoadQueue.push(entity.entityId);
4811
4805
  }
4812
4806
  }
@@ -4944,7 +4938,7 @@ var TilesetCadRenderManager;
4944
4938
  return;
4945
4939
  }
4946
4940
  _this.onCTilesetLoad();
4947
- _this.styler = new TilesetRenderEngine.CadStyler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping);
4941
+ _this.styler = new TilesetRenderEngine.CadStyler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
4948
4942
  }
4949
4943
  catch (e) {
4950
4944
  console.error(e);
@@ -6010,7 +6004,7 @@ var TilesetArbRenderManager;
6010
6004
  try {
6011
6005
  if (_this.item.ApplyStyles) {
6012
6006
  var api = _this.apiGetter.getApi();
6013
- _this.styler = new TilesetRenderEngine.CadStyler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping);
6007
+ _this.styler = new TilesetRenderEngine.CadStyler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
6014
6008
  }
6015
6009
  _this.onCTilesetLoad();
6016
6010
  }