bruce-cesium 3.6.4 → 3.6.6
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 +203 -78
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +202 -77
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js +264 -72
- package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, ColorMaterialProperty, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, HeadingPitchRoll, Transforms, Matrix3, IonResource, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, PolylineGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolygonHierarchy, ScreenSpaceEventHandler, ScreenSpaceEventType, ShadowMode, ClassificationType, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ArcType, CornerType, ColorBlendMode, CzmlDataSource, Quaternion, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -15348,19 +15348,19 @@ var DataSourceStaticCsvManager;
|
|
|
15348
15348
|
Manager.prototype.renderMovingItem = function () {
|
|
15349
15349
|
var _a;
|
|
15350
15350
|
return __awaiter(this, void 0, void 0, function () {
|
|
15351
|
-
var api, vehicleFileUrl, lineColor, fileStrings, files, i, file, fileId, externalURL, fileUrl, fileStr, csvData, i, delimiter, fileStr, headers, rows, rowsArr, j, row, rowArr, primary, pHeaders, pLatIndex, pLonIndex, pDateTimeIndex, i, row, lat, lon,
|
|
15351
|
+
var api, vehicleFileUrl, alarmFileUrl, lineColor, fileStrings, files, i, file, fileId, externalURL, fileUrl, fileStr, csvData, i, delimiter, fileStr, headers, rows, rowsArr, j, row, rowArr, primary, pHeaders, pLatIndex, pLonIndex, pDateTimeIndex, i, row, lat, lon, dateTimeStr, utcDate, _b, datePart, timePart, _c, year, month, day, _d, hours, minutes, seconds, milliseconds, convertTo24HourFormat, dateTime24hr, _e, datePart, timePart, _f, day, month, year, _g, hours, minutes, seconds, _h, datePart, timePart, _j, year, month, day, _k, hours, minutes, seconds, vehicleId, czml, czmlAdjusted, curDateTime, source, pHeadingIndex_1, errorsInARow_1, removal_1;
|
|
15352
15352
|
var _this = this;
|
|
15353
|
-
return __generator(this, function (
|
|
15354
|
-
switch (
|
|
15353
|
+
return __generator(this, function (_l) {
|
|
15354
|
+
switch (_l.label) {
|
|
15355
15355
|
case 0:
|
|
15356
15356
|
api = this.apiGetter.getApi();
|
|
15357
15357
|
return [4 /*yield*/, api.Loading];
|
|
15358
15358
|
case 1:
|
|
15359
|
-
|
|
15359
|
+
_l.sent();
|
|
15360
15360
|
fileStrings = [];
|
|
15361
15361
|
files = this.item.CSV;
|
|
15362
15362
|
i = 0;
|
|
15363
|
-
|
|
15363
|
+
_l.label = 2;
|
|
15364
15364
|
case 2:
|
|
15365
15365
|
if (!(i < files.length)) return [3 /*break*/, 6];
|
|
15366
15366
|
file = files[i];
|
|
@@ -15381,9 +15381,9 @@ var DataSourceStaticCsvManager;
|
|
|
15381
15381
|
fileUrl = externalURL;
|
|
15382
15382
|
}
|
|
15383
15383
|
return [4 /*yield*/, fetch(fileUrl)];
|
|
15384
|
-
case 3: return [4 /*yield*/, (
|
|
15384
|
+
case 3: return [4 /*yield*/, (_l.sent()).text()];
|
|
15385
15385
|
case 4:
|
|
15386
|
-
fileStr =
|
|
15386
|
+
fileStr = _l.sent();
|
|
15387
15387
|
fileStrings.push(fileStr);
|
|
15388
15388
|
if (this.disposed) {
|
|
15389
15389
|
return [2 /*return*/];
|
|
@@ -15398,7 +15398,14 @@ var DataSourceStaticCsvManager;
|
|
|
15398
15398
|
if (file.lineColor) {
|
|
15399
15399
|
lineColor = file.lineColor;
|
|
15400
15400
|
}
|
|
15401
|
-
|
|
15401
|
+
if (file.alertFileId) {
|
|
15402
|
+
alarmFileUrl = ClientFile.GetUrl({
|
|
15403
|
+
api: api,
|
|
15404
|
+
fileId: file.alertFileId,
|
|
15405
|
+
viaCdn: true
|
|
15406
|
+
});
|
|
15407
|
+
}
|
|
15408
|
+
_l.label = 5;
|
|
15402
15409
|
case 5:
|
|
15403
15410
|
i++;
|
|
15404
15411
|
return [3 /*break*/, 2];
|
|
@@ -15439,8 +15446,50 @@ var DataSourceStaticCsvManager;
|
|
|
15439
15446
|
if (typeof lon == "string") {
|
|
15440
15447
|
row[pLonIndex] = parseFloat(lon);
|
|
15441
15448
|
}
|
|
15442
|
-
|
|
15443
|
-
|
|
15449
|
+
dateTimeStr = row[pDateTimeIndex];
|
|
15450
|
+
if (typeof dateTimeStr === "string") {
|
|
15451
|
+
utcDate = void 0;
|
|
15452
|
+
// Dates are assumed to be in UTC.
|
|
15453
|
+
// Check for the format: `2023/12/24 04:15:00.743`.
|
|
15454
|
+
if (dateTimeStr.includes("/") && dateTimeStr.includes(":")) {
|
|
15455
|
+
_b = dateTimeStr.split(" "), datePart = _b[0], timePart = _b[1];
|
|
15456
|
+
_c = datePart.split("/").map(Number), year = _c[0], month = _c[1], day = _c[2];
|
|
15457
|
+
_d = timePart.split(":").map(Number), hours = _d[0], minutes = _d[1], seconds = _d[2];
|
|
15458
|
+
milliseconds = seconds % 1 * 1000;
|
|
15459
|
+
utcDate = new Date(Date.UTC(year, month - 1, day, hours, minutes, Math.floor(seconds), milliseconds));
|
|
15460
|
+
}
|
|
15461
|
+
// Check for the format: `24-12-2023 4:15:12 AM`.
|
|
15462
|
+
else if (dateTimeStr.includes("-") && dateTimeStr.includes(":") && (dateTimeStr.includes("AM") || dateTimeStr.includes("PM"))) {
|
|
15463
|
+
convertTo24HourFormat = function (dateTimeStr) {
|
|
15464
|
+
var _a = dateTimeStr.split(/[: ]+/), datePart = _a[0], timePart = _a[1], meridian = _a[2];
|
|
15465
|
+
var _b = timePart.split(":").map(Number), hours = _b[0], minutes = _b[1], seconds = _b[2];
|
|
15466
|
+
if (meridian === 'PM' && hours < 12) {
|
|
15467
|
+
hours += 12;
|
|
15468
|
+
}
|
|
15469
|
+
if (meridian === 'AM' && hours === 12) {
|
|
15470
|
+
hours = 0;
|
|
15471
|
+
}
|
|
15472
|
+
return "".concat(datePart, " ").concat(hours.toString().padStart(2, '0'), ":").concat(minutes.toString().padStart(2, '0'), ":").concat(seconds.toString().padStart(2, '0'));
|
|
15473
|
+
};
|
|
15474
|
+
dateTime24hr = convertTo24HourFormat(dateTimeStr);
|
|
15475
|
+
_e = dateTime24hr.split(" "), datePart = _e[0], timePart = _e[1];
|
|
15476
|
+
_f = datePart.split("-").map(Number), day = _f[0], month = _f[1], year = _f[2];
|
|
15477
|
+
_g = timePart.split(":").map(Number), hours = _g[0], minutes = _g[1], seconds = _g[2];
|
|
15478
|
+
utcDate = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
|
|
15479
|
+
}
|
|
15480
|
+
// Format: `2023-12-24 04:19:17.196`.
|
|
15481
|
+
else if (dateTimeStr.includes("-") && dateTimeStr.includes(":")) {
|
|
15482
|
+
_h = dateTimeStr.split(" "), datePart = _h[0], timePart = _h[1];
|
|
15483
|
+
_j = datePart.split("-").map(Number), year = _j[0], month = _j[1], day = _j[2];
|
|
15484
|
+
_k = timePart.split(":").map(Number), hours = _k[0], minutes = _k[1], seconds = _k[2];
|
|
15485
|
+
utcDate = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
|
|
15486
|
+
}
|
|
15487
|
+
else {
|
|
15488
|
+
// Fallback to parsing in local time.
|
|
15489
|
+
utcDate = new Date(dateTimeStr);
|
|
15490
|
+
}
|
|
15491
|
+
row[pDateTimeIndex] = utcDate.toISOString();
|
|
15492
|
+
}
|
|
15444
15493
|
}
|
|
15445
15494
|
// Sort by date.
|
|
15446
15495
|
primary.rows.sort(function (a, b) {
|
|
@@ -15449,7 +15498,7 @@ var DataSourceStaticCsvManager;
|
|
|
15449
15498
|
return aDate.getTime() - bDate.getTime();
|
|
15450
15499
|
});
|
|
15451
15500
|
vehicleId = ObjectUtils.UId();
|
|
15452
|
-
czml = createJourneyCzml(vehicleId, vehicleFileUrl, lineColor, primary);
|
|
15501
|
+
czml = createJourneyCzml(vehicleId, vehicleFileUrl, alarmFileUrl, lineColor, primary);
|
|
15453
15502
|
this.czmlDataInputs.push(czml);
|
|
15454
15503
|
czmlAdjusted = JSON.parse(JSON.stringify(czml));
|
|
15455
15504
|
czmlAdjusted.forEach(function (item) {
|
|
@@ -15458,19 +15507,20 @@ var DataSourceStaticCsvManager;
|
|
|
15458
15507
|
curDateTime = this.viewer.clock.currentTime;
|
|
15459
15508
|
return [4 /*yield*/, this.viewer.dataSources.add(CzmlDataSource.load(czmlAdjusted))];
|
|
15460
15509
|
case 7:
|
|
15461
|
-
source =
|
|
15510
|
+
source = _l.sent();
|
|
15462
15511
|
this.dataSource = source;
|
|
15463
15512
|
// Reset back to the previous dateTime.
|
|
15464
15513
|
// Adding the czml data source will have changed the clock.
|
|
15465
15514
|
this.viewer.clock.currentTime = curDateTime;
|
|
15466
15515
|
// Listen to update ticks and ensure orientation of moving item is correct.
|
|
15467
15516
|
if (this.viewer.clock) {
|
|
15517
|
+
pHeadingIndex_1 = pHeaders.findIndex(function (x) { return x.toLowerCase().includes("head"); });
|
|
15468
15518
|
errorsInARow_1 = 0;
|
|
15469
15519
|
removal_1 = this.viewer.clock.onTick.addEventListener(function () {
|
|
15470
15520
|
var vehicle = source.entities.getById(vehicleId);
|
|
15471
15521
|
if (vehicle) {
|
|
15472
15522
|
try {
|
|
15473
|
-
updateOrientation(_this.viewer, vehicle);
|
|
15523
|
+
updateOrientation(primary.rows, pHeadingIndex_1, pDateTimeIndex, _this.viewer, vehicle);
|
|
15474
15524
|
errorsInARow_1 = 0;
|
|
15475
15525
|
}
|
|
15476
15526
|
catch (e) {
|
|
@@ -15526,11 +15576,12 @@ var DataSourceStaticCsvManager;
|
|
|
15526
15576
|
* This shows a journey taken by a moving object and alarms detected along the way.
|
|
15527
15577
|
* @param vehicleId
|
|
15528
15578
|
* @param vehicleFileUrl
|
|
15579
|
+
* @param alarmFileUrl
|
|
15529
15580
|
* @param lineColor
|
|
15530
15581
|
* @param data
|
|
15531
15582
|
* @returns
|
|
15532
15583
|
*/
|
|
15533
|
-
function createJourneyCzml(vehicleId, vehicleFileUrl, lineColor, data) {
|
|
15584
|
+
function createJourneyCzml(vehicleId, vehicleFileUrl, alarmFileUrl, lineColor, data) {
|
|
15534
15585
|
var headers = data.headers;
|
|
15535
15586
|
var rows = data.rows;
|
|
15536
15587
|
var latIndex = headers.findIndex(function (x) { return x.toLowerCase().includes("lat"); });
|
|
@@ -15552,62 +15603,88 @@ function createJourneyCzml(vehicleId, vehicleFileUrl, lineColor, data) {
|
|
|
15552
15603
|
},
|
|
15553
15604
|
];
|
|
15554
15605
|
// Create a polyline for the full path.
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
0
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
});
|
|
15577
|
-
// Add points for the alarms.
|
|
15578
|
-
rows.filter(function (row) { return row[alarmIndex]; }).forEach(function (row, index) {
|
|
15579
|
-
czml.push({
|
|
15580
|
-
"id": ObjectUtils.UId(),
|
|
15581
|
-
"name": "Alarm",
|
|
15582
|
-
"position": {
|
|
15583
|
-
"cartographicDegrees": [
|
|
15584
|
-
Number(row[lonIndex]),
|
|
15585
|
-
Number(row[latIndex]),
|
|
15606
|
+
// If segmented we'll break it into pieces and display each piece based on relative time to the cesium viewer clock.
|
|
15607
|
+
{
|
|
15608
|
+
// Calculate the total duration of the journey in milliseconds.
|
|
15609
|
+
var totalDuration = new Date(rows[rows.length - 1][dateTimeIndex]).getTime() - new Date(rows[0][dateTimeIndex]).getTime();
|
|
15610
|
+
// Percentage of the journey to be visible before and after each point.
|
|
15611
|
+
var visibilityPercentage = 0.05; // 5%
|
|
15612
|
+
var visibilityDuration_1 = totalDuration * visibilityPercentage;
|
|
15613
|
+
rows.forEach(function (row, index) {
|
|
15614
|
+
var time = new Date(row[dateTimeIndex]).getTime();
|
|
15615
|
+
var startTime = new Date(time - visibilityDuration_1 / 2).toISOString();
|
|
15616
|
+
var endTime = new Date(time + visibilityDuration_1 / 2).toISOString();
|
|
15617
|
+
var position = [
|
|
15618
|
+
Number(row[lonIndex]),
|
|
15619
|
+
Number(row[latIndex]),
|
|
15620
|
+
0
|
|
15621
|
+
];
|
|
15622
|
+
if (index < rows.length - 1) {
|
|
15623
|
+
var nextRow = rows[index + 1];
|
|
15624
|
+
var nextPosition = [
|
|
15625
|
+
Number(nextRow[lonIndex]),
|
|
15626
|
+
Number(nextRow[latIndex]),
|
|
15586
15627
|
0
|
|
15587
|
-
]
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
"
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
}
|
|
15628
|
+
];
|
|
15629
|
+
czml.push({
|
|
15630
|
+
"id": "segment-" + ObjectUtils.UId(),
|
|
15631
|
+
"name": "Path Segment",
|
|
15632
|
+
"availability": startTime + "/" + endTime,
|
|
15633
|
+
"polyline": {
|
|
15634
|
+
"positions": {
|
|
15635
|
+
"cartographicDegrees": position.concat(nextPosition)
|
|
15636
|
+
},
|
|
15637
|
+
"material": {
|
|
15638
|
+
"solidColor": {
|
|
15639
|
+
"color": {
|
|
15640
|
+
"rgba": lineColor ? Color.fromCssColorString(lineColor).toBytes() : [0, 255, 0, 100]
|
|
15641
|
+
}
|
|
15642
|
+
}
|
|
15643
|
+
},
|
|
15644
|
+
"width": 5
|
|
15645
|
+
}
|
|
15646
|
+
});
|
|
15607
15647
|
}
|
|
15608
15648
|
});
|
|
15609
|
-
|
|
15649
|
+
// Alarm points.
|
|
15650
|
+
rows.filter(function (row) { return row[alarmIndex]; }).forEach(function (row, index) {
|
|
15651
|
+
var alarmTime = new Date(row[dateTimeIndex]).getTime();
|
|
15652
|
+
var startTime = new Date(alarmTime - visibilityDuration_1 / 2).toISOString();
|
|
15653
|
+
var endTime = new Date(alarmTime + visibilityDuration_1 / 2).toISOString();
|
|
15654
|
+
czml.push({
|
|
15655
|
+
"id": ObjectUtils.UId(),
|
|
15656
|
+
"name": "Alarm",
|
|
15657
|
+
"availability": startTime + "/" + endTime,
|
|
15658
|
+
"position": {
|
|
15659
|
+
"cartographicDegrees": [
|
|
15660
|
+
Number(row[lonIndex]),
|
|
15661
|
+
Number(row[latIndex]),
|
|
15662
|
+
5
|
|
15663
|
+
]
|
|
15664
|
+
},
|
|
15665
|
+
"point": !alarmFileUrl ? {
|
|
15666
|
+
"pixelSize": 10,
|
|
15667
|
+
"color": {
|
|
15668
|
+
"rgba": [255, 0, 0, 255]
|
|
15669
|
+
}
|
|
15670
|
+
} : undefined,
|
|
15671
|
+
"billboard": alarmFileUrl ? {
|
|
15672
|
+
"image": alarmFileUrl,
|
|
15673
|
+
"scale": 1,
|
|
15674
|
+
"pixelOffset": {
|
|
15675
|
+
"cartesian2": [0, 0]
|
|
15676
|
+
}
|
|
15677
|
+
} : undefined
|
|
15678
|
+
});
|
|
15679
|
+
});
|
|
15680
|
+
}
|
|
15610
15681
|
// Add animated point for the moving item.
|
|
15682
|
+
var vehiclePositions = rows.map(function (row) { return [
|
|
15683
|
+
(new Date(row[dateTimeIndex]).getTime() - new Date(rows[0][dateTimeIndex]).getTime()) / 1000,
|
|
15684
|
+
Number(row[lonIndex]),
|
|
15685
|
+
Number(row[latIndex]),
|
|
15686
|
+
0
|
|
15687
|
+
]; }).flat();
|
|
15611
15688
|
czml.push({
|
|
15612
15689
|
"id": vehicleId,
|
|
15613
15690
|
"name": "Vehicle",
|
|
@@ -15627,39 +15704,87 @@ function createJourneyCzml(vehicleId, vehicleFileUrl, lineColor, data) {
|
|
|
15627
15704
|
},
|
|
15628
15705
|
"position": {
|
|
15629
15706
|
"epoch": rows[0][dateTimeIndex],
|
|
15630
|
-
"cartographicDegrees":
|
|
15631
|
-
index,
|
|
15632
|
-
Number(row[lonIndex]),
|
|
15633
|
-
Number(row[latIndex]),
|
|
15634
|
-
0
|
|
15635
|
-
]; }).flat()
|
|
15707
|
+
"cartographicDegrees": vehiclePositions
|
|
15636
15708
|
}
|
|
15637
15709
|
});
|
|
15638
15710
|
return czml;
|
|
15639
15711
|
}
|
|
15640
15712
|
/**
|
|
15641
15713
|
* Updates the orientation of the moving item.
|
|
15642
|
-
*
|
|
15714
|
+
* If there is a heading in the file then it will calculate based on the file data,
|
|
15715
|
+
* if there isn't then it will calculate one based on the previous and current position.
|
|
15716
|
+
* @param rows
|
|
15717
|
+
* @param headingIndex
|
|
15718
|
+
* @param dateTimeIndex
|
|
15643
15719
|
* @param viewer
|
|
15644
15720
|
* @param vehicleEntity
|
|
15645
15721
|
* @returns
|
|
15646
15722
|
*/
|
|
15647
|
-
function updateOrientation(viewer, vehicleEntity) {
|
|
15723
|
+
function updateOrientation(rows, headingIndex, dateTimeIndex, viewer, vehicleEntity) {
|
|
15648
15724
|
if (!vehicleEntity || !vehicleEntity.position) {
|
|
15649
15725
|
return;
|
|
15650
15726
|
}
|
|
15651
15727
|
var positionProperty = vehicleEntity.position;
|
|
15652
15728
|
var currentTime = viewer.clock.currentTime;
|
|
15653
|
-
var previousTime = JulianDate.addSeconds(currentTime, -1, new JulianDate());
|
|
15654
15729
|
var currentPosition = positionProperty.getValue(currentTime);
|
|
15730
|
+
if (!currentPosition) {
|
|
15731
|
+
return;
|
|
15732
|
+
}
|
|
15733
|
+
if (headingIndex > -1) {
|
|
15734
|
+
try {
|
|
15735
|
+
var interpolatedHeading = interpolateHeading(dateTimeIndex, rows, currentTime, headingIndex);
|
|
15736
|
+
if (interpolatedHeading !== null) {
|
|
15737
|
+
var radians = Math$1.toRadians(interpolatedHeading - 90);
|
|
15738
|
+
var quaternion = Transforms.headingPitchRollQuaternion(currentPosition, new HeadingPitchRoll(radians, 0, 0));
|
|
15739
|
+
if (!isNaN(quaternion.w) && !isNaN(quaternion.x) && !isNaN(quaternion.y) && !isNaN(quaternion.z)) {
|
|
15740
|
+
vehicleEntity.orientation = quaternion;
|
|
15741
|
+
return;
|
|
15742
|
+
}
|
|
15743
|
+
else {
|
|
15744
|
+
console.error("Invalid quaternion", quaternion);
|
|
15745
|
+
}
|
|
15746
|
+
}
|
|
15747
|
+
}
|
|
15748
|
+
catch (e) {
|
|
15749
|
+
console.error(e);
|
|
15750
|
+
}
|
|
15751
|
+
}
|
|
15752
|
+
var previousTime = JulianDate.addSeconds(currentTime, -1, new JulianDate());
|
|
15655
15753
|
var previousPosition = positionProperty.getValue(previousTime);
|
|
15656
|
-
if (
|
|
15754
|
+
if (previousPosition && !Cartesian3.equals(currentPosition, previousPosition)) {
|
|
15657
15755
|
var direction = Cartesian3.subtract(currentPosition, previousPosition, new Cartesian3());
|
|
15658
15756
|
Cartesian3.normalize(direction, direction);
|
|
15659
15757
|
var rotationMatrix = Transforms.rotationMatrixFromPositionVelocity(previousPosition, direction);
|
|
15660
15758
|
vehicleEntity.orientation = Quaternion.fromRotationMatrix(rotationMatrix);
|
|
15661
15759
|
}
|
|
15662
15760
|
}
|
|
15761
|
+
function interpolateHeading(dateTimeIndex, rows, currentTime, headingIndex) {
|
|
15762
|
+
var currentTimeMs = JulianDate.toDate(currentTime).getTime();
|
|
15763
|
+
var nearestBefore = null;
|
|
15764
|
+
var nearestAfter = null;
|
|
15765
|
+
for (var _i = 0, rows_1 = rows; _i < rows_1.length; _i++) {
|
|
15766
|
+
var row = rows_1[_i];
|
|
15767
|
+
var time = new Date(row[dateTimeIndex]).getTime();
|
|
15768
|
+
var heading = parseFloat(String(row[headingIndex]));
|
|
15769
|
+
if (!isNaN(heading)) {
|
|
15770
|
+
if (time <= currentTimeMs) {
|
|
15771
|
+
nearestBefore = { time: time, heading: heading };
|
|
15772
|
+
}
|
|
15773
|
+
else if (time > currentTimeMs && nearestAfter === null) {
|
|
15774
|
+
nearestAfter = { time: time, heading: heading };
|
|
15775
|
+
break;
|
|
15776
|
+
}
|
|
15777
|
+
}
|
|
15778
|
+
}
|
|
15779
|
+
if (nearestBefore && nearestAfter) {
|
|
15780
|
+
var factor = (currentTimeMs - nearestBefore.time) / (nearestAfter.time - nearestBefore.time);
|
|
15781
|
+
return nearestBefore.heading + factor * (nearestAfter.heading - nearestBefore.heading);
|
|
15782
|
+
}
|
|
15783
|
+
else if (nearestBefore) {
|
|
15784
|
+
return nearestBefore.heading;
|
|
15785
|
+
}
|
|
15786
|
+
return null;
|
|
15787
|
+
}
|
|
15663
15788
|
|
|
15664
15789
|
var TilesetI3sRenderManager;
|
|
15665
15790
|
(function (TilesetI3sRenderManager) {
|
|
@@ -22219,7 +22344,7 @@ var ViewRenderEngine;
|
|
|
22219
22344
|
ViewRenderEngine.Render = Render;
|
|
22220
22345
|
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
22221
22346
|
|
|
22222
|
-
var VERSION = "3.6.
|
|
22347
|
+
var VERSION = "3.6.6";
|
|
22223
22348
|
|
|
22224
22349
|
export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, Draw3dPolygon, Draw3dPolyline };
|
|
22225
22350
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|