bruce-cesium 6.6.9 → 6.7.0
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 +58 -32
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +56 -30
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js +14 -2
- package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js.map +1 -1
- package/dist/lib/rendering/tile-render-engine.js +24 -2
- package/dist/lib/rendering/tile-render-engine.js.map +1 -1
- package/dist/lib/rendering/view-render-engine.js +16 -20
- package/dist/lib/rendering/view-render-engine.js.map +1 -1
- package/dist/lib/viewer/viewer-utils.js +2 -6
- package/dist/lib/viewer/viewer-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/tilesets/tileset-osm-render-manager.d.ts +2 -2
- package/dist/types/viewer/viewer-utils.d.ts +2 -1
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cartes, Entity as Entity$1, Geometry, ProjectViewTile, ENVIRONMENT, EntityRelationType, EntityType, Calculator, Style, DelayQueue, LRUCache, BruceEvent, ObjectUtils, AccountConcept, EntityHistoricData, EntityLod, RecordChangeFeed, ZoomControl, EntityTag, Tileset, EntityCoords, Api, DataLab, EntitySource, ClientFile, MenuItem, EntityRelation,
|
|
1
|
+
import { Cartes, Entity as Entity$1, Geometry, ProjectViewTile, ENVIRONMENT, EntityRelationType, EntityType, Calculator, Style, DelayQueue, LRUCache, BruceEvent, ObjectUtils, AccountConcept, EntityHistoricData, EntityLod, RecordChangeFeed, ZoomControl, EntityTag, Tileset, EntityCoords, Api, DataLab, BruceApi, EntitySource, ProgramKey, ClientFile, MenuItem, EntityRelation, Bounds, Carto, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, ColorMaterialProperty,
|
|
3
|
+
import { Cartographic, ColorMaterialProperty, Color, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, Entity, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Cesium3DTileset, IonResource, OrthographicFrustum, Ion, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -16113,7 +16113,19 @@ var TilesetOsmRenderManager;
|
|
|
16113
16113
|
// Already exists, no need to re-initialize.
|
|
16114
16114
|
return;
|
|
16115
16115
|
}
|
|
16116
|
-
const
|
|
16116
|
+
const ionCheckApi = this.getters.GetBruceApi({});
|
|
16117
|
+
await ionCheckApi.Loading;
|
|
16118
|
+
const { programKeys: ionCheckKeys } = await ProgramKey.GetList({ api: ionCheckApi });
|
|
16119
|
+
const ionKey = ionCheckKeys.find(k => k.ProgramId === ProgramKey.EProgramId.CesiumIon);
|
|
16120
|
+
// Use if marked as available.
|
|
16121
|
+
let validToken;
|
|
16122
|
+
if (ionCheckApi.IsVersionAtLeast(BruceApi.VERSION_WITH_PROXIES)) {
|
|
16123
|
+
validToken = (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Available) === true;
|
|
16124
|
+
}
|
|
16125
|
+
// Legacy route, to be killed off.
|
|
16126
|
+
else {
|
|
16127
|
+
validToken = (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Key) ? await ViewerUtils.AssertIonToken(ionKey.Key) : false;
|
|
16128
|
+
}
|
|
16117
16129
|
if (!validToken) {
|
|
16118
16130
|
console.warn("'tileset-osm-render-manager.ts' could not locate a valid Cesium Ion token.");
|
|
16119
16131
|
return;
|
|
@@ -23080,7 +23092,18 @@ var TileRenderEngine;
|
|
|
23080
23092
|
// If we need a cesium token, and we don't have one, then we can't render this.
|
|
23081
23093
|
let shouldCreate = true;
|
|
23082
23094
|
if (NEEDS_CESIUM_TOKEN.includes(defaultImg.id)) {
|
|
23083
|
-
|
|
23095
|
+
const ionCheckApi = apiGetter.getApi(apiGetter.accountId);
|
|
23096
|
+
await ionCheckApi.Loading;
|
|
23097
|
+
const { programKeys: ionCheckKeys } = await ProgramKey.GetList({ api: ionCheckApi });
|
|
23098
|
+
const ionKey = ionCheckKeys.find(k => k.ProgramId === ProgramKey.EProgramId.CesiumIon);
|
|
23099
|
+
// Use if marked as available.
|
|
23100
|
+
if (ionCheckApi.IsVersionAtLeast(BruceApi.VERSION_WITH_PROXIES)) {
|
|
23101
|
+
shouldCreate = (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Available) === true;
|
|
23102
|
+
}
|
|
23103
|
+
// Legacy route, to be killed off.
|
|
23104
|
+
else {
|
|
23105
|
+
shouldCreate = (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Key) ? await ViewerUtils.AssertIonToken(ionKey.Key) : false;
|
|
23106
|
+
}
|
|
23084
23107
|
}
|
|
23085
23108
|
if (shouldCreate) {
|
|
23086
23109
|
try {
|
|
@@ -23523,7 +23546,18 @@ var TileRenderEngine;
|
|
|
23523
23546
|
// Cesium token is required for Cesium World Terrain.
|
|
23524
23547
|
let shouldCreate = true;
|
|
23525
23548
|
if (defaultTerr.id == ProjectViewTile.EDefaultTerrain.CesiumWorldTerrain) {
|
|
23526
|
-
|
|
23549
|
+
const ionCheckApi = params.apiGetter.getApi(params.apiGetter.accountId);
|
|
23550
|
+
await ionCheckApi.Loading;
|
|
23551
|
+
const { programKeys: ionCheckKeys } = await ProgramKey.GetList({ api: ionCheckApi });
|
|
23552
|
+
const ionKey = ionCheckKeys.find(k => k.ProgramId === ProgramKey.EProgramId.CesiumIon);
|
|
23553
|
+
// Use if marked as available.
|
|
23554
|
+
if (ionCheckApi.IsVersionAtLeast(BruceApi.VERSION_WITH_PROXIES)) {
|
|
23555
|
+
shouldCreate = (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Available) === true;
|
|
23556
|
+
}
|
|
23557
|
+
// Legacy route, to be killed off.
|
|
23558
|
+
else {
|
|
23559
|
+
shouldCreate = (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Key) ? await ViewerUtils.AssertIonToken(ionKey.Key) : false;
|
|
23560
|
+
}
|
|
23527
23561
|
}
|
|
23528
23562
|
if (shouldCreate) {
|
|
23529
23563
|
provider = await renderDefaultTerrTile(defaultTerr.id);
|
|
@@ -23855,31 +23889,27 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
|
|
|
23855
23889
|
try {
|
|
23856
23890
|
const bruceApi = getters.GetBruceApi();
|
|
23857
23891
|
await bruceApi.Loading;
|
|
23858
|
-
//
|
|
23892
|
+
// Get token record to check availability.
|
|
23893
|
+
const { programKeys } = await ProgramKey.GetList({ api: bruceApi });
|
|
23894
|
+
const ionKey = programKeys.find(k => k.ProgramId === ProgramKey.EProgramId.CesiumIon);
|
|
23859
23895
|
if (bruceApi.IsVersionAtLeast(BruceApi.VERSION_WITH_PROXIES)) {
|
|
23860
|
-
|
|
23861
|
-
|
|
23862
|
-
|
|
23896
|
+
// Marked as available.
|
|
23897
|
+
if (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Available) {
|
|
23898
|
+
Ion.defaultServer = bruceApi.GetBaseUrl() + "proxy/cesium-ion/";
|
|
23899
|
+
Ion.defaultAccessToken = "proxy";
|
|
23900
|
+
cTokenSet = true;
|
|
23901
|
+
}
|
|
23863
23902
|
}
|
|
23864
|
-
// Legacy path: fetch real Ion token from DB.
|
|
23865
|
-
// Kill off once API instances are migrated.
|
|
23866
23903
|
else {
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23874
|
-
if (valid) {
|
|
23875
|
-
Ion.defaultAccessToken = programKey.Key;
|
|
23876
|
-
cTokenSet = true;
|
|
23877
|
-
}
|
|
23904
|
+
// Legacy path: fetch real Ion token from DB.
|
|
23905
|
+
// Kill off once API instances are migrated.
|
|
23906
|
+
if (ionKey === null || ionKey === void 0 ? void 0 : ionKey.Key) {
|
|
23907
|
+
const valid = await ViewerUtils.AssertIonToken(ionKey.Key);
|
|
23908
|
+
if (valid) {
|
|
23909
|
+
Ion.defaultAccessToken = ionKey.Key;
|
|
23910
|
+
cTokenSet = true;
|
|
23878
23911
|
}
|
|
23879
23912
|
}
|
|
23880
|
-
catch (e) {
|
|
23881
|
-
console.error(e);
|
|
23882
|
-
}
|
|
23883
23913
|
}
|
|
23884
23914
|
}
|
|
23885
23915
|
catch (e) {
|
|
@@ -29700,16 +29730,12 @@ var ViewerUtils;
|
|
|
29700
29730
|
ViewerUtils$$1.CreateWidgets = CreateWidgets;
|
|
29701
29731
|
/**
|
|
29702
29732
|
* Returns if the given token is valid or not.
|
|
29703
|
-
*
|
|
29733
|
+
* Returns true if the supplied Cesium Ion access token is valid by probing the Ion endpoint.
|
|
29734
|
+
* @warning don't use when going through the proxy API route.
|
|
29704
29735
|
* @param token
|
|
29705
29736
|
* @returns
|
|
29706
29737
|
*/
|
|
29707
29738
|
async function AssertIonToken(token) {
|
|
29708
|
-
// If routed through a proxy then we don't need auth on client side for it.
|
|
29709
|
-
const defaultServer = Ion.defaultServer;
|
|
29710
|
-
if (defaultServer && typeof defaultServer === "string" && !defaultServer.includes("cesium.com")) {
|
|
29711
|
-
return true;
|
|
29712
|
-
}
|
|
29713
29739
|
if (!token) {
|
|
29714
29740
|
return false;
|
|
29715
29741
|
}
|
|
@@ -36314,7 +36340,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
36314
36340
|
}
|
|
36315
36341
|
}
|
|
36316
36342
|
|
|
36317
|
-
const VERSION = "6.
|
|
36343
|
+
const VERSION = "6.7.0";
|
|
36318
36344
|
/**
|
|
36319
36345
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
36320
36346
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|