bruce-cesium 6.9.5 → 6.9.6

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 * as Cesium from 'cesium';
2
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Api, Bounds, Color as Color$1, Geometry, Carto, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
2
+ import { Cartographic, Entity, DistanceDisplayCondition, Color, HeightReference, CallbackProperty, HorizontalOrigin, VerticalOrigin, ConstantProperty, Cartesian3, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, Cartesian2, Math as Math$1, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, Primitive, Cesium3DTileFeature, Cesium3DTileStyle, HeadingPitchRange, SceneMode, Ion, IonResource, ColorBlendMode, Model, Cesium3DTileColorBlendMode, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, defined, Cesium3DTileset, PolygonPipeline, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Fullscreen, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, CzmlDataSource, Intersect } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry, Bounds, Color as Color$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, EntityLod, EntityRelation, BruceApi, AccountConcept, RecordChangeFeed, ProgramKey, EntitySource, Camera, ProjectViewTile, Session, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -1725,6 +1725,9 @@ function storeDefaultTextureImage(graphic, image) {
1725
1725
  function getDefaultTextureImage(graphic) {
1726
1726
  return graphic[STORE_TEXTURE_IMAGE_KEY];
1727
1727
  }
1728
+ function clearDefaultTextureImage(graphic) {
1729
+ delete graphic[STORE_TEXTURE_IMAGE_KEY];
1730
+ }
1728
1731
  /**
1729
1732
  * Returns a color property from a graphic.
1730
1733
  * This will turn materials properties into colors before returning them.
@@ -2262,6 +2265,39 @@ var CesiumEntityStyler;
2262
2265
  }
2263
2266
  }
2264
2267
  CesiumEntityStyler.SetDefaultColor = SetDefaultColor;
2268
+ /*
2269
+ * Updates (or clears) the baked default texture image for a graphic's polygon parts.
2270
+ */
2271
+ function SetDefaultTextureImage(params) {
2272
+ const { viewer, entity, image, requestRender } = params;
2273
+ if (!entity) {
2274
+ return;
2275
+ }
2276
+ const parts = EntityUtils.GatherEntity({
2277
+ entity: entity,
2278
+ selectable: true
2279
+ });
2280
+ for (let i = 0; i < parts.length; i++) {
2281
+ const part = parts[i];
2282
+ if (!isAlive(viewer, part)) {
2283
+ continue;
2284
+ }
2285
+ // Texture fill only applies to polygons.
2286
+ if (part instanceof Entity && part.polygon) {
2287
+ if (image == null) {
2288
+ clearDefaultTextureImage(part.polygon);
2289
+ }
2290
+ else {
2291
+ storeDefaultTextureImage(part.polygon, image);
2292
+ }
2293
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
2294
+ }
2295
+ }
2296
+ if (requestRender != false) {
2297
+ viewer.scene.requestRender();
2298
+ }
2299
+ }
2300
+ CesiumEntityStyler.SetDefaultTextureImage = SetDefaultTextureImage;
2265
2301
  /**
2266
2302
  * Updates the opacity of the graphic.
2267
2303
  * This will multiply against the current colour's opacity before applying.
@@ -36861,9 +36897,23 @@ var EntityRenderEnginePolygon;
36861
36897
  cEntity.polygon.classificationType = new ConstantProperty(classification);
36862
36898
  // TODO: animate the texture!
36863
36899
  if (textureDataUri) {
36900
+ // Rebaking texture to ensure we don't revert to the wrong one later.
36864
36901
  cEntity.polygon.material = fillMaterial;
36902
+ CesiumEntityStyler.SetDefaultTextureImage({
36903
+ entity: cEntity,
36904
+ image: textureDataUri,
36905
+ viewer: params.viewer,
36906
+ requestRender: false
36907
+ });
36865
36908
  }
36866
36909
  else {
36910
+ // Clear any baked texture from a previous textured style so reverting to default uses the colour fill.
36911
+ CesiumEntityStyler.SetDefaultTextureImage({
36912
+ entity: cEntity,
36913
+ image: null,
36914
+ viewer: params.viewer,
36915
+ requestRender: false
36916
+ });
36867
36917
  // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
36868
36918
  // WARNING: polygon does not support animation (yet?).
36869
36919
  CesiumEntityStyler.SetDefaultColor({
@@ -38591,7 +38641,7 @@ var StyleUtils;
38591
38641
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
38592
38642
  })(StyleUtils || (StyleUtils = {}));
38593
38643
 
38594
- const VERSION = "6.9.5";
38644
+ const VERSION = "6.9.6";
38595
38645
  /**
38596
38646
  * Updates the environment instance used by bruce-cesium to one specified.
38597
38647
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.