bruce-cesium 2.6.2 → 2.6.4
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 +140 -60
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +139 -59
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +86 -27
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +52 -31
- package/dist/lib/utils/entity-utils.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
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, BatchedDataGetter, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian3,
|
|
3
|
+
import { Cartographic, JulianDate, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, Entity, Primitive, Cesium3DTileFeature, HeightReference, DistanceDisplayCondition, NearFarScalar, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EllipsoidTerrainProvider, CesiumInspector, defined, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, EasingFunction, GeometryInstance, Ion, BoundingSphere } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -1031,42 +1031,63 @@ var EntityUtils;
|
|
|
1031
1031
|
* @returns
|
|
1032
1032
|
*/
|
|
1033
1033
|
function GetPosAsync(params) {
|
|
1034
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1034
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1035
1035
|
return __awaiter(this, void 0, void 0, function () {
|
|
1036
|
-
var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, e_1, pos3d, tSettings, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset;
|
|
1037
|
-
return __generator(this, function (
|
|
1038
|
-
switch (
|
|
1036
|
+
var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, lat, lon, e_1, e_2, pos3d, tSettings, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset;
|
|
1037
|
+
return __generator(this, function (_o) {
|
|
1038
|
+
switch (_o.label) {
|
|
1039
1039
|
case 0:
|
|
1040
1040
|
viewer = params.viewer, entityId = params.entityId, entity = params.entity, tileset = params.tileset, tilesetId = params.tilesetId, visualRegister = params.visualRegister, returnHeightRef = params.returnHeightRef, recordHeightRef = params.recordHeightRef, api = params.api;
|
|
1041
|
-
if (!!entity) return [3 /*break*/,
|
|
1042
|
-
|
|
1041
|
+
if (!!entity) return [3 /*break*/, 9];
|
|
1042
|
+
lat = 0;
|
|
1043
|
+
lon = 0;
|
|
1044
|
+
_o.label = 1;
|
|
1043
1045
|
case 1:
|
|
1044
|
-
|
|
1046
|
+
_o.trys.push([1, 3, , 4]);
|
|
1045
1047
|
return [4 /*yield*/, Entity$1.Get({
|
|
1046
1048
|
api: api,
|
|
1047
1049
|
entityId: entityId,
|
|
1048
|
-
expandLocation:
|
|
1050
|
+
expandLocation: false
|
|
1049
1051
|
})];
|
|
1050
1052
|
case 2:
|
|
1051
|
-
entity = (
|
|
1052
|
-
|
|
1053
|
+
entity = (_o.sent()).entity;
|
|
1054
|
+
lat = +((_a = entity === null || entity === void 0 ? void 0 : entity.location) === null || _a === void 0 ? void 0 : _a.latitude);
|
|
1055
|
+
lon = +((_b = entity === null || entity === void 0 ? void 0 : entity.location) === null || _b === void 0 ? void 0 : _b.longitude);
|
|
1056
|
+
return [3 /*break*/, 4];
|
|
1053
1057
|
case 3:
|
|
1054
|
-
e_1 =
|
|
1055
|
-
console.
|
|
1058
|
+
e_1 = _o.sent();
|
|
1059
|
+
console.error(e_1);
|
|
1060
|
+
return [3 /*break*/, 4];
|
|
1061
|
+
case 4:
|
|
1062
|
+
if (!(entity && (isNaN(lat) || isNaN(lon) || (lat == 0 && lon == 0)))) return [3 /*break*/, 9];
|
|
1063
|
+
_o.label = 5;
|
|
1064
|
+
case 5:
|
|
1065
|
+
_o.trys.push([5, 7, , 9]);
|
|
1066
|
+
return [4 /*yield*/, Entity$1.Get({
|
|
1067
|
+
api: api,
|
|
1068
|
+
entityId: entityId,
|
|
1069
|
+
expandLocation: true
|
|
1070
|
+
})];
|
|
1071
|
+
case 6:
|
|
1072
|
+
entity = (_o.sent()).entity;
|
|
1073
|
+
return [3 /*break*/, 9];
|
|
1074
|
+
case 7:
|
|
1075
|
+
e_2 = _o.sent();
|
|
1076
|
+
console.warn(e_2);
|
|
1056
1077
|
return [4 /*yield*/, Entity$1.Get({
|
|
1057
1078
|
api: api,
|
|
1058
1079
|
entityId: entityId,
|
|
1059
1080
|
expandLocation: false
|
|
1060
1081
|
})];
|
|
1061
|
-
case
|
|
1062
|
-
entity = (
|
|
1063
|
-
return [3 /*break*/,
|
|
1064
|
-
case
|
|
1082
|
+
case 8:
|
|
1083
|
+
entity = (_o.sent()).entity;
|
|
1084
|
+
return [3 /*break*/, 9];
|
|
1085
|
+
case 9:
|
|
1065
1086
|
if (!entity) {
|
|
1066
1087
|
return [2 /*return*/, null];
|
|
1067
1088
|
}
|
|
1068
1089
|
if (!tilesetId) {
|
|
1069
|
-
tilesetId = ((
|
|
1090
|
+
tilesetId = ((_c = entity.tilesetID) === null || _c === void 0 ? void 0 : _c.length) ? entity.tilesetID[0] : tilesetId;
|
|
1070
1091
|
}
|
|
1071
1092
|
pos3d = tilesetId ? null : GetPos({
|
|
1072
1093
|
viewer: viewer,
|
|
@@ -1078,19 +1099,19 @@ var EntityUtils;
|
|
|
1078
1099
|
if (Cartes.ValidateCartes3(pos3d)) {
|
|
1079
1100
|
return [2 /*return*/, pos3d];
|
|
1080
1101
|
}
|
|
1081
|
-
if (!!tileset) return [3 /*break*/,
|
|
1082
|
-
if (!tilesetId) return [3 /*break*/,
|
|
1102
|
+
if (!!tileset) return [3 /*break*/, 11];
|
|
1103
|
+
if (!tilesetId) return [3 /*break*/, 11];
|
|
1083
1104
|
return [4 /*yield*/, Tileset.Get({
|
|
1084
1105
|
api: api,
|
|
1085
1106
|
tilesetId: tilesetId
|
|
1086
1107
|
})];
|
|
1087
|
-
case
|
|
1088
|
-
tileset = (
|
|
1089
|
-
|
|
1090
|
-
case
|
|
1108
|
+
case 10:
|
|
1109
|
+
tileset = (_o.sent()).tileset;
|
|
1110
|
+
_o.label = 11;
|
|
1111
|
+
case 11:
|
|
1091
1112
|
tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
|
|
1092
|
-
if (((
|
|
1093
|
-
if ((
|
|
1113
|
+
if (((_d = entity.location) === null || _d === void 0 ? void 0 : _d.longitude) || ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _e === void 0 ? void 0 : _e.longitude)) {
|
|
1114
|
+
if ((_f = entity === null || entity === void 0 ? void 0 : entity.location) === null || _f === void 0 ? void 0 : _f.longitude) {
|
|
1094
1115
|
alt = +entity.location.altitude;
|
|
1095
1116
|
if (isNaN(alt)) {
|
|
1096
1117
|
alt = 0;
|
|
@@ -1109,22 +1130,22 @@ var EntityUtils;
|
|
|
1109
1130
|
heading = 0;
|
|
1110
1131
|
pitch = 0;
|
|
1111
1132
|
roll = 0;
|
|
1112
|
-
if ((
|
|
1133
|
+
if ((_g = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _g === void 0 ? void 0 : _g.heading) {
|
|
1113
1134
|
heading = entity.transform.heading;
|
|
1114
1135
|
}
|
|
1115
|
-
else if ((
|
|
1136
|
+
else if ((_h = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _h === void 0 ? void 0 : _h.heading) {
|
|
1116
1137
|
heading = tSettings.transform.heading;
|
|
1117
1138
|
}
|
|
1118
|
-
if ((
|
|
1139
|
+
if ((_j = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _j === void 0 ? void 0 : _j.pitch) {
|
|
1119
1140
|
pitch = entity.transform.pitch;
|
|
1120
1141
|
}
|
|
1121
|
-
else if ((
|
|
1142
|
+
else if ((_k = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _k === void 0 ? void 0 : _k.pitch) {
|
|
1122
1143
|
pitch = tSettings.transform.pitch;
|
|
1123
1144
|
}
|
|
1124
|
-
if ((
|
|
1145
|
+
if ((_l = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _l === void 0 ? void 0 : _l.roll) {
|
|
1125
1146
|
roll = entity.transform.roll;
|
|
1126
1147
|
}
|
|
1127
|
-
else if ((
|
|
1148
|
+
else if ((_m = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _m === void 0 ? void 0 : _m.roll) {
|
|
1128
1149
|
roll = tSettings.transform.roll;
|
|
1129
1150
|
}
|
|
1130
1151
|
heading = +heading;
|
|
@@ -1630,6 +1651,43 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
|
|
|
1630
1651
|
}
|
|
1631
1652
|
return data;
|
|
1632
1653
|
}
|
|
1654
|
+
function getCylinderStyleExtrusion(style, entity, tags, heightRef) {
|
|
1655
|
+
var _a;
|
|
1656
|
+
if (!style) {
|
|
1657
|
+
return null;
|
|
1658
|
+
}
|
|
1659
|
+
try {
|
|
1660
|
+
var extrusion = +Calculator.GetNumber(style, entity, tags);
|
|
1661
|
+
if (!extrusion && extrusion != 0) {
|
|
1662
|
+
return null;
|
|
1663
|
+
}
|
|
1664
|
+
/*
|
|
1665
|
+
Cesium extrudes in strange way.
|
|
1666
|
+
If you want something that is 50 meters above sea, and 5 meters tall,
|
|
1667
|
+
You need to extrude by 55 meters, if you extrude by 5 it will extrude from sea and look flat.
|
|
1668
|
+
*/
|
|
1669
|
+
var height = EnsureNumber((_a = entity.location) === null || _a === void 0 ? void 0 : _a.altitude, 0);
|
|
1670
|
+
return heightRef != HeightReference.CLAMP_TO_GROUND ? extrusion + height : extrusion;
|
|
1671
|
+
}
|
|
1672
|
+
catch (e) {
|
|
1673
|
+
console.error(e);
|
|
1674
|
+
}
|
|
1675
|
+
return 0;
|
|
1676
|
+
}
|
|
1677
|
+
function getCylinderExtrusion(entity, tags, heightRef, style) {
|
|
1678
|
+
var data = {
|
|
1679
|
+
value: undefined,
|
|
1680
|
+
exHeightRef: heightRef == HeightReference.CLAMP_TO_GROUND ? HeightReference.RELATIVE_TO_GROUND : heightRef
|
|
1681
|
+
};
|
|
1682
|
+
var extrusion = getCylinderStyleExtrusion(style, entity, tags, heightRef);
|
|
1683
|
+
if (extrusion) {
|
|
1684
|
+
data.value = extrusion;
|
|
1685
|
+
}
|
|
1686
|
+
if (data.value != undefined) {
|
|
1687
|
+
data.value = EnsureNumber(data.value);
|
|
1688
|
+
}
|
|
1689
|
+
return data;
|
|
1690
|
+
}
|
|
1633
1691
|
function getHeightRef(style, defaultStyle) {
|
|
1634
1692
|
var _a;
|
|
1635
1693
|
var heightRef = defaultStyle == null ? HeightReference.CLAMP_TO_GROUND : defaultStyle;
|
|
@@ -1863,7 +1921,6 @@ var EntityRenderEngine;
|
|
|
1863
1921
|
return __generator(this, function (_j) {
|
|
1864
1922
|
switch (_j.label) {
|
|
1865
1923
|
case 0:
|
|
1866
|
-
console.log("Rendering entities", params);
|
|
1867
1924
|
groupRenderParams = {
|
|
1868
1925
|
apiGetter: params.apiGetter,
|
|
1869
1926
|
viewer: params.viewer,
|
|
@@ -2115,7 +2172,7 @@ var EntityRenderEngine;
|
|
|
2115
2172
|
(function (Point) {
|
|
2116
2173
|
function Render(params) {
|
|
2117
2174
|
return __awaiter(this, void 0, void 0, function () {
|
|
2118
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, res, e_4, iconScale, disableDepthTest, heightRef, radius, bFill, cFill, outline,
|
|
2175
|
+
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, res, e_4, iconScale, disableDepthTest, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, outlineExtrusion, bColor, cColor, size, heightRef;
|
|
2119
2176
|
return __generator(this, function (_a) {
|
|
2120
2177
|
switch (_a.label) {
|
|
2121
2178
|
case 0:
|
|
@@ -2212,35 +2269,60 @@ var EntityRenderEngine;
|
|
|
2212
2269
|
bFill = style.CylinderFillColor ? Calculator.GetColor(style.CylinderFillColor, entity, params.tags) : null;
|
|
2213
2270
|
cFill = bFill ? colorToCColor(bFill) : Color.RED;
|
|
2214
2271
|
outline = Boolean(style.CylinderBorderEnabled);
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2272
|
+
cOutline = null;
|
|
2273
|
+
outlineWidth = 1;
|
|
2274
|
+
if (outline) {
|
|
2275
|
+
bOutline = style.CylinderBorderColor ? Calculator.GetColor(style.CylinderBorderColor, entity, params.tags) : null;
|
|
2276
|
+
cOutline = bOutline ? colorToCColor(bOutline) : Color.BLACK;
|
|
2277
|
+
outlineWidth = EnsureNumber(Calculator.GetNumber(style.CylinderBorderWidth, entity, params.tags), 1);
|
|
2278
|
+
}
|
|
2279
|
+
heightRef = getHeightRef(style);
|
|
2280
|
+
pos3d = EntityUtils.GetPos({
|
|
2221
2281
|
viewer: params.viewer,
|
|
2222
2282
|
entity: entity,
|
|
2223
|
-
recordHeightRef:
|
|
2224
|
-
returnHeightRef:
|
|
2283
|
+
recordHeightRef: heightRef,
|
|
2284
|
+
returnHeightRef: heightRef
|
|
2225
2285
|
});
|
|
2226
|
-
|
|
2227
|
-
if (pos) {
|
|
2228
|
-
cartographicPosition = Cartographic.fromCartesian(pos);
|
|
2229
|
-
cartographicPosition.height += fillHeight / 2;
|
|
2230
|
-
pos = Cartographic.toCartesian(cartographicPosition);
|
|
2231
|
-
}
|
|
2286
|
+
extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
|
|
2232
2287
|
cEntity = new Entity({
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
topRadius: radius,
|
|
2237
|
-
bottomRadius: radius,
|
|
2288
|
+
ellipse: {
|
|
2289
|
+
semiMajorAxis: radius,
|
|
2290
|
+
semiMinorAxis: radius,
|
|
2238
2291
|
material: cFill,
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2292
|
+
outlineWidth: null,
|
|
2293
|
+
extrudedHeight: extrusion.value,
|
|
2294
|
+
heightReference: heightRef,
|
|
2295
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
2296
|
+
height: Cartographic.fromCartesian(pos3d).height,
|
|
2297
|
+
zIndex: 1,
|
|
2298
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
2299
|
+
},
|
|
2300
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
2301
|
+
show: true
|
|
2243
2302
|
});
|
|
2303
|
+
if (outline && outlineWidth > 0) {
|
|
2304
|
+
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
2305
|
+
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
2306
|
+
// This way they render in a uniform way.
|
|
2307
|
+
if (!outlineExtrusion.value && extrusion.value) {
|
|
2308
|
+
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
2309
|
+
}
|
|
2310
|
+
siblings.push(new Entity({
|
|
2311
|
+
ellipse: {
|
|
2312
|
+
semiMajorAxis: radius + outlineWidth,
|
|
2313
|
+
semiMinorAxis: radius + outlineWidth,
|
|
2314
|
+
material: cOutline,
|
|
2315
|
+
outlineWidth: undefined,
|
|
2316
|
+
extrudedHeight: outlineExtrusion.value,
|
|
2317
|
+
heightReference: heightRef,
|
|
2318
|
+
extrudedHeightReference: outlineExtrusion.exHeightRef,
|
|
2319
|
+
height: Cartographic.fromCartesian(pos3d).height,
|
|
2320
|
+
zIndex: 2,
|
|
2321
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
2322
|
+
},
|
|
2323
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
2324
|
+
}));
|
|
2325
|
+
}
|
|
2244
2326
|
}
|
|
2245
2327
|
if (!cEntity) {
|
|
2246
2328
|
bColor = style.color ? Calculator.GetColor(style.color, entity, params.tags) : null;
|
|
@@ -2269,8 +2351,6 @@ var EntityRenderEngine;
|
|
|
2269
2351
|
}),
|
|
2270
2352
|
show: true
|
|
2271
2353
|
});
|
|
2272
|
-
console.log("Created point", cEntity);
|
|
2273
|
-
debugger;
|
|
2274
2354
|
}
|
|
2275
2355
|
if (cEntity) {
|
|
2276
2356
|
cEntity._siblingGraphics = siblings;
|
|
@@ -14996,7 +15076,7 @@ var ViewerUtils;
|
|
|
14996
15076
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
14997
15077
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
14998
15078
|
|
|
14999
|
-
var VERSION$1 = "2.
|
|
15079
|
+
var VERSION$1 = "2.6.4";
|
|
15000
15080
|
|
|
15001
15081
|
export { VERSION$1 as VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
|
|
15002
15082
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|