bruce-cesium 3.4.8 → 3.4.9
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/README.md +31 -0
- package/dist/bruce-cesium.es5.js +1064 -1049
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1064 -1049
- 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-kml-manager.js +42 -26
- package/dist/lib/rendering/render-managers/data-source/data-source-static-kml-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +0 -1
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +77 -77
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT,
|
|
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, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate,
|
|
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, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, ColorMaterialProperty, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, EllipsoidGeodesic, sampleTerrainMostDetailed, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -79,460 +79,876 @@ function __generator(thisArg, body) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
var TIME_LAG = 300;
|
|
83
|
+
var POSITION_CHECK_TIMER = 950;
|
|
84
|
+
var DEFAULT_GROUNDED_HEIGHT = 300;
|
|
85
|
+
var MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
|
|
86
|
+
var NET_STEP_PERCENT = 5;
|
|
87
|
+
var BORDER_STEPS = 3;
|
|
88
|
+
var ESearchStatus;
|
|
89
|
+
(function (ESearchStatus) {
|
|
90
|
+
ESearchStatus[ESearchStatus["LocationFound"] = 1] = "LocationFound";
|
|
91
|
+
ESearchStatus[ESearchStatus["LocationChanged"] = 2] = "LocationChanged";
|
|
92
|
+
ESearchStatus[ESearchStatus["LocationMissing"] = 3] = "LocationMissing";
|
|
93
|
+
})(ESearchStatus || (ESearchStatus = {}));
|
|
82
94
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @param value
|
|
86
|
-
* @param defaultNum default is 0.
|
|
95
|
+
* @param viewer
|
|
96
|
+
* @param center the previously calculated center of the view area. This is in degrees.
|
|
87
97
|
* @returns
|
|
88
98
|
*/
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var MeasureUtils;
|
|
101
|
-
(function (MeasureUtils) {
|
|
102
|
-
/**
|
|
103
|
-
* Returns the total distance in meters between an array of points.
|
|
104
|
-
* This distance is NOT following the terrain.
|
|
105
|
-
* @param posses
|
|
106
|
-
* @returns
|
|
107
|
-
*/
|
|
108
|
-
function MeasurePolyline(params) {
|
|
109
|
-
var posses = params.posses;
|
|
110
|
-
if (posses.length < 2) {
|
|
111
|
-
return {
|
|
112
|
-
totalLength: 0
|
|
113
|
-
};
|
|
99
|
+
function netScanViewForBoundaries(viewer, center) {
|
|
100
|
+
var maxLong = -2 * Math.PI;
|
|
101
|
+
var minLong = 2 * Math.PI;
|
|
102
|
+
var maxLat = -2 * Math.PI;
|
|
103
|
+
var minLat = 2 * Math.PI;
|
|
104
|
+
var found = 0;
|
|
105
|
+
var updateMinMax = function (lon, lat) {
|
|
106
|
+
// Check to see if given lon/lat (in radians) are within valid range.
|
|
107
|
+
if (lon < -Math.PI || lon > Math.PI || lat < -Math.PI / 2 || lat > Math.PI / 2) {
|
|
108
|
+
return;
|
|
114
109
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
110
|
+
maxLong = Math.max(maxLong, lon);
|
|
111
|
+
maxLat = Math.max(maxLat, lat);
|
|
112
|
+
minLong = Math.min(minLong, lon);
|
|
113
|
+
minLat = Math.min(minLat, lat);
|
|
114
|
+
};
|
|
115
|
+
var updateMinMaxForPoint = function (stepX, stepY) {
|
|
116
|
+
var x = Math.round(0 + (viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
|
|
117
|
+
var y = Math.round(0 + (viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
|
|
118
|
+
var winPos = new Cartesian2(x, y);
|
|
119
|
+
try {
|
|
120
|
+
var intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
|
|
121
|
+
if (intersection) {
|
|
122
|
+
var point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
|
|
123
|
+
updateMinMax(point.longitude, point.latitude);
|
|
124
|
+
found++;
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
MeasureUtils.MeasurePolyline = MeasurePolyline;
|
|
134
|
-
function MeasurePolygon(params) {
|
|
135
|
-
var posses = params.posses;
|
|
136
|
-
posses = [].concat(posses);
|
|
137
|
-
if (!Cartes.IsRing3Closed(posses)) {
|
|
138
|
-
posses.push(posses[0].clone());
|
|
127
|
+
catch (e) {
|
|
128
|
+
console.error(e);
|
|
139
129
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
130
|
+
};
|
|
131
|
+
// Outer circle.
|
|
132
|
+
updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
|
|
133
|
+
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
|
|
134
|
+
updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
135
|
+
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
136
|
+
// Inner circle.
|
|
137
|
+
updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
138
|
+
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
139
|
+
updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
140
|
+
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
141
|
+
// If we failed to find intersections and a center-point was provided, then we can use that to make some guesses.
|
|
142
|
+
// This happens if terrain is hidden, and there's nothing to intersect with.
|
|
143
|
+
if (center && found <= 0) {
|
|
144
|
+
updateMinMax(Math$1.toRadians(center.longitude), Math$1.toRadians(center.latitude));
|
|
145
|
+
found += 1;
|
|
146
|
+
// We'll use the camera height as an indicator on size of the rect.
|
|
147
|
+
var size = viewer.camera.positionCartographic.height;
|
|
148
|
+
var pitch = viewer.camera.pitch;
|
|
149
|
+
var distance = size / Math.tan(pitch);
|
|
150
|
+
var p1 = _offsetPoint({
|
|
151
|
+
altitude: center.altitude,
|
|
152
|
+
latitude: center.latitude,
|
|
153
|
+
longitude: center.longitude
|
|
154
|
+
}, distance, 45);
|
|
155
|
+
var p2 = _offsetPoint({
|
|
156
|
+
altitude: center.altitude,
|
|
157
|
+
latitude: center.latitude,
|
|
158
|
+
longitude: center.longitude
|
|
159
|
+
}, -distance, 45);
|
|
160
|
+
if (p1 === null || p1 === void 0 ? void 0 : p1.latitude) {
|
|
161
|
+
updateMinMax(Math$1.toRadians(p1.longitude), Math$1.toRadians(p1.latitude));
|
|
145
162
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
for (var i = 0; i < indices.length; i += 3) {
|
|
149
|
-
var vector1 = posses[indices[i]];
|
|
150
|
-
var vector2 = posses[indices[i + 1]];
|
|
151
|
-
var vector3 = posses[indices[i + 2]];
|
|
152
|
-
var vectorC = Cartesian3.subtract(vector2, vector1, new Cartesian3());
|
|
153
|
-
var vectorD = Cartesian3.subtract(vector3, vector1, new Cartesian3());
|
|
154
|
-
var areaVector = Cartesian3.cross(vectorC, vectorD, new Cartesian3());
|
|
155
|
-
area += Cartesian3.magnitude(areaVector) / 2.0;
|
|
163
|
+
if (p2 === null || p2 === void 0 ? void 0 : p2.latitude) {
|
|
164
|
+
updateMinMax(Math$1.toRadians(p2.longitude), Math$1.toRadians(p2.latitude));
|
|
156
165
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
}
|
|
167
|
+
if (found > 0) {
|
|
168
|
+
var viewRect = {
|
|
169
|
+
east: maxLong,
|
|
170
|
+
west: minLong,
|
|
171
|
+
north: maxLat,
|
|
172
|
+
south: minLat
|
|
163
173
|
};
|
|
174
|
+
return viewRect;
|
|
164
175
|
}
|
|
165
|
-
|
|
166
|
-
})(MeasureUtils || (MeasureUtils = {}));
|
|
167
|
-
|
|
168
|
-
var C3 = [Cartesian3][0];
|
|
169
|
-
function getT(t, alpha, p0, p1) {
|
|
170
|
-
var d = C3.subtract(p1, p0, new C3);
|
|
171
|
-
var a = C3.dot(d, d);
|
|
172
|
-
var b = Math.pow(a, alpha * 0.5);
|
|
173
|
-
return b + t;
|
|
176
|
+
return null;
|
|
174
177
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
var
|
|
186
|
-
var
|
|
187
|
-
var
|
|
188
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Moves a given point by a given distance towards a heading.
|
|
180
|
+
* @param point in degrees.
|
|
181
|
+
* @param distance in meters.
|
|
182
|
+
* @param heading in degrees.
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
function _offsetPoint(point, distance, heading) {
|
|
186
|
+
// Radius of earth.
|
|
187
|
+
var radius = 6371e3;
|
|
188
|
+
var δ = distance / radius;
|
|
189
|
+
var θ = Math$1.toRadians(heading);
|
|
190
|
+
var φ1 = Math$1.toRadians(point.latitude);
|
|
191
|
+
var λ1 = Math$1.toRadians(point.longitude);
|
|
192
|
+
var sinφ2 = Math.sin(φ1) * Math.cos(δ) + Math.cos(φ1) * Math.sin(δ) * Math.cos(θ);
|
|
193
|
+
var φ2 = Math.asin(sinφ2);
|
|
194
|
+
var y = Math.sin(θ) * Math.sin(δ) * Math.cos(φ1);
|
|
195
|
+
var x = Math.cos(δ) - Math.sin(φ1) * sinφ2;
|
|
196
|
+
var λ2 = λ1 + Math.atan2(y, x);
|
|
197
|
+
return {
|
|
198
|
+
altitude: point.altitude,
|
|
199
|
+
latitude: Math$1.toDegrees(φ2),
|
|
200
|
+
longitude: Math$1.toDegrees(λ2)
|
|
201
|
+
};
|
|
189
202
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
for (var i = 0; i < positions.length - 1; i++) {
|
|
218
|
-
var length_1 = Cartesian3.distance(positions[i], positions[i + 1]);
|
|
219
|
-
if (length_1 + currentDistance >= distance) {
|
|
220
|
-
var carto1 = Cartographic.fromCartesian(positions[i]);
|
|
221
|
-
var carto2 = Cartographic.fromCartesian(positions[i + 1]);
|
|
222
|
-
var geodesic = new EllipsoidGeodesic(carto1, carto2, viewer.scene.globe.ellipsoid);
|
|
223
|
-
//const position = geodesic.interpolateUsingSurfaceDistance(distance - currentDistance);
|
|
224
|
-
var position = geodesic.interpolateUsingFraction((distance - currentDistance) / length_1);
|
|
225
|
-
var height = (carto1.height + carto2.height) / 2;
|
|
226
|
-
return {
|
|
227
|
-
point: Cartesian3.fromRadians(position.longitude, position.latitude, height)
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
currentDistance += length_1;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return {
|
|
236
|
-
point: positions.length ? positions[positions.length - 1] : null
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
DrawingUtils.PointAcrossPolyline = PointAcrossPolyline;
|
|
240
|
-
/**
|
|
241
|
-
* Returns terrain height from current viewer's provider.
|
|
242
|
-
* On error or flat terrain, it will return 0.
|
|
243
|
-
* If an error occurred it will be attached to the result.
|
|
244
|
-
* @param pos3d
|
|
245
|
-
* @param viewer
|
|
246
|
-
* @returns
|
|
247
|
-
*/
|
|
248
|
-
function GetTerrainHeight(params) {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
250
|
-
var pos3d, viewer, sample, height, e_1;
|
|
251
|
-
return __generator(this, function (_a) {
|
|
252
|
-
switch (_a.label) {
|
|
253
|
-
case 0:
|
|
254
|
-
pos3d = params.pos3d, viewer = params.viewer;
|
|
255
|
-
_a.label = 1;
|
|
256
|
-
case 1:
|
|
257
|
-
_a.trys.push([1, 3, , 4]);
|
|
258
|
-
// If the terrain provider is not ready let's not ping it.
|
|
259
|
-
if (!viewer.terrainProvider || viewer.terrainProvider["ready"] == false) {
|
|
260
|
-
return [2 /*return*/, {
|
|
261
|
-
height: 0,
|
|
262
|
-
error: "Terrain provider not ready."
|
|
263
|
-
}];
|
|
264
|
-
}
|
|
265
|
-
if (viewer.scene.terrainProvider instanceof EllipsoidTerrainProvider) {
|
|
266
|
-
return [2 /*return*/, {
|
|
267
|
-
height: 0
|
|
268
|
-
}];
|
|
269
|
-
}
|
|
270
|
-
return [4 /*yield*/, sampleTerrainMostDetailed(viewer.scene.terrainProvider, [Cartographic.fromCartesian(pos3d)])];
|
|
271
|
-
case 2:
|
|
272
|
-
sample = _a.sent();
|
|
273
|
-
height = (sample === null || sample === void 0 ? void 0 : sample.length) ? sample[0].height : null;
|
|
274
|
-
if (isNaN(height)) {
|
|
275
|
-
return [2 /*return*/, {
|
|
276
|
-
height: 0,
|
|
277
|
-
error: "NaN"
|
|
278
|
-
}];
|
|
279
|
-
}
|
|
280
|
-
return [2 /*return*/, {
|
|
281
|
-
height: height
|
|
282
|
-
}];
|
|
283
|
-
case 3:
|
|
284
|
-
e_1 = _a.sent();
|
|
285
|
-
return [2 /*return*/, {
|
|
286
|
-
height: 0,
|
|
287
|
-
error: e_1
|
|
288
|
-
}];
|
|
289
|
-
case 4: return [2 /*return*/];
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
});
|
|
203
|
+
/**
|
|
204
|
+
* @param pos3d
|
|
205
|
+
* @param distance in meters
|
|
206
|
+
* @param heading in degrees
|
|
207
|
+
* @returns
|
|
208
|
+
*/
|
|
209
|
+
function _offsetPos3d(pos3d, distance, heading) {
|
|
210
|
+
var carto = Cartographic.fromCartesian(pos3d);
|
|
211
|
+
var newCarto = _offsetPoint({
|
|
212
|
+
altitude: carto.height,
|
|
213
|
+
latitude: Math$1.toDegrees(carto.latitude),
|
|
214
|
+
longitude: Math$1.toDegrees(carto.longitude)
|
|
215
|
+
}, distance, heading);
|
|
216
|
+
return Cartesian3.fromDegrees(newCarto.longitude, newCarto.latitude, newCarto.altitude);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Returns the intersection of the camera ray with the ground.
|
|
220
|
+
* @param viewer
|
|
221
|
+
* @param screenPos
|
|
222
|
+
* @returns
|
|
223
|
+
*/
|
|
224
|
+
function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
|
|
225
|
+
var ray = viewer.camera.getPickRay(screenPos);
|
|
226
|
+
var intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
227
|
+
if (intersection) {
|
|
228
|
+
return intersection;
|
|
293
229
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (heightRef == HeightReference.NONE) {
|
|
311
|
-
// Turn absolute into clamped.
|
|
312
|
-
if (desiredHeightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
313
|
-
return Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
|
|
314
|
-
}
|
|
315
|
-
// Turn absolute into relative (remove terrain height).
|
|
316
|
-
else if (desiredHeightRef == HeightReference.RELATIVE_TO_GROUND) {
|
|
317
|
-
var terrainHeight = EnsureNumber(viewer.scene.globe.getHeight(carto), 0);
|
|
318
|
-
return Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height - terrainHeight);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
else if (heightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
322
|
-
var terrainHeight = EnsureNumber(viewer.scene.globe.getHeight(carto), 0);
|
|
323
|
-
return Cartesian3.fromRadians(carto.longitude, carto.latitude, terrainHeight);
|
|
324
|
-
}
|
|
325
|
-
else if (heightRef == HeightReference.RELATIVE_TO_GROUND) {
|
|
326
|
-
// Turn relative into absolute (add terrain height).
|
|
327
|
-
if (desiredHeightRef == HeightReference.NONE) {
|
|
328
|
-
var terrainHeight = EnsureNumber(viewer.scene.globe.getHeight(carto), 0);
|
|
329
|
-
return Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height + terrainHeight);
|
|
330
|
-
}
|
|
331
|
-
// Turn relative into clamped.
|
|
332
|
-
else if (desiredHeightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
333
|
-
return Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return pos3d;
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Returns the intersection of the camera ray with the ground.
|
|
234
|
+
* If no intersection is found, then a "guess" is made based on the camera angle and height.
|
|
235
|
+
* The guess is made at the center of the view! It ignores the screenPos.
|
|
236
|
+
* @param viewer
|
|
237
|
+
* @param screenPos
|
|
238
|
+
* @returns
|
|
239
|
+
*/
|
|
240
|
+
function getGroundCenterOfCameraRay(viewer, screenPos) {
|
|
241
|
+
var _a, _b;
|
|
242
|
+
var ray = viewer.camera.getPickRay(screenPos);
|
|
243
|
+
var intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
244
|
+
if (intersection) {
|
|
245
|
+
return intersection;
|
|
337
246
|
}
|
|
338
|
-
|
|
247
|
+
// The fallback will be to "guess" where the intersection might be.
|
|
248
|
+
// This happens if terrain is hidden, and there's nothing to intersect with.
|
|
249
|
+
// We will use the camera angle + camera height.
|
|
250
|
+
// Eg: if camera is looking straight down and is 100 meters above the ground, then the intersection will be 100 meters below the camera.
|
|
251
|
+
var cameraHeight = viewer.camera.positionCartographic.height;
|
|
252
|
+
if (!isNaN(cameraHeight) && cameraHeight != null && ((_b = (_a = viewer.camera) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.clone)) {
|
|
253
|
+
var cameraPos3d = viewer.camera.position.clone();
|
|
254
|
+
var pitch = viewer.camera.pitch;
|
|
255
|
+
var distance = cameraHeight / Math.tan(pitch);
|
|
256
|
+
return _offsetPos3d(cameraPos3d, -distance, Math$1.toDegrees(viewer.camera.heading));
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
function areBoundsEqual(a, b) {
|
|
261
|
+
return a.north == b.north && a.south == b.south && a.east == b.east && a.west == b.west;
|
|
262
|
+
}
|
|
263
|
+
function arePosEqual(a, b) {
|
|
264
|
+
return a.latitude == b.latitude && a.longitude == b.longitude;
|
|
265
|
+
}
|
|
266
|
+
var CesiumViewMonitor;
|
|
267
|
+
(function (CesiumViewMonitor$$1) {
|
|
339
268
|
/**
|
|
340
|
-
*
|
|
341
|
-
* @param viewer
|
|
342
|
-
* @param cursor
|
|
343
|
-
* @returns
|
|
269
|
+
* Monitors and emits events when the Cesium view changes.
|
|
344
270
|
*/
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
271
|
+
var Monitor = /** @class */ (function () {
|
|
272
|
+
function Monitor(viewer) {
|
|
273
|
+
var _this = this;
|
|
274
|
+
this.target = null;
|
|
275
|
+
this.bounds = null;
|
|
276
|
+
this.disposed = false;
|
|
277
|
+
this.updatedEvent = null;
|
|
278
|
+
this.entity = null;
|
|
279
|
+
this.updating = false;
|
|
280
|
+
this.viewer = viewer;
|
|
281
|
+
this.tryEmitUpdate();
|
|
282
|
+
this.checkInterval = setInterval(function () {
|
|
283
|
+
_this.updateQueue();
|
|
284
|
+
}, POSITION_CHECK_TIMER);
|
|
285
|
+
}
|
|
286
|
+
Object.defineProperty(Monitor.prototype, "Disposed", {
|
|
287
|
+
get: function () {
|
|
288
|
+
return this.disposed;
|
|
289
|
+
},
|
|
290
|
+
enumerable: false,
|
|
291
|
+
configurable: true
|
|
292
|
+
});
|
|
293
|
+
Monitor.prototype.createEntity = function () {
|
|
294
|
+
var _this = this;
|
|
295
|
+
if (this.entity) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
this.entity = this.viewer.entities.add({
|
|
299
|
+
position: new CallbackProperty(function () {
|
|
300
|
+
return _this.target ? Cartesian3.fromDegrees(_this.target.longitude, _this.target.latitude) : null;
|
|
301
|
+
}, false),
|
|
302
|
+
point: {
|
|
303
|
+
pixelSize: 8,
|
|
304
|
+
color: Color.ORANGE,
|
|
305
|
+
heightReference: HeightReference.NONE
|
|
306
|
+
},
|
|
307
|
+
rectangle: {
|
|
308
|
+
coordinates: new CallbackProperty(function () {
|
|
309
|
+
return _this.bounds ? Rectangle.fromDegrees(_this.bounds.west, _this.bounds.south, _this.bounds.east, _this.bounds.north) : null;
|
|
310
|
+
}, false),
|
|
311
|
+
material: Color.fromCssColorString('#ff0000').withAlpha(0.4),
|
|
312
|
+
zIndex: 1,
|
|
313
|
+
heightReference: HeightReference.NONE
|
|
366
314
|
}
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
Monitor.prototype.destroyEntity = function () {
|
|
318
|
+
if (this.entity && this.viewer.entities.contains(this.entity)) {
|
|
319
|
+
this.viewer.entities.remove(this.entity);
|
|
367
320
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
pos3d = scene.pickPosition(cursor);
|
|
321
|
+
this.entity = null;
|
|
322
|
+
};
|
|
323
|
+
Monitor.prototype.Updated = function () {
|
|
324
|
+
if (!this.updatedEvent) {
|
|
325
|
+
this.updatedEvent = new BruceEvent();
|
|
374
326
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
327
|
+
return this.updatedEvent;
|
|
328
|
+
};
|
|
329
|
+
Monitor.prototype.GetBounds = function () {
|
|
330
|
+
return this.bounds;
|
|
331
|
+
};
|
|
332
|
+
Monitor.prototype.GetTarget = function () {
|
|
333
|
+
return this.target;
|
|
334
|
+
};
|
|
335
|
+
Monitor.prototype.DoUpdate = function () {
|
|
336
|
+
this.tryEmitUpdate();
|
|
337
|
+
};
|
|
338
|
+
Monitor.prototype.Dispose = function () {
|
|
339
|
+
if (this.disposed) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
this.disposed = true;
|
|
343
|
+
clearInterval(this.checkInterval);
|
|
344
|
+
this.destroyEntity();
|
|
345
|
+
};
|
|
346
|
+
Monitor.prototype.tryDoUpdate = function () {
|
|
347
|
+
var _a;
|
|
348
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
349
|
+
var viewRect, center, camera, terrData, cameraPosition, terrHeight, viewRectRad, windowPosition, intersection, point, viewRectRad, centerLong, centerLat;
|
|
350
|
+
return __generator(this, function (_b) {
|
|
351
|
+
switch (_b.label) {
|
|
352
|
+
case 0:
|
|
353
|
+
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
354
|
+
this.Dispose();
|
|
355
|
+
return [2 /*return*/, ESearchStatus.LocationMissing];
|
|
356
|
+
}
|
|
357
|
+
viewRect = null;
|
|
358
|
+
center = null;
|
|
359
|
+
camera = this.viewer.camera;
|
|
360
|
+
return [4 /*yield*/, DrawingUtils.GetTerrainHeight({
|
|
361
|
+
pos3d: camera.position,
|
|
362
|
+
viewer: this.viewer
|
|
363
|
+
})];
|
|
364
|
+
case 1:
|
|
365
|
+
terrData = _b.sent();
|
|
366
|
+
cameraPosition = this.viewer.camera.positionCartographic;
|
|
367
|
+
terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
|
|
368
|
+
// We are almost at the ground, screw horizon, just load around.
|
|
369
|
+
if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
370
|
+
// View area calculation.
|
|
371
|
+
viewRect = {};
|
|
372
|
+
viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
373
|
+
if (viewRectRad &&
|
|
374
|
+
viewRectRad.east &&
|
|
375
|
+
viewRectRad.west &&
|
|
376
|
+
viewRectRad.north &&
|
|
377
|
+
viewRectRad.south) {
|
|
378
|
+
viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
379
|
+
viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
380
|
+
viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
381
|
+
viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
viewRect.east = cameraPosition.longitude;
|
|
385
|
+
viewRect.west = cameraPosition.longitude;
|
|
386
|
+
viewRect.south = cameraPosition.latitude;
|
|
387
|
+
viewRect.north = cameraPosition.latitude;
|
|
388
|
+
}
|
|
389
|
+
center = {};
|
|
390
|
+
center.latitude = Math$1.toDegrees(camera.positionCartographic.latitude);
|
|
391
|
+
center.longitude = Math$1.toDegrees(camera.positionCartographic.longitude);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
windowPosition = new Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
|
|
395
|
+
intersection = getGroundCenterOfCameraRay(this.viewer, windowPosition);
|
|
396
|
+
point = null;
|
|
397
|
+
if (intersection) {
|
|
398
|
+
point = Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
399
|
+
}
|
|
400
|
+
if (point) {
|
|
401
|
+
center = {};
|
|
402
|
+
center.latitude = Math$1.toDegrees(point.latitude);
|
|
403
|
+
center.longitude = Math$1.toDegrees(point.longitude);
|
|
404
|
+
viewRectRad = netScanViewForBoundaries(this.viewer, center);
|
|
405
|
+
if (viewRectRad) {
|
|
406
|
+
viewRect = {};
|
|
407
|
+
viewRect.east = Math$1.toDegrees(viewRectRad.east);
|
|
408
|
+
viewRect.west = Math$1.toDegrees(viewRectRad.west);
|
|
409
|
+
viewRect.south = Math$1.toDegrees(viewRectRad.south);
|
|
410
|
+
viewRect.north = Math$1.toDegrees(viewRectRad.north);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Minimal field of view.
|
|
415
|
+
if (viewRect) {
|
|
416
|
+
centerLong = (viewRect.east + viewRect.west) / 2;
|
|
417
|
+
centerLat = (viewRect.north + viewRect.south) / 2;
|
|
418
|
+
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
419
|
+
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
420
|
+
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
421
|
+
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
422
|
+
viewRect.alt = (_a = this.viewer.scene.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height;
|
|
423
|
+
}
|
|
424
|
+
if (center && viewRect) {
|
|
425
|
+
if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
|
|
426
|
+
(!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
|
|
427
|
+
this.target = center;
|
|
428
|
+
this.bounds = viewRect;
|
|
429
|
+
return [2 /*return*/, ESearchStatus.LocationChanged];
|
|
430
|
+
}
|
|
431
|
+
return [2 /*return*/, ESearchStatus.LocationFound];
|
|
432
|
+
}
|
|
433
|
+
return [2 /*return*/, ESearchStatus.LocationMissing];
|
|
398
434
|
}
|
|
399
|
-
|
|
400
|
-
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
Monitor.prototype.tryEmitUpdate = function () {
|
|
439
|
+
var _a;
|
|
440
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
441
|
+
var searchResult, interest, e_1;
|
|
442
|
+
return __generator(this, function (_b) {
|
|
443
|
+
switch (_b.label) {
|
|
444
|
+
case 0:
|
|
445
|
+
if (this.updating) {
|
|
446
|
+
return [2 /*return*/];
|
|
447
|
+
}
|
|
448
|
+
this.updating = true;
|
|
449
|
+
_b.label = 1;
|
|
450
|
+
case 1:
|
|
451
|
+
_b.trys.push([1, 3, , 4]);
|
|
452
|
+
return [4 /*yield*/, this.tryDoUpdate()];
|
|
453
|
+
case 2:
|
|
454
|
+
searchResult = _b.sent();
|
|
455
|
+
if (searchResult == ESearchStatus.LocationChanged) {
|
|
456
|
+
interest = {
|
|
457
|
+
bounds: this.bounds,
|
|
458
|
+
target: this.target
|
|
459
|
+
};
|
|
460
|
+
// this.createEntity();
|
|
461
|
+
(_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
|
|
462
|
+
}
|
|
463
|
+
else if (searchResult == ESearchStatus.LocationMissing) {
|
|
464
|
+
this.updateQueue();
|
|
465
|
+
}
|
|
466
|
+
return [3 /*break*/, 4];
|
|
467
|
+
case 3:
|
|
468
|
+
e_1 = _b.sent();
|
|
469
|
+
console.error(e_1);
|
|
470
|
+
this.updateQueue();
|
|
471
|
+
return [3 /*break*/, 4];
|
|
472
|
+
case 4:
|
|
473
|
+
this.updating = false;
|
|
474
|
+
return [2 /*return*/];
|
|
401
475
|
}
|
|
402
|
-
}
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
Monitor.prototype.queuePosition = function (lag) {
|
|
480
|
+
var _this = this;
|
|
481
|
+
if (this.pendingTimeout) {
|
|
482
|
+
clearTimeout(this.pendingTimeout);
|
|
403
483
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
};
|
|
409
|
-
cacheTimestamp = Date.now();
|
|
410
|
-
cachedCameraState = {
|
|
411
|
-
position: camera.positionWC.clone(),
|
|
412
|
-
direction: camera.directionWC.clone()
|
|
413
|
-
};
|
|
414
|
-
return pos3d;
|
|
484
|
+
this.pendingTimeout = setTimeout(function () {
|
|
485
|
+
if (!_this.disposed) {
|
|
486
|
+
_this.tryEmitUpdate();
|
|
487
|
+
}
|
|
488
|
+
}, lag);
|
|
415
489
|
};
|
|
416
|
-
|
|
490
|
+
Monitor.prototype.updateQueue = function () {
|
|
491
|
+
this.queuePosition(TIME_LAG);
|
|
492
|
+
};
|
|
493
|
+
return Monitor;
|
|
494
|
+
}());
|
|
495
|
+
CesiumViewMonitor$$1.Monitor = Monitor;
|
|
496
|
+
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Ensures a number is returned from a given value.
|
|
500
|
+
* If given value cannot be parsed it will return defaultNum.
|
|
501
|
+
* @param value
|
|
502
|
+
* @param defaultNum default is 0.
|
|
503
|
+
* @returns
|
|
504
|
+
*/
|
|
505
|
+
function EnsureNumber(value, defaultNum) {
|
|
506
|
+
if (!defaultNum) {
|
|
507
|
+
defaultNum = 0;
|
|
508
|
+
}
|
|
509
|
+
value = Number(value);
|
|
510
|
+
if (isNaN(value)) {
|
|
511
|
+
return defaultNum;
|
|
512
|
+
}
|
|
513
|
+
return value;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
var MeasureUtils;
|
|
517
|
+
(function (MeasureUtils) {
|
|
417
518
|
/**
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
* @param
|
|
421
|
-
* @param closed: true if this is a closed shape. Eg: polygon.
|
|
519
|
+
* Returns the total distance in meters between an array of points.
|
|
520
|
+
* This distance is NOT following the terrain.
|
|
521
|
+
* @param posses
|
|
422
522
|
* @returns
|
|
423
523
|
*/
|
|
424
|
-
function
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
points.push(C3.subtract(points[points.length - 1], points[points.length - 2], new C3));
|
|
431
|
-
}
|
|
432
|
-
else {
|
|
433
|
-
points.unshift(points[points.length - 1]);
|
|
434
|
-
points.unshift(points[points.length - 2]);
|
|
435
|
-
points.push(points[2]);
|
|
524
|
+
function MeasurePolyline(params) {
|
|
525
|
+
var posses = params.posses;
|
|
526
|
+
if (posses.length < 2) {
|
|
527
|
+
return {
|
|
528
|
+
totalLength: 0
|
|
529
|
+
};
|
|
436
530
|
}
|
|
437
|
-
var
|
|
438
|
-
var
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
531
|
+
var totalLength = 0;
|
|
532
|
+
var pos1 = null;
|
|
533
|
+
var pos2 = null;
|
|
534
|
+
for (var i = 0; i < posses.length; i++) {
|
|
535
|
+
if (pos1 == null) {
|
|
536
|
+
pos1 = posses[i];
|
|
537
|
+
}
|
|
538
|
+
else if (pos2 == null) {
|
|
539
|
+
pos2 = posses[i];
|
|
540
|
+
totalLength += Cartesian3.distance(pos1, pos2);
|
|
541
|
+
pos1 = pos2;
|
|
542
|
+
pos2 = null;
|
|
442
543
|
}
|
|
443
|
-
};
|
|
444
|
-
for (var i = 0; i < points.length - 3; i++) {
|
|
445
|
-
_loop_1(i);
|
|
446
544
|
}
|
|
447
|
-
return
|
|
545
|
+
return {
|
|
546
|
+
totalLength: totalLength
|
|
547
|
+
};
|
|
448
548
|
}
|
|
449
|
-
|
|
549
|
+
MeasureUtils.MeasurePolyline = MeasurePolyline;
|
|
550
|
+
function MeasurePolygon(params) {
|
|
551
|
+
var posses = params.posses;
|
|
552
|
+
posses = [].concat(posses);
|
|
553
|
+
if (!Cartes.IsRing3Closed(posses)) {
|
|
554
|
+
posses.push(posses[0].clone());
|
|
555
|
+
}
|
|
556
|
+
if (posses.length < 3) {
|
|
557
|
+
return {
|
|
558
|
+
area: 0,
|
|
559
|
+
perimeter: 0
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
var area = 0;
|
|
563
|
+
var indices = PolygonPipeline.triangulate(posses, []);
|
|
564
|
+
for (var i = 0; i < indices.length; i += 3) {
|
|
565
|
+
var vector1 = posses[indices[i]];
|
|
566
|
+
var vector2 = posses[indices[i + 1]];
|
|
567
|
+
var vector3 = posses[indices[i + 2]];
|
|
568
|
+
var vectorC = Cartesian3.subtract(vector2, vector1, new Cartesian3());
|
|
569
|
+
var vectorD = Cartesian3.subtract(vector3, vector1, new Cartesian3());
|
|
570
|
+
var areaVector = Cartesian3.cross(vectorC, vectorD, new Cartesian3());
|
|
571
|
+
area += Cartesian3.magnitude(areaVector) / 2.0;
|
|
572
|
+
}
|
|
573
|
+
var perimeter = MeasurePolyline({
|
|
574
|
+
posses: posses
|
|
575
|
+
}).totalLength;
|
|
576
|
+
return {
|
|
577
|
+
area: area,
|
|
578
|
+
perimeter: perimeter
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
MeasureUtils.MeasurePolygon = MeasurePolygon;
|
|
582
|
+
})(MeasureUtils || (MeasureUtils = {}));
|
|
583
|
+
|
|
584
|
+
var C3 = [Cartesian3][0];
|
|
585
|
+
function getT(t, alpha, p0, p1) {
|
|
586
|
+
var d = C3.subtract(p1, p0, new C3);
|
|
587
|
+
var a = C3.dot(d, d);
|
|
588
|
+
var b = Math.pow(a, alpha * 0.5);
|
|
589
|
+
return b + t;
|
|
590
|
+
}
|
|
591
|
+
function catmullRom(p0, p1, p2, p3, t) {
|
|
592
|
+
var t0 = 0;
|
|
593
|
+
var t1 = getT(t0, 0.5, p0, p1);
|
|
594
|
+
var t2 = getT(t1, 0.5, p1, p2);
|
|
595
|
+
var t3 = getT(t2, 0.5, p2, p3);
|
|
596
|
+
t = Math$1.lerp(t1, t2, t);
|
|
597
|
+
var _a = [function (l, r) { return C3.add(l, r, new C3); }, function (l, r) { return C3.multiplyByScalar(l, r, new C3); }], add = _a[0], mul = _a[1];
|
|
598
|
+
var A1 = add(mul(p0, (t1 - t) / (t1 - t0)), mul(p1, (t - t0) / (t1 - t0)));
|
|
599
|
+
var A2 = add(mul(p1, (t2 - t) / (t2 - t1)), mul(p2, (t - t1) / (t2 - t1)));
|
|
600
|
+
var A3 = add(mul(p2, (t3 - t) / (t3 - t2)), mul(p3, (t - t2) / (t3 - t2)));
|
|
601
|
+
var B1 = add(mul(A1, (t2 - t) / (t2 - t0)), mul(A2, (t - t0) / (t2 - t0)));
|
|
602
|
+
var B2 = add(mul(A2, (t3 - t) / (t3 - t1)), mul(A3, (t - t1) / (t3 - t1)));
|
|
603
|
+
var C = add(mul(B1, (t2 - t) / (t2 - t1)), mul(B2, (t - t1) / (t2 - t1)));
|
|
604
|
+
return C;
|
|
605
|
+
}
|
|
606
|
+
var DrawingUtils;
|
|
607
|
+
(function (DrawingUtils) {
|
|
450
608
|
/**
|
|
609
|
+
* Returns the point across a polyline at a given distance.
|
|
610
|
+
* If the distance exceeds the length of the line, the point will be placed at the end of the line.
|
|
611
|
+
* @param viewer
|
|
612
|
+
* @param positions
|
|
613
|
+
* @param distance
|
|
614
|
+
* @returns
|
|
615
|
+
*/
|
|
616
|
+
function PointAcrossPolyline(params) {
|
|
617
|
+
var viewer = params.viewer, positions = params.posses, distance = params.distance;
|
|
618
|
+
if (distance <= 0 && positions.length > 0) {
|
|
619
|
+
return {
|
|
620
|
+
point: positions[0]
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
else if (positions.length > 1) {
|
|
624
|
+
var currentDistance = 0;
|
|
625
|
+
var totalLength = MeasureUtils.MeasurePolyline({
|
|
626
|
+
posses: positions,
|
|
627
|
+
}).totalLength;
|
|
628
|
+
if (distance > totalLength) {
|
|
629
|
+
return {
|
|
630
|
+
point: positions[positions.length - 1]
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
for (var i = 0; i < positions.length - 1; i++) {
|
|
634
|
+
var length_1 = Cartesian3.distance(positions[i], positions[i + 1]);
|
|
635
|
+
if (length_1 + currentDistance >= distance) {
|
|
636
|
+
var carto1 = Cartographic.fromCartesian(positions[i]);
|
|
637
|
+
var carto2 = Cartographic.fromCartesian(positions[i + 1]);
|
|
638
|
+
var geodesic = new EllipsoidGeodesic(carto1, carto2, viewer.scene.globe.ellipsoid);
|
|
639
|
+
//const position = geodesic.interpolateUsingSurfaceDistance(distance - currentDistance);
|
|
640
|
+
var position = geodesic.interpolateUsingFraction((distance - currentDistance) / length_1);
|
|
641
|
+
var height = (carto1.height + carto2.height) / 2;
|
|
642
|
+
return {
|
|
643
|
+
point: Cartesian3.fromRadians(position.longitude, position.latitude, height)
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
currentDistance += length_1;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
point: positions.length ? positions[positions.length - 1] : null
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
DrawingUtils.PointAcrossPolyline = PointAcrossPolyline;
|
|
656
|
+
/**
|
|
657
|
+
* Returns terrain height from current viewer's provider.
|
|
658
|
+
* On error or flat terrain, it will return 0.
|
|
659
|
+
* If an error occurred it will be attached to the result.
|
|
451
660
|
* @param pos3d
|
|
452
|
-
* @param
|
|
661
|
+
* @param viewer
|
|
662
|
+
* @returns
|
|
453
663
|
*/
|
|
454
|
-
function
|
|
455
|
-
if (minimumHeight === void 0) { minimumHeight = 0; }
|
|
664
|
+
function GetTerrainHeight(params) {
|
|
456
665
|
return __awaiter(this, void 0, void 0, function () {
|
|
457
|
-
var
|
|
666
|
+
var pos3d, viewer, sample, height, e_1;
|
|
458
667
|
return __generator(this, function (_a) {
|
|
459
668
|
switch (_a.label) {
|
|
460
669
|
case 0:
|
|
670
|
+
pos3d = params.pos3d, viewer = params.viewer;
|
|
671
|
+
_a.label = 1;
|
|
672
|
+
case 1:
|
|
673
|
+
_a.trys.push([1, 3, , 4]);
|
|
461
674
|
// If the terrain provider is not ready let's not ping it.
|
|
462
675
|
if (!viewer.terrainProvider || viewer.terrainProvider["ready"] == false) {
|
|
463
|
-
return [2 /*return*/,
|
|
676
|
+
return [2 /*return*/, {
|
|
677
|
+
height: 0,
|
|
678
|
+
error: "Terrain provider not ready."
|
|
679
|
+
}];
|
|
464
680
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
return [
|
|
471
|
-
case 1: return [4 /*yield*/, sampleTerrainMostDetailed(viewer.scene.terrainProvider, [terrainCarto])];
|
|
681
|
+
if (viewer.scene.terrainProvider instanceof EllipsoidTerrainProvider) {
|
|
682
|
+
return [2 /*return*/, {
|
|
683
|
+
height: 0
|
|
684
|
+
}];
|
|
685
|
+
}
|
|
686
|
+
return [4 /*yield*/, sampleTerrainMostDetailed(viewer.scene.terrainProvider, [Cartographic.fromCartesian(pos3d)])];
|
|
472
687
|
case 2:
|
|
473
688
|
sample = _a.sent();
|
|
474
|
-
|
|
475
|
-
if (
|
|
476
|
-
|
|
689
|
+
height = (sample === null || sample === void 0 ? void 0 : sample.length) ? sample[0].height : null;
|
|
690
|
+
if (isNaN(height)) {
|
|
691
|
+
return [2 /*return*/, {
|
|
692
|
+
height: 0,
|
|
693
|
+
error: "NaN"
|
|
694
|
+
}];
|
|
477
695
|
}
|
|
478
|
-
|
|
479
|
-
|
|
696
|
+
return [2 /*return*/, {
|
|
697
|
+
height: height
|
|
698
|
+
}];
|
|
699
|
+
case 3:
|
|
700
|
+
e_1 = _a.sent();
|
|
701
|
+
return [2 /*return*/, {
|
|
702
|
+
height: 0,
|
|
703
|
+
error: e_1
|
|
704
|
+
}];
|
|
705
|
+
case 4: return [2 /*return*/];
|
|
480
706
|
}
|
|
481
707
|
});
|
|
482
708
|
});
|
|
483
709
|
}
|
|
484
|
-
DrawingUtils.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
* @param visual
|
|
491
|
-
* @returns
|
|
492
|
-
*/
|
|
493
|
-
function isAlive(viewer, visual) {
|
|
494
|
-
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
495
|
-
return false;
|
|
496
|
-
}
|
|
497
|
-
if (visual instanceof Entity) {
|
|
498
|
-
return true;
|
|
499
|
-
}
|
|
500
|
-
else if (visual instanceof Primitive) {
|
|
501
|
-
return true;
|
|
502
|
-
}
|
|
503
|
-
else if (visual instanceof Cesium3DTileFeature) {
|
|
504
|
-
var cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
505
|
-
if (!cTileset) {
|
|
506
|
-
return false;
|
|
710
|
+
DrawingUtils.GetTerrainHeight = GetTerrainHeight;
|
|
711
|
+
function EnsurePosHeight(params) {
|
|
712
|
+
var pos3d = params.pos3d, viewer = params.viewer, desiredHeightRef = params.desiredHeightRef, heightRef = params.heightRef;
|
|
713
|
+
var carto = Cartes.ValidateCartes3(pos3d) ? Cartographic.fromCartesian(pos3d) : null;
|
|
714
|
+
if (!(carto === null || carto === void 0 ? void 0 : carto.latitude)) {
|
|
715
|
+
return pos3d;
|
|
507
716
|
}
|
|
508
|
-
if (
|
|
509
|
-
|
|
717
|
+
if (heightRef == null) {
|
|
718
|
+
heightRef = HeightReference.CLAMP_TO_GROUND;
|
|
510
719
|
}
|
|
511
|
-
|
|
720
|
+
if (desiredHeightRef == null) {
|
|
721
|
+
desiredHeightRef = HeightReference.CLAMP_TO_GROUND;
|
|
722
|
+
}
|
|
723
|
+
if (heightRef == desiredHeightRef) {
|
|
724
|
+
return pos3d;
|
|
725
|
+
}
|
|
726
|
+
if (heightRef == HeightReference.NONE) {
|
|
727
|
+
// Turn absolute into clamped.
|
|
728
|
+
if (desiredHeightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
729
|
+
return Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
|
|
730
|
+
}
|
|
731
|
+
// Turn absolute into relative (remove terrain height).
|
|
732
|
+
else if (desiredHeightRef == HeightReference.RELATIVE_TO_GROUND) {
|
|
733
|
+
var terrainHeight = EnsureNumber(viewer.scene.globe.getHeight(carto), 0);
|
|
734
|
+
return Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height - terrainHeight);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
else if (heightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
738
|
+
var terrainHeight = EnsureNumber(viewer.scene.globe.getHeight(carto), 0);
|
|
739
|
+
return Cartesian3.fromRadians(carto.longitude, carto.latitude, terrainHeight);
|
|
740
|
+
}
|
|
741
|
+
else if (heightRef == HeightReference.RELATIVE_TO_GROUND) {
|
|
742
|
+
// Turn relative into absolute (add terrain height).
|
|
743
|
+
if (desiredHeightRef == HeightReference.NONE) {
|
|
744
|
+
var terrainHeight = EnsureNumber(viewer.scene.globe.getHeight(carto), 0);
|
|
745
|
+
return Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height + terrainHeight);
|
|
746
|
+
}
|
|
747
|
+
// Turn relative into clamped.
|
|
748
|
+
else if (desiredHeightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
749
|
+
return Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return pos3d;
|
|
512
753
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
754
|
+
DrawingUtils.EnsurePosHeight = EnsurePosHeight;
|
|
755
|
+
/**
|
|
756
|
+
* Returns an accurate 3d position from a given screen position.
|
|
757
|
+
* @param viewer
|
|
758
|
+
* @param cursor
|
|
759
|
+
* @returns
|
|
760
|
+
*/
|
|
761
|
+
DrawingUtils.GetAccuratePosition = (function () {
|
|
762
|
+
var cachedPick = null;
|
|
763
|
+
var cacheTimestamp = null;
|
|
764
|
+
var cachedCameraState = null;
|
|
765
|
+
return function (viewer, cursor, pickOnly) {
|
|
766
|
+
if (pickOnly === void 0) { pickOnly = false; }
|
|
767
|
+
var scene = viewer.scene;
|
|
768
|
+
var camera = scene.camera;
|
|
769
|
+
// Check if we can use cached position.
|
|
770
|
+
if (cachedPick && cacheTimestamp) {
|
|
771
|
+
var timeElapsed = Date.now() - cacheTimestamp;
|
|
772
|
+
var isWithinCacheDuration = timeElapsed < 3000; // 3 seconds
|
|
773
|
+
var isNearPreviousPick = Cartesian2.distanceSquared(cursor, cachedPick.cursor) < 9; // 3 pixels
|
|
774
|
+
var directionDot = Cartesian3.dot(camera.directionWC, cachedCameraState.direction);
|
|
775
|
+
var directionLengths = Cartesian3.magnitude(camera.directionWC) * Cartesian3.magnitude(cachedCameraState.direction);
|
|
776
|
+
var angle = Math.acos(directionDot / directionLengths);
|
|
777
|
+
var hasCameraMoved = Math.abs(camera.positionWC.x - cachedCameraState.position.x) > 2 || // 2 meters
|
|
778
|
+
Math.abs(camera.positionWC.y - cachedCameraState.position.y) > 2 ||
|
|
779
|
+
angle > Math$1.toRadians(5); // 5 degrees
|
|
780
|
+
if (isWithinCacheDuration && isNearPreviousPick && !hasCameraMoved) {
|
|
781
|
+
return cachedPick.position;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
// Actual picking logic
|
|
785
|
+
// https://community.cesium.com/t/scene-pick-returning-point-inside-the-globe/18940/9
|
|
786
|
+
var pos3d = null;
|
|
787
|
+
// Means we can accurately pick right now.
|
|
788
|
+
if (!pickOnly && scene.globe.depthTestAgainstTerrain) {
|
|
789
|
+
pos3d = scene.pickPosition(cursor);
|
|
790
|
+
}
|
|
791
|
+
// Means we cannot guarantee an accurate pick.
|
|
792
|
+
// We want to prioritize pick-position when we can, so we'll try use it and if the result is sus then we'll use some fallbacks.
|
|
793
|
+
else {
|
|
794
|
+
if (!pickOnly) {
|
|
795
|
+
pos3d = scene.pickPosition(cursor);
|
|
796
|
+
}
|
|
797
|
+
if (defined(pos3d)) {
|
|
798
|
+
var carto = Cartographic.fromCartesian(pos3d);
|
|
799
|
+
if (!defined(carto) || carto.height < 0) {
|
|
800
|
+
pos3d = null;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (!defined(pos3d)) {
|
|
804
|
+
pos3d = null;
|
|
805
|
+
var ray = scene.camera.getPickRay(cursor);
|
|
806
|
+
if (scene.pickPositionSupported) {
|
|
807
|
+
var pickedObject = scene.pick(cursor, 1, 1);
|
|
808
|
+
if (defined(pickedObject) &&
|
|
809
|
+
(pickedObject instanceof Cesium3DTileFeature ||
|
|
810
|
+
pickedObject.primitive instanceof Cesium3DTileset ||
|
|
811
|
+
pickedObject.primitive instanceof Model)) {
|
|
812
|
+
pos3d = scene.pickPosition(cursor);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if (!pickOnly && !defined(pos3d)) {
|
|
816
|
+
pos3d = scene.globe.pick(ray, scene);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
// Update cache.
|
|
821
|
+
cachedPick = {
|
|
822
|
+
position: pos3d,
|
|
823
|
+
cursor: cursor.clone()
|
|
824
|
+
};
|
|
825
|
+
cacheTimestamp = Date.now();
|
|
826
|
+
cachedCameraState = {
|
|
827
|
+
position: camera.positionWC.clone(),
|
|
828
|
+
direction: camera.directionWC.clone()
|
|
829
|
+
};
|
|
830
|
+
return pos3d;
|
|
831
|
+
};
|
|
832
|
+
})();
|
|
833
|
+
/**
|
|
834
|
+
* Smooths a given set of points.
|
|
835
|
+
* @param points
|
|
836
|
+
* @param multiplier
|
|
837
|
+
* @param closed: true if this is a closed shape. Eg: polygon.
|
|
838
|
+
* @returns
|
|
839
|
+
*/
|
|
840
|
+
function SmoothPoints(points, multiplier, closed) {
|
|
841
|
+
if (points.length < 4 || multiplier < 2) {
|
|
842
|
+
return points;
|
|
843
|
+
}
|
|
844
|
+
if (!closed) {
|
|
845
|
+
points.unshift(C3.subtract(points[0], points[1], new C3));
|
|
846
|
+
points.push(C3.subtract(points[points.length - 1], points[points.length - 2], new C3));
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
points.unshift(points[points.length - 1]);
|
|
850
|
+
points.unshift(points[points.length - 2]);
|
|
851
|
+
points.push(points[2]);
|
|
852
|
+
}
|
|
853
|
+
var splinePoints = [];
|
|
854
|
+
var _loop_1 = function (i) {
|
|
855
|
+
var _a = [0, 1, 2, 3].map(function (n) { return points[i + n]; }), P0 = _a[0], P1 = _a[1], P2 = _a[2], P3 = _a[3];
|
|
856
|
+
for (var j = 0; j <= multiplier; j++) {
|
|
857
|
+
splinePoints.push(catmullRom(P0, P1, P2, P3, j / multiplier));
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
for (var i = 0; i < points.length - 3; i++) {
|
|
861
|
+
_loop_1(i);
|
|
862
|
+
}
|
|
863
|
+
return splinePoints;
|
|
864
|
+
}
|
|
865
|
+
DrawingUtils.SmoothPoints = SmoothPoints;
|
|
866
|
+
/**
|
|
867
|
+
* @param pos3d
|
|
868
|
+
* @param minimumHeight height relative to ground
|
|
869
|
+
*/
|
|
870
|
+
function RaisePos3d(viewer, pos3d, minimumHeight) {
|
|
871
|
+
if (minimumHeight === void 0) { minimumHeight = 0; }
|
|
872
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
873
|
+
var carto, terrainCarto, sample, terrainHeight;
|
|
874
|
+
return __generator(this, function (_a) {
|
|
875
|
+
switch (_a.label) {
|
|
876
|
+
case 0:
|
|
877
|
+
// If the terrain provider is not ready let's not ping it.
|
|
878
|
+
if (!viewer.terrainProvider || viewer.terrainProvider["ready"] == false) {
|
|
879
|
+
return [2 /*return*/, pos3d];
|
|
880
|
+
}
|
|
881
|
+
carto = Cartographic.fromCartesian(pos3d);
|
|
882
|
+
terrainCarto = carto.clone();
|
|
883
|
+
terrainCarto.height = 0;
|
|
884
|
+
if (!(viewer.scene.terrainProvider instanceof EllipsoidTerrainProvider)) return [3 /*break*/, 1];
|
|
885
|
+
carto.height = Math.max(carto.height, minimumHeight);
|
|
886
|
+
return [3 /*break*/, 3];
|
|
887
|
+
case 1: return [4 /*yield*/, sampleTerrainMostDetailed(viewer.scene.terrainProvider, [terrainCarto])];
|
|
888
|
+
case 2:
|
|
889
|
+
sample = _a.sent();
|
|
890
|
+
terrainHeight = (sample === null || sample === void 0 ? void 0 : sample.length) ? sample[0].height : null;
|
|
891
|
+
if (terrainHeight != null) {
|
|
892
|
+
carto.height = Math.max(carto.height, terrainHeight + minimumHeight);
|
|
893
|
+
}
|
|
894
|
+
_a.label = 3;
|
|
895
|
+
case 3: return [2 /*return*/, Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height)];
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
DrawingUtils.RaisePos3d = RaisePos3d;
|
|
901
|
+
})(DrawingUtils || (DrawingUtils = {}));
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Returns if a given visual can be styled by this utility.
|
|
905
|
+
* @param viewer
|
|
906
|
+
* @param visual
|
|
907
|
+
* @returns
|
|
908
|
+
*/
|
|
909
|
+
function isAlive(viewer, visual) {
|
|
910
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
if (visual instanceof Entity) {
|
|
914
|
+
return true;
|
|
915
|
+
}
|
|
916
|
+
else if (visual instanceof Primitive) {
|
|
917
|
+
return true;
|
|
918
|
+
}
|
|
919
|
+
else if (visual instanceof Cesium3DTileFeature) {
|
|
920
|
+
var cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
921
|
+
if (!cTileset) {
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
return true;
|
|
928
|
+
}
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
931
|
+
var _selectColor = Color.fromAlpha(Color.YELLOW, 0.5);
|
|
932
|
+
var _highlightColor = Color.fromCssColorString("#33b1ff").withAlpha(0.5);
|
|
933
|
+
var STORE_COLOR_PREFIX = "_storeColor_";
|
|
934
|
+
function getStoreKey(key) {
|
|
935
|
+
return STORE_COLOR_PREFIX + key;
|
|
936
|
+
}
|
|
937
|
+
var STORE_KEY_STATE_PREFIX = "_storeKeyState_";
|
|
938
|
+
function getStoreStateKey(key) {
|
|
939
|
+
return STORE_KEY_STATE_PREFIX + key;
|
|
940
|
+
}
|
|
941
|
+
var LAST_APPLIED_OPACITY_KEY = "_lastAppliedOpacityKey";
|
|
942
|
+
/**
|
|
943
|
+
* Returns a color property from a graphic.
|
|
944
|
+
* This will turn materials properties into colors before returning them.
|
|
945
|
+
* @param viewer
|
|
946
|
+
* @param prop
|
|
947
|
+
* @returns
|
|
948
|
+
*/
|
|
949
|
+
function getCesiumColorValue(viewer, prop) {
|
|
950
|
+
if (!prop) {
|
|
951
|
+
return Color.WHITE;
|
|
536
952
|
}
|
|
537
953
|
if (prop.getValue) {
|
|
538
954
|
prop = prop.getValue(viewer.scene.lastRenderTime);
|
|
@@ -6540,7 +6956,6 @@ function updateEntity(viewer, entityId, register) {
|
|
|
6540
6956
|
if (visible == null) {
|
|
6541
6957
|
visible = getShowState(rego);
|
|
6542
6958
|
}
|
|
6543
|
-
console.log("entityId", rego.entityId, "visible", visible, "overrideShow", rego.overrideShow);
|
|
6544
6959
|
updateEntityShow(viewer, rego, visible);
|
|
6545
6960
|
if (rego.best) {
|
|
6546
6961
|
var isLabelled = register.GetIsLabelled({
|
|
@@ -13434,7 +13849,7 @@ var DataSourceStaticKmlManager;
|
|
|
13434
13849
|
configurable: true
|
|
13435
13850
|
});
|
|
13436
13851
|
Manager.prototype.Init = function () {
|
|
13437
|
-
var
|
|
13852
|
+
var _this = this;
|
|
13438
13853
|
var files = this.item.KML;
|
|
13439
13854
|
if (!files) {
|
|
13440
13855
|
return;
|
|
@@ -13442,31 +13857,47 @@ var DataSourceStaticKmlManager;
|
|
|
13442
13857
|
if (!Array.isArray(files)) {
|
|
13443
13858
|
files = [files];
|
|
13444
13859
|
}
|
|
13445
|
-
|
|
13446
|
-
var file
|
|
13447
|
-
var
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13860
|
+
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
13861
|
+
var api, i, file, fileId, externalURL, fileUrl, source;
|
|
13862
|
+
var _a;
|
|
13863
|
+
return __generator(this, function (_b) {
|
|
13864
|
+
switch (_b.label) {
|
|
13865
|
+
case 0:
|
|
13866
|
+
api = this.apiGetter.getApi();
|
|
13867
|
+
return [4 /*yield*/, api.Loading];
|
|
13868
|
+
case 1:
|
|
13869
|
+
_b.sent();
|
|
13870
|
+
if (this.disposed) {
|
|
13871
|
+
return [2 /*return*/];
|
|
13872
|
+
}
|
|
13873
|
+
for (i = 0; i < files.length; i++) {
|
|
13874
|
+
file = files[i];
|
|
13875
|
+
fileId = (_a = file === null || file === void 0 ? void 0 : file.ClientFile) === null || _a === void 0 ? void 0 : _a.ID;
|
|
13876
|
+
externalURL = file === null || file === void 0 ? void 0 : file.fileUrl;
|
|
13877
|
+
if (!fileId && !externalURL) {
|
|
13878
|
+
continue;
|
|
13879
|
+
}
|
|
13880
|
+
fileUrl = void 0;
|
|
13881
|
+
if (fileId) {
|
|
13882
|
+
fileUrl = ClientFile.GetUrl({
|
|
13883
|
+
api: api,
|
|
13884
|
+
fileId: fileId,
|
|
13885
|
+
viaCdn: true
|
|
13886
|
+
});
|
|
13887
|
+
}
|
|
13888
|
+
else if (externalURL) {
|
|
13889
|
+
fileUrl = externalURL;
|
|
13890
|
+
}
|
|
13891
|
+
source = new KmlDataSource();
|
|
13892
|
+
source.load(fileUrl);
|
|
13893
|
+
this.viewer.dataSources.add(source);
|
|
13894
|
+
this.dataSources.push(source);
|
|
13895
|
+
this.viewer.scene.requestRender();
|
|
13896
|
+
}
|
|
13897
|
+
return [2 /*return*/];
|
|
13898
|
+
}
|
|
13899
|
+
});
|
|
13900
|
+
}); })();
|
|
13470
13901
|
};
|
|
13471
13902
|
Manager.prototype.Dispose = function () {
|
|
13472
13903
|
var _a;
|
|
@@ -20976,633 +21407,217 @@ function renderNavigator(iteration, params, bookmark, view, getters) {
|
|
|
20976
21407
|
for (i = 0; i < imagery.length; i++) {
|
|
20977
21408
|
layer = imagery[i];
|
|
20978
21409
|
if (layer.tilesetId == ProjectViewTile.EDefaultImagery.BingMapsAerial) {
|
|
20979
|
-
layer.tilesetId = ProjectViewTile.EDefaultImagery.MapboxSatellite;
|
|
20980
|
-
console.warn("Cesium Ion token not set, using mapbox satellite instead of bing maps aerial.");
|
|
20981
|
-
}
|
|
20982
|
-
else if (layer.tilesetId == ProjectViewTile.EDefaultImagery.BingMapsAerialWithLabels) {
|
|
20983
|
-
layer.tilesetId = ProjectViewTile.EDefaultImagery.MapboxSatellite;
|
|
20984
|
-
console.warn("Cesium Ion token not set, using mapbox satellite instead of bing maps aerial with labels.");
|
|
20985
|
-
}
|
|
20986
|
-
else if (layer.tilesetId == ProjectViewTile.EDefaultImagery.BingMapsRoads) {
|
|
20987
|
-
layer.tilesetId = ProjectViewTile.EDefaultImagery.MapBoxStreets;
|
|
20988
|
-
console.warn("Cesium Ion token not set, using mapbox streets instead of bing maps roads.");
|
|
20989
|
-
}
|
|
20990
|
-
}
|
|
20991
|
-
}
|
|
20992
|
-
}
|
|
20993
|
-
// We don't wait for imageries to load, this does not affect rendering other things.
|
|
20994
|
-
TileRenderEngine.Map.Navigator.Render({
|
|
20995
|
-
apiGetter: params.apiGetter,
|
|
20996
|
-
tiles: imagery,
|
|
20997
|
-
viewer: params.manager.Viewer,
|
|
20998
|
-
});
|
|
20999
|
-
legacyRelationIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedEntityRelations;
|
|
21000
|
-
if (!legacyRelationIds) {
|
|
21001
|
-
legacyRelationIds = [];
|
|
21002
|
-
}
|
|
21003
|
-
relations = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedRelations;
|
|
21004
|
-
if (!relations) {
|
|
21005
|
-
relations = [];
|
|
21006
|
-
}
|
|
21007
|
-
viewer.scene.requestRender();
|
|
21008
|
-
curEnabled = params.manager.GetEnabledItemIds();
|
|
21009
|
-
newItemIds = (_5 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _5 !== void 0 ? _5 : [];
|
|
21010
|
-
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
21011
|
-
id = curEnabled_1[_i];
|
|
21012
|
-
shouldRemove = void 0;
|
|
21013
|
-
if (id == RELATION_MENU_ITEM_ID) {
|
|
21014
|
-
rendered = params.manager.GetEnabledItem(id);
|
|
21015
|
-
shouldRemove = false;
|
|
21016
|
-
if (!legacyRelationIds.length && !relations.length) {
|
|
21017
|
-
shouldRemove = true;
|
|
21018
|
-
}
|
|
21019
|
-
// If we're about to render legacy relationships but a non-legacy item is currently enabled then we remove it.
|
|
21020
|
-
else if (legacyRelationIds.length && (rendered === null || rendered === void 0 ? void 0 : rendered.type) != MenuItem.EType.Relations) {
|
|
21021
|
-
shouldRemove = true;
|
|
21022
|
-
}
|
|
21023
|
-
// If we're about to render non-legacy relationships but a legacy item is currently enabled then we remove it.
|
|
21024
|
-
else if (relations.length && (rendered === null || rendered === void 0 ? void 0 : rendered.type) != MenuItem.EType.Relationships) {
|
|
21025
|
-
shouldRemove = true;
|
|
21026
|
-
}
|
|
21027
|
-
}
|
|
21028
|
-
else {
|
|
21029
|
-
shouldRemove = newItemIds.indexOf(id) === -1;
|
|
21030
|
-
}
|
|
21031
|
-
if (shouldRemove) {
|
|
21032
|
-
params.manager.RemoveItemById({
|
|
21033
|
-
menuItemId: id
|
|
21034
|
-
});
|
|
21035
|
-
}
|
|
21036
|
-
}
|
|
21037
|
-
if (!bookmark) return [3 /*break*/, 15];
|
|
21038
|
-
return [4 /*yield*/, MenuItemCreator.RenderBookmarkItems({
|
|
21039
|
-
getters: params.getters,
|
|
21040
|
-
manager: params.manager,
|
|
21041
|
-
view: view,
|
|
21042
|
-
bookmark: bookmark
|
|
21043
|
-
})];
|
|
21044
|
-
case 14:
|
|
21045
|
-
_8.sent();
|
|
21046
|
-
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21047
|
-
return [2 /*return*/];
|
|
21048
|
-
}
|
|
21049
|
-
_8.label = 15;
|
|
21050
|
-
case 15:
|
|
21051
|
-
if (legacyRelationIds.length || relations.length) {
|
|
21052
|
-
if (relations.length) {
|
|
21053
|
-
menuItem = {
|
|
21054
|
-
id: RELATION_MENU_ITEM_ID,
|
|
21055
|
-
Caption: "Entity relations",
|
|
21056
|
-
relations: relations,
|
|
21057
|
-
Type: MenuItem.EType.Relationships
|
|
21058
|
-
};
|
|
21059
|
-
params.manager.RenderItem({
|
|
21060
|
-
getters: params.getters,
|
|
21061
|
-
item: menuItem
|
|
21062
|
-
});
|
|
21063
|
-
}
|
|
21064
|
-
else if (legacyRelationIds.length) {
|
|
21065
|
-
menuItem = {
|
|
21066
|
-
id: RELATION_MENU_ITEM_ID,
|
|
21067
|
-
Caption: "Entity relations",
|
|
21068
|
-
BruceEntity: {
|
|
21069
|
-
EntityIds: legacyRelationIds
|
|
21070
|
-
},
|
|
21071
|
-
Type: MenuItem.EType.Relations
|
|
21072
|
-
};
|
|
21073
|
-
params.manager.RenderItem({
|
|
21074
|
-
getters: params.getters,
|
|
21075
|
-
item: menuItem
|
|
21076
|
-
});
|
|
21077
|
-
}
|
|
21078
|
-
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21079
|
-
return [2 /*return*/];
|
|
21080
|
-
}
|
|
21081
|
-
}
|
|
21082
|
-
gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
|
|
21083
|
-
if (gOcclusion == null) {
|
|
21084
|
-
gOcclusion = (_6 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _6 === void 0 ? void 0 : _6.groundOcclusion;
|
|
21085
|
-
}
|
|
21086
|
-
if (gOcclusion == null) {
|
|
21087
|
-
// TODO: Need global default.
|
|
21088
|
-
gOcclusion = true;
|
|
21089
|
-
}
|
|
21090
|
-
scene.globe.depthTestAgainstTerrain = Boolean(gOcclusion);
|
|
21091
|
-
return [2 /*return*/];
|
|
21092
|
-
}
|
|
21093
|
-
});
|
|
21094
|
-
});
|
|
21095
|
-
}
|
|
21096
|
-
var ViewRenderEngine;
|
|
21097
|
-
(function (ViewRenderEngine) {
|
|
21098
|
-
function Render(params) {
|
|
21099
|
-
var _a;
|
|
21100
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
21101
|
-
var iteration, api, view, _b, bookmark, bookmarkId, _c, version, bWidget;
|
|
21102
|
-
return __generator(this, function (_d) {
|
|
21103
|
-
switch (_d.label) {
|
|
21104
|
-
case 0:
|
|
21105
|
-
if (!params.manager && params.viewer) {
|
|
21106
|
-
params.manager = ViewerUtils.GetManager({
|
|
21107
|
-
viewer: params.viewer,
|
|
21108
|
-
createIfMissing: true
|
|
21109
|
-
});
|
|
21110
|
-
}
|
|
21111
|
-
else if (!params.viewer && params.manager) {
|
|
21112
|
-
params.viewer = params.manager.Viewer;
|
|
21113
|
-
}
|
|
21114
|
-
iteration = newIteration$1(params.viewer);
|
|
21115
|
-
if (!params.getters) {
|
|
21116
|
-
params.getters = ENVIRONMENT.Api();
|
|
21117
|
-
}
|
|
21118
|
-
if (params.apiGetter && !params.getters) {
|
|
21119
|
-
console.warn("ViewRenderEngine.Render(): Please pass getters instead of apiGetter. This is now deprecated due to needing access to other kinds of apis.");
|
|
21120
|
-
}
|
|
21121
|
-
else if (!params.apiGetter) {
|
|
21122
|
-
params.apiGetter = params.getters.GetBruceGetter();
|
|
21123
|
-
}
|
|
21124
|
-
api = params.getters.GetBruceApi();
|
|
21125
|
-
if (!params.view) return [3 /*break*/, 1];
|
|
21126
|
-
_b = params.view;
|
|
21127
|
-
return [3 /*break*/, 3];
|
|
21128
|
-
case 1: return [4 /*yield*/, ProjectView.Get({
|
|
21129
|
-
api: api,
|
|
21130
|
-
viewId: params.viewId
|
|
21131
|
-
})];
|
|
21132
|
-
case 2:
|
|
21133
|
-
_b = (_d.sent()).view;
|
|
21134
|
-
_d.label = 3;
|
|
21135
|
-
case 3:
|
|
21136
|
-
view = _b;
|
|
21137
|
-
bookmark = params.bookmark;
|
|
21138
|
-
if (!!bookmark) return [3 /*break*/, 7];
|
|
21139
|
-
bookmarkId = params.bookmarkId;
|
|
21140
|
-
if (!bookmarkId) {
|
|
21141
|
-
bookmarkId = view.DefaultUISlideID;
|
|
21142
|
-
}
|
|
21143
|
-
if (!bookmarkId) return [3 /*break*/, 5];
|
|
21144
|
-
return [4 /*yield*/, ProjectViewBookmark.Get({
|
|
21145
|
-
api: api,
|
|
21146
|
-
viewId: params.viewId,
|
|
21147
|
-
bookmarkId: bookmarkId
|
|
21148
|
-
})];
|
|
21149
|
-
case 4:
|
|
21150
|
-
_c = (_d.sent()).bookmark;
|
|
21151
|
-
return [3 /*break*/, 6];
|
|
21152
|
-
case 5:
|
|
21153
|
-
_c = null;
|
|
21154
|
-
_d.label = 6;
|
|
21155
|
-
case 6:
|
|
21156
|
-
bookmark = _c;
|
|
21157
|
-
_d.label = 7;
|
|
21158
|
-
case 7:
|
|
21159
|
-
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21160
|
-
return [2 /*return*/];
|
|
21161
|
-
}
|
|
21162
|
-
version = view.DataVersion;
|
|
21163
|
-
if (!(version == 1)) return [3 /*break*/, 9];
|
|
21164
|
-
return [4 /*yield*/, renderLegacyNavigator(iteration, params, bookmark, view)];
|
|
21165
|
-
case 8:
|
|
21166
|
-
_d.sent();
|
|
21167
|
-
return [3 /*break*/, 11];
|
|
21168
|
-
case 9: return [4 /*yield*/, renderNavigator(iteration, params, bookmark, view, params.getters)];
|
|
21169
|
-
case 10:
|
|
21170
|
-
_d.sent();
|
|
21171
|
-
_d.label = 11;
|
|
21172
|
-
case 11:
|
|
21173
|
-
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21174
|
-
return [2 /*return*/];
|
|
21175
|
-
}
|
|
21176
|
-
bWidget = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_BOOKMARKS_WIDGET_KEY];
|
|
21177
|
-
if (bWidget) {
|
|
21178
|
-
bWidget.ViewId = params.viewId ? params.viewId : view === null || view === void 0 ? void 0 : view.ID;
|
|
21179
|
-
bWidget.LastEnabledBookmarkId = params.bookmarkId ? params.bookmarkId : bookmark === null || bookmark === void 0 ? void 0 : bookmark.ID;
|
|
21180
|
-
}
|
|
21181
|
-
return [2 /*return*/];
|
|
21182
|
-
}
|
|
21183
|
-
});
|
|
21184
|
-
});
|
|
21185
|
-
}
|
|
21186
|
-
ViewRenderEngine.Render = Render;
|
|
21187
|
-
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
21188
|
-
|
|
21189
|
-
var TIME_LAG = 300;
|
|
21190
|
-
var POSITION_CHECK_TIMER = 950;
|
|
21191
|
-
var DEFAULT_GROUNDED_HEIGHT = 300;
|
|
21192
|
-
var MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
|
|
21193
|
-
var NET_STEP_PERCENT = 5;
|
|
21194
|
-
var BORDER_STEPS = 3;
|
|
21195
|
-
var ESearchStatus;
|
|
21196
|
-
(function (ESearchStatus) {
|
|
21197
|
-
ESearchStatus[ESearchStatus["LocationFound"] = 1] = "LocationFound";
|
|
21198
|
-
ESearchStatus[ESearchStatus["LocationChanged"] = 2] = "LocationChanged";
|
|
21199
|
-
ESearchStatus[ESearchStatus["LocationMissing"] = 3] = "LocationMissing";
|
|
21200
|
-
})(ESearchStatus || (ESearchStatus = {}));
|
|
21201
|
-
/**
|
|
21202
|
-
* @param viewer
|
|
21203
|
-
* @param center the previously calculated center of the view area. This is in degrees.
|
|
21204
|
-
* @returns
|
|
21205
|
-
*/
|
|
21206
|
-
function netScanViewForBoundaries(viewer, center) {
|
|
21207
|
-
var maxLong = -2 * Math.PI;
|
|
21208
|
-
var minLong = 2 * Math.PI;
|
|
21209
|
-
var maxLat = -2 * Math.PI;
|
|
21210
|
-
var minLat = 2 * Math.PI;
|
|
21211
|
-
var found = 0;
|
|
21212
|
-
var updateMinMax = function (lon, lat) {
|
|
21213
|
-
// Check to see if given lon/lat (in radians) are within valid range.
|
|
21214
|
-
if (lon < -Math.PI || lon > Math.PI || lat < -Math.PI / 2 || lat > Math.PI / 2) {
|
|
21215
|
-
return;
|
|
21216
|
-
}
|
|
21217
|
-
maxLong = Math.max(maxLong, lon);
|
|
21218
|
-
maxLat = Math.max(maxLat, lat);
|
|
21219
|
-
minLong = Math.min(minLong, lon);
|
|
21220
|
-
minLat = Math.min(minLat, lat);
|
|
21221
|
-
};
|
|
21222
|
-
var updateMinMaxForPoint = function (stepX, stepY) {
|
|
21223
|
-
var x = Math.round(0 + (viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
|
|
21224
|
-
var y = Math.round(0 + (viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
|
|
21225
|
-
var winPos = new Cartesian2(x, y);
|
|
21226
|
-
try {
|
|
21227
|
-
var intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
|
|
21228
|
-
if (intersection) {
|
|
21229
|
-
var point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
|
|
21230
|
-
updateMinMax(point.longitude, point.latitude);
|
|
21231
|
-
found++;
|
|
21232
|
-
}
|
|
21233
|
-
}
|
|
21234
|
-
catch (e) {
|
|
21235
|
-
console.error(e);
|
|
21236
|
-
}
|
|
21237
|
-
};
|
|
21238
|
-
// Outer circle.
|
|
21239
|
-
updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
|
|
21240
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
|
|
21241
|
-
updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
21242
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
21243
|
-
// Inner circle.
|
|
21244
|
-
updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
21245
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
21246
|
-
updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
21247
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
21248
|
-
// If we failed to find intersections and a center-point was provided, then we can use that to make some guesses.
|
|
21249
|
-
// This happens if terrain is hidden, and there's nothing to intersect with.
|
|
21250
|
-
if (center && found <= 0) {
|
|
21251
|
-
updateMinMax(Math$1.toRadians(center.longitude), Math$1.toRadians(center.latitude));
|
|
21252
|
-
found += 1;
|
|
21253
|
-
// We'll use the camera height as an indicator on size of the rect.
|
|
21254
|
-
var size = viewer.camera.positionCartographic.height;
|
|
21255
|
-
var pitch = viewer.camera.pitch;
|
|
21256
|
-
var distance = size / Math.tan(pitch);
|
|
21257
|
-
var p1 = _offsetPoint({
|
|
21258
|
-
altitude: center.altitude,
|
|
21259
|
-
latitude: center.latitude,
|
|
21260
|
-
longitude: center.longitude
|
|
21261
|
-
}, distance, 45);
|
|
21262
|
-
var p2 = _offsetPoint({
|
|
21263
|
-
altitude: center.altitude,
|
|
21264
|
-
latitude: center.latitude,
|
|
21265
|
-
longitude: center.longitude
|
|
21266
|
-
}, -distance, 45);
|
|
21267
|
-
if (p1 === null || p1 === void 0 ? void 0 : p1.latitude) {
|
|
21268
|
-
updateMinMax(Math$1.toRadians(p1.longitude), Math$1.toRadians(p1.latitude));
|
|
21269
|
-
}
|
|
21270
|
-
if (p2 === null || p2 === void 0 ? void 0 : p2.latitude) {
|
|
21271
|
-
updateMinMax(Math$1.toRadians(p2.longitude), Math$1.toRadians(p2.latitude));
|
|
21272
|
-
}
|
|
21273
|
-
}
|
|
21274
|
-
if (found > 0) {
|
|
21275
|
-
var viewRect = {
|
|
21276
|
-
east: maxLong,
|
|
21277
|
-
west: minLong,
|
|
21278
|
-
north: maxLat,
|
|
21279
|
-
south: minLat
|
|
21280
|
-
};
|
|
21281
|
-
return viewRect;
|
|
21282
|
-
}
|
|
21283
|
-
return null;
|
|
21284
|
-
}
|
|
21285
|
-
/**
|
|
21286
|
-
* Moves a given point by a given distance towards a heading.
|
|
21287
|
-
* @param point in degrees.
|
|
21288
|
-
* @param distance in meters.
|
|
21289
|
-
* @param heading in degrees.
|
|
21290
|
-
* @returns
|
|
21291
|
-
*/
|
|
21292
|
-
function _offsetPoint(point, distance, heading) {
|
|
21293
|
-
// Radius of earth.
|
|
21294
|
-
var radius = 6371e3;
|
|
21295
|
-
var δ = distance / radius;
|
|
21296
|
-
var θ = Math$1.toRadians(heading);
|
|
21297
|
-
var φ1 = Math$1.toRadians(point.latitude);
|
|
21298
|
-
var λ1 = Math$1.toRadians(point.longitude);
|
|
21299
|
-
var sinφ2 = Math.sin(φ1) * Math.cos(δ) + Math.cos(φ1) * Math.sin(δ) * Math.cos(θ);
|
|
21300
|
-
var φ2 = Math.asin(sinφ2);
|
|
21301
|
-
var y = Math.sin(θ) * Math.sin(δ) * Math.cos(φ1);
|
|
21302
|
-
var x = Math.cos(δ) - Math.sin(φ1) * sinφ2;
|
|
21303
|
-
var λ2 = λ1 + Math.atan2(y, x);
|
|
21304
|
-
return {
|
|
21305
|
-
altitude: point.altitude,
|
|
21306
|
-
latitude: Math$1.toDegrees(φ2),
|
|
21307
|
-
longitude: Math$1.toDegrees(λ2)
|
|
21308
|
-
};
|
|
21309
|
-
}
|
|
21310
|
-
/**
|
|
21311
|
-
* @param pos3d
|
|
21312
|
-
* @param distance in meters
|
|
21313
|
-
* @param heading in degrees
|
|
21314
|
-
* @returns
|
|
21315
|
-
*/
|
|
21316
|
-
function _offsetPos3d(pos3d, distance, heading) {
|
|
21317
|
-
var carto = Cartographic.fromCartesian(pos3d);
|
|
21318
|
-
var newCarto = _offsetPoint({
|
|
21319
|
-
altitude: carto.height,
|
|
21320
|
-
latitude: Math$1.toDegrees(carto.latitude),
|
|
21321
|
-
longitude: Math$1.toDegrees(carto.longitude)
|
|
21322
|
-
}, distance, heading);
|
|
21323
|
-
return Cartesian3.fromDegrees(newCarto.longitude, newCarto.latitude, newCarto.altitude);
|
|
21324
|
-
}
|
|
21325
|
-
/**
|
|
21326
|
-
* Returns the intersection of the camera ray with the ground.
|
|
21327
|
-
* @param viewer
|
|
21328
|
-
* @param screenPos
|
|
21329
|
-
* @returns
|
|
21330
|
-
*/
|
|
21331
|
-
function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
|
|
21332
|
-
var ray = viewer.camera.getPickRay(screenPos);
|
|
21333
|
-
var intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
21334
|
-
if (intersection) {
|
|
21335
|
-
return intersection;
|
|
21336
|
-
}
|
|
21337
|
-
return null;
|
|
21338
|
-
}
|
|
21339
|
-
/**
|
|
21340
|
-
* Returns the intersection of the camera ray with the ground.
|
|
21341
|
-
* If no intersection is found, then a "guess" is made based on the camera angle and height.
|
|
21342
|
-
* The guess is made at the center of the view! It ignores the screenPos.
|
|
21343
|
-
* @param viewer
|
|
21344
|
-
* @param screenPos
|
|
21345
|
-
* @returns
|
|
21346
|
-
*/
|
|
21347
|
-
function getGroundCenterOfCameraRay(viewer, screenPos) {
|
|
21348
|
-
var _a, _b;
|
|
21349
|
-
var ray = viewer.camera.getPickRay(screenPos);
|
|
21350
|
-
var intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
21351
|
-
if (intersection) {
|
|
21352
|
-
return intersection;
|
|
21353
|
-
}
|
|
21354
|
-
// The fallback will be to "guess" where the intersection might be.
|
|
21355
|
-
// This happens if terrain is hidden, and there's nothing to intersect with.
|
|
21356
|
-
// We will use the camera angle + camera height.
|
|
21357
|
-
// Eg: if camera is looking straight down and is 100 meters above the ground, then the intersection will be 100 meters below the camera.
|
|
21358
|
-
var cameraHeight = viewer.camera.positionCartographic.height;
|
|
21359
|
-
if (!isNaN(cameraHeight) && cameraHeight != null && ((_b = (_a = viewer.camera) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.clone)) {
|
|
21360
|
-
var cameraPos3d = viewer.camera.position.clone();
|
|
21361
|
-
var pitch = viewer.camera.pitch;
|
|
21362
|
-
var distance = cameraHeight / Math.tan(pitch);
|
|
21363
|
-
return _offsetPos3d(cameraPos3d, -distance, Math$1.toDegrees(viewer.camera.heading));
|
|
21364
|
-
}
|
|
21365
|
-
return null;
|
|
21366
|
-
}
|
|
21367
|
-
function areBoundsEqual(a, b) {
|
|
21368
|
-
return a.north == b.north && a.south == b.south && a.east == b.east && a.west == b.west;
|
|
21369
|
-
}
|
|
21370
|
-
function arePosEqual(a, b) {
|
|
21371
|
-
return a.latitude == b.latitude && a.longitude == b.longitude;
|
|
21372
|
-
}
|
|
21373
|
-
var CesiumViewMonitor;
|
|
21374
|
-
(function (CesiumViewMonitor$$1) {
|
|
21375
|
-
/**
|
|
21376
|
-
* Monitors and emits events when the Cesium view changes.
|
|
21377
|
-
*/
|
|
21378
|
-
var Monitor = /** @class */ (function () {
|
|
21379
|
-
function Monitor(viewer) {
|
|
21380
|
-
var _this = this;
|
|
21381
|
-
this.target = null;
|
|
21382
|
-
this.bounds = null;
|
|
21383
|
-
this.disposed = false;
|
|
21384
|
-
this.updatedEvent = null;
|
|
21385
|
-
this.entity = null;
|
|
21386
|
-
this.updating = false;
|
|
21387
|
-
this.viewer = viewer;
|
|
21388
|
-
this.tryEmitUpdate();
|
|
21389
|
-
this.checkInterval = setInterval(function () {
|
|
21390
|
-
_this.updateQueue();
|
|
21391
|
-
}, POSITION_CHECK_TIMER);
|
|
21392
|
-
}
|
|
21393
|
-
Object.defineProperty(Monitor.prototype, "Disposed", {
|
|
21394
|
-
get: function () {
|
|
21395
|
-
return this.disposed;
|
|
21396
|
-
},
|
|
21397
|
-
enumerable: false,
|
|
21398
|
-
configurable: true
|
|
21399
|
-
});
|
|
21400
|
-
Monitor.prototype.createEntity = function () {
|
|
21401
|
-
var _this = this;
|
|
21402
|
-
if (this.entity) {
|
|
21403
|
-
return;
|
|
21404
|
-
}
|
|
21405
|
-
this.entity = this.viewer.entities.add({
|
|
21406
|
-
position: new CallbackProperty(function () {
|
|
21407
|
-
return _this.target ? Cartesian3.fromDegrees(_this.target.longitude, _this.target.latitude) : null;
|
|
21408
|
-
}, false),
|
|
21409
|
-
point: {
|
|
21410
|
-
pixelSize: 8,
|
|
21411
|
-
color: Color.ORANGE,
|
|
21412
|
-
heightReference: HeightReference.NONE
|
|
21413
|
-
},
|
|
21414
|
-
rectangle: {
|
|
21415
|
-
coordinates: new CallbackProperty(function () {
|
|
21416
|
-
return _this.bounds ? Rectangle.fromDegrees(_this.bounds.west, _this.bounds.south, _this.bounds.east, _this.bounds.north) : null;
|
|
21417
|
-
}, false),
|
|
21418
|
-
material: Color.fromCssColorString('#ff0000').withAlpha(0.4),
|
|
21419
|
-
zIndex: 1,
|
|
21420
|
-
heightReference: HeightReference.NONE
|
|
21421
|
-
}
|
|
21422
|
-
});
|
|
21423
|
-
};
|
|
21424
|
-
Monitor.prototype.destroyEntity = function () {
|
|
21425
|
-
if (this.entity && this.viewer.entities.contains(this.entity)) {
|
|
21426
|
-
this.viewer.entities.remove(this.entity);
|
|
21427
|
-
}
|
|
21428
|
-
this.entity = null;
|
|
21429
|
-
};
|
|
21430
|
-
Monitor.prototype.Updated = function () {
|
|
21431
|
-
if (!this.updatedEvent) {
|
|
21432
|
-
this.updatedEvent = new BruceEvent();
|
|
21433
|
-
}
|
|
21434
|
-
return this.updatedEvent;
|
|
21435
|
-
};
|
|
21436
|
-
Monitor.prototype.GetBounds = function () {
|
|
21437
|
-
return this.bounds;
|
|
21438
|
-
};
|
|
21439
|
-
Monitor.prototype.GetTarget = function () {
|
|
21440
|
-
return this.target;
|
|
21441
|
-
};
|
|
21442
|
-
Monitor.prototype.DoUpdate = function () {
|
|
21443
|
-
this.tryEmitUpdate();
|
|
21444
|
-
};
|
|
21445
|
-
Monitor.prototype.Dispose = function () {
|
|
21446
|
-
if (this.disposed) {
|
|
21447
|
-
return;
|
|
21448
|
-
}
|
|
21449
|
-
this.disposed = true;
|
|
21450
|
-
clearInterval(this.checkInterval);
|
|
21451
|
-
this.destroyEntity();
|
|
21452
|
-
};
|
|
21453
|
-
Monitor.prototype.tryDoUpdate = function () {
|
|
21454
|
-
var _a;
|
|
21455
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
21456
|
-
var viewRect, center, camera, terrData, cameraPosition, terrHeight, viewRectRad, windowPosition, intersection, point, viewRectRad, centerLong, centerLat;
|
|
21457
|
-
return __generator(this, function (_b) {
|
|
21458
|
-
switch (_b.label) {
|
|
21459
|
-
case 0:
|
|
21460
|
-
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
21461
|
-
this.Dispose();
|
|
21462
|
-
return [2 /*return*/, ESearchStatus.LocationMissing];
|
|
21463
|
-
}
|
|
21464
|
-
viewRect = null;
|
|
21465
|
-
center = null;
|
|
21466
|
-
camera = this.viewer.camera;
|
|
21467
|
-
return [4 /*yield*/, DrawingUtils.GetTerrainHeight({
|
|
21468
|
-
pos3d: camera.position,
|
|
21469
|
-
viewer: this.viewer
|
|
21470
|
-
})];
|
|
21471
|
-
case 1:
|
|
21472
|
-
terrData = _b.sent();
|
|
21473
|
-
cameraPosition = this.viewer.camera.positionCartographic;
|
|
21474
|
-
terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
|
|
21475
|
-
// We are almost at the ground, screw horizon, just load around.
|
|
21476
|
-
if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
21477
|
-
// View area calculation.
|
|
21478
|
-
viewRect = {};
|
|
21479
|
-
viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
21480
|
-
if (viewRectRad &&
|
|
21481
|
-
viewRectRad.east &&
|
|
21482
|
-
viewRectRad.west &&
|
|
21483
|
-
viewRectRad.north &&
|
|
21484
|
-
viewRectRad.south) {
|
|
21485
|
-
viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
21486
|
-
viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
21487
|
-
viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
21488
|
-
viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
21489
|
-
}
|
|
21490
|
-
else {
|
|
21491
|
-
viewRect.east = cameraPosition.longitude;
|
|
21492
|
-
viewRect.west = cameraPosition.longitude;
|
|
21493
|
-
viewRect.south = cameraPosition.latitude;
|
|
21494
|
-
viewRect.north = cameraPosition.latitude;
|
|
21495
|
-
}
|
|
21496
|
-
center = {};
|
|
21497
|
-
center.latitude = Math$1.toDegrees(camera.positionCartographic.latitude);
|
|
21498
|
-
center.longitude = Math$1.toDegrees(camera.positionCartographic.longitude);
|
|
21499
|
-
}
|
|
21500
|
-
else {
|
|
21501
|
-
windowPosition = new Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
|
|
21502
|
-
intersection = getGroundCenterOfCameraRay(this.viewer, windowPosition);
|
|
21503
|
-
point = null;
|
|
21504
|
-
if (intersection) {
|
|
21505
|
-
point = Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
21506
|
-
}
|
|
21507
|
-
if (point) {
|
|
21508
|
-
center = {};
|
|
21509
|
-
center.latitude = Math$1.toDegrees(point.latitude);
|
|
21510
|
-
center.longitude = Math$1.toDegrees(point.longitude);
|
|
21511
|
-
viewRectRad = netScanViewForBoundaries(this.viewer, center);
|
|
21512
|
-
if (viewRectRad) {
|
|
21513
|
-
viewRect = {};
|
|
21514
|
-
viewRect.east = Math$1.toDegrees(viewRectRad.east);
|
|
21515
|
-
viewRect.west = Math$1.toDegrees(viewRectRad.west);
|
|
21516
|
-
viewRect.south = Math$1.toDegrees(viewRectRad.south);
|
|
21517
|
-
viewRect.north = Math$1.toDegrees(viewRectRad.north);
|
|
21518
|
-
}
|
|
21519
|
-
}
|
|
21520
|
-
}
|
|
21521
|
-
// Minimal field of view.
|
|
21522
|
-
if (viewRect) {
|
|
21523
|
-
centerLong = (viewRect.east + viewRect.west) / 2;
|
|
21524
|
-
centerLat = (viewRect.north + viewRect.south) / 2;
|
|
21525
|
-
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
21526
|
-
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
21527
|
-
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
21528
|
-
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
21529
|
-
viewRect.alt = (_a = this.viewer.scene.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height;
|
|
21530
|
-
}
|
|
21531
|
-
if (center && viewRect) {
|
|
21532
|
-
if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
|
|
21533
|
-
(!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
|
|
21534
|
-
this.target = center;
|
|
21535
|
-
this.bounds = viewRect;
|
|
21536
|
-
return [2 /*return*/, ESearchStatus.LocationChanged];
|
|
21410
|
+
layer.tilesetId = ProjectViewTile.EDefaultImagery.MapboxSatellite;
|
|
21411
|
+
console.warn("Cesium Ion token not set, using mapbox satellite instead of bing maps aerial.");
|
|
21412
|
+
}
|
|
21413
|
+
else if (layer.tilesetId == ProjectViewTile.EDefaultImagery.BingMapsAerialWithLabels) {
|
|
21414
|
+
layer.tilesetId = ProjectViewTile.EDefaultImagery.MapboxSatellite;
|
|
21415
|
+
console.warn("Cesium Ion token not set, using mapbox satellite instead of bing maps aerial with labels.");
|
|
21416
|
+
}
|
|
21417
|
+
else if (layer.tilesetId == ProjectViewTile.EDefaultImagery.BingMapsRoads) {
|
|
21418
|
+
layer.tilesetId = ProjectViewTile.EDefaultImagery.MapBoxStreets;
|
|
21419
|
+
console.warn("Cesium Ion token not set, using mapbox streets instead of bing maps roads.");
|
|
21537
21420
|
}
|
|
21538
|
-
return [2 /*return*/, ESearchStatus.LocationFound];
|
|
21539
21421
|
}
|
|
21540
|
-
|
|
21422
|
+
}
|
|
21541
21423
|
}
|
|
21542
|
-
|
|
21543
|
-
|
|
21544
|
-
|
|
21545
|
-
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21424
|
+
// We don't wait for imageries to load, this does not affect rendering other things.
|
|
21425
|
+
TileRenderEngine.Map.Navigator.Render({
|
|
21426
|
+
apiGetter: params.apiGetter,
|
|
21427
|
+
tiles: imagery,
|
|
21428
|
+
viewer: params.manager.Viewer,
|
|
21429
|
+
});
|
|
21430
|
+
legacyRelationIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedEntityRelations;
|
|
21431
|
+
if (!legacyRelationIds) {
|
|
21432
|
+
legacyRelationIds = [];
|
|
21433
|
+
}
|
|
21434
|
+
relations = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedRelations;
|
|
21435
|
+
if (!relations) {
|
|
21436
|
+
relations = [];
|
|
21437
|
+
}
|
|
21438
|
+
viewer.scene.requestRender();
|
|
21439
|
+
curEnabled = params.manager.GetEnabledItemIds();
|
|
21440
|
+
newItemIds = (_5 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _5 !== void 0 ? _5 : [];
|
|
21441
|
+
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
21442
|
+
id = curEnabled_1[_i];
|
|
21443
|
+
shouldRemove = void 0;
|
|
21444
|
+
if (id == RELATION_MENU_ITEM_ID) {
|
|
21445
|
+
rendered = params.manager.GetEnabledItem(id);
|
|
21446
|
+
shouldRemove = false;
|
|
21447
|
+
if (!legacyRelationIds.length && !relations.length) {
|
|
21448
|
+
shouldRemove = true;
|
|
21554
21449
|
}
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
|
|
21558
|
-
_b.trys.push([1, 3, , 4]);
|
|
21559
|
-
return [4 /*yield*/, this.tryDoUpdate()];
|
|
21560
|
-
case 2:
|
|
21561
|
-
searchResult = _b.sent();
|
|
21562
|
-
if (searchResult == ESearchStatus.LocationChanged) {
|
|
21563
|
-
interest = {
|
|
21564
|
-
bounds: this.bounds,
|
|
21565
|
-
target: this.target
|
|
21566
|
-
};
|
|
21567
|
-
// this.createEntity();
|
|
21568
|
-
(_a = this.updatedEvent) === null || _a === void 0 ? void 0 : _a.Trigger(interest);
|
|
21450
|
+
// If we're about to render legacy relationships but a non-legacy item is currently enabled then we remove it.
|
|
21451
|
+
else if (legacyRelationIds.length && (rendered === null || rendered === void 0 ? void 0 : rendered.type) != MenuItem.EType.Relations) {
|
|
21452
|
+
shouldRemove = true;
|
|
21569
21453
|
}
|
|
21570
|
-
|
|
21571
|
-
|
|
21454
|
+
// If we're about to render non-legacy relationships but a legacy item is currently enabled then we remove it.
|
|
21455
|
+
else if (relations.length && (rendered === null || rendered === void 0 ? void 0 : rendered.type) != MenuItem.EType.Relationships) {
|
|
21456
|
+
shouldRemove = true;
|
|
21572
21457
|
}
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
|
|
21580
|
-
|
|
21458
|
+
}
|
|
21459
|
+
else {
|
|
21460
|
+
shouldRemove = newItemIds.indexOf(id) === -1;
|
|
21461
|
+
}
|
|
21462
|
+
if (shouldRemove) {
|
|
21463
|
+
params.manager.RemoveItemById({
|
|
21464
|
+
menuItemId: id
|
|
21465
|
+
});
|
|
21466
|
+
}
|
|
21467
|
+
}
|
|
21468
|
+
if (!bookmark) return [3 /*break*/, 15];
|
|
21469
|
+
return [4 /*yield*/, MenuItemCreator.RenderBookmarkItems({
|
|
21470
|
+
getters: params.getters,
|
|
21471
|
+
manager: params.manager,
|
|
21472
|
+
view: view,
|
|
21473
|
+
bookmark: bookmark
|
|
21474
|
+
})];
|
|
21475
|
+
case 14:
|
|
21476
|
+
_8.sent();
|
|
21477
|
+
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21478
|
+
return [2 /*return*/];
|
|
21479
|
+
}
|
|
21480
|
+
_8.label = 15;
|
|
21481
|
+
case 15:
|
|
21482
|
+
if (legacyRelationIds.length || relations.length) {
|
|
21483
|
+
if (relations.length) {
|
|
21484
|
+
menuItem = {
|
|
21485
|
+
id: RELATION_MENU_ITEM_ID,
|
|
21486
|
+
Caption: "Entity relations",
|
|
21487
|
+
relations: relations,
|
|
21488
|
+
Type: MenuItem.EType.Relationships
|
|
21489
|
+
};
|
|
21490
|
+
params.manager.RenderItem({
|
|
21491
|
+
getters: params.getters,
|
|
21492
|
+
item: menuItem
|
|
21493
|
+
});
|
|
21494
|
+
}
|
|
21495
|
+
else if (legacyRelationIds.length) {
|
|
21496
|
+
menuItem = {
|
|
21497
|
+
id: RELATION_MENU_ITEM_ID,
|
|
21498
|
+
Caption: "Entity relations",
|
|
21499
|
+
BruceEntity: {
|
|
21500
|
+
EntityIds: legacyRelationIds
|
|
21501
|
+
},
|
|
21502
|
+
Type: MenuItem.EType.Relations
|
|
21503
|
+
};
|
|
21504
|
+
params.manager.RenderItem({
|
|
21505
|
+
getters: params.getters,
|
|
21506
|
+
item: menuItem
|
|
21507
|
+
});
|
|
21508
|
+
}
|
|
21509
|
+
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21581
21510
|
return [2 /*return*/];
|
|
21511
|
+
}
|
|
21582
21512
|
}
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
|
|
21589
|
-
|
|
21513
|
+
gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
|
|
21514
|
+
if (gOcclusion == null) {
|
|
21515
|
+
gOcclusion = (_6 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _6 === void 0 ? void 0 : _6.groundOcclusion;
|
|
21516
|
+
}
|
|
21517
|
+
if (gOcclusion == null) {
|
|
21518
|
+
// TODO: Need global default.
|
|
21519
|
+
gOcclusion = true;
|
|
21520
|
+
}
|
|
21521
|
+
scene.globe.depthTestAgainstTerrain = Boolean(gOcclusion);
|
|
21522
|
+
return [2 /*return*/];
|
|
21590
21523
|
}
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
21524
|
+
});
|
|
21525
|
+
});
|
|
21526
|
+
}
|
|
21527
|
+
var ViewRenderEngine;
|
|
21528
|
+
(function (ViewRenderEngine) {
|
|
21529
|
+
function Render(params) {
|
|
21530
|
+
var _a;
|
|
21531
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
21532
|
+
var iteration, api, view, _b, bookmark, bookmarkId, _c, version, bWidget;
|
|
21533
|
+
return __generator(this, function (_d) {
|
|
21534
|
+
switch (_d.label) {
|
|
21535
|
+
case 0:
|
|
21536
|
+
if (!params.manager && params.viewer) {
|
|
21537
|
+
params.manager = ViewerUtils.GetManager({
|
|
21538
|
+
viewer: params.viewer,
|
|
21539
|
+
createIfMissing: true
|
|
21540
|
+
});
|
|
21541
|
+
}
|
|
21542
|
+
else if (!params.viewer && params.manager) {
|
|
21543
|
+
params.viewer = params.manager.Viewer;
|
|
21544
|
+
}
|
|
21545
|
+
iteration = newIteration$1(params.viewer);
|
|
21546
|
+
if (!params.getters) {
|
|
21547
|
+
params.getters = ENVIRONMENT.Api();
|
|
21548
|
+
}
|
|
21549
|
+
if (params.apiGetter && !params.getters) {
|
|
21550
|
+
console.warn("ViewRenderEngine.Render(): Please pass getters instead of apiGetter. This is now deprecated due to needing access to other kinds of apis.");
|
|
21551
|
+
}
|
|
21552
|
+
else if (!params.apiGetter) {
|
|
21553
|
+
params.apiGetter = params.getters.GetBruceGetter();
|
|
21554
|
+
}
|
|
21555
|
+
api = params.getters.GetBruceApi();
|
|
21556
|
+
if (!params.view) return [3 /*break*/, 1];
|
|
21557
|
+
_b = params.view;
|
|
21558
|
+
return [3 /*break*/, 3];
|
|
21559
|
+
case 1: return [4 /*yield*/, ProjectView.Get({
|
|
21560
|
+
api: api,
|
|
21561
|
+
viewId: params.viewId
|
|
21562
|
+
})];
|
|
21563
|
+
case 2:
|
|
21564
|
+
_b = (_d.sent()).view;
|
|
21565
|
+
_d.label = 3;
|
|
21566
|
+
case 3:
|
|
21567
|
+
view = _b;
|
|
21568
|
+
bookmark = params.bookmark;
|
|
21569
|
+
if (!!bookmark) return [3 /*break*/, 7];
|
|
21570
|
+
bookmarkId = params.bookmarkId;
|
|
21571
|
+
if (!bookmarkId) {
|
|
21572
|
+
bookmarkId = view.DefaultUISlideID;
|
|
21573
|
+
}
|
|
21574
|
+
if (!bookmarkId) return [3 /*break*/, 5];
|
|
21575
|
+
return [4 /*yield*/, ProjectViewBookmark.Get({
|
|
21576
|
+
api: api,
|
|
21577
|
+
viewId: params.viewId,
|
|
21578
|
+
bookmarkId: bookmarkId
|
|
21579
|
+
})];
|
|
21580
|
+
case 4:
|
|
21581
|
+
_c = (_d.sent()).bookmark;
|
|
21582
|
+
return [3 /*break*/, 6];
|
|
21583
|
+
case 5:
|
|
21584
|
+
_c = null;
|
|
21585
|
+
_d.label = 6;
|
|
21586
|
+
case 6:
|
|
21587
|
+
bookmark = _c;
|
|
21588
|
+
_d.label = 7;
|
|
21589
|
+
case 7:
|
|
21590
|
+
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21591
|
+
return [2 /*return*/];
|
|
21592
|
+
}
|
|
21593
|
+
version = view.DataVersion;
|
|
21594
|
+
if (!(version == 1)) return [3 /*break*/, 9];
|
|
21595
|
+
return [4 /*yield*/, renderLegacyNavigator(iteration, params, bookmark, view)];
|
|
21596
|
+
case 8:
|
|
21597
|
+
_d.sent();
|
|
21598
|
+
return [3 /*break*/, 11];
|
|
21599
|
+
case 9: return [4 /*yield*/, renderNavigator(iteration, params, bookmark, view, params.getters)];
|
|
21600
|
+
case 10:
|
|
21601
|
+
_d.sent();
|
|
21602
|
+
_d.label = 11;
|
|
21603
|
+
case 11:
|
|
21604
|
+
if (!assertIteration$1(params.viewer, iteration)) {
|
|
21605
|
+
return [2 /*return*/];
|
|
21606
|
+
}
|
|
21607
|
+
bWidget = (_a = params.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_BOOKMARKS_WIDGET_KEY];
|
|
21608
|
+
if (bWidget) {
|
|
21609
|
+
bWidget.ViewId = params.viewId ? params.viewId : view === null || view === void 0 ? void 0 : view.ID;
|
|
21610
|
+
bWidget.LastEnabledBookmarkId = params.bookmarkId ? params.bookmarkId : bookmark === null || bookmark === void 0 ? void 0 : bookmark.ID;
|
|
21611
|
+
}
|
|
21612
|
+
return [2 /*return*/];
|
|
21594
21613
|
}
|
|
21595
|
-
}
|
|
21596
|
-
};
|
|
21597
|
-
|
|
21598
|
-
|
|
21599
|
-
|
|
21600
|
-
return Monitor;
|
|
21601
|
-
}());
|
|
21602
|
-
CesiumViewMonitor$$1.Monitor = Monitor;
|
|
21603
|
-
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
21614
|
+
});
|
|
21615
|
+
});
|
|
21616
|
+
}
|
|
21617
|
+
ViewRenderEngine.Render = Render;
|
|
21618
|
+
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
21604
21619
|
|
|
21605
|
-
var VERSION
|
|
21620
|
+
var VERSION = "3.4.9";
|
|
21606
21621
|
|
|
21607
|
-
export { VERSION
|
|
21622
|
+
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, Draw3dPolygon, Draw3dPolyline };
|
|
21608
21623
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|