bruce-cesium 6.0.8 → 6.1.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-cesium.es5.js +90 -54
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +89 -53
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/cesium-animated-property.js +31 -6
- package/dist/lib/rendering/cesium-animated-property.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-point.js +57 -46
- package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -1267,16 +1267,21 @@
|
|
|
1267
1267
|
return;
|
|
1268
1268
|
}
|
|
1269
1269
|
let hasHeading = false;
|
|
1270
|
+
const indicesToUpdate = [];
|
|
1270
1271
|
for (let i = 0; i < this.positions.length; i++) {
|
|
1271
|
-
|
|
1272
|
+
const pos = this.positions[i];
|
|
1272
1273
|
if (pos.heading !== null && pos.heading !== 0) {
|
|
1273
1274
|
hasHeading = true;
|
|
1274
|
-
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
// Track positions that need updating while we're iterating.
|
|
1278
|
+
if (pos.heading !== null) {
|
|
1279
|
+
indicesToUpdate.push(i);
|
|
1275
1280
|
}
|
|
1276
1281
|
}
|
|
1277
1282
|
if (!hasHeading) {
|
|
1278
|
-
for (
|
|
1279
|
-
this.positions[
|
|
1283
|
+
for (const index of indicesToUpdate) {
|
|
1284
|
+
this.positions[index].heading = null;
|
|
1280
1285
|
}
|
|
1281
1286
|
}
|
|
1282
1287
|
}
|
|
@@ -1547,18 +1552,38 @@
|
|
|
1547
1552
|
if (!newSeries || newSeries.length === 0) {
|
|
1548
1553
|
return;
|
|
1549
1554
|
}
|
|
1555
|
+
const dateTimeIndexes = new Map();
|
|
1556
|
+
for (let i = 0; i < this.positions.length; i++) {
|
|
1557
|
+
const pos = this.positions[i];
|
|
1558
|
+
if (pos && pos.dateTime) {
|
|
1559
|
+
dateTimeIndexes.set(pos.dateTime.getTime(), i);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1550
1562
|
for (const pos of newSeries) {
|
|
1551
1563
|
if (!pos || !pos.pos3d || !pos.dateTime) {
|
|
1552
1564
|
continue;
|
|
1553
1565
|
}
|
|
1554
|
-
const existingIndex =
|
|
1566
|
+
const existingIndex = dateTimeIndexes.get(pos.dateTime.getTime());
|
|
1555
1567
|
if (existingIndex >= 0) {
|
|
1556
1568
|
this.positions[existingIndex] = pos;
|
|
1557
1569
|
}
|
|
1558
1570
|
else {
|
|
1559
|
-
|
|
1571
|
+
const newPoint = {
|
|
1572
|
+
pos: pos.pos3d.clone(),
|
|
1573
|
+
time: pos.dateTime.getTime(),
|
|
1574
|
+
realTime: Date.now()
|
|
1575
|
+
};
|
|
1576
|
+
this.positionHistory.push(newPoint);
|
|
1577
|
+
dateTimeIndexes.set(pos.dateTime.getTime(), this.positions.length);
|
|
1560
1578
|
}
|
|
1561
1579
|
}
|
|
1580
|
+
if (this.positionHistory.length > this.maxHistorySize) {
|
|
1581
|
+
this.positionHistory = this.positionHistory.slice(-this.maxHistorySize);
|
|
1582
|
+
}
|
|
1583
|
+
this.analyzeMovementPatterns();
|
|
1584
|
+
this.processHeadings();
|
|
1585
|
+
this.sortPositions();
|
|
1586
|
+
this.invalidateCache();
|
|
1562
1587
|
}
|
|
1563
1588
|
UpdatePositionForDateTime(pos3d, dateTime, heading) {
|
|
1564
1589
|
if (!pos3d || !dateTime) {
|
|
@@ -5542,56 +5567,67 @@
|
|
|
5542
5567
|
}
|
|
5543
5568
|
};
|
|
5544
5569
|
if (type == BModels.Style.EPointType.Icon) {
|
|
5545
|
-
|
|
5546
|
-
let
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5570
|
+
let image = null;
|
|
5571
|
+
let imageKey = null;
|
|
5572
|
+
// Let's our apps/plugins generate images themselves.
|
|
5573
|
+
// Need a better documented process than this in the future.
|
|
5574
|
+
if (style["imageBillboard"]) {
|
|
5575
|
+
image = style["imageBillboard"];
|
|
5576
|
+
imageKey = image ? image.canvasDataUri : null;
|
|
5577
|
+
}
|
|
5578
|
+
// Typical process.
|
|
5579
|
+
else {
|
|
5580
|
+
// Fixing poor data.
|
|
5581
|
+
let iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
5582
|
+
iconUrlRows.forEach((row) => {
|
|
5583
|
+
if (row.type == BModels.Calculator.EValueType.Color) {
|
|
5584
|
+
row.type = BModels.Calculator.EValueType.Input;
|
|
5585
|
+
}
|
|
5586
|
+
});
|
|
5587
|
+
const icon = BModels.Calculator.GetString(iconUrlRows, entity, params.tags);
|
|
5588
|
+
let iconUrl = null;
|
|
5589
|
+
if (typeof icon == "string") {
|
|
5590
|
+
iconUrl = icon;
|
|
5591
|
+
const metadata = extractMetadataFromFileUrl(iconUrl);
|
|
5592
|
+
// If we're able to determine the Nextspace metadata from the url then we can use that to load the file.
|
|
5593
|
+
// Warning, if this is cross-env, eg: UAT -> DEV then it will RIGHTLY fail to load the file.
|
|
5594
|
+
if (metadata) {
|
|
5595
|
+
const api = params.apiGetter.getApi(metadata.accountId);
|
|
5596
|
+
await api.Loading;
|
|
5597
|
+
iconUrl = BModels.ClientFile.GetUrl({
|
|
5598
|
+
api: api,
|
|
5599
|
+
fileId: metadata.fileId,
|
|
5600
|
+
viaCdn: true
|
|
5601
|
+
});
|
|
5602
|
+
}
|
|
5550
5603
|
}
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
let iconUrl = null;
|
|
5554
|
-
if (typeof icon == "string") {
|
|
5555
|
-
iconUrl = icon;
|
|
5556
|
-
const metadata = extractMetadataFromFileUrl(iconUrl);
|
|
5557
|
-
// If we're able to determine the Nextspace metadata from the url then we can use that to load the file.
|
|
5558
|
-
// Warning, if this is cross-env, eg: UAT -> DEV then it will RIGHTLY fail to load the file.
|
|
5559
|
-
if (metadata) {
|
|
5560
|
-
const api = params.apiGetter.getApi(metadata.accountId);
|
|
5561
|
-
await api.Loading;
|
|
5604
|
+
if (!iconUrl && style.iconId) {
|
|
5605
|
+
await params.api.Loading;
|
|
5562
5606
|
iconUrl = BModels.ClientFile.GetUrl({
|
|
5563
|
-
api: api,
|
|
5564
|
-
fileId:
|
|
5607
|
+
api: params.api,
|
|
5608
|
+
fileId: style.iconId,
|
|
5565
5609
|
viaCdn: true
|
|
5566
5610
|
});
|
|
5567
5611
|
}
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
iconUrl
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
catch (e) {
|
|
5586
|
-
// Expanding the logging here so we can figure out why this is happening.
|
|
5587
|
-
// Most of the time the file is missing but we're getting some strange errors so I am including logging on the API settings as well.
|
|
5588
|
-
OneTimeError("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
5589
|
-
error: e,
|
|
5590
|
-
iconUrl,
|
|
5591
|
-
apiUrl: (_a = params.api) === null || _a === void 0 ? void 0 : _a.GetBaseUrl(),
|
|
5592
|
-
apiAccountId: (_b = params.api) === null || _b === void 0 ? void 0 : _b.AccountId
|
|
5593
|
-
});
|
|
5612
|
+
// ND-1640 - Tags not appearing.
|
|
5613
|
+
// Validate file, else user will see nothing.
|
|
5614
|
+
// Pray we aren't loading some giant file.
|
|
5615
|
+
if (iconUrl) {
|
|
5616
|
+
try {
|
|
5617
|
+
image = await createImageBillboard(iconUrl);
|
|
5618
|
+
}
|
|
5619
|
+
catch (e) {
|
|
5620
|
+
// Expanding the logging here so we can figure out why this is happening.
|
|
5621
|
+
// Most of the time the file is missing but we're getting some strange errors so I am including logging on the API settings as well.
|
|
5622
|
+
OneTimeError("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
5623
|
+
error: e,
|
|
5624
|
+
iconUrl,
|
|
5625
|
+
apiUrl: (_a = params.api) === null || _a === void 0 ? void 0 : _a.GetBaseUrl(),
|
|
5626
|
+
apiAccountId: (_b = params.api) === null || _b === void 0 ? void 0 : _b.AccountId
|
|
5627
|
+
});
|
|
5628
|
+
}
|
|
5594
5629
|
}
|
|
5630
|
+
imageKey = image ? iconUrl : null;
|
|
5595
5631
|
}
|
|
5596
5632
|
if (image) {
|
|
5597
5633
|
let iconScale = EnsureNumber(BModels.Calculator.GetNumber(style.iconScale, entity, params.tags));
|
|
@@ -5667,7 +5703,7 @@
|
|
|
5667
5703
|
prepareExistingGraphic(params.rendered, shouldShowTrack ? 1 : 0);
|
|
5668
5704
|
cEntity = params.rendered;
|
|
5669
5705
|
const currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5670
|
-
if (currentImgKey !=
|
|
5706
|
+
if (currentImgKey != imageKey) {
|
|
5671
5707
|
cEntity.billboard.image = new Cesium.ConstantProperty(image.canvasDataUri);
|
|
5672
5708
|
}
|
|
5673
5709
|
cEntity.billboard.scale = new Cesium.ConstantProperty(iconScale);
|
|
@@ -5753,7 +5789,7 @@
|
|
|
5753
5789
|
cEntity.show = true;
|
|
5754
5790
|
}
|
|
5755
5791
|
cEntity.billboard._billboardSize = image.height;
|
|
5756
|
-
cEntity.billboard._billboardImgKey =
|
|
5792
|
+
cEntity.billboard._billboardImgKey = imageKey;
|
|
5757
5793
|
}
|
|
5758
5794
|
}
|
|
5759
5795
|
}
|
|
@@ -33413,7 +33449,7 @@
|
|
|
33413
33449
|
}
|
|
33414
33450
|
}
|
|
33415
33451
|
|
|
33416
|
-
const VERSION = "6.0
|
|
33452
|
+
const VERSION = "6.1.0";
|
|
33417
33453
|
|
|
33418
33454
|
exports.VERSION = VERSION;
|
|
33419
33455
|
exports.isOutlineChanged = isOutlineChanged;
|