bruce-cesium 3.7.1 → 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 +101 -48
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +100 -47
  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 +6 -2
  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
  }
@@ -5426,7 +5452,7 @@
5426
5452
  color: color,
5427
5453
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
5428
5454
  },
5429
- orientation: orientation,
5455
+ orientation: new Cesium.ConstantProperty(orientation),
5430
5456
  position: pos,
5431
5457
  show: true
5432
5458
  });
@@ -6339,7 +6365,11 @@
6339
6365
  */
6340
6366
  function getValue$2(viewer, obj) {
6341
6367
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
6342
- 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);
6343
6373
  }
6344
6374
  return obj;
6345
6375
  }
@@ -7938,7 +7968,11 @@
7938
7968
 
7939
7969
  function GetValue$1(viewer, obj) {
7940
7970
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
7941
- 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);
7942
7976
  }
7943
7977
  return obj;
7944
7978
  }
@@ -8538,12 +8572,12 @@
8538
8572
  var centroid = this_1.calculateCentroid(cluster.points);
8539
8573
  var count = cluster.points.length;
8540
8574
  if (clusterEntity) {
8541
- clusterEntity.position = Cesium.Cartesian3.fromDegrees(centroid.lon, centroid.lat, 150);
8575
+ clusterEntity.position = new Cesium.ConstantPositionProperty(Cesium.Cartesian3.fromDegrees(centroid.lon, centroid.lat, 150));
8542
8576
  clusterEntity.billboard.image = new Cesium.CallbackProperty(function () {
8543
8577
  return getCanvas(count);
8544
8578
  }, false),
8545
- clusterEntity.billboard.width = getScale(cluster.points.length);
8546
- 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));
8547
8581
  }
8548
8582
  else {
8549
8583
  clusterEntity = this_1.viewer.entities.add({
@@ -8798,7 +8832,11 @@
8798
8832
  var CHECK_BATCH_SIZE = 250;
8799
8833
  function getValue$3(viewer, obj) {
8800
8834
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
8801
- 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);
8802
8840
  }
8803
8841
  return obj;
8804
8842
  }
@@ -9378,9 +9416,9 @@
9378
9416
  curWidth == width) {
9379
9417
  return;
9380
9418
  }
9381
- thing.polygon.material = cFillColor_1;
9382
- thing.polygon.outlineColor = cLineColor_1;
9383
- 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);
9384
9422
  }
9385
9423
  else if (thing.polyline) {
9386
9424
  var bColor = lStyle.lineColor ? bruceModels.Calculator.GetColor(lStyle.lineColor, data, []) : null;
@@ -9402,8 +9440,8 @@
9402
9440
  curWidth == width) {
9403
9441
  return;
9404
9442
  }
9405
- thing.polyline.material = cColor;
9406
- thing.polyline.width = width;
9443
+ thing.polyline.material = new Cesium.ColorMaterialProperty(cColor);
9444
+ thing.polyline.width = new Cesium.ConstantProperty(width);
9407
9445
  }
9408
9446
  };
9409
9447
  toForceUpdate = [];
@@ -9665,7 +9703,11 @@
9665
9703
  var CHECK_BATCH_SIZE$1 = 250;
9666
9704
  function getValue$4(viewer, obj) {
9667
9705
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
9668
- 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);
9669
9711
  }
9670
9712
  return obj;
9671
9713
  }
@@ -10185,9 +10227,9 @@
10185
10227
  curWidth == width) {
10186
10228
  return;
10187
10229
  }
10188
- thing.polygon.material = cFillColor_1;
10189
- thing.polygon.outlineColor = cLineColor_1;
10190
- 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);
10191
10233
  }
10192
10234
  else if (thing.polyline) {
10193
10235
  var bColor = lStyle.lineColor ? bruceModels.Calculator.GetColor(lStyle.lineColor, data, []) : null;
@@ -10209,8 +10251,8 @@
10209
10251
  curWidth == width) {
10210
10252
  return;
10211
10253
  }
10212
- thing.polyline.material = cColor;
10213
- thing.polyline.width = width;
10254
+ thing.polyline.material = new Cesium.ColorMaterialProperty(cColor);
10255
+ thing.polyline.width = new Cesium.ConstantProperty(width);
10214
10256
  }
10215
10257
  };
10216
10258
  toForceUpdate = [];
@@ -10380,7 +10422,11 @@
10380
10422
  var BATCH_SIZE$2 = 500;
10381
10423
  function getValue$5(viewer, obj) {
10382
10424
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
10383
- 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);
10384
10430
  }
