bruce-cesium 1.2.9 → 1.3.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,5 +1,5 @@
1
1
  import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, Entity as Entity$1, BatchedDataGetter, EntityRelationType, Tileset, EntityCoords, EntityFilterGetter, EntitySource, EntityRelation, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
2
- import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, OrthographicFrustum, JulianDate, CallbackProperty, Matrix4, Cesium3DTileset, IonResource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
2
+ import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Matrix4, Cesium3DTileset, IonResource, KmlDataSource, OrthographicFrustum, JulianDate, CallbackProperty, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, EllipsoidGeodesic, sampleTerrainMostDetailed } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -1032,7 +1032,7 @@ function getPolygonStyleExtrusion(pStyle, entity, tags, heightRef) {
1032
1032
  return null;
1033
1033
  }
1034
1034
  try {
1035
- var extrusion = +Calculator.GetValue(attrPath, entity, tags);
1035
+ var extrusion = +Calculator.GetNumber(attrPath, entity, tags);
1036
1036
  if (!extrusion && extrusion != 0) {
1037
1037
  return null;
1038
1038
  }
@@ -1072,6 +1072,7 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
1072
1072
  });
1073
1073
  posses = points.map(function (x) { return Cartesian3.fromRadians(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.height)); });
1074
1074
  }
1075
+ data.value = extrusion;
1075
1076
  }
1076
1077
  // Step 2. Try get using geometry data.
1077
1078
  else {
@@ -1114,7 +1115,7 @@ function getHeightRef(style) {
1114
1115
  return heightRef;
1115
1116
  }
1116
1117
  function getZIndex(style, entity, tags) {
1117
- var zIndex = (style === null || style === void 0 ? void 0 : style.zIndex) ? +Calculator.GetValue(style === null || style === void 0 ? void 0 : style.zIndex, entity, tags) : 0;
1118
+ var zIndex = (style === null || style === void 0 ? void 0 : style.zIndex) ? +Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.zIndex, entity, tags) : 0;
1118
1119
  if (zIndex == null) {
1119
1120
  zIndex = 0;
1120
1121
  }
@@ -1440,7 +1441,7 @@ var EntityRenderEngine;
1440
1441
  row.type = Calculator.EValueType.Input;
1441
1442
  }
1442
1443
  });
1443
- var icon = Calculator.GetValue(iconUrlRows, entity, params.tags);
1444
+ var icon = Calculator.GetString(iconUrlRows, entity, params.tags);
1444
1445
  var iconUrl = null;
1445
1446
  if (typeof icon == "string") {
1446
1447
  iconUrl = icon;
@@ -1452,7 +1453,7 @@ var EntityRenderEngine;
1452
1453
  });
1453
1454
  }
1454
1455
  if (iconUrl) {
1455
- var iconScale = EnsureNumber(Calculator.GetValue(style.iconScale, entity, params.tags));
1456
+ var iconScale = EnsureNumber(Calculator.GetNumber(style.iconScale, entity, params.tags));
1456
1457
  if (!iconScale && iconScale != 0) {
1457
1458
  iconScale = 1;
1458
1459
  }
@@ -1478,7 +1479,7 @@ var EntityRenderEngine;
1478
1479
  if (!cEntity) {
1479
1480
  var bColor = style.color ? Calculator.GetColor(style.color, entity, params.tags) : null;
1480
1481
  var cColor = bColor ? colorToCColor(bColor) : Color.RED;
1481
- var size = style.size ? Calculator.GetValue(style.size, entity, params.tags) : null;
1482
+ var size = style.size ? Calculator.GetNumber(style.size, entity, params.tags) : null;
1482
1483
  if (size == null) {
1483
1484
  size = 30;
1484
1485
  }
@@ -1594,7 +1595,7 @@ var EntityRenderEngine;
1594
1595
  var style = params.style;
1595
1596
  var bColor = style.lineColor ? Calculator.GetColor(style.lineColor, entity, params.tags) : null;
1596
1597
  var cColor = bColor ? colorToCColor(bColor) : Color.RED;
1597
- var width = style.lineWidth ? Calculator.GetValue(style.lineWidth, entity, params.tags) : null;
1598
+ var width = style.lineWidth ? Calculator.GetNumber(style.lineWidth, entity, params.tags) : null;
1598
1599
  if (width == null) {
1599
1600
  width = 4;
1600
1601
  }
@@ -1688,7 +1689,7 @@ var EntityRenderEngine;
1688
1689
  var cFillColor = bFillColor ? colorToCColor(bFillColor) : Color.RED;
1689
1690
  var bLineColor = Calculator.GetColor(style.lineColor, entity, params.tags);
1690
1691
  var cLineColor = bLineColor ? colorToCColor(bLineColor) : Color.RED;
1691
- var width = style.lineWidth ? Calculator.GetValue(style.lineWidth, entity, params.tags) : null;
1692
+ var width = style.lineWidth ? Calculator.GetNumber(style.lineWidth, entity, params.tags) : null;
1692
1693
  if (width == null) {
1693
1694
  width = 4;
1694
1695
  }
@@ -1700,6 +1701,7 @@ var EntityRenderEngine;
1700
1701
  var outerRing = pRings.find(function (x) { return x.Facing == Geometry.EPolygonRingType.Boundaries; });
1701
1702
  var points = Geometry.ParsePoints(outerRing === null || outerRing === void 0 ? void 0 : outerRing.LinearRing);
1702
1703
  var posses = points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)); });
