bruce-cesium 2.6.5 → 2.6.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 +61 -31
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +60 -30
- 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 +13 -2
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js +1 -0
- package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +33 -20
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +12 -7
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/shared-getters.d.ts +1 -0
- package/dist/types/rendering/render-managers/entities/entities-loaded-render-manager.d.ts +5 -1
- 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, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, HeightReference, DistanceDisplayCondition, NearFarScalar,
|
|
3
|
+
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, Entity, Primitive, Cesium3DTileFeature, HeightReference, DistanceDisplayCondition, NearFarScalar, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, HeadingPitchRange, Cesium3DTileColorBlendMode, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Model, Matrix4, Matrix3, IonResource, 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;
|
|
@@ -1715,7 +1715,7 @@ function getValue(viewer, obj) {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
function getName(api, entity) {
|
|
1717
1717
|
return __awaiter(this, void 0, void 0, function () {
|
|
1718
|
-
var typeId, type, name_1, e_1;
|
|
1718
|
+
var typeId, type, name_1, e_1, hideError, error, code;
|
|
1719
1719
|
return __generator(this, function (_a) {
|
|
1720
1720
|
switch (_a.label) {
|
|
1721
1721
|
case 0:
|
|
@@ -1742,7 +1742,18 @@ function getName(api, entity) {
|
|
|
1742
1742
|
return [3 /*break*/, 4];
|
|
1743
1743
|
case 3:
|
|
1744
1744
|
e_1 = _a.sent();
|
|
1745
|
-
|
|
1745
|
+
hideError = false;
|
|
1746
|
+
// TODO: we need a util for extracting code + message rather than writing all this every time.
|
|
1747
|
+
if (e_1 && typeof e_1 == "object" && e_1.ERROR) {
|
|
1748
|
+
error = e_1.ERROR;
|
|
1749
|
+
code = error && typeof error == "object" ? error.Code : "";
|
|
1750
|
+
// Avoiding logging a common error.
|
|
1751
|
+
// This happens when rendering entities that don't have records.
|
|
1752
|
+
hideError = String(code).toLowerCase() == "notfound";
|
|
1753
|
+
}
|
|
1754
|
+
if (!hideError) {
|
|
1755
|
+
console.error(e_1);
|
|
1756
|
+
}
|
|
1746
1757
|
return [3 /*break*/, 4];
|
|
1747
1758
|
case 4: return [2 /*return*/, "Unknown entity"];
|
|
1748
1759
|
}
|
|
@@ -5444,6 +5455,12 @@ var EntitiesRenderManager;
|
|
|
5444
5455
|
var _this = this;
|
|
5445
5456
|
var _a;
|
|
5446
5457
|
this.unsetGetter();
|
|
5458
|
+
var isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
|
|
5459
|
+
var tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
|
|
5460
|
+
if (!tagsToRender) {
|
|
5461
|
+
tagsToRender = [];
|
|
5462
|
+
}
|
|
5463
|
+
tagsToRender = [].concat(tagsToRender);
|
|
5447
5464
|
this.getter = this.sharedGetters.GetOrCreateFilterGetter({
|
|
5448
5465
|
api: this.apiGetter.getApi(),
|
|
5449
5466
|
attrFilter: (_a = this.item.BruceEntity.Filter) !== null && _a !== void 0 ? _a : {},
|
|
@@ -5451,19 +5468,18 @@ var EntitiesRenderManager;
|
|
|
5451
5468
|
typeId: this.item.BruceEntity["EntityType.ID"],
|
|
5452
5469
|
monitor: this.monitor,
|
|
5453
5470
|
viewer: this.viewer,
|
|
5471
|
+
// Unfortunately this searches as an "AND" rather than "OR" which does not meet our needs here.
|
|
5472
|
+
// So for multiple tags we'll manually sort on UI end...
|
|
5473
|
+
tagIds: tagsToRender.length == 1 ? tagsToRender : [],
|
|
5454
5474
|
debugShowBounds: Boolean(window === null || window === void 0 ? void 0 : window.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS),
|
|
5455
5475
|
cdn: this.item.cdnEnabled
|
|
5456
5476
|
});
|
|
5457
5477
|
var minMax = RenderManager.GetZoomMinMax({
|
|
5458
5478
|
zoomControl: this.item.CameraZoomSettings
|
|
5459
5479
|
});
|
|
5460
|
-
this
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
if (!tagsToRender) {
|
|
5464
|
-
tagsToRender = [];
|
|
5465
|
-
}
|
|
5466
|
-
tagsToRender = [].concat(tagsToRender);
|
|
5480
|
+
// Unfortunately this searches as an "AND" rather than "OR" which does not meet our needs here.
|
|
5481
|
+
// So for multiple tags we'll manually sort on UI end...
|
|
5482
|
+
this.getter.IncludeMenuItem(this.item.id, tagsToRender.length == 1 ? tagsToRender : [], minMax[0], minMax[1]);
|
|
5467
5483
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
5468
5484
|
if (isTagItem) {
|
|
5469
5485
|
_this.distributeForRender(entities.filter(function (entity) {
|
|
@@ -5757,17 +5773,20 @@ var EntitiesLoadedRenderManager;
|
|
|
5757
5773
|
(function (EntitiesLoadedRenderManager) {
|
|
5758
5774
|
var Manager = /** @class */ (function () {
|
|
5759
5775
|
function Manager(params) {
|
|
5776
|
+
var _a;
|
|
5760
5777
|
this.getter = null;
|
|
5761
5778
|
this.getterSub = null;
|
|
5762
5779
|
this.disposed = false;
|
|
5763
5780
|
this.renderedEntities = {};
|
|
5764
|
-
this.updatedEntities = {};
|
|
5765
5781
|
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register;
|
|
5766
5782
|
this.viewer = viewer;
|
|
5767
5783
|
this.apiGetter = apiGetter;
|
|
5768
5784
|
this.monitor = monitor;
|
|
5769
5785
|
this.item = item;
|
|
5770
5786
|
this.visualsManager = visualsManager;
|
|
5787
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
5788
|
+
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
5789
|
+
}
|
|
5771
5790
|
}
|
|
5772
5791
|
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
5773
5792
|
get: function () {
|
|
@@ -5783,13 +5802,9 @@ var EntitiesLoadedRenderManager;
|
|
|
5783
5802
|
*/
|
|
5784
5803
|
Manager.prototype.AddEntities = function (params) {
|
|
5785
5804
|
var _this = this;
|
|
5786
|
-
var _a;
|
|
5787
5805
|
if (this.disposed) {
|
|
5788
5806
|
throw (new Error("This item is disposed."));
|
|
5789
5807
|
}
|
|
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
5808
|
var entities = params.entities;
|
|
5794
5809
|
entities.forEach(function (x) {
|
|
5795
5810
|
var _a;
|
|
@@ -5816,13 +5831,9 @@ var EntitiesLoadedRenderManager;
|
|
|
5816
5831
|
*/
|
|
5817
5832
|
Manager.prototype.RemoveEntities = function (params) {
|
|
5818
5833
|
var _this = this;
|
|
5819
|
-
var _a;
|
|
5820
5834
|
if (this.disposed) {
|
|
5821
5835
|
throw (new Error("This item is disposed."));
|
|
5822
5836
|
}
|
|
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
5837
|
var entityIds = params.entityIds;
|
|
5827
5838
|
entityIds.forEach(function (x) {
|
|
5828
5839
|
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; });
|
|
@@ -5833,9 +5844,25 @@ var EntitiesLoadedRenderManager;
|
|
|
5833
5844
|
entityId: x,
|
|
5834
5845
|
menuItemId: _this.item.id
|
|
5835
5846
|
});
|
|
5847
|
+
_this.renderedEntities[x] = false;
|
|
5836
5848
|
});
|
|
5837
5849
|
this.recreateGetter();
|
|
5838
5850
|
};
|
|
5851
|
+
/**
|
|
5852
|
+
* Clears all entities from the menu item.
|
|
5853
|
+
* Any visuals will be removed as well.
|
|
5854
|
+
*/
|
|
5855
|
+
Manager.prototype.ClearEntities = function () {
|
|
5856
|
+
if (this.disposed) {
|
|
5857
|
+
throw (new Error("This item is disposed."));
|
|
5858
|
+
}
|
|
5859
|
+
this.item.BruceEntity.Entities = [];
|
|
5860
|
+
this.visualsManager.RemoveRegos({
|
|
5861
|
+
menuItemId: this.item.id
|
|
5862
|
+
});
|
|
5863
|
+
this.renderedEntities = {};
|
|
5864
|
+
this.recreateGetter();
|
|
5865
|
+
};
|
|
5839
5866
|
Manager.prototype.Init = function () {
|
|
5840
5867
|
var _a;
|
|
5841
5868
|
if (this.disposed) {
|
|
@@ -5910,10 +5937,6 @@ var EntitiesLoadedRenderManager;
|
|
|
5910
5937
|
}
|
|
5911
5938
|
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
5912
5939
|
entities = [].concat(entities).filter(function (x) { var _a; return entityIds.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID); });
|
|
5913
|
-
entities.forEach(function (x) {
|
|
5914
|
-
var _a;
|
|
5915
|
-
_this.updatedEntities[(_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = x;
|
|
5916
|
-
});
|
|
5917
5940
|
}
|
|
5918
5941
|
this.visualsManager.MarkStale({
|
|
5919
5942
|
entityIds: entityIds,
|
|
@@ -5964,7 +5987,6 @@ var EntitiesLoadedRenderManager;
|
|
|
5964
5987
|
if (!(ids.length > 0)) return [3 /*break*/, 4];
|
|
5965
5988
|
checkBatch = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5966
5989
|
var entityIds, entities;
|
|
5967
|
-
var _this = this;
|
|
5968
5990
|
return __generator(this, function (_a) {
|
|
5969
5991
|
switch (_a.label) {
|
|
5970
5992
|
case 0:
|
|
@@ -5978,10 +6000,6 @@ var EntitiesLoadedRenderManager;
|
|
|
5978
6000
|
if (this.disposed) {
|
|
5979
6001
|
return [2 /*return*/];
|
|
5980
6002
|
}
|
|
5981
|
-
entities.forEach(function (x) {
|
|
5982
|
-
var _a;
|
|
5983
|
-
_this.updatedEntities[(_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = x;
|
|
5984
|
-
});
|
|
5985
6003
|
this.onGetterUpdate(entities, force);
|
|
5986
6004
|
return [2 /*return*/];
|
|
5987
6005
|
}
|
|
@@ -6008,7 +6026,8 @@ var EntitiesLoadedRenderManager;
|
|
|
6008
6026
|
var _a;
|
|
6009
6027
|
if (force === void 0) { force = false; }
|
|
6010
6028
|
return __awaiter(this, void 0, void 0, function () {
|
|
6011
|
-
var cEntities, i, entity, id, cEntity, visual, e_2;
|
|
6029
|
+
var isEntityInItem_1, cEntities, i, entity, id, cEntity, visual, e_2;
|
|
6030
|
+
var _this = this;
|
|
6012
6031
|
return __generator(this, function (_b) {
|
|
6013
6032
|
switch (_b.label) {
|
|
6014
6033
|
case 0:
|
|
@@ -6016,6 +6035,16 @@ var EntitiesLoadedRenderManager;
|
|
|
6016
6035
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
6017
6036
|
return [2 /*return*/];
|
|
6018
6037
|
}
|
|
6038
|
+
isEntityInItem_1 = function (entityId) {
|
|
6039
|
+
var _a, _b;
|
|
6040
|
+
return (_b = (_a = _this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities) === null || _b === void 0 ? void 0 : _b.find(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; });
|
|
6041
|
+
};
|
|
6042
|
+
// Filter out entities that aren't in the menu item.
|
|
6043
|
+
// This can happen if the menu item is updated while the getter is running.
|
|
6044
|
+
entities = entities.filter(function (x) {
|
|
6045
|
+
var _a;
|
|
6046
|
+
return isEntityInItem_1((_a = x === null || x === void 0 ? void 0 : x.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
6047
|
+
});
|
|
6019
6048
|
return [4 /*yield*/, EntityRenderEngine.Render({
|
|
6020
6049
|
viewer: this.viewer,
|
|
6021
6050
|
apiGetter: this.apiGetter,
|
|
@@ -6032,7 +6061,7 @@ var EntitiesLoadedRenderManager;
|
|
|
6032
6061
|
id = entity.Bruce.ID;
|
|
6033
6062
|
cEntity = cEntities[id];
|
|
6034
6063
|
this.renderedEntities[id] = !!cEntity;
|
|
6035
|
-
if (cEntity) {
|
|
6064
|
+
if (cEntity && isEntityInItem_1(id)) {
|
|
6036
6065
|
visual = (_a = this.visualsManager.GetRego({
|
|
6037
6066
|
entityId: id,
|
|
6038
6067
|
menuItemId: this.item.id
|
|
@@ -7744,6 +7773,7 @@ function createFilterGetterCacheKey(params) {
|
|
|
7744
7773
|
cacheKey += params.typeId;
|
|
7745
7774
|
cacheKey += params.batchSize;
|
|
7746
7775
|
cacheKey += String(params.cdn);
|
|
7776
|
+
cacheKey += JSON.stringify(params.tagIds ? params.tagIds : []);
|
|
7747
7777
|
// This could potentially crash, but if it crashes here then it would crash during API request anyways.
|
|
7748
7778
|
cacheKey += JSON.stringify(params.attrFilter ? params.attrFilter : {});
|
|
7749
7779
|
return cacheKey;
|
|
@@ -15146,7 +15176,7 @@ var ViewerUtils;
|
|
|
15146
15176
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15147
15177
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
15148
15178
|
|
|
15149
|
-
var VERSION$1 = "2.6.
|
|
15179
|
+
var VERSION$1 = "2.6.7";
|
|
15150
15180
|
|
|
15151
15181
|
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 };
|
|
15152
15182
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|