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.
@@ -3129,6 +3129,54 @@
3129
3129
  }
3130
3130
  return recheck;
3131
3131
  }
3132
+ /**
3133
+ * Returns true if the given rego should be ignored from culling.
3134
+ * @param rego
3135
+ * @returns
3136
+ */
3137
+ function isCullingIgnored(viewer, rego) {
3138
+ if (
3139
+ // No rego or visual.
3140
+ // This is a safety check to avoid crashes.
3141
+ !rego ||
3142
+ !rego.visual ||
3143
+ // We will only touch entities. Not tileset stuff.
3144
+ !(rego.visual instanceof Cesium.Entity) ||
3145
+ // We won't touch relationship lines because they dynamically change shape.
3146
+ rego.relation != null ||
3147
+ // Explicitly being either shown or hidden.
3148
+ rego.overrideShow != null ||
3149
+ // Part of an independent collection.
3150
+ // Won't touch in case there is special logic.
3151
+ rego.collection) {
3152
+ return true;
3153
+ }
3154
+ var visual = rego.visual;
3155
+ // We will only cull clamped stuff since it seems that's where we get benefits from.
3156
+ var heightRef;
3157
+ if (visual.polygon) {
3158
+ heightRef = getValue(viewer, visual.polygon.heightReference);
3159
+ }
3160
+ else if (visual.polyline) {
3161
+ heightRef = getValue(viewer, visual.polyline.clampToGround) == false ? Cesium.HeightReference.NONE : Cesium.HeightReference.CLAMP_TO_GROUND;
3162
+ }
3163
+ else if (visual.corridor) {
3164
+ heightRef = getValue(viewer, visual.corridor.heightReference);
3165
+ }
3166
+ else if (visual.ellipse) {
3167
+ heightRef = getValue(viewer, visual.ellipse.heightReference);
3168
+ }
3169
+ else if (visual.model) {
3170
+ heightRef = getValue(viewer, visual.model.heightReference);
3171
+ }
3172
+ else if (visual.point) {
3173
+ heightRef = getValue(viewer, visual.point.heightReference);
3174
+ }
3175
+ else if (visual.billboard) {
3176
+ heightRef = getValue(viewer, visual.billboard.heightReference);
3177
+ }
3178
+ return heightRef != Cesium.HeightReference.CLAMP_TO_GROUND;
3179
+ }
3132
3180
  /**
3133
3181
  * Runs through all entities in the register and culls them if they are out of the viewport.
3134
3182
  * This will work in batches.
@@ -3155,7 +3203,7 @@
3155
3203
  var rego = register.GetRego({
3156
3204
  entityId: entityId
3157
3205
  });
3158
- if (!rego || !rego.visual || !(rego.visual instanceof Cesium.Entity) || rego.relation != null || rego.overrideShow != null || rego.collection) {
3206
+ if (isCullingIgnored(viewer, rego)) {
3159
3207
  continue;
3160
3208
  }
3161
3209
  var parts = exports.EntityUtils.GatherEntity({
@@ -3266,7 +3314,10 @@
3266
3314
  };
3267
3315
  }
3268
3316
  VisualRegisterCuller.Monitor = Monitor;
3269
- function IsCulled(viewer, visual) {
3317
+ function IsCulled(viewer, rego, visual) {
3318
+ if (isCullingIgnored(viewer, rego)) {
3319
+ return false;
3320
+ }
3270
3321
  if (!visual) {
3271
3322
  return false;
3272
3323
  }
@@ -6286,13 +6337,9 @@
6286
6337
  console.warn("updateCEntityShow(): Max show depth reached. EntityId = " + rego.entityId);
6287
6338
  return;
6288
6339
  }
6289
- if (show && !rego.relation && !rego.overrideShow && !rego.collection) {
6290
- // Culling is controlled by "visual-register-culler.ts".
6291
- // When an object is unculled then the 'updateEntityShow' function is re-called to reveal it and related objects.
6292
- // A sub-object can be culled while the siblings are not.
6293
- var isCulled = show ? VisualRegisterCuller.IsCulled(viewer, visual) : true;
6294
- show = !isCulled;
6295
- }
6340
+ // A sub-object can be culled while the siblings are not.
6341
+ // We only cull things that give us some benefit. For example clamped to ground graphics are expensive to keep rendered.
6342
+ show = show ? !VisualRegisterCuller.IsCulled(viewer, rego, visual) : true;
6296
6343
  if (visual._parentEntity && !ignoreParent) {
6297
6344
  updateCEntityShow(viewer, visual._parentEntity, rego, show, false, depth + 1);
6298
6345
  }
@@ -10997,6 +11044,10 @@
10997
11044
  this.cTileset = cTileset;
10998
11045
  this.fallbackStyleId = fallbackStyleId;
10999
11046
  this.styleMapping = styleMapping;
11047
+ if (styleMapping) {
11048
+ // Dereference.
11049
+ styleMapping = JSON.parse(JSON.stringify(styleMapping));
11050
+ }
11000
11051
  // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
11001
11052
  // We have some evil hard-coded style mappings that need to be fixed.
11002
11053
  // These exist within legacy project views.
@@ -11027,6 +11078,8 @@
11027
11078
  Styler.prototype.UpdateStyleMapping = function (params) {
11028
11079
  var _a;
11029
11080
  if (params.styleMapping) {
11081
+ // Dereference.
11082
+ params.styleMapping = JSON.parse(JSON.stringify(params.styleMapping));
11030
11083
  this.styleMapping = params.styleMapping;
11031
11084
  // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
11032
11085
  // We have some evil hard-coded style mappings that need to be fixed.
@@ -21386,7 +21439,7 @@
21386
21439
  CesiumViewMonitor.Monitor = Monitor;
21387
21440
  })(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
21388
21441
 
21389
- var VERSION$1 = "3.4.3";
21442
+ var VERSION$1 = "3.4.4";
21390
21443
 
21391
21444
  exports.VERSION = VERSION$1;
21392
21445
  exports.CesiumParabola = CesiumParabola;