bruce-cesium 3.4.2 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, ENVIRONMENT, BruceEvent, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, ColorMaterialProperty, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, Cesium3DTileset, Matrix4, Matrix3, IonResource, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, CesiumInspector, defined, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, NearFarScalar, Model, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, GeoJsonDataSource, ColorMaterialProperty, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, PolygonPipeline, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -742,6 +742,52 @@ var CesiumEntityStyler;
742
742
  }
743
743
  }
744
744
  CesiumEntityStyler.UpdateColorSetting = UpdateColorSetting;
745
+ function Refresh(params) {
746
+ var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
747
+ if (!entity) {
748
+ return;
749
+ }
750
+ var parts = EntityUtils.GatherEntity({
751
+ entity: entity
752
+ });
753
+ for (var i = 0; i < parts.length; i++) {
754
+ var part = parts[i];
755
+ if (!isAlive(viewer, part)) {
756
+ continue;
757
+ }
758
+ if (part instanceof Cesium3DTileFeature) {
759
+ var opacity = getAppliedOpacity(part);
760
+ refreshColor(viewer, part, opacity);
761
+ }
762
+ else if (part instanceof Entity) {
763
+ if (part.billboard) {
764
+ refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
765
+ }
766
+ if (part.model) {
767
+ refreshColor(viewer, part.model, getAppliedOpacity(part.model));
768
+ }
769
+ if (part.polyline) {
770
+ refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
771
+ }
772
+ if (part.polygon) {
773
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
774
+ }
775
+ if (part.corridor) {
776
+ refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
777
+ }
778
+ if (part.point) {
779
+ refreshColor(viewer, part.point, getAppliedOpacity(part.point));
780
+ }
781
+ if (part.ellipse) {
782
+ refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
783
+ }
784
+ }
785
+ }
786
+ if (requestRender != false) {
787
+ viewer.scene.requestRender();
788
+ }
789
+ }
790
+ CesiumEntityStyler.Refresh = Refresh;
745
791
  /**
746
792
  * Updates the default colour of a graphic.
747
793
  * This will not change the graphic's state to use it if the entity is selected/highlighted.
@@ -6479,16 +6525,40 @@ var VisualsRegister;
6479
6525
  };
6480
6526
  Register.prototype.ForceUpdate = function (params) {
6481
6527
  var _a;
6482
- var entityIds = params.entityIds;
6528
+ var entityIds = params.entityIds, requestRender = params.requestRender, refreshColors = params.refreshColors;
6529
+ var selectedIds = this.selectedIds;
6530
+ var highlightedIds = this.highlightedIds;
6483
6531
  for (var i = 0; i < entityIds.length; i++) {
6484
6532
  var entityId = entityIds[i];
6485
6533
  updateEntity(this.viewer, entityId, this);
6534
+ if (refreshColors) {
6535
+ if (selectedIds.includes(entityId)) {
6536
+ CesiumEntityStyler.Select({
6537
+ entity: this.GetRego({
6538
+ entityId: entityId
6539
+ }).visual,
6540
+ viewer: this.viewer,
6541
+ requestRender: false
6542
+ });
6543
+ }
6544
+ else if (highlightedIds.includes(entityId)) {
6545
+ CesiumEntityStyler.Highlight({
6546
+ entity: this.GetRego({
6547
+ entityId: entityId
6548
+ }).visual,
6549
+ viewer: this.viewer,
6550
+ requestRender: false
6551
+ });
6552
+ }
6553
+ }
6486
6554
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
6487
6555
  type: EVisualUpdateType.Update,
6488
6556
  entityId: entityId
6489
6557
  });
6490
6558
  }
6491
- this.viewer.scene.requestRender();
6559
+ if (requestRender != false) {
6560
+ this.viewer.scene.requestRender();
6561
+ }
6492
6562
  };
6493
6563
  /**
6494
6564
  * Marks given entityIds as either labelled or not labelled.
@@ -8498,7 +8568,7 @@ var EntitiesRenderManager;
8498
8568
  Manager.prototype.renderAsGeojson = function (entities, force) {
8499
8569
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8500
8570
  return __awaiter(this, void 0, void 0, function () {
8501
- var zoomItem, lods, withLods_1, individuals, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
8571
+ var zoomItem, lods, withLods_1, individuals, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
8502
8572
  var _this = this;
8503
8573
  return __generator(this, function (_o) {
8504
8574
  switch (_o.label) {
@@ -8707,6 +8777,7 @@ var EntitiesRenderManager;
8707
8777
  thing.polyline.width = width;
8708
8778
  }
8709
8779
  };
8780
+ toForceUpdate = [];
8710
8781
  register = function (thing) {
8711
8782
  var _a, _b, _c, _d;
8712
8783
  // See if the cesium entity already exists in a group.
@@ -8719,7 +8790,6 @@ var EntitiesRenderManager;
8719
8790
  if (!entityId) {
8720
8791
  return;
8721
8792
  }
8722
- var needsUpdate = false;
8723
8793
  // Find group for the nextspace entity ID.
8724
8794
  group = groups.find(function (x) { return x.entityId == entityId; });
8725
8795
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -8734,6 +8804,7 @@ var EntitiesRenderManager;
8734
8804
  rego: null
8735
8805
  };
8736
8806
  groups.push(group);
8807
+ applyStyle(thing, entityId, group.data);
8737
8808
  var rego = {
8738
8809
  entityId: entityId,
8739
8810
  menuItemId: _this.item.id,
@@ -8758,6 +8829,7 @@ var EntitiesRenderManager;
8758
8829
  }
8759
8830
  // Found a group. We flag this as a sibling entity of the primary.
8760
8831
  else {
8832
+ applyStyle(thing, entityId, group.data);
8761
8833
  group.siblings.push(thing);
8762
8834
  group.visual._siblingGraphics = group.siblings;
8763
8835
  thing._parentEntity = group.visual;
@@ -8765,21 +8837,24 @@ var EntitiesRenderManager;
8765
8837
  _this.visualsManager.RefreshMark({
8766
8838
  rego: group.rego
8767
8839
  });
8768
- needsUpdate = true;
8840
+ if (!toForceUpdate.includes(entityId)) {
8841
+ toForceUpdate.push(entityId);
8842
+ }
8769
8843
  }
8770
8844
  }
8771
- applyStyle(thing, entityId, group.data);
8772
- if (needsUpdate) {
8773
- _this.visualsManager.ForceUpdate({
8774
- entityIds: [entityId],
8775
- });
8776
- }
8777
8845
  };
8778
8846
  sEntities = source.entities.values;
8779
8847
  for (i = 0; i < sEntities.length; i++) {
8780
8848
  cEntity = sEntities[i];
8781
8849
  register(cEntity);
8782
8850
  }
8851
+ if (toForceUpdate.length) {
8852
+ this.visualsManager.ForceUpdate({
8853
+ entityIds: toForceUpdate,
8854
+ refreshColors: true,
8855
+ requestRender: false
8856
+ });
8857
+ }
8783
8858
  this.viewer.scene.requestRender();
8784
8859
  return [2 /*return*/];
