bruce-cesium 3.7.2 → 3.7.4

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.
@@ -55,6 +55,8 @@ var render_manager_1 = require("./render-managers/render-manager");
55
55
  var js_utils_1 = require("../internal/js-utils");
56
56
  var visual_register_culler_1 = require("./visual-register-culler");
57
57
  var limited_log_1 = require("../internal/limited-log");
58
+ var cesium_entity_styler_1 = require("../utils/cesium-entity-styler");
59
+ var cesium_animated_property_1 = require("./cesium-animated-property");
58
60
  function colorToCColor(color) {
59
61
  return new Cesium.Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
60
62
  }
@@ -450,7 +452,7 @@ var POINT_BILLBOARD_PADDING = 1;
450
452
  var createCircleBillboard = function (size, colorCss) {
451
453
  var key = size + "-" + colorCss;
452
454
  var cacheData = _billboardCache.Get(key);
453
- if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvas) instanceof HTMLCanvasElement) {
455
+ if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) && typeof (cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) == "string") {
454
456
  return cacheData;
455
457
  }
456
458
  // Slight padding to avoid corners clipping.
@@ -464,7 +466,7 @@ var createCircleBillboard = function (size, colorCss) {
464
466
  context.fillStyle = colorCss;
465
467
  context.fill();
466
468
  var data = {
467
- canvas: canvas,
469
+ canvasDataUri: canvas.toDataURL("image/png"),
468
470
  colorCss: colorCss,
469
471
  size: size,
470
472
  height: canvasSize,
@@ -499,7 +501,7 @@ var createImageBillboard = function (url) {
499
501
  var context = canvas_1.getContext("2d");
500
502
  context.drawImage(image_1, 0, 0);
501
503
  var data = {
502
- canvas: canvas_1,
504
+ canvasDataUri: canvas_1.toDataURL("image/png"),
503
505
  height: image_1.height
504
506
  };
505
507
  res(data);
@@ -617,7 +619,7 @@ var EntityRenderEngine;
617
619
  function Render(params) {
618
620
  var _a, _b, _c, _d, _e, _f, _g, _h;
619
621
  return __awaiter(this, void 0, void 0, function () {
620
- var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, newRenderId, existingRego, oldRenderId, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
622
+ var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
621
623
  return __generator(this, function (_j) {
622
624
  switch (_j.label) {
623
625
  case 0:
@@ -661,16 +663,23 @@ var EntityRenderEngine;
661
663
  displayType = bruce_models_1.ZoomControl.EDisplayType.Geometry;
662
664
  }
663
665
  if (displayType != bruce_models_1.ZoomControl.EDisplayType.Hidden) {
664
- newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
665
666
  existingRego = params.visualRegister.GetRego({
666
667
  entityId: id,
667
668
  menuItemId: params.menuItemId
668
669
  });
670
+ newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
669
671
  oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
670
672
  if (!params.force && newRenderId == oldRenderId && !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale)) {
673
+ // No sorting category needed. Already rendered the way we want.
671
674
  cEntities[id] = existingRego.visual;
672
675
  }
673
676
  else {
677
+ // Add so we can re-use the graphic and update it.
678
+ if (existingRego && newRenderId == oldRenderId) {
679
+ cEntities[id] = existingRego.visual;
680
+ // Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
681
+ existingRego.stale = false;
682
+ }
674
683
  if (displayType == bruce_models_1.ZoomControl.EDisplayType.Model3D) {
675
684
  models.push(entity);
676
685
  }
@@ -690,7 +699,7 @@ var EntityRenderEngine;
690
699
  }
691
700
  }
692
701
  if (!(models.length > 0)) return [3 /*break*/, 2];
693
- mParams = __assign(__assign({}, groupRenderParams), { entities: models });
702
+ mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
694
703
  return [4 /*yield*/, Model3d.RenderGroup(mParams)];
695
704
  case 1:
696
705
  mEntities = _j.sent();
@@ -718,7 +727,7 @@ var EntityRenderEngine;
718
727
  polygons.push(entity);
719
728
  return [2 /*return*/, "continue"];
720
729
  }
721
- pParams = __assign(__assign({}, groupRenderParams), { entities: [] });
730
+ pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
722
731
  zoomItem = pParams.zoomItems[entity.Bruce.ID];
723
732
  for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
724
733
  subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: bruce_models_1.ObjectUtils.UId() }) });
@@ -787,7 +796,7 @@ var EntityRenderEngine;
787
796
  return [3 /*break*/, 3];
788
797
  case 6:
789
798
  if (!(polygons.length > 0)) return [3 /*break*/, 8];
790
- pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
799
+ pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
791
800
  return [4 /*yield*/, Polygon.RenderGroup(pParams)];
792
801
  case 7:
793
802
  pEntities = _j.sent();
@@ -804,7 +813,7 @@ var EntityRenderEngine;
804
813
  _j.label = 8;
805
814
  case 8:
806
815
  if (!(polylines.length > 0)) return [3 /*break*/, 10];
807
- pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
816
+ pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
808
817
  return [4 /*yield*/, Polyline.RenderGroup(pParams)];
809
818
  case 9:
810
819
  pEntities = _j.sent();
@@ -821,7 +830,7 @@ var EntityRenderEngine;
821
830
  _j.label = 10;
822
831
  case 10:
823
832
  if (!(points.length > 0)) return [3 /*break*/, 12];
824
- pParams = __assign(__assign({}, groupRenderParams), { entities: points });
833
+ pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
825
834
  return [4 /*yield*/, Point.RenderGroup(pParams)];
826
835
  case 11:
827
836
  pEntities = _j.sent();
@@ -885,11 +894,11 @@ var EntityRenderEngine;
885
894
  }
886
895
  Point.CreateCircleBillboard = CreateCircleBillboard;
887
896
  function Render(params) {
888
- var _a, _b;
897
+ var _a, _b, _c, _d;
889
898
  return __awaiter(this, void 0, void 0, function () {
890
- var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, outlineExtrusion, bColor, cColor, size, heightRef, circleBillboard, disableDepthTest;
891
- return __generator(this, function (_c) {
892
- switch (_c.label) {
899
+ var entity, style, type, cEntity, siblings, prepareExistingGraphic, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor_1, heightRef, currentImgKey, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, hasOutline, outlineExtrusion, outlineEntity, bColor, cColor, size, heightRef, circleBillboard, disableDepthTest, imgKey, currentImgKey;
900
+ return __generator(this, function (_e) {
901
+ switch (_e.label) {
893
902
  case 0:
894
903
  entity = params.entity;
895
904
  style = params.style;
@@ -902,6 +911,27 @@ var EntityRenderEngine;
902
911
  }
903
912
  cEntity = null;
904
913
  siblings = [];
914
+ prepareExistingGraphic = function (cEntity, siblings) {
915
+ if (siblings === void 0) { siblings = 0; }
916
+ // Gather entity in case previous version had sibling graphics we no longer need.
917
+ var parts = entity_utils_1.EntityUtils.GatherEntity({
918
+ entity: cEntity,
919
+ });
920
+ if (parts.length > 1) {
921
+ // We'll cull all except the allowed number of siblings.
922
+ cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
923
+ // We'll remove all that aren't in the allowed (direct) list.
924
+ for (var i = 0; i < parts.length - 1; i++) {
925
+ var part = parts[i];
926
+ if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
927
+ params.viewer.entities.remove(part);
928
+ }
929
+ }
930
+ if (cEntity._parentEntity) {
931
+ console.warn("Point.Render: Parent entity was not null. This should not happen.");
932
+ }
933
+ }
934
+ };
905
935
  if (!(type == bruce_models_1.Style.EPointType.Icon)) return [3 /*break*/, 9];
906
936
  iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
907
937
  iconUrlRows.forEach(function (row) {
@@ -918,36 +948,36 @@ var EntityRenderEngine;
918
948
  api = params.apiGetter.getApi(metadata.accountId);
919
949
  return [4 /*yield*/, api.Loading];
920
950
  case 1:
921
- _c.sent();
951
+ _e.sent();
922
952
  iconUrl = bruce_models_1.ClientFile.GetUrl({
923
953
  api: api,
924
954
  fileId: metadata.fileId,
925
955
  viaCdn: true
926
956
  });
927
- _c.label = 2;
957
+ _e.label = 2;
928
958
  case 2:
929
959
  if (!(!iconUrl && style.iconId)) return [3 /*break*/, 4];
930
960
  return [4 /*yield*/, params.api.Loading];
931
961
  case 3:
932
- _c.sent();
962
+ _e.sent();
933
963
  iconUrl = bruce_models_1.ClientFile.GetUrl({
934
964
  api: params.api,
935
965
  fileId: style.iconId,
936
966
  viaCdn: true
937
967
  });
938
- _c.label = 4;
968
+ _e.label = 4;
939
969
  case 4:
940
970
  image = null;
941
971
  if (!iconUrl) return [3 /*break*/, 8];
942
- _c.label = 5;
972
+ _e.label = 5;
943
973
  case 5:
944
- _c.trys.push([5, 7, , 8]);
974
+ _e.trys.push([5, 7, , 8]);
945
975
  return [4 /*yield*/, createImageBillboard(iconUrl)];
946
976
  case 6:
947
- image = _c.sent();
977
+ image = _e.sent();
948
978
  return [3 /*break*/, 8];
949
979
  case 7:
950
- e_5 = _c.sent();
980
+ e_5 = _e.sent();
951
981
  // Expanding the logging here so we can figure out why this is happening.
952
982
  // Most of the time the file is missing but we're getting some strange errors so I am including logging on the API settings as well.
953
983
  (0, limited_log_1.OneTimeError)("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
@@ -966,34 +996,64 @@ var EntityRenderEngine;
966
996
  disableDepthTest = Boolean(style.renderOnTop);
967
997
  if (iconScale > 0) {
968
998
  bColor = style.iconTintColor ? bruce_models_1.Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
969
- cColor = bColor ? colorToCColor(bColor) : undefined;
999
+ cColor_1 = bColor ? colorToCColor(bColor) : undefined;
970
1000
  heightRef = getHeightRef(style);
971
- cEntity = new Cesium.Entity({
972
- id: bruce_models_1.ObjectUtils.UId(10),
973
- billboard: {
974
- horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
975
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
976
- image: image.canvas,
977
- heightReference: getHeightRef(style),
978
- scale: iconScale,
979
- disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
980
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
981
- color: cColor
982
- // Would be great once we have a setting for this.
983
- // translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
984
- },
985
- position: entity_utils_1.EntityUtils.GetPos({
1001
+ if (!params.rendered || !params.rendered.billboard) {
1002
+ cEntity = new Cesium.Entity({
1003
+ id: bruce_models_1.ObjectUtils.UId(10),
1004
+ billboard: {
1005
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
1006
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
1007
+ image: image.canvasDataUri,
1008
+ heightReference: getHeightRef(style),
1009
+ scale: iconScale,
1010
+ disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
1011
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
1012
+ color: new Cesium.CallbackProperty(function () { return cColor_1; }, true),
1013
+ // Would be great once we have a setting for this.
1014
+ // translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
1015
+ },
1016
+ position: entity_utils_1.EntityUtils.GetPos({
1017
+ viewer: params.viewer,
1018
+ entity: entity,
1019
+ recordHeightRef: heightRef,
1020
+ returnHeightRef: heightRef
1021
+ }),
1022
+ show: true
1023
+ });
1024
+ }
1025
+ else {
1026
+ prepareExistingGraphic(params.rendered);
1027
+ cEntity = params.rendered;
1028
+ currentImgKey = cEntity.billboard._billboardImgKey;
1029
+ if (currentImgKey != iconUrl) {
1030
+ cEntity.billboard.image = new Cesium.ConstantProperty(image.canvasDataUri);
1031
+ }
1032
+ cEntity.billboard.scale = new Cesium.ConstantProperty(iconScale);
1033
+ cEntity.billboard.heightReference = new Cesium.ConstantProperty(getHeightRef(style));
1034
+ cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
1035
+ cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
1036
+ cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
986
1037
  viewer: params.viewer,
987
1038
  entity: entity,
988
1039
  recordHeightRef: heightRef,
989
1040
  returnHeightRef: heightRef
990
- }),
991
- show: true
992
- });
1041
+ }));
1042
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
1043
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
1044
+ color: cColor_1,
1045
+ entity: cEntity,
1046
+ viewer: params.viewer,
1047
+ override: true,
1048
+ requestRender: false
1049
+ });
1050
+ cEntity.show = true;
1051
+ }
993
1052
  cEntity.billboard._billboardSize = image.height;
1053
+ cEntity.billboard._billboardImgKey = iconUrl;
994
1054
  }
995
1055
  }
996
- _c.label = 9;
1056
+ _e.label = 9;
997
1057
  case 9:
998
1058
  if (type == bruce_models_1.Style.EPointType.Cylinder) {
999
1059
  radius = (0, js_utils_1.EnsureNumber)(bruce_models_1.Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
@@ -1018,46 +1078,97 @@ var EntityRenderEngine;
1018
1078
  returnHeightRef: heightRef
1019
1079
  });
1020
1080
  extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
1021
- cEntity = new Cesium.Entity({
1022
- id: bruce_models_1.ObjectUtils.UId(10),
1023
- ellipse: {
1024
- semiMajorAxis: radius,
1025
- semiMinorAxis: radius,
1026
- material: cFill,
1027
- outlineWidth: null,
1028
- extrudedHeight: extrusion.value,
1029
- heightReference: heightRef,
1030
- extrudedHeightReference: extrusion.exHeightRef,
1031
- height: Cesium.Cartographic.fromCartesian(pos3d).height,
1032
- zIndex: 1,
1033
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1034
- },
1035
- position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
1036
- show: true
1037
- });
1038
- if (outline && outlineWidth > 0) {
1039
- outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
1040
- // If this doesn't have its own extrusion, we must make it match the sibling.
1041
- // This way they render in a uniform way.
1042
- if (!outlineExtrusion.value && extrusion.value) {
1043
- outlineExtrusion.exHeightRef = extrusion.exHeightRef;
1044
- }
1045
- siblings.push(new Cesium.Entity({
1081
+ hasOutline = outline && outlineWidth > 0;
1082
+ if (!params.rendered || !params.rendered.ellipse) {
1083
+ cEntity = new Cesium.Entity({
1046
1084
  id: bruce_models_1.ObjectUtils.UId(10),
1047
1085
  ellipse: {
1048
- semiMajorAxis: radius + outlineWidth,
1049
- semiMinorAxis: radius + outlineWidth,
1050
- material: cOutline,
1051
- outlineWidth: undefined,
1052
- extrudedHeight: outlineExtrusion.value,
1086
+ semiMajorAxis: radius,
1087
+ semiMinorAxis: radius,
1088
+ material: cFill,
1089
+ outlineWidth: null,
1090
+ extrudedHeight: extrusion.value,
1053
1091
  heightReference: heightRef,
1054
- extrudedHeightReference: outlineExtrusion.exHeightRef,
1092
+ extrudedHeightReference: extrusion.exHeightRef,
1055
1093
  height: Cesium.Cartographic.fromCartesian(pos3d).height,
1056
- zIndex: 2,
1094
+ zIndex: 1,
1057
1095
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1058
1096
  },
1059
- position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
1060
- }));
1097
+ position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
1098
+ show: true
1099
+ });
1100
+ }
1101
+ else {
1102
+ prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
1103
+ cEntity = params.rendered;
1104
+ cEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius);
1105
+ cEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius);
1106
+ cEntity.ellipse.outlineWidth = undefined;
1107
+ cEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
1108
+ cEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
1109
+ cEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
1110
+ cEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
1111
+ cEntity.ellipse.zIndex = new Cesium.ConstantProperty(1);
1112
+ cEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
1113
+ cEntity.position = new Cesium.ConstantPositionProperty(pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone());
1114
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
1115
+ // WARNING: ellipse does not support animation (yet?).
1116
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
1117
+ color: cFill,
1118
+ entity: cEntity,
1119
+ viewer: params.viewer,
1120
+ override: true,
1121
+ requestRender: false
1122
+ });
1123
+ cEntity.show = true;
1124
+ }
1125
+ if (hasOutline) {
1126
+ outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
1127
+ // If this doesn't have its own extrusion, we must make it match the sibling.
1128
+ // This way they render in a uniform way.
1129
+ if (!outlineExtrusion.value && extrusion.value) {
1130
+ outlineExtrusion.exHeightRef = extrusion.exHeightRef;
1131
+ }
1132
+ outlineEntity = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
1133
+ if (outlineEntity && outlineEntity.ellipse) {
1134
+ outlineEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
1135
+ outlineEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
1136
+ outlineEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(outlineExtrusion.value);
1137
+ outlineEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
1138
+ outlineEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(outlineExtrusion.exHeightRef);
1139
+ outlineEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
1140
+ outlineEntity.ellipse.zIndex = new Cesium.ConstantProperty(2);
1141
+ outlineEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
1142
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
1143
+ // WARNING: ellipse does not support animation (yet?).
1144
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
1145
+ color: cOutline,
1146
+ entity: outlineEntity,
1147
+ viewer: params.viewer,
1148
+ override: true,
1149
+ requestRender: false
1150
+ });
1151
+ outlineEntity.show = true;
1152
+ }
1153
+ else {
1154
+ outlineEntity = new Cesium.Entity({
1155
+ id: bruce_models_1.ObjectUtils.UId(10),
1156
+ ellipse: {
1157
+ semiMajorAxis: radius + outlineWidth,
1158
+ semiMinorAxis: radius + outlineWidth,
1159
+ material: cOutline,
1160
+ outlineWidth: undefined,
1161
+ extrudedHeight: outlineExtrusion.value,
1162
+ heightReference: heightRef,
1163
+ extrudedHeightReference: outlineExtrusion.exHeightRef,
1164
+ height: Cesium.Cartographic.fromCartesian(pos3d).height,
1165
+ zIndex: 2,
1166
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1167
+ },
1168
+ position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
1169
+ });
1170
+ }
1171
+ siblings.push(outlineEntity);
1061
1172
  }
