bruce-cesium 2.6.3 → 2.6.4

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.
@@ -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 (_l) {
1037
- switch (_l.label) {
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*/, 5];
1041
- _l.label = 1;
1040
+ if (!!entity) return [3 /*break*/, 9];
1041
+ lat = 0;
1042
+ lon = 0;
1043
+ _o.label = 1;
1042
1044
  case 1:
1043
- _l.trys.push([1, 3, , 5]);
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: true
1049
+ expandLocation: false
1048
1050
  })];
1049
1051
  case 2:
1050
- entity = (_l.sent()).entity;
1051
- return [3 /*break*/, 5];
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 = _l.sent();
1054
- console.warn(e_1);
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 4:
1061
- entity = (_l.sent()).entity;
1062
- return [3 /*break*/, 5];
1063
- case 5:
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 = ((_a = entity.tilesetID) === null || _a === void 0 ? void 0 : _a.length) ? entity.tilesetID[0] : 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*/, 7];
1081
- if (!tilesetId) return [3 /*break*/, 7];
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 6:
1087
- tileset = (_l.sent()).tileset;
1088
- _l.label = 7;
1089
- case 7:
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 (((_b = entity.location) === null || _b === void 0 ? void 0 : _b.longitude) || ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _c === void 0 ? void 0 : _c.longitude)) {
1092
- if ((_d = entity === null || entity === void 0 ? void 0 : entity.location) === null || _d === void 0 ? void 0 : _d.longitude) {
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 ((_e = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _e === void 0 ? void 0 : _e.heading) {
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 ((_f = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _f === void 0 ? void 0 : _f.heading) {
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 ((_g = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _g === void 0 ? void 0 : _g.pitch) {
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 ((_h = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _h === void 0 ? void 0 : _h.pitch) {
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 ((_j = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _j === void 0 ? void 0 : _j.roll) {
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 ((_k = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _k === void 0 ? void 0 : _k.roll) {
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;
@@ -15001,7 +15022,7 @@
15001
15022
  ViewerUtils.CreateWidgets = CreateWidgets;
15002
15023
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
15003
15024
 
15004
- var VERSION$1 = "2.6.3";
15025
+ var VERSION$1 = "2.6.4";
15005
15026
 
15006
15027
  exports.VERSION = VERSION$1;
15007
15028
  exports.CesiumViewMonitor = CesiumViewMonitor;