bruce-cesium 2.6.4 → 2.6.6
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 +111 -17
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +110 -16
- 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/entities/entities-loaded-render-manager.js +107 -13
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.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 +27 -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,
|
|
3
|
+
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, JulianDate, Primitive, Cesium3DTileFeature, HeadingPitchRange, Cesium3DTileColorBlendMode, Cesium3DTileStyle, KmlDataSource, createOsmBuildings, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, CesiumInspector, OrthographicFrustum, defined, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, ColorMaterialProperty, EasingFunction, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, 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
|
}
|
|
@@ -5757,17 +5768,20 @@ var EntitiesLoadedRenderManager;
|
|
|
5757
5768
|
(function (EntitiesLoadedRenderManager) {
|
|
5758
5769
|
var Manager = /** @class */ (function () {
|
|
5759
5770
|
function Manager(params) {
|
|
5771
|
+
var _a;
|
|
5760
5772
|
this.getter = null;
|
|
5761
5773
|
this.getterSub = null;
|
|
5762
5774
|
this.disposed = false;
|
|
5763
5775
|
this.renderedEntities = {};
|
|
5764
|
-
this.updatedEntities = {};
|
|
5765
5776
|
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register;
|
|
5766
5777
|
this.viewer = viewer;
|
|
5767
5778
|
this.apiGetter = apiGetter;
|
|
5768
5779
|
this.monitor = monitor;
|
|
5769
5780
|
this.item = item;
|
|
5770
5781
|
this.visualsManager = visualsManager;
|
|
5782
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
5783
|
+
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
5784
|
+
}
|
|
5771
5785
|
}
|
|
5772
5786
|
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
5773
5787
|
get: function () {
|
|
@@ -5776,8 +5790,75 @@ var EntitiesLoadedRenderManager;
|
|
|
5776
5790
|
enumerable: false,
|
|
5777
5791
|
configurable: true
|
|
5778
5792
|
});
|
|
5779
|
-
|
|
5793
|
+
/**
|
|
5794
|
+
* Adds entities to menu item and queues the render for them.
|
|
5795
|
+
* If the entity already exists in the menu item, it will be removed and redrawn.
|
|
5796
|
+
* @param params
|
|
5797
|
+
*/
|
|
5798
|
+
Manager.prototype.AddEntities = function (params) {
|
|
5799
|
+
var _this = this;
|
|
5800
|
+
if (this.disposed) {
|
|
5801
|
+
throw (new Error("This item is disposed."));
|
|
5802
|
+
}
|
|
5803
|
+
var entities = params.entities;
|
|
5804
|
+
entities.forEach(function (x) {
|
|
5805
|
+
var _a;
|
|
5806
|
+
// If already in the menu item we'll first remove it.
|
|
5807
|
+
// That way we're using the latest provided data.
|
|
5808
|
+
var entityId = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
5809
|
+
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; });
|
|
5810
|
+
if (index > -1) {
|
|
5811
|
+
_this.item.BruceEntity.Entities.splice(index, 1);
|
|
5812
|
+
}
|
|
5813
|
+
_this.item.BruceEntity.Entities.push(x);
|
|
5814
|
+
});
|
|
5815
|
+
this.ReRender({
|
|
5816
|
+
entities: entities,
|
|
5817
|
+
entityIds: entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; }),
|
|
5818
|
+
force: true
|
|
5819
|
+
});
|
|
5820
|
+
this.recreateGetter();
|
|
5821
|
+
};
|
|
5822
|
+
/**
|
|
5823
|
+
* Removes entities from the menu item that match provided IDs.
|
|
5824
|
+
* Any visuals will be removed as well.
|
|
5825
|
+
* @param params
|
|
5826
|
+
*/
|
|
5827
|
+
Manager.prototype.RemoveEntities = function (params) {
|
|
5780
5828
|
var _this = this;
|
|
5829
|
+
if (this.disposed) {
|
|
5830
|
+
throw (new Error("This item is disposed."));
|
|
5831
|
+
}
|
|
5832
|
+
var entityIds = params.entityIds;
|
|
5833
|
+
entityIds.forEach(function (x) {
|
|
5834
|
+
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; });
|
|
5835
|
+
if (index > -1) {
|
|
5836
|
+
_this.item.BruceEntity.Entities.splice(index, 1);
|
|
5837
|
+
}
|
|
5838
|
+
_this.visualsManager.RemoveRegos({
|
|
5839
|
+
entityId: x,
|
|
5840
|
+
menuItemId: _this.item.id
|
|
5841
|
+
});
|
|
5842
|
+
_this.renderedEntities[x] = false;
|
|
5843
|
+
});
|
|
5844
|
+
this.recreateGetter();
|
|
5845
|
+
};
|
|
5846
|
+
/**
|
|
5847
|
+
* Clears all entities from the menu item.
|
|
5848
|
+
* Any visuals will be removed as well.
|
|
5849
|
+
*/
|
|
5850
|
+
Manager.prototype.ClearEntities = function () {
|
|
5851
|
+
if (this.disposed) {
|
|
5852
|
+
throw (new Error("This item is disposed."));
|
|
5853
|
+
}
|
|
5854
|
+
this.item.BruceEntity.Entities = [];
|
|
5855
|
+
this.visualsManager.RemoveRegos({
|
|
5856
|
+
menuItemId: this.item.id
|
|
5857
|
+
});
|
|
5858
|
+
this.renderedEntities = {};
|
|
5859
|
+
this.recreateGetter();
|
|
5860
|
+
};
|
|
5861
|
+
Manager.prototype.Init = function () {
|
|
5781
5862
|
var _a;
|
|
5782
5863
|
if (this.disposed) {
|
|
5783
5864
|
throw (new Error("This item is disposed."));
|
|
@@ -5794,6 +5875,17 @@ var EntitiesLoadedRenderManager;
|
|
|
5794
5875
|
}
|
|
5795
5876
|
];
|
|
5796
5877
|
}
|
|
5878
|
+
this.recreateGetter();
|
|
5879
|
+
};
|
|
5880
|
+
/**
|
|
5881
|
+
* Recreates the getter for the entities.
|
|
5882
|
+
* This is used when the entities within the menu item are updated.
|
|
5883
|
+
* @todo: this causes a bad side-effect where all menu item entities are queued for a re-render.
|
|
5884
|
+
*/
|
|
5885
|
+
Manager.prototype.recreateGetter = function () {
|
|
5886
|
+
var _this = this;
|
|
5887
|
+
var _a;
|
|
5888
|
+
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
5797
5889
|
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, BATCH_SIZE$1);
|
|
5798
5890
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
5799
5891
|
var _a;
|
|
@@ -5840,10 +5932,6 @@ var EntitiesLoadedRenderManager;
|
|
|
5840
5932
|
}
|
|
5841
5933
|
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
5842
5934
|
entities = [].concat(entities).filter(function (x) { var _a; return entityIds.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID); });
|
|
5843
|
-
entities.forEach(function (x) {
|
|
5844
|
-
var _a;
|
|
5845
|
-
_this.updatedEntities[(_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = x;
|
|
5846
|
-
});
|
|
5847
5935
|
}
|
|
5848
5936
|
this.visualsManager.MarkStale({
|
|
5849
5937
|
entityIds: entityIds,
|
|
@@ -5894,7 +5982,6 @@ var EntitiesLoadedRenderManager;
|
|
|
5894
5982
|
if (!(ids.length > 0)) return [3 /*break*/, 4];
|
|
5895
5983
|
checkBatch = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5896
5984
|
var entityIds, entities;
|
|
5897
|
-
var _this = this;
|
|
5898
5985
|
return __generator(this, function (_a) {
|
|
5899
5986
|
switch (_a.label) {
|
|
5900
5987
|
case 0:
|
|
@@ -5908,10 +5995,6 @@ var EntitiesLoadedRenderManager;
|
|
|
5908
5995
|
if (this.disposed) {
|
|
5909
5996
|
return [2 /*return*/];
|
|
5910
5997
|
}
|
|
5911
|
-
entities.forEach(function (x) {
|
|
5912
|
-
var _a;
|
|
5913
|
-
_this.updatedEntities[(_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = x;
|
|
5914
|
-
});
|
|
5915
5998
|
this.onGetterUpdate(entities, force);
|
|
5916
5999
|
return [2 /*return*/];
|
|
5917
6000
|
}
|
|
@@ -5938,7 +6021,8 @@ var EntitiesLoadedRenderManager;
|
|
|
5938
6021
|
var _a;
|
|
5939
6022
|
if (force === void 0) { force = false; }
|
|
5940
6023
|
return __awaiter(this, void 0, void 0, function () {
|
|
5941
|
-
var cEntities, i, entity, id, cEntity, visual, e_2;
|
|
6024
|
+
var isEntityInItem_1, cEntities, i, entity, id, cEntity, visual, e_2;
|
|
6025
|
+
var _this = this;
|
|
5942
6026
|
return __generator(this, function (_b) {
|
|
5943
6027
|
switch (_b.label) {
|
|
5944
6028
|
case 0:
|
|
@@ -5946,6 +6030,16 @@ var EntitiesLoadedRenderManager;
|
|
|
5946
6030
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
5947
6031
|
return [2 /*return*/];
|
|
5948
6032
|
}
|
|
6033
|
+
isEntityInItem_1 = function (entityId) {
|
|
6034
|
+
var _a, _b;
|
|
6035
|
+
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; });
|
|
6036
|
+
};
|
|
6037
|
+
// Filter out entities that aren't in the menu item.
|
|
6038
|
+
// This can happen if the menu item is updated while the getter is running.
|
|
6039
|
+
entities = entities.filter(function (x) {
|
|
6040
|
+
var _a;
|
|
6041
|
+
return isEntityInItem_1((_a = x === null || x === void 0 ? void 0 : x.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
6042
|
+
});
|
|
5949
6043
|
return [4 /*yield*/, EntityRenderEngine.Render({
|
|
5950
6044
|
viewer: this.viewer,
|
|
5951
6045
|
apiGetter: this.apiGetter,
|
|
@@ -5962,7 +6056,7 @@ var EntitiesLoadedRenderManager;
|
|
|
5962
6056
|
id = entity.Bruce.ID;
|
|
5963
6057
|
cEntity = cEntities[id];
|
|
5964
6058
|
this.renderedEntities[id] = !!cEntity;
|
|
5965
|
-
if (cEntity) {
|
|
6059
|
+
if (cEntity && isEntityInItem_1(id)) {
|
|
5966
6060
|
visual = (_a = this.visualsManager.GetRego({
|
|
5967
6061
|
entityId: id,
|
|
5968
6062
|
menuItemId: this.item.id
|
|
@@ -15076,7 +15170,7 @@ var ViewerUtils;
|
|
|
15076
15170
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15077
15171
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
15078
15172
|
|
|
15079
|
-
var VERSION$1 = "2.6.
|
|
15173
|
+
var VERSION$1 = "2.6.6";
|
|
15080
15174
|
|
|
15081
15175
|
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 };
|
|
15082
15176
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|