bruce-cesium 2.7.6 → 2.7.8

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, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, BatchedDataGetter, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, Model, PolygonPipeline, CesiumInspector, ColorMaterialProperty, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Ion, BoundingSphere } from 'cesium';
3
+ import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, EasingFunction, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Model, Matrix4, Matrix3, IonResource, Ion, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, GeometryInstance, BoundingSphere } from 'cesium';
4
4
 
5
5
  var TIME_LAG = 300;
6
6
  var POSITION_CHECK_TIMER = 950;
@@ -2647,6 +2647,10 @@ var EntityRenderEngine;
2647
2647
  if (width < 0.01) {
2648
2648
  width = 0;
2649
2649
  }
2650
+ var units = style.lineWidthUnits;
2651
+ if (units != "px" && units != "m") {
2652
+ units = "m";
2653
+ }
2650
2654
  // If both outline and fill is not available then don't render anything.
2651
2655
  if ((width <= 0 || cLineColor.alpha <= 0) &&
2652
2656
  cFillColor.alpha <= 0) {
@@ -2686,7 +2690,7 @@ var EntityRenderEngine;
2686
2690
  classificationType: classification,
2687
2691
  perPositionHeight: heightRef == HeightReference.CLAMP_TO_GROUND ? false : true,
2688
2692
  zIndex: zIndex,
2689
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, size, true)
2693
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
2690
2694
  },
