bruce-cesium 3.3.6 → 3.3.8
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 +366 -45
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +364 -43
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +79 -4
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +251 -24
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visual-register-culler.js +1 -1
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +32 -11
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +6 -0
- package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +17 -0
- package/dist/types/rendering/visuals-register.d.ts +4 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, BruceEvent, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ProgramKey,
|
|
1
|
+
import { Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, ENVIRONMENT, BruceEvent, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, PolygonPipeline, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ColorMaterialProperty } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3052,7 +3052,7 @@ function runCullChecker(register) {
|
|
|
3052
3052
|
var rego = register.GetRego({
|
|
3053
3053
|
entityId: entityId
|
|
3054
3054
|
});
|
|
3055
|
-
if (!rego || !rego.visual || !(rego.visual instanceof Entity) || rego.relation != null || rego.overrideShow != null) {
|
|
3055
|
+
if (!rego || !rego.visual || !(rego.visual instanceof Entity) || rego.relation != null || rego.overrideShow != null || rego.collection) {
|
|
3056
3056
|
continue;
|
|
3057
3057
|
}
|
|
3058
3058
|
var parts = EntityUtils.GatherEntity({
|
|
@@ -5615,12 +5615,19 @@ var EntityLabel;
|
|
|
5615
5615
|
// Override to make it draw at a different position.
|
|
5616
5616
|
this._pos3d = null;
|
|
5617
5617
|
this.prePositioned = false;
|
|
5618
|
+
// If the entity name is not loaded-in, we'll wait a moment then request the information.
|
|
5619
|
+
// We wait a moment to avoid the user quickly dragging their mouse over entities and spamming requests.
|
|
5620
|
+
this.loadTimeout = null;
|
|
5621
|
+
this.loadedName = false;
|
|
5618
5622
|
this.rego = params.rego;
|
|
5619
5623
|
this.viewer = params.viewer;
|
|
5620
5624
|
this.api = params.api;
|
|
5621
5625
|
this.visualRegister = params.visualRegister;
|
|
5622
5626
|
this.prePositioned = !isNaN((_a = params.pos3d) === null || _a === void 0 ? void 0 : _a.x);
|
|
5623
5627
|
this.createLabel(params.pos3d);
|
|
5628
|
+
if (!params.api && !ENVIRONMENT.IS_SELF_MANAGED) {
|
|
5629
|
+
params.api = ENVIRONMENT.Api().GetBruceApi();
|
|
5630
|
+
}
|
|
5624
5631
|
}
|
|
5625
5632
|
Object.defineProperty(Label.prototype, "Rego", {
|
|
5626
5633
|
get: function () {
|
|
@@ -5648,6 +5655,48 @@ var EntityLabel;
|
|
|
5648
5655
|
enumerable: false,
|
|
5649
5656
|
configurable: true
|
|
5650
5657
|
});
|
|
5658
|
+
/**
|
|
5659
|
+
* Loads the Entity's name and updates the corresponding visual rego.
|
|
5660
|
+
*/
|
|
5661
|
+
Label.prototype.loadName = function () {
|
|
5662
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5663
|
+
var rego, _a, e_1;
|
|
5664
|
+
return __generator(this, function (_b) {
|
|
5665
|
+
switch (_b.label) {
|
|
5666
|
+
case 0:
|
|
5667
|
+
if (this.loadedName) {
|
|
5668
|
+
return [2 /*return*/];
|
|
5669
|
+
}
|
|
5670
|
+
_b.label = 1;
|
|
5671
|
+
case 1:
|
|
5672
|
+
_b.trys.push([1, 4, , 5]);
|
|
5673
|
+
if (!this.api) return [3 /*break*/, 3];
|
|
5674
|
+
rego = this.rego;
|
|
5675
|
+
_a = this.rego;
|
|
5676
|
+
return [4 /*yield*/, Entity$1.CalculateNameAsync({
|
|
5677
|
+
api: this.api,
|
|
5678
|
+
entity: null,
|
|
5679
|
+
entityId: rego.entityId,
|
|
5680
|
+
defaultToId: false
|
|
5681
|
+
})];
|
|
5682
|
+
case 2:
|
|
5683
|
+
_a.name = _b.sent();
|
|
5684
|
+
if (!this.rego.name) {
|
|
5685
|
+
this.rego.name = "Unnamed Entity";
|
|
5686
|
+
}
|
|
5687
|
+
_b.label = 3;
|
|
5688
|
+
case 3: return [3 /*break*/, 5];
|
|
5689
|
+
case 4:
|
|
5690
|
+
e_1 = _b.sent();
|
|
5691
|
+
console.error(e_1);
|
|
5692
|
+
return [3 /*break*/, 5];
|
|
5693
|
+
case 5:
|
|
5694
|
+
this.loadedName = true;
|
|
5695
|
+
return [2 /*return*/];
|
|
5696
|
+
}
|
|
5697
|
+
});
|
|
5698
|
+
});
|
|
5699
|
+
};
|
|
5651
5700
|
/**
|
|
5652
5701
|
* Disposes label and marks instance as disposed.
|
|
5653
5702
|
* Recalling will be ignored.
|
|
@@ -5658,6 +5707,8 @@ var EntityLabel;
|
|
|
5658
5707
|
}
|
|
5659
5708
|
this.disposed = true;
|
|
5660
5709
|
this.removeLabel();
|
|
5710
|
+
clearTimeout(this.loadTimeout);
|
|
5711
|
+
this.loadTimeout = null;
|
|
5661
5712
|
};
|
|
5662
5713
|
/**
|
|
5663
5714
|
* Creates cesium entity for the label if one does not exist.
|
|
@@ -5666,7 +5717,7 @@ var EntityLabel;
|
|
|
5666
5717
|
Label.prototype.createLabel = function (starterPos3d) {
|
|
5667
5718
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
5668
5719
|
return __awaiter(this, void 0, void 0, function () {
|
|
5669
|
-
var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, model, size, height, scale, posses, centerIndex, text, type,
|
|
5720
|
+
var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, model, size, height, scale, posses, centerIndex, text, type, e_2, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel, terrTimeout;
|
|
5670
5721
|
var _this = this;
|
|
5671
5722
|
return __generator(this, function (_h) {
|
|
5672
5723
|
switch (_h.label) {
|
|
@@ -5834,7 +5885,7 @@ var EntityLabel;
|
|
|
5834
5885
|
}
|
|
5835
5886
|
this._pos3d = pos3d;
|
|
5836
5887
|
text = "Unknown Entity";
|
|
5837
|
-
if (!this.rego) return [3 /*break*/,
|
|
5888
|
+
if (!this.rego) return [3 /*break*/, 9];
|
|
5838
5889
|
if (!this.rego.relation) return [3 /*break*/, 7];
|
|
5839
5890
|
type = this.rego.relation.RelationType;
|
|
5840
5891
|
if (!(!type && this.rego.relation["Relation.Type.ID"])) return [3 /*break*/, 6];
|
|
@@ -5849,8 +5900,8 @@ var EntityLabel;
|
|
|
5849
5900
|
type = (_h.sent()).relationType;
|
|
5850
5901
|
return [3 /*break*/, 6];
|
|
5851
5902
|
case 5:
|
|
5852
|
-
|
|
5853
|
-
console.error(
|
|
5903
|
+
e_2 = _h.sent();
|
|
5904
|
+
console.error(e_2);
|
|
5854
5905
|
return [3 /*break*/, 6];
|
|
5855
5906
|
case 6:
|
|
5856
5907
|
if (type) {
|
|
@@ -5869,6 +5920,30 @@ var EntityLabel;
|
|
|
5869
5920
|
}
|
|
5870
5921
|
_h.label = 8;
|
|
5871
5922
|
case 8:
|
|
5923
|
+
if (text == "Unnamed Entity" && !this.loadedName) {
|
|
5924
|
+
text = "Loading...";
|
|
5925
|
+
clearTimeout(this.loadTimeout);
|
|
5926
|
+
this.loadTimeout = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5927
|
+
return __generator(this, function (_a) {
|
|
5928
|
+
switch (_a.label) {
|
|
5929
|
+
case 0:
|
|
5930
|
+
if (this.disposed || this.counter != counter) {
|
|
5931
|
+
return [2 /*return*/];
|
|
5932
|
+
}
|
|
5933
|
+
return [4 /*yield*/, this.loadName()];
|
|
5934
|
+
case 1:
|
|
5935
|
+
_a.sent();
|
|
5936
|
+
if (this.disposed || this.counter != counter) {
|
|
5937
|
+
return [2 /*return*/];
|
|
5938
|
+
}
|
|
5939
|
+
this.createLabel(starterPos3d);
|
|
5940
|
+
return [2 /*return*/];
|
|
5941
|
+
}
|
|
5942
|
+
});
|
|
5943
|
+
}); }, 120);
|
|
5944
|
+
}
|
|
5945
|
+
_h.label = 9;
|
|
5946
|
+
case 9:
|
|
5872
5947
|
if (this.disposed || this.counter != counter) {
|
|
5873
5948
|
return [2 /*return*/];
|
|
5874
5949
|
}
|
|
@@ -6106,8 +6181,14 @@ function removeEntity(viewer, visual) {
|
|
|
6106
6181
|
}
|
|
6107
6182
|
}
|
|
6108
6183
|
}
|
|
6109
|
-
|
|
6110
|
-
|
|
6184
|
+
var MAX_SHOW_DEPTH = 10;
|
|
6185
|
+
function updateCEntityShow(viewer, visual, rego, show, ignoreParent, depth) {
|
|
6186
|
+
if (depth === void 0) { depth = 0; }
|
|
6187
|
+
if (depth > MAX_SHOW_DEPTH) {
|
|
6188
|
+
console.warn("updateCEntityShow(): Max show depth reached. EntityId = " + rego.entityId);
|
|
6189
|
+
return;
|
|
6190
|
+
}
|
|
6191
|
+
if (show && !rego.relation && !rego.overrideShow && !rego.collection) {
|
|
6111
6192
|
// Culling is controlled by "visual-register-culler.ts".
|
|
6112
6193
|
// When an object is unculled then the 'updateEntityShow' function is re-called to reveal it and related objects.
|
|
6113
6194
|
// A sub-object can be culled while the siblings are not.
|
|
@@ -6115,31 +6196,42 @@ function updateCEntityShow(viewer, isRelationship, visual, isShowOverriden, show
|
|
|
6115
6196
|
show = !isCulled;
|
|
6116
6197
|
}
|
|
6117
6198
|
if (visual._parentEntity && !ignoreParent) {
|
|
6118
|
-
updateCEntityShow(viewer,
|
|
6199
|
+
updateCEntityShow(viewer, visual._parentEntity, rego, show, false, depth + 1);
|
|
6119
6200
|
}
|
|
6120
6201
|
if (visual._siblingGraphics) {
|
|
6121
6202
|
for (var i = 0; i < visual._siblingGraphics.length; i++) {
|
|
6122
6203
|
var sibling = visual._siblingGraphics[i];
|
|
6123
|
-
updateCEntityShow(viewer,
|
|
6204
|
+
updateCEntityShow(viewer, sibling, rego, show, true, depth + 1);
|
|
6124
6205
|
}
|
|
6125
6206
|
}
|
|
6126
6207
|
/**
|
|
6127
6208
|
* Do NOT use ".show" as it causes crashes in Cesium polylines that are clamped to ground.
|
|
6128
6209
|
* We could target them specifically here but we may be getting overall performance gain by just removing stuff from the scene.
|
|
6129
6210
|
*/
|
|
6130
|
-
if (
|
|
6131
|
-
|
|
6211
|
+
if (rego.collection) {
|
|
6212
|
+
if (!show && rego.collection.contains(visual)) {
|
|
6213
|
+
rego.collection.remove(visual);
|
|
6214
|
+
}
|
|
6215
|
+
else if (show && !rego.collection.contains(visual)) {
|
|
6216
|
+
rego.collection.add(visual);
|
|
6217
|
+
}
|
|
6132
6218
|
}
|
|
6133
|
-
else
|
|
6134
|
-
viewer.entities.
|
|
6219
|
+
else {
|
|
6220
|
+
if (!show && viewer.entities.contains(visual)) {
|
|
6221
|
+
viewer.entities.remove(visual);
|
|
6222
|
+
}
|
|
6223
|
+
else if (show && !viewer.entities.contains(visual)) {
|
|
6224
|
+
viewer.entities.add(visual);
|
|
6225
|
+
}
|
|
6135
6226
|
}
|
|
6136
6227
|
}
|
|
6137
|
-
function updateEntityShow(viewer,
|
|
6228
|
+
function updateEntityShow(viewer, rego, show) {
|
|
6229
|
+
var visual = rego.visual;
|
|
6138
6230
|
if (visual instanceof Entity) {
|
|
6139
6231
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
6140
6232
|
return;
|
|
6141
6233
|
}
|
|
6142
|
-
updateCEntityShow(viewer,
|
|
6234
|
+
updateCEntityShow(viewer, rego.visual, rego, show, false, 0);
|
|
6143
6235
|
return;
|
|
6144
6236
|
}
|
|
6145
6237
|
if (!isAlive$1(viewer, visual)) {
|
|
@@ -6192,7 +6284,7 @@ function updateEntity(viewer, entityId, register) {
|
|
|
6192
6284
|
if (visible == null) {
|
|
6193
6285
|
visible = getShowState(rego);
|
|
6194
6286
|
}
|
|
6195
|
-
updateEntityShow(viewer, rego
|
|
6287
|
+
updateEntityShow(viewer, rego, visible);
|
|
6196
6288
|
if (rego.best) {
|
|
6197
6289
|
var isLabelled = register.GetIsLabelled({
|
|
6198
6290
|
entityId: entityId
|
|
@@ -6314,6 +6406,10 @@ var VisualsRegister;
|
|
|
6314
6406
|
enumerable: false,
|
|
6315
6407
|
configurable: true
|
|
6316
6408
|
});
|
|
6409
|
+
Register.prototype.RefreshMark = function (params) {
|
|
6410
|
+
var rego = params.rego;
|
|
6411
|
+
markEntity(this, rego, rego.visual, false);
|
|
6412
|
+
};
|
|
6317
6413
|
Register.prototype.Dispose = function () {
|
|
6318
6414
|
var _a;
|
|
6319
6415
|
(_a = this.cameraCullerDispose) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
@@ -7936,6 +8032,15 @@ var PointClustering = /** @class */ (function () {
|
|
|
7936
8032
|
|
|
7937
8033
|
var BATCH_SIZE = 500;
|
|
7938
8034
|
var CHECK_BATCH_SIZE = 250;
|
|
8035
|
+
function getValue$3(viewer, obj) {
|
|
8036
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
8037
|
+
return obj.getValue(viewer.scene.lastRenderTime);
|
|
8038
|
+
}
|
|
8039
|
+
return obj;
|
|
8040
|
+
}
|
|
8041
|
+
function colorToCColor$2(color) {
|
|
8042
|
+
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
8043
|
+
}
|
|
7939
8044
|
/**
|
|
7940
8045
|
* Manager for rendering Bruce entities.
|
|
7941
8046
|
* This will request entities based on setup menu item filter.
|
|
@@ -7955,6 +8060,10 @@ var EntitiesRenderManager;
|
|
|
7955
8060
|
this.viewMonitorRemoval = null;
|
|
7956
8061
|
this.renderQueue = [];
|
|
7957
8062
|
this.renderQueueInterval = null;
|
|
8063
|
+
this.sources = [];
|
|
8064
|
+
// Highly experimental flag to try improve rendering large sets of polygons and polylines.
|
|
8065
|
+
// Many things are not supported when this is enabled.
|
|
8066
|
+
this.useGeojson = false;
|
|
7958
8067
|
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register, sharedGetters = params.sharedGetters;
|
|
7959
8068
|
this.viewer = viewer;
|
|
7960
8069
|
this.sharedGetters = sharedGetters;
|
|
@@ -7962,6 +8071,7 @@ var EntitiesRenderManager;
|
|
|
7962
8071
|
this.apiGetter = apiGetter;
|
|
7963
8072
|
this.item = item;
|
|
7964
8073
|
this.visualsManager = visualsManager;
|
|
8074
|
+
this.useGeojson = item.renderAsGeojson == true;
|
|
7965
8075
|
if (item.enableClustering) {
|
|
7966
8076
|
this.clustering = new PointClustering(this.visualsManager, this.item.id);
|
|
7967
8077
|
}
|
|
@@ -8111,6 +8221,12 @@ var EntitiesRenderManager;
|
|
|
8111
8221
|
clearInterval(this.renderQueueInterval);
|
|
8112
8222
|
this.renderQueue = [];
|
|
8113
8223
|
(_c = this.clustering) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
8224
|
+
this.clustering = null;
|
|
8225
|
+
for (var i = 0; i < this.sources.length; i++) {
|
|
8226
|
+
var source = this.sources[i];
|
|
8227
|
+
this.viewer.dataSources.remove(source);
|
|
8228
|
+
}
|
|
8229
|
+
this.sources = [];
|
|
8114
8230
|
};
|
|
8115
8231
|
Manager.prototype.ReRender = function (params) {
|
|
8116
8232
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8262,14 +8378,14 @@ var EntitiesRenderManager;
|
|
|
8262
8378
|
}
|
|
8263
8379
|
};
|
|
8264
8380
|
Manager.prototype.renderEntities = function (entities, force) {
|
|
8265
|
-
var _a
|
|
8381
|
+
var _a;
|
|
8266
8382
|
if (force === void 0) { force = false; }
|
|
8267
8383
|
return __awaiter(this, void 0, void 0, function () {
|
|
8268
|
-
var typeId_1,
|
|
8269
|
-
return __generator(this, function (
|
|
8270
|
-
switch (
|
|
8384
|
+
var typeId_1, e_3;
|
|
8385
|
+
return __generator(this, function (_b) {
|
|
8386
|
+
switch (_b.label) {
|
|
8271
8387
|
case 0:
|
|
8272
|
-
|
|
8388
|
+
_b.trys.push([0, 5, , 6]);
|
|
8273
8389
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
8274
8390
|
return [2 /*return*/];
|
|
8275
8391
|
}
|
|
@@ -8277,17 +8393,227 @@ var EntitiesRenderManager;
|
|
|
8277
8393
|
if (typeId_1) {
|
|
8278
8394
|
entities = entities.filter(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId_1; });
|
|
8279
8395
|
}
|
|
8280
|
-
return [
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8396
|
+
if (!this.useGeojson) return [3 /*break*/, 2];
|
|
8397
|
+
return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
8398
|
+
case 1:
|
|
8399
|
+
_b.sent();
|
|
8400
|
+
return [3 /*break*/, 4];
|
|
8401
|
+
case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
8402
|
+
case 3:
|
|
8403
|
+
_b.sent();
|
|
8404
|
+
_b.label = 4;
|
|
8405
|
+
case 4: return [3 /*break*/, 6];
|
|
8406
|
+
case 5:
|
|
8407
|
+
e_3 = _b.sent();
|
|
8408
|
+
console.error(e_3);
|
|
8409
|
+
return [3 /*break*/, 6];
|
|
8410
|
+
case 6: return [2 /*return*/];
|
|
8411
|
+
}
|
|
8412
|
+
});
|
|
8413
|
+
});
|
|
8414
|
+
};
|
|
8415
|
+
/**
|
|
8416
|
+
* Our optimized and more stable path.
|
|
8417
|
+
* We construct a geojson that we draw in one go.
|
|
8418
|
+
* @param entities
|
|
8419
|
+
* @param force TODO: This should re-render entities that are already rendered.
|
|
8420
|
+
*/
|
|
8421
|
+
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
8422
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8423
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8424
|
+
var zoomItem, style, e_4, entityType, e_5, pStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, register, sEntities, i, cEntity;
|
|
8425
|
+
var _this = this;
|
|
8426
|
+
return __generator(this, function (_j) {
|
|
8427
|
+
switch (_j.label) {
|
|
8428
|
+
case 0:
|
|
8429
|
+
entities = entities.filter(function (entity) {
|
|
8430
|
+
var _a;
|
|
8431
|
+
return !_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID];
|
|
8432
|
+
});
|
|
8433
|
+
// Mark these as rendered.
|
|
8434
|
+
entities.forEach(function (entity) {
|
|
8435
|
+
var _a;
|
|
8436
|
+
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
8437
|
+
});
|
|
8438
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
8439
|
+
style = null;
|
|
8440
|
+
if (!(zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID)) return [3 /*break*/, 4];
|
|
8441
|
+
_j.label = 1;
|
|
8442
|
+
case 1:
|
|
8443
|
+
_j.trys.push([1, 3, , 4]);
|
|
8444
|
+
return [4 /*yield*/, Style.Get({
|
|
8445
|
+
api: this.apiGetter.getApi(),
|
|
8446
|
+
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
8447
|
+
})];
|
|
8448
|
+
case 2:
|
|
8449
|
+
style = (_a = (_j.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
8450
|
+
return [3 /*break*/, 4];
|
|
8451
|
+
case 3:
|
|
8452
|
+
e_4 = _j.sent();
|
|
8453
|
+
console.error(e_4);
|
|
8454
|
+
return [3 /*break*/, 4];
|
|
8455
|
+
case 4:
|
|
8456
|
+
_j.trys.push([4, 8, , 9]);
|
|
8457
|
+
return [4 /*yield*/, EntityType.Get({
|
|
8458
|
+
entityTypeId: this.item.BruceEntity["EntityType.ID"],
|
|
8459
|
+
api: this.apiGetter.getApi()
|
|
8460
|
+
})];
|
|
8461
|
+
case 5:
|
|
8462
|
+
entityType = (_b = (_j.sent())) === null || _b === void 0 ? void 0 : _b.entityType;
|
|
8463
|
+
if (!(!style && ((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"]))) return [3 /*break*/, 7];
|
|
8464
|
+
if (!entityType["DisplaySetting.ID"]) return [3 /*break*/, 7];
|
|
8465
|
+
return [4 /*yield*/, Style.Get({
|
|
8466
|
+
api: this.apiGetter.getApi(),
|
|
8467
|
+
styleId: entityType["DisplaySetting.ID"]
|
|
8288
8468
|
})];
|
|
8469
|
+
case 6:
|
|
8470
|
+
style = (_d = (_j.sent()).style) === null || _d === void 0 ? void 0 : _d.Settings;
|
|
8471
|
+
_j.label = 7;
|
|
8472
|
+
case 7: return [3 /*break*/, 9];
|
|
8473
|
+
case 8:
|
|
8474
|
+
e_5 = _j.sent();
|
|
8475
|
+
console.error(e_5);
|
|
8476
|
+
return [3 /*break*/, 9];
|
|
8477
|
+
case 9:
|
|
8478
|
+
pStyle = (_e = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _e !== void 0 ? _e : {};
|
|
8479
|
+
polygonsClamped = ((_f = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _f === void 0 ? void 0 : _f.id) == null ? true : ((_g = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _g === void 0 ? void 0 : _g.id) == 0;
|
|
8480
|
+
bFillColor = Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
8481
|
+
cFillColor = bFillColor ? colorToCColor$2(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
8482
|
+
bLineColor = Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
8483
|
+
cLineColor = bLineColor ? colorToCColor$2(bLineColor) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
8484
|
+
lineWidthPx = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, {}, []) : null;
|
|
8485
|
+
if (lineWidthPx == null) {
|
|
8486
|
+
lineWidthPx = 1;
|
|
8487
|
+
}
|
|
8488
|
+
lineWidthPx = EnsureNumber(lineWidthPx);
|
|
8489
|
+
if (lineWidthPx < 0.01) {
|
|
8490
|
+
lineWidthPx = 0;
|
|
8491
|
+
}
|
|
8492
|
+
lineWidthPx = Math.round(lineWidthPx);
|
|
8493
|
+
geojson = Entity$1.ToGeoJson({
|
|
8494
|
+
entities: entities,
|
|
8495
|
+
includeUserData: false,
|
|
8496
|
+
excludeAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
8497
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
8498
|
+
// No points.
|
|
8499
|
+
allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
|
|
8500
|
+
});
|
|
8501
|
+
if (!((_h = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _h === void 0 ? void 0 : _h.length)) {
|
|
8502
|
+
return [2 /*return*/];
|
|
8503
|
+
}
|
|
8504
|
+
return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
|
|
8505
|
+
stroke: cLineColor,
|
|
8506
|
+
fill: cFillColor,
|
|
8507
|
+
strokeWidth: lineWidthPx,
|
|
8508
|
+
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
8509
|
+
})];
|
|
8510
|
+
case 10:
|
|
8511
|
+
source = _j.sent();
|
|
8512
|
+
this.viewer.dataSources.add(source);
|
|
8513
|
+
this.sources.push(source);
|
|
8514
|
+
if (this.disposed) {
|
|
8515
|
+
this.doDispose();
|
|
8516
|
+
return [2 /*return*/];
|
|
8517
|
+
}
|
|
8518
|
+
groups = [];
|
|
8519
|
+
register = function (thing) {
|
|
8520
|
+
var _a, _b, _c, _d;
|
|
8521
|
+
// See if the cesium entity already exists in a group.
|
|
8522
|
+
var group = groups.find(function (x) { var _a; return ((_a = x.visual) === null || _a === void 0 ? void 0 : _a.id) == thing.id || x.siblings.find(function (x) { return (x === null || x === void 0 ? void 0 : x.id) == thing.id; }); });
|
|
8523
|
+
if (group) {
|
|
8524
|
+
return;
|
|
8525
|
+
}
|
|
8526
|
+
var metadata = getValue$3(_this.viewer, thing === null || thing === void 0 ? void 0 : thing.properties);
|
|
8527
|
+
var entityId = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
8528
|
+
if (!entityId) {
|
|
8529
|
+
return;
|
|
8530
|
+
}
|
|
8531
|
+
// Find group for the nextspace entity ID.
|
|
8532
|
+
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
8533
|
+
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
8534
|
+
if (!group) {
|
|
8535
|
+
group = {
|
|
8536
|
+
entityId: entityId,
|
|
8537
|
+
visual: thing,
|
|
8538
|
+
tagIds: (_b = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"],
|
|
8539
|
+
entityTypeId: (_c = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _c === void 0 ? void 0 : _c["EntityType.ID"],
|
|
8540
|
+
siblings: [],
|
|
8541
|
+
data: entities.find(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; }),
|
|
8542
|
+
rego: null
|
|
8543
|
+
};
|
|
8544
|
+
groups.push(group);
|
|
8545
|
+
var rego = {
|
|
8546
|
+
entityId: entityId,
|
|
8547
|
+
menuItemId: _this.item.id,
|
|
8548
|
+
visual: thing,
|
|
8549
|
+
priority: 0,
|
|
8550
|
+
entityTypeId: group.entityTypeId,
|
|
8551
|
+
accountId: _this.apiGetter.accountId,
|
|
8552
|
+
tagIds: group.tagIds ? [].concat(group.tagIds) : [],
|
|
8553
|
+
name: (_d = Entity$1.CalculateName({
|
|
8554
|
+
entity: group.data,
|
|
8555
|
+
type: entityType,
|
|
8556
|
+
defaultToId: false
|
|
8557
|
+
})) !== null && _d !== void 0 ? _d : "Unnamed Entity",
|
|
8558
|
+
cdn: _this.item.cdnEnabled,
|
|
8559
|
+
collection: source.entities
|
|
8560
|
+
};
|
|
8561
|
+
group.rego = rego;
|
|
8562
|
+
_this.visualsManager.AddRego({
|
|
8563
|
+
rego: rego,
|
|
8564
|
+
requestRender: false
|
|
8565
|
+
});
|
|
8566
|
+
}
|
|
8567
|
+
// Found a group. We flag this as a sibling entity of the primary.
|
|
8568
|
+
else {
|
|
8569
|
+
group.siblings.push(thing);
|
|
8570
|
+
group.visual._siblingGraphics = group.siblings;
|
|
8571
|
+
thing._parentEntity = group.visual;
|
|
8572
|
+
if (group.rego) {
|
|
8573
|
+
_this.visualsManager.RefreshMark({
|
|
8574
|
+
rego: group.rego
|
|
8575
|
+
});
|
|
8576
|
+
}
|
|
8577
|
+
}
|
|
8578
|
+
// Won't do individual styles for now. More stability that way.
|
|
8579
|
+
// applyStyle(thing, entityId, group.data);
|
|
8580
|
+
};
|
|
8581
|
+
sEntities = source.entities.values;
|
|
8582
|
+
for (i = 0; i < sEntities.length; i++) {
|
|
8583
|
+
cEntity = sEntities[i];
|
|
8584
|
+
register(cEntity);
|
|
8585
|
+
}
|
|
8586
|
+
this.viewer.scene.requestRender();
|
|
8587
|
+
return [2 /*return*/];
|
|
8588
|
+
}
|
|
8589
|
+
});
|
|
8590
|
+
});
|
|
8591
|
+
};
|
|
8592
|
+
/**
|
|
8593
|
+
* Our default path.
|
|
8594
|
+
* We render each entity individually.
|
|
8595
|
+
* @param entities
|
|
8596
|
+
* @param force
|
|
8597
|
+
* @returns
|
|
8598
|
+
*/
|
|
8599
|
+
Manager.prototype.renderAsIndividuals = function (entities, force) {
|
|
8600
|
+
var _a, _b, _c;
|
|
8601
|
+
if (force === void 0) { force = false; }
|
|
8602
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8603
|
+
var cEntities, i, entity, id, cEntity, visual, wasClustered, tagIds, rego;
|
|
8604
|
+
return __generator(this, function (_d) {
|
|
8605
|
+
switch (_d.label) {
|
|
8606
|
+
case 0: return [4 /*yield*/, EntityRenderEngine.Render({
|
|
8607
|
+
viewer: this.viewer,
|
|
8608
|
+
apiGetter: this.apiGetter,
|
|
8609
|
+
entities: entities,
|
|
8610
|
+
menuItemId: this.item.id,
|
|
8611
|
+
visualRegister: this.visualsManager,
|
|
8612
|
+
zoomControl: this.item.CameraZoomSettings,
|
|
8613
|
+
force: force
|
|
8614
|
+
})];
|
|
8289
8615
|
case 1:
|
|
8290
|
-
cEntities =
|
|
8616
|
+
cEntities = _d.sent();
|
|
8291
8617
|
if (this.disposed) {
|
|
8292
8618
|
this.doDispose();
|
|
8293
8619
|
return [2 /*return*/];
|
|
@@ -8298,13 +8624,13 @@ var EntitiesRenderManager;
|
|
|
8298
8624
|
cEntity = cEntities[id];
|
|
8299
8625
|
this.renderedEntities[id] = !!cEntity;
|
|
8300
8626
|
if (cEntity) {
|
|
8301
|
-
visual = (
|
|
8627
|
+
visual = (_a = this.visualsManager.GetRego({
|
|
8302
8628
|
entityId: id,
|
|
8303
8629
|
menuItemId: this.item.id
|
|
8304
|
-
})) === null ||
|
|
8630
|
+
})) === null || _a === void 0 ? void 0 : _a.visual;
|
|
8305
8631
|
if (!visual || visual != cEntity) {
|
|
8306
8632
|
wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
|
|
8307
|
-
tagIds = (
|
|
8633
|
+
tagIds = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"];
|
|
8308
8634
|
rego = {
|
|
8309
8635
|
entityId: id,
|
|
8310
8636
|
menuItemId: this.item.id,
|
|
@@ -8329,19 +8655,14 @@ var EntitiesRenderManager;
|
|
|
8329
8655
|
menuItemId: this.item.id,
|
|
8330
8656
|
requestRender: false
|
|
8331
8657
|
});
|
|
8332
|
-
(
|
|
8658
|
+
(_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(id, false);
|
|
8333
8659
|
}
|
|
8334
8660
|
}
|
|
8335
8661
|
this.viewer.scene.requestRender();
|
|
8336
8662
|
if (this.clustering && entities.length) {
|
|
8337
8663
|
this.clustering.Update();
|
|
8338
8664
|
}
|
|
8339
|
-
return [
|
|
8340
|
-
case 2:
|
|
8341
|
-
e_3 = _e.sent();
|
|
8342
|
-
console.error(e_3);
|
|
8343
|
-
return [3 /*break*/, 3];
|
|
8344
|
-
case 3: return [2 /*return*/];
|
|
8665
|
+
return [2 /*return*/];
|
|
8345
8666
|
}
|
|
8346
8667
|
});
|
|
8347
8668
|
});
|
|
@@ -9225,7 +9546,7 @@ var EntityRenderManager;
|
|
|
9225
9546
|
EntityRenderManager.Manager = Manager;
|
|
9226
9547
|
})(EntityRenderManager || (EntityRenderManager = {}));
|
|
9227
9548
|
|
|
9228
|
-
function colorToCColor$
|
|
9549
|
+
function colorToCColor$3(color) {
|
|
9229
9550
|
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
9230
9551
|
}
|
|
9231
9552
|
/**
|
|
@@ -10041,7 +10362,7 @@ var TilesetRenderEngine;
|
|
|
10041
10362
|
}
|
|
10042
10363
|
var bColor = ((_a = style.modelStyle) === null || _a === void 0 ? void 0 : _a.fillColor) ? Calculator.GetColor(style.modelStyle.fillColor, data, []) : null;
|
|
10043
10364
|
if (bColor != null) {
|
|
10044
|
-
var cColor = colorToCColor$
|
|
10365
|
+
var cColor = colorToCColor$3(bColor);
|
|
10045
10366
|
var visual = entity.visual;
|
|
10046
10367
|
if (visual && visual instanceof Cesium3DTileFeature) {
|
|
10047
10368
|
visual.color = cColor;
|
|
@@ -20033,7 +20354,7 @@ var CesiumViewMonitor;
|
|
|
20033
20354
|
CesiumViewMonitor$$1.Monitor = Monitor;
|
|
20034
20355
|
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
20035
20356
|
|
|
20036
|
-
var VERSION$1 = "3.3.
|
|
20357
|
+
var VERSION$1 = "3.3.8";
|
|
20037
20358
|
|
|
20038
20359
|
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, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
|
|
20039
20360
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|