bruce-cesium 0.0.9 → 0.1.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.
@@ -1,4 +1,4 @@
1
- import { Cartesian2, Cartographic, Math as Math$1, Viewer, ArcGisMapServerImageryProvider, ScreenSpaceEventType, Color, HeightReference, Cartesian3, Entity, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, Matrix4, Cesium3DTileset, EllipsoidGeodesic } from 'cesium';
1
+ import { Viewer, ArcGisMapServerImageryProvider, ScreenSpaceEventType, Cartesian2, Cartographic, Math as Math$1, Entity, Primitive, Cesium3DTileFeature, Color, HeightReference, Cartesian3, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, HeadingPitchRange, Matrix4, Cesium3DTileset, EllipsoidGeodesic } from 'cesium';
2
2
  import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, DelayQueue, Entity as Entity$1, EntityFilterGetter, BatchedDataGetter, ObjectUtils, Tileset, MenuItem, ProjectView, ProjectViewBookmark } from 'bruce-models';
3
3
 
4
4
  var TIME_LAG = 300;
@@ -678,8 +678,7 @@ function getStyle(api, entity, styleId) {
678
678
  });
679
679
  }
680
680
  function getExistingCEntity(entityId, menuItemId, item, visualRegister) {
681
- var visuals = visualRegister.GetVisuals(entityId, menuItemId);
682
- return visuals.length > 0 ? visuals[0] : null;
681
+ return visualRegister.GetVisual(entityId, menuItemId);
683
682
  }
684
683
  function getRenderGroupId(zoomItem) {
685
684
  if (!zoomItem) {
@@ -1432,7 +1431,7 @@ var EntitiesRenderManager;
1432
1431
  };
1433
1432
  Manager.prototype.onGetterUpdate = function (entities) {
1434
1433
  return __awaiter(this, void 0, void 0, function () {
1435
- var cEntities, i, id, cEntity, visuals;
1434
+ var cEntities, i, id, cEntity, visual;
1436
1435
  return __generator(this, function (_a) {
1437
1436
  switch (_a.label) {
1438
1437
  case 0:
@@ -1454,8 +1453,8 @@ var EntitiesRenderManager;
1454
1453
  cEntity = cEntities[id];
1455
1454
  this.renderedEntities[id] = !!cEntity;
1456
1455
  if (cEntity) {
1457
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
1458
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
1456
+ visual = this.visualsManager.GetVisual(id, this.item.id);
1457
+ if (!visual || visual != cEntity) {
1459
1458
  this.visualsManager.Add({
1460
1459
  entityId: id,
1461
1460
  menuItemId: this.item.id,
@@ -1530,7 +1529,7 @@ var EntitiesLoadedRenderManager;
1530
1529
  };
1531
1530
  Manager.prototype.onGetterUpdate = function (entities) {
1532
1531
  return __awaiter(this, void 0, void 0, function () {
1533
- var cEntities, i, id, cEntity, visuals;
1532
+ var cEntities, i, id, cEntity, visual;
1534
1533
  return __generator(this, function (_a) {
1535
1534
  switch (_a.label) {
1536
1535
  case 0:
@@ -1552,8 +1551,8 @@ var EntitiesLoadedRenderManager;
1552
1551
  cEntity = cEntities[id];
1553
1552
  this.renderedEntities[id] = !!cEntity;
1554
1553
  if (cEntity) {
1555
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
1556
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
1554
+ visual = this.visualsManager.GetVisual(id, this.item.id);
1555
+ if (!visual || visual != cEntity) {
1557
1556
  this.visualsManager.Add({
1558
1557
  entityId: id,
1559
1558
  menuItemId: this.item.id,
@@ -1815,14 +1814,26 @@ var VisualsRegister;
1815
1814
  }
1816
1815
  (_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ rego: rego, isAdding: true });
1817
1816
  };
1818
- Register.prototype.GetVisuals = function (entityId, menuItemId) {
1817
+ Register.prototype.GetVisual = function (entityId, menuItemId) {
1819
1818
  var _a;
1820
1819
  var entityRegos = this.rego[entityId];
1821
1820
  if (!entityRegos) {
1822
1821
  return [];
1823
1822
  }
1824
- var visuals = (_a = entityRegos.find(function (r) { return r.menuItemId === menuItemId; })) === null || _a === void 0 ? void 0 : _a.visual;
1825
- return visuals !== null && visuals !== void 0 ? visuals : [];
1823
+ return (_a = entityRegos.find(function (r) { return r.menuItemId === menuItemId; })) === null || _a === void 0 ? void 0 : _a.visual;
1824
+ };
1825
+ Register.prototype.GetMenuItemVisuals = function (menuItemId) {
1826
+ var visuals = [];
1827
+ for (var entityId in this.rego) {
1828
+ var entityRegos = this.rego[entityId];
1829
+ if (entityRegos) {
1830
+ var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId; });
1831
+ if (rego) {
1832
+ visuals.push(rego.visual);
1833
+ }
1834
+ }
1835
+ }
1836
+ return visuals;
1826
1837
  };
1827
1838
  Register.prototype.RemoveByEntityId = function (id) {
1828
1839
  var _a;
@@ -1951,7 +1962,7 @@ var EntitiesIdsRenderManager;
1951
1962
  };
1952
1963
  Manager.prototype.onGetterUpdate = function (entityIds) {
1953
1964
  return __awaiter(this, void 0, void 0, function () {
1954
- var entities, cEntities, i, id, cEntity, visuals;
1965
+ var entities, cEntities, i, id, cEntity, visual;
1955
1966
  return __generator(this, function (_a) {
1956
1967
  switch (_a.label) {
1957
1968
  case 0:
@@ -1976,8 +1987,8 @@ var EntitiesIdsRenderManager;
1976
1987
  cEntity = cEntities[id];
1977
1988
  this.renderedEntities[id] = !!cEntity;
1978
1989
  if (cEntity) {
1979
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
1980
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
1990
+ visual = this.visualsManager.GetVisual(id, this.item.id);
1991
+ if (!visual || visual != cEntity) {
1981
1992
  this.visualsManager.Add({
1982
1993
  entityId: id,
1983
1994
  menuItemId: this.item.id,
@@ -2049,7 +2060,7 @@ var EntityRenderManager;
2049
2060
  };
2050
2061
  Manager.prototype.onGetterUpdate = function (id) {
2051
2062
  return __awaiter(this, void 0, void 0, function () {
2052
- var entity, cEntities, cEntity, visuals;
2063
+ var entity, cEntities, cEntity, visual;
2053
2064
  return __generator(this, function (_a) {
2054
2065
  switch (_a.label) {
2055
2066
  case 0:
@@ -2071,8 +2082,8 @@ var EntityRenderManager;
2071
2082
  cEntities = _a.sent();
2072
2083
  cEntity = cEntities[id];
2073
2084
  if (cEntity) {
2074
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
2075
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
2085
+ visual = this.visualsManager.GetVisual(id, this.item.id);
2086
+ if (!visual || visual != cEntity) {
2076
2087
  this.visualsManager.Add({
2077
2088
  entityId: entity.Bruce.ID,
2078
2089
  menuItemId: this.item.id,