bruce-cesium 4.4.0 → 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
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, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, ColorMaterialProperty, ConstantProperty, DistanceDisplayCondition, NearFarScalar, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, HeadingPitchRange, Ion, Cesium3DTileStyle, Cesium3DTileColorBlendMode, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, PolygonPipeline, BoundingSphere, Matrix3, Matrix4, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, IonResource, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } 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.
@@ -17433,7 +17433,7 @@ var TilesetGooglePhotosRenderManager;
17433
17433
  Manager.prototype.Init = function () {
17434
17434
  var _this = this;
17435
17435
  (function () { return __awaiter(_this, void 0, void 0, function () {
17436
- var CESIUM, programKey, e_1, _a, colorCss;
17436
+ var CESIUM, programKeys, _i, programKeys_1, programKey, e_1, _a, colorCss;
17437
17437
  var _b;
17438
17438
  return __generator(this, function (_c) {
17439
17439
  switch (_c.label) {
@@ -17447,14 +17447,20 @@ var TilesetGooglePhotosRenderManager;
17447
17447
  _c.label = 1;
17448
17448
  case 1:
17449
17449
  _c.trys.push([1, 3, , 4]);
17450
- return [4 /*yield*/, ProgramKey.Get({
17451
- programId: ProgramKey.EProgramId.Google,
17450
+ return [4 /*yield*/, ProgramKey.GetList({
17452
17451
  api: this.getters.GetBruceApi()
17453
17452
  })];
17454
17453
  case 2:
17455
- programKey = (_c.sent()).programKey;
17456
- if (programKey === null || programKey === void 0 ? void 0 : programKey.Key) {
17457
- 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
+ }
17458
17464
  }
17459
17465
  return [3 /*break*/, 4];
17460
17466
  case 3:
@@ -18574,64 +18580,43 @@ var GoogleSearchRenderManager;
18574
18580
  Manager.prototype.Init = function () {
18575
18581
  var _this = this;
18576
18582
  (function () { return __awaiter(_this, void 0, void 0, function () {
18577
- var key, valid, programKey, valid, e_1;
18583
+ var programKey, valid, e_1;
18578
18584
  var _this = this;
18579
- var _a, _b, _c, _d;
18580
- return __generator(this, function (_e) {
18581
- switch (_e.label) {
18585
+ var _a;
18586
+ return __generator(this, function (_b) {
18587
+ switch (_b.label) {
18582
18588
  case 0:
18583
- _e.trys.push([0, 7, , 8]);
18584
- 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];
18585
- key = this.item.accessToken;
18586
- if (!key) return [3 /*break*/, 2];
18587
- return [4 /*yield*/, validateKey(key)];
18588
- case 1:
18589
- valid = _e.sent();
18590
- if (!valid) {
18591
- console.warn("Menu Item key not valid for Google Places API. Will try use the account default.");
18592
- key = null;
18593
- }
18594
- _e.label = 2;
18595
- case 2:
18596
- if (!!key) return [3 /*break*/, 5];
18589
+ _b.trys.push([0, 5, , 6]);
18597
18590
  return [4 /*yield*/, ProgramKey.Get({
18598
- programId: ProgramKey.EProgramId.Google,
18591
+ programId: ProgramKey.EProgramId.GoogleApi,
18599
18592
  api: this.getters.GetBruceApi()
18600
18593
  })];
18601
- case 3:
18602
- programKey = (_e.sent()).programKey;
18603
- if (programKey === null || programKey === void 0 ? void 0 : programKey.Key) {
18604
- key = programKey.Key;
18605
- }
18606
- if (!key) return [3 /*break*/, 5];
18607
- return [4 /*yield*/, validateKey(key)];
18608
- case 4:
18609
- 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();
18610
18600
  if (!valid) {
18611
18601
  throw new Error("Account default key not valid for Google Places API.");
18612
18602
  }
18613
- _e.label = 5;
18614
- case 5:
18615
- if (!key) {
18616
- throw new Error("No valid key found for Google Places API.");
18617
- }
18618
- this.accessToken = key;
18619
- _e.label = 6;
18620
- case 6:
18603
+ return [3 /*break*/, 4];
18604
+ case 3: throw new Error("No valid key found for Google Places API.");
18605
+ case 4:
18621
18606
  if (this.Disposed) {
18622
18607
  return [2 /*return*/];
18623
18608
  }
18624
- (_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);
18625
18610
  this.monitorRemoval = this.monitor.Updated().Subscribe(function () {
18626
18611
  _this.startGetterLoop();
18627
18612
  });
18628
18613
  this.startGetterLoop();
18629
- return [3 /*break*/, 8];
18630
- case 7:
18631
- e_1 = _e.sent();
18614
+ return [3 /*break*/, 6];
18615
+ case 5:
18616
+ e_1 = _b.sent();
18632
18617
  console.error(e_1);
18633
- return [3 /*break*/, 8];
18634
- case 8: return [2 /*return*/];
18618
+ return [3 /*break*/, 6];
18619
+ case 6: return [2 /*return*/];
18635
18620
  }
18636
18621
  });
18637
18622
  }); })();
@@ -18731,8 +18716,7 @@ var GoogleSearchRenderManager;
18731
18716
  return [4 /*yield*/, getPlaces({
18732
18717
  location: location_1,
18733
18718
  bounds: bounds_1,
18734
- keyword: this.item.keyword,
18735
- accessToken: this.accessToken
18719
+ keyword: this.item.keyword
18736
18720
  })];
18737
18721
  case 8:
18738
18722
  result = _a.sent();
@@ -18886,72 +18870,6 @@ function delay$1(milliseconds) {
18886
18870
  * @param params
18887
18871
  */
18888
18872
  function getPlaces(params) {
18889
- var _a, _b, _c;
18890
- return __awaiter(this, void 0, void 0, function () {
18891
- return __generator(this, function (_d) {
18892
- // Works better with CORS.
18893
- // Does not allow a token to be passed in.
18894
- 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) {
18895
- return [2 /*return*/, getPlacesThroughLib(params)];
18896
- }
18897
- // Dies in localhost with CORS errors.
18898
- return [2 /*return*/, getPlacesThroughHTTP(params)];
18899
- });
18900
- });
18901
- }
18902
- function getPlacesThroughHTTP(params) {
18903
- return __awaiter(this, void 0, void 0, function () {
18904
- var location, bounds, keyword, accessToken, isKeyValid, url, baseUrl, boundsStr, locationStr, baseUrl, locationStr, response, data;
18905
- return __generator(this, function (_a) {
18906
- switch (_a.label) {
18907
- case 0:
18908
- location = params.location, bounds = params.bounds, keyword = params.keyword, accessToken = params.accessToken;
18909
- if (!accessToken) {
18910
- throw new Error("No access token provided");
18911
- }
18912
- return [4 /*yield*/, validateKeyForSearches(accessToken)];
18913
- case 1:
18914
- isKeyValid = _a.sent();
18915
- if (!isKeyValid) {
18916
- throw new Error("Invalid Google API Key");
18917
- }
18918
- if (bounds) {
18919
- baseUrl = "https://maps.googleapis.com/maps/api/place/textsearch/json";
18920
- url = new URL(baseUrl);
18921
- url.searchParams.append("key", accessToken);
18922
- url.searchParams.append("query", keyword);
18923
- 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));
18924
- url.searchParams.append("bounds", boundsStr);
18925
- locationStr = "".concat(MathUtils.Round(location.latitude, 4), ",").concat(MathUtils.Round(location.longitude, 4));
18926
- url.searchParams.append("location", locationStr);
18927
- }
18928
- else {
18929
- baseUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json";
18930
- url = new URL(baseUrl);
18931
- url.searchParams.append("key", accessToken);
18932
- url.searchParams.append("keyword", keyword);
18933
- locationStr = "".concat(MathUtils.Round(location.latitude, 4), ",").concat(MathUtils.Round(location.longitude, 4));
18934
- url.searchParams.append("location", locationStr);
18935
- url.searchParams.append("radius", "1000");
18936
- }
18937
- return [4 /*yield*/, fetch(url.toString())];
18938
- case 2:
18939
- response = _a.sent();
18940
- if (!response.ok) {
18941
- throw new Error("HTTP error! status: ".concat(response.status));
18942
- }
18943
- return [4 /*yield*/, response.json()];
18944
- case 3:
18945
- data = _a.sent();
18946
- if (data.status !== "OK") {
18947
- throw new Error("API error! status: ".concat(data.status));
18948
- }
18949
- return [2 /*return*/, data.results];
18950
- }
18951
- });
18952
- });
18953
- }
18954
- function getPlacesThroughLib(params) {
18955
18873
  var _a, _b, _c;
18956
18874
  return __awaiter(this, void 0, void 0, function () {
18957
18875
  var location, bounds, keyword;
@@ -26338,7 +26256,7 @@ var ViewerUtils;
26338
26256
  ViewerUtils.AssertIonToken = AssertIonToken;
26339
26257
  })(ViewerUtils || (ViewerUtils = {}));
26340
26258
 
26341
- var VERSION = "4.4.0";
26259
+ var VERSION = "4.4.1";
26342
26260
 
26343
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 };
26344
26262
  //# sourceMappingURL=bruce-cesium.es5.js.map