bruce-cesium 3.7.0 → 3.7.2

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.
Files changed (33) hide show
  1. package/dist/bruce-cesium.es5.js +105 -50
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +104 -49
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +1 -1
  6. package/dist/lib/rendering/entity-render-engine.js +10 -4
  7. package/dist/lib/rendering/entity-render-engine.js.map +1 -1
  8. package/dist/lib/rendering/render-managers/common/entity-label.js +5 -1
  9. package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
  10. package/dist/lib/rendering/render-managers/common/point-clustering.js +8 -4
  11. package/dist/lib/rendering/render-managers/common/point-clustering.js.map +1 -1
  12. package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js +2 -2
  13. package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js.map +1 -1
  14. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +10 -6
  15. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
  16. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +10 -6
  17. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
  18. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +10 -6
  19. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  20. package/dist/lib/rendering/view-render-engine.js +3 -1
  21. package/dist/lib/rendering/view-render-engine.js.map +1 -1
  22. package/dist/lib/rendering/visual-register-culler.js +7 -3
  23. package/dist/lib/rendering/visual-register-culler.js.map +1 -1
  24. package/dist/lib/utils/cesium-entity-styler.js +9 -5
  25. package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
  26. package/dist/lib/utils/entity-utils.js +6 -1
  27. package/dist/lib/utils/entity-utils.js.map +1 -1
  28. package/dist/lib/utils/view-utils.js +12 -3
  29. package/dist/lib/utils/view-utils.js.map +1 -1
  30. package/dist/lib/viewer/viewer-utils.js +13 -8
  31. package/dist/lib/viewer/viewer-utils.js.map +1 -1
  32. package/dist/types/bruce-cesium.d.ts +1 -1
  33. package/package.json +2 -2
@@ -949,15 +949,19 @@
949
949
  if (!prop) {
950
950
  return Cesium.Color.WHITE;
951
951
  }
952
+ var date = viewer.scene.lastRenderTime;
953
+ if (!date) {
954
+ date = viewer.clock.currentTime;
955
+ }
952
956
  if (prop.getValue) {
953
- prop = prop.getValue(viewer.scene.lastRenderTime);
957
+ prop = prop.getValue(date);
954
958
  }
955
959
  if (prop instanceof Cesium.Color) {
956
960
  return prop;
957
961
  }
958
962
  var tmp = prop === null || prop === void 0 ? void 0 : prop.color;
959
963
  if (tmp === null || tmp === void 0 ? void 0 : tmp.getValue) {
960
- tmp = tmp.getValue(viewer.scene.lastRenderTime);
964
+ tmp = tmp.getValue(date);
961
965
  }
962
966
  return tmp ? tmp : Cesium.Color.WHITE;
963
967
  }
@@ -1087,7 +1091,7 @@
1087
1091
  graphic.color = color;
1088
1092
  }
1089
1093
  else if (graphic instanceof Cesium.ModelGraphics) {
1090
- graphic.color = color;
1094
+ graphic.color = new Cesium.ConstantProperty(color);
1091
1095
  }
1092
1096
  else if (graphic instanceof Cesium.PolygonGraphics) {
1093
1097
  graphic.material = new Cesium.ColorMaterialProperty(color);
@@ -1099,10 +1103,10 @@
1099
1103
  graphic.material = new Cesium.ColorMaterialProperty(color);
1100
1104
  }
1101
1105
  else if (graphic instanceof Cesium.PointGraphics) {
1102
- graphic.color = color;
1106
+ graphic.color = new Cesium.ConstantProperty(color);
1103
1107
  }
1104
1108
  else if (graphic instanceof Cesium.BillboardGraphics) {
1105
- graphic.color = color;
1109
+ graphic.color = new Cesium.ConstantProperty(color);
1106
1110
  }
1107
1111
  else if (graphic instanceof Cesium.EllipseGraphics) {
1108
1112
  graphic.material = new Cesium.ColorMaterialProperty(color);
@@ -1623,7 +1627,11 @@
1623
1627
  }
