bruce-cesium 7.5.3 → 7.5.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.
- package/dist/bruce-cesium.es5.js +133 -39
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +131 -37
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-gatherer.js +3 -0
- package/dist/lib/rendering/entity-gatherer.js.map +1 -1
- package/dist/lib/rendering/tileset-styler.js +120 -35
- package/dist/lib/rendering/tileset-styler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +9 -2
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/entity-gatherer.d.ts +1 -0
- package/dist/types/rendering/tileset-styler.d.ts +48 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Cesium from 'cesium';
|
|
2
|
-
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature,
|
|
3
|
-
import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, Entity as Entity$1,
|
|
2
|
+
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, HorizontalOrigin, VerticalOrigin, HeightReference, ClassificationType, ConstantPositionProperty, DistanceDisplayCondition, JulianDate, Quaternion, HeadingPitchRoll, ArcType, CornerType, ShadowMode, ColorBlendMode, Model, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CustomDataSource, PolygonPipeline, CesiumInspector, defined, ClockRange, DynamicEnvironmentMapManager, EllipsoidGeodesic, sampleTerrainMostDetailed, ScreenSpaceEventHandler, ScreenSpaceEventType, GeometryInstance, Fullscreen, CzmlDataSource } from 'cesium';
|
|
3
|
+
import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Api, Calculator, ClientFile, Entity as Entity$1, EntityTag, EntityType, ObjectUtils, Style, Carto, Geometry as Geometry$1, EntityLod, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, Bounds, ClientFileValueMap, Color as Color$1, DataLab, DelayQueue, AccountConcept, BruceApi, EntityRelation, RecordChangeFeed, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, ProjectViewBookmarkGroup, EntityRelationType, EntityHistoricData } from 'bruce-models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -12417,8 +12417,15 @@ var VisualsRegister;
|
|
|
12417
12417
|
createIfMissing: params.createIfMissing !== false
|
|
12418
12418
|
};
|
|
12419
12419
|
const doc = this.viewer.container.ownerDocument;
|
|
12420
|
-
|
|
12421
|
-
|
|
12420
|
+
// Only a label following the cursor should go when the cursor leaves the canvas.
|
|
12421
|
+
if (params.position) {
|
|
12422
|
+
doc.addEventListener("pointermove", this.CheckLabelHoverBounds, true);
|
|
12423
|
+
this.viewer.container.addEventListener("pointerleave", this.CheckLabelHoverBounds);
|
|
12424
|
+
}
|
|
12425
|
+
else {
|
|
12426
|
+
doc.removeEventListener("pointermove", this.CheckLabelHoverBounds, true);
|
|
12427
|
+
this.viewer.container.removeEventListener("pointerleave", this.CheckLabelHoverBounds);
|
|
12428
|
+
}
|
|
12422
12429
|
doc.defaultView.addEventListener("blur", this.ClearLabelHover);
|
|
12423
12430
|
this.SyncLabelHover();
|
|
12424
12431
|
this.viewer.scene.requestRender();
|
|
@@ -17297,6 +17304,9 @@ class EntityGatherer {
|
|
|
17297
17304
|
}
|
|
17298
17305
|
};
|
|
17299
17306
|
}
|
|
17307
|
+
HasEntityDataOverride(eId) {
|
|
17308
|
+
return this.entityDataOverrides.has(eId);
|
|
17309
|
+
}
|
|
17300
17310
|
SetEntityDataOverride(eId, entity) {
|
|
17301
17311
|
if (this.disposed) {
|
|
17302
17312
|
return;
|
|
@@ -17993,6 +18003,24 @@ function correctStyle(style) {
|
|
|
17993
18003
|
}
|
|
17994
18004
|
return style;
|
|
17995
18005
|
}
|
|
18006
|
+
/**
|
|
18007
|
+
* Reads the baked attribute declaration from a loaded tileset, keyed by path.
|
|
18008
|
+
* @param cTileset
|
|
18009
|
+
*/
|
|
18010
|
+
function getBakedAttributes(cTileset) {
|
|
18011
|
+
var _a, _b;
|
|
18012
|
+
const result = new Map();
|
|
18013
|
+
const declared = (_b = (_a = cTileset === null || cTileset === void 0 ? void 0 : cTileset.extras) === null || _a === void 0 ? void 0 : _a.bruce) === null || _b === void 0 ? void 0 : _b.bakedAttributes;
|
|
18014
|
+
if (!Array.isArray(declared)) {
|
|
18015
|
+
return result;
|
|
18016
|
+
}
|
|
18017
|
+
for (const baked of declared) {
|
|
18018
|
+
if (Array.isArray(baked === null || baked === void 0 ? void 0 : baked.path) && baked.path.length && typeof baked.property == "string") {
|
|
18019
|
+
result.set(JSON.stringify(baked.path), baked);
|
|
18020
|
+
}
|
|
18021
|
+
}
|
|
18022
|
+
return result;
|
|
18023
|
+
}
|
|
17996
18024
|
function colorToCColor$3(color) {
|
|
17997
18025
|
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
17998
18026
|
}
|
|
@@ -18063,6 +18091,10 @@ class TilesetStyler {
|
|
|
18063
18091
|
// When false the Entity data is still gathered and the regos still updated, but no colour is
|
|
18064
18092
|
// applied. A historic item that did not ask for styling needs the first without the second.
|
|
18065
18093
|
this.applyStyles = true;
|
|
18094
|
+
// Attribute values the tiles carry per feature, keyed by JSON path. Empty for a tileset without them.
|
|
18095
|
+
this.bakedAttributes = new Map();
|
|
18096
|
+
// Entities changed since the tileset was generated, so their baked values can no longer be trusted.
|
|
18097
|
+
this.bakedStaleIds = new Set();
|
|
18066
18098
|
this.reRenderState = new EntityReRenderMaintainState();
|
|
18067
18099
|
// More expensive process.
|
|
18068
18100
|
// When an Entity is styled, the rego is reviewed and updated if needed.
|
|
@@ -18104,6 +18136,7 @@ class TilesetStyler {
|
|
|
18104
18136
|
this.viewer = viewer;
|
|
18105
18137
|
this.api = api;
|
|
18106
18138
|
this.cTileset = cTileset;
|
|
18139
|
+
this.bakedAttributes = getBakedAttributes(cTileset);
|
|
18107
18140
|
this.register = register;
|
|
18108
18141
|
this.menuItemId = menuItemId;
|
|
18109
18142
|
this.historic = Boolean(historic);
|
|
@@ -18182,6 +18215,7 @@ class TilesetStyler {
|
|
|
18182
18215
|
for (const [internalId, entityId] of this.styledByInternalId) {
|
|
18183
18216
|
if (RecordChangeFeed.isEntityInternalIdInRangeString(rangeStr, internalId)) {
|
|
18184
18217
|
this.feedPendingRestyleIds.add(entityId);
|
|
18218
|
+
this.bakedStaleIds.add(entityId);
|
|
18185
18219
|
}
|
|
18186
18220
|
}
|
|
18187
18221
|
if (this.feedPendingRestyleIds.size && !this.feedRestyleThrottleTimer) {
|
|
@@ -18502,17 +18536,7 @@ class TilesetStyler {
|
|
|
18502
18536
|
for (const key of pendingKeys) {
|
|
18503
18537
|
const relatedIds = this.stylePendingEntityIds.get(key);
|
|
18504
18538
|
if (relatedIds) {
|
|
18505
|
-
|
|
18506
|
-
this.entityGatherer.Queue(Array.from(relatedIds));
|
|
18507
|
-
}
|
|
18508
|
-
else {
|
|
18509
|
-
relatedIds.forEach(id => {
|
|
18510
|
-
const rego = this.getEntityRego(id);
|
|
18511
|
-
if (rego) {
|
|
18512
|
-
this.styleTilesetFeature(rego);
|
|
18513
|
-
}
|
|
18514
|
-
});
|
|
18515
|
-
}
|
|
18539
|
+
this.styleOrGatherIds(key, relatedIds);
|
|
18516
18540
|
}
|
|
18517
18541
|
}
|
|
18518
18542
|
this.stylePendingEntityIds.clear();
|
|
@@ -18527,17 +18551,7 @@ class TilesetStyler {
|
|
|
18527
18551
|
if (!relatedIds) {
|
|
18528
18552
|
return;
|
|
18529
18553
|
}
|
|
18530
|
-
|
|
18531
|
-
this.entityGatherer.Queue(Array.from(relatedIds));
|
|
18532
|
-
}
|
|
18533
|
-
else {
|
|
18534
|
-
relatedIds.forEach(id => {
|
|
18535
|
-
const rego = this.getEntityRego(id);
|
|
18536
|
-
if (rego) {
|
|
18537
|
-
this.styleTilesetFeature(rego);
|
|
18538
|
-
}
|
|
18539
|
-
});
|
|
18540
|
-
}
|
|
18554
|
+
this.styleOrGatherIds(entityTypeId, relatedIds);
|
|
18541
18555
|
this.stylePendingEntityIds.delete(entityTypeId);
|
|
18542
18556
|
}
|
|
18543
18557
|
hasMappingRow(entityTypeId) {
|
|
@@ -18622,20 +18636,10 @@ class TilesetStyler {
|
|
|
18622
18636
|
this.loadEntityTypeDefaultStyle(typeId);
|
|
18623
18637
|
}
|
|
18624
18638
|
if (this.styleMappingsLoaded.get(typeId) || (this.styleMappingLoaded && !this.hasMappingRow(typeId))) {
|
|
18625
|
-
|
|
18626
|
-
needsDataIds.push(rego.entityId);
|
|
18627
|
-
}
|
|
18628
|
-
else {
|
|
18629
|
-
this.styleTilesetFeature(rego);
|
|
18630
|
-
}
|
|
18639
|
+
this.styleOrCollect(rego, typeId, needsDataIds);
|
|
18631
18640
|
}
|
|
18632
18641
|
else if (!this.styleMappingsLoaded.has(typeId) && this.styleFallbackLoaded) {
|
|
18633
|
-
|
|
18634
|
-
needsDataIds.push(rego.entityId);
|
|
18635
|
-
}
|
|
18636
|
-
else {
|
|
18637
|
-
this.styleTilesetFeature(rego);
|
|
18638
|
-
}
|
|
18642
|
+
this.styleOrCollect(rego, typeId, needsDataIds);
|
|
18639
18643
|
}
|
|
18640
18644
|
else {
|
|
18641
18645
|
if (!this.stylePendingEntityIds.has(typeId)) {
|
|
@@ -18648,6 +18652,96 @@ class TilesetStyler {
|
|
|
18648
18652
|
this.entityGatherer.Queue(needsDataIds, highPriority);
|
|
18649
18653
|
}
|
|
18650
18654
|
}
|
|
18655
|
+
/**
|
|
18656
|
+
* Styles each Entity waiting on a type's style, gathering the records of those that need one.
|
|
18657
|
+
* @param entityTypeId
|
|
18658
|
+
* @param entityIds
|
|
18659
|
+
*/
|
|
18660
|
+
styleOrGatherIds(entityTypeId, entityIds) {
|
|
18661
|
+
const gatherIds = [];
|
|
18662
|
+
for (const id of entityIds) {
|
|
18663
|
+
const rego = this.getEntityRego(id);
|
|
18664
|
+
if (rego) {
|
|
18665
|
+
this.styleOrCollect(rego, entityTypeId, gatherIds);
|
|
18666
|
+
}
|
|
18667
|
+
}
|
|
18668
|
+
if (gatherIds.length) {
|
|
18669
|
+
this.entityGatherer.Queue(gatherIds);
|
|
18670
|
+
}
|
|
18671
|
+
}
|
|
18672
|
+
/**
|
|
18673
|
+
* Styles a feature now when its style reads no record, or reads only values its tile carries, and otherwise collects it for gathering.
|
|
18674
|
+
* @param rego
|
|
18675
|
+
* @param entityTypeId
|
|
18676
|
+
* @param gatherIds Receives the Entity ID when its record is needed.
|
|
18677
|
+
*/
|
|
18678
|
+
styleOrCollect(rego, entityTypeId, gatherIds) {
|
|
18679
|
+
if (!this.getTilesetFeatureNeedsFullData(entityTypeId)) {
|
|
18680
|
+
this.styleTilesetFeature(rego);
|
|
18681
|
+
return;
|
|
18682
|
+
}
|
|
18683
|
+
const record = this.canStyleFromBaked(rego.entityId, entityTypeId) ? this.readBakedRecord(rego.visual) : null;
|
|
18684
|
+
if (!record) {
|
|
18685
|
+
gatherIds.push(rego.entityId);
|
|
18686
|
+
return;
|
|
18687
|
+
}
|
|
18688
|
+
this.styleTilesetFeatureFullData(rego, record, []);
|
|
18689
|
+
// A later edit has to reach the record path, and the change feed finds Entities by Internal ID.
|
|
18690
|
+
if (rego.internalId != null) {
|
|
18691
|
+
this.styledByInternalId.set(rego.internalId, rego.entityId);
|
|
18692
|
+
}
|
|
18693
|
+
}
|
|
18694
|
+
/**
|
|
18695
|
+
* Returns if the tile's baked values hold everything this Entity's style would read from its record.
|
|
18696
|
+
* @param entityId
|
|
18697
|
+
* @param entityTypeId
|
|
18698
|
+
*/
|
|
18699
|
+
canStyleFromBaked(entityId, entityTypeId) {
|
|
18700
|
+
var _a, _b, _c;
|
|
18701
|
+
// Baked values are the base record at generation time, which a scenario, a point in time or merged sources all differ from.
|
|
18702
|
+
if (!this.bakedAttributes.size || this.historic || !!this.scenario || this.expandSources) {
|
|
18703
|
+
return false;
|
|
18704
|
+
}
|
|
18705
|
+
if (this.bakedStaleIds.has(entityId) || ((_a = this.entityGatherer) === null || _a === void 0 ? void 0 : _a.HasEntityDataOverride(entityId))) {
|
|
18706
|
+
return false;
|
|
18707
|
+
}
|
|
18708
|
+
const paths = Calculator.GetFieldPaths((_c = (_b = this.getTilesetFeatureStyle(entityTypeId)) === null || _b === void 0 ? void 0 : _b.modelStyle) === null || _c === void 0 ? void 0 : _c.fillColor);
|
|
18709
|
+
return paths != null && paths.every(path => this.bakedAttributes.has(JSON.stringify(path)));
|
|
18710
|
+
}
|
|
18711
|
+
/**
|
|
18712
|
+
* Builds a stand-in record from a feature's baked values, holding only the attributes that have one.
|
|
18713
|
+
* Returns null when the feature's tile lacks a declared column, so the record is gathered instead.
|
|
18714
|
+
* @param visual
|
|
18715
|
+
*/
|
|
18716
|
+
readBakedRecord(visual) {
|
|
18717
|
+
if (!(visual instanceof Cesium3DTileFeature)) {
|
|
18718
|
+
return null;
|
|
18719
|
+
}
|
|
18720
|
+
const record = {};
|
|
18721
|
+
for (const baked of this.bakedAttributes.values()) {
|
|
18722
|
+
if (!visual.hasProperty(baked.property)) {
|
|
18723
|
+
return null;
|
|
18724
|
+
}
|
|
18725
|
+
let value = visual.getProperty(baked.property);
|
|
18726
|
+
if (value == null) {
|
|
18727
|
+
continue;
|
|
18728
|
+
}
|
|
18729
|
+
// Booleans travel as 0/1 because a boolean column has no way to say "no value".
|
|
18730
|
+
if (baked.type == "BOOLEAN") {
|
|
18731
|
+
value = value != 0;
|
|
18732
|
+
}
|
|
18733
|
+
let target = record;
|
|
18734
|
+
for (let i = 0; i < baked.path.length - 1; i++) {
|
|
18735
|
+
const segment = baked.path[i];
|
|
18736
|
+
if (target[segment] == null || typeof target[segment] != "object") {
|
|
18737
|
+
target[segment] = {};
|
|
18738
|
+
}
|
|
18739
|
+
target = target[segment];
|
|
18740
|
+
}
|
|
18741
|
+
target[baked.path[baked.path.length - 1]] = value;
|
|
18742
|
+
}
|
|
18743
|
+
return record;
|
|
18744
|
+
}
|
|
18651
18745
|
styleTilesetFeature(rego) {
|
|
18652
18746
|
this.styleTilesetFeatureFullData(rego, null, []);
|
|
18653
18747
|
}
|
|
@@ -51223,7 +51317,7 @@ var StyleUtils;
|
|
|
51223
51317
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
51224
51318
|
})(StyleUtils || (StyleUtils = {}));
|
|
51225
51319
|
|
|
51226
|
-
const VERSION = "7.5.
|
|
51320
|
+
const VERSION = "7.5.5";
|
|
51227
51321
|
/**
|
|
51228
51322
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
51229
51323
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|