bruce-models 4.2.7 → 4.3.0

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.
@@ -3601,7 +3601,13 @@ var Entity;
3601
3601
  * @param params
3602
3602
  */
3603
3603
  function SetValue(params) {
3604
- const { entity: data, path, value } = params;
3604
+ let { entity: data, path, value } = params;
3605
+ if (!path || !path.length) {
3606
+ return;
3607
+ }
3608
+ if (typeof path == "string") {
3609
+ path = PathUtils.Parse(path);
3610
+ }
3605
3611
  let curData = data;
3606
3612
  for (let i = 0; i < path.length; i++) {
3607
3613
  const step = path[i];
@@ -3627,6 +3633,12 @@ var Entity;
3627
3633
  if (checkAgainstLegacy == null) {
3628
3634
  checkAgainstLegacy = true;
3629
3635
  }
3636
+ if (!path || !path.length) {
3637
+ return null;
3638
+ }
3639
+ if (typeof path == "string") {
3640
+ path = PathUtils.Parse(path);
3641
+ }
3630
3642
  // Backwards compatibility for incredibly old data.
3631
3643
  if (checkAgainstLegacy && path.length == 1 && path[0] == "ID") {
3632
3644
  return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
@@ -3654,54 +3666,66 @@ var Entity;
3654
3666
  // So we'll check against both locations until migration is complete.
3655
3667
  // First we'll check against properties that could be found inside the internal section.
3656
3668
  if (path[0] == "location") {
3657
- value = checkForValue(["Bruce"].concat(path));
3669
+ value = checkForValue(["Bruce", "Location"].concat(path.slice(1)));
3658
3670
  }
3659
3671
  else if (path[0] == "transform") {
3660
- value = checkForValue(["Bruce"].concat(path));
3672
+ value = checkForValue(["Bruce", "Transform"].concat(path.slice(1)));
3661
3673
  }
3662
3674
  else if (path[0] == "geometry") {
3663
- value = checkForValue(["Bruce"].concat(path));
3675
+ value = checkForValue(["Bruce", "VectorGeometry"].concat(path.slice(1)));
3664
3676
  }
3665
3677
  else if (path[0] == "boundaries") {
3666
- value = checkForValue(["Bruce"].concat(path));
3678
+ value = checkForValue(["Bruce", "Boundaries"].concat(path.slice(1)));
3667
3679
  }
3668
- else if (path[0] == "position") {
3669
- value = checkForValue(["Bruce"].concat(path));
3680
+ else if (path[0] == "geometryPivot") {
3681
+ value = checkForValue(["Bruce", "GeometryPivot"].concat(path.slice(1)));
3682
+ }
3683
+ else if (path[0] == "worldPivot") {
3684
+ value = checkForValue(["Bruce", "GeometryWorldPivot"].concat(path.slice(1)));
3670
3685
  }
3671
3686
  else if (path[0] == "worldPosition") {
3672
- value = checkForValue(["Bruce"].concat(path));
3687
+ value = checkForValue(["Bruce", "AssemblyWorldPosition"].concat(path.slice(1)));
3673
3688
  }
3674
3689
  else if (path[0] == "tilesetID") {
3675
- value = checkForValue(["Bruce"].concat(path));
3690
+ value = checkForValue(["Bruce", "TilesetIDs"].concat(path.slice(1)));
3676
3691
  }
3677
3692
  else if (path[0] == "geometryRadius") {
3678
- value = checkForValue(["Bruce"].concat(path));
3693
+ value = checkForValue(["Bruce", "GeometryRadius"].concat(path.slice(1)));
3679
3694
  }
3680
3695
  // Now we'll check against properties that could still be in the top-level and haven't been migrated yet.
3681
3696
  if (path[0] == "Bruce" && path.length > 1) {
3682
- if (path[1] == "location") {
3683
- value = checkForValue(path.slice(1));
3697
+ if (path[1] == "Location") {
3698
+ value = checkForValue(["location"].concat(path.slice(2)));
3699
+ }
3700
+ else if (path[1] == "Transform") {
3701
+ value = checkForValue(["transform"].concat(path.slice(2)));
3684
3702
  }
3685
- else if (path[1] == "transform") {
3686
- value = checkForValue(path.slice(1));
3703
+ else if (path[1] == "VectorGeometry") {
3704
+ value = checkForValue(["geometry"].concat(path.slice(2)));
3687
3705
  }
3688
- else if (path[1] == "geometry") {
3689
- value = checkForValue(path.slice(1));
3706
+ else if (path[1] == "Boundaries") {
3707
+ value = checkForValue(["boundaries"].concat(path.slice(2)));
3690
3708
  }
3691
- else if (path[1] == "boundaries") {
3692
- value = checkForValue(path.slice(1));
3709
+ else if (path[1] == "GeometryPivot") {
3710
+ value = checkForValue(["geometryPivot"].concat(path.slice(2)));
3693
3711
  }
3694
- else if (path[1] == "position") {
3695
- value = checkForValue(path.slice(1));
3712
+ else if (path[1] == "GeometryWorldPivot") {
3713
+ value = checkForValue(["worldPivot"].concat(path.slice(2)));
3696
3714
  }
3697
- else if (path[1] == "worldPosition") {
3698
- value = checkForValue(path.slice(1));
3715
+ else if (path[1] == "AssemblyWorldPosition") {
3716
+ value = checkForValue(["worldPosition"].concat(path.slice(2)));
3699
3717
  }
3700
- else if (path[1] == "tilesetID") {
3701
- value = checkForValue(path.slice(1));
3718
+ else if (path[1] == "TilesetIDs") {
3719
+ value = checkForValue(["tilesetID"].concat(path.slice(2)));
3702
3720
  }
3703
- else if (path[1] == "geometryRadius") {
3704
- value = checkForValue(path.slice(1));
3721
+ else if (path[1] == "GeometryRadius") {
3722
+ value = checkForValue(["geometryRadius"].concat(path.slice(2)));
3723
+ }
3724
+ else if (path[1] == "relations") {
3725
+ value = checkForValue(["Bruce", "Relations"].concat(path.slice(2)));
3726
+ }
3727
+ else if (path[1] == "Relations") {
3728
+ value = checkForValue(["Bruce", "relations"].concat(path.slice(2)));
3705
3729
  }
3706
3730
  }
3707
3731
  }
@@ -3715,7 +3739,13 @@ var Entity;
3715
3739
  * @param params
3716
3740
  */
3717
3741
  function RemoveValue(params) {
3718
- const { entity: data, path } = params;
3742
+ let { entity: data, path } = params;
3743
+ if (!path || !path.length) {
3744
+ return;
3745
+ }
3746
+ if (typeof path == "string") {
3747
+ path = PathUtils.Parse(path);
3748
+ }
3719
3749
  let curData = data;
3720
3750
  for (let i = 0; i < path.length; i++) {
3721
3751
  const step = path[i];
@@ -3978,6 +4008,39 @@ var Entity;
3978
4008
  });
3979
4009
  }
3980
4010
  Entity.GetList = GetList;
4011
+ /**
4012
+ * Helper method that returns an Entity object.
4013
+ * This will ensure the basics exist ("Bruce" structure).
4014
+ * @param params
4015
+ */
4016
+ function Assert(params) {
4017
+ var _a, _b;
4018
+ let { entityId, entityTypeId, baseEntity } = params ? params : {};
4019
+ if (!entityId) {
4020
+ entityId = (_a = baseEntity === null || baseEntity === void 0 ? void 0 : baseEntity["Bruce"]) === null || _a === void 0 ? void 0 : _a["ID"];
4021
+ }
4022
+ if (!entityId) {
4023
+ entityId = ObjectUtils.UId();
4024
+ }
4025
+ if (!entityTypeId) {
4026
+ entityTypeId = (_b = baseEntity === null || baseEntity === void 0 ? void 0 : baseEntity["Bruce"]) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
4027
+ }
4028
+ let bruce = baseEntity === null || baseEntity === void 0 ? void 0 : baseEntity["Bruce"];
4029
+ if (!bruce) {
4030
+ bruce = {
4031
+ "EntityType.ID": null
4032
+ };
4033
+ }
4034
+ bruce["ID"] = entityId;
4035
+ bruce["EntityType.ID"] = entityTypeId;
4036
+ return Object.assign(Object.assign({}, baseEntity), { "Bruce": bruce });
4037
+ }
4038
+ Entity.Assert = Assert;
4039
+ /**
4040
+ * Helper method that returns a geojson object for a given set of Entities.
4041
+ * @param params
4042
+ * @returns
4043
+ */
3981
4044
  function ToGeoJson(params) {
3982
4045
  const { entities, excludeAltitude, altitude, includeUserData, allowedDisplayTypes } = params;
3983
4046
  const features = [];
@@ -4691,14 +4754,14 @@ var Bounds;
4691
4754
  const points = [];
4692
4755
  const location = Entity.GetValue({
4693
4756
  entity: entity,
4694
- path: ["location"]
4757
+ path: ["Bruce", "Location"]
4695
4758
  });
4696
4759
  if (location) {
4697
4760
  points.push(location);
4698
4761
  }
4699
4762
  const geometry = Entity.GetValue({
4700
4763
  entity: entity,
4701
- path: ["geometry"]
4764
+ path: ["Bruce", "VectorGeometry"]
4702
4765
  });
4703
4766
  const processGeometry = (geometry, depth = 0) => {
4704
4767
  if (!geometry || depth > 5) {
@@ -13269,7 +13332,7 @@ var DataSource;
13269
13332
  })(DataSource || (DataSource = {}));
13270
13333
 
13271
13334
  // This is updated with the package.json version on build.
13272
- const VERSION = "4.2.7";
13335
+ const VERSION = "4.3.0";
13273
13336
 
13274
13337
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, 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 };
13275
13338
  //# sourceMappingURL=bruce-models.es5.js.map