bruce-cesium 1.2.9 → 1.3.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.
@@ -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 { Cartesian3, Color, HeightReference, Cartographic, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Math as Math$1, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cartesian2, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, OrthographicFrustum, JulianDate, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, PolygonPipeline, Matrix4, Cesium3DTileset, IonResource, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider } 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
  }
@@ -1702,6 +1703,7 @@ var EntityRenderEngine;
1702
1703
  var posses = points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)); });
1703
1704
  var extrusion = getPolygonExtrusion(entity, params.tags, outerRing, posses, heightRef, style);
1704
1705
  posses = extrusion.posses;
1706
+ console.log("EXTRUSION", extrusion, style);
1705
1707
  var holeRings = pRings.filter(function (x) { return x.Facing == Geometry.EPolygonRingType.Hole; });
1706
1708
  var holePosses = holeRings.map(function (x) {
1707
1709
  var points = Geometry.ParsePoints(x.LinearRing);
@@ -1814,7 +1816,7 @@ var EntityRenderEngine;
1814
1816
  scale = 1;
1815
1817
  }
1816
1818
  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;
1819
+ 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
1820
  styleScale = EnsureNumber(styleScale ? styleScale : 1);
1819
1821
  if (styleScale <= 0) {
1820
1822
  styleScale = 1;
@@ -1906,7 +1908,7 @@ var EntityRenderEngine;
1906
1908
  _e.label = 4;
1907
1909
  case 4:
1908
1910
  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;
1911
+ group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
1910
1912
  if (!group) {
1911
1913
  group = "DEFAULT";
1912
1914
  }
@@ -2908,12 +2910,12 @@ var RelationRenderEngine;
2908
2910
  var entity = params.dataEntity;
2909
2911
  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
2912
  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);
2913
+ 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
2914
  if (width < 1) {
2913
2915
  width = 1;
2914
2916
  }
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);
2917
+ 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);
2918
+ 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
2919
  var fromPos = null;
2918
2920
  var toPos = null;
2919
2921
  var updatingPosses = false;
@@ -4272,11 +4274,11 @@ var TilesetRenderEngine;
4272
4274
  TilesetRenderEngine.Render = Render;
4273
4275
  function RenderLegacy(params) {
4274
4276
  return __awaiter(this, void 0, void 0, function () {
4275
- var apiGetter, viewer, tileset, ionId, loadUrl, settings, visual, etc, api, cTileset;
4277
+ var apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, settings, visual, etc, api, rootFile, api, rootFile, cTileset;
4276
4278
  return __generator(this, function (_a) {
4277
4279
  switch (_a.label) {
4278
4280
  case 0:
4279
- apiGetter = params.apiGetter, viewer = params.viewer, tileset = params.tileset, ionId = params.ionId, loadUrl = params.loadUrl;
4281
+ apiGetter = params.apiGetter, viewer = params.viewer, tileset = params.tileset, ionId = params.ionId, loadUrl = params.loadUrl, viaCdn = params.viaCdn;
4280
4282
  settings = tileset === null || tileset === void 0 ? void 0 : tileset.Settings;
4281
4283
  settings = __assign({}, settings);
4282
4284
  visual = settings.visual;
@@ -4297,7 +4299,15 @@ var TilesetRenderEngine;
4297
4299
  case 3:
4298
4300
  if (!loadUrl && tileset) {
4299
4301
  api = apiGetter.getApi(apiGetter.accountId);
4300
- loadUrl = api.GetBaseUrl() + ("ui.tileset/" + tileset.ID + "/file/tileset.json");
4302
+ rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
4303
+ loadUrl = api.GetBaseUrl() + ("ui.tileset/" + tileset.ID + "/file/" + rootFile);
4304
+ }
4305
+ if (viaCdn && (tileset === null || tileset === void 0 ? void 0 : tileset.ID)) {
4306
+ api = apiGetter.getApi(apiGetter.accountId);
4307
+ if (api.LegacyTilesetCdnUrl) {
4308
+ rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
4309
+ loadUrl = api.LegacyTilesetCdnUrl.replace("<TILESETID>", tileset.ID).replace("<FILEPATH>", rootFile);
4310
+ }
4301
4311
  }
4302
4312
  cTileset = new Cesium3DTileset({
4303
4313
  url: loadUrl
@@ -5038,7 +5048,7 @@ var SharedGetters;
5038
5048
  var cacheKey = createFilterGetterCacheKey(params);
5039
5049
  var getter = this.data[cacheKey];
5040
5050
  if (!getter) {
5041
- getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter);
5051
+ getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, true);
5042
5052
  this.data[cacheKey] = getter;
5043
5053
  }
5044
5054
  return getter;
@@ -5849,7 +5859,8 @@ var TilesetArbRenderManager;
5849
5859
  tileset: legacyTileset,
5850
5860
  viewer: this.viewer,
5851
5861
  ionId: (_d = this.item.IonResource) === null || _d === void 0 ? void 0 : _d.AssetID,
5852
- loadUrl: loadUrlOverride
5862
+ loadUrl: loadUrlOverride,
5863
+ viaCdn: true
5853
5864
  })];
5854
5865
  case 7:
5855
5866
  _h.cTileset = _j.sent();