1062
1173
  }
1063
1174
  if (!cEntity) {
@@ -1074,33 +1185,66 @@ var EntityRenderEngine;
1074
1185
  heightRef = getHeightRef(style);
1075
1186
  circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
1076
1187
  disableDepthTest = Boolean(style.renderOnTop);
1077
- cEntity = new Cesium.Entity({
1078
- id: bruce_models_1.ObjectUtils.UId(10),
1079
- // point: {
1080
- // pixelSize: size,
1081
- // color: cColor,
1082
- // heightReference: getHeightRef(style),
1083
- // distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1084
- // },
1085
- // We are generating a billboard instead of using the point.
1086
- // This is because points were behaving strangely where they would appear oblong shapes.
1087
- // This occurred consistently when rendering many icons and points at the same time.
1088
- billboard: {
1089
- height: circleBillboard.height,
1090
- width: circleBillboard.width,
1091
- image: circleBillboard.canvas,
1092
- heightReference: heightRef,
1093
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
1094
- disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
1095
- },
1096
- position: entity_utils_1.EntityUtils.GetPos({
1188
+ if (!params.rendered || !params.rendered.billboard) {
1189
+ cEntity = new Cesium.Entity({
1190
+ id: bruce_models_1.ObjectUtils.UId(10),
1191
+ // point: {
1192
+ // pixelSize: size,
1193
+ // color: cColor,
1194
+ // heightReference: getHeightRef(style),
1195
+ // distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1196
+ // },
1197
+ // We are generating a billboard instead of using the point.
1198
+ // This is because points were behaving strangely where they would appear oblong shapes.
1199
+ // This occurred consistently when rendering many icons and points at the same time.
1200
+ billboard: {
1201
+ height: circleBillboard.height,
1202
+ width: circleBillboard.width,
1203
+ image: circleBillboard.canvasDataUri,
1204
+ color: new Cesium.CallbackProperty(function () { return undefined; }, true),
1205
+ heightReference: heightRef,
1206
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
1207
+ disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
1208
+ },
1209
+ position: entity_utils_1.EntityUtils.GetPos({
1210
+ viewer: params.viewer,
1211
+ entity: entity,
1212
+ recordHeightRef: heightRef,
1213
+ returnHeightRef: heightRef
1214
+ }),
1215
+ show: true
1216
+ });
1217
+ }
1218
+ else {
1219
+ prepareExistingGraphic(params.rendered);
1220
+ cEntity = params.rendered;
1221
+ imgKey = "".concat(size, "-").concat(cColor.toCssColorString());
1222
+ currentImgKey = cEntity.billboard._billboardImgKey;
1223
+ if (currentImgKey != imgKey) {
1224
+ cEntity.billboard.image = new Cesium.ConstantProperty(circleBillboard.canvasDataUri);
1225
+ }
1226
+ cEntity.billboard.height = new Cesium.ConstantProperty(circleBillboard.height);
1227
+ cEntity.billboard.width = new Cesium.ConstantProperty(circleBillboard.width);
1228
+ cEntity.billboard.heightReference = new Cesium.ConstantProperty(heightRef);
1229
+ cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
1230
+ cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
1231
+ cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
1097
1232
  viewer: params.viewer,
1098
1233
  entity: entity,
1099
1234
  recordHeightRef: heightRef,
1100
1235
  returnHeightRef: heightRef
1101
- }),
1102
- show: true
1103
- });
1236
+ }));
1237
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
1238
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
1239
+ color: cColor,
1240
+ entity: cEntity,
1241
+ viewer: params.viewer,
1242
+ override: true,
1243
+ requestRender: false
1244
+ });
1245
+ cEntity.show = true;
1246
+ cEntity.billboard._billboardImgKey = imgKey;
1247
+ }
1104
1248
  cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
