bruce-cesium 1.5.8 → 1.5.9

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, MenuItem, EntityRelation, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
2
- import { Cartesian2, Cartographic, Math as Math$1, SceneMode, Cartesian3, Color, HeightReference, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, Cesium3DTileColorBlendMode, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, Cesium3DTileset, Matrix4, IonResource, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, JulianDate, OrthographicFrustum } from 'cesium';
2
+ import { Color, HeightReference, Cartographic, Cartesian3, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Math as Math$1, Transforms, ColorBlendMode, Cartesian2, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, OrthographicFrustum, JulianDate, KmlDataSource, CallbackProperty, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Cesium3DTileset, Matrix4, IonResource, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -1724,21 +1724,24 @@ var EntityRenderEngine;
1724
1724
  flattenPoints = true;
1725
1725
  }
1726
1726
  var posses = points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(flattenPoints ? 0 : x.altitude)); });
1727
- // Making sure no 0 length lines coming through.
1728
- // Ideally we would measure the full line but I fear that's too expensive.
1729
- if (posses.length == 2 || posses.length == 3) {
1730
- var totalDistance = 0;
1731
- for (var i = 0; i < posses.length; i++) {
1732
- var pos1 = posses[i];
1733
- var pos2 = posses[i + 1];
1734
- if (pos1 && pos2) {
1735
- totalDistance += Cartesian3.distance(pos1, pos2);
1736
- }
1727
+ // 5 points should be enough to tell most bad data.
1728
+ var CHECK_POINTS = 5;
1729
+ var MIN_LEN = 0.001;
1730
+ var MAX_LEN = 4500000;
1731
+ var totalLength = 0;
1732
+ for (var i = 0; i < posses.length; i++) {
1733
+ if (i > CHECK_POINTS) {
1734
+ break;
1737
1735
  }
1738
- if (totalDistance < 0.001) {
1739
- return null;
1736
+ var pos1 = posses[i];
1737
+ var pos2 = posses[i + 1];
1738
+ if (pos1 && pos2) {
1739
+ totalLength += Cartesian3.distance(pos1, pos2);
1740
1740
  }
1741
1741
  }
1742
+ if (totalLength < MIN_LEN || totalLength > MAX_LEN) {
1743
+ return null;
1744
+ }
1742
1745
  var bColor = style.lineColor ? Calculator.GetColor(style.lineColor, entity, params.tags) : null;
1743
1746
  var cColor = bColor ? colorToCColor(bColor) : Color.RED;
1744
1747
  var width = style.lineWidth ? Calculator.GetNumber(style.lineWidth, entity, params.tags) : null;