10385
10431
  return obj;
10386
10432
  }
@@ -10785,9 +10831,9 @@
10785
10831
  curWidth == width) {
10786
10832
  return;
10787
10833
  }
10788
- thing.polygon.material = cFillColor_1;
10789
- thing.polygon.outlineColor = cLineColor_1;
10790
- 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);
10791
10837
  }
10792
10838
  else if (thing.polyline) {
10793
10839
  var bColor = lStyle.lineColor ? bruceModels.Calculator.GetColor(lStyle.lineColor, data, []) : null;
@@ -10809,8 +10855,8 @@
10809
10855
  curWidth == width) {
10810
10856
  return;
10811
10857
  }
10812
- thing.polyline.material = cColor;
10813
- thing.polyline.width = width;
10858
+ thing.polyline.material = new Cesium.ColorMaterialProperty(cColor);
10859
+ thing.polyline.width = new Cesium.ConstantProperty(width);
10814
10860
  }
10815
10861
  };
10816
10862
  toForceUpdate = [];
@@ -15839,7 +15885,7 @@
15839
15885
  var radians = Cesium.Math.toRadians(interpolatedHeading - 90);
15840
15886
  var quaternion = Cesium.Transforms.headingPitchRollQuaternion(currentPosition, new Cesium.HeadingPitchRoll(radians, 0, 0));
15841
15887
  if (!isNaN(quaternion.w) && !isNaN(quaternion.x) && !isNaN(quaternion.y) && !isNaN(quaternion.z)) {
15842
- vehicleEntity.orientation = quaternion;
15888
+ vehicleEntity.orientation = new Cesium.ConstantProperty(quaternion);
15843
15889
  return;
15844
15890
  }
15845
15891
  else {
@@ -15857,7 +15903,7 @@
15857
15903
  var direction = Cesium.Cartesian3.subtract(currentPosition, previousPosition, new Cesium.Cartesian3());
15858
15904
  Cesium.Cartesian3.normalize(direction, direction);
15859
15905
  var rotationMatrix = Cesium.Transforms.rotationMatrixFromPositionVelocity(previousPosition, direction);
15860
- vehicleEntity.orientation = Cesium.Quaternion.fromRotationMatrix(rotationMatrix);
15906
+ vehicleEntity.orientation = new Cesium.ConstantProperty(Cesium.Quaternion.fromRotationMatrix(rotationMatrix));
15861
15907
  }
15862
15908
  }
15863
15909
  function interpolateHeading(dateTimeIndex, rows, currentTime, headingIndex) {
@@ -19639,16 +19685,21 @@
19639
19685
  clearInterval(interval);
19640
19686
  return;
19641
19687
  }
19642
- // Check if last render time is greater than 3 seconds ago.
19643
- // We check in case something else is also requesting renders.
19644
- var lastRenderTime = viewer.scene.lastRenderTime;
19645
- if (!lastRenderTime || Cesium.JulianDate.secondsDifference(Cesium.JulianDate.now(), lastRenderTime) > 3) {
19646
- // Check if window is active/in focus.
19647
- // TODO: Should render the moment it is in focus as well.
19648
- if (document.hasFocus()) {
19649
- 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
+ }
19650
19698
  }
19651
19699
  }
19700
+ catch (e) {
19701
+ console.error("backgroundRendering", e);
19702
+ }
19652
19703
  }, 1500);
19653
19704
  }
19654
19705
  // Cache of Cesium Token -> Validity.
@@ -21827,7 +21878,9 @@
21827
21878
  if (pointer != null) {
21828
21879
  clock = manager.Viewer.clock;
21829
21880
  timeStr = Cesium.JulianDate.toIso8601(pointer);
21830
- clock.currentTime = Cesium.JulianDate.fromIso8601(timeStr);
21881
+ if (timeStr) {
21882
+ clock.currentTime = Cesium.JulianDate.fromIso8601(timeStr);
21883
+ }
21831
21884
  }
21832
21885
  enabledItems = manager.GetEnabledItemIds();
21833
21886
  newItemIds = (_d = bSettings === null || bSettings === void 0 ? void 0 : bSettings.selectedItemIds) !== null && _d !== void 0 ? _d : [];
@@ -22462,7 +22515,7 @@
22462
22515
  ViewRenderEngine.Render = Render;
22463
22516
  })(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
22464
22517
 
22465
- var VERSION = "3.7.1";
22518
+ var VERSION = "3.7.2";
22466
22519
 
22467
22520
  exports.VERSION = VERSION;
22468
22521
  exports.CesiumParabola = CesiumParabola;