bruce-cesium 3.2.6 → 3.2.8
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 +402 -298
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +399 -295
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +5 -3
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +187 -86
- package/dist/lib/utils/entity-utils.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
|
@@ -484,212 +484,6 @@
|
|
|
484
484
|
DrawingUtils.RaisePos3d = RaisePos3d;
|
|
485
485
|
})(exports.DrawingUtils || (exports.DrawingUtils = {}));
|
|
486
486
|
|
|
487
|
-
var CESIUM_INSPECTOR_KEY = "_nextspace_inspector";
|
|
488
|
-
(function (ViewUtils) {
|
|
489
|
-
function GatherLegacyMapTiles(params) {
|
|
490
|
-
var viewer = params.viewer;
|
|
491
|
-
var collection = viewer.imageryLayers;
|
|
492
|
-
var tiles = [];
|
|
493
|
-
for (var i = 0; i < collection.length; i++) {
|
|
494
|
-
var layer = collection.get(i);
|
|
495
|
-
if (layer._bName) {
|
|
496
|
-
tiles.push({
|
|
497
|
-
alpha: layer.alpha,
|
|
498
|
-
brightness: layer.brightness,
|
|
499
|
-
contrast: layer.contrast,
|
|
500
|
-
hue: layer.hue,
|
|
501
|
-
saturation: layer.saturation,
|
|
502
|
-
gamma: layer.gamma,
|
|
503
|
-
title: layer._bName,
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return {
|
|
508
|
-
imagery: tiles.reverse()
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
ViewUtils.GatherLegacyMapTiles = GatherLegacyMapTiles;
|
|
512
|
-
function GatherLegacyTerrainTile(params) {
|
|
513
|
-
var viewer = params.viewer;
|
|
514
|
-
var enabled = viewer.terrainProvider;
|
|
515
|
-
if (enabled === null || enabled === void 0 ? void 0 : enabled._bName) {
|
|
516
|
-
return {
|
|
517
|
-
terrain: enabled._bName
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
return {
|
|
521
|
-
terrain: "flatterrain"
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
ViewUtils.GatherLegacyTerrainTile = GatherLegacyTerrainTile;
|
|
525
|
-
function GatherMapTiles(params) {
|
|
526
|
-
var viewer = params.viewer;
|
|
527
|
-
var imagery = viewer.imageryLayers;
|
|
528
|
-
var tiles = [];
|
|
529
|
-
var _loop_1 = function (i) {
|
|
530
|
-
var provider = imagery.get(i);
|
|
531
|
-
if (provider._bMeta) {
|
|
532
|
-
var idCombo_1 = provider._bMeta.accountId + provider._bMeta.tilesetId;
|
|
533
|
-
if (!tiles.find(function (x) { return x.accountId + x.tilesetId === idCombo_1; })) {
|
|
534
|
-
tiles.push({
|
|
535
|
-
accountId: provider._bMeta.accountId,
|
|
536
|
-
tilesetId: provider._bMeta.tilesetId,
|
|
537
|
-
alpha: provider.alpha,
|
|
538
|
-
brightness: provider.brightness,
|
|
539
|
-
contrast: provider.contrast,
|
|
540
|
-
hue: provider.hue,
|
|
541
|
-
saturation: provider.saturation,
|
|
542
|
-
gamma: provider.gamma
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
for (var i = 0; i < imagery.length; i++) {
|
|
548
|
-
_loop_1(i);
|
|
549
|
-
}
|
|
550
|
-
return {
|
|
551
|
-
imagery: tiles
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
ViewUtils.GatherMapTiles = GatherMapTiles;
|
|
555
|
-
function GatherTerrainTile(params) {
|
|
556
|
-
var viewer = params.viewer;
|
|
557
|
-
var provider = viewer.terrainProvider;
|
|
558
|
-
if (provider === null || provider === void 0 ? void 0 : provider._bMeta) {
|
|
559
|
-
return {
|
|
560
|
-
terrain: {
|
|
561
|
-
accountId: provider._bMeta.accountId,
|
|
562
|
-
tilesetId: provider._bMeta.tilesetId,
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
else if (provider instanceof Cesium.EllipsoidTerrainProvider) {
|
|
567
|
-
return {
|
|
568
|
-
terrain: {
|
|
569
|
-
tilesetId: bruceModels.ProjectViewTile.EDefaultTerrain.FlatTerrain,
|
|
570
|
-
accountId: null
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
return null;
|
|
575
|
-
}
|
|
576
|
-
ViewUtils.GatherTerrainTile = GatherTerrainTile;
|
|
577
|
-
function SetTerrainWireframeStatus(params) {
|
|
578
|
-
if (!params.viewer[CESIUM_INSPECTOR_KEY]) {
|
|
579
|
-
var InspectorClass = Cesium.CesiumInspector;
|
|
580
|
-
if (InspectorClass) {
|
|
581
|
-
var inspector = new InspectorClass(document.createElement("div"), params.viewer.scene);
|
|
582
|
-
inspector.container.style.display = "none";
|
|
583
|
-
params.viewer[CESIUM_INSPECTOR_KEY] = inspector;
|
|
584
|
-
params.viewer.scene.requestRender();
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
if (params.viewer[CESIUM_INSPECTOR_KEY]) {
|
|
588
|
-
params.viewer[CESIUM_INSPECTOR_KEY].viewModel.wireframe = params.status;
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
ViewUtils.SetTerrainWireframeStatus = SetTerrainWireframeStatus;
|
|
592
|
-
function GetTerrainWireframeStatus(params) {
|
|
593
|
-
var _a, _b;
|
|
594
|
-
if (!params.viewer[CESIUM_INSPECTOR_KEY]) {
|
|
595
|
-
return false;
|
|
596
|
-
}
|
|
597
|
-
return (_b = (_a = params.viewer[CESIUM_INSPECTOR_KEY]) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.wireframe;
|
|
598
|
-
}
|
|
599
|
-
ViewUtils.GetTerrainWireframeStatus = GetTerrainWireframeStatus;
|
|
600
|
-
/**
|
|
601
|
-
* Changes between perspective and orthographic view.
|
|
602
|
-
* When Cesium stops being bad at picking positions in 2d mode we'll use the flat earth mode instead.
|
|
603
|
-
* @param params
|
|
604
|
-
*/
|
|
605
|
-
function Set2dStatus(params) {
|
|
606
|
-
var viewer = params.viewer, is2d = params.status, moveCamera = params.moveCamera;
|
|
607
|
-
var curLens2d = viewer.camera.frustum instanceof Cesium.OrthographicFrustum;
|
|
608
|
-
if (curLens2d && !is2d) {
|
|
609
|
-
viewer.camera.switchToPerspectiveFrustum();
|
|
610
|
-
viewer.scene.screenSpaceCameraController.enableTilt = true;
|
|
611
|
-
viewer.scene.requestRender();
|
|
612
|
-
}
|
|
613
|
-
else if (!curLens2d && is2d) {
|
|
614
|
-
viewer.camera.switchToOrthographicFrustum();
|
|
615
|
-
viewer.scene.screenSpaceCameraController.enableTilt = false;
|
|
616
|
-
if (moveCamera != false) {
|
|
617
|
-
try {
|
|
618
|
-
// Face camera downwards to make it look 2d.
|
|
619
|
-
// We want to try make it look at the center-point of the current view.
|
|
620
|
-
// If center cannot be calculated then we'll simply raise the camera and face it downwards.
|
|
621
|
-
var scene = viewer.scene;
|
|
622
|
-
var windowPosition = new Cesium.Cartesian2(scene.canvas.clientWidth / 2, scene.canvas.clientHeight / 2);
|
|
623
|
-
var ray = viewer.camera.getPickRay(windowPosition);
|
|
624
|
-
var intersection = scene.globe.pick(ray, scene);
|
|
625
|
-
var center = void 0;
|
|
626
|
-
if (Cesium.defined(intersection)) {
|
|
627
|
-
center = Cesium.Cartographic.fromCartesian(intersection);
|
|
628
|
-
}
|
|
629
|
-
// Use current camera position if we can't calculate the center.
|
|
630
|
-
else {
|
|
631
|
-
center = Cesium.Cartographic.fromCartesian(viewer.camera.position);
|
|
632
|
-
center.height = 0;
|
|
633
|
-
}
|
|
634
|
-
center.height = viewer.camera.positionCartographic.height + 100;
|
|
635
|
-
viewer.camera.setView({
|
|
636
|
-
destination: Cesium.Cartographic.toCartesian(center),
|
|
637
|
-
orientation: {
|
|
638
|
-
heading: 0.0,
|
|
639
|
-
pitch: Cesium.Math.toRadians(-90.0),
|
|
640
|
-
roll: 0.0
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
catch (e) {
|
|
645
|
-
console.error(e);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
viewer.scene.requestRender();
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
ViewUtils.Set2dStatus = Set2dStatus;
|
|
652
|
-
function Get2dStatus(params) {
|
|
653
|
-
var viewer = params.viewer;
|
|
654
|
-
return viewer.camera.frustum instanceof Cesium.OrthographicFrustum;
|
|
655
|
-
}
|
|
656
|
-
ViewUtils.Get2dStatus = Get2dStatus;
|
|
657
|
-
function SetLockedCameraStatus(params) {
|
|
658
|
-
var viewer = params.viewer, status = params.status;
|
|
659
|
-
var scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
|
|
660
|
-
if (!scene) {
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
if (status) {
|
|
664
|
-
scene.screenSpaceCameraController.enableInputs = false;
|
|
665
|
-
scene.screenSpaceCameraController.enableTranslate = false;
|
|
666
|
-
scene.screenSpaceCameraController.enableZoom = false;
|
|
667
|
-
scene.screenSpaceCameraController.enableRotate = false;
|
|
668
|
-
scene.screenSpaceCameraController.enableTilt = false;
|
|
669
|
-
}
|
|
670
|
-
else {
|
|
671
|
-
scene.screenSpaceCameraController.enableInputs = true;
|
|
672
|
-
scene.screenSpaceCameraController.enableTranslate = true;
|
|
673
|
-
scene.screenSpaceCameraController.enableZoom = true;
|
|
674
|
-
scene.screenSpaceCameraController.enableRotate = true;
|
|
675
|
-
if (!ViewUtils.Get2dStatus({ viewer: viewer })) {
|
|
676
|
-
scene.screenSpaceCameraController.enableTilt = true;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
viewer.scene.requestRender();
|
|
680
|
-
}
|
|
681
|
-
ViewUtils.SetLockedCameraStatus = SetLockedCameraStatus;
|
|
682
|
-
function GetLockedCameraStatus(params) {
|
|
683
|
-
var _a;
|
|
684
|
-
var scene = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a.scene;
|
|
685
|
-
if (!scene) {
|
|
686
|
-
return false;
|
|
687
|
-
}
|
|
688
|
-
return !scene.screenSpaceCameraController.enableTranslate;
|
|
689
|
-
}
|
|
690
|
-
ViewUtils.GetLockedCameraStatus = GetLockedCameraStatus;
|
|
691
|
-
})(exports.ViewUtils || (exports.ViewUtils = {}));
|
|
692
|
-
|
|
693
487
|
/**
|
|
694
488
|
* Returns if a given visual can be styled by this utility.
|
|
695
489
|
* @param viewer
|
|
@@ -812,6 +606,11 @@
|
|
|
812
606
|
if (!color) {
|
|
813
607
|
if (key == "default") {
|
|
814
608
|
color = calculateCurColor(viewer, graphic);
|
|
609
|
+
// We'll only store the default color.
|
|
610
|
+
// Rest can be retrieved every time to get the latest setting value.
|
|
611
|
+
if (color) {
|
|
612
|
+
storeColor(viewer, key, color, graphic);
|
|
613
|
+
}
|
|
815
614
|
}
|
|
816
615
|
else if (key == "select") {
|
|
817
616
|
color = _selectColor;
|
|
@@ -819,9 +618,6 @@
|
|
|
819
618
|
else if (key == "highlight") {
|
|
820
619
|
color = _highlightColor;
|
|
821
620
|
}
|
|
822
|
-
if (color) {
|
|
823
|
-
storeColor(viewer, key, color, graphic);
|
|
824
|
-
}
|
|
825
621
|
}
|
|
826
622
|
return color;
|
|
827
623
|
}
|
|
@@ -1308,6 +1104,81 @@
|
|
|
1308
1104
|
}
|
|
1309
1105
|
return obj;
|
|
1310
1106
|
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Returns location information from a given tileset feature.
|
|
1109
|
+
* This works well with OSM.
|
|
1110
|
+
* @param feature
|
|
1111
|
+
* @returns
|
|
1112
|
+
*/
|
|
1113
|
+
var getLocationFromFeature = function (feature) {
|
|
1114
|
+
var _a;
|
|
1115
|
+
var prepareLatitude = function (propName, value) {
|
|
1116
|
+
value = +value;
|
|
1117
|
+
// Check to see if the lat is in valid degrees, if not, try convert from radians.
|
|
1118
|
+
if (value < -90 || value > 90) {
|
|
1119
|
+
value = Cesium.Math.toDegrees(value);
|
|
1120
|
+
}
|
|
1121
|
+
// If the value is really small we'll assume it's in radians.
|
|
1122
|
+
// "cesium#blah" properties are always in degrees. No need to check.
|
|
1123
|
+
if (value < 0.9 && !propName.startsWith("cesium#")) {
|
|
1124
|
+
value = Cesium.Math.toDegrees(value);
|
|
1125
|
+
}
|
|
1126
|
+
return value;
|
|
1127
|
+
};
|
|
1128
|
+
var prepareLongitude = function (propName, value) {
|
|
1129
|
+
value = +value;
|
|
1130
|
+
// Check to see if the lon is in valid degrees, if not, try convert from radians.
|
|
1131
|
+
if (value < -180 || value > 180) {
|
|
1132
|
+
value = Cesium.Math.toDegrees(value);
|
|
1133
|
+
}
|
|
1134
|
+
// If the value is really small we'll assume it's in radians.
|
|
1135
|
+
// "cesium#blah" properties are always in degrees. No need to check.
|
|
1136
|
+
if (value < 0.9 && !propName.startsWith("cesium#")) {
|
|
1137
|
+
value = Cesium.Math.toDegrees(value);
|
|
1138
|
+
}
|
|
1139
|
+
return value;
|
|
1140
|
+
};
|
|
1141
|
+
var result = {
|
|
1142
|
+
location: {
|
|
1143
|
+
latitude: null,
|
|
1144
|
+
longitude: null,
|
|
1145
|
+
altitude: 0
|
|
1146
|
+
},
|
|
1147
|
+
isClamped: true,
|
|
1148
|
+
radius: null
|
|
1149
|
+
};
|
|
1150
|
+
// 'getPropertyIds' = new version of Cesium, 'getPropertyNames' = old version.
|
|
1151
|
+
var featureAny = feature;
|
|
1152
|
+
var propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
|
|
1153
|
+
propertyNames = [].concat(propertyNames);
|
|
1154
|
+
for (var i = 0; i < propertyNames.length; i++) {
|
|
1155
|
+
var propName = propertyNames[i];
|
|
1156
|
+
var propLower = propName.toLowerCase();
|
|
1157
|
+
if (propLower.includes("latitude")) {
|
|
1158
|
+
result.location.latitude = prepareLatitude(propName, feature.getProperty(propName));
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
if (propLower.includes("longitude")) {
|
|
1162
|
+
result.location.longitude = prepareLongitude(propName, feature.getProperty(propName));
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
if (propLower.includes("height")) {
|
|
1166
|
+
result.radius = +feature.getProperty(propName);
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
if (propLower.includes("terrain")) {
|
|
1170
|
+
result.location.altitude = +feature.getProperty(propName);
|
|
1171
|
+
if (!result.location.altitude) {
|
|
1172
|
+
result.location.altitude = 0;
|
|
1173
|
+
}
|
|
1174
|
+
continue;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
if (result.location.latitude == null || result.location.longitude == null) {
|
|
1178
|
+
return null;
|
|
1179
|
+
}
|
|
1180
|
+
return result;
|
|
1181
|
+
};
|
|
1311
1182
|
(function (EntityUtils) {
|
|
1312
1183
|
/**
|
|
1313
1184
|
* Returns the location for given entity or entities.
|
|
@@ -1316,12 +1187,11 @@
|
|
|
1316
1187
|
* @param params
|
|
1317
1188
|
*/
|
|
1318
1189
|
function GetLocation(params) {
|
|
1319
|
-
var _a;
|
|
1320
1190
|
return __awaiter(this, void 0, void 0, function () {
|
|
1321
|
-
var api, viewer, samples, visualRegister, minimumAlt, paddingAlt, MAX_DISTANCE_BETWEEN_SAMPLES, MAX_TERRAIN_SAMPLES, terrainSamples, MAX_API_CALLS, apiCalls, MAX_VALID_SAMPLES, validSamples,
|
|
1191
|
+
var api, viewer, samples, visualRegister, minimumAlt, paddingAlt, MAX_DISTANCE_BETWEEN_SAMPLES, MAX_TERRAIN_SAMPLES, terrainSamples, MAX_API_CALLS, apiCalls, MAX_VALID_SAMPLES, validSamples, data, spheres, processPosHeight, ensureHeightRefs, getEntityPositions, allPosses, i, sample, samplePosses, valid, j, samplePos, k, allPos, distance, rect, factor, marginX, marginY, carto, i, pos, radius, sphere, allPointSphere, rectSphere, combinedSphere;
|
|
1322
1192
|
var _this = this;
|
|
1323
|
-
return __generator(this, function (
|
|
1324
|
-
switch (
|
|
1193
|
+
return __generator(this, function (_a) {
|
|
1194
|
+
switch (_a.label) {
|
|
1325
1195
|
case 0:
|
|
1326
1196
|
api = params.api, viewer = params.viewer, samples = params.samples, visualRegister = params.visualRegister, minimumAlt = params.minimumAlt, paddingAlt = params.paddingAlt;
|
|
1327
1197
|
if (!paddingAlt) {
|
|
@@ -1334,10 +1204,6 @@
|
|
|
1334
1204
|
apiCalls = 0;
|
|
1335
1205
|
MAX_VALID_SAMPLES = 20;
|
|
1336
1206
|
validSamples = 0;
|
|
1337
|
-
MIN_RECT_DIAGONAL_LENGTH = isNaN(minimumAlt) || minimumAlt == null ? 0 : minimumAlt * 10;
|
|
1338
|
-
if (MIN_RECT_DIAGONAL_LENGTH < 1500) {
|
|
1339
|
-
MIN_RECT_DIAGONAL_LENGTH = 1500;
|
|
1340
|
-
}
|
|
1341
1207
|
data = {
|
|
1342
1208
|
pos3d: null,
|
|
1343
1209
|
rectangle: null,
|
|
@@ -1435,7 +1301,7 @@
|
|
|
1435
1301
|
case 0:
|
|
1436
1302
|
entityId = sample.entityId, entity = sample.entity, tileset = sample.tileset, tilesetId = sample.tilesetId;
|
|
1437
1303
|
evaluateRendered = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1438
|
-
var rego, posses,
|
|
1304
|
+
var rego, posses, parts, i, part, visualHeightRef, hierarchy, hPosses, hPossesSample, step, i_1, pPosses, pPossesSample, step, i_2, pPosses, pPossesSample, step, i_3, pos3d_1, toAdjust, modelExt, sphere, data_1, pos3d_2, toAdjust, sphere;
|
|
1439
1305
|
return __generator(this, function (_a) {
|
|
1440
1306
|
switch (_a.label) {
|
|
1441
1307
|
case 0:
|
|
@@ -1443,102 +1309,130 @@
|
|
|
1443
1309
|
entityId: sample.entityId,
|
|
1444
1310
|
}) : null;
|
|
1445
1311
|
posses = [];
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
return [3 /*break*/, 12];
|
|
1312
|
+
parts = GatherEntity({
|
|
1313
|
+
entity: rego === null || rego === void 0 ? void 0 : rego.visual,
|
|
1314
|
+
});
|
|
1315
|
+
i = 0;
|
|
1316
|
+
_a.label = 1;
|
|
1452
1317
|
case 1:
|
|
1453
|
-
if (!
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1318
|
+
if (!(i < parts.length)) return [3 /*break*/, 19];
|
|
1319
|
+
part = parts[i];
|
|
1320
|
+
if (!(part instanceof Cesium.Entity)) return [3 /*break*/, 16];
|
|
1321
|
+
visualHeightRef = Cesium.HeightReference.RELATIVE_TO_GROUND;
|
|
1322
|
+
if (!part.model) return [3 /*break*/, 2];
|
|
1323
|
+
visualHeightRef = GetValue(viewer, part.model.heightReference);
|
|
1324
|
+
return [3 /*break*/, 13];
|
|
1325
|
+
case 2:
|
|
1326
|
+
if (!part.polygon) return [3 /*break*/, 5];
|
|
1327
|
+
visualHeightRef = GetValue(viewer, part.polygon.heightReference);
|
|
1328
|
+
hierarchy = GetValue(viewer, part.polygon.hierarchy);
|
|
1329
|
+
if (!(hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.positions)) return [3 /*break*/, 4];
|
|
1457
1330
|
hPosses = hierarchy.positions.map(function (x) { return x.clone ? x.clone() : x; });
|
|
1458
1331
|
hPossesSample = [];
|
|
1459
1332
|
step = Math.max(1, Math.floor(hPosses.length / 5));
|
|
1460
|
-
for (
|
|
1461
|
-
hPossesSample.push(hPosses[
|
|
1333
|
+
for (i_1 = 0; i_1 < hPosses.length; i_1 += step) {
|
|
1334
|
+
hPossesSample.push(hPosses[i_1]);
|
|
1462
1335
|
}
|
|
1463
1336
|
return [4 /*yield*/, ensureHeightRefs(hPossesSample, __assign(__assign({}, sample), { heightRef: visualHeightRef }))];
|
|
1464
|
-
case
|
|
1337
|
+
case 3:
|
|
1465
1338
|
_a.sent();
|
|
1466
1339
|
posses = posses.concat(hPossesSample);
|
|
1467
|
-
_a.label =
|
|
1468
|
-
case
|
|
1469
|
-
case
|
|
1470
|
-
if (!
|
|
1471
|
-
visualHeightRef = GetValue(viewer,
|
|
1340
|
+
_a.label = 4;
|
|
1341
|
+
case 4: return [3 /*break*/, 13];
|
|
1342
|
+
case 5:
|
|
1343
|
+
if (!part.polyline) return [3 /*break*/, 8];
|
|
1344
|
+
visualHeightRef = GetValue(viewer, part.polyline.clampToGround) ?
|
|
1472
1345
|
Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE;
|
|
1473
|
-
pPosses = GetValue(viewer,
|
|
1474
|
-
if (!(pPosses === null || pPosses === void 0 ? void 0 : pPosses.length)) return [3 /*break*/,
|
|
1346
|
+
pPosses = GetValue(viewer, part.polyline.positions);
|
|
1347
|
+
if (!(pPosses === null || pPosses === void 0 ? void 0 : pPosses.length)) return [3 /*break*/, 7];
|
|
1475
1348
|
// Grab 5 positions from the polyline at varied indexes.
|
|
1476
1349
|
pPosses = pPosses.map(function (x) { return x.clone ? x.clone() : x; });
|
|
1477
1350
|
pPossesSample = [];
|
|
1478
1351
|
step = Math.max(1, Math.floor(pPosses.length / 5));
|
|
1479
|
-
for (
|
|
1480
|
-
pPossesSample.push(pPosses[
|
|
1352
|
+
for (i_2 = 0; i_2 < pPosses.length; i_2 += step) {
|
|
1353
|
+
pPossesSample.push(pPosses[i_2]);
|
|
1481
1354
|
}
|
|
1482
1355
|
return [4 /*yield*/, ensureHeightRefs(pPossesSample, __assign(__assign({}, sample), { heightRef: visualHeightRef }))];
|
|
1483
|
-
case
|
|
1356
|
+
case 6:
|
|
1484
1357
|
_a.sent();
|
|
1485
1358
|
posses = posses.concat(pPossesSample);
|
|
1486
|
-
_a.label =
|
|
1487
|
-
case
|
|
1488
|
-
case 7:
|
|
1489
|
-
if (!visual.billboard) return [3 /*break*/, 8];
|
|
1490
|
-
visualHeightRef = GetValue(viewer, visual.billboard.heightReference);
|
|
1491
|
-
return [3 /*break*/, 12];
|
|
1359
|
+
_a.label = 7;
|
|
1360
|
+
case 7: return [3 /*break*/, 13];
|
|
1492
1361
|
case 8:
|
|
1493
|
-
if (!
|
|
1494
|
-
visualHeightRef = GetValue(viewer,
|
|
1495
|
-
|
|
1496
|
-
|
|
1362
|
+
if (!part.billboard) return [3 /*break*/, 9];
|
|
1363
|
+
visualHeightRef = GetValue(viewer, part.billboard.heightReference);
|
|
1364
|
+
return [3 /*break*/, 13];
|
|
1365
|
+
case 9:
|
|
1366
|
+
if (!part.corridor) return [3 /*break*/, 12];
|
|
1367
|
+
visualHeightRef = GetValue(viewer, part.corridor.heightReference);
|
|
1368
|
+
pPosses = GetValue(viewer, part.corridor.positions);
|
|
1369
|
+
if (!(pPosses === null || pPosses === void 0 ? void 0 : pPosses.length)) return [3 /*break*/, 11];
|
|
1497
1370
|
// Grab 5 positions from the corridor at varied indexes.
|
|
1498
1371
|
pPosses = pPosses.map(function (x) { return x.clone ? x.clone() : x; });
|
|
1499
1372
|
pPossesSample = [];
|
|
1500
1373
|
step = Math.max(1, Math.floor(pPosses.length / 5));
|
|
1501
|
-
for (
|
|
1502
|
-
pPossesSample.push(pPosses[
|
|
1374
|
+
for (i_3 = 0; i_3 < pPosses.length; i_3 += step) {
|
|
1375
|
+
pPossesSample.push(pPosses[i_3]);
|
|
1503
1376
|
}
|
|
1504
1377
|
return [4 /*yield*/, ensureHeightRefs(pPossesSample, __assign(__assign({}, sample), { heightRef: visualHeightRef }))];
|
|
1505
|
-
case
|
|
1378
|
+
case 10:
|
|
1506
1379
|
_a.sent();
|
|
1507
1380
|
posses = posses.concat(pPossesSample);
|
|
1508
|
-
_a.label =
|
|
1509
|
-
case
|
|
1510
|
-
case
|
|
1511
|
-
if (
|
|
1512
|
-
visualHeightRef = GetValue(viewer,
|
|
1381
|
+
_a.label = 11;
|
|
1382
|
+
case 11: return [3 /*break*/, 13];
|
|
1383
|
+
case 12:
|
|
1384
|
+
if (part.ellipse) {
|
|
1385
|
+
visualHeightRef = GetValue(viewer, part.ellipse.heightReference);
|
|
1513
1386
|
}
|
|
1514
|
-
else if (
|
|
1515
|
-
visualHeightRef = GetValue(viewer,
|
|
1387
|
+
else if (part.point) {
|
|
1388
|
+
visualHeightRef = GetValue(viewer, part.point.heightReference);
|
|
1516
1389
|
}
|
|
1517
|
-
_a.label =
|
|
1518
|
-
case
|
|
1519
|
-
|
|
1520
|
-
|
|
1390
|
+
_a.label = 13;
|
|
1391
|
+
case 13:
|
|
1392
|
+
if (!(part.point || part.model || part.billboard || part.ellipse)) return [3 /*break*/, 15];
|
|
1393
|
+
pos3d_1 = GetValue(viewer, part.position);
|
|
1394
|
+
if (!(pos3d_1 === null || pos3d_1 === void 0 ? void 0 : pos3d_1.x)) return [3 /*break*/, 15];
|
|
1521
1395
|
toAdjust = [pos3d_1];
|
|
1522
1396
|
return [4 /*yield*/, ensureHeightRefs(toAdjust, __assign(__assign({}, sample), { heightRef: visualHeightRef }))];
|
|
1523
|
-
case
|
|
1397
|
+
case 14:
|
|
1524
1398
|
_a.sent();
|
|
1525
1399
|
pos3d_1 = toAdjust[0];
|
|
1526
1400
|
posses.push(pos3d_1);
|
|
1527
|
-
if (
|
|
1528
|
-
modelExt =
|
|
1401
|
+
if (part.model) {
|
|
1402
|
+
modelExt = part.model;
|
|
1529
1403
|
if (modelExt._radius && modelExt._radius > -1) {
|
|
1530
1404
|
sphere = Cesium.BoundingSphere.fromPoints([pos3d_1]);
|
|
1531
1405
|
sphere.radius = modelExt._radius;
|
|
1532
1406
|
spheres.push(sphere);
|
|
1533
1407
|
}
|
|
1534
1408
|
}
|
|
1535
|
-
_a.label =
|
|
1536
|
-
case
|
|
1409
|
+
_a.label = 15;
|
|
1410
|
+
case 15: return [3 /*break*/, 18];
|
|
1411
|
+
case 16:
|
|
1412
|
+
if (!(part instanceof Cesium.Cesium3DTileFeature)) return [3 /*break*/, 18];
|
|
1413
|
+
data_1 = getLocationFromFeature(part);
|
|
1414
|
+
if (!(data_1 != null)) return [3 /*break*/, 18];
|
|
1415
|
+
pos3d_2 = Cesium.Cartesian3.fromDegrees(data_1.location.longitude, data_1.location.latitude, data_1.location.altitude);
|
|
1416
|
+
toAdjust = [pos3d_2];
|
|
1417
|
+
return [4 /*yield*/, ensureHeightRefs(toAdjust, __assign(__assign({}, sample), { heightRef: data_1.isClamped ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE }))];
|
|
1418
|
+
case 17:
|
|
1419
|
+
_a.sent();
|
|
1420
|
+
pos3d_2 = toAdjust[0];
|
|
1421
|
+
posses.push(pos3d_2);
|
|
1422
|
+
if (data_1.radius != null && !isNaN(data_1.radius)) {
|
|
1423
|
+
sphere = new Cesium.BoundingSphere(pos3d_2, data_1.radius);
|
|
1424
|
+
spheres.push(sphere);
|
|
1425
|
+
}
|
|
1426
|
+
_a.label = 18;
|
|
1427
|
+
case 18:
|
|
1428
|
+
i++;
|
|
1429
|
+
return [3 /*break*/, 1];
|
|
1430
|
+
case 19: return [2 /*return*/, posses];
|
|
1537
1431
|
}
|
|
1538
1432
|
});
|
|
1539
1433
|
}); };
|
|
1540
1434
|
evaluateRecord = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1541
|
-
var posses, location_1, latitude, longitude,
|
|
1435
|
+
var posses, location_1, latitude, longitude, pos3d_3, pointStr, points, point, pos3d_4, lineStr, points, pPosses, pRings, boundary, points, pPosses, point, bPosses;
|
|
1542
1436
|
return __generator(this, function (_a) {
|
|
1543
1437
|
switch (_a.label) {
|
|
1544
1438
|
case 0:
|
|
@@ -1549,8 +1443,8 @@
|
|
|
1549
1443
|
longitude = EnsureNumber(location_1.longitude);
|
|
1550
1444
|
// Disallowing exact 0.
|
|
1551
1445
|
if (latitude || longitude) {
|
|
1552
|
-
|
|
1553
|
-
posses.push(
|
|
1446
|
+
pos3d_3 = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location_1.altitude));
|
|
1447
|
+
posses.push(pos3d_3);
|
|
1554
1448
|
}
|
|
1555
1449
|
}
|
|
1556
1450
|
if (!(entity.geometry && typeof entity.geometry == "object")) return [3 /*break*/, 4];
|
|
@@ -1559,8 +1453,8 @@
|
|
|
1559
1453
|
points = bruceModels.Geometry.ParsePoints(pointStr);
|
|
1560
1454
|
point = points.length > 0 ? points[0] : null;
|
|
1561
1455
|
if (point && bruceModels.Carto.ValidateCarto(point)) {
|
|
1562
|
-
|
|
1563
|
-
posses.push(
|
|
1456
|
+
pos3d_4 = Cesium.Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
|
|
1457
|
+
posses.push(pos3d_4);
|
|
1564
1458
|
}
|
|
1565
1459
|
}
|
|
1566
1460
|
lineStr = entity.geometry.LineString;
|
|
@@ -1751,13 +1645,13 @@
|
|
|
1751
1645
|
}); };
|
|
1752
1646
|
allPosses = [];
|
|
1753
1647
|
i = 0;
|
|
1754
|
-
|
|
1648
|
+
_a.label = 1;
|
|
1755
1649
|
case 1:
|
|
1756
1650
|
if (!(i < samples.length)) return [3 /*break*/, 4];
|
|
1757
1651
|
sample = samples[i];
|
|
1758
1652
|
return [4 /*yield*/, getEntityPositions(sample)];
|
|
1759
1653
|
case 2:
|
|
1760
|
-
samplePosses =
|
|
1654
|
+
samplePosses = _a.sent();
|
|
1761
1655
|
if (samplePosses === null || samplePosses === void 0 ? void 0 : samplePosses.length) {
|
|
1762
1656
|
valid = !(allPosses === null || allPosses === void 0 ? void 0 : allPosses.length);
|
|
1763
1657
|
if (!valid) {
|
|
@@ -1784,7 +1678,7 @@
|
|
|
1784
1678
|
}
|
|
1785
1679
|
}
|
|
1786
1680
|
}
|
|
1787
|
-
|
|
1681
|
+
_a.label = 3;
|
|
1788
1682
|
case 3:
|
|
1789
1683
|
i++;
|
|
1790
1684
|
return [3 /*break*/, 1];
|
|
@@ -1798,25 +1692,29 @@
|
|
|
1798
1692
|
rect.west -= marginX;
|
|
1799
1693
|
rect.north += marginY;
|
|
1800
1694
|
rect.south -= marginY;
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1695
|
+
data.rectangle = rect;
|
|
1696
|
+
carto = Cesium.Rectangle.center(rect);
|
|
1697
|
+
carto.height = 0;
|
|
1698
|
+
for (i = 0; i < allPosses.length; i++) {
|
|
1699
|
+
pos = allPosses[i];
|
|
1700
|
+
carto.height += Cesium.Cartographic.fromCartesian(pos).height;
|
|
1701
|
+
}
|
|
1702
|
+
if (carto.height != 0) {
|
|
1703
|
+
carto.height /= allPosses.length;
|
|
1807
1704
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
if (diagonalLen >= MIN_RECT_DIAGONAL_LENGTH && allPosses.length >= MIN_POSSES_LEN) {
|
|
1813
|
-
data.rectangle = rect;
|
|
1705
|
+
data.pos3d = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height);
|
|
1706
|
+
radius = Cesium.Cartesian3.distance(Cesium.Cartesian3.fromRadians(rect.west, rect.north), Cesium.Cartesian3.fromRadians(rect.east, rect.south));
|
|
1707
|
+
if (radius != 0) {
|
|
1708
|
+
radius /= 2;
|
|
1814
1709
|
}
|
|
1710
|
+
sphere = new Cesium.BoundingSphere(data.pos3d, radius);
|
|
1711
|
+
spheres.push(sphere);
|
|
1712
|
+
data.sphere = sphere;
|
|
1815
1713
|
}
|
|
1816
1714
|
else if (allPosses.length == 1) {
|
|
1817
1715
|
data.pos3d = allPosses[0];
|
|
1818
1716
|
}
|
|
1819
|
-
if (spheres.length) {
|
|
1717
|
+
if ((data.rectangle && spheres.length > 1) || (!data.rectangle && spheres.length > 0)) {
|
|
1820
1718
|
allPointSphere = Cesium.BoundingSphere.fromPoints(allPosses);
|
|
1821
1719
|
spheres.push(allPointSphere);
|
|
1822
1720
|
if (data.rectangle) {
|
|
@@ -1848,9 +1746,9 @@
|
|
|
1848
1746
|
if ((rego === null || rego === void 0 ? void 0 : rego.visual) instanceof Cesium.Entity) {
|
|
1849
1747
|
var visual = rego.visual;
|
|
1850
1748
|
if (visual.position) {
|
|
1851
|
-
var
|
|
1749
|
+
var pos3d_5 = GetValue(viewer, visual.position);
|
|
1852
1750
|
// Fix height reference.
|
|
1853
|
-
if (
|
|
1751
|
+
if (pos3d_5 === null || pos3d_5 === void 0 ? void 0 : pos3d_5.x) {
|
|
1854
1752
|
var visualHeightRef = Cesium.HeightReference.RELATIVE_TO_GROUND;
|
|
1855
1753
|
if (visual.model) {
|
|
1856
1754
|
visualHeightRef = GetValue(viewer, visual.model.heightReference);
|
|
@@ -1877,7 +1775,7 @@
|
|
|
1877
1775
|
return exports.DrawingUtils.EnsurePosHeight({
|
|
1878
1776
|
desiredHeightRef: params.returnHeightRef,
|
|
1879
1777
|
heightRef: visualHeightRef,
|
|
1880
|
-
pos3d:
|
|
1778
|
+
pos3d: pos3d_5,
|
|
1881
1779
|
viewer: viewer
|
|
1882
1780
|
});
|
|
1883
1781
|
}
|
|
@@ -2539,6 +2437,212 @@
|
|
|
2539
2437
|
RenderManager.GetZoomMinMax = GetZoomMinMax;
|
|
2540
2438
|
})(exports.RenderManager || (exports.RenderManager = {}));
|
|
2541
2439
|
|
|
2440
|
+
var CESIUM_INSPECTOR_KEY = "_nextspace_inspector";
|
|
2441
|
+
(function (ViewUtils) {
|
|
2442
|
+
function GatherLegacyMapTiles(params) {
|
|
2443
|
+
var viewer = params.viewer;
|
|
2444
|
+
var collection = viewer.imageryLayers;
|
|
2445
|
+
var tiles = [];
|
|
2446
|
+
for (var i = 0; i < collection.length; i++) {
|
|
2447
|
+
var layer = collection.get(i);
|
|
2448
|
+
if (layer._bName) {
|
|
2449
|
+
tiles.push({
|
|
2450
|
+
alpha: layer.alpha,
|
|
2451
|
+
brightness: layer.brightness,
|
|
2452
|
+
contrast: layer.contrast,
|
|
2453
|
+
hue: layer.hue,
|
|
2454
|
+
saturation: layer.saturation,
|
|
2455
|
+
gamma: layer.gamma,
|
|
2456
|
+
title: layer._bName,
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
return {
|
|
2461
|
+
imagery: tiles.reverse()
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
ViewUtils.GatherLegacyMapTiles = GatherLegacyMapTiles;
|
|
2465
|
+
function GatherLegacyTerrainTile(params) {
|
|
2466
|
+
var viewer = params.viewer;
|
|
2467
|
+
var enabled = viewer.terrainProvider;
|
|
2468
|
+
if (enabled === null || enabled === void 0 ? void 0 : enabled._bName) {
|
|
2469
|
+
return {
|
|
2470
|
+
terrain: enabled._bName
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
return {
|
|
2474
|
+
terrain: "flatterrain"
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
ViewUtils.GatherLegacyTerrainTile = GatherLegacyTerrainTile;
|
|
2478
|
+
function GatherMapTiles(params) {
|
|
2479
|
+
var viewer = params.viewer;
|
|
2480
|
+
var imagery = viewer.imageryLayers;
|
|
2481
|
+
var tiles = [];
|
|
2482
|
+
var _loop_1 = function (i) {
|
|
2483
|
+
var provider = imagery.get(i);
|
|
2484
|
+
if (provider._bMeta) {
|
|
2485
|
+
var idCombo_1 = provider._bMeta.accountId + provider._bMeta.tilesetId;
|
|
2486
|
+
if (!tiles.find(function (x) { return x.accountId + x.tilesetId === idCombo_1; })) {
|
|
2487
|
+
tiles.push({
|
|
2488
|
+
accountId: provider._bMeta.accountId,
|
|
2489
|
+
tilesetId: provider._bMeta.tilesetId,
|
|
2490
|
+
alpha: provider.alpha,
|
|
2491
|
+
brightness: provider.brightness,
|
|
2492
|
+
contrast: provider.contrast,
|
|
2493
|
+
hue: provider.hue,
|
|
2494
|
+
saturation: provider.saturation,
|
|
2495
|
+
gamma: provider.gamma
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
};
|
|
2500
|
+
for (var i = 0; i < imagery.length; i++) {
|
|
2501
|
+
_loop_1(i);
|
|
2502
|
+
}
|
|
2503
|
+
return {
|
|
2504
|
+
imagery: tiles
|
|
2505
|
+
};
|
|
2506
|
+
}
|
|
2507
|
+
ViewUtils.GatherMapTiles = GatherMapTiles;
|
|
2508
|
+
function GatherTerrainTile(params) {
|
|
2509
|
+
var viewer = params.viewer;
|
|
2510
|
+
var provider = viewer.terrainProvider;
|
|
2511
|
+
if (provider === null || provider === void 0 ? void 0 : provider._bMeta) {
|
|
2512
|
+
return {
|
|
2513
|
+
terrain: {
|
|
2514
|
+
accountId: provider._bMeta.accountId,
|
|
2515
|
+
tilesetId: provider._bMeta.tilesetId,
|
|
2516
|
+
}
|
|
2517
|
+
};
|
|
2518
|
+
}
|
|
2519
|
+
else if (provider instanceof Cesium.EllipsoidTerrainProvider) {
|
|
2520
|
+
return {
|
|
2521
|
+
terrain: {
|
|
2522
|
+
tilesetId: bruceModels.ProjectViewTile.EDefaultTerrain.FlatTerrain,
|
|
2523
|
+
accountId: null
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
return null;
|
|
2528
|
+
}
|
|
2529
|
+
ViewUtils.GatherTerrainTile = GatherTerrainTile;
|
|
2530
|
+
function SetTerrainWireframeStatus(params) {
|
|
2531
|
+
if (!params.viewer[CESIUM_INSPECTOR_KEY]) {
|
|
2532
|
+
var InspectorClass = Cesium.CesiumInspector;
|
|
2533
|
+
if (InspectorClass) {
|
|
2534
|
+
var inspector = new InspectorClass(document.createElement("div"), params.viewer.scene);
|
|
2535
|
+
inspector.container.style.display = "none";
|
|
2536
|
+
params.viewer[CESIUM_INSPECTOR_KEY] = inspector;
|
|
2537
|
+
params.viewer.scene.requestRender();
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
if (params.viewer[CESIUM_INSPECTOR_KEY]) {
|
|
2541
|
+
params.viewer[CESIUM_INSPECTOR_KEY].viewModel.wireframe = params.status;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
ViewUtils.SetTerrainWireframeStatus = SetTerrainWireframeStatus;
|
|
2545
|
+
function GetTerrainWireframeStatus(params) {
|
|
2546
|
+
var _a, _b;
|
|
2547
|
+
if (!params.viewer[CESIUM_INSPECTOR_KEY]) {
|
|
2548
|
+
return false;
|
|
2549
|
+
}
|
|
2550
|
+
return (_b = (_a = params.viewer[CESIUM_INSPECTOR_KEY]) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.wireframe;
|
|
2551
|
+
}
|
|
2552
|
+
ViewUtils.GetTerrainWireframeStatus = GetTerrainWireframeStatus;
|
|
2553
|
+
/**
|
|
2554
|
+
* Changes between perspective and orthographic view.
|
|
2555
|
+
* When Cesium stops being bad at picking positions in 2d mode we'll use the flat earth mode instead.
|
|
2556
|
+
* @param params
|
|
2557
|
+
*/
|
|
2558
|
+
function Set2dStatus(params) {
|
|
2559
|
+
var viewer = params.viewer, is2d = params.status, moveCamera = params.moveCamera;
|
|
2560
|
+
var curLens2d = viewer.camera.frustum instanceof Cesium.OrthographicFrustum;
|
|
2561
|
+
if (curLens2d && !is2d) {
|
|
2562
|
+
viewer.camera.switchToPerspectiveFrustum();
|
|
2563
|
+
viewer.scene.screenSpaceCameraController.enableTilt = true;
|
|
2564
|
+
viewer.scene.requestRender();
|
|
2565
|
+
}
|
|
2566
|
+
else if (!curLens2d && is2d) {
|
|
2567
|
+
viewer.camera.switchToOrthographicFrustum();
|
|
2568
|
+
viewer.scene.screenSpaceCameraController.enableTilt = false;
|
|
2569
|
+
if (moveCamera != false) {
|
|
2570
|
+
try {
|
|
2571
|
+
// Face camera downwards to make it look 2d.
|
|
2572
|
+
// We want to try make it look at the center-point of the current view.
|
|
2573
|
+
// If center cannot be calculated then we'll simply raise the camera and face it downwards.
|
|
2574
|
+
var scene = viewer.scene;
|
|
2575
|
+
var windowPosition = new Cesium.Cartesian2(scene.canvas.clientWidth / 2, scene.canvas.clientHeight / 2);
|
|
2576
|
+
var ray = viewer.camera.getPickRay(windowPosition);
|
|
2577
|
+
var intersection = scene.globe.pick(ray, scene);
|
|
2578
|
+
var center = void 0;
|
|
2579
|
+
if (Cesium.defined(intersection)) {
|
|
2580
|
+
center = Cesium.Cartographic.fromCartesian(intersection);
|
|
2581
|
+
}
|
|
2582
|
+
// Use current camera position if we can't calculate the center.
|
|
2583
|
+
else {
|
|
2584
|
+
center = Cesium.Cartographic.fromCartesian(viewer.camera.position);
|
|
2585
|
+
center.height = 0;
|
|
2586
|
+
}
|
|
2587
|
+
center.height = viewer.camera.positionCartographic.height + 100;
|
|
2588
|
+
viewer.camera.setView({
|
|
2589
|
+
destination: Cesium.Cartographic.toCartesian(center),
|
|
2590
|
+
orientation: {
|
|
2591
|
+
heading: 0.0,
|
|
2592
|
+
pitch: Cesium.Math.toRadians(-90.0),
|
|
2593
|
+
roll: 0.0
|
|
2594
|
+
}
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
catch (e) {
|
|
2598
|
+
console.error(e);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
viewer.scene.requestRender();
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
ViewUtils.Set2dStatus = Set2dStatus;
|
|
2605
|
+
function Get2dStatus(params) {
|
|
2606
|
+
var viewer = params.viewer;
|
|
2607
|
+
return viewer.camera.frustum instanceof Cesium.OrthographicFrustum;
|
|
2608
|
+
}
|
|
2609
|
+
ViewUtils.Get2dStatus = Get2dStatus;
|
|
2610
|
+
function SetLockedCameraStatus(params) {
|
|
2611
|
+
var viewer = params.viewer, status = params.status;
|
|
2612
|
+
var scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
|
|
2613
|
+
if (!scene) {
|
|
2614
|
+
return;
|
|
2615
|
+
}
|
|
2616
|
+
if (status) {
|
|
2617
|
+
scene.screenSpaceCameraController.enableInputs = false;
|
|
2618
|
+
scene.screenSpaceCameraController.enableTranslate = false;
|
|
2619
|
+
scene.screenSpaceCameraController.enableZoom = false;
|
|
2620
|
+
scene.screenSpaceCameraController.enableRotate = false;
|
|
2621
|
+
scene.screenSpaceCameraController.enableTilt = false;
|
|
2622
|
+
}
|
|
2623
|
+
else {
|
|
2624
|
+
scene.screenSpaceCameraController.enableInputs = true;
|
|
2625
|
+
scene.screenSpaceCameraController.enableTranslate = true;
|
|
2626
|
+
scene.screenSpaceCameraController.enableZoom = true;
|
|
2627
|
+
scene.screenSpaceCameraController.enableRotate = true;
|
|
2628
|
+
if (!ViewUtils.Get2dStatus({ viewer: viewer })) {
|
|
2629
|
+
scene.screenSpaceCameraController.enableTilt = true;
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
viewer.scene.requestRender();
|
|
2633
|
+
}
|
|
2634
|
+
ViewUtils.SetLockedCameraStatus = SetLockedCameraStatus;
|
|
2635
|
+
function GetLockedCameraStatus(params) {
|
|
2636
|
+
var _a;
|
|
2637
|
+
var scene = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a.scene;
|
|
2638
|
+
if (!scene) {
|
|
2639
|
+
return false;
|
|
2640
|
+
}
|
|
2641
|
+
return !scene.screenSpaceCameraController.enableTranslate;
|
|
2642
|
+
}
|
|
2643
|
+
ViewUtils.GetLockedCameraStatus = GetLockedCameraStatus;
|
|
2644
|
+
})(exports.ViewUtils || (exports.ViewUtils = {}));
|
|
2645
|
+
|
|
2542
2646
|
var MODEL_MIN_RADIUS = 10;
|
|
2543
2647
|
var POINT_MIN_RADIUS = 15;
|
|
2544
2648
|
// If a shape has more than this amount of points, we'll avoid checking it because it will take too long.
|
|
@@ -19840,7 +19944,7 @@
|
|
|
19840
19944
|
CesiumViewMonitor.Monitor = Monitor;
|
|
19841
19945
|
})(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
|
|
19842
19946
|
|
|
19843
|
-
var VERSION$1 = "3.2.
|
|
19947
|
+
var VERSION$1 = "3.2.8";
|
|
19844
19948
|
|
|
19845
19949
|
exports.VERSION = VERSION$1;
|
|
19846
19950
|
exports.CesiumParabola = CesiumParabola;
|