bruce-cesium 0.4.6 → 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 +55 -47
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +54 -46
- 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/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;
|
|
@@ -445,59 +445,62 @@ var EntityUtils;
|
|
|
445
445
|
* @returns
|
|
446
446
|
*/
|
|
447
447
|
function GetPos(viewer, entity) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
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
|
+
}
|
|
459
461
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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];
|
|
471
476
|
}
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
return posses[0];
|
|
475
477
|
}
|
|
476
478
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
+
}
|
|
486
488
|
}
|
|
487
489
|
}
|
|
488
490
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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
|
+
}
|
|
498
500
|
}
|
|
499
501
|
}
|
|
500
|
-
|
|
502
|
+
var pos3d = evaluate();
|
|
503
|
+
return Cartes.ValidateCartes3(pos3d) ? pos3d : null;
|
|
501
504
|
}
|
|
502
505
|
EntityUtils.GetPos = GetPos;
|
|
503
506
|
/**
|
|
@@ -526,14 +529,17 @@ var RenderManager;
|
|
|
526
529
|
return null;
|
|
527
530
|
}
|
|
528
531
|
var cameraPos = viewer.camera.position;
|
|
532
|
+
if (!Cartes.ValidateCartes3(cameraPos)) {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
529
535
|
var distance = Cartesian3.distance(pos, cameraPos);
|
|
530
|
-
return GetZoomControlFromDistance(zoomControl, distance);
|
|
536
|
+
return (!distance && distance != 0) ? null : GetZoomControlFromDistance(zoomControl, distance);
|
|
531
537
|
}
|
|
532
538
|
Utils.DetermineZoomItem = DetermineZoomItem;
|
|
533
539
|
function GetZoomControlFromDistance(zoomControl, distance) {
|
|
534
540
|
for (var i = 0; i < zoomControl.length; i++) {
|
|
535
541
|
var zoomItem = zoomControl[i];
|
|
536
|
-
if ((distance >= zoomItem.MinZoom) && (distance <= zoomItem.MaxZoom)) {
|
|
542
|
+
if ((distance >= Number(zoomItem.MinZoom)) && (distance <= Number(zoomItem.MaxZoom))) {
|
|
537
543
|
return zoomItem;
|
|
538
544
|
}
|
|
539
545
|
}
|
|
@@ -545,6 +551,8 @@ var RenderManager;
|
|
|
545
551
|
var max = 100;
|
|
546
552
|
for (var i = 0; i < zoomControl.length; i++) {
|
|
547
553
|
var zoomItem = zoomControl[i];
|
|
554
|
+
zoomItem.MinZoom = Number(zoomItem.MinZoom);
|
|
555
|
+
zoomItem.MaxZoom = Number(zoomItem.MaxZoom);
|
|
548
556
|
if (zoomItem.MinZoom != null) {
|
|
549
557
|
if (zoomItem.MinZoom < min) {
|
|
550
558
|
min = zoomItem.MinZoom;
|