bruce-cesium 2.6.3 → 2.6.5
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-cesium.es5.js +125 -34
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +124 -33
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +82 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +52 -31
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/entities/entities-loaded-render-manager.d.ts +22 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -1030,42 +1030,63 @@
|
|
|
1030
1030
|
* @returns
|
|
1031
1031
|
*/
|
|
1032
1032
|
function GetPosAsync(params) {
|
|
1033
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1033
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1034
1034
|
return __awaiter(this, void 0, void 0, function () {
|
|
1035
|
-
var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, e_1, pos3d, tSettings, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset;
|
|
1036
|
-
return __generator(this, function (
|
|
1037
|
-
switch (
|
|
1035
|
+
var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, lat, lon, e_1, e_2, pos3d, tSettings, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset;
|
|
1036
|
+
return __generator(this, function (_o) {
|
|
1037
|
+
switch (_o.label) {
|
|
1038
1038
|
case 0:
|
|
1039
1039
|
viewer = params.viewer, entityId = params.entityId, entity = params.entity, tileset = params.tileset, tilesetId = params.tilesetId, visualRegister = params.visualRegister, returnHeightRef = params.returnHeightRef, recordHeightRef = params.recordHeightRef, api = params.api;
|
|
1040
|
-
if (!!entity) return [3 /*break*/,
|
|
1041
|
-
|
|
1040
|
+
if (!!entity) return [3 /*break*/, 9];
|
|
1041
|
+
lat = 0;
|
|
1042
|
+
lon = 0;
|
|
1043
|
+
_o.label = 1;
|
|
1042
1044
|
case 1:
|
|
1043
|
-
|
|
1045
|
+
_o.trys.push([1, 3, , 4]);
|
|
1044
1046
|
return [4 /*yield*/, bruceModels.Entity.Get({
|
|
1045
1047
|
api: api,
|
|
1046
1048
|
entityId: entityId,
|
|
1047
|
-
expandLocation:
|
|
1049
|
+
expandLocation: false
|
|
1048
1050
|
})];
|
|
1049
1051
|
case 2:
|
|
1050
|
-
entity = (
|
|
1051
|
-
|
|
1052
|
+
entity = (_o.sent()).entity;
|
|
1053
|
+
lat = +((_a = entity === null || entity === void 0 ? void 0 : entity.location) === null || _a === void 0 ? void 0 : _a.latitude);
|
|
1054
|
+
lon = +((_b = entity === null || entity === void 0 ? void 0 : entity.location) === null || _b === void 0 ? void 0 : _b.longitude);
|
|
1055
|
+
return [3 /*break*/, 4];
|
|
1052
1056
|
case 3:
|
|
1053
|
-
e_1 =
|
|
1054
|
-
console.
|
|
1057
|
+
e_1 = _o.sent();
|
|
1058
|
+
console.error(e_1);
|
|
1059
|
+
return [3 /*break*/, 4];
|
|
1060
|
+
case 4:
|
|
1061
|
+
if (!(entity && (isNaN(lat) || isNaN(lon) || (lat == 0 && lon == 0)))) return [3 /*break*/, 9];
|
|
1062
|
+
_o.label = 5;
|
|
1063
|
+
case 5:
|
|
1064
|
+
_o.trys.push([5, 7, , 9]);
|
|
1065
|
+
return [4 /*yield*/, bruceModels.Entity.Get({
|
|
1066
|
+
api: api,
|
|
1067
|
+
entityId: entityId,
|
|
1068
|
+
expandLocation: true
|
|
1069
|
+
})];
|
|
1070
|
+
case 6:
|
|
1071
|
+
entity = (_o.sent()).entity;
|
|
1072
|
+
return [3 /*break*/, 9];
|
|
1073
|
+
case 7:
|
|
1074
|
+
e_2 = _o.sent();
|
|
1075
|
+
console.warn(e_2);
|
|
1055
1076
|
return [4 /*yield*/, bruceModels.Entity.Get({
|
|
1056
1077
|
api: api,
|
|
1057
1078
|
entityId: entityId,
|
|
1058
1079
|
expandLocation: false
|
|
1059
1080
|
})];
|
|
1060
|
-
case
|
|
1061
|
-
entity = (
|
|
1062
|
-
return [3 /*break*/,
|
|
1063
|
-
case
|
|
1081
|
+
case 8:
|
|
1082
|
+
entity = (_o.sent()).entity;
|
|
1083
|
+
return [3 /*break*/, 9];
|
|
1084
|
+
case 9:
|
|
1064
1085
|
if (!entity) {
|
|
1065
1086
|
return [2 /*return*/, null];
|
|
1066
1087
|
}
|
|
1067
1088
|
if (!tilesetId) {
|
|
1068
|
-
tilesetId = ((
|
|
1089
|
+
tilesetId = ((_c = entity.tilesetID) === null || _c === void 0 ? void 0 : _c.length) ? entity.tilesetID[0] : tilesetId;
|
|
1069
1090
|
}
|
|
1070
1091
|
pos3d = tilesetId ? null : GetPos({
|
|
1071
1092
|
viewer: viewer,
|
|
@@ -1077,19 +1098,19 @@
|
|
|
1077
1098
|
if (bruceModels.Cartes.ValidateCartes3(pos3d)) {
|
|
1078
1099
|
return [2 /*return*/, pos3d];
|
|
1079
1100
|
}
|
|
1080
|
-
if (!!tileset) return [3 /*break*/,
|
|
1081
|
-
if (!tilesetId) return [3 /*break*/,
|
|
1101
|
+
if (!!tileset) return [3 /*break*/, 11];
|
|
1102
|
+
if (!tilesetId) return [3 /*break*/, 11];
|
|
1082
1103
|
return [4 /*yield*/, bruceModels.Tileset.Get({
|
|
1083
1104
|
api: api,
|
|
1084
1105
|
tilesetId: tilesetId
|
|
1085
1106
|
})];
|
|
1086
|
-
case
|
|
1087
|
-
tileset = (
|
|
1088
|
-
|
|
1089
|
-
case
|
|
1107
|
+
case 10:
|
|
1108
|
+
tileset = (_o.sent()).tileset;
|
|
1109
|
+
_o.label = 11;
|
|
1110
|
+
case 11:
|
|
1090
1111
|
tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
|
|
1091
|
-
if (((
|
|
1092
|
-
if ((
|
|
1112
|
+
if (((_d = entity.location) === null || _d === void 0 ? void 0 : _d.longitude) || ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _e === void 0 ? void 0 : _e.longitude)) {
|
|
1113
|
+
if ((_f = entity === null || entity === void 0 ? void 0 : entity.location) === null || _f === void 0 ? void 0 : _f.longitude) {
|
|
1093
1114
|
alt = +entity.location.altitude;
|
|
1094
1115
|
if (isNaN(alt)) {
|
|
1095
1116
|
alt = 0;
|
|
@@ -1108,22 +1129,22 @@
|
|
|
1108
1129
|
heading = 0;
|
|
1109
1130
|
pitch = 0;
|
|
1110
1131
|
roll = 0;
|
|
1111
|
-
if ((
|
|
1132
|
+
if ((_g = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _g === void 0 ? void 0 : _g.heading) {
|
|
1112
1133
|
heading = entity.transform.heading;
|
|
1113
1134
|
}
|
|
1114
|
-
else if ((
|
|
1135
|
+
else if ((_h = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _h === void 0 ? void 0 : _h.heading) {
|
|
1115
1136
|
heading = tSettings.transform.heading;
|
|
1116
1137
|
}
|
|
1117
|
-
if ((
|
|
1138
|
+
if ((_j = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _j === void 0 ? void 0 : _j.pitch) {
|
|
1118
1139
|
pitch = entity.transform.pitch;
|
|
1119
1140
|
}
|
|
1120
|
-
else if ((
|
|
1141
|
+
else if ((_k = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _k === void 0 ? void 0 : _k.pitch) {
|
|
1121
1142
|
pitch = tSettings.transform.pitch;
|
|
1122
1143
|
}
|
|
1123
|
-
if ((
|
|
1144
|
+
if ((_l = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _l === void 0 ? void 0 : _l.roll) {
|
|
1124
1145
|
roll = entity.transform.roll;
|
|
1125
1146
|
}
|
|
1126
|
-
else if ((
|
|
1147
|
+
else if ((_m = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _m === void 0 ? void 0 : _m.roll) {
|
|
1127
1148
|
roll = tSettings.transform.roll;
|
|
1128
1149
|
}
|
|
1129
1150
|
heading = +heading;
|
|
@@ -5736,8 +5757,67 @@
|
|
|
5736
5757
|
enumerable: false,
|
|
5737
5758
|
configurable: true
|
|
5738
5759
|
});
|
|
5739
|
-
|
|
5760
|
+
/**
|
|
5761
|
+
* Adds entities to menu item and queues the render for them.
|
|
5762
|
+
* If the entity already exists in the menu item, it will be removed and redrawn.
|
|
5763
|
+
* @param params
|
|
5764
|
+
*/
|
|
5765
|
+
Manager.prototype.AddEntities = function (params) {
|
|
5740
5766
|
var _this = this;
|
|
5767
|
+
var _a;
|
|
5768
|
+
if (this.disposed) {
|
|
5769
|
+
throw (new Error("This item is disposed."));
|
|
5770
|
+
}
|
|
5771
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
5772
|
+
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
5773
|
+
}
|
|
5774
|
+
var entities = params.entities;
|
|
5775
|
+
entities.forEach(function (x) {
|
|
5776
|
+
var _a;
|
|
5777
|
+
// If already in the menu item we'll first remove it.
|
|
5778
|
+
// That way we're using the latest provided data.
|
|
5779
|
+
var entityId = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
5780
|
+
var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; });
|
|
5781
|
+
if (index > -1) {
|
|
5782
|
+
_this.item.BruceEntity.Entities.splice(index, 1);
|
|
5783
|
+
}
|
|
5784
|
+
_this.item.BruceEntity.Entities.push(x);
|
|
5785
|
+
});
|
|
5786
|
+
this.ReRender({
|
|
5787
|
+
entities: entities,
|
|
5788
|
+
entityIds: entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; }),
|
|
5789
|
+
force: true
|
|
5790
|
+
});
|
|
5791
|
+
this.recreateGetter();
|
|
5792
|
+
};
|
|
5793
|
+
/**
|
|
5794
|
+
* Removes entities from the menu item that match provided IDs.
|
|
5795
|
+
* Any visuals will be removed as well.
|
|
5796
|
+
* @param params
|
|
5797
|
+
*/
|
|
5798
|
+
Manager.prototype.RemoveEntities = function (params) {
|
|
5799
|
+
var _this = this;
|
|
5800
|
+
var _a;
|
|
5801
|
+
if (this.disposed) {
|
|
5802
|
+
throw (new Error("This item is disposed."));
|
|
5803
|
+
}
|
|
5804
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
5805
|
+
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
5806
|
+
}
|
|
5807
|
+
var entityIds = params.entityIds;
|
|
5808
|
+
entityIds.forEach(function (x) {
|
|
5809
|
+
var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == x; });
|
|
5810
|
+
if (index > -1) {
|
|
5811
|
+
_this.item.BruceEntity.Entities.splice(index, 1);
|
|
5812
|
+
}
|
|
5813
|
+
_this.visualsManager.RemoveRegos({
|
|
5814
|
+
entityId: x,
|
|
5815
|
+
menuItemId: _this.item.id
|
|
5816
|
+
});
|
|
5817
|
+
});
|
|
5818
|
+
this.recreateGetter();
|
|
5819
|
+
};
|
|
5820
|
+
Manager.prototype.Init = function () {
|
|
5741
5821
|
var _a;
|
|
5742
5822
|
if (this.disposed) {
|
|
5743
5823
|
throw (new Error("This item is disposed."));
|
|
@@ -5754,6 +5834,17 @@
|
|
|
5754
5834
|
}
|
|
5755
5835
|
];
|
|
5756
5836
|
}
|
|
5837
|
+
this.recreateGetter();
|
|
5838
|
+
};
|
|
5839
|
+
/**
|
|
5840
|
+
* Recreates the getter for the entities.
|
|
5841
|
+
* This is used when the entities within the menu item are updated.
|
|
5842
|
+
* @todo: this causes a bad side-effect where all menu item entities are queued for a re-render.
|
|
5843
|
+
*/
|
|
5844
|
+
Manager.prototype.recreateGetter = function () {
|
|
5845
|
+
var _this = this;
|
|
5846
|
+
var _a;
|
|
5847
|
+
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
5757
5848
|
this.getter = new bruceModels.BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, BATCH_SIZE$1);
|
|
5758
5849
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
5759
5850
|
var _a;
|
|
@@ -15001,7 +15092,7 @@
|
|
|
15001
15092
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15002
15093
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
15003
15094
|
|
|
15004
|
-
var VERSION$1 = "2.6.
|
|
15095
|
+
var VERSION$1 = "2.6.5";
|
|
15005
15096
|
|
|
15006
15097
|
exports.VERSION = VERSION$1;
|
|
15007
15098
|
exports.CesiumViewMonitor = CesiumViewMonitor;
|