1704
+ Cartes.CloseRing3(posses);
1703
1705
  var extrusion = getPolygonExtrusion(entity, params.tags, outerRing, posses, heightRef, style);
1704
1706
  posses = extrusion.posses;
1705
1707
  var holeRings = pRings.filter(function (x) { return x.Facing == Geometry.EPolygonRingType.Hole; });
@@ -1727,8 +1729,24 @@ var EntityRenderEngine;
1727
1729
  show: false
1728
1730
  });
1729
1731
  cEntity._siblingGraphics = [];
1732
+ if (width > 0 && bLineColor) {
1733
+ var cEntityBorder = new Entity({
1734
+ polyline: new PolylineGraphics({
1735
+ positions: posses,
1736
+ material: cLineColor,
1737
+ width: width,
1738
+ clampToGround: heightRef == HeightReference.CLAMP_TO_GROUND,
1739
+ classificationType: ClassificationType.TERRAIN,
1740
+ arcType: ArcType.GEODESIC,
1741
+ zIndex: zIndex
1742
+ }),
1743
+ show: false
1744
+ });
1745
+ cEntity._siblingGraphics.push(cEntityBorder);
1746
+ }
1730
1747
  for (var i = 0; i < holePosses.length; i++) {
1731
1748
  var posses_1 = holePosses[i];
1749
+ Cartes.CloseRing3(posses_1);
1732
1750
  var cEntityHole = new Entity({
1733
1751
  polyline: new PolylineGraphics({
1734
1752
  positions: posses_1,
@@ -1814,7 +1832,7 @@ var EntityRenderEngine;
1814
1832
  scale = 1;
1815
1833
  }
1816
1834
  var style = params.style;
1817
- var styleScale = (style === null || style === void 0 ? void 0 : style.scale) ? Calculator.GetValue(style === null || style === void 0 ? void 0 : style.scale, entity, params.tags) : null;
1835
+ var styleScale = (style === null || style === void 0 ? void 0 : style.scale) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.scale, entity, params.tags) : null;
1818
1836
  styleScale = EnsureNumber(styleScale ? styleScale : 1);
1819
1837
  if (styleScale <= 0) {
1820
1838
  styleScale = 1;
@@ -1906,7 +1924,7 @@ var EntityRenderEngine;
1906
1924
  _e.label = 4;
1907
1925
  case 4:
1908
1926
  mStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.polygonStyle) !== null && _b !== void 0 ? _b : {};
1909
- group = mStyle.lodGroup ? Calculator.GetValue(mStyle.lodGroup, entity, tags) : null;
1927
+ group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
1910
1928
  if (!group) {
1911
1929
  group = "DEFAULT";
1912
1930
  }
@@ -2908,12 +2926,12 @@ var RelationRenderEngine;
2908
2926
  var entity = params.dataEntity;
2909
2927
  var bColor = (style === null || style === void 0 ? void 0 : style.lineColor) ? Calculator.GetColor(style === null || style === void 0 ? void 0 : style.lineColor, entity, []) : null;
2910
2928
  var cColor = bColor ? colorToCColor$1(bColor) : Color.WHITE;
2911
- var width = EnsureNumber((style === null || style === void 0 ? void 0 : style.lineWidth) ? Calculator.GetValue(style === null || style === void 0 ? void 0 : style.lineWidth, entity, []) : 4, 4);
2929
+ var width = EnsureNumber((style === null || style === void 0 ? void 0 : style.lineWidth) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.lineWidth, entity, []) : 4, 4);
2912
2930
  if (width < 1) {
2913
2931
  width = 1;
2914
2932
  }
2915
- var duration = EnsureNumber((style === null || style === void 0 ? void 0 : style.duration) ? Calculator.GetValue(style === null || style === void 0 ? void 0 : style.duration, entity, []) : 2, 2);
2916
- var hDistanceRatio = EnsureNumber((style === null || style === void 0 ? void 0 : style.heightDistanceRatio) ? Calculator.GetValue(style === null || style === void 0 ? void 0 : style.heightDistanceRatio, entity, []) : 0.25, 0.25);
2933
+ var duration = EnsureNumber((style === null || style === void 0 ? void 0 : style.duration) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.duration, entity, []) : 2, 2);
2934
+ var hDistanceRatio = EnsureNumber((style === null || style === void 0 ? void 0 : style.heightDistanceRatio) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.heightDistanceRatio, entity, []) : 0.25, 0.25);
2917
2935
  var fromPos = null;
