bruce-cesium 1.3.9 → 1.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,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, CallbackProperty, OrthographicFrustum, JulianDate, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Matrix4, Cesium3DTileset, IonResource, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, 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, KmlDataSource, CallbackProperty, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, JulianDate, Matrix4, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -702,7 +702,7 @@ var EntityUtils;
702
702
  }
703
703
  else if (visual.polyline) {
704
704
  visualHeightRef = GetValue(viewer, visual.polyline.clampToGround) ?
705
- HeightReference.RELATIVE_TO_GROUND : HeightReference.NONE;
705
+ HeightReference.CLAMP_TO_GROUND : HeightReference.NONE;
706
706
  }
707
707
  else if (visual.billboard) {
708
708
  visualHeightRef = GetValue(viewer, visual.billboard.heightReference);
@@ -1440,6 +1440,7 @@ var EntityRenderEngine;
1440
1440
  }
1441
1441
  }
1442
1442
  var cEntity = null;
1443
+ var siblings = [];
1443
1444
  if (type == Style.EPointType.Icon) {
1444
1445
  // Fixing poor data.
1445
1446
  var iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
@@ -1482,7 +1483,67 @@ var EntityRenderEngine;
1482
1483
  }
1483
1484
  }
1484
1485
  }
1485
- if (type == Style.EPointType.Cylinder) ;
1486
+ if (type == Style.EPointType.Cylinder) {
1487
+ var radius = EnsureNumber(Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
1488
+ if (radius <= 0) {
1489
+ return null;
1490
+ }
1491
+ var bFill = style.CylinderFillColor ? Calculator.GetColor(style.CylinderFillColor, entity, params.tags) : null;
1492
+ var cFill = bFill ? colorToCColor(bFill) : Color.RED;
1493
+ var outline = Boolean(style.CylinderBorderEnabled);
1494
+ var cOutline = null;
1495
+ var outlineWidth = 1;
1496
+ var outlineHeight = 0;
1497
+ if (outline) {
1498
+ var bOutline = style.CylinderBorderColor ? Calculator.GetColor(style.CylinderBorderColor, entity, params.tags) : null;
1499
+ cOutline = bOutline ? colorToCColor(bOutline) : Color.BLACK;
1500
+ outlineWidth = EnsureNumber(Calculator.GetNumber(style.CylinderBorderWidth, entity, params.tags), 1);
1501
+ outlineHeight = EnsureNumber(Calculator.GetNumber(style.CylinderBorderExtrusion, entity, params.tags), 0);
1502
+ }
1503
+ var fillHeight = EnsureNumber(Calculator.GetNumber(style.CylinderFillExtrusion, entity, params.tags));
1504
+ var exHeightRef = undefined;
1505
+ if (fillHeight > 0) {
1506
+ exHeightRef = HeightReference.RELATIVE_TO_GROUND;
1507
+ }
1508
+ var pos = EntityUtils.GetPos({
1509
+ viewer: params.viewer,
1510
+ entity: entity
1511
+ });
1512
+ cEntity = new Entity({
1513
+ ellipse: {
1514
+ semiMajorAxis: radius,
1515
+ semiMinorAxis: radius,
1516
+ material: cFill,
1517
+ outlineWidth: null,
1518
+ extrudedHeight: fillHeight,
1519
+ heightReference: HeightReference.CLAMP_TO_GROUND,
1520
+ extrudedHeightReference: exHeightRef,
1521
+ zIndex: 1
1522
+ },
1523
+ position: pos === null || pos === void 0 ? void 0 : pos.clone(),
1524
+ show: false
1525
+ });
1526
+ if (outline && outlineWidth > 0) {
1527
+ if (!exHeightRef && outlineHeight > 0) {
1528
+ exHeightRef = HeightReference.RELATIVE_TO_GROUND;
1529
+ // We need height reference to match between rings.
1530
+ cEntity.ellipse.extrudedHeightReference = exHeightRef;
1531
+ }
1532
+ siblings.push(new Entity({
1533
+ ellipse: {
1534
+ semiMajorAxis: radius + outlineWidth,
1535
+ semiMinorAxis: radius + outlineWidth,
1536
+ material: cOutline,
1537
+ outlineWidth: undefined,
1538
+ extrudedHeight: outlineHeight,
1539
+ heightReference: HeightReference.CLAMP_TO_GROUND,
1540
+ extrudedHeightReference: exHeightRef,
1541
+ zIndex: 2
1542
+ },
1543
+ position: pos === null || pos === void 0 ? void 0 : pos.clone()
1544
+ }));
1545
+ }
1546
+ }
1486
1547
  if (!cEntity) {
1487
1548
  var bColor = style.color ? Calculator.GetColor(style.color, entity, params.tags) : null;
1488
1549
  var cColor = bColor ? colorToCColor(bColor) : Color.RED;
@@ -1509,6 +1570,12 @@ var EntityRenderEngine;
1509
1570
  }
1510
1571
  if (cEntity) {
1511
1572
  params.viewer.entities.add(cEntity);
1573
+ if (siblings) {
1574
+ siblings.forEach(function (sibling) {
1575
+ params.viewer.entities.add(sibling);
1576
+ });
1577
+ }
1578
+ cEntity._siblingGraphics = siblings;
1512
1579
  }
1513
1580
  return cEntity;
1514
1581
  }
