bruce-cesium 4.3.9 → 4.4.1

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
- import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, Camera, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, Session } from 'bruce-models';
1
+ import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, JulianDate, Color, HeightReference, Cartesian3, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, Entity, CallbackProperty, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, Primitive, Cesium3DTileFeature, Cartesian2, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, Rectangle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Quaternion } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, Primitive, Cesium3DTileFeature, SceneMode, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16919,8 +16919,9 @@ var TilesetArbRenderManager;
16919
16919
  }
16920
16920
  }
16921
16921
  if (!rego.entityId) {
16922
+ // 'Building' ones are for legacy CC3D data.
16922
16923
  var ACCEPTABLE_PROPS = [
16923
- "Building_ID", "BuildingID", "BruceId"
16924
+ "Building_ID", "BuildingID", "BruceId", "entityId", "bruceId"
16924
16925
  ];
16925
16926
  for (var _i = 0, ACCEPTABLE_PROPS_1 = ACCEPTABLE_PROPS; _i < ACCEPTABLE_PROPS_1.length; _i++) {
16926
16927
  var acceptableId = ACCEPTABLE_PROPS_1[_i];
@@ -17432,7 +17433,7 @@ var TilesetGooglePhotosRenderManager;
17432
17433
  Manager.prototype.Init = function () {
17433
17434
  var _this = this;
17434
17435
  (function () { return __awaiter(_this, void 0, void 0, function () {
17435
- var CESIUM, programKey, e_1, _a, colorCss;
17436
+ var CESIUM, programKeys, _i, programKeys_1, programKey, e_1, _a, colorCss;
17436
17437
  var _b;
17437
17438
  return __generator(this, function (_c) {
17438
17439
  switch (_c.label) {
@@ -17446,14 +17447,20 @@ var TilesetGooglePhotosRenderManager;
17446
17447
  _c.label = 1;
17447
17448
  case 1:
17448
17449
  _c.trys.push([1, 3, , 4]);
17449
- return [4 /*yield*/, ProgramKey.Get({
17450
- programId: ProgramKey.EProgramId.Google,
17450
+ return [4 /*yield*/, ProgramKey.GetList({
17451
17451
  api: this.getters.GetBruceApi()
17452
17452
  })];
17453
17453
  case 2:
17454
- programKey = (_c.sent()).programKey;
17455
- if (programKey === null || programKey === void 0 ? void 0 : programKey.Key) {
17456
- CESIUM.GoogleMaps.defaultApiKey = programKey.Key;
17454
+ programKeys = (_c.sent()).programKeys;
17455
+ for (_i = 0, programKeys_1 = programKeys; _i < programKeys_1.length; _i++) {
17456
+ programKey = programKeys_1[_i];
17457
+ if (!programKey.Key) {
17458
+ continue;
17459
+ }
17460
+ if (programKey.ProgramId === ProgramKey.EProgramId.Google || programKey.ProgramId === ProgramKey.EProgramId.GooglePhotogrammetry) {
17461
+ CESIUM.GoogleMaps.defaultApiKey = programKey.Key;
17462
+ break;
17463
+ }
17457
17464
  }
17458
17465
  return [3 /*break*/, 4];
17459
17466
  case 3:
@@ -18573,64 +18580,43 @@ var GoogleSearchRenderManager;
18573
18580
  Manager.prototype.Init = function () {
18574
18581
  var _this = this;
18575
18582
  (function () { return __awaiter(_this, void 0, void 0, function () {
18576
- var key, valid, programKey, valid, e_1;
18583
+ var programKey, valid, e_1;
18577
18584
  var _this = this;
18578
- var _a, _b, _c, _d;
18579
- return __generator(this, function (_e) {
18580
- switch (_e.label) {
18585
+ var _a;
18586
+ return __generator(this, function (_b) {
18587
+ switch (_b.label) {
18581
18588
  case 0:
18582
- _e.trys.push([0, 7, , 8]);
18583
- if (!!((_c = (_b = (_a = getGoogle()) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places) === null || _c === void 0 ? void 0 : _c.PlacesService)) return [3 /*break*/, 6];
18584
- key = this.item.accessToken;
18585
- if (!key) return [3 /*break*/, 2];
18586
- return [4 /*yield*/, validateKey(key)];
18587
- case 1:
18588
- valid = _e.sent();
18589
- if (!valid) {
18590
- console.warn("Menu Item key not valid for Google Places API. Will try use the account default.");
18591
- key = null;
18592
- }
18593
- _e.label = 2;
18594
- case 2:
18595
- if (!!key) return [3 /*break*/, 5];
18589
+ _b.trys.push([0, 5, , 6]);
18596
18590
  return [4 /*yield*/, ProgramKey.Get({
18597
- programId: ProgramKey.EProgramId.Google,
18591
+ programId: ProgramKey.EProgramId.GoogleApi,
18598
18592
  api: this.getters.GetBruceApi()
18599
18593
  })];
18600
- case 3:
18601
- programKey = (_e.sent()).programKey;
18602
- if (programKey === null || programKey === void 0 ? void 0 : programKey.Key) {
18603
- key = programKey.Key;
18604
- }
18605
- if (!key) return [3 /*break*/, 5];
18606
- return [4 /*yield*/, validateKey(key)];
18607
- case 4:
18608
- valid = _e.sent();
18594
+ case 1:
18595
+ programKey = (_b.sent()).programKey;
18596
+ if (!(programKey === null || programKey === void 0 ? void 0 : programKey.Key)) return [3 /*break*/, 3];
18597
+ return [4 /*yield*/, validateKey(programKey === null || programKey === void 0 ? void 0 : programKey.Key)];
18598
+ case 2:
18599
+ valid = _b.sent();
18609
18600
  if (!valid) {
18610
18601
  throw new Error("Account default key not valid for Google Places API.");
18611
18602
  }
18612
- _e.label = 5;
18613
- case 5:
18614
- if (!key) {
18615
- throw new Error("No valid key found for Google Places API.");
18616
- }
18617
- this.accessToken = key;
18618
- _e.label = 6;
18619
- case 6:
18603
+ return [3 /*break*/, 4];
18604
+ case 3: throw new Error("No valid key found for Google Places API.");
18605
+ case 4:
18620
18606
  if (this.Disposed) {
18621
18607
  return [2 /*return*/];
18622
18608
  }
18623
- (_d = this.monitorRemoval) === null || _d === void 0 ? void 0 : _d.call(this);
18609
+ (_a = this.monitorRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
18624
18610
  this.monitorRemoval = this.monitor.Updated().Subscribe(function () {
18625
18611
  _this.startGetterLoop();
18626
18612
  });
18627
18613
  this.startGetterLoop();
18628
- return [3 /*break*/, 8];
18629
- case 7:
18630
- e_1 = _e.sent();
18614
+ return [3 /*break*/, 6];
18615
+ case 5:
18616
+ e_1 = _b.sent();
18631
18617
  console.error(e_1);
18632
- return [3 /*break*/, 8];
18633
- case 8: return [2 /*return*/];
18618
+ return [3 /*break*/, 6];
18619
+ case 6: return [2 /*return*/];
18634
18620
  }
18635
18621
  });
18636
18622
  }); })();
@@ -18730,8 +18716,7 @@ var GoogleSearchRenderManager;
18730
18716
  return [4 /*yield*/, getPlaces({
18731
18717
  location: location_1,
18732
18718
  bounds: bounds_1,
18733
- keyword: this.item.keyword,
18734
- accessToken: this.accessToken
18719
+ keyword: this.item.keyword
18735
18720
  })];
18736
18721
  case 8:
18737
18722
  result = _a.sent();
@@ -18885,72 +18870,6 @@ function delay$1(milliseconds) {
18885
18870
  * @param params
18886
18871
  */
18887
18872
  function getPlaces(params) {
18888
- var _a, _b, _c;
18889
- return __awaiter(this, void 0, void 0, function () {
18890
- return __generator(this, function (_d) {
18891
- // Works better with CORS.
18892
- // Does not allow a token to be passed in.
18893
- if ((_c = (_b = (_a = getGoogle()) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places) === null || _c === void 0 ? void 0 : _c.PlacesService) {
18894
- return [2 /*return*/, getPlacesThroughLib(params)];
18895
- }
18896
- // Dies in localhost with CORS errors.
18897
- return [2 /*return*/, getPlacesThroughHTTP(params)];
18898
- });
18899
- });
18900
- }
18901
- function getPlacesThroughHTTP(params) {
18902
- return __awaiter(this, void 0, void 0, function () {
18903
- var location, bounds, keyword, accessToken, isKeyValid, url, baseUrl, boundsStr, locationStr, baseUrl, locationStr, response, data;
18904
- return __generator(this, function (_a) {
18905
- switch (_a.label) {
18906
- case 0:
18907
- location = params.location, bounds = params.bounds, keyword = params.keyword, accessToken = params.accessToken;
18908
- if (!accessToken) {
18909
- throw new Error("No access token provided");
18910
- }
18911
- return [4 /*yield*/, validateKeyForSearches(accessToken)];
18912
- case 1:
18913
- isKeyValid = _a.sent();
18914
- if (!isKeyValid) {
18915
- throw new Error("Invalid Google API Key");
18916
- }
18917
- if (bounds) {
18918
- baseUrl = "https://maps.googleapis.com/maps/api/place/textsearch/json";
18919
- url = new URL(baseUrl);
18920
- url.searchParams.append("key", accessToken);
18921
- url.searchParams.append("query", keyword);
18922
- boundsStr = "".concat(MathUtils.Round(bounds.south, 4), ",").concat(MathUtils.Round(bounds.west, 4), "|").concat(MathUtils.Round(bounds.north, 4), ",").concat(MathUtils.Round(bounds.east, 4));
18923
- url.searchParams.append("bounds", boundsStr);
18924
- locationStr = "".concat(MathUtils.Round(location.latitude, 4), ",").concat(MathUtils.Round(location.longitude, 4));
18925
- url.searchParams.append("location", locationStr);
18926
- }
18927
- else {
18928
- baseUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json";
18929
- url = new URL(baseUrl);
18930
- url.searchParams.append("key", accessToken);
18931
- url.searchParams.append("keyword", keyword);
18932
- locationStr = "".concat(MathUtils.Round(location.latitude, 4), ",").concat(MathUtils.Round(location.longitude, 4));
18933
- url.searchParams.append("location", locationStr);
18934
- url.searchParams.append("radius", "1000");
18935
- }
18936
- return [4 /*yield*/, fetch(url.toString())];
18937
- case 2:
18938
- response = _a.sent();
18939
- if (!response.ok) {
18940
- throw new Error("HTTP error! status: ".concat(response.status));
18941
- }
18942
- return [4 /*yield*/, response.json()];
18943
- case 3:
18944
- data = _a.sent();
18945
- if (data.status !== "OK") {
18946
- throw new Error("API error! status: ".concat(data.status));
18947
- }
18948
- return [2 /*return*/, data.results];
18949
- }
18950
- });
18951
- });
18952
- }
18953
- function getPlacesThroughLib(params) {
18954
18873
  var _a, _b, _c;
18955
18874
  return __awaiter(this, void 0, void 0, function () {
18956
18875
  var location, bounds, keyword;
@@ -26337,7 +26256,7 @@ var ViewerUtils;
26337
26256
  ViewerUtils.AssertIonToken = AssertIonToken;
26338
26257
  })(ViewerUtils || (ViewerUtils = {}));
26339
26258
 
26340
- var VERSION = "4.3.9";
26259
+ var VERSION = "4.4.1";
26341
26260
 
26342
26261
  export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, WidgetSearchBar, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
26343
26262
  //# sourceMappingURL=bruce-cesium.es5.js.map