2918
2936
  var toPos = null;
2919
2937
  var updatingPosses = false;
@@ -4272,11 +4290,11 @@ var TilesetRenderEngine;
4272
4290
  TilesetRenderEngine.Render = Render;
4273
4291
  function RenderLegacy(params) {
4274
4292
  return __awaiter(this, void 0, void 0, function () {
4275
- var apiGetter, viewer, tileset, ionId, loadUrl, settings, visual, etc, api, cTileset;
4293
+ var apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, settings, visual, etc, api, rootFile, api, rootFile, cTileset;
4276
4294
  return __generator(this, function (_a) {
4277
4295
  switch (_a.label) {
4278
4296
  case 0:
4279
- apiGetter = params.apiGetter, viewer = params.viewer, tileset = params.tileset, ionId = params.ionId, loadUrl = params.loadUrl;
4297
+ apiGetter = params.apiGetter, viewer = params.viewer, tileset = params.tileset, ionId = params.ionId, loadUrl = params.loadUrl, viaCdn = params.viaCdn;
4280
4298
  settings = tileset === null || tileset === void 0 ? void 0 : tileset.Settings;
4281
4299
  settings = __assign({}, settings);
4282
4300
  visual = settings.visual;
@@ -4297,7 +4315,15 @@ var TilesetRenderEngine;
4297
4315
  case 3:
4298
4316
  if (!loadUrl && tileset) {
4299
4317
  api = apiGetter.getApi(apiGetter.accountId);
4300
- loadUrl = api.GetBaseUrl() + ("ui.tileset/" + tileset.ID + "/file/tileset.json");
4318
+ rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
4319
+ loadUrl = api.GetBaseUrl() + ("ui.tileset/" + tileset.ID + "/file/" + rootFile);
4320
+ }
4321
+ if (viaCdn && (tileset === null || tileset === void 0 ? void 0 : tileset.ID)) {
4322
+ api = apiGetter.getApi(apiGetter.accountId);
4323
+ if (api.LegacyTilesetCdnUrl) {
4324
+ rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
4325
+ loadUrl = api.LegacyTilesetCdnUrl.replace("<TILESETID>", tileset.ID).replace("<FILEPATH>", rootFile);
4326
+ }
4301
4327
  }
4302
4328
  cTileset = new Cesium3DTileset({
4303
4329
  url: loadUrl
@@ -5038,7 +5064,7 @@ var SharedGetters;
5038
5064
  var cacheKey = createFilterGetterCacheKey(params);
5039
5065
  var getter = this.data[cacheKey];
5040
5066
  if (!getter) {
5041
- getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter);
5067
+ getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, true);
5042
5068
  this.data[cacheKey] = getter;
5043
5069
  }
5044
5070
  return getter;
@@ -5849,7 +5875,8 @@ var TilesetArbRenderManager;
5849
5875
  tileset: legacyTileset,
5850
5876
  viewer: this.viewer,
5851
5877
  ionId: (_d = this.item.IonResource) === null || _d === void 0 ? void 0 : _d.AssetID,
5852
- loadUrl: loadUrlOverride
5878
+ loadUrl: loadUrlOverride,
5879
+ viaCdn: true
5853
5880
  })];
5854
5881
  case 7:
5855
5882
  _h.cTileset = _j.sent();