bruce-cesium 3.4.3 → 3.4.4

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, 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';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, SceneMode, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, GeoJsonDataSource, ColorMaterialProperty, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, CesiumInspector, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3132,6 +3132,54 @@ function shouldRecheck(viewer) {
3132
3132
  }
3133
3133
  return recheck;
3134
3134
  }
3135
+ /**
3136
+ * Returns true if the given rego should be ignored from culling.
3137
+ * @param rego
3138
+ * @returns
3139
+ */
3140
+ function isCullingIgnored(viewer, rego) {
3141
+ if (
3142
+ // No rego or visual.
3143
+ // This is a safety check to avoid crashes.
3144
+ !rego ||
3145
+ !rego.visual ||
3146
+ // We will only touch entities. Not tileset stuff.
3147
+ !(rego.visual instanceof Entity) ||
3148
+ // We won't touch relationship lines because they dynamically change shape.
3149
+ rego.relation != null ||
3150
+ // Explicitly being either shown or hidden.
3151
+ rego.overrideShow != null ||
3152
+ // Part of an independent collection.
3153
+ // Won't touch in case there is special logic.
3154
+ rego.collection) {
3155
+ return true;
3156
+ }
3157
+ var visual = rego.visual;
3158
+ // We will only cull clamped stuff since it seems that's where we get benefits from.
3159
+ var heightRef;
3160
+ if (visual.polygon) {
3161
+ heightRef = getValue(viewer, visual.polygon.heightReference);
3162
+ }
3163
+ else if (visual.polyline) {
3164
+ heightRef = getValue(viewer, visual.polyline.clampToGround) == false ? HeightReference.NONE : HeightReference.CLAMP_TO_GROUND;
3165
+ }
3166
+ else if (visual.corridor) {
3167
+ heightRef = getValue(viewer, visual.corridor.heightReference);
3168
+ }
3169
+ else if (visual.ellipse) {
3170
+ heightRef = getValue(viewer, visual.ellipse.heightReference);
3171
+ }
3172
+ else if (visual.model) {
3173
+ heightRef = getValue(viewer, visual.model.heightReference);
3174
+ }
3175
+ else if (visual.point) {
3176
+ heightRef = getValue(viewer, visual.point.heightReference);
3177
+ }
3178
+ else if (visual.billboard) {
3179
+ heightRef = getValue(viewer, visual.billboard.heightReference);
3180
+ }
3181
+ return heightRef != HeightReference.CLAMP_TO_GROUND;
3182
+ }
3135
3183
  /**
3136
3184
  * Runs through all entities in the register and culls them if they are out of the viewport.
3137
3185
  * This will work in batches.
@@ -3158,7 +3206,7 @@ function runCullChecker(register) {
3158
3206
  var rego = register.GetRego({
3159
3207
  entityId: entityId
3160
3208
  });
3161
- if (!rego || !rego.visual || !(rego.visual instanceof Entity) || rego.relation != null || rego.overrideShow != null || rego.collection) {
3209
+ if (isCullingIgnored(viewer, rego)) {
3162
3210
  continue;
3163
3211
  }
3164
3212
  var parts = EntityUtils.GatherEntity({
@@ -3269,7 +3317,10 @@ var VisualRegisterCuller;
3269
3317
  };
3270
3318
  }
3271
3319
  VisualRegisterCuller.Monitor = Monitor;
3272
- function IsCulled(viewer, visual) {
3320
+ function IsCulled(viewer, rego, visual) {
3321
+ if (isCullingIgnored(viewer, rego)) {
3322
+ return false;
3323
+ }
3273
3324
  if (!visual) {
3274
3325
  return false;
3275
3326
  }
@@ -6294,13 +6345,9 @@ function updateCEntityShow(viewer, visual, rego, show, ignoreParent, depth) {
6294
6345
  console.warn("updateCEntityShow(): Max show depth reached. EntityId = " + rego.entityId);
6295
6346
  return;
6296
6347
  }
6297
- if (show && !rego.relation && !rego.overrideShow && !rego.collection) {
6298
- // Culling is controlled by "visual-register-culler.ts".
6299
- // When an object is unculled then the 'updateEntityShow' function is re-called to reveal it and related objects.
6300
- // A sub-object can be culled while the siblings are not.
6301
- var isCulled = show ? VisualRegisterCuller.IsCulled(viewer, visual) : true;
6302
- show = !isCulled;
6303
- }
6348
+ // A sub-object can be culled while the siblings are not.
6349
+ // We only cull things that give us some benefit. For example clamped to ground graphics are expensive to keep rendered.
6350
+ show = show ? !VisualRegisterCuller.IsCulled(viewer, rego, visual) : true;
6304
6351
  if (visual._parentEntity && !ignoreParent) {
6305
6352
  updateCEntityShow(viewer, visual._parentEntity, rego, show, false, depth + 1);
6306
6353
  }
@@ -11031,6 +11078,10 @@ var TilesetRenderEngine;
11031
11078
  this.cTileset = cTileset;
11032
11079
  this.fallbackStyleId = fallbackStyleId;
11033
11080
  this.styleMapping = styleMapping;
11081
+ if (styleMapping) {
11082
+ // Dereference.
11083
+ styleMapping = JSON.parse(JSON.stringify(styleMapping));
11084
+ }
11034
11085
  // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
11035
11086
  // We have some evil hard-coded style mappings that need to be fixed.
11036
11087
  // These exist within legacy project views.
@@ -11061,6 +11112,8 @@ var TilesetRenderEngine;
11061
11112
  Styler.prototype.UpdateStyleMapping = function (params) {
11062
11113
  var _a;
11063
11114
  if (params.styleMapping) {
11115
+ // Dereference.
11116
+ params.styleMapping = JSON.parse(JSON.stringify(params.styleMapping));
11064
11117
  this.styleMapping = params.styleMapping;
11065
11118
  // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
11066
11119
  // We have some evil hard-coded style mappings that need to be fixed.
@@ -21445,7 +21498,7 @@ var CesiumViewMonitor;
21445
21498
  CesiumViewMonitor$$1.Monitor = Monitor;
21446
21499
  })(CesiumViewMonitor || (CesiumViewMonitor = {}));
21447
21500
 
21448
- var VERSION$1 = "3.4.3";
21501
+ var VERSION$1 = "3.4.4";
21449
21502
 
21450
21503
  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 };
21451
21504
  //# sourceMappingURL=bruce-cesium.es5.js.map