2691
2695
  position: EntityUtils.GetPos({
2692
2696
  viewer: params.viewer,
@@ -2722,17 +2726,17 @@ var EntityRenderEngine;
2722
2726
  borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
2723
2727
  }
2724
2728
  var cEntityBorder = new Entity({
2725
- // polyline: new Cesium.PolylineGraphics({
2726
- // positions: borderPosses,
2727
- // material: <Cesium.MaterialProperty><any>cLineColor,
2728
- // width: width,
2729
- // clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
2730
- // classificationType: Cesium.ClassificationType.TERRAIN,
2731
- // arcType: Cesium.ArcType.GEODESIC,
2732
- // zIndex: zIndex,
2733
- // distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2734
- // }),
2735
- corridor: {
2729
+ polyline: units == "px" ? new PolylineGraphics({
2730
+ positions: borderPosses,
2731
+ material: cLineColor,
2732
+ width: width,
2733
+ clampToGround: heightRef == HeightReference.CLAMP_TO_GROUND,
2734
+ classificationType: ClassificationType.TERRAIN,
2735
+ arcType: ArcType.GEODESIC,
2736
+ zIndex: zIndex,
2737
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2738
+ }) : null,
2739
+ corridor: units == "m" ? {
2736
2740
  positions: borderPosses,
2737
2741
  material: cLineColor,
2738
2742
  heightReference: heightRef,
@@ -2744,7 +2748,7 @@ var EntityRenderEngine;
2744
2748
  classificationType: classification,
2745
2749
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
2746
2750
  shadows: ShadowMode.ENABLED
2747
- },
2751
+ } : null,
2748
2752
  show: true
2749
2753
  });
2750
2754
  cEntityBorder._parentEntity = cEntity;
@@ -2753,17 +2757,17 @@ var EntityRenderEngine;
2753
2757
  var posses_1 = holePosses[i];
2754
2758
  Cartes.CloseRing3(posses_1);
2755
2759
  var cEntityHole = new Entity({
2756
- // polyline: new Cesium.PolylineGraphics({
2757
- // positions: posses,
2758
- // material: <Cesium.MaterialProperty><any>cLineColor,
2759
- // width: width,
2760
- // clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
2761
- // classificationType: Cesium.ClassificationType.TERRAIN,
2762
- // arcType: Cesium.ArcType.GEODESIC,
2763
- // zIndex: zIndex,
2764
- // distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2765
- // }),
2766
- corridor: {
2760
+ polyline: units == "px" ? new PolylineGraphics({
2761
+ positions: posses_1,
2762
+ material: cLineColor,
2763
+ width: width,
2764
+ clampToGround: heightRef == HeightReference.CLAMP_TO_GROUND,
2765
+ classificationType: ClassificationType.TERRAIN,
2766
+ arcType: ArcType.GEODESIC,
2767
+ zIndex: zIndex,
2768
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2769
+ }) : null,
2770
+ corridor: units == "m" ? {
2767
2771
  positions: borderPosses,
2768
2772
  material: cLineColor,
2769
2773
  heightReference: heightRef,
@@ -2775,7 +2779,7 @@ var EntityRenderEngine;
2775
2779
  classificationType: classification,
2776
2780
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
2777
2781
  shadows: ShadowMode.ENABLED,
2778
- },
2782
+ } : null,
2779
2783
  show: true
2780
2784
  });
2781
2785
  cEntity._siblingGraphics.push(cEntityHole);
@@ -6927,7 +6931,9 @@ var TilesetRenderEngine;
6927
6931
  etc = settings.etc;
6928
6932
  etc = __assign({}, etc);
6929
6933
  if (!ionId) return [3 /*break*/, 2];
6930
- return [4 /*yield*/, IonResource.fromAssetId(EnsureNumber(ionId))];
6934
+ return [4 /*yield*/, IonResource.fromAssetId(EnsureNumber(ionId), {
6935
+ accessToken: params.ionAccessToken ? params.ionAccessToken : Ion.defaultAccessToken
6936
+ })];
6931
6937
  case 1:
6932
6938
  loadUrl = (_a.sent());
6933
6939
  return [3 /*break*/, 3];
@@ -8843,15 +8849,15 @@ var TilesetArbRenderManager;
8843
8849
  (function () { return __awaiter(_this, void 0, void 0, function () {
8844
8850
  var canAccess, e_3, _a, tileset, type, _b, LEGACY_TYPES, legacyTileset, _c, accountId, _d, _e;
8845
8851
  var _this = this;
8846
- var _f, _g, _h, _j, _k, _l, _m;
8847
- return __generator(this, function (_o) {
8848
- switch (_o.label) {
8852
+ var _f, _g, _h, _j, _k, _l, _m, _o;
8853
+ return __generator(this, function (_p) {
8854
+ switch (_p.label) {
8849
8855
  case 0:
8850
8856
  if (!tilesetId) return [3 /*break*/, 5];
8851
8857
  canAccess = false;
8852
- _o.label = 1;
8858
+ _p.label = 1;
8853
8859
  case 1:
8854
- _o.trys.push([1, 3, , 4]);
8860
+ _p.trys.push([1, 3, , 4]);
8855
8861
  return [4 /*yield*/, Tileset.Publish.IsAccessAllowed({
8856
8862
  sourceAccountId: (_f = this.item.tileset) === null || _f === void 0 ? void 0 : _f.ClientAccountID,
8857
8863
  tilesetId: tilesetId,
@@ -8859,10 +8865,10 @@ var TilesetArbRenderManager;
8859
8865
  api: this.getters.GetGlobalApi()
8860
8866
  })];
8861
8867
  case 2:
8862
- canAccess = _o.sent();
8868
+ canAccess = _p.sent();
8863
8869
  return [3 /*break*/, 4];
8864
8870
  case 3:
8865
- e_3 = _o.sent();
8871
+ e_3 = _p.sent();
8866
8872
  console.error(e_3);
8867
8873
  return [3 /*break*/, 4];
8868
8874
  case 4:
@@ -8873,7 +8879,7 @@ var TilesetArbRenderManager;
8873
8879
  return [3 /*break*/, 6];
8874
8880
  case 5:
8875
8881
  console.warn("No tileset id found. Skipping access check.");
8876
- _o.label = 6;
8882
+ _p.label = 6;
8877
8883
  case 6:
8878
8884
  if (!tilesetId) return [3 /*break*/, 8];
8879
8885
  return [4 /*yield*/, getTileset({
@@ -8881,11 +8887,11 @@ var TilesetArbRenderManager;
8881
8887
  menuItem: this.item
8882
8888
  })];
8883
8889
  case 7:
8884
- _b = _o.sent();
8890
+ _b = _p.sent();
8885
8891
  return [3 /*break*/, 9];
8886
8892
  case 8:
8887
8893
  _b = { tileset: null, type: null };
8888
- _o.label = 9;
8894
+ _p.label = 9;
8889
8895
  case 9:
8890
8896
  _a = _b, tileset = _a.tileset, type = _a.type;
8891
8897
  if (this.disposed) {
@@ -8908,11 +8914,11 @@ var TilesetArbRenderManager;
8908
8914
  tileset: tileset
8909
8915
  })];
8910
8916
  case 10:
8911
- _c = _o.sent();
8917
+ _c = _p.sent();
8912
8918
  return [3 /*break*/, 12];
8913
8919
  case 11:
8914
8920
  _c = null;
8915
- _o.label = 12;
8921
+ _p.label = 12;
8916
8922
  case 12:
8917
8923
  legacyTileset = _c;
8918
8924
  if (this.disposed) {
@@ -8928,12 +8934,13 @@ var TilesetArbRenderManager;
8928
8934
  tileset: legacyTileset,
8929
8935
  viewer: this.viewer,
8930
8936
  ionId: (_k = this.item.IonResource) === null || _k === void 0 ? void 0 : _k.AssetID,
8937
+ ionAccessToken: (_l = this.item.IonResource) === null || _l === void 0 ? void 0 : _l.AccessToken,
8931
8938
  loadUrl: loadUrlOverride,
8932
8939
  accountId: accountId,
8933
8940
  viaCdn: true
8934
8941
  })];
8935
8942
  case 13:
8936
- _d.cTileset = _o.sent();
8943
+ _d.cTileset = _p.sent();
8937
8944
  return [3 /*break*/, 16];
8938
8945
  case 14:
8939
8946
  if (!tileset) return [3 /*break*/, 16];
@@ -8943,13 +8950,13 @@ var TilesetArbRenderManager;
8943
8950
  tileset: tileset,
8944
8951
  viewer: this.viewer,
8945
8952
  coords: null,
8946
- accountId: (_m = (_l = this.item.tileset) === null || _l === void 0 ? void 0 : _l.ClientAccountID) !== null && _m !== void 0 ? _m : this.getters.GetAccountId(),
8953
+ accountId: (_o = (_m = this.item.tileset) === null || _m === void 0 ? void 0 : _m.ClientAccountID) !== null && _o !== void 0 ? _o : this.getters.GetAccountId(),
8947
8954
  // Not doing viaCDN here because I fear it'll break something since this is a legacy menu item type.
8948
8955
  viaCdn: false
8949
8956
  })];
8950
8957
  case 15:
8951
- _e.cTileset = _o.sent();
8952
- _o.label = 16;
8958
+ _e.cTileset = _p.sent();
8959
+ _p.label = 16;
8953
8960
  case 16:
8954
8961
  if (this.disposed) {
8955
8962
  this.doDispose();
@@ -15289,7 +15296,7 @@ var ViewerUtils;
15289
15296
  ViewerUtils.CreateWidgets = CreateWidgets;
15290
15297
  })(ViewerUtils || (ViewerUtils = {}));
15291
15298
 
15292
- var VERSION$1 = "2.7.6";
15299
+ var VERSION$1 = "2.7.8";
15293
15300
 
15294
15301
  export { VERSION$1 as VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
15295
15302
  //# sourceMappingURL=bruce-cesium.es5.js.map