1105
1249
  }
1106
1250
  if (cEntity) {
@@ -1113,16 +1257,16 @@ var EntityRenderEngine;
1113
1257
  }
1114
1258
  Point.Render = Render;
1115
1259
  function RenderGroup(params) {
1116
- var _a, _b, _c;
1260
+ var _a, _b, _c, _d;
1117
1261
  return __awaiter(this, void 0, void 0, function () {
1118
- var api, cEntities, i, entity, zoomItem, style, _d, tagIds, tags, pStyle, cEntity, name_2;
1119
- return __generator(this, function (_e) {
1120
- switch (_e.label) {
1262
+ var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_2;
1263
+ return __generator(this, function (_f) {
1264
+ switch (_f.label) {
1121
1265
  case 0:
1122
1266
  api = params.apiGetter.getApi();
1123
1267
  cEntities = {};
1124
1268
  i = 0;
1125
- _e.label = 1;
1269
+ _f.label = 1;
1126
1270
  case 1:
1127
1271
  if (!(i < params.entities.length)) return [3 /*break*/, 11];
1128
1272
  entity = params.entities[i];
@@ -1130,13 +1274,13 @@ var EntityRenderEngine;
1130
1274
  if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
1131
1275
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
1132
1276
  case 2:
1133
- _d = (_a = (_e.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1277
+ _e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1134
1278
  return [3 /*break*/, 4];
1135
1279
  case 3:
1136
- _d = zoomItem.Style;
1137
- _e.label = 4;
1280
+ _e = zoomItem.Style;
1281
+ _f.label = 4;
1138
1282
  case 4:
1139
- style = _d;
1283
+ style = _e;
1140
1284
  tagIds = entity.Bruce["Layer.ID"];
1141
1285
  tags = [];
1142
1286
  if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
@@ -1145,8 +1289,8 @@ var EntityRenderEngine;
1145
1289
  tagIds: tagIds
1146
1290
  })];
1147
1291
  case 5:
1148
- tags = (_e.sent()).tags;
1149
- _e.label = 6;
1292
+ tags = (_f.sent()).tags;
1293
+ _f.label = 6;
1150
1294
  case 6:
1151
1295
  pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
1152
1296
  return [4 /*yield*/, Render({
@@ -1157,20 +1301,21 @@ var EntityRenderEngine;
1157
1301
  api: api,
1158
1302
  apiGetter: params.apiGetter,
1159
1303
  maxDistance: zoomItem.MaxZoom,
1160
- minDistance: zoomItem.MinZoom
1304
+ minDistance: zoomItem.MinZoom,
1305
+ rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
1161
1306
  })];
1162
1307
  case 7:
1163
- cEntity = _e.sent();
1308
+ cEntity = _f.sent();
1164
1309
  if (!cEntity) return [3 /*break*/, 9];
1165
1310
  return [4 /*yield*/, getName(api, entity)];
1166
1311
  case 8:
1167
- name_2 = _e.sent();
1312
+ name_2 = _f.sent();
1168
1313
  cEntity.name = name_2;
1169
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
1170
- _e.label = 9;
1314
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
1315
+ _f.label = 9;
1171
1316
  case 9:
1172
1317
  cEntities[entity.Bruce.ID] = cEntity;
1173
- _e.label = 10;
1318
+ _f.label = 10;
1174
1319
  case 10:
1175
1320
  i++;
1176
1321
  return [3 /*break*/, 1];
@@ -1255,52 +1400,110 @@ var EntityRenderEngine;
1255
1400
  if (style.drapeOver == "ALL") {
1256
1401
  classification = Cesium.ClassificationType.BOTH;
1257
1402
  }
1258
- var cEntity = new Cesium.Entity({
1259
- id: bruce_models_1.ObjectUtils.UId(10),
1260
- polyline: units == "px" ? {
1261
- positions: posses,
1262
- material: cColor,
1263
- width: width,
1264
- classificationType: classification,
1265
- arcType: Cesium.ArcType.GEODESIC,
1266
- zIndex: getZIndex(style, entity, params.tags),
1267
- clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
1268
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1269
- } : null,
1270
- corridor: units == "m" ? {
1271
- positions: posses,
1272
- material: cColor,
1273
- width: width,
1274
- classificationType: classification,
1275
- heightReference: heightRef,
1276
- zIndex: getZIndex(style, entity, params.tags),
1277
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
1278
- cornerType: Cesium.CornerType.MITERED,
1279
- shadows: Cesium.ShadowMode.ENABLED,
1280
- fill: true
1281
- } : null,
1282
- position: entity_utils_1.EntityUtils.GetPos({
1403
+ var cEntity = null;
1404
+ if (!params.rendered || ((!params.rendered.polyline && units == "px") ||
1405
+ (!params.rendered.corridor && units == "m"))) {
1406
+ cEntity = new Cesium.Entity({
1407
+ id: bruce_models_1.ObjectUtils.UId(10),
1408
+ polyline: units == "px" ? {
1409
+ positions: posses,
1410
+ material: cColor,
1411
+ width: width,
1412
+ classificationType: classification,
1413
+ arcType: Cesium.ArcType.GEODESIC,
1414
+ zIndex: getZIndex(style, entity, params.tags),
1415
+ clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
1416
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1417
+ } : null,
1418
+ corridor: units == "m" ? {
1419
+ positions: posses,
1420
+ material: cColor,
1421
+ width: width,
1422
+ classificationType: classification,
1423
+ heightReference: heightRef,
1424
+ zIndex: getZIndex(style, entity, params.tags),
1425
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
1426
+ cornerType: Cesium.CornerType.MITERED,
1427
+ shadows: Cesium.ShadowMode.ENABLED,
1428
+ fill: true
1429
+ } : null,
1430
+ position: entity_utils_1.EntityUtils.GetPos({
1431
+ viewer: params.viewer,
1432
+ entity: entity,
1433
+ recordHeightRef: heightRef,
1434
+ returnHeightRef: heightRef
1435
+ }),
1436
+ show: true
1437
+ });
1438
+ }
1439
+ else {
1440
+ // Gather entity in case previous version had sibling graphics we no longer need.
1441
+ var parts = entity_utils_1.EntityUtils.GatherEntity({
1442
+ entity: cEntity,
1443
+ });
1444
+ if (parts.length > 1) {
1445
+ // Kill all expect last part. Last one is the primary entity.
1446
+ for (var i = 0; i < parts.length - 1; i++) {
1447
+ var part = parts[i];
1448
+ if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
1449
+ params.viewer.entities.remove(part);
1450
+ }
1451
+ }
1452
+ cEntity._siblingGraphics = [];
1453
+ if (cEntity._parentEntity) {
1454
+ console.warn("Polyline.Render: Parent entity was not null. This should not happen.");
1455
+ }
1456
+ }
1457
+ cEntity = params.rendered;
1458
+ if (units == "px") {
1459
+ cEntity.polyline.positions = new Cesium.ConstantProperty(posses);
1460
+ cEntity.polyline.width = new Cesium.ConstantProperty(width);
1461
+ cEntity.polyline.classificationType = new Cesium.ConstantProperty(classification);
1462
+ cEntity.polyline.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
1463
+ cEntity.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
1464
+ cEntity.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
1465
+ cEntity.corridor = undefined;
1466
+ }
1467
+ else {
1468
+ cEntity.corridor.positions = new Cesium.ConstantProperty(posses);
1469
+ cEntity.corridor.width = new Cesium.ConstantProperty(width);
1470
+ cEntity.corridor.classificationType = new Cesium.ConstantProperty(classification);
1471
+ cEntity.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
1472
+ cEntity.corridor.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
1473
+ cEntity.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
1474
+ cEntity.polyline = undefined;
1475
+ }
1476
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
1477
+ // WARNING: polyline does not support animation (yet?).
1478
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
1479
+ color: cColor,
1480
+ entity: cEntity,
1481
+ viewer: params.viewer,
1482
+ override: true,
1483
+ requestRender: false
1484
+ });
1485
+ cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
1283
1486
  viewer: params.viewer,
1284
1487
  entity: entity,
1285
1488
  recordHeightRef: heightRef,
1286
1489
  returnHeightRef: heightRef
1287
- }),
1288
- show: true
1289
- });
1490
+ }));
1491
+ cEntity.show = true;
1492
+ }
1290
1493
  return cEntity;
1291
1494
  }
1292
1495
  Polyline.Render = Render;
1293
1496
  function RenderGroup(params) {
1294
- var _a, _b, _c;
1497
+ var _a, _b, _c, _d;
1295
1498
  return __awaiter(this, void 0, void 0, function () {
1296
- var api, cEntities, i, entity, zoomItem, style, _d, tagIds, tags, lStyle, cEntity, name_3;
1297
- return __generator(this, function (_e) {
1298
- switch (_e.label) {
1499
+ var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, lStyle, cEntity, name_3;
1500
+ return __generator(this, function (_f) {
1501
+ switch (_f.label) {
1299
1502
  case 0:
1300
1503
  api = params.apiGetter.getApi();
1301
1504
  cEntities = {};
1302
1505
  i = 0;
1303
- _e.label = 1;
1506
+ _f.label = 1;
1304
1507
  case 1:
1305
1508
  if (!(i < params.entities.length)) return [3 /*break*/, 9];
1306
1509
  entity = params.entities[i];
@@ -1308,13 +1511,13 @@ var EntityRenderEngine;
1308
1511
  if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
1309
1512
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
1310
1513
  case 2:
1311
- _d = (_a = (_e.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1514
+ _e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1312
1515
  return [3 /*break*/, 4];
1313
1516
  case 3:
1314
- _d = zoomItem.Style;
1315
- _e.label = 4;
1517
+ _e = zoomItem.Style;
1518
+ _f.label = 4;
1316
1519
  case 4:
1317
- style = _d;
1520
+ style = _e;
1318
1521
  tagIds = entity.Bruce["Layer.ID"];
1319
1522
  tags = [];
1320
1523
  if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
@@ -1323,8 +1526,8 @@ var EntityRenderEngine;
1323
1526
  tagIds: tagIds
1324
1527
  })];
1325
1528
  case 5:
1326
- tags = (_e.sent()).tags;
1327
- _e.label = 6;
1529
+ tags = (_f.sent()).tags;
1530
+ _f.label = 6;
1328
1531
  case 6:
1329
1532
  lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
1330
1533
  cEntity = Render({
@@ -1333,16 +1536,17 @@ var EntityRenderEngine;
1333
1536
  tags: tags,
1334
1537
  viewer: params.viewer,
1335
1538
  maxDistance: zoomItem.MaxZoom,
1336
- minDistance: zoomItem.MinZoom
1539
+ minDistance: zoomItem.MinZoom,
1540
+ rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
1337
1541
  });
1338
1542
  if (!cEntity) return [3 /*break*/, 8];
1339
1543
  return [4 /*yield*/, getName(api, entity)];
1340
1544
  case 7:
1341
- name_3 = _e.sent();
1545
+ name_3 = _f.sent();
1342
1546
  cEntity.name = name_3;
1343
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
1547
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
1344
1548
  cEntities[entity.Bruce.ID] = cEntity;
1345
- _e.label = 8;
1549
+ _f.label = 8;
1346
1550
  case 8:
1347
1551
  i++;
1348
1552
  return [3 /*break*/, 1];
@@ -1356,7 +1560,7 @@ var EntityRenderEngine;
1356
1560
  var Polygon;
1357
1561
  (function (Polygon) {
1358
1562
  function Render(params) {
1359
- var _a, _b;
1563
+ var _a, _b, _c, _d;
1360
1564
  var entity = params.entity;
1361
1565
  var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
1362
1566
  if (pRings == null || pRings.length <= 0) {
@@ -1413,30 +1617,85 @@ var EntityRenderEngine;
1413
1617
  if (style.drapeOver == "ALL") {
1414
1618
  classification = Cesium.ClassificationType.BOTH;
1415
1619
  }
1416
- var cEntity = new Cesium.Entity({
1417
- id: bruce_models_1.ObjectUtils.UId(10),
1418
- polygon: {
1419
- hierarchy: new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })),
1420
- material: cFillColor,
1421
- extrudedHeight: extrusion.value,
1422
- extrudedHeightReference: extrusion.exHeightRef,
1423
- shadows: Cesium.ShadowMode.ENABLED,
1424
- heightReference: heightRef,
1425
- classificationType: classification,
1426
- perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
1427
- zIndex: zIndex,
1428
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
1429
- },
1430
- position: entity_utils_1.EntityUtils.GetPos({
1620
+ var prepareExistingGraphic = function (cEntity, siblings) {
1621
+ if (siblings === void 0) { siblings = 0; }
1622
+ // Gather entity in case previous version had sibling graphics we no longer need.
1623
+ var parts = entity_utils_1.EntityUtils.GatherEntity({
1624
+ entity: cEntity,
1625
+ });
1626
+ if (parts.length > 1) {
1627
+ // We'll cull all except the allowed number of siblings.
1628
+ cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
1629
+ // We'll remove all that aren't in the allowed (direct) list.
1630
+ for (var i = 0; i < parts.length - 1; i++) {
1631
+ var part = parts[i];
1632
+ if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
1633
+ params.viewer.entities.remove(part);
1634
+ }
1635
+ }
1636
+ if (cEntity._parentEntity) {
1637
+ console.warn("Point.Render: Parent entity was not null. This should not happen.");
1638
+ }
1639
+ }
1640
+ };
1641
+ var hasOutline = width > 0 && cLineColor;
1642
+ var cEntity = null;
1643
+ if (!params.rendered || !params.rendered.polygon) {
1644
+ cEntity = new Cesium.Entity({
1645
+ id: bruce_models_1.ObjectUtils.UId(10),
1646
+ polygon: {
1647
+ hierarchy: new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })),
1648
+ material: cFillColor,
1649
+ extrudedHeight: extrusion.value,
1650
+ extrudedHeightReference: extrusion.exHeightRef,
1651
+ shadows: Cesium.ShadowMode.ENABLED,
1652
+ heightReference: heightRef,
1653
+ classificationType: classification,
1654
+ perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
1655
+ zIndex: zIndex,
1656
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
1657
+ },
1658
+ position: entity_utils_1.EntityUtils.GetPos({
1659
+ viewer: params.viewer,
1660
+ entity: entity,
1661
+ recordHeightRef: heightRef,
1662
+ returnHeightRef: heightRef
1663
+ }),
1664
+ show: true
1665
+ });
1666
+ }
1667
+ else {
1668
+ // Polygons can have more siblings for the related hole graphics.
1669
+ // So this is a "good enough" way rather than perfect as it only preserves the outline.
1670
+ prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
1671
+ cEntity = params.rendered;
1672
+ cEntity.polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })));
1673
+ cEntity.polygon.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
1674
+ cEntity.polygon.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
1675
+ cEntity.polygon.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
1676
+ cEntity.polygon.heightReference = new Cesium.ConstantProperty(heightRef);
1677
+ cEntity.polygon.classificationType = new Cesium.ConstantProperty(classification);
1678
+ cEntity.polygon.perPositionHeight = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true);
1679
+ cEntity.polygon.zIndex = new Cesium.ConstantProperty(zIndex);
1680
+ cEntity.polygon.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true));
1681
+ cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
1431
1682
  viewer: params.viewer,
1432
1683
  entity: entity,
1433
1684
  recordHeightRef: heightRef,
1434
1685
  returnHeightRef: heightRef
1435
- }),
1436
- show: true
1437
- });
1438
- cEntity._siblingGraphics = [];
1439
- if (width > 0 && cLineColor) {
1686
+ }));
1687
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
1688
+ // WARNING: polygon does not support animation (yet?).
1689
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
1690
+ color: cFillColor,
1691
+ entity: cEntity,
1692
+ viewer: params.viewer,
1693
+ override: true,
1694
+ requestRender: false
1695
+ });
1696
+ cEntity.show = true;
1697
+ }
1698
+ if (hasOutline) {
1440
1699
  var borderHeight = undefined;
1441
1700
  if (heightRef != Cesium.HeightReference.CLAMP_TO_GROUND) {
1442
1701
  if (flattenPoints) {
@@ -1460,33 +1719,62 @@ var EntityRenderEngine;
1460
1719
  else {
1461
1720
  borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
1462
1721
  }
1463
- var cEntityBorder = new Cesium.Entity({
1464
- id: bruce_models_1.ObjectUtils.UId(10),
1465
- polyline: units == "px" ? new Cesium.PolylineGraphics({
1466
- positions: borderPosses,
1467
- material: cLineColor,
1468
- width: width,
1469
- clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
1470
- classificationType: Cesium.ClassificationType.TERRAIN,
1471
- arcType: Cesium.ArcType.GEODESIC,
1472
- zIndex: zIndex,
1473
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1474
- }) : null,
1475
- corridor: units == "m" ? {
1476
- positions: borderPosses,
1477
- material: cLineColor,
1478
- heightReference: heightRef,
1479
- height: borderHeight,
1480
- width: width,
1481
- fill: true,
1482
- zIndex: zIndex + 1,
1483
- cornerType: Cesium.CornerType.MITERED,
1484
- classificationType: classification,
1485
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
1486
- shadows: Cesium.ShadowMode.ENABLED
1487
- } : null,
1488
- show: true
1489
- });
1722
+ var cEntityBorder = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
1723
+ cEntity._siblingGraphics = [];
1724
+ if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
1725
+ (!cEntityBorder.corridor && units == "m"))) {
1726
+ cEntityBorder = new Cesium.Entity({
1727
+ id: bruce_models_1.ObjectUtils.UId(10),
1728
+ polyline: units == "px" ? new Cesium.PolylineGraphics({
1729
+ positions: borderPosses,
1730
+ material: cLineColor,
1731
+ width: width,
1732
+ clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
1733
+ classificationType: Cesium.ClassificationType.TERRAIN,
1734
+ arcType: Cesium.ArcType.GEODESIC,
1735
+ zIndex: zIndex,
1736
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1737
+ }) : null,
1738
+ corridor: units == "m" ? {
1739
+ positions: borderPosses,
1740
+ material: cLineColor,
1741
+ heightReference: heightRef,
1742
+ height: borderHeight,
1743
+ width: width,
1744
+ fill: true,
1745
+ zIndex: zIndex + 1,
1746
+ cornerType: Cesium.CornerType.MITERED,
1747
+ classificationType: classification,
1748
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
1749
+ shadows: Cesium.ShadowMode.ENABLED
1750
+ } : null,
1751
+ show: true
1752
+ });
1753
+ }
1754
+ else {
1755
+ if (units == "px") {
1756
+ cEntityBorder.polyline.positions = new Cesium.ConstantProperty(borderPosses);
1757
+ cEntityBorder.polyline.width = new Cesium.ConstantProperty(width);
1758
+ cEntityBorder.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
1759
+ cEntityBorder.polyline.classificationType = new Cesium.ConstantProperty(Cesium.ClassificationType.TERRAIN);
1760
+ cEntityBorder.polyline.zIndex = new Cesium.ConstantProperty(zIndex);
1761
+ cEntityBorder.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
1762
+ cEntityBorder.polyline.material = new Cesium.ColorMaterialProperty(cLineColor);
1763
+ cEntityBorder.corridor = undefined;
1764
+ }
1765
+ else {
1766
+ cEntityBorder.corridor.positions = new Cesium.ConstantProperty(borderPosses);
1767
+ cEntityBorder.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
1768
+ cEntityBorder.corridor.height = new Cesium.ConstantProperty(borderHeight);
1769
+ cEntityBorder.corridor.width = new Cesium.ConstantProperty(width);
1770
+ cEntityBorder.corridor.fill = new Cesium.ConstantProperty(true);
1771
+ cEntityBorder.corridor.zIndex = new Cesium.ConstantProperty(zIndex + 1);
1772
+ cEntityBorder.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
1773
+ cEntityBorder.corridor.material = new Cesium.ColorMaterialProperty(cLineColor);
1774
+ cEntityBorder.polyline = undefined;
1775
+ }
1776
+ cEntityBorder.show = true;
1777
+ }
1490
1778
  cEntityBorder._parentEntity = cEntity;
1491
1779
  cEntity._siblingGraphics.push(cEntityBorder);
1492
1780
  for (var i = 0; i < holePosses.length; i++) {
@@ -1523,20 +1811,23 @@ var EntityRenderEngine;
1523
1811
  cEntityHole._parentEntity = cEntity;
1524
1812
  }
1525
1813
  }
