bruce-cesium 1.6.0 → 1.6.2
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 +225 -81
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +223 -79
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/rendering/relation-render-engine.js +108 -78
- package/dist/lib/rendering/relation-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +2 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +149 -0
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/types/rendering/relation-render-engine.d.ts +2 -1
- package/dist/types/utils/entity-utils.d.ts +18 -1
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue,
|
|
2
|
-
import { Cartesian2, Cartographic, Math as Math$1,
|
|
1
|
+
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, BatchedDataGetter, EntityRelationType, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
|
|
2
|
+
import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, SceneMode, OrthographicFrustum, JulianDate, CallbackProperty, KmlDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, Matrix4, EasingFunction, GeometryInstance, Cesium3DTileset, IonResource, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider } from 'cesium';
|
|
3
3
|
|
|
4
4
|
var TIME_LAG = 300;
|
|
5
5
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -836,6 +836,119 @@ var EntityUtils;
|
|
|
836
836
|
});
|
|
837
837
|
}
|
|
838
838
|
EntityUtils.GetPos = GetPos;
|
|
839
|
+
/**
|
|
840
|
+
* Returns the position of the entity.
|
|
841
|
+
* This is an async variant that checks for related tilesets.
|
|
842
|
+
* @param params
|
|
843
|
+
* @returns
|
|
844
|
+
*/
|
|
845
|
+
function GetPosAsync(params) {
|
|
846
|
+
var _a, _b, _c, _d, _e, _f;
|
|
847
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
848
|
+
var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, pos3d, e_1, tSettings, ALT_INCREASE, alt, alt, heading, matrix4, offset, m1, hpr, transform, transformedOffset;
|
|
849
|
+
return __generator(this, function (_g) {
|
|
850
|
+
switch (_g.label) {
|
|
851
|
+
case 0:
|
|
852
|
+
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;
|
|
853
|
+
pos3d = GetPos({
|
|
854
|
+
viewer: viewer,
|
|
855
|
+
entity: entity,
|
|
856
|
+
visualRegister: visualRegister,
|
|
857
|
+
returnHeightRef: returnHeightRef,
|
|
858
|
+
recordHeightRef: recordHeightRef
|
|
859
|
+
});
|
|
860
|
+
if (Cartes.ValidateCartes3(pos3d)) {
|
|
861
|
+
return [2 /*return*/, pos3d];
|
|
862
|
+
}
|
|
863
|
+
if (!!entity) return [3 /*break*/, 5];
|
|
864
|
+
_g.label = 1;
|
|
865
|
+
case 1:
|
|
866
|
+
_g.trys.push([1, 3, , 5]);
|
|
867
|
+
return [4 /*yield*/, Entity$1.Get({
|
|
868
|
+
api: api,
|
|
869
|
+
entityId: entityId,
|
|
870
|
+
expandLocation: true
|
|
871
|
+
})];
|
|
872
|
+
case 2:
|
|
873
|
+
entity = (_g.sent()).entity;
|
|
874
|
+
return [3 /*break*/, 5];
|
|
875
|
+
case 3:
|
|
876
|
+
e_1 = _g.sent();
|
|
877
|
+
console.warn(e_1);
|
|
878
|
+
return [4 /*yield*/, Entity$1.Get({
|
|
879
|
+
api: api,
|
|
880
|
+
entityId: entityId,
|
|
881
|
+
expandLocation: false
|
|
882
|
+
})];
|
|
883
|
+
case 4:
|
|
884
|
+
entity = (_g.sent()).entity;
|
|
885
|
+
return [3 /*break*/, 5];
|
|
886
|
+
case 5:
|
|
887
|
+
if (!!tileset) return [3 /*break*/, 7];
|
|
888
|
+
if (!tilesetId) {
|
|
889
|
+
tilesetId = ((_a = entity.tilesetID) === null || _a === void 0 ? void 0 : _a.length) ? entity.tilesetID[0] : tilesetId;
|
|
890
|
+
}
|
|
891
|
+
if (!tilesetId) return [3 /*break*/, 7];
|
|
892
|
+
return [4 /*yield*/, Tileset.Get({
|
|
893
|
+
api: api,
|
|
894
|
+
tilesetId: tilesetId
|
|
895
|
+
})];
|
|
896
|
+
case 6:
|
|
897
|
+
tileset = (_g.sent()).tileset;
|
|
898
|
+
_g.label = 7;
|
|
899
|
+
case 7:
|
|
900
|
+
tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
|
|
901
|
+
if (((_b = entity.location) === null || _b === void 0 ? void 0 : _b.longitude) || ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _c === void 0 ? void 0 : _c.longitude)) {
|
|
902
|
+
ALT_INCREASE = 30;
|
|
903
|
+
if ((_d = entity === null || entity === void 0 ? void 0 : entity.location) === null || _d === void 0 ? void 0 : _d.longitude) {
|
|
904
|
+
alt = +entity.location.altitude;
|
|
905
|
+
if (isNaN(alt)) {
|
|
906
|
+
alt = 0;
|
|
907
|
+
}
|
|
908
|
+
alt += ALT_INCREASE;
|
|
909
|
+
pos3d = Cartesian3.fromDegrees(+entity.location.longitude, +entity.location.latitude, alt);
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
alt = +tSettings.location.altitude;
|
|
913
|
+
if (isNaN(alt)) {
|
|
914
|
+
alt = 0;
|
|
915
|
+
}
|
|
916
|
+
alt += ALT_INCREASE;
|
|
917
|
+
pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
|
|
918
|
+
}
|
|
919
|
+
// World position = we got lat/lon/alt from the tileset, now we need to apply relative movement.
|
|
920
|
+
if (entity === null || entity === void 0 ? void 0 : entity.worldPosition) {
|
|
921
|
+
heading = 0;
|
|
922
|
+
if ((_e = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _e === void 0 ? void 0 : _e.heading) {
|
|
923
|
+
heading = entity.transform.heading;
|
|
924
|
+
}
|
|
925
|
+
else if ((_f = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _f === void 0 ? void 0 : _f.heading) {
|
|
926
|
+
heading = tSettings.transform.heading;
|
|
927
|
+
}
|
|
928
|
+
heading = +heading;
|
|
929
|
+
if (isNaN(heading)) {
|
|
930
|
+
heading = 0;
|
|
931
|
+
}
|
|
932
|
+
matrix4 = entity.worldPosition;
|
|
933
|
+
offset = new Cartesian3(matrix4[0][3], matrix4[1][3], matrix4[2][3]);
|
|
934
|
+
m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
|
|
935
|
+
hpr = HeadingPitchRoll.fromDegrees(heading, 0, 0, new HeadingPitchRoll());
|
|
936
|
+
transform = Matrix3.fromHeadingPitchRoll(hpr);
|
|
937
|
+
transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
|
|
938
|
+
pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return [2 /*return*/, DrawingUtils.EnsurePosHeight({
|
|
942
|
+
desiredHeightRef: params.returnHeightRef,
|
|
943
|
+
heightRef: params.recordHeightRef,
|
|
944
|
+
pos3d: pos3d,
|
|
945
|
+
viewer: viewer
|
|
946
|
+
})];
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
EntityUtils.GetPosAsync = GetPosAsync;
|
|
839
952
|
/**
|
|
840
953
|
* Returns entity and any associated parent/sibling entities as a flat array.
|
|
841
954
|
* @param entity
|
|
@@ -2265,7 +2378,8 @@ var EntitiesRenderManager;
|
|
|
2265
2378
|
typeId: this.item.BruceEntity["EntityType.ID"],
|
|
2266
2379
|
monitor: this.monitor,
|
|
2267
2380
|
viewer: this.viewer,
|
|
2268
|
-
debugShowBounds: false
|
|
2381
|
+
debugShowBounds: false,
|
|
2382
|
+
cdn: this.item.cdnEnabled
|
|
2269
2383
|
});
|
|
2270
2384
|
minMax = RenderManager.GetZoomMinMax({
|
|
2271
2385
|
zoomControl: this.item.CameraZoomSettings
|
|
@@ -3028,7 +3142,7 @@ var RelationRenderEngine;
|
|
|
3028
3142
|
i = 0;
|
|
3029
3143
|
_d.label = 1;
|
|
3030
3144
|
case 1:
|
|
3031
|
-
if (!(i < relations.length)) return [3 /*break*/,
|
|
3145
|
+
if (!(i < relations.length)) return [3 /*break*/, 17];
|
|
3032
3146
|
relation = relations[i];
|
|
3033
3147
|
return [4 /*yield*/, Entity$1.Get({
|
|
3034
3148
|
api: api,
|
|
@@ -3093,22 +3207,25 @@ var RelationRenderEngine;
|
|
|
3093
3207
|
_d.label = 14;
|
|
3094
3208
|
case 14:
|
|
3095
3209
|
style = _c;
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3210
|
+
return [4 /*yield*/, Parabola.Render({
|
|
3211
|
+
dataEntity: dataEntity,
|
|
3212
|
+
fromEntity: fromEntity,
|
|
3213
|
+
relation: relation,
|
|
3214
|
+
style: style,
|
|
3215
|
+
toEntity: toEntity,
|
|
3216
|
+
viewer: viewer,
|
|
3217
|
+
visualRegister: visualRegister,
|
|
3218
|
+
apiGetter: apiGetter
|
|
3219
|
+
})];
|
|
3220
|
+
case 15:
|
|
3221
|
+
cEntity = _d.sent();
|
|
3105
3222
|
cEntity._renderGroup = GetRenderGroupId(relation);
|
|
3106
3223
|
rendered[GetRenderGroupId(relation)] = cEntity;
|
|
3107
|
-
_d.label =
|
|
3108
|
-
case
|
|
3224
|
+
_d.label = 16;
|
|
3225
|
+
case 16:
|
|
3109
3226
|
i++;
|
|
3110
3227
|
return [3 /*break*/, 1];
|
|
3111
|
-
case
|
|
3228
|
+
case 17: return [2 /*return*/, rendered];
|
|
3112
3229
|
}
|
|
3113
3230
|
});
|
|
3114
3231
|
});
|
|
@@ -3118,74 +3235,101 @@ var RelationRenderEngine;
|
|
|
3118
3235
|
(function (Parabola) {
|
|
3119
3236
|
function Render(params) {
|
|
3120
3237
|
var _a;
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3238
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3239
|
+
var style, entity, bColor, cColor, width, duration, hDistanceRatio, fromPos, toPos, updatingPosses, updatePosses, parabola, cEntities, cEntity, i, sibling, updateInterval;
|
|
3240
|
+
var _this = this;
|
|
3241
|
+
return __generator(this, function (_b) {
|
|
3242
|
+
style = (_a = params.style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
3243
|
+
entity = params.dataEntity;
|
|
3244
|
+
bColor = (style === null || style === void 0 ? void 0 : style.lineColor) ? Calculator.GetColor(style === null || style === void 0 ? void 0 : style.lineColor, entity, []) : null;
|
|
3245
|
+
cColor = bColor ? colorToCColor$1(bColor) : Color.WHITE;
|
|
3246
|
+
width = EnsureNumber((style === null || style === void 0 ? void 0 : style.lineWidth) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.lineWidth, entity, []) : 4, 4);
|
|
3247
|
+
if (width < 1) {
|
|
3248
|
+
width = 1;
|
|
3249
|
+
}
|
|
3250
|
+
duration = EnsureNumber((style === null || style === void 0 ? void 0 : style.duration) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.duration, entity, []) : 2, 2);
|
|
3251
|
+
hDistanceRatio = EnsureNumber((style === null || style === void 0 ? void 0 : style.heightDistanceRatio) ? Calculator.GetNumber(style === null || style === void 0 ? void 0 : style.heightDistanceRatio, entity, []) : 0.25, 0.25);
|
|
3252
|
+
fromPos = null;
|
|
3253
|
+
toPos = null;
|
|
3254
|
+
updatingPosses = false;
|
|
3255
|
+
updatePosses = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3256
|
+
var e_1;
|
|
3257
|
+
return __generator(this, function (_a) {
|
|
3258
|
+
switch (_a.label) {
|
|
3259
|
+
case 0:
|
|
3260
|
+
if (updatingPosses) {
|
|
3261
|
+
return [2 /*return*/];
|
|
3262
|
+
}
|
|
3263
|
+
updatingPosses = true;
|
|
3264
|
+
_a.label = 1;
|
|
3265
|
+
case 1:
|
|
3266
|
+
_a.trys.push([1, 4, , 5]);
|
|
3267
|
+
return [4 /*yield*/, EntityUtils.GetPosAsync({
|
|
3268
|
+
// Not passing it so it requests entity with expanded tileset information instead.
|
|
3269
|
+
//entity: params.fromEntity,
|
|
3270
|
+
viewer: params.viewer,
|
|
3271
|
+
visualRegister: params.visualRegister,
|
|
3272
|
+
returnHeightRef: HeightReference.NONE,
|
|
3273
|
+
recordHeightRef: HeightReference.CLAMP_TO_GROUND,
|
|
3274
|
+
api: params.apiGetter.getApi(),
|
|
3275
|
+
entityId: params.fromEntity.Bruce.ID
|
|
3276
|
+
})];
|
|
3277
|
+
case 2:
|
|
3278
|
+
fromPos = _a.sent();
|
|
3279
|
+
return [4 /*yield*/, EntityUtils.GetPosAsync({
|
|
3280
|
+
// Not passing it so it requests entity with expanded tileset information instead.
|
|
3281
|
+
//entity: params.toEntity,
|
|
3282
|
+
viewer: params.viewer,
|
|
3283
|
+
visualRegister: params.visualRegister,
|
|
3284
|
+
returnHeightRef: HeightReference.NONE,
|
|
3285
|
+
recordHeightRef: HeightReference.CLAMP_TO_GROUND,
|
|
3286
|
+
api: params.apiGetter.getApi(),
|
|
3287
|
+
entityId: params.toEntity.Bruce.ID
|
|
3288
|
+
})];
|
|
3289
|
+
case 3:
|
|
3290
|
+
toPos = _a.sent();
|
|
3291
|
+
return [3 /*break*/, 5];
|
|
3292
|
+
case 4:
|
|
3293
|
+
e_1 = _a.sent();
|
|
3294
|
+
console.error(e_1);
|
|
3295
|
+
return [3 /*break*/, 5];
|
|
3296
|
+
case 5:
|
|
3297
|
+
updatingPosses = false;
|
|
3298
|
+
return [2 /*return*/];
|
|
3299
|
+
}
|
|
3300
|
+
});
|
|
3301
|
+
}); };
|
|
3302
|
+
updatePosses();
|
|
3303
|
+
parabola = new CesiumParabola({
|
|
3149
3304
|
viewer: params.viewer,
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3305
|
+
pos1: function () { return fromPos; },
|
|
3306
|
+
pos2: function () { return toPos; },
|
|
3307
|
+
color: cColor.toCssColorString(),
|
|
3308
|
+
width: width,
|
|
3309
|
+
duration: duration,
|
|
3310
|
+
heightDistanceRatio: hDistanceRatio
|
|
3153
3311
|
});
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3312
|
+
cEntities = parabola.Animate();
|
|
3313
|
+
cEntity = cEntities.parabola;
|
|
3314
|
+
cEntity._siblingGraphics = [];
|
|
3315
|
+
for (i = 0; i < cEntities.siblings.length; i++) {
|
|
3316
|
+
sibling = cEntities.siblings[i];
|
|
3317
|
+
cEntity._siblingGraphics.push(sibling);
|
|
3318
|
+
}
|
|
3319
|
+
updateInterval = setInterval(function () {
|
|
3320
|
+
var _a;
|
|
3321
|
+
if (!((_a = params.viewer) === null || _a === void 0 ? void 0 : _a.scene) ||
|
|
3322
|
+
params.viewer.isDestroyed() ||
|
|
3323
|
+
!params.viewer.entities.contains(cEntity)) {
|
|
3324
|
+
clearInterval(updateInterval);
|
|
3325
|
+
parabola.Dispose();
|
|
3326
|
+
return;
|
|
3327
|
+
}
|
|
3328
|
+
updatePosses();
|
|
3329
|
+
}, 1000);
|
|
3330
|
+
return [2 /*return*/, cEntity];
|
|
3331
|
+
});
|
|
3169
3332
|
});
|
|
3170
|
-
var cEntities = parabola.Animate();
|
|
3171
|
-
var cEntity = cEntities.parabola;
|
|
3172
|
-
cEntity._siblingGraphics = [];
|
|
3173
|
-
for (var i = 0; i < cEntities.siblings.length; i++) {
|
|
3174
|
-
var sibling = cEntities.siblings[i];
|
|
3175
|
-
cEntity._siblingGraphics.push(sibling);
|
|
3176
|
-
}
|
|
3177
|
-
var updateInterval = setInterval(function () {
|
|
3178
|
-
var _a;
|
|
3179
|
-
if (!((_a = params.viewer) === null || _a === void 0 ? void 0 : _a.scene) ||
|
|
3180
|
-
params.viewer.isDestroyed() ||
|
|
3181
|
-
!params.viewer.entities.contains(cEntity)) {
|
|
3182
|
-
clearInterval(updateInterval);
|
|
3183
|
-
parabola.Dispose();
|
|
3184
|
-
return;
|
|
3185
|
-
}
|
|
3186
|
-
updatePosses();
|
|
3187
|
-
}, 1000);
|
|
3188
|
-
return cEntity;
|
|
3189
3333
|
}
|
|
3190
3334
|
Parabola.Render = Render;
|
|
3191
3335
|
})(Parabola = RelationRenderEngine.Parabola || (RelationRenderEngine.Parabola = {}));
|