bruce-cesium 3.5.9 → 3.6.1
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 +426 -3
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +425 -2
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/menu-item-manager.js +8 -0
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js +445 -0
- package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js.map +1 -0
- package/dist/lib/rendering/render-managers/data-source/data-source-static-kml-manager.js +7 -0
- package/dist/lib/rendering/render-managers/data-source/data-source-static-kml-manager.js.map +1 -1
- package/dist/lib/widgets/common/draw-3d-polyline.js +10 -1
- package/dist/lib/widgets/common/draw-3d-polyline.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/data-source/data-source-static-csv-manager.d.ts +38 -0
- package/dist/types/rendering/render-managers/data-source/data-source-static-kml-manager.d.ts +1 -0
- package/dist/types/widgets/common/draw-3d-polyline.d.ts +3 -0
- 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, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, ColorMaterialProperty, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, KmlDataSource, Ion, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, CzmlDataSource, Quaternion, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -13908,6 +13908,13 @@ var DataSourceStaticKmlManager;
|
|
|
13908
13908
|
enumerable: false,
|
|
13909
13909
|
configurable: true
|
|
13910
13910
|
});
|
|
13911
|
+
Object.defineProperty(Manager.prototype, "DataSources", {
|
|
13912
|
+
get: function () {
|
|
13913
|
+
return this.dataSources;
|
|
13914
|
+
},
|
|
13915
|
+
enumerable: false,
|
|
13916
|
+
configurable: true
|
|
13917
|
+
});
|
|
13911
13918
|
Manager.prototype.Init = function () {
|
|
13912
13919
|
var _this = this;
|
|
13913
13920
|
var files = this.item.KML;
|
|
@@ -15246,6 +15253,406 @@ var LegacyRelationsRenderManager;
|
|
|
15246
15253
|
LegacyRelationsRenderManager.Manager = Manager;
|
|
15247
15254
|
})(LegacyRelationsRenderManager || (LegacyRelationsRenderManager = {}));
|
|
15248
15255
|
|
|
15256
|
+
/**
|
|
15257
|
+
* Made for a POC experiment.
|
|
15258
|
+
* Do not use without reviewing the purpose and settings of the Menu Item.
|
|
15259
|
+
*/
|
|
15260
|
+
var DataSourceStaticCsvManager;
|
|
15261
|
+
(function (DataSourceStaticCsvManager) {
|
|
15262
|
+
var Manager = /** @class */ (function () {
|
|
15263
|
+
function Manager(params) {
|
|
15264
|
+
this.disposed = false;
|
|
15265
|
+
this.czmlDataInputs = [];
|
|
15266
|
+
// Array of callbacks to remove from the clock tick event.
|
|
15267
|
+
this.tickRemovals = [];
|
|
15268
|
+
var viewer = params.viewer, apiGetter = params.apiGetter, item = params.item;
|
|
15269
|
+
this.viewer = viewer;
|
|
15270
|
+
this.apiGetter = apiGetter;
|
|
15271
|
+
this.item = item;
|
|
15272
|
+
}
|
|
15273
|
+
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
15274
|
+
get: function () {
|
|
15275
|
+
return this.disposed;
|
|
15276
|
+
},
|
|
15277
|
+
enumerable: false,
|
|
15278
|
+
configurable: true
|
|
15279
|
+
});
|
|
15280
|
+
Object.defineProperty(Manager.prototype, "DataSources", {
|
|
15281
|
+
get: function () {
|
|
15282
|
+
return this.dataSource ? [this.dataSource] : [];
|
|
15283
|
+
},
|
|
15284
|
+
enumerable: false,
|
|
15285
|
+
configurable: true
|
|
15286
|
+
});
|
|
15287
|
+
Object.defineProperty(Manager.prototype, "CzmlDataInputs", {
|
|
15288
|
+
get: function () {
|
|
15289
|
+
return this.czmlDataInputs;
|
|
15290
|
+
},
|
|
15291
|
+
enumerable: false,
|
|
15292
|
+
configurable: true
|
|
15293
|
+
});
|
|
15294
|
+
Manager.prototype.Init = function () {
|
|
15295
|
+
var _this = this;
|
|
15296
|
+
var files = this.item.CSV;
|
|
15297
|
+
if (!files) {
|
|
15298
|
+
return;
|
|
15299
|
+
}
|
|
15300
|
+
if (!Array.isArray(files)) {
|
|
15301
|
+
files = [files];
|
|
15302
|
+
}
|
|
15303
|
+
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
15304
|
+
var api, e_1;
|
|
15305
|
+
var _a;
|
|
15306
|
+
return __generator(this, function (_b) {
|
|
15307
|
+
switch (_b.label) {
|
|
15308
|
+
case 0:
|
|
15309
|
+
api = this.apiGetter.getApi();
|
|
15310
|
+
return [4 /*yield*/, api.Loading];
|
|
15311
|
+
case 1:
|
|
15312
|
+
_b.sent();
|
|
15313
|
+
if (this.disposed) {
|
|
15314
|
+
return [2 /*return*/];
|
|
15315
|
+
}
|
|
15316
|
+
_b.label = 2;
|
|
15317
|
+
case 2:
|
|
15318
|
+
_b.trys.push([2, 4, , 5]);
|
|
15319
|
+
return [4 /*yield*/, this.renderMovingItem()];
|
|
15320
|
+
case 3:
|
|
15321
|
+
_b.sent();
|
|
15322
|
+
if (this.disposed) {
|
|
15323
|
+
if (!((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.isDestroyed()) && this.dataSource && this.viewer.dataSources.contains(this.dataSource)) {
|
|
15324
|
+
this.viewer.dataSources.remove(this.dataSource);
|
|
15325
|
+
this.dataSource = null;
|
|
15326
|
+
this.viewer.scene.requestRender();
|
|
15327
|
+
}
|
|
15328
|
+
if (this.tickRemovals.length) {
|
|
15329
|
+
this.tickRemovals.forEach(function (removal) { return removal(); });
|
|
15330
|
+
this.tickRemovals = [];
|
|
15331
|
+
}
|
|
15332
|
+
}
|
|
15333
|
+
return [3 /*break*/, 5];
|
|
15334
|
+
case 4:
|
|
15335
|
+
e_1 = _b.sent();
|
|
15336
|
+
console.error(e_1);
|
|
15337
|
+
return [3 /*break*/, 5];
|
|
15338
|
+
case 5: return [2 /*return*/];
|
|
15339
|
+
}
|
|
15340
|
+
});
|
|
15341
|
+
}); })();
|
|
15342
|
+
};
|
|
15343
|
+
/**
|
|
15344
|
+
* Takes a set of CSV files and renders the collection as a single moving item (truck, car, etc).
|
|
15345
|
+
* This will try to find which is the primary source of point data, and complimentary sources of attribute information.
|
|
15346
|
+
* @param files
|
|
15347
|
+
*/
|
|
15348
|
+
Manager.prototype.renderMovingItem = function () {
|
|
15349
|
+
var _a;
|
|
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, dateTime, vehicleId, czml, source, errorsInARow_1, removal_1;
|
|
15352
|
+
var _this = this;
|
|
15353
|
+
return __generator(this, function (_b) {
|
|
15354
|
+
switch (_b.label) {
|
|
15355
|
+
case 0:
|
|
15356
|
+
api = this.apiGetter.getApi();
|
|
15357
|
+
return [4 /*yield*/, api.Loading];
|
|
15358
|
+
case 1:
|
|
15359
|
+
_b.sent();
|
|
15360
|
+
fileStrings = [];
|
|
15361
|
+
files = this.item.CSV;
|
|
15362
|
+
i = 0;
|
|
15363
|
+
_b.label = 2;
|
|
15364
|
+
case 2:
|
|
15365
|
+
if (!(i < files.length)) return [3 /*break*/, 6];
|
|
15366
|
+
file = files[i];
|
|
15367
|
+
fileId = (_a = file === null || file === void 0 ? void 0 : file.ClientFile) === null || _a === void 0 ? void 0 : _a.ID;
|
|
15368
|
+
externalURL = file === null || file === void 0 ? void 0 : file.fileUrl;
|
|
15369
|
+
if (!fileId && !externalURL) {
|
|
15370
|
+
return [3 /*break*/, 5];
|
|
15371
|
+
}
|
|
15372
|
+
fileUrl = void 0;
|
|
15373
|
+
if (fileId) {
|
|
15374
|
+
fileUrl = ClientFile.GetUrl({
|
|
15375
|
+
api: api,
|
|
15376
|
+
fileId: fileId,
|
|
15377
|
+
viaCdn: true
|
|
15378
|
+
});
|
|
15379
|
+
}
|
|
15380
|
+
else if (externalURL) {
|
|
15381
|
+
fileUrl = externalURL;
|
|
15382
|
+
}
|
|
15383
|
+
return [4 /*yield*/, fetch(fileUrl)];
|
|
15384
|
+
case 3: return [4 /*yield*/, (_b.sent()).text()];
|
|
15385
|
+
case 4:
|
|
15386
|
+
fileStr = _b.sent();
|
|
15387
|
+
fileStrings.push(fileStr);
|
|
15388
|
+
if (this.disposed) {
|
|
15389
|
+
return [2 /*return*/];
|
|
15390
|
+
}
|
|
15391
|
+
if (file.vehicleFileId) {
|
|
15392
|
+
vehicleFileUrl = ClientFile.GetUrl({
|
|
15393
|
+
api: api,
|
|
15394
|
+
fileId: file.vehicleFileId,
|
|
15395
|
+
viaCdn: true
|
|
15396
|
+
});
|
|
15397
|
+
}
|
|
15398
|
+
if (file.lineColor) {
|
|
15399
|
+
lineColor = file.lineColor;
|
|
15400
|
+
}
|
|
15401
|
+
_b.label = 5;
|
|
15402
|
+
case 5:
|
|
15403
|
+
i++;
|
|
15404
|
+
return [3 /*break*/, 2];
|
|
15405
|
+
case 6:
|
|
15406
|
+
csvData = [];
|
|
15407
|
+
for (i = 0; i < fileStrings.length; i++) {
|
|
15408
|
+
delimiter = ",";
|
|
15409
|
+
fileStr = fileStrings[i];
|
|
15410
|
+
headers = fileStr.slice(0, fileStr.indexOf("\n")).split(delimiter).map(function (header) { return header.trim(); });
|
|
15411
|
+
rows = fileStr.slice(fileStr.indexOf("\n") + 1).split("\n");
|
|
15412
|
+
rowsArr = [];
|
|
15413
|
+
for (j = 0; j < rows.length; j++) {
|
|
15414
|
+
row = rows[j];
|
|
15415
|
+
rowArr = row.split(delimiter).map(function (item) { return item.trim(); });
|
|
15416
|
+
if (rowArr.length === 1 && rowArr[0] === "") {
|
|
15417
|
+
continue;
|
|
15418
|
+
}
|
|
15419
|
+
rowsArr.push(rowArr);
|
|
15420
|
+
}
|
|
15421
|
+
csvData.push({
|
|
15422
|
+
headers: headers,
|
|
15423
|
+
rows: rowsArr
|
|
15424
|
+
});
|
|
15425
|
+
}
|
|
15426
|
+
primary = csvData[0];
|
|
15427
|
+
pHeaders = primary.headers;
|
|
15428
|
+
pLatIndex = pHeaders.findIndex(function (x) { return x.toLowerCase().includes("lat"); });
|
|
15429
|
+
pLonIndex = pHeaders.findIndex(function (x) { return x.toLowerCase().includes("lon"); });
|
|
15430
|
+
pDateTimeIndex = pHeaders.findIndex(function (x) { return x.toLowerCase().includes("date"); });
|
|
15431
|
+
// Ensure values are correct data types.
|
|
15432
|
+
for (i = 0; i < primary.rows.length; i++) {
|
|
15433
|
+
row = primary.rows[i];
|
|
15434
|
+
lat = row[pLatIndex];
|
|
15435
|
+
if (typeof lat == "string") {
|
|
15436
|
+
row[pLatIndex] = parseFloat(lat);
|
|
15437
|
+
}
|
|
15438
|
+
lon = row[pLonIndex];
|
|
15439
|
+
if (typeof lon == "string") {
|
|
15440
|
+
row[pLonIndex] = parseFloat(lon);
|
|
15441
|
+
}
|
|
15442
|
+
dateTime = new Date(row[pDateTimeIndex]);
|
|
15443
|
+
row[pDateTimeIndex] = dateTime.toISOString();
|
|
15444
|
+
}
|
|
15445
|
+
// Sort by date.
|
|
15446
|
+
primary.rows.sort(function (a, b) {
|
|
15447
|
+
var aDate = new Date(a[pDateTimeIndex]);
|
|
15448
|
+
var bDate = new Date(b[pDateTimeIndex]);
|
|
15449
|
+
return aDate.getTime() - bDate.getTime();
|
|
15450
|
+
});
|
|
15451
|
+
vehicleId = ObjectUtils.UId();
|
|
15452
|
+
czml = createJourneyCzml(vehicleId, vehicleFileUrl, lineColor, primary);
|
|
15453
|
+
this.czmlDataInputs.push(czml);
|
|
15454
|
+
return [4 /*yield*/, this.viewer.dataSources.add(CzmlDataSource.load(czml))];
|
|
15455
|
+
case 7:
|
|
15456
|
+
source = _b.sent();
|
|
15457
|
+
this.dataSource = source;
|
|
15458
|
+
// Listen to update ticks and ensure orientation of moving item is correct.
|
|
15459
|
+
if (this.viewer.clock) {
|
|
15460
|
+
errorsInARow_1 = 0;
|
|
15461
|
+
removal_1 = this.viewer.clock.onTick.addEventListener(function () {
|
|
15462
|
+
var vehicle = source.entities.getById(vehicleId);
|
|
15463
|
+
if (vehicle) {
|
|
15464
|
+
try {
|
|
15465
|
+
updateOrientation(_this.viewer, vehicle);
|
|
15466
|
+
errorsInARow_1 = 0;
|
|
15467
|
+
}
|
|
15468
|
+
catch (e) {
|
|
15469
|
+
console.error(e);
|
|
15470
|
+
errorsInARow_1 += 1;
|
|
15471
|
+
if (errorsInARow_1 >= 3) {
|
|
15472
|
+
removal_1();
|
|
15473
|
+
}
|
|
15474
|
+
}
|
|
15475
|
+
_this.viewer.scene.requestRender();
|
|
15476
|
+
}
|
|
15477
|
+
});
|
|
15478
|
+
this.tickRemovals.push(removal_1);
|
|
15479
|
+
}
|
|
15480
|
+
return [2 /*return*/];
|
|
15481
|
+
}
|
|
15482
|
+
});
|
|
15483
|
+
});
|
|
15484
|
+
};
|
|
15485
|
+
Manager.prototype.Dispose = function () {
|
|
15486
|
+
var _a;
|
|
15487
|
+
if (this.disposed) {
|
|
15488
|
+
return;
|
|
15489
|
+
}
|
|
15490
|
+
this.disposed = true;
|
|
15491
|
+
if (!((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.isDestroyed())) {
|
|
15492
|
+
if (this.dataSource && this.viewer.dataSources.contains(this.dataSource)) {
|
|
15493
|
+
this.viewer.dataSources.remove(this.dataSource);
|
|
15494
|
+
this.dataSource = null;
|
|
15495
|
+
this.viewer.scene.requestRender();
|
|
15496
|
+
}
|
|
15497
|
+
}
|
|
15498
|
+
if (this.tickRemovals.length) {
|
|
15499
|
+
this.tickRemovals.forEach(function (removal) { return removal(); });
|
|
15500
|
+
this.tickRemovals = [];
|
|
15501
|
+
}
|
|
15502
|
+
};
|
|
15503
|
+
Manager.prototype.ReRender = function (params) {
|
|
15504
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
15505
|
+
var entityIds, force;
|
|
15506
|
+
return __generator(this, function (_a) {
|
|
15507
|
+
entityIds = params.entityIds, force = params.force;
|
|
15508
|
+
return [2 /*return*/];
|
|
15509
|
+
});
|
|
15510
|
+
});
|
|
15511
|
+
};
|
|
15512
|
+
return Manager;
|
|
15513
|
+
}());
|
|
15514
|
+
DataSourceStaticCsvManager.Manager = Manager;
|
|
15515
|
+
})(DataSourceStaticCsvManager || (DataSourceStaticCsvManager = {}));
|
|
15516
|
+
/**
|
|
15517
|
+
* Creates a CZML object from the CSV data.
|
|
15518
|
+
* This shows a journey taken by a moving object and alarms detected along the way.
|
|
15519
|
+
* @param vehicleId
|
|
15520
|
+
* @param vehicleFileUrl
|
|
15521
|
+
* @param lineColor
|
|
15522
|
+
* @param data
|
|
15523
|
+
* @returns
|
|
15524
|
+
*/
|
|
15525
|
+
function createJourneyCzml(vehicleId, vehicleFileUrl, lineColor, data) {
|
|
15526
|
+
var headers = data.headers;
|
|
15527
|
+
var rows = data.rows;
|
|
15528
|
+
var latIndex = headers.findIndex(function (x) { return x.toLowerCase().includes("lat"); });
|
|
15529
|
+
var lonIndex = headers.findIndex(function (x) { return x.toLowerCase().includes("lon"); });
|
|
15530
|
+
var dateTimeIndex = headers.findIndex(function (x) { return x.toLowerCase().includes("date"); });
|
|
15531
|
+
var alarmIndex = headers.findIndex(function (x) { return x.toLowerCase().includes("alarm"); });
|
|
15532
|
+
var czml = [
|
|
15533
|
+
{
|
|
15534
|
+
"id": "document",
|
|
15535
|
+
"name": "Journey",
|
|
15536
|
+
"version": "1.0",
|
|
15537
|
+
"clock": {
|
|
15538
|
+
"interval": rows[0][dateTimeIndex] + "/" + rows[rows.length - 1][dateTimeIndex],
|
|
15539
|
+
"currentTime": rows[0][dateTimeIndex],
|
|
15540
|
+
"multiplier": 10,
|
|
15541
|
+
"range": "LOOP_STOP",
|
|
15542
|
+
"step": "SYSTEM_CLOCK_MULTIPLIER"
|
|
15543
|
+
}
|
|
15544
|
+
},
|
|
15545
|
+
];
|
|
15546
|
+
// Create a polyline for the full path.
|
|
15547
|
+
var roadPositions = rows.map(function (row) { return [
|
|
15548
|
+
Number(row[lonIndex]),
|
|
15549
|
+
Number(row[latIndex]),
|
|
15550
|
+
0
|
|
15551
|
+
]; }).flat();
|
|
15552
|
+
czml.push({
|
|
15553
|
+
"id": ObjectUtils.UId(),
|
|
15554
|
+
"name": "Path",
|
|
15555
|
+
"polyline": {
|
|
15556
|
+
"positions": {
|
|
15557
|
+
"cartographicDegrees": roadPositions
|
|
15558
|
+
},
|
|
15559
|
+
"material": {
|
|
15560
|
+
"solidColor": {
|
|
15561
|
+
"color": {
|
|
15562
|
+
"rgba": lineColor ? Color.fromCssColorString(lineColor).toBytes() : [0, 255, 0, 100]
|
|
15563
|
+
}
|
|
15564
|
+
}
|
|
15565
|
+
},
|
|
15566
|
+
"width": 5
|
|
15567
|
+
}
|
|
15568
|
+
});
|
|
15569
|
+
// Add points for the alarms.
|
|
15570
|
+
rows.filter(function (row) { return row[alarmIndex]; }).forEach(function (row, index) {
|
|
15571
|
+
czml.push({
|
|
15572
|
+
"id": ObjectUtils.UId(),
|
|
15573
|
+
"name": "Alarm",
|
|
15574
|
+
"position": {
|
|
15575
|
+
"cartographicDegrees": [
|
|
15576
|
+
Number(row[lonIndex]),
|
|
15577
|
+
Number(row[latIndex]),
|
|
15578
|
+
0
|
|
15579
|
+
]
|
|
15580
|
+
},
|
|
15581
|
+
"point": {
|
|
15582
|
+
"pixelSize": 10,
|
|
15583
|
+
"color": {
|
|
15584
|
+
"rgba": [255, 0, 0, 255]
|
|
15585
|
+
}
|
|
15586
|
+
},
|
|
15587
|
+
"label": {
|
|
15588
|
+
"text": row[alarmIndex],
|
|
15589
|
+
"show": true,
|
|
15590
|
+
"font": "11pt monospace",
|
|
15591
|
+
"style": "FILL",
|
|
15592
|
+
"outlineColor": {
|
|
15593
|
+
"rgba": [0, 0, 0, 255]
|
|
15594
|
+
},
|
|
15595
|
+
"outlineWidth": 2,
|
|
15596
|
+
"pixelOffset": {
|
|
15597
|
+
"cartesian2": [0, -16]
|
|
15598
|
+
}
|
|
15599
|
+
}
|
|
15600
|
+
});
|
|
15601
|
+
});
|
|
15602
|
+
// Add animated point for the moving item.
|
|
15603
|
+
czml.push({
|
|
15604
|
+
"id": vehicleId,
|
|
15605
|
+
"name": "Vehicle",
|
|
15606
|
+
"availability": rows[0][dateTimeIndex] + "/" + rows[rows.length - 1][dateTimeIndex],
|
|
15607
|
+
"model": vehicleFileUrl ? {
|
|
15608
|
+
"gltf": vehicleFileUrl,
|
|
15609
|
+
"scale": 5
|
|
15610
|
+
} : undefined,
|
|
15611
|
+
"point": !vehicleFileUrl ? {
|
|
15612
|
+
"pixelSize": 20,
|
|
15613
|
+
"color": {
|
|
15614
|
+
"rgba": [0, 0, 255, 255]
|
|
15615
|
+
}
|
|
15616
|
+
} : undefined,
|
|
15617
|
+
"orientation": {
|
|
15618
|
+
"velocityReference": "#vehicle#position"
|
|
15619
|
+
},
|
|
15620
|
+
"position": {
|
|
15621
|
+
"epoch": rows[0][dateTimeIndex],
|
|
15622
|
+
"cartographicDegrees": rows.map(function (row, index) { return [
|
|
15623
|
+
index,
|
|
15624
|
+
Number(row[lonIndex]),
|
|
15625
|
+
Number(row[latIndex]),
|
|
15626
|
+
0
|
|
15627
|
+
]; }).flat()
|
|
15628
|
+
}
|
|
15629
|
+
});
|
|
15630
|
+
return czml;
|
|
15631
|
+
}
|
|
15632
|
+
/**
|
|
15633
|
+
* Updates the orientation of the moving item.
|
|
15634
|
+
* This is done by calculating the direction of travel between the current and previous positions.
|
|
15635
|
+
* @param viewer
|
|
15636
|
+
* @param vehicleEntity
|
|
15637
|
+
* @returns
|
|
15638
|
+
*/
|
|
15639
|
+
function updateOrientation(viewer, vehicleEntity) {
|
|
15640
|
+
if (!vehicleEntity || !vehicleEntity.position) {
|
|
15641
|
+
return;
|
|
15642
|
+
}
|
|
15643
|
+
var positionProperty = vehicleEntity.position;
|
|
15644
|
+
var currentTime = viewer.clock.currentTime;
|
|
15645
|
+
var previousTime = JulianDate.addSeconds(currentTime, -1, new JulianDate());
|
|
15646
|
+
var currentPosition = positionProperty.getValue(currentTime);
|
|
15647
|
+
var previousPosition = positionProperty.getValue(previousTime);
|
|
15648
|
+
if (currentPosition && previousPosition && !Cartesian3.equals(currentPosition, previousPosition)) {
|
|
15649
|
+
var direction = Cartesian3.subtract(currentPosition, previousPosition, new Cartesian3());
|
|
15650
|
+
Cartesian3.normalize(direction, direction);
|
|
15651
|
+
var rotationMatrix = Transforms.rotationMatrixFromPositionVelocity(previousPosition, direction);
|
|
15652
|
+
vehicleEntity.orientation = Quaternion.fromRotationMatrix(rotationMatrix);
|
|
15653
|
+
}
|
|
15654
|
+
}
|
|
15655
|
+
|
|
15249
15656
|
/**
|
|
15250
15657
|
* Utility to keep track of enabled menu items within a Cesium viewer.
|
|
15251
15658
|
*/
|
|
@@ -15484,6 +15891,13 @@ var MenuItemManager;
|
|
|
15484
15891
|
item: params.item
|
|
15485
15892
|
});
|
|
15486
15893
|
break;
|
|
15894
|
+
case MenuItem.EType.Csv:
|
|
15895
|
+
rItem.renderManager = new DataSourceStaticCsvManager.Manager({
|
|
15896
|
+
viewer: this.viewer,
|
|
15897
|
+
apiGetter: params.apiGetter,
|
|
15898
|
+
item: params.item
|
|
15899
|
+
});
|
|
15900
|
+
break;
|
|
15487
15901
|
case MenuItem.EType.IonTileset:
|
|
15488
15902
|
case MenuItem.EType.ArbTileset:
|
|
15489
15903
|
rItem.renderManager = new TilesetArbRenderManager.Manager({
|
|
@@ -16173,9 +16587,11 @@ var Draw3dPolyline = /** @class */ (function () {
|
|
|
16173
16587
|
this.hideLine = false;
|
|
16174
16588
|
this.perPositionHeight = false;
|
|
16175
16589
|
this.smoothing = false;
|
|
16590
|
+
this.maxPoints = -1;
|
|
16176
16591
|
this.viewer = params.viewer;
|
|
16177
16592
|
this.onFinish = params.onFinish;
|
|
16178
16593
|
this.onChange = params.onChange;
|
|
16594
|
+
this.maxPoints = isNaN(+params.maxPoints) ? -1 : +params.maxPoints;
|
|
16179
16595
|
if (params.perPositionHeight) {
|
|
16180
16596
|
this.perPositionHeight = params.perPositionHeight;
|
|
16181
16597
|
}
|
|
@@ -16192,6 +16608,13 @@ var Draw3dPolyline = /** @class */ (function () {
|
|
|
16192
16608
|
this.smoothing = params.smoothing;
|
|
16193
16609
|
}
|
|
16194
16610
|
}
|
|
16611
|
+
Object.defineProperty(Draw3dPolyline.prototype, "hasReachedMax", {
|
|
16612
|
+
get: function () {
|
|
16613
|
+
return this.maxPoints > 0 && this.points.length >= this.maxPoints;
|
|
16614
|
+
},
|
|
16615
|
+
enumerable: false,
|
|
16616
|
+
configurable: true
|
|
16617
|
+
});
|
|
16195
16618
|
Draw3dPolyline.prototype.Start = function () {
|
|
16196
16619
|
this.createEntity();
|
|
16197
16620
|
this.points.forEach(function (x) {
|
|
@@ -16277,7 +16700,7 @@ var Draw3dPolyline = /** @class */ (function () {
|
|
|
16277
16700
|
};
|
|
16278
16701
|
Draw3dPolyline.prototype.onMouseClick = function (pos2d) {
|
|
16279
16702
|
var _a;
|
|
16280
|
-
if (!this.draggingPoint) {
|
|
16703
|
+
if (!this.draggingPoint && !this.hasReachedMax) {
|
|
16281
16704
|
var pos3d = DrawingUtils.GetAccuratePosition(this.viewer, pos2d);
|
|
16282
16705
|
if (Cartes.ValidateCartes3(pos3d)) {
|
|
16283
16706
|
var positions = this.GetPositions();
|
|
@@ -21681,7 +22104,7 @@ var ViewRenderEngine;
|
|
|
21681
22104
|
ViewRenderEngine.Render = Render;
|
|
21682
22105
|
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
21683
22106
|
|
|
21684
|
-
var VERSION = "3.
|
|
22107
|
+
var VERSION = "3.6.1";
|
|
21685
22108
|
|
|
21686
22109
|
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 };
|
|
21687
22110
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|