1814
+ else {
1815
+ cEntity._siblingGraphics = [];
1816
+ }
1526
1817
  return cEntity;
1527
1818
  }
1528
1819
  Polygon.Render = Render;
1529
1820
  function RenderGroup(params) {
1530
- var _a, _b, _c;
1821
+ var _a, _b, _c, _d;
1531
1822
  return __awaiter(this, void 0, void 0, function () {
1532
- var api, cEntities, i, entity, zoomItem, style, _d, tagIds, tags, pStyle, cEntity, name_4;
1533
- return __generator(this, function (_e) {
1534
- switch (_e.label) {
1823
+ var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_4;
1824
+ return __generator(this, function (_f) {
1825
+ switch (_f.label) {
1535
1826
  case 0:
1536
1827
  api = params.apiGetter.getApi();
1537
1828
  cEntities = {};
1538
1829
  i = 0;
1539
- _e.label = 1;
1830
+ _f.label = 1;
1540
1831
  case 1:
1541
1832
  if (!(i < params.entities.length)) return [3 /*break*/, 9];
1542
1833
  entity = params.entities[i];
@@ -1544,13 +1835,13 @@ var EntityRenderEngine;
1544
1835
  if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
1545
1836
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
1546
1837
  case 2:
1547
- _d = (_a = (_e.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1838
+ _e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1548
1839
  return [3 /*break*/, 4];
1549
1840
  case 3:
1550
- _d = zoomItem.Style;
1551
- _e.label = 4;
1841
+ _e = zoomItem.Style;
1842
+ _f.label = 4;
1552
1843
  case 4:
1553
- style = _d;
1844
+ style = _e;
1554
1845
  tagIds = entity.Bruce["Layer.ID"];
1555
1846
  tags = [];
1556
1847
  if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
@@ -1559,8 +1850,8 @@ var EntityRenderEngine;
1559
1850
  tagIds: tagIds
1560
1851
  })];
1561
1852
  case 5:
1562
- tags = (_e.sent()).tags;
1563
- _e.label = 6;
1853
+ tags = (_f.sent()).tags;
1854
+ _f.label = 6;
1564
1855
  case 6:
1565
1856
  pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
1566
1857
  cEntity = Render({
@@ -1569,16 +1860,17 @@ var EntityRenderEngine;
1569
1860
  tags: tags,
1570
1861
  viewer: params.viewer,
1571
1862
  maxDistance: zoomItem.MaxZoom,
1572
- minDistance: zoomItem.MinZoom
1863
+ minDistance: zoomItem.MinZoom,
1864
+ rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
1573
1865
  });
1574
1866
  if (!cEntity) return [3 /*break*/, 8];
1575
1867
  return [4 /*yield*/, getName(api, entity)];
1576
1868
  case 7:
1577
- name_4 = _e.sent();
1869
+ name_4 = _f.sent();
1578
1870
  cEntity.name = name_4;
1579
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
1871
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
1580
1872
  cEntities[entity.Bruce.ID] = cEntity;
1581
- _e.label = 8;
1873
+ _f.label = 8;
1582
1874
  case 8:
1583
1875
  i++;
1584
1876
  return [3 /*break*/, 1];
@@ -1642,8 +1934,9 @@ var EntityRenderEngine;
1642
1934
  color = colorToCColor(bColor);
1643
1935
  }
1644
1936
  }
1645
- var cEntity = new Cesium.Entity({
1646
- id: bruce_models_1.ObjectUtils.UId(10),
1937
+ /*
1938
+ const cEntity: ICesiumEntityExt = new Cesium.Entity({
1939
+ id: ObjectUtils.UId(10),
1647
1940
  model: {
1648
1941
  uri: params.lodUrl,
1649
1942
  heightReference: heightRef,
@@ -1651,13 +1944,89 @@ var EntityRenderEngine;
1651
1944
  shadows: Cesium.ShadowMode.ENABLED,
1652
1945
  colorBlendAmount: blendAmount,
1653
1946
  colorBlendMode: blendMode,
1654
- color: color,
1947
+ color: new Cesium.CallbackProperty(() => color, true),
1655
1948
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1656
1949
  },
1657
1950
  orientation: new Cesium.ConstantProperty(orientation),
1658
1951
  position: pos,
1659
1952
  show: true
1660
1953
  });
1954
+ */
1955
+ var animateScale = null;
1956
+ var cEntity = params.rendered;
1957
+ if (!cEntity || !cEntity.model) {
1958
+ cEntity = new Cesium.Entity({
1959
+ id: bruce_models_1.ObjectUtils.UId(10),
1960
+ model: {
1961
+ uri: params.lodUrl,
1962
+ heightReference: heightRef,
1963
+ scale: new Cesium.CallbackProperty(function () { return scale * styleScale; }, true),
1964
+ shadows: Cesium.ShadowMode.ENABLED,
1965
+ colorBlendAmount: blendAmount,
1966
+ colorBlendMode: blendMode,
1967
+ color: new Cesium.CallbackProperty(function () { return color; }, true),
1968
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
1969
+ },
1970
+ orientation: new Cesium.ConstantProperty(orientation),
1971
+ position: pos,
1972
+ show: true
1973
+ });
1974
+ }
1975
+ else {
1976
+ // Gather entity in case previous version had sibling graphics we no longer need.
1977
+ var parts = entity_utils_1.EntityUtils.GatherEntity({
1978
+ entity: cEntity,
1979
+ });
1980
+ if (parts.length > 1) {
1981
+ // Kill all expect last part. Last one is the primary entity.
1982
+ for (var i = 0; i < parts.length - 1; i++) {
1983
+ var part = parts[i];
1984
+ if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
1985
+ params.viewer.entities.remove(part);
1986
+ }
1987
+ }
1988
+ cEntity._siblingGraphics = [];
1989
+ if (cEntity._parentEntity) {
1990
+ console.warn("Model3d.Render: Parent entity was not null. This should not happen.");
1991
+ }
1992
+ }
1993
+ var currentUri = getValue(params.viewer, cEntity.model.uri);
1994
+ if (currentUri != params.lodUrl) {
1995
+ cEntity.model.uri = new Cesium.ConstantProperty(params.lodUrl);
1996
+ }
1997
+ cEntity.model.heightReference = new Cesium.ConstantProperty(heightRef);
1998
+ cEntity.model.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
1999
+ cEntity.model.colorBlendAmount = new Cesium.ConstantProperty(blendAmount);
2000
+ cEntity.model.colorBlendMode = new Cesium.ConstantProperty(blendMode);
2001
+ cEntity.model.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
2002
+ cEntity.orientation = new Cesium.ConstantProperty(orientation);
2003
+ cEntity.position = new Cesium.ConstantPositionProperty(pos);
2004
+ // Same file but different scale. We'll animate the scale.
2005
+ var prevClientFileId = cEntity.model._clientFileId;
2006
+ if (prevClientFileId == params.lodClientFileId) {
2007
+ animateScale = new cesium_animated_property_1.CesiumAnimatedProperty.AnimateNumber({
2008
+ durationMs: 200,
2009
+ value: scale * styleScale,
2010
+ viewer: params.viewer,
2011
+ startValue: cEntity.model.scale,
2012
+ startPaused: true
2013
+ });
2014
+ cEntity.model.scale = new Cesium.CallbackProperty(function () { return animateScale.GetValue(); }, false);
2015
+ }
2016
+ else {
2017
+ cEntity.model.scale = new Cesium.CallbackProperty(function () { return scale * styleScale; }, true);
2018
+ }
2019
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
2020
+ // cEntity.model.color = new Cesium.CallbackProperty(() => color, true);
2021
+ cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
2022
+ color: color,
2023
+ entity: cEntity,
2024
+ viewer: params.viewer,
2025
+ override: true,
2026
+ requestRender: false
2027
+ });
2028
+ cEntity.show = true;
2029
+ }
1661
2030
  var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
1662
2031
  var heightProm = _fileRadiusCache.Get(fileRadiusKey);
1663
2032
  if (!heightProm) {
@@ -1736,6 +2105,10 @@ var EntityRenderEngine;
1736
2105
  visual_register_culler_1.VisualRegisterCuller.MarkShouldRecheck(params.viewer);
1737
2106
  }
1738
2107
  }
2108
+ // Rough estimate on when the model is ready in the scene.
2109
+ if (animateScale) {
2110
+ animateScale.Play();
2111
+ }
1739
2112
  });
1740
2113
  var model = cEntity.model;
1741
2114
  model._radiusLoaded = false;
@@ -1748,16 +2121,16 @@ var EntityRenderEngine;
1748
2121
  }
1749
2122
  Model3d.Render = Render;
1750
2123
  function RenderGroup(params) {
1751
- var _a, _b, _c, _d, _e;
2124
+ var _a, _b, _c, _d, _e, _f;
1752
2125
  return __awaiter(this, void 0, void 0, function () {
1753
- var api, cEntities, reqBody, i, entity, zoomItem, style, _f, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
1754
- return __generator(this, function (_g) {
1755
- switch (_g.label) {
2126
+ var api, cEntities, reqBody, i, entity, zoomItem, style, _g, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
2127
+ return __generator(this, function (_h) {
2128
+ switch (_h.label) {
1756
2129
  case 0:
1757
2130
  api = params.apiGetter.getApi();
1758
2131
  return [4 /*yield*/, api.Loading];
1759
2132
  case 1:
1760
- _g.sent();
2133
+ _h.sent();
1761
2134
  cEntities = {};
1762
2135
  reqBody = {
1763
2136
  "strict": false,
@@ -1765,7 +2138,7 @@ var EntityRenderEngine;
1765
2138
  "Items": []
1766
2139
  };
1767
2140
  i = 0;
1768
- _g.label = 2;
2141
+ _h.label = 2;
1769
2142
  case 2:
1770
2143
  if (!(i < params.entities.length)) return [3 /*break*/, 9];
1771
2144
  entity = params.entities[i];
@@ -1773,13 +2146,13 @@ var EntityRenderEngine;
1773
2146
  if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
1774
2147
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
1775
2148
  case 3:
1776
- _f = (_a = (_g.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
2149
+ _g = (_a = (_h.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
1777
2150
  return [3 /*break*/, 5];
1778
2151
  case 4:
1779
- _f = zoomItem.Style;
1780
- _g.label = 5;
2152
+ _g = zoomItem.Style;
2153
+ _h.label = 5;
1781
2154
  case 5:
1782
- style = _f;
2155
+ style = _g;
1783
2156
  tagIds = entity.Bruce["Layer.ID"];
1784
2157
  tags = [];
1785
2158
  if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
@@ -1788,8 +2161,8 @@ var EntityRenderEngine;
1788
2161
  tagIds: tagIds
1789
2162
  })];
1790
2163
  case 6:
1791
- tags = (_g.sent()).tags;
1792
- _g.label = 7;
2164
+ tags = (_h.sent()).tags;
2165
+ _h.label = 7;
1793
2166
  case 7:
1794
2167
  mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
1795
2168
  group = mStyle.lodGroup ? bruce_models_1.Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
@@ -1810,7 +2183,7 @@ var EntityRenderEngine;
1810
2183
  "group": group,
1811
2184
  "level": level
1812
2185
  });
1813
- _g.label = 8;
2186
+ _h.label = 8;
1814
2187
  case 8:
1815
2188
  i++;
1816
2189
  return [3 /*break*/, 2];
@@ -1819,24 +2192,24 @@ var EntityRenderEngine;
1819
2192
  filter: reqBody
1820
2193
  })];
1821
2194
  case 10:
1822
- lodData = (_g.sent()).lods;
2195
+ lodData = (_h.sent()).lods;
1823
2196
  _loop_2 = function (i) {
1824
- var entity, zoomItem, style, _h, tagIds, tags, lod, mStyle, cEntity, name_5;
1825
- return __generator(this, function (_j) {
1826
- switch (_j.label) {
2197
+ var entity, zoomItem, style, _j, tagIds, tags, lod, mStyle, cEntity, name_5;
2198
+ return __generator(this, function (_k) {
2199
+ switch (_k.label) {
1827
2200
  case 0:
1828
2201
  entity = params.entities[i];
1829
2202
  zoomItem = params.zoomItems[entity.Bruce.ID];
1830
2203
  if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
1831
2204
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
1832
2205
  case 1:
1833
- _h = (_c = (_j.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
2206
+ _j = (_c = (_k.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
1834
2207
  return [3 /*break*/, 3];
1835
2208
  case 2:
1836
- _h = zoomItem.Style;
1837
- _j.label = 3;
2209
+ _j = zoomItem.Style;
2210
+ _k.label = 3;
1838
2211
  case 3:
1839
- style = _h;
2212
+ style = _j;
1840
2213
  tagIds = entity.Bruce["Layer.ID"];
1841
2214
  tags = [];
1842
2215
  if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
@@ -1845,8 +2218,8 @@ var EntityRenderEngine;
1845
2218
  tagIds: tagIds
1846
2219
  })];
1847
2220
  case 4:
1848
- tags = (_j.sent()).tags;
1849
- _j.label = 5;
2221
+ tags = (_k.sent()).tags;
2222
+ _k.label = 5;
1850
2223
  case 5:
1851
2224
  lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
1852
2225
  if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
@@ -1854,6 +2227,7 @@ var EntityRenderEngine;
1854
2227
  }
1855
2228
  mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
1856
2229
  cEntity = Render({
2230
+ rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
1857
2231
  entity: entity,
1858
2232
  style: mStyle,
1859
2233
  tags: tags,
@@ -1870,23 +2244,23 @@ var EntityRenderEngine;
1870
2244
  if (!cEntity) return [3 /*break*/, 7];
1871
2245
  return [4 /*yield*/, getName(api, entity)];
1872
2246
  case 6:
1873
- name_5 = _j.sent();
2247
+ name_5 = _k.sent();
1874
2248
  cEntity.name = name_5;
1875
- cEntity._renderGroup = getRenderGroupId(zoomItem, (_e = params.viewer) === null || _e === void 0 ? void 0 : _e.terrainProvider);
2249
+ cEntity._renderGroup = getRenderGroupId(zoomItem, (_f = params.viewer) === null || _f === void 0 ? void 0 : _f.terrainProvider);
1876
2250
  cEntities[entity.Bruce.ID] = cEntity;
1877
- _j.label = 7;
2251
+ _k.label = 7;
1878
2252
  case 7: return [2 /*return*/];
1879
2253
  }
1880
2254
  });
1881
2255
  };
1882
2256
  i = 0;
1883
- _g.label = 11;
2257
+ _h.label = 11;
1884
2258
  case 11:
1885
2259
  if (!(i < params.entities.length)) return [3 /*break*/, 14];
1886
2260
  return [5 /*yield**/, _loop_2(i)];
1887
2261
  case 12:
1888
- _g.sent();
1889
- _g.label = 13;
2262
+ _h.sent();
2263
+ _h.label = 13;
1890
2264
  case 13:
1891
2265
  i++;
1892
2266
  return [3 /*break*/, 11];