bruce-cesium 2.6.3 → 2.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 +125 -34
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +124 -33
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +82 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.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/dist/types/rendering/render-managers/entities/entities-loaded-render-manager.d.ts +22 -0
- package/package.json +1 -1
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, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, ColorMaterialProperty, EasingFunction, GeometryInstance, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, 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;
|
|
@@ -5755,8 +5776,67 @@ var EntitiesLoadedRenderManager;
|
|
|
5755
5776
|
enumerable: false,
|
|
5756
5777
|
configurable: true
|
|
5757
5778
|
});
|
|
5758
|
-
|
|
5779
|
+
/**
|
|
5780
|
+
* Adds entities to menu item and queues the render for them.
|
|
5781
|
+
* If the entity already exists in the menu item, it will be removed and redrawn.
|
|
5782
|
+
* @param params
|
|
5783
|
+
*/
|
|
5784
|
+
Manager.prototype.AddEntities = function (params) {
|
|
5759
5785
|
var _this = this;
|
|
5786
|
+
var _a;
|
|
5787
|
+
if (this.disposed) {
|
|
5788
|
+
throw (new Error("This item is disposed."));
|
|
5789
|
+
}
|
|
5790
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
5791
|
+
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
5792
|
+
}
|
|
5793
|
+
var entities = params.entities;
|
|
5794
|
+
entities.forEach(function (x) {
|
|
5795
|
+
var _a;
|
|
5796
|
+
// If already in the menu item we'll first remove it.
|
|
5797
|
+
// That way we're using the latest provided data.
|
|
5798
|
+
var entityId = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
5799
|
+
var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; });
|
|
5800
|
+
if (index > -1) {
|
|
5801
|
+
_this.item.BruceEntity.Entities.splice(index, 1);
|
|
5802
|
+
}
|
|
5803
|
+
_this.item.BruceEntity.Entities.push(x);
|
|
5804
|
+
});
|
|
5805
|
+
this.ReRender({
|
|
5806
|
+
entities: entities,
|
|
5807
|
+
entityIds: entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; }),
|
|
5808
|
+
force: true
|
|
5809
|
+
});
|
|
5810
|
+
this.recreateGetter();
|
|
5811
|
+
};
|
|
5812
|
+
/**
|
|
5813
|
+
* Removes entities from the menu item that match provided IDs.
|
|
5814
|
+
* Any visuals will be removed as well.
|
|
5815
|
+
* @param params
|
|
5816
|
+
*/
|
|
5817
|
+
Manager.prototype.RemoveEntities = function (params) {
|
|
5818
|
+
var _this = this;
|
|
5819
|
+
var _a;
|
|
5820
|
+
if (this.disposed) {
|
|
5821
|
+
throw (new Error("This item is disposed."));
|
|
5822
|
+
}
|
|
5823
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
5824
|
+
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
5825
|
+
}
|
|
5826
|
+
var entityIds = params.entityIds;
|
|
5827
|
+
entityIds.forEach(function (x) {
|
|
5828
|
+
var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == x; });
|
|
5829
|
+
if (index > -1) {
|
|
5830
|
+
_this.item.BruceEntity.Entities.splice(index, 1);
|
|
5831
|
+
}
|
|
5832
|
+
_this.visualsManager.RemoveRegos({
|
|
5833
|
+
entityId: x,
|
|
5834
|
+
menuItemId: _this.item.id
|
|
5835
|
+
});
|
|
5836
|
+
});
|
|
5837
|
+
this.recreateGetter();
|
|
5838
|
+
};
|
|
5839
|
+
Manager.prototype.Init = function () {
|
|
5760
5840
|
var _a;
|
|
5761
5841
|
if (this.disposed) {
|
|
5762
5842
|
throw (new Error("This item is disposed."));
|
|
@@ -5773,6 +5853,17 @@ var EntitiesLoadedRenderManager;
|
|
|
5773
5853
|
}
|
|
5774
5854
|
];
|
|
5775
5855
|
}
|
|
5856
|
+
this.recreateGetter();
|
|
5857
|
+
};
|
|
5858
|
+
/**
|
|
5859
|
+
* Recreates the getter for the entities.
|
|
5860
|
+
* This is used when the entities within the menu item are updated.
|
|
5861
|
+
* @todo: this causes a bad side-effect where all menu item entities are queued for a re-render.
|
|
5862
|
+
*/
|
|
5863
|
+
Manager.prototype.recreateGetter = function () {
|
|
5864
|
+
var _this = this;
|
|
5865
|
+
var _a;
|
|
5866
|
+
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
5776
5867
|
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, BATCH_SIZE$1);
|
|
5777
5868
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
5778
5869
|
var _a;
|
|
@@ -15055,7 +15146,7 @@ var ViewerUtils;
|
|
|
15055
15146
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15056
15147
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
15057
15148
|
|
|
15058
|
-
var VERSION$1 = "2.6.
|
|
15149
|
+
var VERSION$1 = "2.6.5";
|
|
15059
15150
|
|
|
15060
15151
|
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 };
|
|
15061
15152
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|