bruce-cesium 2.6.4 → 2.6.5

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 { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, BatchedDataGetter, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, JulianDate, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, Entity, Primitive, Cesium3DTileFeature, HeightReference, DistanceDisplayCondition, NearFarScalar, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EllipsoidTerrainProvider, CesiumInspector, defined, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, EasingFunction, GeometryInstance, Ion, BoundingSphere } from 'cesium';
3
+ import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, ColorMaterialProperty, EasingFunction, GeometryInstance, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, Ion, BoundingSphere } from 'cesium';
4
4
 
5
5
  var TIME_LAG = 300;
6
6
  var POSITION_CHECK_TIMER = 950;
@@ -5776,8 +5776,67 @@ var EntitiesLoadedRenderManager;
5776
5776
  enumerable: false,
5777
5777
  configurable: true
5778
5778
  });
5779
- Manager.prototype.Init = function () {
5779
+ /**
5780
+ * Adds entities to menu item and queues the render for them.
5781
+ * If the entity already exists in the menu item, it will be removed and redrawn.
5782
+ * @param params
5783
+ */
5784
+ Manager.prototype.AddEntities = function (params) {
5785
+ var _this = this;
5786
+ var _a;
5787
+ if (this.disposed) {
5788
+ throw (new Error("This item is disposed."));
5789
+ }
5790
+ if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
5791
+ this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
5792
+ }
5793
+ var entities = params.entities;
5794
+ entities.forEach(function (x) {
5795
+ var _a;
5796
+ // If already in the menu item we'll first remove it.
5797
+ // That way we're using the latest provided data.
5798
+ var entityId = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
5799
+ var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; });
5800
+ if (index > -1) {
5801
+ _this.item.BruceEntity.Entities.splice(index, 1);
5802
+ }
5803
+ _this.item.BruceEntity.Entities.push(x);
5804
+ });
5805
+ this.ReRender({
5806
+ entities: entities,
5807
+ entityIds: entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; }),
5808
+ force: true
5809
+ });
5810
+ this.recreateGetter();
5811
+ };
5812
+ /**
5813
+ * Removes entities from the menu item that match provided IDs.
5814
+ * Any visuals will be removed as well.
5815
+ * @param params
5816
+ */
5817
+ Manager.prototype.RemoveEntities = function (params) {
5780
5818
  var _this = this;
5819
+ var _a;
5820
+ if (this.disposed) {
5821
+ throw (new Error("This item is disposed."));
5822
+ }
5823
+ if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
5824
+ this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
5825
+ }
5826
+ var entityIds = params.entityIds;
5827
+ entityIds.forEach(function (x) {
5828
+ var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == x; });
5829
+ if (index > -1) {
5830
+ _this.item.BruceEntity.Entities.splice(index, 1);
5831
+ }
5832
+ _this.visualsManager.RemoveRegos({
5833
+ entityId: x,
5834
+ menuItemId: _this.item.id
5835
+ });
5836
+ });
5837
+ this.recreateGetter();
5838
+ };
5839
+ Manager.prototype.Init = function () {
5781
5840
  var _a;
5782
5841
  if (this.disposed) {
5783
5842
  throw (new Error("This item is disposed."));
@@ -5794,6 +5853,17 @@ var EntitiesLoadedRenderManager;
5794
5853
  }
5795
5854
  ];
5796
5855
  }
5856
+ this.recreateGetter();
5857
+ };
5858
+ /**
5859
+ * Recreates the getter for the entities.
5860
+ * This is used when the entities within the menu item are updated.
5861
+ * @todo: this causes a bad side-effect where all menu item entities are queued for a re-render.
5862
+ */
5863
+ Manager.prototype.recreateGetter = function () {
5864
+ var _this = this;
5865
+ var _a;
5866
+ (_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
5797
5867
  this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, BATCH_SIZE$1);
5798
5868
  this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
5799
5869
  var _a;
@@ -15076,7 +15146,7 @@ var ViewerUtils;
15076
15146
  ViewerUtils.CreateWidgets = CreateWidgets;
15077
15147
  })(ViewerUtils || (ViewerUtils = {}));
15078
15148
 
15079
- var VERSION$1 = "2.6.4";
15149
+ var VERSION$1 = "2.6.5";
15080
15150
 
15081
15151
  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, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
15082
15152
  //# sourceMappingURL=bruce-cesium.es5.js.map