@@ -1932,7 +1999,7 @@ var EntityRenderEngine;
1932
1999
  tags = (_e.sent()).tags;
1933
2000
  _e.label = 4;
1934
2001
  case 4:
1935
- 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 : {};
2002
+ mStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.modelStyle) !== null && _b !== void 0 ? _b : {};
1936
2003
  group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
1937
2004
  if (!group) {
1938
2005
  group = "DEFAULT";
@@ -1986,7 +2053,7 @@ var EntityRenderEngine;
1986
2053
  if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
1987
2054
  return [2 /*return*/, "continue"];
1988
2055
  }
1989
- mStyle = (_d = (_c = style === null || style === void 0 ? void 0 : style.Settings) === null || _c === void 0 ? void 0 : _c.polygonStyle) !== null && _d !== void 0 ? _d : {};
2056
+ mStyle = (_d = (_c = style === null || style === void 0 ? void 0 : style.Settings) === null || _c === void 0 ? void 0 : _c.modelStyle) !== null && _d !== void 0 ? _d : {};
1990
2057
  cEntity = Render({
1991
2058
  entity: entity,
1992
2059
  style: mStyle,
@@ -6718,18 +6785,59 @@ var MenuItemCreator;
6718
6785
  _b.label = 3;
6719
6786
  case 3:
6720
6787
  tileset = _a;
6721
- if (!(tileset.type == Tileset.EType.Cad)) return [3 /*break*/, 5];
6722
- menuItem = {
6723
- Caption: "Rendering Tileset",
6724
- FlyTo: true,
6725
- id: ObjectUtils.UId(),
6726
- tileset: {
6727
- TilesetID: tilesetId
6728
- },
6729
- Type: MenuItem.EType.CadTileset,
6730
- styleId: 0,
6731
- Children: []
6732
- };
6788
+ menuItem = null;
6789
+ if (tileset.type == Tileset.EType.Cad) {
6790
+ menuItem = {
6791
+ Caption: "Rendering Tileset",
6792
+ FlyTo: true,
6793
+ id: ObjectUtils.UId(),
6794
+ tileset: {
6795
+ TilesetID: tilesetId
6796
+ },
6797
+ Type: MenuItem.EType.CadTileset,
6798
+ styleId: 0,
6799
+ Children: []
6800
+ };
6801
+ }
6802
+ else if (tileset.type == Tileset.EType.PointCloud) {
6803
+ menuItem = {
6804
+ Caption: "Rendering Tileset",
6805
+ FlyTo: true,
6806
+ id: ObjectUtils.UId(),
6807
+ tileset: {
6808
+ TilesetID: tilesetId
6809
+ },
6810
+ Type: MenuItem.EType.PointCloud,
6811
+ Children: []
6812
+ };
6813
+ }
6814
+ else if (tileset.type == Tileset.EType.EntitiesSet) {
6815
+ menuItem = {
6816
+ Caption: "Rendering Tileset",
6817
+ FlyTo: true,
6818
+ id: ObjectUtils.UId(),
6819
+ tileset: {
6820
+ TilesetID: tilesetId
6821
+ },
6822
+ Type: MenuItem.EType.EntityTileset,
6823
+ Children: []
6824
+ };
6825
+ }
6826
+ else if (tileset.type == Tileset.EType.LegacyStatic ||
6827
+ tileset.type == Tileset.EType.LegacyExternal ||
6828
+ tileset.type == Tileset.EType.LegacyEntitiesSet) {
6829
+ menuItem = {
6830
+ Caption: "Rendering Tileset",
6831
+ FlyTo: true,
6832
+ id: ObjectUtils.UId(),
6833
+ tileset: {
6834
+ TilesetID: tilesetId
6835
+ },
6836
+ Type: MenuItem.EType.ArbTileset,
6837
+ Children: []
6838
+ };
6839
+ }
6840
+ if (!menuItem) return [3 /*break*/, 5];
6733
6841
  return [4 /*yield*/, params.manager.RenderItem({
6734
6842
  item: menuItem,
6735
6843
  apiGetter: params.apiGetter
@@ -6740,7 +6848,10 @@ var MenuItemCreator;
6740
6848
  menuItems: [menuItem],
6741
6849
  menuItemIds: [renderedIds]
6742
6850
  }];
6743
- case 5: throw (new Error("Tileset type not supported."));
6851
+ case 5: return [2 /*return*/, {
6852
+ menuItemIds: [],
6853
+ menuItems: []
6854
+ }];
6744
6855
  }
6745
6856
  });
6746
6857
  });