1624
1628
  function GetValue(viewer, obj) {
1625
1629
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
1626
- return obj.getValue(viewer.scene.lastRenderTime);
1630
+ var date = viewer.scene.lastRenderTime;
1631
+ if (!date) {
1632
+ date = viewer.clock.currentTime;
1633
+ }
1634
+ return obj.getValue(date);
1627
1635
  }
1628
1636
  return obj;
1629
1637
  }
@@ -2566,6 +2574,7 @@
2566
2574
  if (isNaN(roll)) {
2567
2575
  roll = 0;
2568
2576
  }
2577
+ console.log(tSettings, entity);
2569
2578
  matrix4 = entity.worldPosition;
2570
2579
  offset = new Cesium.Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
2571
2580
  if (entity.worldPivot) //the position from worldMatrix + center of geometry offset
@@ -3241,19 +3250,28 @@
3241
3250
  clock.startTime = startTime;
3242
3251
  }
3243
3252
  else if (startTimeIso) {
3244
- clock.startTime = Cesium.JulianDate.fromIso8601(params.startTimeIso);
3253
+ var startDate = Cesium.JulianDate.fromIso8601(startTimeIso);
3254
+ if (startDate) {
3255
+ clock.startTime = startDate;
3256
+ }
3245
3257
  }
3246
3258
  if (currentTime) {
3247
3259
  clock.currentTime = currentTime;
3248
3260
  }
3249
3261
  else if (currentTimeIso) {
3250
- clock.currentTime = Cesium.JulianDate.fromIso8601(params.currentTimeIso);
3262
+ var currentDate = Cesium.JulianDate.fromIso8601(currentTimeIso);
3263
+ if (currentDate) {
3264
+ clock.currentTime = currentDate;
3265
+ }
3251
3266
  }
3252
3267
  if (stopTime) {
3253
3268
  clock.stopTime = stopTime;
3254
3269
  }
3255
3270
  else if (stopTimeIso) {
3256
- clock.stopTime = Cesium.JulianDate.fromIso8601(params.stopTimeIso);
3271
+ var stopDate = Cesium.JulianDate.fromIso8601(stopTimeIso);
3272
+ if (stopDate) {
3273
+ clock.stopTime = stopDate;
3274
+ }
3257
3275
  }
3258
3276
  clock.clockRange = Cesium.ClockRange.LOOP_STOP;
3259
3277
  var areCesiumValues = clock[CESIUM_TIMELINE_KEY] != true;
@@ -3381,7 +3399,11 @@
3381
3399
  }
3382
3400
  function getValue(viewer, obj) {
3383
3401
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
3384
- return obj.getValue(viewer.scene.lastRenderTime);
3402
+ var date = viewer.scene.lastRenderTime;
3403
+ if (!date) {
3404
+ date = viewer.clock.currentTime;
3405
+ }
3406
+ return obj.getValue(date);
3385
3407
  }
3386
3408
  return obj;
3387
3409
  }
@@ -3992,7 +4014,11 @@
3992
4014
  }
3993
4015
  function getValue$1(viewer, obj) {
3994
4016
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
3995
- return obj.getValue(viewer.scene.lastRenderTime);
4017
+ var date = viewer.scene.lastRenderTime;
4018
+ if (!date) {
4019
+ date = viewer.clock.currentTime;
4020
+ }
4021
+ return obj.getValue(date);
3996
4022
  }
3997
4023
  return obj;
3998
4024
  }
