bruce-cesium 0.6.4 → 0.6.5
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 +33 -24
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +32 -23
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +21 -13
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +8 -7
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +3 -3
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/package.json +1 -1
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, ProgramKey, Camera } from 'bruce-models';
|
|
2
|
-
import { Cartesian2, Cartographic, Math as Math$1,
|
|
2
|
+
import { Cartesian2, Cartographic, Math as Math$1, Entity, Primitive, Cesium3DTileFeature, Color, HeightReference, Cartesian3, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, HeadingPitchRange, OrthographicFrustum, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Matrix4, Cesium3DTileset, EllipsoidGeodesic, ColorMaterialProperty, Rectangle, Matrix3, EasingFunction, GeometryInstance, JulianDate, createOsmBuildings, Cesium3DTileStyle } from 'cesium';
|
|
3
3
|
|
|
4
4
|
var TIME_LAG = 300;
|
|
5
5
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -563,14 +563,14 @@ var EntityUtils;
|
|
|
563
563
|
var points = Geometry.ParsePoints(pointStr);
|
|
564
564
|
var point = points.length > 0 ? points[0] : null;
|
|
565
565
|
if (point && Carto.ValidateCarto(point)) {
|
|
566
|
-
return Cartesian3.fromDegrees(point.longitude, point.latitude, point.altitude);
|
|
566
|
+
return Cartesian3.fromDegrees(Number(point.longitude), Number(point.latitude), Number(point.altitude));
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
var lineStr = entity.geometry.LineString;
|
|
570
570
|
if (lineStr && typeof lineStr == "string") {
|
|
571
571
|
var points = Geometry.ParsePoints(lineStr);
|
|
572
572
|
if (points.length > 0) {
|
|
573
|
-
var posses = points.map(function (x) { return Cartesian3.fromDegrees(x.longitude, x.latitude, x.altitude); });
|
|
573
|
+
var posses = points.map(function (x) { return Cartesian3.fromDegrees(Number(x.longitude), Number(x.latitude), Number(x.altitude)); });
|
|
574
574
|
var length_1 = MeasureUtils.MeasurePolyline(posses);
|
|
575
575
|
if (length_1 > 0) {
|
|
576
576
|
var point = DrawingUtils.PointAcrossPolyline(viewer, posses, length_1 / 2);
|
|
@@ -590,7 +590,7 @@ var EntityUtils;
|
|
|
590
590
|
var points = Geometry.ParsePoints(boundary.LinearRing);
|
|
591
591
|
var point = Carto.GetCenter(points);
|
|
592
592
|
if (point && Carto.ValidateCarto(point)) {
|
|
593
|
-
return Cartesian3.fromDegrees(point.longitude, point.latitude, point.altitude);
|
|
593
|
+
return Cartesian3.fromDegrees(Number(point.longitude), Number(point.latitude), Number(point.altitude));
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
}
|
|
@@ -845,7 +845,7 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
|
|
|
845
845
|
points.forEach(function (point) {
|
|
846
846
|
point.height = alt_1;
|
|
847
847
|
});
|
|
848
|
-
posses = points.map(function (x) { return Cartesian3.fromRadians(x.longitude, x.latitude, x.height); });
|
|
848
|
+
posses = points.map(function (x) { return Cartesian3.fromRadians(Number(x.longitude), Number(x.latitude), Number(x.height)); });
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
// Step 2. Try get using geometry data.
|
|
@@ -871,6 +871,9 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
|
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
data.posses = posses;
|
|
874
|
+
if (data.value != undefined) {
|
|
875
|
+
data.value = Number(data.value);
|
|
876
|
+
}
|
|
874
877
|
return data;
|
|
875
878
|
}
|
|
876
879
|
function getHeightRef(style) {
|
|
@@ -890,7 +893,7 @@ function getZIndex(style, entity, tags) {
|
|
|
890
893
|
if (zIndex == null) {
|
|
891
894
|
zIndex = 0;
|
|
892
895
|
}
|
|
893
|
-
return zIndex;
|
|
896
|
+
return Number(zIndex);
|
|
894
897
|
}
|
|
895
898
|
function getStyle(api, entity, styleId) {
|
|
896
899
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1090,7 +1093,7 @@ var EntityRenderEngine;
|
|
|
1090
1093
|
iconUrl = ClientFile.GetUrl(params.api, style.iconId);
|
|
1091
1094
|
}
|
|
1092
1095
|
if (iconUrl) {
|
|
1093
|
-
var iconScale =
|
|
1096
|
+
var iconScale = Number(Calculator.GetValue(style.iconScale, entity, params.tags));
|
|
1094
1097
|
if (!iconScale && iconScale != 0) {
|
|
1095
1098
|
iconScale = 1;
|
|
1096
1099
|
}
|
|
@@ -1100,7 +1103,8 @@ var EntityRenderEngine;
|
|
|
1100
1103
|
horizontalOrigin: HorizontalOrigin.CENTER,
|
|
1101
1104
|
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
1102
1105
|
image: iconUrl,
|
|
1103
|
-
heightReference: getHeightRef(style)
|
|
1106
|
+
heightReference: getHeightRef(style),
|
|
1107
|
+
scale: iconScale
|
|
1104
1108
|
},
|
|
1105
1109
|
position: EntityUtils.GetPos(params.viewer, entity),
|
|
1106
1110
|
show: false
|
|
@@ -1116,6 +1120,7 @@ var EntityRenderEngine;
|
|
|
1116
1120
|
if (size == null) {
|
|
1117
1121
|
size = 30;
|
|
1118
1122
|
}
|
|
1123
|
+
size = Number(size);
|
|
1119
1124
|
if (size <= 0) {
|
|
1120
1125
|
return null;
|
|
1121
1126
|
}
|
|
@@ -1202,7 +1207,7 @@ var EntityRenderEngine;
|
|
|
1202
1207
|
if (!isValid) {
|
|
1203
1208
|
return null;
|
|
1204
1209
|
}
|
|
1205
|
-
var posses = points.map(function (x) { return Cartesian3.fromDegrees(x.longitude, x.latitude, x.altitude); });
|
|
1210
|
+
var posses = points.map(function (x) { return Cartesian3.fromDegrees(Number(x.longitude), Number(x.latitude), Number(x.altitude)); });
|
|
1206
1211
|
// Making sure no 0 length lines coming through.
|
|
1207
1212
|
// Ideally we would measure the full line but I fear that's too expensive.
|
|
1208
1213
|
if (posses.length == 2 || posses.length == 3) {
|
|
@@ -1225,6 +1230,7 @@ var EntityRenderEngine;
|
|
|
1225
1230
|
if (width == null) {
|
|
1226
1231
|
width = 4;
|
|
1227
1232
|
}
|
|
1233
|
+
width = Number(width);
|
|
1228
1234
|
if (width <= 0) {
|
|
1229
1235
|
return null;
|
|
1230
1236
|
}
|
|
@@ -1312,19 +1318,20 @@ var EntityRenderEngine;
|
|
|
1312
1318
|
if (width == null) {
|
|
1313
1319
|
width = 4;
|
|
1314
1320
|
}
|
|
1321
|
+
width = Number(width);
|
|
1315
1322
|
if (width <= 0) {
|
|
1316
1323
|
return null;
|
|
1317
1324
|
}
|
|
1318
1325
|
var heightRef = getHeightRef(style);
|
|
1319
1326
|
var outerRing = pRings.find(function (x) { return x.Facing == Geometry.EPolygonRingType.Boundaries; });
|
|
1320
1327
|
var points = Geometry.ParsePoints(outerRing === null || outerRing === void 0 ? void 0 : outerRing.LinearRing);
|
|
1321
|
-
var posses = points.map(function (x) { return Cartesian3.fromDegrees(x.longitude, x.latitude, x.altitude); });
|
|
1328
|
+
var posses = points.map(function (x) { return Cartesian3.fromDegrees(Number(x.longitude), Number(x.latitude), Number(x.altitude)); });
|
|
1322
1329
|
var extrusion = getPolygonExtrusion(entity, params.tags, outerRing, posses, heightRef, style);
|
|
1323
1330
|
posses = extrusion.posses;
|
|
1324
1331
|
var holeRings = pRings.filter(function (x) { return x.Facing == Geometry.EPolygonRingType.Hole; });
|
|
1325
1332
|
var holePosses = holeRings.map(function (x) {
|
|
1326
1333
|
var points = Geometry.ParsePoints(x.LinearRing);
|
|
1327
|
-
return points.map(function (x) { return Cartesian3.fromDegrees(x.longitude, x.latitude, x.altitude); });
|
|
1334
|
+
return points.map(function (x) { return Cartesian3.fromDegrees(Number(x.longitude), Number(x.latitude), Number(x.altitude)); });
|
|
1328
1335
|
});
|
|
1329
1336
|
var zIndex = getZIndex(style, entity, params.tags);
|
|
1330
1337
|
var cEntity = new Entity({
|
|
@@ -1418,16 +1425,17 @@ var EntityRenderEngine;
|
|
|
1418
1425
|
function Render(params) {
|
|
1419
1426
|
var entity = params.entity;
|
|
1420
1427
|
var transform = entity === null || entity === void 0 ? void 0 : entity.transform;
|
|
1421
|
-
var heading = transform ?
|
|
1428
|
+
var heading = transform ? Number(transform.heading) : 0;
|
|
1422
1429
|
heading = (heading + 90) % 360;
|
|
1423
|
-
var pitch = transform ?
|
|
1424
|
-
var roll = transform ?
|
|
1425
|
-
var scale = transform ?
|
|
1430
|
+
var pitch = transform ? Number(transform.pitch) : 0;
|
|
1431
|
+
var roll = transform ? Number(transform.roll) : 0;
|
|
1432
|
+
var scale = transform ? Number(transform.scale) : 1;
|
|
1426
1433
|
if (scale <= 0) {
|
|
1427
1434
|
scale = 1;
|
|
1428
1435
|
}
|
|
1429
1436
|
var style = params.style;
|
|
1430
|
-
var styleScale = (style === null || style === void 0 ? void 0 : style.scale) ?
|
|
1437
|
+
var styleScale = (style === null || style === void 0 ? void 0 : style.scale) ? Calculator.GetValue(style === null || style === void 0 ? void 0 : style.scale, entity, params.tags) : null;
|
|
1438
|
+
styleScale = Number(styleScale);
|
|
1431
1439
|
if (!styleScale) {
|
|
1432
1440
|
styleScale = 1;
|
|
1433
1441
|
}
|
|
@@ -1437,7 +1445,7 @@ var EntityRenderEngine;
|
|
|
1437
1445
|
var pos = EntityUtils.GetPos(params.viewer, entity);
|
|
1438
1446
|
if (heightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
1439
1447
|
var carto = Cartographic.fromCartesian(pos);
|
|
1440
|
-
pos = Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
|
|
1448
|
+
pos = Cartesian3.fromRadians(Number(carto.longitude), Number(carto.latitude), 0);
|
|
1441
1449
|
heightRef = HeightReference.RELATIVE_TO_GROUND;
|
|
1442
1450
|
}
|
|
1443
1451
|
var orientation = Transforms.headingPitchRollQuaternion(pos, hpr);
|
|
@@ -2644,16 +2652,17 @@ var TilesetRenderEngine;
|
|
|
2644
2652
|
return;
|
|
2645
2653
|
}
|
|
2646
2654
|
transform = __assign({ heading: 0, pitch: 0, roll: 0, scale: 1, x: 0, y: 0, z: 0 }, transform);
|
|
2655
|
+
transform.scale = Number(transform.scale);
|
|
2647
2656
|
if (transform.scale <= 0) {
|
|
2648
2657
|
transform.scale = 0.000001;
|
|
2649
2658
|
}
|
|
2650
|
-
var pos = Cartesian3.fromDegrees(location.longitude, location.latitude, location.altitude);
|
|
2651
|
-
var hpr = HeadingPitchRoll.fromDegrees(transform.heading, transform.pitch, transform.roll, new HeadingPitchRoll());
|
|
2659
|
+
var pos = Cartesian3.fromDegrees(Number(location.longitude), Number(location.latitude), Number(location.altitude));
|
|
2660
|
+
var hpr = HeadingPitchRoll.fromDegrees(Number(transform.heading), Number(transform.pitch), Number(transform.roll), new HeadingPitchRoll());
|
|
2652
2661
|
var root = cTileset.root;
|
|
2653
2662
|
root.transform = Transforms.headingPitchRollToFixedFrame(pos, hpr);
|
|
2654
2663
|
var scaleMatrix = Matrix4.fromScale(new Cartesian3(transform.scale, transform.scale, transform.scale), new Matrix4());
|
|
2655
2664
|
root.transform = Matrix4.multiply(root.transform, scaleMatrix, root.transform);
|
|
2656
|
-
root.transform = Matrix4.multiplyByTranslation(root.transform, new Cartesian3(transform.x, transform.y, transform.z), root.transform);
|
|
2665
|
+
root.transform = Matrix4.multiplyByTranslation(root.transform, new Cartesian3(Number(transform.x), Number(transform.y), Number(transform.z)), root.transform);
|
|
2657
2666
|
// Force matrix to update
|
|
2658
2667
|
root.updateTransform();
|
|
2659
2668
|
}
|
|
@@ -2663,22 +2672,22 @@ var TilesetRenderEngine;
|
|
|
2663
2672
|
var settings = tileset.settings;
|
|
2664
2673
|
var maxScreenSpaceError = settings.maximumScreenSpaceError;
|
|
2665
2674
|
if (maxScreenSpaceError || maxScreenSpaceError == 0) {
|
|
2666
|
-
cTileset.maximumScreenSpaceError = maxScreenSpaceError;
|
|
2675
|
+
cTileset.maximumScreenSpaceError = Number(maxScreenSpaceError);
|
|
2667
2676
|
}
|
|
2668
2677
|
}
|
|
2669
2678
|
else if (tileset.type == Tileset.EType.PointCloud) {
|
|
2670
2679
|
var settings = tileset.settings;
|
|
2671
2680
|
var maxScreenSpaceError = settings.maximumScreenSpaceError;
|
|
2672
2681
|
if (maxScreenSpaceError || maxScreenSpaceError == 0) {
|
|
2673
|
-
cTileset.maximumScreenSpaceError = maxScreenSpaceError;
|
|
2682
|
+
cTileset.maximumScreenSpaceError = Number(maxScreenSpaceError);
|
|
2674
2683
|
}
|
|
2675
2684
|
var attenuation = settings.attenuation;
|
|
2676
2685
|
if (attenuation != null) {
|
|
2677
|
-
cTileset.pointCloudShading.attenuation = attenuation;
|
|
2686
|
+
cTileset.pointCloudShading.attenuation = Boolean(attenuation);
|
|
2678
2687
|
}
|
|
2679
2688
|
var attenuationMax = settings.attenuationMax;
|
|
2680
2689
|
if (attenuationMax || attenuationMax == 0) {
|
|
2681
|
-
cTileset.pointCloudShading.maximumAttenuation = attenuationMax;
|
|
2690
|
+
cTileset.pointCloudShading.maximumAttenuation = Number(attenuationMax);
|
|
2682
2691
|
}
|
|
2683
2692
|
}
|
|
2684
2693
|
else {
|