bruce-cesium 4.4.6 → 4.4.7

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
- import { BruceEvent, Cartes, Entity as Entity$1, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, ProjectViewTile, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, Session, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi } from 'bruce-models';
1
+ import { BruceEvent, Cartes, Entity as Entity$1, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, ProjectViewTile, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, AbstractApi, Session, EntityAttribute, EntityAttachment, EntityAttachmentType } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, Quaternion, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, JulianDate, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, PolygonPipeline, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6876,6 +6876,18 @@ var EntityRenderEnginePolyline;
6876
6876
  if (totalLength < MIN_LEN || totalLength > MAX_LEN) {
6877
6877
  return null;
6878
6878
  }
6879
+ // Smoothening the line.
6880
+ // Warning: we don't have a way to indicate that this is not the original set of points yet.
6881
+ // This means editing tools in our apps will bake these in on save.
6882
+ if (style.smoothen && style.smoothen > 2) {
6883
+ var smoothed = smoothenPoints(posses, style.smoothen, false);
6884
+ if (smoothed.find(function (x) { return !Cartes.ValidateCartes3(x); })) {
6885
+ console.error("Polyline.Render: Smoothening failed. Invalid Cartesian3 found. Defaulting to original points.");
6886
+ }
6887
+ else {
6888
+ posses = smoothed;
6889
+ }
6890
+ }
6879
6891
  var bColor = style.lineColor ? Calculator.GetColor(style.lineColor, entity, params.tags) : null;
6880
6892
  var cColor = bColor ? ColorToCColor(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
6881
6893
  if (cColor.alpha <= 0) {
@@ -7233,6 +7245,52 @@ function getHeightRef$2(style, defaultStyle) {
7233
7245
  }
7234
7246
  return heightRef;
7235
7247
  }
7248
+ function smoothenPoints(points, multiplier, closed) {
7249
+ if (points.length < 4 || multiplier < 2) {
7250
+ return points;
7251
+ }
7252
+ if (!closed) {
7253
+ points.unshift(Cartesian3.subtract(points[0], points[1], new Cartesian3()));
7254
+ points.push(Cartesian3.subtract(points[points.length - 1], points[points.length - 2], new Cartesian3()));
7255
+ }
7256
+ else {
7257
+ points.unshift(points[points.length - 1]);
7258
+ points.unshift(points[points.length - 2]);
7259
+ points.push(points[2]);
7260
+ }
7261
+ var splinePoints = [];
7262
+ var _loop_1 = function (i) {
7263
+ var _a = [0, 1, 2, 3].map(function (n) { return points[i + n]; }), P0 = _a[0], P1 = _a[1], P2 = _a[2], P3 = _a[3];
7264
+ for (var j = 0; j <= multiplier; j++) {
7265
+ splinePoints.push(catmullRom$1(P0, P1, P2, P3, j / multiplier));
7266
+ }
7267
+ };
7268
+ for (var i = 0; i < points.length - 3; i++) {
7269
+ _loop_1(i);
7270
+ }
7271
+ return splinePoints;
7272
+ }
7273
+ function catmullRom$1(p0, p1, p2, p3, t) {
7274
+ var t0 = 0;
7275
+ var t1 = getT$1(t0, 0.5, p0, p1);
7276
+ var t2 = getT$1(t1, 0.5, p1, p2);
7277
+ var t3 = getT$1(t2, 0.5, p2, p3);
7278
+ t = Math$1.lerp(t1, t2, t);
7279
+ var _a = [function (l, r) { return Cartesian3.add(l, r, new Cartesian3()); }, function (l, r) { return Cartesian3.multiplyByScalar(l, r, new Cartesian3()); }], add = _a[0], mul = _a[1];
7280
+ var A1 = add(mul(p0, (t1 - t) / (t1 - t0)), mul(p1, (t - t0) / (t1 - t0)));
7281
+ var A2 = add(mul(p1, (t2 - t) / (t2 - t1)), mul(p2, (t - t1) / (t2 - t1)));
7282
+ var A3 = add(mul(p2, (t3 - t) / (t3 - t2)), mul(p3, (t - t2) / (t3 - t2)));
7283
+ var B1 = add(mul(A1, (t2 - t) / (t2 - t0)), mul(A2, (t - t0) / (t2 - t0)));
7284
+ var B2 = add(mul(A2, (t3 - t) / (t3 - t1)), mul(A3, (t - t1) / (t3 - t1)));
7285
+ var C = add(mul(B1, (t2 - t) / (t2 - t1)), mul(B2, (t - t1) / (t2 - t1)));
7286
+ return C;
7287
+ }
7288
+ function getT$1(t, alpha, p0, p1) {
7289
+ var d = Cartesian3.subtract(p1, p0, new Cartesian3());
7290
+ var a = Cartesian3.dot(d, d);
7291
+ var b = Math.pow(a, alpha * 0.5);
7292
+ return b + t;
7293
+ }
7236
7294
 
7237
7295
  var EntityRenderEnginePolygon;
7238
7296
  (function (EntityRenderEnginePolygon) {
@@ -17712,6 +17770,24 @@ var TilesetArbRenderManager;
17712
17770
  }
17713
17771
  this.viewer.scene.requestRender();
17714
17772
  TilesetRenderEngine.OnTilesetReady(this.cTileset).then(function () {
17773
+ // Colour mask to apply to the Tileset as a whole.
17774
+ // Individual Entities can override this.
17775
+ // This is typically used for Tilesets without Entities to allow some sort of basic styling per-bookmark.
17776
+ try {
17777
+ var colorCss = _this.item.colorMask;
17778
+ if (colorCss) {
17779
+ _this.cTileset.style = new Cesium3DTileStyle({
17780
+ color: {
17781
+ conditions: [
17782
+ ["true", "color(\"".concat(colorCss, "\")")]
17783
+ ]
17784
+ }
17785
+ });
17786
+ }
17787
+ }
17788
+ catch (e) {
17789
+ console.error(e);
17790
+ }
17715
17791
  try {
17716
17792
  if (_this.item.ApplyStyles ||
17717
17793
  _this.item.Type == MenuItem.EType.IonTileset) {
@@ -24462,19 +24538,11 @@ function getInsertIndex(positions, pos3d) {
24462
24538
  if (startDist <= minDistance) {
24463
24539
  index = 0;
24464
24540
  minDistance = startDist;
24465
- console.log("Insert at start");
24466
- }
24467
- else {
24468
- console.log("Start distance was longer than cur distance. ".concat(startDist, " > ").concat(minDistance));
24469
24541
  }
24470
24542
  // Check against end point
24471
24543
  var endDist = Cartesian3.distance(pos3d, positions[positions.length - 1]);
24472
24544
  if (endDist <= minDistance) {
24473
24545
  index = positions.length;
24474
- console.log("Insert at end");
24475
- }
24476
- else {
24477
- console.log("End distance was longer than cur distance. ".concat(endDist, " > ").concat(minDistance));
24478
24546
  }
24479
24547
  return index;
24480
24548
  }
@@ -27204,7 +27272,7 @@ var ViewerUtils;
27204
27272
  ViewerUtils.AssertIonToken = AssertIonToken;
27205
27273
  })(ViewerUtils || (ViewerUtils = {}));
27206
27274
 
27207
- var VERSION = "4.4.6";
27275
+ var VERSION = "4.4.7";
27208
27276
 
27209
- export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, WidgetSearchBar, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
27277
+ export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, smoothenPoints, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, WidgetSearchBar, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
27210
27278
  //# sourceMappingURL=bruce-cesium.es5.js.map