bruce-cesium 0.0.9 → 0.1.1

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.
@@ -678,8 +678,8 @@ 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
+ var _a;
682
+ return (_a = visualRegister.GetRego(entityId, menuItemId)) === null || _a === void 0 ? void 0 : _a.visual;
683
683
  }
684
684
  function getRenderGroupId(zoomItem) {
685
685
  if (!zoomItem) {
@@ -1431,10 +1431,11 @@ var EntitiesRenderManager;
1431
1431
  }
1432
1432
  };
1433
1433
  Manager.prototype.onGetterUpdate = function (entities) {
1434
+ var _a;
1434
1435
  return __awaiter(this, void 0, void 0, function () {
1435
- var cEntities, i, id, cEntity, visuals;
1436
- return __generator(this, function (_a) {
1437
- switch (_a.label) {
1436
+ var cEntities, i, id, cEntity, visual;
1437
+ return __generator(this, function (_b) {
1438
+ switch (_b.label) {
1438
1439
  case 0:
1439
1440
  if (this.disposed) {
1440
1441
  return [2 /*return*/];
@@ -1448,14 +1449,14 @@ var EntitiesRenderManager;
1448
1449
  zoomControl: this.item.CameraZoomSettings
1449
1450
  })];
1450
1451
  case 1:
1451
- cEntities = _a.sent();
1452
+ cEntities = _b.sent();
1452
1453
  for (i = 0; i < entities.length; i++) {
1453
1454
  id = entities[i].Bruce.ID;
1454
1455
  cEntity = cEntities[id];
1455
1456
  this.renderedEntities[id] = !!cEntity;
1456
1457
  if (cEntity) {
1457
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
1458
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
1458
+ visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
1459
+ if (!visual || visual != cEntity) {
1459
1460
  this.visualsManager.Add({
1460
1461
  entityId: id,
1461
1462
  menuItemId: this.item.id,
@@ -1529,10 +1530,11 @@ var EntitiesLoadedRenderManager;
1529
1530
  this.visualsManager.RemoveByMenuItemId(this.item.id);
1530
1531
  };
1531
1532
  Manager.prototype.onGetterUpdate = function (entities) {
1533
+ var _a;
1532
1534
  return __awaiter(this, void 0, void 0, function () {
1533
- var cEntities, i, id, cEntity, visuals;
1534
- return __generator(this, function (_a) {
1535
- switch (_a.label) {
1535
+ var cEntities, i, id, cEntity, visual;
1536
+ return __generator(this, function (_b) {
1537
+ switch (_b.label) {
1536
1538
  case 0:
1537
1539
  if (this.disposed) {
1538
1540
  return [2 /*return*/];
@@ -1546,14 +1548,14 @@ var EntitiesLoadedRenderManager;
1546
1548
  zoomControl: this.item.CameraZoomSettings
1547
1549
  })];
1548
1550
  case 1:
1549
- cEntities = _a.sent();
1551
+ cEntities = _b.sent();
1550
1552
  for (i = 0; i < entities.length; i++) {
1551
1553
  id = entities[i].Bruce.ID;
1552
1554
  cEntity = cEntities[id];
1553
1555
  this.renderedEntities[id] = !!cEntity;
1554
1556
  if (cEntity) {
1555
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
1556
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
1557
+ visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
1558
+ if (!visual || visual != cEntity) {
1557
1559
  this.visualsManager.Add({
1558
1560
  entityId: id,
1559
1561
  menuItemId: this.item.id,
@@ -1815,14 +1817,25 @@ var VisualsRegister;
1815
1817
  }
1816
1818
  (_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ rego: rego, isAdding: true });
1817
1819
  };
1818
- Register.prototype.GetVisuals = function (entityId, menuItemId) {
1819
- var _a;
1820
+ Register.prototype.GetRego = function (entityId, menuItemId) {
1820
1821
  var entityRegos = this.rego[entityId];
1821
1822
  if (!entityRegos) {
1822
1823
  return [];
1823
1824
  }
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 : [];
1825
+ return entityRegos.find(function (r) { return r.menuItemId === menuItemId; });
1826
+ };
1827
+ Register.prototype.GetMenuItemRegos = function (menuItemId) {
1828
+ var visuals = [];
1829
+ for (var entityId in this.rego) {
1830
+ var entityRegos = this.rego[entityId];
1831
+ if (entityRegos) {
1832
+ var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId; });
1833
+ if (rego) {
1834
+ visuals.push(rego);
1835
+ }
1836
+ }
1837
+ }
1838
+ return visuals;
1826
1839
  };
1827
1840
  Register.prototype.RemoveByEntityId = function (id) {
1828
1841
  var _a;
@@ -1950,17 +1963,18 @@ var EntitiesIdsRenderManager;
1950
1963
  this.visualsManager.RemoveByMenuItemId(this.item.id);
1951
1964
  };
1952
1965
  Manager.prototype.onGetterUpdate = function (entityIds) {
1966
+ var _a;
1953
1967
  return __awaiter(this, void 0, void 0, function () {
1954
- var entities, cEntities, i, id, cEntity, visuals;
1955
- return __generator(this, function (_a) {
1956
- switch (_a.label) {
1968
+ var entities, cEntities, i, id, cEntity, visual;
1969
+ return __generator(this, function (_b) {
1970
+ switch (_b.label) {
1957
1971
  case 0:
1958
1972
  if (this.disposed) {
1959
1973
  return [2 /*return*/];
1960
1974
  }
1961
1975
  return [4 /*yield*/, Entity$1.GetListByIds(this.api, entityIds)];
1962
1976
  case 1:
1963
- entities = _a.sent();
1977
+ entities = _b.sent();
1964
1978
  return [4 /*yield*/, EntityRenderEngine.Render({
1965
1979
  viewer: this.viewer,
1966
1980
  api: this.api,
@@ -1970,14 +1984,14 @@ var EntitiesIdsRenderManager;
1970
1984
  zoomControl: this.item.CameraZoomSettings
1971
1985
  })];
1972
1986
  case 2:
1973
- cEntities = _a.sent();
1987
+ cEntities = _b.sent();
1974
1988
  for (i = 0; i < entities.length; i++) {
1975
1989
  id = entities[i].Bruce.ID;
1976
1990
  cEntity = cEntities[id];
1977
1991
  this.renderedEntities[id] = !!cEntity;
1978
1992
  if (cEntity) {
1979
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
1980
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
1993
+ visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
1994
+ if (!visual || visual != cEntity) {
1981
1995
  this.visualsManager.Add({
1982
1996
  entityId: id,
1983
1997
  menuItemId: this.item.id,
@@ -2048,17 +2062,18 @@ var EntityRenderManager;
2048
2062
  this.visualsManager.RemoveByMenuItemId(this.item.id);
2049
2063
  };
2050
2064
  Manager.prototype.onGetterUpdate = function (id) {
2065
+ var _a;
2051
2066
  return __awaiter(this, void 0, void 0, function () {
2052
- var entity, cEntities, cEntity, visuals;
2053
- return __generator(this, function (_a) {
2054
- switch (_a.label) {
2067
+ var entity, cEntities, cEntity, visual;
2068
+ return __generator(this, function (_b) {
2069
+ switch (_b.label) {
2055
2070
  case 0:
2056
2071
  if (this.disposed) {
2057
2072
  return [2 /*return*/];
2058
2073
  }
2059
2074
  return [4 /*yield*/, Entity$1.Get(this.api, id)];
2060
2075
  case 1:
2061
- entity = _a.sent();
2076
+ entity = _b.sent();
2062
2077
  return [4 /*yield*/, EntityRenderEngine.Render({
2063
2078
  viewer: this.viewer,
2064
2079
  api: this.api,
@@ -2068,11 +2083,11 @@ var EntityRenderManager;
2068
2083
  zoomControl: this.item.CameraZoomSettings
2069
2084
  })];
2070
2085
  case 2:
2071
- cEntities = _a.sent();
2086
+ cEntities = _b.sent();
2072
2087
  cEntity = cEntities[id];
2073
2088
  if (cEntity) {
2074
- visuals = this.visualsManager.GetVisuals(id, this.item.id);
2075
- if (visuals.length != 1 || (visuals.length > 0 && visuals[0] != cEntity)) {
2089
+ visual = (_a = this.visualsManager.GetRego(id, this.item.id)) === null || _a === void 0 ? void 0 : _a.visual;
2090
+ if (!visual || visual != cEntity) {
2076
2091
  this.visualsManager.Add({
2077
2092
  entityId: entity.Bruce.ID,
2078
2093
  menuItemId: this.item.id,