bruce-cesium 6.2.2 → 6.2.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.
- package/dist/bruce-cesium.es5.js +216 -101
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +210 -99
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +2 -1
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +144 -98
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
- package/dist/lib/rendering/xgrids-render-engine.js +76 -0
- package/dist/lib/rendering/xgrids-render-engine.js.map +1 -0
- package/dist/types/bruce-cesium.d.ts +2 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-arb-render-manager.d.ts +11 -1
- package/dist/types/rendering/xgrids-render-engine.d.ts +14 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -20905,6 +20905,72 @@
|
|
|
20905
20905
|
DataSourceStaticKmlManager.Manager = Manager;
|
|
20906
20906
|
})(exports.DataSourceStaticKmlManager || (exports.DataSourceStaticKmlManager = {}));
|
|
20907
20907
|
|
|
20908
|
+
(function (XGridsRenderEngine) {
|
|
20909
|
+
function Render(params) {
|
|
20910
|
+
var _a, _b, _c;
|
|
20911
|
+
const { api, viewer, tileset } = params;
|
|
20912
|
+
if (!LCCRender) {
|
|
20913
|
+
console.warn("[XGridsRenderEngine] Render() LCCRender library not available.");
|
|
20914
|
+
return null;
|
|
20915
|
+
}
|
|
20916
|
+
const settings = tileset.settings;
|
|
20917
|
+
let position = settings === null || settings === void 0 ? void 0 : settings.origin;
|
|
20918
|
+
if (settings.dontTransform) {
|
|
20919
|
+
position = null;
|
|
20920
|
+
}
|
|
20921
|
+
let m1 = undefined;
|
|
20922
|
+
// Location matrix.
|
|
20923
|
+
if ((position === null || position === void 0 ? void 0 : position.latitude) || (position === null || position === void 0 ? void 0 : position.longitude) || (position === null || position === void 0 ? void 0 : position.altitude)) {
|
|
20924
|
+
m1 = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(EnsureNumber(position.longitude, 0), EnsureNumber(position.latitude, 0), EnsureNumber(position.altitude, 0)));
|
|
20925
|
+
}
|
|
20926
|
+
else {
|
|
20927
|
+
m1 = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(0, 0, 0));
|
|
20928
|
+
}
|
|
20929
|
+
// Apply HPR + scale.
|
|
20930
|
+
if (!settings.dontRotate && !settings.dontTransform) {
|
|
20931
|
+
const translationMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, 0), new Cesium.Matrix4());
|
|
20932
|
+
const hpr = Cesium.HeadingPitchRoll.fromDegrees(EnsureNumber((_a = settings.rotation) === null || _a === void 0 ? void 0 : _a.z), EnsureNumber((_b = settings.rotation) === null || _b === void 0 ? void 0 : _b.x), EnsureNumber((_c = settings.rotation) === null || _c === void 0 ? void 0 : _c.y), new Cesium.HeadingPitchRoll());
|
|
20933
|
+
const hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
|
|
20934
|
+
const scaleMatrix = Cesium.Matrix4.fromUniformScale(EnsureNumber((position === null || position === void 0 ? void 0 : position.scale) || 1, 1), new Cesium.Matrix4());
|
|
20935
|
+
let combinedMatrix = Cesium.Matrix4.multiply(m1, translationMatrix, new Cesium.Matrix4());
|
|
20936
|
+
combinedMatrix = Cesium.Matrix4.multiply(combinedMatrix, Cesium.Matrix4.fromRotation(hprRotation), new Cesium.Matrix4());
|
|
20937
|
+
combinedMatrix = Cesium.Matrix4.multiply(combinedMatrix, scaleMatrix, new Cesium.Matrix4());
|
|
20938
|
+
m1 = combinedMatrix;
|
|
20939
|
+
}
|
|
20940
|
+
const loadUrl = BModels.Tileset.GetFileUrl({
|
|
20941
|
+
file: tileset.rootFileName || "meta.lcc",
|
|
20942
|
+
tilesetId: tileset.id,
|
|
20943
|
+
viaCdn: true,
|
|
20944
|
+
legacy: true,
|
|
20945
|
+
cacheToken: tileset.generateVersion,
|
|
20946
|
+
api: api
|
|
20947
|
+
});
|
|
20948
|
+
return LCCRender.load({
|
|
20949
|
+
camera: viewer.camera,
|
|
20950
|
+
scene: viewer.scene,
|
|
20951
|
+
dataPath: loadUrl,
|
|
20952
|
+
renderLib: Cesium,
|
|
20953
|
+
canvas: viewer.canvas,
|
|
20954
|
+
useEnv: false,
|
|
20955
|
+
modelMatrix: m1,
|
|
20956
|
+
useIndexDB: false,
|
|
20957
|
+
appKey: null
|
|
20958
|
+
});
|
|
20959
|
+
}
|
|
20960
|
+
XGridsRenderEngine.Render = Render;
|
|
20961
|
+
function Remove(viewer, renderObject) {
|
|
20962
|
+
if (!renderObject) {
|
|
20963
|
+
return;
|
|
20964
|
+
}
|
|
20965
|
+
if (!LCCRender) {
|
|
20966
|
+
console.warn("[XGridsRenderEngine] Remove() LCCRender library not available.");
|
|
20967
|
+
return;
|
|
20968
|
+
}
|
|
20969
|
+
LCCRender.unload(renderObject);
|
|
20970
|
+
}
|
|
20971
|
+
XGridsRenderEngine.Remove = Remove;
|
|
20972
|
+
})(exports.XGridsRenderEngine || (exports.XGridsRenderEngine = {}));
|
|
20973
|
+
|
|
20908
20974
|
async function getLegacyTileset(params) {
|
|
20909
20975
|
const { apiGetter, menuItem, tileset } = params;
|
|
20910
20976
|
try {
|
|
@@ -20938,6 +21004,12 @@
|
|
|
20938
21004
|
}
|
|
20939
21005
|
}
|
|
20940
21006
|
(function (TilesetArbRenderManager) {
|
|
21007
|
+
let ERenderType;
|
|
21008
|
+
(function (ERenderType) {
|
|
21009
|
+
ERenderType["CesiumTileset"] = "CesiumTileset";
|
|
21010
|
+
ERenderType["XGridsLCC"] = "XGridsLCC";
|
|
21011
|
+
ERenderType["Unknown"] = "Unknown";
|
|
21012
|
+
})(ERenderType = TilesetArbRenderManager.ERenderType || (TilesetArbRenderManager.ERenderType = {}));
|
|
20941
21013
|
class Manager {
|
|
20942
21014
|
get Disposed() {
|
|
20943
21015
|
return this.disposed;
|
|
@@ -20948,6 +21020,12 @@
|
|
|
20948
21020
|
get Styler() {
|
|
20949
21021
|
return this.styler;
|
|
20950
21022
|
}
|
|
21023
|
+
get RenderType() {
|
|
21024
|
+
return this.renderType;
|
|
21025
|
+
}
|
|
21026
|
+
get RenderTypeChanged() {
|
|
21027
|
+
return this.renderTypeChanged;
|
|
21028
|
+
}
|
|
20951
21029
|
constructor(params) {
|
|
20952
21030
|
this.disposed = false;
|
|
20953
21031
|
this.cTileset = null;
|
|
@@ -20971,6 +21049,11 @@
|
|
|
20971
21049
|
// Saves having to do a case-insensitive lookup every time.
|
|
20972
21050
|
this.featurePropCache = new Map();
|
|
20973
21051
|
this.featurePropsChecked = 0;
|
|
21052
|
+
// How we're rendering the data.
|
|
21053
|
+
this.renderType = ERenderType.Unknown;
|
|
21054
|
+
this.renderTypeChanged = new BModels.BruceEvent();
|
|
21055
|
+
// LCC object if we're using XGrids to render LCC data.
|
|
21056
|
+
this.lccObject = null;
|
|
20974
21057
|
this.viewer = params.viewer;
|
|
20975
21058
|
this.getters = params.getters;
|
|
20976
21059
|
this.visualsManager = params.register;
|
|
@@ -21016,7 +21099,7 @@
|
|
|
21016
21099
|
}
|
|
21017
21100
|
const tilesetId = (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID;
|
|
21018
21101
|
(async () => {
|
|
21019
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
21102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21020
21103
|
if (tilesetId) {
|
|
21021
21104
|
let canAccess = false;
|
|
21022
21105
|
try {
|
|
@@ -21055,113 +21138,137 @@
|
|
|
21055
21138
|
if (tileset && loadUrlOverride) {
|
|
21056
21139
|
tileset.loadUrl = loadUrlOverride;
|
|
21057
21140
|
}
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
// Legacy type. We re-request using ui.tileset endpoint.
|
|
21065
|
-
const legacyTileset = tileset ? await getLegacyTileset({
|
|
21066
|
-
apiGetter: this.getters.GetBruceGetter(),
|
|
21067
|
-
menuItem: this.item,
|
|
21068
|
-
tileset
|
|
21069
|
-
}) : null;
|
|
21070
|
-
if (this.disposed) {
|
|
21071
|
-
return;
|
|
21072
|
-
}
|
|
21073
|
-
let accountId = (_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.tileset) === null || _c === void 0 ? void 0 : _c.ClientAccountID;
|
|
21074
|
-
if (!accountId) {
|
|
21075
|
-
accountId = this.getters.GetAccountId();
|
|
21076
|
-
}
|
|
21077
|
-
this.cTileset = await exports.TilesetRenderEngine.RenderLegacy({
|
|
21078
|
-
apiGetter: this.getters.GetBruceGetter(),
|
|
21079
|
-
tileset: legacyTileset,
|
|
21080
|
-
viewer: this.viewer,
|
|
21081
|
-
ionId: (_d = this.item.IonResource) === null || _d === void 0 ? void 0 : _d.AssetID,
|
|
21082
|
-
ionAccessToken: (_e = this.item.IonResource) === null || _e === void 0 ? void 0 : _e.AccessToken,
|
|
21083
|
-
loadUrl: loadUrlOverride,
|
|
21084
|
-
accountId: accountId,
|
|
21085
|
-
viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled),
|
|
21086
|
-
noMemoryLimit: this.item.noMaximumMemory,
|
|
21087
|
-
backFaceCulling: this.item.backFaceCulling
|
|
21141
|
+
// LCC Tileset to load through XGrids libs if they're available.
|
|
21142
|
+
if (tileset.type === BModels.Tileset.EType.LegacyStatic && tileset.rootFileName && (tileset.rootFileName.toLowerCase()).endsWith(".lcc")) {
|
|
21143
|
+
this.renderType = ERenderType.XGridsLCC;
|
|
21144
|
+
this.renderTypeChanged.Trigger(this.renderType);
|
|
21145
|
+
const api = this.getters.GetBruceApi({
|
|
21146
|
+
accountId: ((_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.tileset) === null || _c === void 0 ? void 0 : _c.ClientAccountID) || this.getters.GetAccountId()
|
|
21088
21147
|
});
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
this.cTileset = await exports.TilesetRenderEngine.Render({
|
|
21092
|
-
apiGetter: this.getters.GetBruceGetter(),
|
|
21093
|
-
tileset: tileset,
|
|
21148
|
+
this.lccObject = exports.XGridsRenderEngine.Render({
|
|
21149
|
+
api: api,
|
|
21094
21150
|
viewer: this.viewer,
|
|
21095
|
-
|
|
21096
|
-
accountId: (_g = (_f = this.item.tileset) === null || _f === void 0 ? void 0 : _f.ClientAccountID) !== null && _g !== void 0 ? _g : this.getters.GetAccountId(),
|
|
21097
|
-
viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled)
|
|
21151
|
+
tileset: tileset
|
|
21098
21152
|
});
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
}
|
|
21104
|
-
this.viewer.scene.requestRender();
|
|
21105
|
-
exports.TilesetRenderEngine.OnTilesetReady(this.cTileset).then(() => {
|
|
21106
|
-
if (this.disposed || this.viewer.isDestroyed()) {
|
|
21153
|
+
// Disposed while it was loading so we'll remove it now.
|
|
21154
|
+
if (this.Disposed && this.lccObject) {
|
|
21155
|
+
exports.XGridsRenderEngine.Remove(this.viewer, this.lccObject);
|
|
21156
|
+
this.lccObject = null;
|
|
21107
21157
|
return;
|
|
21108
21158
|
}
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
|
|
21114
|
-
|
|
21115
|
-
|
|
21116
|
-
|
|
21117
|
-
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21121
|
-
|
|
21159
|
+
}
|
|
21160
|
+
// Typical Cesium Tileset.
|
|
21161
|
+
else {
|
|
21162
|
+
this.renderType = ERenderType.CesiumTileset;
|
|
21163
|
+
this.renderTypeChanged.Trigger(this.renderType);
|
|
21164
|
+
const LEGACY_TYPES = [
|
|
21165
|
+
BModels.Tileset.EType.LegacyEntitiesSet,
|
|
21166
|
+
BModels.Tileset.EType.LegacyExternal,
|
|
21167
|
+
BModels.Tileset.EType.LegacyStatic
|
|
21168
|
+
];
|
|
21169
|
+
if (!type || LEGACY_TYPES.includes(type)) {
|
|
21170
|
+
// Legacy type. We re-request using ui.tileset endpoint.
|
|
21171
|
+
const legacyTileset = tileset ? await getLegacyTileset({
|
|
21172
|
+
apiGetter: this.getters.GetBruceGetter(),
|
|
21173
|
+
menuItem: this.item,
|
|
21174
|
+
tileset
|
|
21175
|
+
}) : null;
|
|
21176
|
+
if (this.disposed) {
|
|
21177
|
+
return;
|
|
21122
21178
|
}
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
}
|
|
21127
|
-
try {
|
|
21128
|
-
if (this.item.ApplyStyles ||
|
|
21129
|
-
this.item.Type == BModels.MenuItem.EType.IonTileset) {
|
|
21130
|
-
const api = this.getters.GetBruceApi();
|
|
21131
|
-
this.styler.Init({
|
|
21132
|
-
viewer: this.viewer,
|
|
21133
|
-
api: api,
|
|
21134
|
-
cTileset: this.cTileset,
|
|
21135
|
-
fallbackStyleId: this.item.styleId,
|
|
21136
|
-
styleMapping: this.item.StyleMapping,
|
|
21137
|
-
expandSources: false,
|
|
21138
|
-
menuItemId: this.item.id,
|
|
21139
|
-
register: this.visualsManager,
|
|
21140
|
-
});
|
|
21179
|
+
let accountId = (_e = (_d = this.item) === null || _d === void 0 ? void 0 : _d.tileset) === null || _e === void 0 ? void 0 : _e.ClientAccountID;
|
|
21180
|
+
if (!accountId) {
|
|
21181
|
+
accountId = this.getters.GetAccountId();
|
|
21141
21182
|
}
|
|
21142
|
-
this.
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
console.error(e);
|
|
21183
|
+
this.cTileset = await exports.TilesetRenderEngine.RenderLegacy({
|
|
21184
|
+
apiGetter: this.getters.GetBruceGetter(),
|
|
21185
|
+
tileset: legacyTileset,
|
|
21186
|
+
viewer: this.viewer,
|
|
21187
|
+
ionId: (_f = this.item.IonResource) === null || _f === void 0 ? void 0 : _f.AssetID,
|
|
21188
|
+
ionAccessToken: (_g = this.item.IonResource) === null || _g === void 0 ? void 0 : _g.AccessToken,
|
|
21189
|
+
loadUrl: loadUrlOverride,
|
|
21190
|
+
accountId: accountId,
|
|
21191
|
+
viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled),
|
|
21192
|
+
noMemoryLimit: this.item.noMaximumMemory,
|
|
21193
|
+
backFaceCulling: this.item.backFaceCulling
|
|
21194
|
+
});
|
|
21155
21195
|
}
|
|
21156
|
-
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
|
|
21196
|
+
else if (tileset) {
|
|
21197
|
+
this.cTileset = await exports.TilesetRenderEngine.Render({
|
|
21198
|
+
apiGetter: this.getters.GetBruceGetter(),
|
|
21199
|
+
tileset: tileset,
|
|
21200
|
+
viewer: this.viewer,
|
|
21201
|
+
coords: null,
|
|
21202
|
+
accountId: (_j = (_h = this.item.tileset) === null || _h === void 0 ? void 0 : _h.ClientAccountID) !== null && _j !== void 0 ? _j : this.getters.GetAccountId(),
|
|
21203
|
+
viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled)
|
|
21204
|
+
});
|
|
21160
21205
|
}
|
|
21161
|
-
|
|
21162
|
-
|
|
21206
|
+
if (this.disposed) {
|
|
21207
|
+
this.doDispose();
|
|
21208
|
+
return;
|
|
21163
21209
|
}
|
|
21164
|
-
|
|
21210
|
+
this.viewer.scene.requestRender();
|
|
21211
|
+
exports.TilesetRenderEngine.OnTilesetReady(this.cTileset).then(() => {
|
|
21212
|
+
if (this.disposed || this.viewer.isDestroyed()) {
|
|
21213
|
+
return;
|
|
21214
|
+
}
|
|
21215
|
+
// Colour mask to apply to the Tileset as a whole.
|
|
21216
|
+
// Individual Entities can override this.
|
|
21217
|
+
// This is typically used for Tilesets without Entities to allow some sort of basic styling per-bookmark.
|
|
21218
|
+
try {
|
|
21219
|
+
const colorCss = this.item.colorMask;
|
|
21220
|
+
if (colorCss) {
|
|
21221
|
+
this.cTileset.style = new Cesium.Cesium3DTileStyle({
|
|
21222
|
+
color: {
|
|
21223
|
+
conditions: [
|
|
21224
|
+
["true", `color("${colorCss}")`]
|
|
21225
|
+
]
|
|
21226
|
+
}
|
|
21227
|
+
});
|
|
21228
|
+
}
|
|
21229
|
+
}
|
|
21230
|
+
catch (e) {
|
|
21231
|
+
console.error(e);
|
|
21232
|
+
}
|
|
21233
|
+
try {
|
|
21234
|
+
if (this.item.ApplyStyles ||
|
|
21235
|
+
this.item.Type == BModels.MenuItem.EType.IonTileset) {
|
|
21236
|
+
const api = this.getters.GetBruceApi();
|
|
21237
|
+
this.styler.Init({
|
|
21238
|
+
viewer: this.viewer,
|
|
21239
|
+
api: api,
|
|
21240
|
+
cTileset: this.cTileset,
|
|
21241
|
+
fallbackStyleId: this.item.styleId,
|
|
21242
|
+
styleMapping: this.item.StyleMapping,
|
|
21243
|
+
expandSources: false,
|
|
21244
|
+
menuItemId: this.item.id,
|
|
21245
|
+
register: this.visualsManager,
|
|
21246
|
+
});
|
|
21247
|
+
}
|
|
21248
|
+
this.onCTilesetLoad();
|
|
21249
|
+
this.viewer.scene.requestRender();
|
|
21250
|
+
}
|
|
21251
|
+
catch (e) {
|
|
21252
|
+
console.error(e);
|
|
21253
|
+
}
|
|
21254
|
+
});
|
|
21255
|
+
this.cTileset.tileLoad.addEventListener((tile) => {
|
|
21256
|
+
try {
|
|
21257
|
+
this.queueTile(tile, true);
|
|
21258
|
+
}
|
|
21259
|
+
catch (e) {
|
|
21260
|
+
console.error(e);
|
|
21261
|
+
}
|
|
21262
|
+
});
|
|
21263
|
+
this.cTileset.tileUnload.addEventListener((tile) => {
|
|
21264
|
+
try {
|
|
21265
|
+
this.queueTile(tile, false);
|
|
21266
|
+
}
|
|
21267
|
+
catch (e) {
|
|
21268
|
+
console.error(e);
|
|
21269
|
+
}
|
|
21270
|
+
});
|
|
21271
|
+
}
|
|
21165
21272
|
})();
|
|
21166
21273
|
}
|
|
21167
21274
|
/**
|
|
@@ -21305,6 +21412,10 @@
|
|
|
21305
21412
|
}
|
|
21306
21413
|
this.cTileset = null;
|
|
21307
21414
|
}
|
|
21415
|
+
if (this.lccObject) {
|
|
21416
|
+
exports.XGridsRenderEngine.Remove(this.viewer, this.lccObject);
|
|
21417
|
+
this.lccObject = null;
|
|
21418
|
+
}
|
|
21308
21419
|
(_b = this.styler) === null || _b === void 0 ? void 0 : _b.Dispose();
|
|
21309
21420
|
this.visualsManager.RemoveRegos({
|
|
21310
21421
|
menuItemId: this.item.id
|
|
@@ -34361,7 +34472,7 @@
|
|
|
34361
34472
|
}
|
|
34362
34473
|
}
|
|
34363
34474
|
|
|
34364
|
-
const VERSION = "6.2.
|
|
34475
|
+
const VERSION = "6.2.4";
|
|
34365
34476
|
|
|
34366
34477
|
exports.VERSION = VERSION;
|
|
34367
34478
|
exports.isOutlineChanged = isOutlineChanged;
|