bruce-cesium 1.5.4 → 1.5.6

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.
Files changed (42) hide show
  1. package/dist/bruce-cesium.es5.js +297 -231
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +296 -230
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +39 -39
  6. package/dist/lib/internal/js-utils.js +21 -21
  7. package/dist/lib/rendering/entity-render-engine.js +1197 -1162
  8. package/dist/lib/rendering/entity-render-engine.js.map +1 -1
  9. package/dist/lib/rendering/menu-item-creator.js +404 -404
  10. package/dist/lib/rendering/menu-item-manager.js +384 -384
  11. package/dist/lib/rendering/relation-render-engine.js +227 -227
  12. package/dist/lib/rendering/render-managers/common/cesium-parabola.js +363 -363
  13. package/dist/lib/rendering/render-managers/common/shared-getters.js +53 -53
  14. package/dist/lib/rendering/render-managers/data-source/data-source-static-kml-manager.js +130 -130
  15. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +192 -192
  16. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +237 -237
  17. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +343 -343
  18. package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +180 -180
  19. package/dist/lib/rendering/render-managers/other/relations-render-manager.js +202 -202
  20. package/dist/lib/rendering/render-managers/render-manager.js +70 -70
  21. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +356 -351
  22. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
  23. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +310 -310
  24. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
  25. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +180 -180
  26. package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js +365 -365
  27. package/dist/lib/rendering/render-managers/tilesets/tileset-pointcloud-render-manager.js +145 -145
  28. package/dist/lib/rendering/tile-render-engine.js +1013 -1013
  29. package/dist/lib/rendering/tileset-render-engine.js +807 -783
  30. package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
  31. package/dist/lib/rendering/view-render-engine.js +581 -579
  32. package/dist/lib/rendering/view-render-engine.js.map +1 -1
  33. package/dist/lib/rendering/visuals-register.js +773 -773
  34. package/dist/lib/utils/drawing-utils.js +183 -183
  35. package/dist/lib/utils/entity-utils.js +398 -398
  36. package/dist/lib/utils/measure-utils.js +72 -72
  37. package/dist/lib/utils/view-utils.js +86 -86
  38. package/dist/lib/viewer/cesium-view-monitor.js +231 -231
  39. package/dist/lib/viewer/viewer-utils.js +71 -71
  40. package/dist/types/rendering/entity-render-engine.d.ts +1 -1
  41. package/dist/types/rendering/tileset-render-engine.d.ts +2 -1
  42. package/package.json +76 -76
@@ -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, MenuItem, EntityRelation, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
2
- import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, OrthographicFrustum, JulianDate, Matrix4, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider } from 'cesium';
2
+ import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, OrthographicFrustum, JulianDate, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, Matrix4, Cesium3DTileset, IonResource, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, PolygonPipeline } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -1190,6 +1190,7 @@ function getRenderGroupId(zoomItem, terrain) {
1190
1190
  }
1191
1191
  return zoomItem.MinZoom + "-" + zoomItem.MaxZoom + "-" + isFlatTerrain;
1192
1192
  }
1193
+ var _fileValidationCache = {};
1193
1194
  var EntityRenderEngine;
