bruce-models 4.6.7 → 4.6.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.
@@ -4528,7 +4528,7 @@ var Geometry;
4528
4528
  * @returns returns GeoJSON or null if conversion failed or resulted in an empty object.
4529
4529
  */
4530
4530
  function ToGeoJsonFeature(params) {
4531
- const { geometry, properties, altitude } = params;
4531
+ const { geometry, properties, altitude, noAltitude } = params;
4532
4532
  // Primary collection of geometries.
4533
4533
  // We will return a single feature that contains many geometries.
4534
4534
  // That way we can attach properties to the top-level.
@@ -4583,6 +4583,9 @@ var Geometry;
4583
4583
  const points = ParsePoints(polygon.LinearRing);
4584
4584
  return removeConsecutiveDuplicates(points.map(coord => {
4585
4585
  const { longitude: lon, latitude: lat, altitude: alt } = coord;
4586
+ if (noAltitude) {
4587
+ return [lon, lat];
4588
+ }
4586
4589
  return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
4587
4590
  }));
4588
4591
  }));
@@ -4597,6 +4600,9 @@ var Geometry;
4597
4600
  const points = ParsePoints(geometry.LineString);
4598
4601
  const coordinates = removeConsecutiveDuplicates(points.map(coord => {
4599
4602
  const { longitude: lon, latitude: lat, altitude: alt } = coord;
4603
+ if (noAltitude) {
4604
+ return [lon, lat];
4605
+ }
4600
4606
  return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
4601
4607
  }));
4602
4608
  if (coordinates.length >= 2) {
@@ -4610,7 +4616,13 @@ var Geometry;
4610
4616
  const points = ParsePoints(geometry.Point);
4611
4617
  if (points.length) {
4612
4618
  const { longitude: lon, latitude: lat, altitude: alt } = points[0];
4613
- const coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
4619
+ let coordinates;
4620
+ if (noAltitude) {
4621
+ coordinates = [lon, lat];
4622
+ }
4623
+ else {
4624
+ coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
4625
+ }
4614
4626
  jGeometry = {
4615
4627
  coordinates: coordinates,
4616
4628
  type: GeoJson.EType.Point
@@ -4676,15 +4688,11 @@ var Geometry;
4676
4688
  // This will append to the "full" object as it goes.
4677
4689
  const traverse = (feature) => {
4678
4690
  // Geometry collections don't have coords so we have to cast as any.
4679
- const { type, coordinates, properties } = feature.geometry;
4691
+ const { type, coordinates, properties, geometries } = feature.geometry;
4680
4692
  // Unknown thing. Ignoring.
4681
4693
  if (!type) {
4682
4694
  return;
4683
4695
  }
4684
- // No coordinates. Ignoring.
4685
- if (!coordinates) {
4686
- return;
4687
- }
4688
4696
  // Simple properties merge.
4689
4697
  // Doesn't handle nested properties very well.
4690
4698
  if (properties) {
@@ -4693,9 +4701,8 @@ var Geometry;
4693
4701
  // We'll first match cases of nested collections and handle them early.
4694
4702
  // Then we'll be left with simple geometry cases.
4695
4703
  if (type === GeoJson.EType.GeometryCollection) {
4696
- const collection = feature;
4697
- for (let i = 0; i < collection.geometries.length; i++) {
4698
- const geo = collection.geometries[i];
4704
+ for (let i = 0; i < geometries.length; i++) {
4705
+ const geo = geometries[i];
4699
4706
  traverse({
4700
4707
  type: GeoJson.EType.Feature,
4701
4708
  geometry: geo,
@@ -4711,6 +4718,10 @@ var Geometry;
4711
4718
  }
4712
4719
  return;
4713
4720
  }
4721
+ // No coordinates. Ignoring.
4722
+ if (!coordinates) {
4723
+ return;
4724
+ }
4714
4725
  const geometry = {};
4715
4726
  switch (type) {
4716
4727
  case GeoJson.EType.Polygon:
@@ -14026,7 +14037,7 @@ var DataSource;
14026
14037
  })(DataSource || (DataSource = {}));
14027
14038
 
14028
14039
  // This is updated with the package.json version on build.
14029
- const VERSION = "4.6.7";
14040
+ const VERSION = "4.6.9";
14030
14041
 
14031
14042
  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 };
14032
14043
  //# sourceMappingURL=bruce-models.es5.js.map