@@ -4659,7 +4685,7 @@
4659
4685
  function Render(params) {
4660
4686
  var _a, _b;
4661
4687
  return __awaiter(this, void 0, void 0, function () {
4662
- 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;
4688
+ 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;
4663
4689
  return __generator(this, function (_c) {
4664
4690
  switch (_c.label) {
4665
4691
  case 0:
@@ -4845,6 +4871,7 @@
4845
4871
  }
4846
4872
  heightRef = getHeightRef(style);
4847
4873
  circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
4874
+ disableDepthTest = Boolean(style.renderOnTop);
4848
4875
  cEntity = new Cesium.Entity({
4849
4876
  id: bruceModels.ObjectUtils.UId(10),
4850
4877
  // point: {
@@ -4861,7 +4888,8 @@
4861
4888
  width: circleBillboard.width,
4862
4889
  image: circleBillboard.canvas,
4863
4890
  heightReference: heightRef,
4864
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
4891
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
4892
+ disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
4865
4893
  },
4866
4894
  position: exports.EntityUtils.GetPos({
4867
4895
  viewer: params.viewer,
@@ -5424,7 +5452,7 @@
5424
5452
  color: color,
5425
5453
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
5426
5454
  },
5427
- orientation: orientation,
5455
+ orientation: new Cesium.ConstantProperty(orientation),
5428
5456
  position: pos,
5429
5457
  show: true
5430
5458
  });
@@ -6337,7 +6365,11 @@
6337
6365
  */
6338
6366
  function getValue$2(viewer, obj) {
6339
6367
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
6340
- return obj.getValue(viewer.scene.lastRenderTime);
6368
+ var date = viewer.scene.lastRenderTime;
6369
+ if (!date) {
6370
+ date = viewer.clock.currentTime;
6371
+ }
6372
+ return obj.getValue(date);
6341
6373
  }
6342
6374
  return obj;
6343
6375
  }
@@ -7936,7 +7968,11 @@
7936
7968
 
7937
7969
  function GetValue$1(viewer, obj) {
7938
7970
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
7939
- return obj.getValue(viewer.scene.lastRenderTime);
7971
+ var date = viewer.scene.lastRenderTime;
7972
+ if (!date) {
7973
+ date = viewer.clock.currentTime;
7974
+ }
7975
+ return obj.getValue(date);
7940
7976
  }
7941
7977
  return obj;
7942
7978
  }
@@ -8536,12 +8572,12 @@
8536
8572
  var centroid = this_1.calculateCentroid(cluster.points);
8537
8573
  var count = cluster.points.length;
8538
8574
  if (clusterEntity) {
8539
- clusterEntity.position = Cesium.Cartesian3.fromDegrees(centroid.lon, centroid.lat, 150);
8575
+ clusterEntity.position = new Cesium.ConstantPositionProperty(Cesium.Cartesian3.fromDegrees(centroid.lon, centroid.lat, 150));
8540
8576
  clusterEntity.billboard.image = new Cesium.CallbackProperty(function () {
8541
8577
  return getCanvas(count);
8542
8578
  }, false),
8543
- clusterEntity.billboard.width = getScale(cluster.points.length);
8544
- clusterEntity.billboard.height = getScale(cluster.points.length);
8579
+ clusterEntity.billboard.width = new Cesium.ConstantProperty(getScale(cluster.points.length));
8580
+ clusterEntity.billboard.height = new Cesium.ConstantProperty(getScale(cluster.points.length));
8545
8581
  }
8546
8582
  else {
8547
8583
  clusterEntity = this_1.viewer.entities.add({
@@ -8796,7 +8832,11 @@
8796
8832
  var CHECK_BATCH_SIZE = 250;
8797
8833
  function getValue$3(viewer, obj) {
8798
8834
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
8799
- return obj.getValue(viewer.scene.lastRenderTime);
8835
+ var date = viewer.scene.lastRenderTime;
8836
+ if (!date) {
8837
+ date = viewer.clock.currentTime;
8838
+ }
8839
+ return obj.getValue(date);
8800
8840
  }
8801
8841
  return obj;
8802
8842
  }
@@ -9376,9 +9416,9 @@
9376
9416
  curWidth == width) {
9377
9417
  return;
9378
9418
  }
9379
- thing.polygon.material = cFillColor_1;
9380
- thing.polygon.outlineColor = cLineColor_1;
9381
- thing.polygon.outlineWidth = width;
9419
+ thing.polygon.material = new Cesium.ColorMaterialProperty(cFillColor_1);
9420
+ thing.polygon.outlineColor = new Cesium.ConstantProperty(cLineColor_1);
9421
+ thing.polygon.outlineWidth = new Cesium.ConstantProperty(width);
9382
9422
  }
9383
9423
  else if (thing.polyline) {
9384
9424
  var bColor = lStyle.lineColor ? bruceModels.Calculator.GetColor(lStyle.lineColor, data, []) : null;
@@ -9400,8 +9440,8 @@
9400
9440
  curWidth == width) {
9401
9441
  return;
9402
9442
  }
9403
- thing.polyline.material = cColor;
9404
- thing.polyline.width = width;
9443
+ thing.polyline.material = new Cesium.ColorMaterialProperty(cColor);
9444
+ thing.polyline.width = new Cesium.ConstantProperty(width);
9405
9445
  }
9406
9446
  };
9407
9447
  toForceUpdate = [];
@@ -9663,7 +9703,11 @@
9663
9703
  var CHECK_BATCH_SIZE$1 = 250;
9664
9704
  function getValue$4(viewer, obj) {
9665
9705
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
9666
- return obj.getValue(viewer.scene.lastRenderTime);
9706
+ var date = viewer.scene.lastRenderTime;
9707
+ if (!date) {
9708
+ date = viewer.clock.currentTime;
9709
+ }
9710
+ return obj.getValue(date);
9667
9711
  }
9668
9712
  return obj;
9669
9713
  }
