bruce-models 4.6.6 → 4.6.8

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.
@@ -4580,8 +4580,9 @@ var Geometry;
4580
4580
  // Converts polygons to GeoJSON coordinates.
4581
4581
  // This will close the polygon if it's not already closed and remove consecutive duplicates.
4582
4582
  const coordinates = closePolygonCoordinates(sortedPolygons.map(polygon => {
4583
- return removeConsecutiveDuplicates(polygon.LinearRing.split(' ').map(coord => {
4584
- const [lon, lat, alt] = coord.split(',').map(Number);
4583
+ const points = ParsePoints(polygon.LinearRing);
4584
+ return removeConsecutiveDuplicates(points.map(coord => {
4585
+ const { longitude: lon, latitude: lat, altitude: alt } = coord;
4585
4586
  return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
4586
4587
  }));
4587
4588
  }));
@@ -4593,8 +4594,9 @@ var Geometry;
4593
4594
  }
4594
4595
  }
4595
4596
  if (!jGeometry && geometry.LineString) {
4596
- const coordinates = removeConsecutiveDuplicates(geometry.LineString.split(' ').map(coord => {
4597
- const [lon, lat, alt] = coord.split(',').map(Number);
4597
+ const points = ParsePoints(geometry.LineString);
4598
+ const coordinates = removeConsecutiveDuplicates(points.map(coord => {
4599
+ const { longitude: lon, latitude: lat, altitude: alt } = coord;
4598
4600
  return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
4599
4601
  }));
4600
4602
  if (coordinates.length >= 2) {
@@ -4605,12 +4607,15 @@ var Geometry;
4605
4607
  }
4606
4608
  }
4607
4609
  if (!jGeometry && geometry.Point) {
4608
- const [lon, lat, alt] = geometry.Point.split(',').map(Number);
4609
- const coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
4610
- jGeometry = {
4611
- coordinates: coordinates,
4612
- type: GeoJson.EType.Point
4613
- };
4610
+ const points = ParsePoints(geometry.Point);
4611
+ if (points.length) {
4612
+ const { longitude: lon, latitude: lat, altitude: alt } = points[0];
4613
+ const coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
4614
+ jGeometry = {
4615
+ coordinates: coordinates,
4616
+ type: GeoJson.EType.Point
4617
+ };
4618
+ }
4614
4619
  }
4615
4620
  if (jGeometry) {
4616
4621
  collection.push(jGeometry);
@@ -4671,15 +4676,11 @@ var Geometry;
4671
4676
  // This will append to the "full" object as it goes.
4672
4677
  const traverse = (feature) => {
4673
4678
  // Geometry collections don't have coords so we have to cast as any.
4674
- const { type, coordinates, properties } = feature.geometry;
4679
+ const { type, coordinates, properties, geometries } = feature.geometry;
4675
4680
  // Unknown thing. Ignoring.
4676
4681
  if (!type) {
4677
4682
  return;
4678
4683
  }
4679
- // No coordinates. Ignoring.
4680
- if (!coordinates) {
4681
- return;
4682
- }
4683
4684
  // Simple properties merge.
4684
4685
  // Doesn't handle nested properties very well.
4685
4686
  if (properties) {
@@ -4688,9 +4689,8 @@ var Geometry;
4688
4689
  // We'll first match cases of nested collections and handle them early.
4689
4690
  // Then we'll be left with simple geometry cases.
4690
4691
  if (type === GeoJson.EType.GeometryCollection) {
4691
- const collection = feature;
4692
- for (let i = 0; i < collection.geometries.length; i++) {
4693
- const geo = collection.geometries[i];
4692
+ for (let i = 0; i < geometries.length; i++) {
4693
+ const geo = geometries[i];
4694
4694
  traverse({
4695
4695
  type: GeoJson.EType.Feature,
4696
4696
  geometry: geo,
@@ -4706,6 +4706,10 @@ var Geometry;
4706
4706
  }
4707
4707
  return;
4708
4708
  }
4709
+ // No coordinates. Ignoring.
4710
+ if (!coordinates) {
4711
+ return;
4712
+ }
4709
4713
  const geometry = {};
4710
4714
  switch (type) {
4711
4715
  case GeoJson.EType.Polygon:
@@ -14021,7 +14025,7 @@ var DataSource;
14021
14025
  })(DataSource || (DataSource = {}));
14022
14026
 
14023
14027
  // This is updated with the package.json version on build.
14024
- const VERSION = "4.6.6";
14028
+ const VERSION = "4.6.8";
14025
14029
 
14026
14030
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14027
14031
  //# sourceMappingURL=bruce-models.es5.js.map