8785
8860
  }
@@ -9306,7 +9381,7 @@ var EntitiesLoadedRenderManager;
9306
9381
  Manager.prototype.renderAsGeojson = function (entities, force) {
9307
9382
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9308
9383
  return __awaiter(this, void 0, void 0, function () {
9309
- var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
9384
+ var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
9310
9385
  var _this = this;
9311
9386
  return __generator(this, function (_o) {
9312
9387
  switch (_o.label) {
@@ -9515,6 +9590,7 @@ var EntitiesLoadedRenderManager;
9515
9590
  thing.polyline.width = width;
9516
9591
  }
9517
9592
  };
9593
+ toForceUpdate = [];
9518
9594
  register = function (thing) {
9519
9595
  var _a, _b, _c, _d;
9520
9596
  // See if the cesium entity already exists in a group.
@@ -9527,7 +9603,6 @@ var EntitiesLoadedRenderManager;
9527
9603
  if (!entityId) {
9528
9604
  return;
9529
9605
  }
9530
- var needsUpdate = false;
9531
9606
  // Find group for the nextspace entity ID.
9532
9607
  group = groups.find(function (x) { return x.entityId == entityId; });
9533
9608
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -9542,6 +9617,7 @@ var EntitiesLoadedRenderManager;
9542
9617
  rego: null
9543
9618
  };
9544
9619
  groups.push(group);
9620
+ applyStyle(thing, entityId, group.data);
9545
9621
  var rego = {
9546
9622
  entityId: entityId,
9547
9623
  menuItemId: _this.item.id,
@@ -9566,6 +9642,7 @@ var EntitiesLoadedRenderManager;
9566
9642
  }
9567
9643
  // Found a group. We flag this as a sibling entity of the primary.
9568
9644
  else {
9645
+ applyStyle(thing, entityId, group.data);
9569
9646
  group.siblings.push(thing);
9570
9647
  group.visual._siblingGraphics = group.siblings;
9571
9648
  thing._parentEntity = group.visual;
@@ -9573,21 +9650,24 @@ var EntitiesLoadedRenderManager;
9573
9650
  _this.visualsManager.RefreshMark({
9574
9651
  rego: group.rego
9575
9652
  });
9576
- needsUpdate = true;
9653
+ if (!toForceUpdate.includes(entityId)) {
9654
+ toForceUpdate.push(entityId);
9655
+ }
9577
9656
  }
9578
9657
  }
9579
- applyStyle(thing, entityId, group.data);
9580
- if (needsUpdate) {
9581
- _this.visualsManager.ForceUpdate({
9582
- entityIds: [entityId],
9583
- });
9584
- }
9585
9658
  };
9586
9659
  sEntities = source.entities.values;
9587
9660
  for (i = 0; i < sEntities.length; i++) {
9588
9661
  cEntity = sEntities[i];
9589
9662
  register(cEntity);
9590
9663
  }
9664
+ if (toForceUpdate.length) {
9665
+ this.visualsManager.ForceUpdate({
9666
+ entityIds: toForceUpdate,
9667
+ refreshColors: true,
9668
+ requestRender: false
9669
+ });
9670
+ }
9591
9671
  this.viewer.scene.requestRender();
9592
9672
  return [2 /*return*/];
9593
9673
  }
@@ -9906,7 +9986,7 @@ var EntitiesIdsRenderManager;
9906
9986
  Manager.prototype.renderAsGeojson = function (entities, force) {
9907
9987
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9908
9988
  return __awaiter(this, void 0, void 0, function () {
9909
- var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
9989
+ var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
9910
9990
  var _this = this;
9911
9991
  return __generator(this, function (_o) {
9912
9992
  switch (_o.label) {
@@ -10115,6 +10195,7 @@ var EntitiesIdsRenderManager;
10115
10195
  thing.polyline.width = width;
10116
10196
  }
10117
10197
  };
10198
+ toForceUpdate = [];
10118
10199
  register = function (thing) {
10119
10200
  var _a, _b, _c, _d;
10120
10201
  // See if the cesium entity already exists in a group.
@@ -10127,7 +10208,6 @@ var EntitiesIdsRenderManager;
10127
10208
  if (!entityId) {
10128
10209
  return;
10129
10210
  }
10130
- var needsUpdate = false;
10131
10211
  // Find group for the nextspace entity ID.
10132
10212
  group = groups.find(function (x) { return x.entityId == entityId; });
10133
10213
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -10142,6 +10222,7 @@ var EntitiesIdsRenderManager;
10142
10222
  rego: null
10143
10223
  };
10144
10224
  groups.push(group);
10225
+ applyStyle(thing, entityId, group.data);
10145
10226
  var rego = {
10146
10227
  entityId: entityId,
10147
10228
  menuItemId: _this.item.id,
@@ -10166,6 +10247,7 @@ var EntitiesIdsRenderManager;
10166
10247
  }
10167
10248
  // Found a group. We flag this as a sibling entity of the primary.
10168
10249
  else {
10250
+ applyStyle(thing, entityId, group.data);
10169
10251
  group.siblings.push(thing);
10170
10252
  group.visual._siblingGraphics = group.siblings;
10171
10253
  thing._parentEntity = group.visual;
@@ -10173,21 +10255,24 @@ var EntitiesIdsRenderManager;
10173
10255
  _this.visualsManager.RefreshMark({
10174
10256
  rego: group.rego
10175
10257
  });
10176
- needsUpdate = true;
10258
+ if (!toForceUpdate.includes(entityId)) {
10259
+ toForceUpdate.push(entityId);
10260
+ }
10177
10261
  }
10178
10262
  }
10179
- applyStyle(thing, entityId, group.data);
10180
- if (needsUpdate) {
10181
- _this.visualsManager.ForceUpdate({
10182
- entityIds: [entityId],
10183
- });
10184
- }
10185
10263
  };
10186
10264
  sEntities = source.entities.values;
10187
10265
  for (i = 0; i < sEntities.length; i++) {
10188
10266
  cEntity = sEntities[i];
10189
10267
  register(cEntity);
10190
10268
  }
10269
+ if (toForceUpdate.length) {
10270
+ this.visualsManager.ForceUpdate({
10271
+ entityIds: toForceUpdate,
10272
+ refreshColors: true,
10273
+ requestRender: false
10274
+ });
10275
+ }
10191
10276
  this.viewer.scene.requestRender();
10192
10277
  return [2 /*return*/];
10193
10278
  }
@@ -21360,7 +21445,7 @@ var CesiumViewMonitor;
21360
21445
  CesiumViewMonitor$$1.Monitor = Monitor;
21361
21446
  })(CesiumViewMonitor || (CesiumViewMonitor = {}));
21362
21447
 
21363
- var VERSION$1 = "3.4.2";
21448
+ var VERSION$1 = "3.4.3";
21364
21449
 
21365
21450
  export { VERSION$1 as VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
21366
21451
  //# sourceMappingURL=bruce-cesium.es5.js.map