@@ -10183,9 +10227,9 @@
10183
10227
  curWidth == width) {
10184
10228
  return;
10185
10229
  }
10186
- thing.polygon.material = cFillColor_1;
10187
- thing.polygon.outlineColor = cLineColor_1;
10188
- thing.polygon.outlineWidth = width;
10230
+ thing.polygon.material = new Cesium.ColorMaterialProperty(cFillColor_1);
10231
+ thing.polygon.outlineColor = new Cesium.ConstantProperty(cLineColor_1);
10232
+ thing.polygon.outlineWidth = new Cesium.ConstantProperty(width);
10189
10233
  }
10190
10234
  else if (thing.polyline) {
10191
10235
  var bColor = lStyle.lineColor ? bruceModels.Calculator.GetColor(lStyle.lineColor, data, []) : null;
@@ -10207,8 +10251,8 @@
10207
10251
  curWidth == width) {
10208
10252
  return;
10209
10253
  }
10210
- thing.polyline.material = cColor;
10211
- thing.polyline.width = width;
10254
+ thing.polyline.material = new Cesium.ColorMaterialProperty(cColor);
10255
+ thing.polyline.width = new Cesium.ConstantProperty(width);
10212
10256
  }
10213
10257
  };
10214
10258
  toForceUpdate = [];
@@ -10378,7 +10422,11 @@
10378
10422
  var BATCH_SIZE$2 = 500;
10379
10423
  function getValue$5(viewer, obj) {
10380
10424
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
10381
- return obj.getValue(viewer.scene.lastRenderTime);
10425
+ var date = viewer.scene.lastRenderTime;
10426
+ if (!date) {
10427
+ date = viewer.clock.currentTime;
10428
+ }
10429
+ return obj.getValue(date);
10382
10430
  }
10383
10431
  return obj;
10384
10432
  }
@@ -10783,9 +10831,9 @@
10783
10831
  curWidth == width) {
10784
10832
  return;
10785
10833
  }
10786
- thing.polygon.material = cFillColor_1;
10787
- thing.polygon.outlineColor = cLineColor_1;
10788
- thing.polygon.outlineWidth = width;
10834
+ thing.polygon.material = new Cesium.ColorMaterialProperty(cFillColor_1);
10835
+ thing.polygon.outlineColor = new Cesium.ConstantProperty(cLineColor_1);
10836
+ thing.polygon.outlineWidth = new Cesium.ConstantProperty(width);
10789
10837
  }
10790
10838
  else if (thing.polyline) {
10791
10839
  var bColor = lStyle.lineColor ? bruceModels.Calculator.GetColor(lStyle.lineColor, data, []) : null;
@@ -10807,8 +10855,8 @@
10807
10855
  curWidth == width) {
10808
10856
  return;
10809
10857
  }
10810
- thing.polyline.material = cColor;
10811
- thing.polyline.width = width;
10858
+ thing.polyline.material = new Cesium.ColorMaterialProperty(cColor);
10859
+ thing.polyline.width = new Cesium.ConstantProperty(width);
10812
10860
  }
10813
10861
  };
10814
10862
  toForceUpdate = [];
