bruce-cesium 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-cesium.es5.js +65 -76
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +64 -75
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/rendering/render-managers/render-manager.js +8 -2
- package/dist/lib/rendering/render-managers/render-manager.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +47 -44
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/lib/viewer/viewer-utils.js +10 -30
- package/dist/lib/viewer/viewer-utils.js.map +1 -1
- package/dist/types/viewer/viewer-utils.d.ts +3 -9
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, DelayQueue, Entity as Entity$1, BatchedDataGetter, ObjectUtils, Tileset, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, TilesetExtMapTiles, Camera, MathUtils } from 'bruce-models';
|
|
2
|
-
import { Cartesian2, Cartographic, Math as Math$1,
|
|
2
|
+
import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, OrthographicFrustum, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Matrix4, Cesium3DTileset, EllipsoidGeodesic, createOsmBuildings, Cesium3DTileStyle, Rectangle } from 'cesium';
|
|
3
3
|
|
|
4
4
|
var TIME_LAG = 300;
|
|
5
5
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -230,38 +230,19 @@ var CesiumViewMonitor = /** @class */ (function () {
|
|
|
230
230
|
var ViewerUtils;
|
|
231
231
|
(function (ViewerUtils) {
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* @param container
|
|
236
|
-
* @returns
|
|
233
|
+
* Destroys all the junk that cesium viewer ships with.
|
|
234
|
+
* @param viewer
|
|
237
235
|
*/
|
|
238
|
-
function InitViewer(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
})
|
|
247
|
-
});
|
|
248
|
-
cViewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
249
|
-
cViewer.camera.percentageChanged = 0.05;
|
|
250
|
-
ViewerUtils.DestroyWidget(cViewer.timeline);
|
|
251
|
-
ViewerUtils.DestroyWidget(cViewer.vrButton);
|
|
252
|
-
ViewerUtils.DestroyWidget(cViewer.sceneModePicker);
|
|
253
|
-
ViewerUtils.DestroyWidget(cViewer.homeButton);
|
|
254
|
-
ViewerUtils.DestroyWidget(cViewer.fullscreenButton);
|
|
255
|
-
ViewerUtils.DestroyWidget(cViewer.baseLayerPicker);
|
|
256
|
-
ViewerUtils.StyleContainer(cViewer);
|
|
257
|
-
container._cViewer = cViewer;
|
|
258
|
-
return cViewer;
|
|
236
|
+
function InitViewer(viewer) {
|
|
237
|
+
ViewerUtils.DestroyWidget(viewer.timeline);
|
|
238
|
+
ViewerUtils.DestroyWidget(viewer.vrButton);
|
|
239
|
+
ViewerUtils.DestroyWidget(viewer.sceneModePicker);
|
|
240
|
+
ViewerUtils.DestroyWidget(viewer.homeButton);
|
|
241
|
+
ViewerUtils.DestroyWidget(viewer.fullscreenButton);
|
|
242
|
+
ViewerUtils.DestroyWidget(viewer.baseLayerPicker);
|
|
243
|
+
ViewerUtils.StyleContainer(viewer);
|
|
259
244
|
}
|
|
260
245
|
ViewerUtils.InitViewer = InitViewer;
|
|
261
|
-
function GetViewerFromContainer(container) {
|
|
262
|
-
return container._cViewer;
|
|
263
|
-
}
|
|
264
|
-
ViewerUtils.GetViewerFromContainer = GetViewerFromContainer;
|
|
265
246
|
function DestroyWidget(widget) {
|
|
266
247
|
if (widget && !widget.isDestroyed()) {
|
|
267
248
|
widget.destroy();
|
|
@@ -464,59 +445,62 @@ var EntityUtils;
|
|
|
464
445
|
* @returns
|
|
465
446
|
*/
|
|
466
447
|
function GetPos(viewer, entity) {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
448
|
+
function evaluate() {
|
|
449
|
+
if (entity.location && Carto.ValidateCarto(entity.location)) {
|
|
450
|
+
var location_1 = entity.location;
|
|
451
|
+
return Cartesian3.fromDegrees(Number(location_1.longitude), Number(location_1.latitude), Number(location_1.altitude));
|
|
452
|
+
}
|
|
453
|
+
if (entity.geometry && typeof entity.geometry == "object") {
|
|
454
|
+
var pointStr = entity.geometry.Point;
|
|
455
|
+
if (pointStr && typeof pointStr == "string") {
|
|
456
|
+
var points = Geometry.ParsePoints(pointStr);
|
|
457
|
+
var point = points.length > 0 ? points[0] : null;
|
|
458
|
+
if (point && Carto.ValidateCarto(point)) {
|
|
459
|
+
return Cartesian3.fromDegrees(point.longitude, point.latitude, point.altitude);
|
|
460
|
+
}
|
|
478
461
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
462
|
+
var lineStr = entity.geometry.LineString;
|
|
463
|
+
if (lineStr && typeof lineStr == "string") {
|
|
464
|
+
var points = Geometry.ParsePoints(lineStr);
|
|
465
|
+
if (points.length > 0) {
|
|
466
|
+
var posses = points.map(function (x) { return Cartesian3.fromDegrees(x.longitude, x.latitude, x.altitude); });
|
|
467
|
+
var length_1 = MeasureUtils.MeasurePolyline(posses);
|
|
468
|
+
if (length_1 > 0) {
|
|
469
|
+
var point = DrawingUtils.PointAcrossPolyline(viewer, posses, length_1 / 2);
|
|
470
|
+
if (point && Cartes.ValidateCartes3(point)) {
|
|
471
|
+
return point;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
return posses[0];
|
|
490
476
|
}
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
return posses[0];
|
|
494
477
|
}
|
|
495
478
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
479
|
+
var pRings = entity.geometry.Polygon;
|
|
480
|
+
if (pRings && typeof pRings == "object") {
|
|
481
|
+
var boundary = pRings.find(function (x) { return x.Facing == Geometry.EPolygonRingType.Boundaries; });
|
|
482
|
+
if (boundary === null || boundary === void 0 ? void 0 : boundary.LinearRing) {
|
|
483
|
+
var points = Geometry.ParsePoints(boundary.LinearRing);
|
|
484
|
+
var point = Carto.GetCenter(points);
|
|
485
|
+
if (point && Carto.ValidateCarto(point)) {
|
|
486
|
+
return Cartesian3.fromDegrees(point.longitude, point.latitude, point.altitude);
|
|
487
|
+
}
|
|
505
488
|
}
|
|
506
489
|
}
|
|
507
490
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
491
|
+
if (entity.boundaries) {
|
|
492
|
+
var point = {
|
|
493
|
+
latitude: (Number(entity.boundaries.minLatitude) + Number(entity.boundaries.maxLatitude)) / 2,
|
|
494
|
+
longitude: (Number(entity.boundaries.minLongitude) + Number(entity.boundaries.maxLongitude)) / 2,
|
|
495
|
+
altitude: 0
|
|
496
|
+
};
|
|
497
|
+
if (point && Carto.ValidateCarto(point)) {
|
|
498
|
+
return Cartesian3.fromDegrees(point.longitude, point.latitude, point.altitude);
|
|
499
|
+
}
|
|
517
500
|
}
|
|
518
501
|
}
|
|
519
|
-
|
|
502
|
+
var pos3d = evaluate();
|
|
503
|
+
return Cartes.ValidateCartes3(pos3d) ? pos3d : null;
|
|
520
504
|
}
|
|
521
505
|
EntityUtils.GetPos = GetPos;
|
|
522
506
|
/**
|
|
@@ -545,14 +529,17 @@ var RenderManager;
|
|
|
545
529
|
return null;
|
|
546
530
|
}
|
|
547
531
|
var cameraPos = viewer.camera.position;
|
|
532
|
+
if (!Cartes.ValidateCartes3(cameraPos)) {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
548
535
|
var distance = Cartesian3.distance(pos, cameraPos);
|
|
549
|
-
return GetZoomControlFromDistance(zoomControl, distance);
|
|
536
|
+
return (!distance && distance != 0) ? null : GetZoomControlFromDistance(zoomControl, distance);
|
|
550
537
|
}
|
|
551
538
|
Utils.DetermineZoomItem = DetermineZoomItem;
|
|
552
539
|
function GetZoomControlFromDistance(zoomControl, distance) {
|
|
553
540
|
for (var i = 0; i < zoomControl.length; i++) {
|
|
554
541
|
var zoomItem = zoomControl[i];
|
|
555
|
-
if ((distance >= zoomItem.MinZoom) && (distance <= zoomItem.MaxZoom)) {
|
|
542
|
+
if ((distance >= Number(zoomItem.MinZoom)) && (distance <= Number(zoomItem.MaxZoom))) {
|
|
556
543
|
return zoomItem;
|
|
557
544
|
}
|
|
558
545
|
}
|
|
@@ -564,6 +551,8 @@ var RenderManager;
|
|
|
564
551
|
var max = 100;
|
|
565
552
|
for (var i = 0; i < zoomControl.length; i++) {
|
|
566
553
|
var zoomItem = zoomControl[i];
|
|
554
|
+
zoomItem.MinZoom = Number(zoomItem.MinZoom);
|
|
555
|
+
zoomItem.MaxZoom = Number(zoomItem.MaxZoom);
|
|
567
556
|
if (zoomItem.MinZoom != null) {
|
|
568
557
|
if (zoomItem.MinZoom < min) {
|
|
569
558
|
min = zoomItem.MinZoom;
|