1194
1195
  (function (EntityRenderEngine) {
1195
1196
  function Render(params) {
@@ -1450,162 +1451,194 @@ var EntityRenderEngine;
1450
1451
  var Point;
1451
1452
  (function (Point) {
1452
1453
  function Render(params) {
1453
- var entity = params.entity;
1454
- var style = params.style;
1455
- var type = style.Type;
1456
- if (type == null) {
1457
- // Very old backward compatibility.
1458
- if (style.useIcon == true) {
1459
- type = Style.EPointType.Icon;
1460
- }
1461
- }
1462
- var cEntity = null;
1463
- var siblings = [];
1464
- if (type == Style.EPointType.Icon) {
1465
- // Fixing poor data.
1466
- var iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
1467
- iconUrlRows.forEach(function (row) {
1468
- if (row.type == Calculator.EValueType.Color) {
1469
- row.type = Calculator.EValueType.Input;
1470
- }
1471
- });
1472
- var icon = Calculator.GetString(iconUrlRows, entity, params.tags);
1473
- var iconUrl = null;
1474
- if (typeof icon == "string") {
1475
- iconUrl = icon;
1476
- }
1477
- if (!iconUrl && style.iconId) {
1478
- iconUrl = ClientFile.GetUrl({
1479
- api: params.api,
1480
- fileId: style.iconId
1481
- });
1482
- }
1483
- if (iconUrl) {
1484
- var iconScale = EnsureNumber(Calculator.GetNumber(style.iconScale, entity, params.tags));
1485
- if (!iconScale && iconScale != 0) {
1486
- iconScale = 1;
1487
- }
1488
- if (iconScale > 0) {
1489
- var heightRef = getHeightRef(style);
1490
- cEntity = new Entity({
1491
- billboard: {
1492
- horizontalOrigin: HorizontalOrigin.CENTER,
1493
- verticalOrigin: VerticalOrigin.BOTTOM,
1494
- image: iconUrl,
1495
- heightReference: getHeightRef(style),
1496
- scale: iconScale
1497
- },
1498
- position: EntityUtils.GetPos({
1499
- viewer: params.viewer,
1500
- entity: entity,
1501
- recordHeightRef: heightRef,
1502
- returnHeightRef: heightRef
1503
- }),
1504
- show: false
1505
- });
1454
+ return __awaiter(this, void 0, void 0, function () {
1455
+ var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, res, e_1, iconScale, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, outlineHeight, bOutline, fillHeight, exHeightRef, pos, bColor, cColor, size, heightRef;
1456
+ return __generator(this, function (_a) {
1457
+ switch (_a.label) {
1458
+ case 0:
1459
+ entity = params.entity;
1460
+ style = params.style;
1461
+ type = style.Type;
1462
+ if (type == null) {
1463
+ // Very old backward compatibility.
1464
+ if (style.useIcon == true) {
1465
+ type = Style.EPointType.Icon;
1466
+ }
1467
+ }
1468
+ cEntity = null;
1469
+ siblings = [];
1470
+ if (!(type == Style.EPointType.Icon)) return [3 /*break*/, 7];
1471
+ iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
1472
+ iconUrlRows.forEach(function (row) {
1473
+ if (row.type == Calculator.EValueType.Color) {
1474
+ row.type = Calculator.EValueType.Input;
1475
+ }
1476
+ });
1477
+ icon = Calculator.GetString(iconUrlRows, entity, params.tags);
1478
+ iconUrl = null;
1479
+ if (typeof icon == "string") {
1480
+ iconUrl = icon;
1481
+ }
1482
+ if (!iconUrl && style.iconId) {
1483
+ iconUrl = ClientFile.GetUrl({
1484
+ api: params.api,
1485
+ fileId: style.iconId
1486
+ });
1487
+ }
1488
+ if (!iconUrl) return [3 /*break*/, 6];
1489
+ _a.label = 1;
1490
+ case 1:
1491
+ _a.trys.push([1, 5, , 6]);
1492
+ if (!(_fileValidationCache[iconUrl] == null)) return [3 /*break*/, 3];
1493
+ return [4 /*yield*/, fetch(iconUrl)];
1494
+ case 2:
1495
+ res = _a.sent();
1496
+ if (res.status != 200) {
1497
+ iconUrl = null;
1498
+ }
1499
+ _fileValidationCache[iconUrl] = Boolean(iconUrl);
1500
+ return [3 /*break*/, 4];
1501
+ case 3:
1502
+ if (!_fileValidationCache[iconUrl]) {
1503
+ iconUrl = null;
1504
+ }
1505
+ _a.label = 4;
1506
+ case 4: return [3 /*break*/, 6];
1507
+ case 5:
1508
+ e_1 = _a.sent();
1509
+ iconUrl = null;
1510
+ return [3 /*break*/, 6];
1511
+ case 6:
1512
+ if (iconUrl) {
1513
+ iconScale = EnsureNumber(Calculator.GetNumber(style.iconScale, entity, params.tags));
1514
+ if (!iconScale && iconScale != 0) {
1515
+ iconScale = 1;
1516
+ }
1517
+ if (iconScale > 0) {
1518
+ heightRef = getHeightRef(style);
1519
+ cEntity = new Entity({
1520
+ billboard: {
1521
+ horizontalOrigin: HorizontalOrigin.CENTER,
1522
+ verticalOrigin: VerticalOrigin.BOTTOM,
1523
+ image: iconUrl,
1524
+ heightReference: getHeightRef(style),
1525
+ scale: iconScale
1526
+ },
1527
+ position: EntityUtils.GetPos({
1528
+ viewer: params.viewer,
1529
+ entity: entity,
1530
+ recordHeightRef: heightRef,
1531
+ returnHeightRef: heightRef
1532
+ }),
1533
+ show: false
1534
+ });
1535
+ }
1536
+ }
1537
+ _a.label = 7;
1538
+ case 7:
1539
+ if (type == Style.EPointType.Cylinder) {
1540
+ radius = EnsureNumber(Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
1541
+ if (radius <= 0) {
1542
+ return [2 /*return*/, null];
1543
+ }
1544
+ bFill = style.CylinderFillColor ? Calculator.GetColor(style.CylinderFillColor, entity, params.tags) : null;
1545
+ cFill = bFill ? colorToCColor(bFill) : Color.RED;
1546
+ outline = Boolean(style.CylinderBorderEnabled);
1547
+ cOutline = null;
1548
+ outlineWidth = 1;
1549
+ outlineHeight = 0;
1550
+ if (outline) {
1551
+ bOutline = style.CylinderBorderColor ? Calculator.GetColor(style.CylinderBorderColor, entity, params.tags) : null;
1552
+ cOutline = bOutline ? colorToCColor(bOutline) : Color.BLACK;
1553
+ outlineWidth = EnsureNumber(Calculator.GetNumber(style.CylinderBorderWidth, entity, params.tags), 1);
1554
+ outlineHeight = EnsureNumber(Calculator.GetNumber(style.CylinderBorderExtrusion, entity, params.tags), 0);
1555
+ }
1556
+ fillHeight = EnsureNumber(Calculator.GetNumber(style.CylinderFillExtrusion, entity, params.tags));
1557
+ exHeightRef = undefined;
1558
+ if (fillHeight > 0) {
1559
+ exHeightRef = HeightReference.RELATIVE_TO_GROUND;
1560
+ }
1561
+ pos = EntityUtils.GetPos({
1562
+ viewer: params.viewer,
1563
+ entity: entity,
1564
+ recordHeightRef: HeightReference.CLAMP_TO_GROUND,
1565
+ returnHeightRef: HeightReference.CLAMP_TO_GROUND
1566
+ });
1567
+ cEntity = new Entity({
1568
+ ellipse: {
1569
+ semiMajorAxis: radius,
1570
+ semiMinorAxis: radius,
1571
+ material: cFill,
1572
+ outlineWidth: null,
1573
+ extrudedHeight: fillHeight,
1574
+ heightReference: HeightReference.CLAMP_TO_GROUND,
1575
+ extrudedHeightReference: exHeightRef,
1576
+ zIndex: 1
1577
+ },
1578
+ position: pos === null || pos === void 0 ? void 0 : pos.clone(),
1579
+ show: false
1580
+ });
1581
+ if (outline && outlineWidth > 0) {
1582
+ if (!exHeightRef && outlineHeight > 0) {
1583
+ exHeightRef = HeightReference.RELATIVE_TO_GROUND;
1584
+ // We need height reference to match between rings.
1585
+ cEntity.ellipse.extrudedHeightReference = exHeightRef;
1586
+ }
1587
+ siblings.push(new Entity({
1588
+ ellipse: {
1589
+ semiMajorAxis: radius + outlineWidth,
1590
+ semiMinorAxis: radius + outlineWidth,
1591
+ material: cOutline,
1592
+ outlineWidth: undefined,
1593
+ extrudedHeight: outlineHeight,
1594
+ heightReference: HeightReference.CLAMP_TO_GROUND,
1595
+ extrudedHeightReference: exHeightRef,
1596
+ zIndex: 2
1597
+ },
1598
+ position: pos === null || pos === void 0 ? void 0 : pos.clone()
1599
+ }));
1600
+ }
1601
+ }
1602
+ if (!cEntity) {
1603
+ bColor = style.color ? Calculator.GetColor(style.color, entity, params.tags) : null;
1604
+ cColor = bColor ? colorToCColor(bColor) : Color.RED;
1605
+ size = style.size ? Calculator.GetNumber(style.size, entity, params.tags) : null;
1606
+ if (size == null) {
1607
+ size = 30;
1608
+ }
1609
+ size = EnsureNumber(size);
1610
+ if (size <= 0) {
1611
+ return [2 /*return*/, null];
1612
+ }
1613
+ heightRef = getHeightRef(style);
1614
+ cEntity = new Entity({
1615
+ point: {
1616
+ pixelSize: size,
1617
+ color: cColor,
1618
+ heightReference: getHeightRef(style)
1619
+ },
1620
+ position: EntityUtils.GetPos({
1621
+ viewer: params.viewer,
1622
+ entity: entity,
1623
+ recordHeightRef: heightRef,
1624
+ returnHeightRef: heightRef
1625
+ }),
1626
+ show: false
1627
+ });
1628
+ }
1629
+ if (cEntity) {
1630
+ params.viewer.entities.add(cEntity);
1631
+ if (siblings) {
1632
+ siblings.forEach(function (sibling) {
1633
+ params.viewer.entities.add(sibling);
1634
+ });
1635
+ }
1636
+ cEntity._siblingGraphics = siblings;
1637
+ }
1638
+ return [2 /*return*/, cEntity];
1506
1639
  }
1507
- }
1508
- }
1509
- if (type == Style.EPointType.Cylinder) {
1510
- var radius = EnsureNumber(Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
1511
- if (radius <= 0) {
1512
- return null;
1513
- }
1514
- var bFill = style.CylinderFillColor ? Calculator.GetColor(style.CylinderFillColor, entity, params.tags) : null;
1515
- var cFill = bFill ? colorToCColor(bFill) : Color.RED;
1516
- var outline = Boolean(style.CylinderBorderEnabled);
1517
- var cOutline = null;
1518
- var outlineWidth = 1;
1519
- var outlineHeight = 0;
1520
- if (outline) {
1521
- var bOutline = style.CylinderBorderColor ? Calculator.GetColor(style.CylinderBorderColor, entity, params.tags) : null;
1522
- cOutline = bOutline ? colorToCColor(bOutline) : Color.BLACK;
1523
- outlineWidth = EnsureNumber(Calculator.GetNumber(style.CylinderBorderWidth, entity, params.tags), 1);
1524
- outlineHeight = EnsureNumber(Calculator.GetNumber(style.CylinderBorderExtrusion, entity, params.tags), 0);
1525
- }
1526
- var fillHeight = EnsureNumber(Calculator.GetNumber(style.CylinderFillExtrusion, entity, params.tags));
1527
- var exHeightRef = undefined;
1528
- if (fillHeight > 0) {
1529
- exHeightRef = HeightReference.RELATIVE_TO_GROUND;
1530
- }
1531
- var pos = EntityUtils.GetPos({
1532
- viewer: params.viewer,
1533
- entity: entity,
1534
- recordHeightRef: HeightReference.CLAMP_TO_GROUND,
1535
- returnHeightRef: HeightReference.CLAMP_TO_GROUND
1536
1640
  });
1537
- cEntity = new Entity({
1538
- ellipse: {
1539
- semiMajorAxis: radius,
1540
- semiMinorAxis: radius,
1541
- material: cFill,
1542
- outlineWidth: null,
1543
- extrudedHeight: fillHeight,
1544
- heightReference: HeightReference.CLAMP_TO_GROUND,
1545
- extrudedHeightReference: exHeightRef,
1546
- zIndex: 1
1547
- },
1548
- position: pos === null || pos === void 0 ? void 0 : pos.clone(),
1549
- show: false
1550
- });
1551
- if (outline && outlineWidth > 0) {
1552
- if (!exHeightRef && outlineHeight > 0) {
1553
- exHeightRef = HeightReference.RELATIVE_TO_GROUND;
1554
- // We need height reference to match between rings.
1555
- cEntity.ellipse.extrudedHeightReference = exHeightRef;
1556
- }
1557
- siblings.push(new Entity({
1558
- ellipse: {
1559
- semiMajorAxis: radius + outlineWidth,
1560
- semiMinorAxis: radius + outlineWidth,
1561
- material: cOutline,
1562
- outlineWidth: undefined,
1563
- extrudedHeight: outlineHeight,
1564
- heightReference: HeightReference.CLAMP_TO_GROUND,
1565
- extrudedHeightReference: exHeightRef,
1566
- zIndex: 2
1567
- },
1568
- position: pos === null || pos === void 0 ? void 0 : pos.clone()
1569
- }));
1570
- }
1571
- }
1572
- if (!cEntity) {
1573
- var bColor = style.color ? Calculator.GetColor(style.color, entity, params.tags) : null;
1574
- var cColor = bColor ? colorToCColor(bColor) : Color.RED;
1575
- var size = style.size ? Calculator.GetNumber(style.size, entity, params.tags) : null;
1576
- if (size == null) {
1577
- size = 30;
1578
- }
1579
- size = EnsureNumber(size);
1580
- if (size <= 0) {
1581
- return null;
1582
- }
1583
- var heightRef = getHeightRef(style);
1584
- cEntity = new Entity({
1585
- point: {
1586
- pixelSize: size,
1587
- color: cColor,
1588
- heightReference: getHeightRef(style)
1589
- },
1590
- position: EntityUtils.GetPos({
1591
- viewer: params.viewer,
1592
- entity: entity,
1593
- recordHeightRef: heightRef,
1594
- returnHeightRef: heightRef
1595
- }),
1596
- show: false
1597
- });
1598
- }
1599
- if (cEntity) {
1600
- params.viewer.entities.add(cEntity);
1601
- if (siblings) {
1602
- siblings.forEach(function (sibling) {
1603
- params.viewer.entities.add(sibling);
1604
- });
1605
- }
1606
- cEntity._siblingGraphics = siblings;
1607
- }
1608
- return cEntity;
1641
+ });
1609
1642
  }
1610
1643
  Point.Render = Render;
1611
1644
  function RenderGroup(params) {
@@ -1620,7 +1653,7 @@ var EntityRenderEngine;
1620
1653
  i = 0;
1621
1654
  _d.label = 1;
1622
1655
  case 1:
1623
- if (!(i < params.entities.length)) return [3 /*break*/, 6];
1656
+ if (!(i < params.entities.length)) return [3 /*break*/, 7];
1624
1657
  entity = params.entities[i];
1625
1658
  zoomItem = params.zoomItems[entity.Bruce.ID];
1626
1659
  return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
@@ -1638,20 +1671,22 @@ var EntityRenderEngine;
1638
1671
  _d.label = 4;
1639
1672
  case 4:
1640
1673
  pStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.pointStyle) !== null && _b !== void 0 ? _b : {};
1641
- cEntity = Render({
1642
- entity: entity,
1643
- style: pStyle,
1644
- tags: tags,
1645
- viewer: params.viewer,
1646
- api: api
1647
- });
1674
+ return [4 /*yield*/, Render({
1675
+ entity: entity,
1676
+ style: pStyle,
1677
+ tags: tags,
1678
+ viewer: params.viewer,
1679
+ api: api
1680
+ })];
1681
+ case 5:
1682
+ cEntity = _d.sent();
1648
1683
  cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
1649
1684
  cEntities[entity.Bruce.ID] = cEntity;
1650
- _d.label = 5;
1651
- case 5:
1685
+ _d.label = 6;
1686
+ case 6:
1652
1687
  i++;
1653
1688
  return [3 /*break*/, 1];
1654
- case 6: return [2 /*return*/, cEntities];
1689
+ case 7: return [2 /*return*/, cEntities];
1655
1690
  }
1656
1691
  });
1657
1692
  });
@@ -4227,6 +4262,20 @@ function isAlive(viewer, cTileset) {
4227
4262
  }
4228
4263
  return viewer.scene.primitives.contains(cTileset);
4229
4264
  }
4265
+ // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
4266
+ // We have some evil hard-coded style mappings that need to be fixed.
4267
+ // These exist within legacy project views.
4268
+ function correctStyle(style) {
4269
+ if (style && !style.Settings && !style.ID) {
4270
+ return {
4271
+ ID: 0,
4272
+ Name: "Unknown",
4273
+ Settings: __assign({}, style),
4274
+ Type: Style.EType.Entity
4275
+ };
4276
+ }
4277
+ return style;
4278
+ }
4230
4279
  var TilesetRenderEngine;
4231
4280
  (function (TilesetRenderEngine) {
4232
4281
  function ApplyPosition(params) {
@@ -4452,11 +4501,11 @@ var TilesetRenderEngine;
4452
4501
  TilesetRenderEngine.Render = Render;
4453
4502
  function RenderLegacy(params) {
4454
4503
  return __awaiter(this, void 0, void 0, function () {
4455
- var apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, settings, visual, etc, api, rootFile, api, rootFile, cTileset;
4504
+ var apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, accountId, settings, visual, etc, api, rootFile, api, rootFile, cTileset;
4456
4505
  return __generator(this, function (_a) {
4457
4506
  switch (_a.label) {
4458
4507
  case 0:
4459
- apiGetter = params.apiGetter, viewer = params.viewer, tileset = params.tileset, ionId = params.ionId, loadUrl = params.loadUrl, viaCdn = params.viaCdn;
4508
+ apiGetter = params.apiGetter, viewer = params.viewer, tileset = params.tileset, ionId = params.ionId, loadUrl = params.loadUrl, viaCdn = params.viaCdn, accountId = params.accountId;
4460
4509
  settings = tileset === null || tileset === void 0 ? void 0 : tileset.Settings;
4461
4510
  settings = __assign({}, settings);
4462
4511
  visual = settings.visual;
@@ -4476,15 +4525,18 @@ var TilesetRenderEngine;
4476
4525
  _a.label = 3;
4477
4526
  case 3:
4478
4527
  if (!loadUrl && tileset) {
4479
- api = apiGetter.getApi(apiGetter.accountId);
4528
+ api = apiGetter.getApi(accountId);
4480
4529
  rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
4481
4530
  loadUrl = api.GetBaseUrl() + ("ui.tileset/" + tileset.ID + "/file/" + rootFile);
4482
4531
  }
4483
4532
  if (viaCdn && (tileset === null || tileset === void 0 ? void 0 : tileset.ID)) {
4484
- api = apiGetter.getApi(apiGetter.accountId);
4533
+ api = apiGetter.getApi(accountId);
4485
4534
  if (api.LegacyTilesetCdnUrl) {
4486
4535
  rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
4487
- loadUrl = api.LegacyTilesetCdnUrl.replace("<TILESETID>", tileset.ID).replace("<FILEPATH>", rootFile);
4536
+ loadUrl = api.LegacyTilesetCdnUrl
4537
+ .replace("<TILESETID>", tileset.ID)
4538
+ .replace("<FILEPATH>", rootFile)
4539
+ .replace("<ACCOUNT>", accountId);
4488
4540
  }
4489
4541
  }
4490
4542
  cTileset = new Cesium3DTileset({
@@ -4552,8 +4604,9 @@ var TilesetRenderEngine;
4552
4604
  });
4553
4605
  }
4554
4606
  TilesetRenderEngine.RenderLegacy = RenderLegacy;
4555
- var CadStyler = /** @class */ (function () {
4556
- function CadStyler(api, cTileset, fallbackStyleId, styleMapping, menuItemId, register) {
4607
+ var Styler = /** @class */ (function () {
4608
+ function Styler(api, cTileset, fallbackStyleId, styleMapping, menuItemId, register) {
4609
+ var _a;
4557
4610
  this.disposed = false;
4558
4611
  this.styleMappingLoaded = false;
4559
4612
  this.styleMappingsLoaded = {};
@@ -4565,18 +4618,27 @@ var TilesetRenderEngine;
4565
4618
  this.cTileset = cTileset;
4566
4619
  this.fallbackStyleId = fallbackStyleId;
4567
4620
  this.styleMapping = styleMapping;
4621
+ // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
4622
+ // We have some evil hard-coded style mappings that need to be fixed.
4623
+ // These exist within legacy project views.
4624
+ if ((_a = this.styleMapping) === null || _a === void 0 ? void 0 : _a.length) {
4625
+ for (var i = 0; i < this.styleMapping.length; i++) {
4626
+ var mapItem = this.styleMapping[i];
4627
+ this.styleMapping[i].style = correctStyle(mapItem === null || mapItem === void 0 ? void 0 : mapItem.style);
4628
+ }
4629
+ }
4568
4630
  this.register = register;
4569
4631
  this.menuItemId = menuItemId;
4570
4632
  this.loadStyles();
4571
4633
  }
4572
- Object.defineProperty(CadStyler.prototype, "Disposed", {
4634
+ Object.defineProperty(Styler.prototype, "Disposed", {
4573
4635
  get: function () {
4574
4636
  return this.disposed;
4575
4637
  },
4576
4638
  enumerable: false,
4577
4639
  configurable: true
4578
4640
  });
4579
- CadStyler.prototype.QueueEntities = function (entities) {
4641
+ Styler.prototype.QueueEntities = function (entities) {
4580
4642
  for (var i = 0; i < entities.length; i++) {
4581
4643
  var entity = entities[i];
4582
4644
  this.queueTilesetFeatureStyle(entity);
@@ -4585,7 +4647,7 @@ var TilesetRenderEngine;
4585
4647
  this.processQueue();
4586
4648
  }
4587
4649
  };
4588
- CadStyler.prototype.processQueue = function () {
4650
+ Styler.prototype.processQueue = function () {
4589
4651
  return __awaiter(this, void 0, void 0, function () {
4590
4652
  var MAX_BATCHES, BATCH_DELAY, batch, rerun, entities, _loop_1, this_1, i;
4591
4653
  var _this = this;
@@ -4642,17 +4704,17 @@ var TilesetRenderEngine;
4642
4704
  });
4643
4705
  });
4644
4706
  };
4645
- CadStyler.prototype.getEntityIdsForQueue = function () {
4707
+ Styler.prototype.getEntityIdsForQueue = function () {
4646
4708
  var BATCH_SIZE = 30;
4647
4709
  return this.recordLoadQueue.splice(0, BATCH_SIZE);
4648
4710
  };
4649
- CadStyler.prototype.getEntityRego = function (entityId) {
4711
+ Styler.prototype.getEntityRego = function (entityId) {
4650
4712
  return this.register.GetRego({
4651
4713
  entityId: entityId,
4652
4714
  menuItemId: this.menuItemId
4653
4715
  });
4654
4716
  };
4655
- CadStyler.prototype.Dispose = function () {
4717
+ Styler.prototype.Dispose = function () {
4656
4718
  if (this.disposed) {
4657
4719
  return;
4658
4720
  }
@@ -4660,7 +4722,7 @@ var TilesetRenderEngine;
4660
4722
  clearInterval(this.queueLoadInterval);
4661
4723
  clearInterval(this.queueCheckInterval);
4662
4724
  };
4663
- CadStyler.prototype.loadStyles = function () {
4725
+ Styler.prototype.loadStyles = function () {
4664
4726
  var _a, _b;
4665
4727
  return __awaiter(this, void 0, void 0, function () {
4666
4728
  var fallbackStyleId, data, e_1, styleMapping, modelTree, entityTypeIds, _loop_2, i, i, styleMap, styleId, entityType, e_2, data, e_3;
@@ -4785,12 +4847,12 @@ var TilesetRenderEngine;
4785
4847
  });
4786
4848
  });
4787
4849
  };
4788
- CadStyler.prototype.getEntityTypeIdsFromModelTree = function (modelTree) {
4850
+ Styler.prototype.getEntityTypeIdsFromModelTree = function (modelTree) {
4789
4851
  var entityTypeIds = [];
4790
4852
  this.digEntityTypeIdsFromModelTreeBranch(modelTree, entityTypeIds);
4791
4853
  return entityTypeIds;
4792
4854
  };
4793
- CadStyler.prototype.digEntityTypeIdsFromModelTreeBranch = function (branch, arr) {
4855
+ Styler.prototype.digEntityTypeIdsFromModelTreeBranch = function (branch, arr) {
4794
4856
  if (branch) {
4795
4857
  // Does not yet include this entity type id.
4796
4858
  if (branch.typeId && !arr.includes(branch.typeId)) {
@@ -4804,7 +4866,7 @@ var TilesetRenderEngine;
4804
4866
  }
4805
4867
  }
4806
4868
  };
4807
- CadStyler.prototype.processTilesetFeatureCheckQueue = function () {
4869
+ Styler.prototype.processTilesetFeatureCheckQueue = function () {
4808
4870
  return __awaiter(this, void 0, void 0, function () {
4809
4871
  var BATCH_CHECK_SIZE;
4810
4872
  var _this = this;
@@ -4868,7 +4930,7 @@ var TilesetRenderEngine;
4868
4930
  });
4869
4931
  });
4870
4932
  };
4871
- CadStyler.prototype.queueTilesetFeatureStyle = function (entity) {
4933
+ Styler.prototype.queueTilesetFeatureStyle = function (entity) {
4872
4934
  if (this.styleMappingLoaded || this.styleMappingsLoaded[entity.entityTypeId] == true) {
4873
4935
  var needsData = this.getTilesetFeatureNeedsFullData(entity.entityId, entity.entityTypeId);
4874
4936
  if (needsData) {
@@ -4884,10 +4946,10 @@ var TilesetRenderEngine;
4884
4946
  this.recordCheckQueue.push(entity.entityId);
4885
4947
  }
4886
4948
  };
4887
- CadStyler.prototype.styleTilesetFeature = function (entity) {
4949
+ Styler.prototype.styleTilesetFeature = function (entity) {
4888
4950
  this.styleTilesetFeatureFullData(entity, null);
4889
4951
  };
4890
- CadStyler.prototype.styleTilesetFeatureFullData = function (entity, data) {
4952
+ Styler.prototype.styleTilesetFeatureFullData = function (entity, data) {
4891
4953
  var _a;
4892
4954
  var style = this.getTilesetFeatureStyle(entity.entityId, entity.entityTypeId);
4893
4955
  if (!style) {
@@ -4902,25 +4964,22 @@ var TilesetRenderEngine;
4902
4964
  }
4903
4965
  }
4904
4966
  };
4905
- CadStyler.prototype.getTilesetFeatureStyle = function (entityId, entityTypeId) {
4906
- var _a, _b, _c;
4967
+ Styler.prototype.getTilesetFeatureStyle = function (entityId, entityTypeId) {
4968
+ var _a, _b, _c, _d;
4907
4969
  // Locate what style is applicable to the feature.
4908
4970
  var style = null;
4909
4971
  if (entityTypeId) {
4910
- style = (_a = this.styleMapping.find(function (x) { return x.EntityTypeID == entityTypeId; })) === null || _a === void 0 ? void 0 : _a.style;
4911
- }
4912
- if (!style) {
4913
- style = this.fallbackStyle;
4972
+ style = ((_b = (_a = this.styleMapping.find(function (x) { return x.EntityTypeID == entityTypeId; })) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.Settings);
4914
4973
  }
4915
4974
  if (!style) {
4916
- return null;
4975
+ style = ((_c = this.fallbackStyle) === null || _c === void 0 ? void 0 : _c.Settings);
4917
4976
  }
4918
- if (!((_c = (_b = style.Settings) === null || _b === void 0 ? void 0 : _b.modelStyle) === null || _c === void 0 ? void 0 : _c.customize)) {
4977
+ if (!style || !((_d = style === null || style === void 0 ? void 0 : style.modelStyle) === null || _d === void 0 ? void 0 : _d.customize)) {
4919
4978
  return null;
4920
4979
  }
4921
- return style.Settings;
4980
+ return style;
4922
4981
  };
4923
- CadStyler.prototype.getTilesetFeatureNeedsFullData = function (entityId, entityTypeId) {
4982
+ Styler.prototype.getTilesetFeatureNeedsFullData = function (entityId, entityTypeId) {
4924
4983
  var _a;
4925
4984
  var style = this.getTilesetFeatureStyle(entityId, entityTypeId);
4926
4985
  if (!style) {
@@ -4932,9 +4991,9 @@ var TilesetRenderEngine;
4932
4991
  }
4933
4992
  return fill[0].type != 0;
4934
4993
  };
4935
- return CadStyler;
4994
+ return Styler;
4936
4995
  }());
4937
- TilesetRenderEngine.CadStyler = CadStyler;
4996
+ TilesetRenderEngine.Styler = Styler;
4938
4997
  })(TilesetRenderEngine || (TilesetRenderEngine = {}));
4939
4998
 
4940
4999
  /**
@@ -5010,7 +5069,7 @@ var TilesetCadRenderManager;
5010
5069
  return;
5011
5070
  }
5012
5071
  _this.onCTilesetLoad();
5013
- _this.styler = new TilesetRenderEngine.CadStyler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
5072
+ _this.styler = new TilesetRenderEngine.Styler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
5014
5073
  }
5015
5074
  catch (e) {
5016
5075
  console.error(e);
@@ -5989,12 +6048,12 @@ var TilesetArbRenderManager;
5989
6048
  configurable: true
5990
6049
  });
5991
6050
  Manager.prototype.Init = function () {
5992
- var _a, _b, _c, _d;
6051
+ var _a, _b, _c, _d, _e, _f;
5993
6052
  return __awaiter(this, void 0, void 0, function () {
5994
- var loadUrlOverride, itemUrl, url, urlParts, tilesetId_1, accountId, tilesetId, _e, tileset, type, _f, LEGACY_TYPES, legacyTileset, _g, _h;
6053
+ var loadUrlOverride, itemUrl, url, urlParts, tilesetId_1, accountId, tilesetId, _g, tileset, type, _h, LEGACY_TYPES, legacyTileset, _j, accountId, _k;
5995
6054
  var _this = this;
5996
- return __generator(this, function (_j) {
5997
- switch (_j.label) {
6055
+ return __generator(this, function (_l) {
6056
+ switch (_l.label) {
5998
6057
  case 0:
5999
6058
  loadUrlOverride = null;
6000
6059
  if (this.item.tileset) {
@@ -6026,13 +6085,13 @@ var TilesetArbRenderManager;
6026
6085
  menuItem: this.item
6027
6086
  })];
6028
6087
  case 1:
6029
- _f = _j.sent();
6088
+ _h = _l.sent();
6030
6089
  return [3 /*break*/, 3];
6031
6090
  case 2:
6032
- _f = { tileset: null, type: null };
6033
- _j.label = 3;
6091
+ _h = { tileset: null, type: null };
6092
+ _l.label = 3;
6034
6093
  case 3:
6035
- _e = _f, tileset = _e.tileset, type = _e.type;
6094
+ _g = _h, tileset = _g.tileset, type = _g.type;
6036
6095
  if (tileset && loadUrlOverride) {
6037
6096
  tileset.loadUrl = loadUrlOverride;
6038
6097
  }
@@ -6049,24 +6108,29 @@ var TilesetArbRenderManager;
6049
6108
  tileset: tileset
6050
6109
  })];
6051
6110
  case 4:
6052
- _g = _j.sent();
6111
+ _j = _l.sent();
6053
6112
  return [3 /*break*/, 6];
6054
6113
  case 5:
6055
- _g = null;
6056
- _j.label = 6;
6114
+ _j = null;
6115
+ _l.label = 6;
6057
6116
  case 6:
6058
- legacyTileset = _g;
6059
- _h = this;
6117
+ legacyTileset = _j;
6118
+ accountId = (_e = (_d = this.item) === null || _d === void 0 ? void 0 : _d.tileset) === null || _e === void 0 ? void 0 : _e.ClientAccountID;
6119
+ if (!accountId) {
6120
+ accountId = this.apiGetter.accountId;
6121
+ }
6122
+ _k = this;
6060
6123
  return [4 /*yield*/, TilesetRenderEngine.RenderLegacy({
6061
6124
  apiGetter: this.apiGetter,
6062
6125
  tileset: legacyTileset,
6063
6126
  viewer: this.viewer,
6064
- ionId: (_d = this.item.IonResource) === null || _d === void 0 ? void 0 : _d.AssetID,
6127
+ ionId: (_f = this.item.IonResource) === null || _f === void 0 ? void 0 : _f.AssetID,
6065
6128
  loadUrl: loadUrlOverride,
6129
+ accountId: accountId,
6066
6130
  viaCdn: true
6067
6131
  })];
6068
6132
  case 7:
6069
- _h.cTileset = _j.sent();
6133
+ _k.cTileset = _l.sent();
6070
6134
  return [3 /*break*/, 9];
6071
6135
  case 8:
6072
6136
  if (tileset) {
@@ -6077,14 +6141,14 @@ var TilesetArbRenderManager;
6077
6141
  coords: null
6078
6142
  });
6079
6143
  }
6080
- _j.label = 9;
6144
+ _l.label = 9;
6081
6145
  case 9:
6082
6146
  this.cTileset.readyPromise.then(function () {
6083
6147
  try {
6084
6148
  if (_this.item.ApplyStyles ||
6085
6149
  _this.item.Type == MenuItem.EType.IonTileset) {
6086
6150
  var api = _this.apiGetter.getApi();
6087
- _this.styler = new TilesetRenderEngine.CadStyler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
6151
+ _this.styler = new TilesetRenderEngine.Styler(api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
6088
6152
  }
6089
6153
  _this.onCTilesetLoad();
6090
6154
  }
@@ -8068,7 +8132,7 @@ function renderLegacyNavigator(params, bookmark, view) {
8068
8132
  // TODO: Other scene settings.
8069
8133
  // TODO: Rendered relationships.
8070
8134
  VR.ClearHidden();
8071
- if ((_a = bSettings.hiddenEntityIds) === null || _a === void 0 ? void 0 : _a.length) {
8135
+ if ((_a = bSettings === null || bSettings === void 0 ? void 0 : bSettings.hiddenEntityIds) === null || _a === void 0 ? void 0 : _a.length) {
8072
8136
  VR.SetHidden({
8073
8137
  entityIds: bSettings.hiddenEntityIds,
8074
8138
  hidden: true
@@ -8091,17 +8155,19 @@ function renderLegacyNavigator(params, bookmark, view) {
8091
8155
  params.skipTransition = true;
8092
8156
  }
8093
8157
  if (!params.skipCamera) {
8094
- camera = bookmark.Camera;
8095
- pos = Cartesian3.fromDegrees(+camera.position.longitude, +camera.position.latitude, +camera.position.height);
8096
- manager.Viewer.scene.camera.flyTo({
8097
- destination: pos,
8098
- orientation: {
8099
- heading: +camera.heading,
8100
- pitch: +camera.pitch,
8101
- roll: +camera.roll
8102
- },
8103
- duration: params.skipTransition ? 0 : 2
8104
- });
8158
+ camera = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Camera;
8159
+ pos = camera ? Cartesian3.fromDegrees(+camera.position.longitude, +camera.position.latitude, +camera.position.height) : null;
8160
+ if (pos === null || pos === void 0 ? void 0 : pos.x) {
8161
+ manager.Viewer.scene.camera.flyTo({
8162
+ destination: pos,
8163
+ orientation: {
8164
+ heading: +camera.heading,
8165
+ pitch: +camera.pitch,
8166
+ roll: +camera.roll
8167
+ },
8168
+ duration: params.skipTransition ? 0 : 2
8169
+ });
8170
+ }
8105
8171
  }
8106
8172
  go = (_b = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Settings) === null || _b === void 0 ? void 0 : _b.groundOcclusion;
8107
8173
  if (go == null) {
@@ -8149,7 +8215,7 @@ function renderLegacyNavigator(params, bookmark, view) {
8149
8215
  _f.sent();
8150
8216
  _f.label = 8;
8151
8217
  case 8:
8152
- if (!((_e = bSettings.drawnRelationEntityIDs) === null || _e === void 0 ? void 0 : _e.length)) return [3 /*break*/, 10];
8218
+ if (!((_e = bSettings === null || bSettings === void 0 ? void 0 : bSettings.drawnRelationEntityIDs) === null || _e === void 0 ? void 0 : _e.length)) return [3 /*break*/, 10];
8153
8219
  menuItem = {
8154
8220
  id: RELATION_MENU_ITEM_ID,
8155
8221
  Caption: "Entity relations",
@@ -8406,7 +8472,7 @@ function renderNavigator(params, bookmark, view) {
8406
8472
  }
8407
8473
  }
8408
8474
  }
8409
- imagery = bSettings.imagery != null ? bSettings.imagery : (_1 = defaults.settings) === null || _1 === void 0 ? void 0 : _1.imagery;
8475
+ imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_1 = defaults.settings) === null || _1 === void 0 ? void 0 : _1.imagery;
8410
8476
  if (imagery == null) {
8411
8477
  // TODO: Need global default.
8412
8478
  imagery = [
@@ -8429,7 +8495,7 @@ function renderNavigator(params, bookmark, view) {
8429
8495
  })];
8430
8496
  case 3:
8431
8497
  _3.sent();
8432
- renderedRelationEntityIds = bSettings.renderedEntityRelations;
8498
+ renderedRelationEntityIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedEntityRelations;
8433
8499
  if (!renderedRelationEntityIds) {
8434
8500
  renderedRelationEntityIds = [];
8435
8501
  }