@@ -15837,7 +15885,7 @@
15837
15885
  var radians = Cesium.Math.toRadians(interpolatedHeading - 90);
15838
15886
  var quaternion = Cesium.Transforms.headingPitchRollQuaternion(currentPosition, new Cesium.HeadingPitchRoll(radians, 0, 0));
15839
15887
  if (!isNaN(quaternion.w) && !isNaN(quaternion.x) && !isNaN(quaternion.y) && !isNaN(quaternion.z)) {
15840
- vehicleEntity.orientation = quaternion;
15888
+ vehicleEntity.orientation = new Cesium.ConstantProperty(quaternion);
15841
15889
  return;
15842
15890
  }
15843
15891
  else {
@@ -15855,7 +15903,7 @@
15855
15903
  var direction = Cesium.Cartesian3.subtract(currentPosition, previousPosition, new Cesium.Cartesian3());
15856
15904
  Cesium.Cartesian3.normalize(direction, direction);
15857
15905
  var rotationMatrix = Cesium.Transforms.rotationMatrixFromPositionVelocity(previousPosition, direction);
15858
- vehicleEntity.orientation = Cesium.Quaternion.fromRotationMatrix(rotationMatrix);
15906
+ vehicleEntity.orientation = new Cesium.ConstantProperty(Cesium.Quaternion.fromRotationMatrix(rotationMatrix));
15859
15907
  }
15860
15908
  }
15861
15909
  function interpolateHeading(dateTimeIndex, rows, currentTime, headingIndex) {
@@ -19637,16 +19685,21 @@
19637
19685
  clearInterval(interval);
19638
19686
  return;
19639
19687
  }
19640
- // Check if last render time is greater than 3 seconds ago.
19641
- // We check in case something else is also requesting renders.
19642
- var lastRenderTime = viewer.scene.lastRenderTime;
19643
- if (!lastRenderTime || Cesium.JulianDate.secondsDifference(Cesium.JulianDate.now(), lastRenderTime) > 3) {
19644
- // Check if window is active/in focus.
19645
- // TODO: Should render the moment it is in focus as well.
19646
- if (document.hasFocus()) {
19647
- viewer.scene.requestRender();
19688
+ try {
19689
+ // Check if last render time is greater than 3 seconds ago.
19690
+ // We check in case something else is also requesting renders.
19691
+ var lastRenderTime = viewer.scene.lastRenderTime;
19692
+ if (!lastRenderTime || Cesium.JulianDate.secondsDifference(Cesium.JulianDate.now(), lastRenderTime) > 3) {
19693
+ // Check if window is active/in focus.
19694
+ // TODO: Should render the moment it is in focus as well.
19695
+ if (document.hasFocus()) {
19696
+ viewer.scene.requestRender();
19697
+ }
19648
19698
  }
19649
19699
  }
19700
+ catch (e) {
19701
+ console.error("backgroundRendering", e);
19702
+ }
19650
19703
  }, 1500);
19651
19704
  }
19652
19705
  // Cache of Cesium Token -> Validity.
@@ -21825,7 +21878,9 @@
21825
21878
  if (pointer != null) {
21826
21879
  clock = manager.Viewer.clock;
21827
21880
  timeStr = Cesium.JulianDate.toIso8601(pointer);
21828
- clock.currentTime = Cesium.JulianDate.fromIso8601(timeStr);
21881
+ if (timeStr) {
21882
+ clock.currentTime = Cesium.JulianDate.fromIso8601(timeStr);
21883
+ }
21829
21884
  }
21830
21885
  enabledItems = manager.GetEnabledItemIds();
21831
21886
  newItemIds = (_d = bSettings === null || bSettings === void 0 ? void 0 : bSettings.selectedItemIds) !== null && _d !== void 0 ? _d : [];
@@ -22460,7 +22515,7 @@
22460
22515
  ViewRenderEngine.Render = Render;
22461
22516
  })(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
22462
22517
 
22463
- var VERSION = "3.7.0";
22518
+ var VERSION = "3.7.2";
22464
22519
 
22465
22520
  exports.VERSION = VERSION;
22466
22521
  exports.CesiumParabola = CesiumParabola;