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.
- package/dist/bruce-models.es5.js +93 -30
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +93 -30
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/common/bounds.js +2 -2
- package/dist/lib/common/bounds.js.map +1 -1
- package/dist/lib/entity/entity.js +90 -27
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity.d.ts +53 -17
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3547,7 +3547,13 @@
|
|
|
3547
3547
|
* @param params
|
|
3548
3548
|
*/
|
|
3549
3549
|
function SetValue(params) {
|
|
3550
|
-
|
|
3550
|
+
let { entity: data, path, value } = params;
|
|
3551
|
+
if (!path || !path.length) {
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
if (typeof path == "string") {
|
|
3555
|
+
path = exports.PathUtils.Parse(path);
|
|
3556
|
+
}
|
|
3551
3557
|
let curData = data;
|
|
3552
3558
|
for (let i = 0; i < path.length; i++) {
|
|
3553
3559
|
const step = path[i];
|
|
@@ -3573,6 +3579,12 @@
|
|
|
3573
3579
|
if (checkAgainstLegacy == null) {
|
|
3574
3580
|
checkAgainstLegacy = true;
|
|
3575
3581
|
}
|
|
3582
|
+
if (!path || !path.length) {
|
|
3583
|
+
return null;
|
|
3584
|
+
}
|
|
3585
|
+
if (typeof path == "string") {
|
|
3586
|
+
path = exports.PathUtils.Parse(path);
|
|
3587
|
+
}
|
|
3576
3588
|
// Backwards compatibility for incredibly old data.
|
|
3577
3589
|
if (checkAgainstLegacy && path.length == 1 && path[0] == "ID") {
|
|
3578
3590
|
return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
@@ -3600,54 +3612,66 @@
|
|
|
3600
3612
|
// So we'll check against both locations until migration is complete.
|
|
3601
3613
|
// First we'll check against properties that could be found inside the internal section.
|
|
3602
3614
|
if (path[0] == "location") {
|
|
3603
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3615
|
+
value = checkForValue(["Bruce", "Location"].concat(path.slice(1)));
|
|
3604
3616
|
}
|
|
3605
3617
|
else if (path[0] == "transform") {
|
|
3606
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3618
|
+
value = checkForValue(["Bruce", "Transform"].concat(path.slice(1)));
|
|
3607
3619
|
}
|
|
3608
3620
|
else if (path[0] == "geometry") {
|
|
3609
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3621
|
+
value = checkForValue(["Bruce", "VectorGeometry"].concat(path.slice(1)));
|
|
3610
3622
|
}
|
|
3611
3623
|
else if (path[0] == "boundaries") {
|
|
3612
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3624
|
+
value = checkForValue(["Bruce", "Boundaries"].concat(path.slice(1)));
|
|
3613
3625
|
}
|
|
3614
|
-
else if (path[0] == "
|
|
3615
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3626
|
+
else if (path[0] == "geometryPivot") {
|
|
3627
|
+
value = checkForValue(["Bruce", "GeometryPivot"].concat(path.slice(1)));
|
|
3628
|
+
}
|
|
3629
|
+
else if (path[0] == "worldPivot") {
|
|
3630
|
+
value = checkForValue(["Bruce", "GeometryWorldPivot"].concat(path.slice(1)));
|
|
3616
3631
|
}
|
|
3617
3632
|
else if (path[0] == "worldPosition") {
|
|
3618
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3633
|
+
value = checkForValue(["Bruce", "AssemblyWorldPosition"].concat(path.slice(1)));
|
|
3619
3634
|
}
|
|
3620
3635
|
else if (path[0] == "tilesetID") {
|
|
3621
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3636
|
+
value = checkForValue(["Bruce", "TilesetIDs"].concat(path.slice(1)));
|
|
3622
3637
|
}
|
|
3623
3638
|
else if (path[0] == "geometryRadius") {
|
|
3624
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3639
|
+
value = checkForValue(["Bruce", "GeometryRadius"].concat(path.slice(1)));
|
|
3625
3640
|
}
|
|
3626
3641
|
// Now we'll check against properties that could still be in the top-level and haven't been migrated yet.
|
|
3627
3642
|
if (path[0] == "Bruce" && path.length > 1) {
|
|
3628
|
-
if (path[1] == "
|
|
3629
|
-
value = checkForValue(path.slice(
|
|
3643
|
+
if (path[1] == "Location") {
|
|
3644
|
+
value = checkForValue(["location"].concat(path.slice(2)));
|
|
3645
|
+
}
|
|
3646
|
+
else if (path[1] == "Transform") {
|
|
3647
|
+
value = checkForValue(["transform"].concat(path.slice(2)));
|
|
3630
3648
|
}
|
|
3631
|
-
else if (path[1] == "
|
|
3632
|
-
value = checkForValue(path.slice(
|
|
3649
|
+
else if (path[1] == "VectorGeometry") {
|
|
3650
|
+
value = checkForValue(["geometry"].concat(path.slice(2)));
|
|
3633
3651
|
}
|
|
3634
|
-
else if (path[1] == "
|
|
3635
|
-
value = checkForValue(path.slice(
|
|
3652
|
+
else if (path[1] == "Boundaries") {
|
|
3653
|
+
value = checkForValue(["boundaries"].concat(path.slice(2)));
|
|
3636
3654
|
}
|
|
3637
|
-
else if (path[1] == "
|
|
3638
|
-
value = checkForValue(path.slice(
|
|
3655
|
+
else if (path[1] == "GeometryPivot") {
|
|
3656
|
+
value = checkForValue(["geometryPivot"].concat(path.slice(2)));
|
|
3639
3657
|
}
|
|
3640
|
-
else if (path[1] == "
|
|
3641
|
-
value = checkForValue(path.slice(
|
|
3658
|
+
else if (path[1] == "GeometryWorldPivot") {
|
|
3659
|
+
value = checkForValue(["worldPivot"].concat(path.slice(2)));
|
|
3642
3660
|
}
|
|
3643
|
-
else if (path[1] == "
|
|
3644
|
-
value = checkForValue(path.slice(
|
|
3661
|
+
else if (path[1] == "AssemblyWorldPosition") {
|
|
3662
|
+
value = checkForValue(["worldPosition"].concat(path.slice(2)));
|
|
3645
3663
|
}
|
|
3646
|
-
else if (path[1] == "
|
|
3647
|
-
value = checkForValue(path.slice(
|
|
3664
|
+
else if (path[1] == "TilesetIDs") {
|
|
3665
|
+
value = checkForValue(["tilesetID"].concat(path.slice(2)));
|
|
3648
3666
|
}
|
|
3649
|
-
else if (path[1] == "
|
|
3650
|
-
value = checkForValue(path.slice(
|
|
3667
|
+
else if (path[1] == "GeometryRadius") {
|
|
3668
|
+
value = checkForValue(["geometryRadius"].concat(path.slice(2)));
|
|
3669
|
+
}
|
|
3670
|
+
else if (path[1] == "relations") {
|
|
3671
|
+
value = checkForValue(["Bruce", "Relations"].concat(path.slice(2)));
|
|
3672
|
+
}
|
|
3673
|
+
else if (path[1] == "Relations") {
|
|
3674
|
+
value = checkForValue(["Bruce", "relations"].concat(path.slice(2)));
|
|
3651
3675
|
}
|
|
3652
3676
|
}
|
|
3653
3677
|
}
|
|
@@ -3661,7 +3685,13 @@
|
|
|
3661
3685
|
* @param params
|
|
3662
3686
|
*/
|
|
3663
3687
|
function RemoveValue(params) {
|
|
3664
|
-
|
|
3688
|
+
let { entity: data, path } = params;
|
|
3689
|
+
if (!path || !path.length) {
|
|
3690
|
+
return;
|
|
3691
|
+
}
|
|
3692
|
+
if (typeof path == "string") {
|
|
3693
|
+
path = exports.PathUtils.Parse(path);
|
|
3694
|
+
}
|
|
3665
3695
|
let curData = data;
|
|
3666
3696
|
for (let i = 0; i < path.length; i++) {
|
|
3667
3697
|
const step = path[i];
|
|
@@ -3924,6 +3954,39 @@
|
|
|
3924
3954
|
});
|
|
3925
3955
|
}
|
|
3926
3956
|
Entity.GetList = GetList;
|
|
3957
|
+
/**
|
|
3958
|
+
* Helper method that returns an Entity object.
|
|
3959
|
+
* This will ensure the basics exist ("Bruce" structure).
|
|
3960
|
+
* @param params
|
|
3961
|
+
*/
|
|
3962
|
+
function Assert(params) {
|
|
3963
|
+
var _a, _b;
|
|
3964
|
+
let { entityId, entityTypeId, baseEntity } = params ? params : {};
|
|
3965
|
+
if (!entityId) {
|
|
3966
|
+
entityId = (_a = baseEntity === null || baseEntity === void 0 ? void 0 : baseEntity["Bruce"]) === null || _a === void 0 ? void 0 : _a["ID"];
|
|
3967
|
+
}
|
|
3968
|
+
if (!entityId) {
|
|
3969
|
+
entityId = exports.ObjectUtils.UId();
|
|
3970
|
+
}
|
|
3971
|
+
if (!entityTypeId) {
|
|
3972
|
+
entityTypeId = (_b = baseEntity === null || baseEntity === void 0 ? void 0 : baseEntity["Bruce"]) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
3973
|
+
}
|
|
3974
|
+
let bruce = baseEntity === null || baseEntity === void 0 ? void 0 : baseEntity["Bruce"];
|
|
3975
|
+
if (!bruce) {
|
|
3976
|
+
bruce = {
|
|
3977
|
+
"EntityType.ID": null
|
|
3978
|
+
};
|
|
3979
|
+
}
|
|
3980
|
+
bruce["ID"] = entityId;
|
|
3981
|
+
bruce["EntityType.ID"] = entityTypeId;
|
|
3982
|
+
return Object.assign(Object.assign({}, baseEntity), { "Bruce": bruce });
|
|
3983
|
+
}
|
|
3984
|
+
Entity.Assert = Assert;
|
|
3985
|
+
/**
|
|
3986
|
+
* Helper method that returns a geojson object for a given set of Entities.
|
|
3987
|
+
* @param params
|
|
3988
|
+
* @returns
|
|
3989
|
+
*/
|
|
3927
3990
|
function ToGeoJson(params) {
|
|
3928
3991
|
const { entities, excludeAltitude, altitude, includeUserData, allowedDisplayTypes } = params;
|
|
3929
3992
|
const features = [];
|
|
@@ -4624,14 +4687,14 @@
|
|
|
4624
4687
|
const points = [];
|
|
4625
4688
|
const location = exports.Entity.GetValue({
|
|
4626
4689
|
entity: entity,
|
|
4627
|
-
path: ["
|
|
4690
|
+
path: ["Bruce", "Location"]
|
|
4628
4691
|
});
|
|
4629
4692
|
if (location) {
|
|
4630
4693
|
points.push(location);
|
|
4631
4694
|
}
|
|
4632
4695
|
const geometry = exports.Entity.GetValue({
|
|
4633
4696
|
entity: entity,
|
|
4634
|
-
path: ["
|
|
4697
|
+
path: ["Bruce", "VectorGeometry"]
|
|
4635
4698
|
});
|
|
4636
4699
|
const processGeometry = (geometry, depth = 0) => {
|
|
4637
4700
|
if (!geometry || depth > 5) {
|
|
@@ -13003,7 +13066,7 @@
|
|
|
13003
13066
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13004
13067
|
|
|
13005
13068
|
// This is updated with the package.json version on build.
|
|
13006
|
-
const VERSION = "4.
|
|
13069
|
+
const VERSION = "4.3.0";
|
|
13007
13070
|
|
|
13008
13071
|
exports.VERSION = VERSION;
|
|
13009
13072
|
exports.AbstractApi = AbstractApi;
|