bruce-cesium 3.3.9 → 3.4.1
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 +880 -267
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +868 -255
- 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-ids-render-manager.js +320 -21
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +324 -21
- 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 +46 -32
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +4 -3
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/entities/entities-ids-render-manager.d.ts +18 -0
- package/dist/types/rendering/render-managers/entities/entities-loaded-render-manager.d.ts +18 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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,
|
|
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, SceneMode, GeoJsonDataSource, ColorMaterialProperty, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, PolygonPipeline, EllipsoidTerrainProvider, CesiumInspector, defined, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Matrix4, Matrix3, IonResource, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8479,12 +8479,12 @@ var EntitiesRenderManager;
|
|
|
8479
8479
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
8480
8480
|
*/
|
|
8481
8481
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
8482
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
8482
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
8483
8483
|
return __awaiter(this, void 0, void 0, function () {
|
|
8484
|
-
var zoomItem, style, e_4, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
8484
|
+
var zoomItem, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
8485
8485
|
var _this = this;
|
|
8486
|
-
return __generator(this, function (
|
|
8487
|
-
switch (
|
|
8486
|
+
return __generator(this, function (_m) {
|
|
8487
|
+
switch (_m.label) {
|
|
8488
8488
|
case 0:
|
|
8489
8489
|
entities = entities.filter(function (entity) {
|
|
8490
8490
|
var _a;
|
|
@@ -8497,47 +8497,54 @@ var EntitiesRenderManager;
|
|
|
8497
8497
|
});
|
|
8498
8498
|
zoomItem = this.item.CameraZoomSettings[0];
|
|
8499
8499
|
style = null;
|
|
8500
|
-
if (!(zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID)) return [3 /*break*/, 4];
|
|
8501
|
-
|
|
8500
|
+
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
|
|
8501
|
+
_m.label = 1;
|
|
8502
8502
|
case 1:
|
|
8503
|
-
|
|
8503
|
+
_m.trys.push([1, 3, , 4]);
|
|
8504
8504
|
return [4 /*yield*/, Style.Get({
|
|
8505
8505
|
api: this.apiGetter.getApi(),
|
|
8506
8506
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
8507
8507
|
})];
|
|
8508
8508
|
case 2:
|
|
8509
|
-
style = (_a = (
|
|
8509
|
+
style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
8510
8510
|
return [3 /*break*/, 4];
|
|
8511
8511
|
case 3:
|
|
8512
|
-
e_4 =
|
|
8512
|
+
e_4 = _m.sent();
|
|
8513
8513
|
console.error(e_4);
|
|
8514
8514
|
return [3 /*break*/, 4];
|
|
8515
8515
|
case 4:
|
|
8516
|
-
|
|
8516
|
+
entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
8517
|
+
if (!entityTypeId) {
|
|
8518
|
+
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
8519
|
+
}
|
|
8520
|
+
if (!entityTypeId) return [3 /*break*/, 10];
|
|
8521
|
+
_m.label = 5;
|
|
8522
|
+
case 5:
|
|
8523
|
+
_m.trys.push([5, 9, , 10]);
|
|
8517
8524
|
return [4 /*yield*/, EntityType.Get({
|
|
8518
|
-
entityTypeId:
|
|
8525
|
+
entityTypeId: entityTypeId,
|
|
8519
8526
|
api: this.apiGetter.getApi()
|
|
8520
8527
|
})];
|
|
8521
|
-
case
|
|
8522
|
-
entityType = (
|
|
8523
|
-
if (!(!style &&
|
|
8524
|
-
if (!entityType["DisplaySetting.ID"]) return [3 /*break*/,
|
|
8528
|
+
case 6:
|
|
8529
|
+
entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
8530
|
+
if (!(!style && entityType)) return [3 /*break*/, 8];
|
|
8531
|
+
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
|
|
8525
8532
|
return [4 /*yield*/, Style.Get({
|
|
8526
8533
|
api: this.apiGetter.getApi(),
|
|
8527
8534
|
styleId: entityType["DisplaySetting.ID"]
|
|
8528
8535
|
})];
|
|
8529
|
-
case
|
|
8530
|
-
style = (
|
|
8531
|
-
|
|
8532
|
-
case
|
|
8533
|
-
case 8:
|
|
8534
|
-
e_5 = _k.sent();
|
|
8535
|
-
console.error(e_5);
|
|
8536
|
-
return [3 /*break*/, 9];
|
|
8536
|
+
case 7:
|
|
8537
|
+
style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
8538
|
+
_m.label = 8;
|
|
8539
|
+
case 8: return [3 /*break*/, 10];
|
|
8537
8540
|
case 9:
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
+
e_5 = _m.sent();
|
|
8542
|
+
console.error(e_5);
|
|
8543
|
+
return [3 /*break*/, 10];
|
|
8544
|
+
case 10:
|
|
8545
|
+
pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
8546
|
+
lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
8547
|
+
polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
8541
8548
|
bFillColor = Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
8542
8549
|
cFillColor = bFillColor ? colorToCColor$2(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
8543
8550
|
bLineColor = Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
@@ -8559,7 +8566,7 @@ var EntitiesRenderManager;
|
|
|
8559
8566
|
// No points.
|
|
8560
8567
|
allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
|
|
8561
8568
|
});
|
|
8562
|
-
if (!((
|
|
8569
|
+
if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
|
|
8563
8570
|
return [2 /*return*/];
|
|
8564
8571
|
}
|
|
8565
8572
|
return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
|
|
@@ -8568,8 +8575,8 @@ var EntitiesRenderManager;
|
|
|
8568
8575
|
strokeWidth: lineWidthPx,
|
|
8569
8576
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
8570
8577
|
})];
|
|
8571
|
-
case
|
|
8572
|
-
source =
|
|
8578
|
+
case 11:
|
|
8579
|
+
source = _m.sent();
|
|
8573
8580
|
this.viewer.dataSources.add(source);
|
|
8574
8581
|
this.sources.push(source);
|
|
8575
8582
|
if (this.disposed) {
|
|
@@ -8645,6 +8652,7 @@ var EntitiesRenderManager;
|
|
|
8645
8652
|
if (!entityId) {
|
|
8646
8653
|
return;
|
|
8647
8654
|
}
|
|
8655
|
+
var needsUpdate = false;
|
|
8648
8656
|
// Find group for the nextspace entity ID.
|
|
8649
8657
|
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
8650
8658
|
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
@@ -8667,11 +8675,11 @@ var EntitiesRenderManager;
|
|
|
8667
8675
|
entityTypeId: group.entityTypeId,
|
|
8668
8676
|
accountId: _this.apiGetter.accountId,
|
|
8669
8677
|
tagIds: group.tagIds ? [].concat(group.tagIds) : [],
|
|
8670
|
-
name: (_d = Entity$1.CalculateName({
|
|
8678
|
+
name: entityType ? (_d = Entity$1.CalculateName({
|
|
8671
8679
|
entity: group.data,
|
|
8672
8680
|
type: entityType,
|
|
8673
8681
|
defaultToId: false
|
|
8674
|
-
})) !== null && _d !== void 0 ? _d : "Unnamed Entity",
|
|
8682
|
+
})) !== null && _d !== void 0 ? _d : "Unnamed Entity" : "Unnamed Entity",
|
|
8675
8683
|
cdn: _this.item.cdnEnabled,
|
|
8676
8684
|
collection: source.entities
|
|
8677
8685
|
};
|
|
@@ -8690,9 +8698,15 @@ var EntitiesRenderManager;
|
|
|
8690
8698
|
_this.visualsManager.RefreshMark({
|
|
8691
8699
|
rego: group.rego
|
|
8692
8700
|
});
|
|
8701
|
+
needsUpdate = true;
|
|
8693
8702
|
}
|
|
8694
8703
|
}
|
|
8695
8704
|
applyStyle(thing, entityId, group.data);
|
|
8705
|
+
if (needsUpdate) {
|
|
8706
|
+
_this.visualsManager.ForceUpdate({
|
|
8707
|
+
entityIds: [entityId],
|
|
8708
|
+
});
|
|
8709
|
+
}
|
|
8696
8710
|
};
|
|
8697
8711
|
sEntities = source.entities.values;
|
|
8698
8712
|
for (i = 0; i < sEntities.length; i++) {
|
|
@@ -8878,6 +8892,15 @@ var BatchedDataGetter;
|
|
|
8878
8892
|
|
|
8879
8893
|
var BATCH_SIZE$1 = 500;
|
|
8880
8894
|
var CHECK_BATCH_SIZE$1 = 250;
|
|
8895
|
+
function getValue$4(viewer, obj) {
|
|
8896
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
8897
|
+
return obj.getValue(viewer.scene.lastRenderTime);
|
|
8898
|
+
}
|
|
8899
|
+
return obj;
|
|
8900
|
+
}
|
|
8901
|
+
function colorToCColor$3(color) {
|
|
8902
|
+
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
8903
|
+
}
|
|
8881
8904
|
/**
|
|
8882
8905
|
* Render manager for a group of pre-loaded entities.
|
|
8883
8906
|
* The entities may or may not have records.
|
|
@@ -8892,12 +8915,17 @@ var EntitiesLoadedRenderManager;
|
|
|
8892
8915
|
this.getterSub = null;
|
|
8893
8916
|
this.disposed = false;
|
|
8894
8917
|
this.renderedEntities = {};
|
|
8918
|
+
this.sources = [];
|
|
8919
|
+
// Highly experimental flag to try improve rendering large sets of polygons and polylines.
|
|
8920
|
+
// Many things are not supported when this is enabled.
|
|
8921
|
+
this.useGeojson = false;
|
|
8895
8922
|
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register;
|
|
8896
8923
|
this.viewer = viewer;
|
|
8897
8924
|
this.apiGetter = apiGetter;
|
|
8898
8925
|
this.monitor = monitor;
|
|
8899
8926
|
this.item = item;
|
|
8900
8927
|
this.visualsManager = visualsManager;
|
|
8928
|
+
this.useGeojson = item.renderAsGeojson == true;
|
|
8901
8929
|
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
|
|
8902
8930
|
this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
|
|
8903
8931
|
}
|
|
@@ -9019,16 +9047,24 @@ var EntitiesLoadedRenderManager;
|
|
|
9019
9047
|
this.getter.Start();
|
|
9020
9048
|
};
|
|
9021
9049
|
Manager.prototype.Dispose = function () {
|
|
9022
|
-
var _a;
|
|
9023
9050
|
if (this.disposed) {
|
|
9024
9051
|
return;
|
|
9025
9052
|
}
|
|
9053
|
+
this.doDispose();
|
|
9054
|
+
};
|
|
9055
|
+
Manager.prototype.doDispose = function () {
|
|
9056
|
+
var _a;
|
|
9026
9057
|
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
9027
9058
|
this.getterSub = null;
|
|
9028
9059
|
this.disposed = true;
|
|
9029
9060
|
this.visualsManager.RemoveRegos({
|
|
9030
9061
|
menuItemId: this.item.id
|
|
9031
9062
|
});
|
|
9063
|
+
for (var i = 0; i < this.sources.length; i++) {
|
|
9064
|
+
var source = this.sources[i];
|
|
9065
|
+
this.viewer.dataSources.remove(source);
|
|
9066
|
+
}
|
|
9067
|
+
this.sources = [];
|
|
9032
9068
|
};
|
|
9033
9069
|
Manager.prototype.ReRender = function (params) {
|
|
9034
9070
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -9137,15 +9173,14 @@ var EntitiesLoadedRenderManager;
|
|
|
9137
9173
|
});
|
|
9138
9174
|
};
|
|
9139
9175
|
Manager.prototype.onGetterUpdate = function (entities, force) {
|
|
9140
|
-
var _a;
|
|
9141
9176
|
if (force === void 0) { force = false; }
|
|
9142
9177
|
return __awaiter(this, void 0, void 0, function () {
|
|
9143
|
-
var isEntityInItem_1,
|
|
9178
|
+
var isEntityInItem_1, e_2;
|
|
9144
9179
|
var _this = this;
|
|
9145
|
-
return __generator(this, function (
|
|
9146
|
-
switch (
|
|
9180
|
+
return __generator(this, function (_a) {
|
|
9181
|
+
switch (_a.label) {
|
|
9147
9182
|
case 0:
|
|
9148
|
-
|
|
9183
|
+
_a.trys.push([0, 5, , 6]);
|
|
9149
9184
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9150
9185
|
return [2 /*return*/];
|
|
9151
9186
|
}
|
|
@@ -9159,247 +9194,829 @@ var EntitiesLoadedRenderManager;
|
|
|
9159
9194
|
var _a;
|
|
9160
9195
|
return isEntityInItem_1((_a = x === null || x === void 0 ? void 0 : x.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
9161
9196
|
});
|
|
9162
|
-
return [
|
|
9163
|
-
|
|
9164
|
-
apiGetter: this.apiGetter,
|
|
9165
|
-
entities: entities,
|
|
9166
|
-
menuItemId: this.item.id,
|
|
9167
|
-
visualRegister: this.visualsManager,
|
|
9168
|
-
zoomControl: this.item.CameraZoomSettings,
|
|
9169
|
-
force: force
|
|
9170
|
-
})];
|
|
9197
|
+
if (!this.useGeojson) return [3 /*break*/, 2];
|
|
9198
|
+
return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
9171
9199
|
case 1:
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
id = entity.Bruce.ID;
|
|
9182
|
-
cEntity = cEntities[id];
|
|
9183
|
-
this.renderedEntities[id] = !!cEntity;
|
|
9184
|
-
if (cEntity && isEntityInItem_1(id)) {
|
|
9185
|
-
visual = (_a = this.visualsManager.GetRego({
|
|
9186
|
-
entityId: id,
|
|
9187
|
-
menuItemId: this.item.id
|
|
9188
|
-
})) === null || _a === void 0 ? void 0 : _a.visual;
|
|
9189
|
-
if (!visual || visual != cEntity) {
|
|
9190
|
-
this.visualsManager.AddRego({
|
|
9191
|
-
rego: {
|
|
9192
|
-
entityId: id,
|
|
9193
|
-
menuItemId: this.item.id,
|
|
9194
|
-
visual: cEntity,
|
|
9195
|
-
priority: 0,
|
|
9196
|
-
entityTypeId: entity.Bruce["EntityType.ID"],
|
|
9197
|
-
accountId: this.apiGetter.accountId,
|
|
9198
|
-
name: cEntity.name
|
|
9199
|
-
},
|
|
9200
|
-
requestRender: false
|
|
9201
|
-
});
|
|
9202
|
-
}
|
|
9203
|
-
}
|
|
9204
|
-
else {
|
|
9205
|
-
this.visualsManager.RemoveRegos({
|
|
9206
|
-
entityId: id,
|
|
9207
|
-
menuItemId: this.item.id,
|
|
9208
|
-
requestRender: false
|
|
9209
|
-
});
|
|
9210
|
-
}
|
|
9211
|
-
}
|
|
9212
|
-
this.viewer.scene.requestRender();
|
|
9213
|
-
return [3 /*break*/, 3];
|
|
9214
|
-
case 2:
|
|
9215
|
-
e_2 = _b.sent();
|
|
9200
|
+
_a.sent();
|
|
9201
|
+
return [3 /*break*/, 4];
|
|
9202
|
+
case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
9203
|
+
case 3:
|
|
9204
|
+
_a.sent();
|
|
9205
|
+
_a.label = 4;
|
|
9206
|
+
case 4: return [3 /*break*/, 6];
|
|
9207
|
+
case 5:
|
|
9208
|
+
e_2 = _a.sent();
|
|
9216
9209
|
console.error(e_2);
|
|
9217
|
-
return [3 /*break*/,
|
|
9218
|
-
case
|
|
9210
|
+
return [3 /*break*/, 6];
|
|
9211
|
+
case 6: return [2 /*return*/];
|
|
9219
9212
|
}
|
|
9220
9213
|
});
|
|
9221
9214
|
});
|
|
9222
9215
|
};
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
* This will render them in batches to avoid overloading the viewer.
|
|
9232
|
-
*/
|
|
9233
|
-
var EntitiesIdsRenderManager;
|
|
9234
|
-
(function (EntitiesIdsRenderManager) {
|
|
9235
|
-
var Manager = /** @class */ (function () {
|
|
9236
|
-
function Manager(params) {
|
|
9237
|
-
var _a;
|
|
9238
|
-
this.getter = null;
|
|
9239
|
-
this.getterSub = null;
|
|
9240
|
-
this.disposed = false;
|
|
9241
|
-
this.renderedEntities = {};
|
|
9242
|
-
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register;
|
|
9243
|
-
this.viewer = viewer;
|
|
9244
|
-
this.apiGetter = apiGetter;
|
|
9245
|
-
this.monitor = monitor;
|
|
9246
|
-
this.item = item;
|
|
9247
|
-
this.visualsManager = visualsManager;
|
|
9248
|
-
if (this.item.enableClustering) {
|
|
9249
|
-
this.clustering = new PointClustering(visualsManager, this.item.id, (_a = this.item) === null || _a === void 0 ? void 0 : _a.clustering);
|
|
9250
|
-
}
|
|
9251
|
-
}
|
|
9252
|
-
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
9253
|
-
get: function () {
|
|
9254
|
-
return this.disposed;
|
|
9255
|
-
},
|
|
9256
|
-
enumerable: false,
|
|
9257
|
-
configurable: true
|
|
9258
|
-
});
|
|
9259
|
-
Manager.prototype.Init = function () {
|
|
9260
|
-
var _this = this;
|
|
9261
|
-
var _a;
|
|
9262
|
-
if (this.disposed) {
|
|
9263
|
-
throw (new Error("This item is disposed."));
|
|
9264
|
-
}
|
|
9265
|
-
if (!((_a = this.item.CameraZoomSettings) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
9266
|
-
this.item.CameraZoomSettings = [
|
|
9267
|
-
{
|
|
9268
|
-
MinZoom: 0,
|
|
9269
|
-
MaxZoom: 100000,
|
|
9270
|
-
DisplayType: ZoomControl.EDisplayType.Model3D,
|
|
9271
|
-
LODCategoryID: "glb",
|
|
9272
|
-
LODLevel: 0,
|
|
9273
|
-
StyleID: 0
|
|
9274
|
-
}
|
|
9275
|
-
];
|
|
9276
|
-
}
|
|
9277
|
-
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
|
|
9278
|
-
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
9279
|
-
_this.onGetterUpdate(ids);
|
|
9280
|
-
});
|
|
9281
|
-
this.getter.Start();
|
|
9282
|
-
};
|
|
9283
|
-
Manager.prototype.Dispose = function () {
|
|
9284
|
-
var _a, _b;
|
|
9285
|
-
if (this.disposed) {
|
|
9286
|
-
return;
|
|
9287
|
-
}
|
|
9288
|
-
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
9289
|
-
this.getterSub = null;
|
|
9290
|
-
this.disposed = true;
|
|
9291
|
-
this.visualsManager.RemoveRegos({
|
|
9292
|
-
menuItemId: this.item.id
|
|
9293
|
-
});
|
|
9294
|
-
(_b = this.clustering) === null || _b === void 0 ? void 0 : _b.Dispose();
|
|
9295
|
-
};
|
|
9296
|
-
Manager.prototype.ReRender = function (params) {
|
|
9216
|
+
/**
|
|
9217
|
+
* Our optimized and more stable path.
|
|
9218
|
+
* We construct a geojson that we draw in one go.
|
|
9219
|
+
* @param entities
|
|
9220
|
+
* @param force TODO: This should re-render entities that are already rendered.
|
|
9221
|
+
*/
|
|
9222
|
+
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
9223
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9297
9224
|
return __awaiter(this, void 0, void 0, function () {
|
|
9298
|
-
var
|
|
9225
|
+
var zoomItem, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
9299
9226
|
var _this = this;
|
|
9300
|
-
return __generator(this, function (
|
|
9301
|
-
|
|
9302
|
-
if (entities && !entityIds) {
|
|
9303
|
-
entityIds = entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
|
|
9304
|
-
}
|
|
9305
|
-
if (entityIds == null) {
|
|
9306
|
-
entityIds = Object.keys(this.renderedEntities);
|
|
9307
|
-
}
|
|
9308
|
-
else {
|
|
9309
|
-
// ensure entity ids are part of menu item.
|
|
9310
|
-
entityIds = entityIds.filter(function (x) {
|
|
9311
|
-
var _a;
|
|
9312
|
-
return (_a = _this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.EntityIds.includes(x);
|
|
9313
|
-
});
|
|
9314
|
-
}
|
|
9315
|
-
this.visualsManager.MarkStale({
|
|
9316
|
-
entityIds: entityIds,
|
|
9317
|
-
menuItemIds: [this.item.id]
|
|
9318
|
-
});
|
|
9319
|
-
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
9320
|
-
this.renderEntities([].concat(entities).filter(function (x) { var _a; return entityIds.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID); }), force);
|
|
9321
|
-
}
|
|
9322
|
-
else {
|
|
9323
|
-
this.onGetterUpdate(entityIds, force);
|
|
9324
|
-
}
|
|
9325
|
-
return [2 /*return*/];
|
|
9326
|
-
});
|
|
9327
|
-
});
|
|
9328
|
-
};
|
|
9329
|
-
Manager.prototype.UpdateSettings = function (params) {
|
|
9330
|
-
var CameraZoomSettings = params.zoomControl, queueRerender = params.queueRerender;
|
|
9331
|
-
if (this.disposed) {
|
|
9332
|
-
return;
|
|
9333
|
-
}
|
|
9334
|
-
if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
|
|
9335
|
-
this.item.CameraZoomSettings = CameraZoomSettings;
|
|
9336
|
-
}
|
|
9337
|
-
if (queueRerender != false) {
|
|
9338
|
-
var entityIds = Object.keys(this.renderedEntities);
|
|
9339
|
-
this.visualsManager.MarkStale({
|
|
9340
|
-
entityIds: entityIds,
|
|
9341
|
-
menuItemIds: [this.item.id]
|
|
9342
|
-
});
|
|
9343
|
-
this.onGetterUpdate(entityIds);
|
|
9344
|
-
}
|
|
9345
|
-
};
|
|
9346
|
-
Manager.prototype.onGetterUpdate = function (entityIds, force) {
|
|
9347
|
-
if (force === void 0) { force = false; }
|
|
9348
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
9349
|
-
var api, entities, e_1;
|
|
9350
|
-
return __generator(this, function (_a) {
|
|
9351
|
-
switch (_a.label) {
|
|
9227
|
+
return __generator(this, function (_m) {
|
|
9228
|
+
switch (_m.label) {
|
|
9352
9229
|
case 0:
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9230
|
+
entities = entities.filter(function (entity) {
|
|
9231
|
+
var _a;
|
|
9232
|
+
return !_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID];
|
|
9233
|
+
});
|
|
9234
|
+
// Mark these as rendered.
|
|
9235
|
+
entities.forEach(function (entity) {
|
|
9236
|
+
var _a;
|
|
9237
|
+
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
9238
|
+
});
|
|
9239
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
9240
|
+
style = null;
|
|
9241
|
+
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
|
|
9242
|
+
_m.label = 1;
|
|
9243
|
+
case 1:
|
|
9244
|
+
_m.trys.push([1, 3, , 4]);
|
|
9245
|
+
return [4 /*yield*/, Style.Get({
|
|
9246
|
+
api: this.apiGetter.getApi(),
|
|
9247
|
+
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
9248
|
+
})];
|
|
9249
|
+
case 2:
|
|
9250
|
+
style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
9251
|
+
return [3 /*break*/, 4];
|
|
9252
|
+
case 3:
|
|
9253
|
+
e_3 = _m.sent();
|
|
9254
|
+
console.error(e_3);
|
|
9255
|
+
return [3 /*break*/, 4];
|
|
9256
|
+
case 4:
|
|
9257
|
+
entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
9258
|
+
if (!entityTypeId) {
|
|
9259
|
+
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
9260
|
+
}
|
|
9261
|
+
if (!entityTypeId) return [3 /*break*/, 10];
|
|
9262
|
+
_m.label = 5;
|
|
9263
|
+
case 5:
|
|
9264
|
+
_m.trys.push([5, 9, , 10]);
|
|
9265
|
+
return [4 /*yield*/, EntityType.Get({
|
|
9266
|
+
entityTypeId: entityTypeId,
|
|
9267
|
+
api: this.apiGetter.getApi()
|
|
9268
|
+
})];
|
|
9269
|
+
case 6:
|
|
9270
|
+
entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
9271
|
+
if (!(!style && entityType)) return [3 /*break*/, 8];
|
|
9272
|
+
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
|
|
9273
|
+
return [4 /*yield*/, Style.Get({
|
|
9274
|
+
api: this.apiGetter.getApi(),
|
|
9275
|
+
styleId: entityType["DisplaySetting.ID"]
|
|
9276
|
+
})];
|
|
9277
|
+
case 7:
|
|
9278
|
+
style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
9279
|
+
_m.label = 8;
|
|
9280
|
+
case 8: return [3 /*break*/, 10];
|
|
9281
|
+
case 9:
|
|
9282
|
+
e_4 = _m.sent();
|
|
9283
|
+
console.error(e_4);
|
|
9284
|
+
return [3 /*break*/, 10];
|
|
9285
|
+
case 10:
|
|
9286
|
+
pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
9287
|
+
lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
9288
|
+
polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
9289
|
+
bFillColor = Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
9290
|
+
cFillColor = bFillColor ? colorToCColor$3(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
9291
|
+
bLineColor = Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
9292
|
+
cLineColor = bLineColor ? colorToCColor$3(bLineColor) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
9293
|
+
lineWidthPx = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, {}, []) : null;
|
|
9294
|
+
if (lineWidthPx == null) {
|
|
9295
|
+
lineWidthPx = 1;
|
|
9296
|
+
}
|
|
9297
|
+
lineWidthPx = EnsureNumber(lineWidthPx);
|
|
9298
|
+
if (lineWidthPx < 0.01) {
|
|
9299
|
+
lineWidthPx = 0;
|
|
9300
|
+
}
|
|
9301
|
+
lineWidthPx = Math.round(lineWidthPx);
|
|
9302
|
+
geojson = Entity$1.ToGeoJson({
|
|
9303
|
+
entities: entities,
|
|
9304
|
+
includeUserData: false,
|
|
9305
|
+
excludeAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
9306
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
9307
|
+
// No points.
|
|
9308
|
+
allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
|
|
9309
|
+
});
|
|
9310
|
+
if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
|
|
9311
|
+
return [2 /*return*/];
|
|
9312
|
+
}
|
|
9313
|
+
return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
|
|
9314
|
+
stroke: cLineColor,
|
|
9315
|
+
fill: cFillColor,
|
|
9316
|
+
strokeWidth: lineWidthPx,
|
|
9317
|
+
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
9318
|
+
})];
|
|
9319
|
+
case 11:
|
|
9320
|
+
source = _m.sent();
|
|
9321
|
+
this.viewer.dataSources.add(source);
|
|
9322
|
+
this.sources.push(source);
|
|
9323
|
+
if (this.disposed) {
|
|
9324
|
+
this.doDispose();
|
|
9325
|
+
return [2 /*return*/];
|
|
9326
|
+
}
|
|
9327
|
+
groups = [];
|
|
9328
|
+
applyStyle = function (thing, entityId, data) {
|
|
9329
|
+
if (thing.polygon) {
|
|
9330
|
+
var bFillColor_1 = Calculator.GetColor(pStyle.fillColor, data, []);
|
|
9331
|
+
var cFillColor_1 = bFillColor_1 ? colorToCColor$3(bFillColor_1) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
9332
|
+
var bLineColor_1 = Calculator.GetColor(pStyle.lineColor, data, []);
|
|
9333
|
+
var cLineColor_1 = bLineColor_1 ? colorToCColor$3(bLineColor_1) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
9334
|
+
var width = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, data, []) : null;
|
|
9335
|
+
if (width == null) {
|
|
9336
|
+
width = 1;
|
|
9337
|
+
}
|
|
9338
|
+
width = EnsureNumber(width);
|
|
9339
|
+
if (width < 0.01) {
|
|
9340
|
+
width = 0;
|
|
9341
|
+
}
|
|
9342
|
+
var curFillColor = getValue$4(_this.viewer, thing.polygon.material);
|
|
9343
|
+
if (curFillColor && curFillColor instanceof ColorMaterialProperty) {
|
|
9344
|
+
curFillColor = curFillColor.color;
|
|
9345
|
+
}
|
|
9346
|
+
var curLineColor = getValue$4(_this.viewer, thing.polygon.outlineColor);
|
|
9347
|
+
if (curLineColor && curLineColor instanceof ColorMaterialProperty) {
|
|
9348
|
+
curLineColor = curLineColor.color;
|
|
9349
|
+
}
|
|
9350
|
+
var curWidth = getValue$4(_this.viewer, thing.polygon.outlineWidth);
|
|
9351
|
+
if ((curFillColor instanceof Color && curFillColor.equals(cFillColor_1)) &&
|
|
9352
|
+
(curLineColor instanceof Color && curLineColor.equals(cLineColor_1)) &&
|
|
9353
|
+
curWidth == width) {
|
|
9354
|
+
return;
|
|
9355
|
+
}
|
|
9356
|
+
thing.polygon.material = cFillColor_1;
|
|
9357
|
+
thing.polygon.outlineColor = cLineColor_1;
|
|
9358
|
+
thing.polygon.outlineWidth = width;
|
|
9359
|
+
}
|
|
9360
|
+
else if (thing.polyline) {
|
|
9361
|
+
var bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, data, []) : null;
|
|
9362
|
+
var cColor = bColor ? colorToCColor$3(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
|
|
9363
|
+
var width = lStyle.lineWidth ? Calculator.GetNumber(lStyle.lineWidth, data, []) : null;
|
|
9364
|
+
if (width == null) {
|
|
9365
|
+
width = 2;
|
|
9366
|
+
}
|
|
9367
|
+
width = EnsureNumber(width);
|
|
9368
|
+
if (width < 0.01) {
|
|
9369
|
+
width = 0;
|
|
9370
|
+
}
|
|
9371
|
+
var curColor = getValue$4(_this.viewer, thing.polyline.material);
|
|
9372
|
+
if (curColor && curColor instanceof ColorMaterialProperty) {
|
|
9373
|
+
curColor = curColor.color;
|
|
9374
|
+
}
|
|
9375
|
+
var curWidth = getValue$4(_this.viewer, thing.polyline.width);
|
|
9376
|
+
if ((curColor instanceof Color && curColor.equals(cColor)) &&
|
|
9377
|
+
curWidth == width) {
|
|
9378
|
+
return;
|
|
9379
|
+
}
|
|
9380
|
+
thing.polyline.material = cColor;
|
|
9381
|
+
thing.polyline.width = width;
|
|
9382
|
+
}
|
|
9383
|
+
};
|
|
9384
|
+
register = function (thing) {
|
|
9385
|
+
var _a, _b, _c, _d;
|
|
9386
|
+
// See if the cesium entity already exists in a group.
|
|
9387
|
+
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; }); });
|
|
9388
|
+
if (group) {
|
|
9389
|
+
return;
|
|
9390
|
+
}
|
|
9391
|
+
var metadata = getValue$4(_this.viewer, thing === null || thing === void 0 ? void 0 : thing.properties);
|
|
9392
|
+
var entityId = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
9393
|
+
if (!entityId) {
|
|
9394
|
+
return;
|
|
9395
|
+
}
|
|
9396
|
+
var needsUpdate = false;
|
|
9397
|
+
// Find group for the nextspace entity ID.
|
|
9398
|
+
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
9399
|
+
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
9400
|
+
if (!group) {
|
|
9401
|
+
group = {
|
|
9402
|
+
entityId: entityId,
|
|
9403
|
+
visual: thing,
|
|
9404
|
+
tagIds: (_b = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"],
|
|
9405
|
+
entityTypeId: (_c = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _c === void 0 ? void 0 : _c["EntityType.ID"],
|
|
9406
|
+
siblings: [],
|
|
9407
|
+
data: entities.find(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; }),
|
|
9408
|
+
rego: null
|
|
9409
|
+
};
|
|
9410
|
+
groups.push(group);
|
|
9411
|
+
var rego = {
|
|
9412
|
+
entityId: entityId,
|
|
9413
|
+
menuItemId: _this.item.id,
|
|
9414
|
+
visual: thing,
|
|
9415
|
+
priority: 0,
|
|
9416
|
+
entityTypeId: group.entityTypeId,
|
|
9417
|
+
accountId: _this.apiGetter.accountId,
|
|
9418
|
+
tagIds: group.tagIds ? [].concat(group.tagIds) : [],
|
|
9419
|
+
name: entityType ? (_d = Entity$1.CalculateName({
|
|
9420
|
+
entity: group.data,
|
|
9421
|
+
type: entityType,
|
|
9422
|
+
defaultToId: false
|
|
9423
|
+
})) !== null && _d !== void 0 ? _d : "Unnamed Entity" : "Unnamed Entity",
|
|
9424
|
+
cdn: _this.item.cdnEnabled,
|
|
9425
|
+
collection: source.entities
|
|
9426
|
+
};
|
|
9427
|
+
group.rego = rego;
|
|
9428
|
+
_this.visualsManager.AddRego({
|
|
9429
|
+
rego: rego,
|
|
9430
|
+
requestRender: false
|
|
9431
|
+
});
|
|
9432
|
+
}
|
|
9433
|
+
// Found a group. We flag this as a sibling entity of the primary.
|
|
9434
|
+
else {
|
|
9435
|
+
group.siblings.push(thing);
|
|
9436
|
+
group.visual._siblingGraphics = group.siblings;
|
|
9437
|
+
thing._parentEntity = group.visual;
|
|
9438
|
+
if (group.rego) {
|
|
9439
|
+
_this.visualsManager.RefreshMark({
|
|
9440
|
+
rego: group.rego
|
|
9441
|
+
});
|
|
9442
|
+
needsUpdate = true;
|
|
9443
|
+
}
|
|
9444
|
+
}
|
|
9445
|
+
applyStyle(thing, entityId, group.data);
|
|
9446
|
+
if (needsUpdate) {
|
|
9447
|
+
_this.visualsManager.ForceUpdate({
|
|
9448
|
+
entityIds: [entityId],
|
|
9449
|
+
});
|
|
9450
|
+
}
|
|
9451
|
+
};
|
|
9452
|
+
sEntities = source.entities.values;
|
|
9453
|
+
for (i = 0; i < sEntities.length; i++) {
|
|
9454
|
+
cEntity = sEntities[i];
|
|
9455
|
+
register(cEntity);
|
|
9456
|
+
}
|
|
9457
|
+
this.viewer.scene.requestRender();
|
|
9458
|
+
return [2 /*return*/];
|
|
9459
|
+
}
|
|
9460
|
+
});
|
|
9461
|
+
});
|
|
9462
|
+
};
|
|
9463
|
+
/**
|
|
9464
|
+
* Our default path.
|
|
9465
|
+
* We render each entity individually.
|
|
9466
|
+
* @param entities
|
|
9467
|
+
* @param force
|
|
9468
|
+
* @returns
|
|
9469
|
+
*/
|
|
9470
|
+
Manager.prototype.renderAsIndividuals = function (entities, force) {
|
|
9471
|
+
var _a;
|
|
9472
|
+
if (force === void 0) { force = false; }
|
|
9473
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9474
|
+
var cEntities, isEntityInItem, i, entity, id, cEntity, visual;
|
|
9475
|
+
var _this = this;
|
|
9476
|
+
return __generator(this, function (_b) {
|
|
9477
|
+
switch (_b.label) {
|
|
9478
|
+
case 0: return [4 /*yield*/, EntityRenderEngine.Render({
|
|
9479
|
+
viewer: this.viewer,
|
|
9480
|
+
apiGetter: this.apiGetter,
|
|
9481
|
+
entities: entities,
|
|
9482
|
+
menuItemId: this.item.id,
|
|
9483
|
+
visualRegister: this.visualsManager,
|
|
9484
|
+
zoomControl: this.item.CameraZoomSettings,
|
|
9485
|
+
force: force
|
|
9486
|
+
})];
|
|
9487
|
+
case 1:
|
|
9488
|
+
cEntities = _b.sent();
|
|
9489
|
+
if (this.disposed) {
|
|
9490
|
+
this.visualsManager.RemoveRegos({
|
|
9491
|
+
menuItemId: this.item.id
|
|
9492
|
+
});
|
|
9493
|
+
return [2 /*return*/];
|
|
9494
|
+
}
|
|
9495
|
+
isEntityInItem = function (entityId) {
|
|
9496
|
+
var _a, _b;
|
|
9497
|
+
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; });
|
|
9498
|
+
};
|
|
9499
|
+
for (i = 0; i < entities.length; i++) {
|
|
9500
|
+
entity = entities[i];
|
|
9501
|
+
id = entity.Bruce.ID;
|
|
9502
|
+
cEntity = cEntities[id];
|
|
9503
|
+
this.renderedEntities[id] = !!cEntity;
|
|
9504
|
+
if (cEntity && isEntityInItem(id)) {
|
|
9505
|
+
visual = (_a = this.visualsManager.GetRego({
|
|
9506
|
+
entityId: id,
|
|
9507
|
+
menuItemId: this.item.id
|
|
9508
|
+
})) === null || _a === void 0 ? void 0 : _a.visual;
|
|
9509
|
+
if (!visual || visual != cEntity) {
|
|
9510
|
+
this.visualsManager.AddRego({
|
|
9511
|
+
rego: {
|
|
9512
|
+
entityId: id,
|
|
9513
|
+
menuItemId: this.item.id,
|
|
9514
|
+
visual: cEntity,
|
|
9515
|
+
priority: 0,
|
|
9516
|
+
entityTypeId: entity.Bruce["EntityType.ID"],
|
|
9517
|
+
accountId: this.apiGetter.accountId,
|
|
9518
|
+
name: cEntity.name
|
|
9519
|
+
},
|
|
9520
|
+
requestRender: false
|
|
9521
|
+
});
|
|
9522
|
+
}
|
|
9523
|
+
}
|
|
9524
|
+
else {
|
|
9525
|
+
this.visualsManager.RemoveRegos({
|
|
9526
|
+
entityId: id,
|
|
9527
|
+
menuItemId: this.item.id,
|
|
9528
|
+
requestRender: false
|
|
9529
|
+
});
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9532
|
+
this.viewer.scene.requestRender();
|
|
9533
|
+
return [2 /*return*/];
|
|
9534
|
+
}
|
|
9535
|
+
});
|
|
9536
|
+
});
|
|
9537
|
+
};
|
|
9538
|
+
return Manager;
|
|
9539
|
+
}());
|
|
9540
|
+
EntitiesLoadedRenderManager.Manager = Manager;
|
|
9541
|
+
})(EntitiesLoadedRenderManager || (EntitiesLoadedRenderManager = {}));
|
|
9542
|
+
|
|
9543
|
+
var BATCH_SIZE$2 = 500;
|
|
9544
|
+
function getValue$5(viewer, obj) {
|
|
9545
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
9546
|
+
return obj.getValue(viewer.scene.lastRenderTime);
|
|
9547
|
+
}
|
|
9548
|
+
return obj;
|
|
9549
|
+
}
|
|
9550
|
+
function colorToCColor$4(color) {
|
|
9551
|
+
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
9552
|
+
}
|
|
9553
|
+
/**
|
|
9554
|
+
* Render manager for rendering an array of entity ids.
|
|
9555
|
+
* This will render them in batches to avoid overloading the viewer.
|
|
9556
|
+
*/
|
|
9557
|
+
var EntitiesIdsRenderManager;
|
|
9558
|
+
(function (EntitiesIdsRenderManager) {
|
|
9559
|
+
var Manager = /** @class */ (function () {
|
|
9560
|
+
function Manager(params) {
|
|
9561
|
+
var _a;
|
|
9562
|
+
this.getter = null;
|
|
9563
|
+
this.getterSub = null;
|
|
9564
|
+
this.disposed = false;
|
|
9565
|
+
this.renderedEntities = {};
|
|
9566
|
+
this.sources = [];
|
|
9567
|
+
// Highly experimental flag to try improve rendering large sets of polygons and polylines.
|
|
9568
|
+
// Many things are not supported when this is enabled.
|
|
9569
|
+
this.useGeojson = false;
|
|
9570
|
+
var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register;
|
|
9571
|
+
this.viewer = viewer;
|
|
9572
|
+
this.apiGetter = apiGetter;
|
|
9573
|
+
this.monitor = monitor;
|
|
9574
|
+
this.item = item;
|
|
9575
|
+
this.visualsManager = visualsManager;
|
|
9576
|
+
this.useGeojson = item.renderAsGeojson == true;
|
|
9577
|
+
if (this.item.enableClustering) {
|
|
9578
|
+
this.clustering = new PointClustering(visualsManager, this.item.id, (_a = this.item) === null || _a === void 0 ? void 0 : _a.clustering);
|
|
9579
|
+
}
|
|
9580
|
+
}
|
|
9581
|
+
Object.defineProperty(Manager.prototype, "Disposed", {
|
|
9582
|
+
get: function () {
|
|
9583
|
+
return this.disposed;
|
|
9584
|
+
},
|
|
9585
|
+
enumerable: false,
|
|
9586
|
+
configurable: true
|
|
9587
|
+
});
|
|
9588
|
+
Manager.prototype.Init = function () {
|
|
9589
|
+
var _this = this;
|
|
9590
|
+
var _a;
|
|
9591
|
+
if (this.disposed) {
|
|
9592
|
+
throw (new Error("This item is disposed."));
|
|
9593
|
+
}
|
|
9594
|
+
if (!((_a = this.item.CameraZoomSettings) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
9595
|
+
this.item.CameraZoomSettings = [
|
|
9596
|
+
{
|
|
9597
|
+
MinZoom: 0,
|
|
9598
|
+
MaxZoom: 100000,
|
|
9599
|
+
DisplayType: ZoomControl.EDisplayType.Model3D,
|
|
9600
|
+
LODCategoryID: "glb",
|
|
9601
|
+
LODLevel: 0,
|
|
9602
|
+
StyleID: 0
|
|
9603
|
+
}
|
|
9604
|
+
];
|
|
9605
|
+
}
|
|
9606
|
+
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
|
|
9607
|
+
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
9608
|
+
_this.onGetterUpdate(ids);
|
|
9609
|
+
});
|
|
9610
|
+
this.getter.Start();
|
|
9611
|
+
};
|
|
9612
|
+
Manager.prototype.Dispose = function () {
|
|
9613
|
+
if (this.disposed) {
|
|
9614
|
+
return;
|
|
9615
|
+
}
|
|
9616
|
+
this.doDispose();
|
|
9617
|
+
};
|
|
9618
|
+
Manager.prototype.doDispose = function () {
|
|
9619
|
+
var _a, _b;
|
|
9620
|
+
(_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
9621
|
+
this.getterSub = null;
|
|
9622
|
+
this.disposed = true;
|
|
9623
|
+
this.visualsManager.RemoveRegos({
|
|
9624
|
+
menuItemId: this.item.id
|
|
9625
|
+
});
|
|
9626
|
+
(_b = this.clustering) === null || _b === void 0 ? void 0 : _b.Dispose();
|
|
9627
|
+
this.clustering = null;
|
|
9628
|
+
for (var i = 0; i < this.sources.length; i++) {
|
|
9629
|
+
var source = this.sources[i];
|
|
9630
|
+
this.viewer.dataSources.remove(source);
|
|
9631
|
+
}
|
|
9632
|
+
this.sources = [];
|
|
9633
|
+
};
|
|
9634
|
+
Manager.prototype.ReRender = function (params) {
|
|
9635
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9636
|
+
var entityIds, force, entities;
|
|
9637
|
+
var _this = this;
|
|
9638
|
+
return __generator(this, function (_a) {
|
|
9639
|
+
entityIds = params.entityIds, force = params.force, entities = params.entities;
|
|
9640
|
+
if (entities && !entityIds) {
|
|
9641
|
+
entityIds = entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
|
|
9642
|
+
}
|
|
9643
|
+
if (entityIds == null) {
|
|
9644
|
+
entityIds = Object.keys(this.renderedEntities);
|
|
9645
|
+
}
|
|
9646
|
+
else {
|
|
9647
|
+
// ensure entity ids are part of menu item.
|
|
9648
|
+
entityIds = entityIds.filter(function (x) {
|
|
9649
|
+
var _a;
|
|
9650
|
+
return (_a = _this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.EntityIds.includes(x);
|
|
9651
|
+
});
|
|
9652
|
+
}
|
|
9653
|
+
this.visualsManager.MarkStale({
|
|
9654
|
+
entityIds: entityIds,
|
|
9655
|
+
menuItemIds: [this.item.id]
|
|
9656
|
+
});
|
|
9657
|
+
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
9658
|
+
this.renderEntities([].concat(entities).filter(function (x) { var _a; return entityIds.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID); }), force);
|
|
9659
|
+
}
|
|
9660
|
+
else {
|
|
9661
|
+
this.onGetterUpdate(entityIds, force);
|
|
9662
|
+
}
|
|
9663
|
+
return [2 /*return*/];
|
|
9664
|
+
});
|
|
9665
|
+
});
|
|
9666
|
+
};
|
|
9667
|
+
Manager.prototype.UpdateSettings = function (params) {
|
|
9668
|
+
var CameraZoomSettings = params.zoomControl, queueRerender = params.queueRerender;
|
|
9669
|
+
if (this.disposed) {
|
|
9670
|
+
return;
|
|
9671
|
+
}
|
|
9672
|
+
if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
|
|
9673
|
+
this.item.CameraZoomSettings = CameraZoomSettings;
|
|
9674
|
+
}
|
|
9675
|
+
if (queueRerender != false) {
|
|
9676
|
+
var entityIds = Object.keys(this.renderedEntities);
|
|
9677
|
+
this.visualsManager.MarkStale({
|
|
9678
|
+
entityIds: entityIds,
|
|
9679
|
+
menuItemIds: [this.item.id]
|
|
9680
|
+
});
|
|
9681
|
+
this.onGetterUpdate(entityIds);
|
|
9682
|
+
}
|
|
9683
|
+
};
|
|
9684
|
+
Manager.prototype.onGetterUpdate = function (entityIds, force) {
|
|
9685
|
+
if (force === void 0) { force = false; }
|
|
9686
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9687
|
+
var api, entities, e_1;
|
|
9688
|
+
return __generator(this, function (_a) {
|
|
9689
|
+
switch (_a.label) {
|
|
9690
|
+
case 0:
|
|
9691
|
+
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9692
|
+
return [2 /*return*/];
|
|
9693
|
+
}
|
|
9694
|
+
_a.label = 1;
|
|
9695
|
+
case 1:
|
|
9696
|
+
_a.trys.push([1, 4, , 5]);
|
|
9697
|
+
api = this.apiGetter.getApi();
|
|
9698
|
+
return [4 /*yield*/, Entity$1.GetListByIds({
|
|
9699
|
+
api: api,
|
|
9700
|
+
entityIds: entityIds
|
|
9363
9701
|
})];
|
|
9364
9702
|
case 2:
|
|
9365
|
-
entities = (_a.sent()).entities;
|
|
9366
|
-
return [4 /*yield*/, this.renderEntities(entities, force)];
|
|
9367
|
-
case 3:
|
|
9703
|
+
entities = (_a.sent()).entities;
|
|
9704
|
+
return [4 /*yield*/, this.renderEntities(entities, force)];
|
|
9705
|
+
case 3:
|
|
9706
|
+
_a.sent();
|
|
9707
|
+
return [3 /*break*/, 5];
|
|
9708
|
+
case 4:
|
|
9709
|
+
e_1 = _a.sent();
|
|
9710
|
+
console.error(e_1);
|
|
9711
|
+
return [3 /*break*/, 5];
|
|
9712
|
+
case 5: return [2 /*return*/];
|
|
9713
|
+
}
|
|
9714
|
+
});
|
|
9715
|
+
});
|
|
9716
|
+
};
|
|
9717
|
+
Manager.prototype.renderEntities = function (entities, force) {
|
|
9718
|
+
if (force === void 0) { force = false; }
|
|
9719
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9720
|
+
var e_2;
|
|
9721
|
+
return __generator(this, function (_a) {
|
|
9722
|
+
switch (_a.label) {
|
|
9723
|
+
case 0:
|
|
9724
|
+
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9725
|
+
return [2 /*return*/];
|
|
9726
|
+
}
|
|
9727
|
+
_a.label = 1;
|
|
9728
|
+
case 1:
|
|
9729
|
+
_a.trys.push([1, 6, , 7]);
|
|
9730
|
+
if (!this.useGeojson) return [3 /*break*/, 3];
|
|
9731
|
+
return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
9732
|
+
case 2:
|
|
9368
9733
|
_a.sent();
|
|
9369
9734
|
return [3 /*break*/, 5];
|
|
9735
|
+
case 3: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
9370
9736
|
case 4:
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
case
|
|
9737
|
+
_a.sent();
|
|
9738
|
+
_a.label = 5;
|
|
9739
|
+
case 5: return [3 /*break*/, 7];
|
|
9740
|
+
case 6:
|
|
9741
|
+
e_2 = _a.sent();
|
|
9742
|
+
console.error(e_2);
|
|
9743
|
+
return [3 /*break*/, 7];
|
|
9744
|
+
case 7: return [2 /*return*/];
|
|
9375
9745
|
}
|
|
9376
9746
|
});
|
|
9377
9747
|
});
|
|
9378
9748
|
};
|
|
9379
|
-
|
|
9749
|
+
/**
|
|
9750
|
+
* Our optimized and more stable path.
|
|
9751
|
+
* We construct a geojson that we draw in one go.
|
|
9752
|
+
* @param entities
|
|
9753
|
+
* @param force TODO: This should re-render entities that are already rendered.
|
|
9754
|
+
*/
|
|
9755
|
+
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
9756
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9757
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9758
|
+
var zoomItem, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
9759
|
+
var _this = this;
|
|
9760
|
+
return __generator(this, function (_m) {
|
|
9761
|
+
switch (_m.label) {
|
|
9762
|
+
case 0:
|
|
9763
|
+
entities = entities.filter(function (entity) {
|
|
9764
|
+
var _a;
|
|
9765
|
+
return !_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID];
|
|
9766
|
+
});
|
|
9767
|
+
// Mark these as rendered.
|
|
9768
|
+
entities.forEach(function (entity) {
|
|
9769
|
+
var _a;
|
|
9770
|
+
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
9771
|
+
});
|
|
9772
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
9773
|
+
style = null;
|
|
9774
|
+
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
|
|
9775
|
+
_m.label = 1;
|
|
9776
|
+
case 1:
|
|
9777
|
+
_m.trys.push([1, 3, , 4]);
|
|
9778
|
+
return [4 /*yield*/, Style.Get({
|
|
9779
|
+
api: this.apiGetter.getApi(),
|
|
9780
|
+
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
9781
|
+
})];
|
|
9782
|
+
case 2:
|
|
9783
|
+
style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
9784
|
+
return [3 /*break*/, 4];
|
|
9785
|
+
case 3:
|
|
9786
|
+
e_3 = _m.sent();
|
|
9787
|
+
console.error(e_3);
|
|
9788
|
+
return [3 /*break*/, 4];
|
|
9789
|
+
case 4:
|
|
9790
|
+
entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
9791
|
+
if (!entityTypeId) {
|
|
9792
|
+
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
9793
|
+
}
|
|
9794
|
+
if (!entityTypeId) return [3 /*break*/, 10];
|
|
9795
|
+
_m.label = 5;
|
|
9796
|
+
case 5:
|
|
9797
|
+
_m.trys.push([5, 9, , 10]);
|
|
9798
|
+
return [4 /*yield*/, EntityType.Get({
|
|
9799
|
+
entityTypeId: entityTypeId,
|
|
9800
|
+
api: this.apiGetter.getApi()
|
|
9801
|
+
})];
|
|
9802
|
+
case 6:
|
|
9803
|
+
entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
9804
|
+
if (!(!style && entityType)) return [3 /*break*/, 8];
|
|
9805
|
+
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
|
|
9806
|
+
return [4 /*yield*/, Style.Get({
|
|
9807
|
+
api: this.apiGetter.getApi(),
|
|
9808
|
+
styleId: entityType["DisplaySetting.ID"]
|
|
9809
|
+
})];
|
|
9810
|
+
case 7:
|
|
9811
|
+
style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
9812
|
+
_m.label = 8;
|
|
9813
|
+
case 8: return [3 /*break*/, 10];
|
|
9814
|
+
case 9:
|
|
9815
|
+
e_4 = _m.sent();
|
|
9816
|
+
console.error(e_4);
|
|
9817
|
+
return [3 /*break*/, 10];
|
|
9818
|
+
case 10:
|
|
9819
|
+
pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
9820
|
+
lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
9821
|
+
polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
9822
|
+
bFillColor = Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
9823
|
+
cFillColor = bFillColor ? colorToCColor$4(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
9824
|
+
bLineColor = Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
9825
|
+
cLineColor = bLineColor ? colorToCColor$4(bLineColor) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
9826
|
+
lineWidthPx = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, {}, []) : null;
|
|
9827
|
+
if (lineWidthPx == null) {
|
|
9828
|
+
lineWidthPx = 1;
|
|
9829
|
+
}
|
|
9830
|
+
lineWidthPx = EnsureNumber(lineWidthPx);
|
|
9831
|
+
if (lineWidthPx < 0.01) {
|
|
9832
|
+
lineWidthPx = 0;
|
|
9833
|
+
}
|
|
9834
|
+
lineWidthPx = Math.round(lineWidthPx);
|
|
9835
|
+
geojson = Entity$1.ToGeoJson({
|
|
9836
|
+
entities: entities,
|
|
9837
|
+
includeUserData: false,
|
|
9838
|
+
excludeAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
9839
|
+
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
9840
|
+
// No points.
|
|
9841
|
+
allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
|
|
9842
|
+
});
|
|
9843
|
+
if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
|
|
9844
|
+
return [2 /*return*/];
|
|
9845
|
+
}
|
|
9846
|
+
return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
|
|
9847
|
+
stroke: cLineColor,
|
|
9848
|
+
fill: cFillColor,
|
|
9849
|
+
strokeWidth: lineWidthPx,
|
|
9850
|
+
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
9851
|
+
})];
|
|
9852
|
+
case 11:
|
|
9853
|
+
source = _m.sent();
|
|
9854
|
+
this.viewer.dataSources.add(source);
|
|
9855
|
+
this.sources.push(source);
|
|
9856
|
+
if (this.disposed) {
|
|
9857
|
+
this.doDispose();
|
|
9858
|
+
return [2 /*return*/];
|
|
9859
|
+
}
|
|
9860
|
+
groups = [];
|
|
9861
|
+
applyStyle = function (thing, entityId, data) {
|
|
9862
|
+
if (thing.polygon) {
|
|
9863
|
+
var bFillColor_1 = Calculator.GetColor(pStyle.fillColor, data, []);
|
|
9864
|
+
var cFillColor_1 = bFillColor_1 ? colorToCColor$4(bFillColor_1) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
9865
|
+
var bLineColor_1 = Calculator.GetColor(pStyle.lineColor, data, []);
|
|
9866
|
+
var cLineColor_1 = bLineColor_1 ? colorToCColor$4(bLineColor_1) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
9867
|
+
var width = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, data, []) : null;
|
|
9868
|
+
if (width == null) {
|
|
9869
|
+
width = 1;
|
|
9870
|
+
}
|
|
9871
|
+
width = EnsureNumber(width);
|
|
9872
|
+
if (width < 0.01) {
|
|
9873
|
+
width = 0;
|
|
9874
|
+
}
|
|
9875
|
+
var curFillColor = getValue$5(_this.viewer, thing.polygon.material);
|
|
9876
|
+
if (curFillColor && curFillColor instanceof ColorMaterialProperty) {
|
|
9877
|
+
curFillColor = curFillColor.color;
|
|
9878
|
+
}
|
|
9879
|
+
var curLineColor = getValue$5(_this.viewer, thing.polygon.outlineColor);
|
|
9880
|
+
if (curLineColor && curLineColor instanceof ColorMaterialProperty) {
|
|
9881
|
+
curLineColor = curLineColor.color;
|
|
9882
|
+
}
|
|
9883
|
+
var curWidth = getValue$5(_this.viewer, thing.polygon.outlineWidth);
|
|
9884
|
+
if ((curFillColor instanceof Color && curFillColor.equals(cFillColor_1)) &&
|
|
9885
|
+
(curLineColor instanceof Color && curLineColor.equals(cLineColor_1)) &&
|
|
9886
|
+
curWidth == width) {
|
|
9887
|
+
return;
|
|
9888
|
+
}
|
|
9889
|
+
thing.polygon.material = cFillColor_1;
|
|
9890
|
+
thing.polygon.outlineColor = cLineColor_1;
|
|
9891
|
+
thing.polygon.outlineWidth = width;
|
|
9892
|
+
}
|
|
9893
|
+
else if (thing.polyline) {
|
|
9894
|
+
var bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, data, []) : null;
|
|
9895
|
+
var cColor = bColor ? colorToCColor$4(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
|
|
9896
|
+
var width = lStyle.lineWidth ? Calculator.GetNumber(lStyle.lineWidth, data, []) : null;
|
|
9897
|
+
if (width == null) {
|
|
9898
|
+
width = 2;
|
|
9899
|
+
}
|
|
9900
|
+
width = EnsureNumber(width);
|
|
9901
|
+
if (width < 0.01) {
|
|
9902
|
+
width = 0;
|
|
9903
|
+
}
|
|
9904
|
+
var curColor = getValue$5(_this.viewer, thing.polyline.material);
|
|
9905
|
+
if (curColor && curColor instanceof ColorMaterialProperty) {
|
|
9906
|
+
curColor = curColor.color;
|
|
9907
|
+
}
|
|
9908
|
+
var curWidth = getValue$5(_this.viewer, thing.polyline.width);
|
|
9909
|
+
if ((curColor instanceof Color && curColor.equals(cColor)) &&
|
|
9910
|
+
curWidth == width) {
|
|
9911
|
+
return;
|
|
9912
|
+
}
|
|
9913
|
+
thing.polyline.material = cColor;
|
|
9914
|
+
thing.polyline.width = width;
|
|
9915
|
+
}
|
|
9916
|
+
};
|
|
9917
|
+
register = function (thing) {
|
|
9918
|
+
var _a, _b, _c, _d;
|
|
9919
|
+
// See if the cesium entity already exists in a group.
|
|
9920
|
+
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; }); });
|
|
9921
|
+
if (group) {
|
|
9922
|
+
return;
|
|
9923
|
+
}
|
|
9924
|
+
var metadata = getValue$5(_this.viewer, thing === null || thing === void 0 ? void 0 : thing.properties);
|
|
9925
|
+
var entityId = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
9926
|
+
if (!entityId) {
|
|
9927
|
+
return;
|
|
9928
|
+
}
|
|
9929
|
+
var needsUpdate = false;
|
|
9930
|
+
// Find group for the nextspace entity ID.
|
|
9931
|
+
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
9932
|
+
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
9933
|
+
if (!group) {
|
|
9934
|
+
group = {
|
|
9935
|
+
entityId: entityId,
|
|
9936
|
+
visual: thing,
|
|
9937
|
+
tagIds: (_b = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"],
|
|
9938
|
+
entityTypeId: (_c = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _c === void 0 ? void 0 : _c["EntityType.ID"],
|
|
9939
|
+
siblings: [],
|
|
9940
|
+
data: entities.find(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; }),
|
|
9941
|
+
rego: null
|
|
9942
|
+
};
|
|
9943
|
+
groups.push(group);
|
|
9944
|
+
var rego = {
|
|
9945
|
+
entityId: entityId,
|
|
9946
|
+
menuItemId: _this.item.id,
|
|
9947
|
+
visual: thing,
|
|
9948
|
+
priority: 0,
|
|
9949
|
+
entityTypeId: group.entityTypeId,
|
|
9950
|
+
accountId: _this.apiGetter.accountId,
|
|
9951
|
+
tagIds: group.tagIds ? [].concat(group.tagIds) : [],
|
|
9952
|
+
name: entityType ? (_d = Entity$1.CalculateName({
|
|
9953
|
+
entity: group.data,
|
|
9954
|
+
type: entityType,
|
|
9955
|
+
defaultToId: false
|
|
9956
|
+
})) !== null && _d !== void 0 ? _d : "Unnamed Entity" : "Unnamed Entity",
|
|
9957
|
+
cdn: _this.item.cdnEnabled,
|
|
9958
|
+
collection: source.entities
|
|
9959
|
+
};
|
|
9960
|
+
group.rego = rego;
|
|
9961
|
+
_this.visualsManager.AddRego({
|
|
9962
|
+
rego: rego,
|
|
9963
|
+
requestRender: false
|
|
9964
|
+
});
|
|
9965
|
+
}
|
|
9966
|
+
// Found a group. We flag this as a sibling entity of the primary.
|
|
9967
|
+
else {
|
|
9968
|
+
group.siblings.push(thing);
|
|
9969
|
+
group.visual._siblingGraphics = group.siblings;
|
|
9970
|
+
thing._parentEntity = group.visual;
|
|
9971
|
+
if (group.rego) {
|
|
9972
|
+
_this.visualsManager.RefreshMark({
|
|
9973
|
+
rego: group.rego
|
|
9974
|
+
});
|
|
9975
|
+
needsUpdate = true;
|
|
9976
|
+
}
|
|
9977
|
+
}
|
|
9978
|
+
applyStyle(thing, entityId, group.data);
|
|
9979
|
+
if (needsUpdate) {
|
|
9980
|
+
_this.visualsManager.ForceUpdate({
|
|
9981
|
+
entityIds: [entityId],
|
|
9982
|
+
});
|
|
9983
|
+
}
|
|
9984
|
+
};
|
|
9985
|
+
sEntities = source.entities.values;
|
|
9986
|
+
for (i = 0; i < sEntities.length; i++) {
|
|
9987
|
+
cEntity = sEntities[i];
|
|
9988
|
+
register(cEntity);
|
|
9989
|
+
}
|
|
9990
|
+
this.viewer.scene.requestRender();
|
|
9991
|
+
return [2 /*return*/];
|
|
9992
|
+
}
|
|
9993
|
+
});
|
|
9994
|
+
});
|
|
9995
|
+
};
|
|
9996
|
+
/**
|
|
9997
|
+
* Our default path.
|
|
9998
|
+
* We render each entity individually.
|
|
9999
|
+
* @param entities
|
|
10000
|
+
* @param force
|
|
10001
|
+
* @returns
|
|
10002
|
+
*/
|
|
10003
|
+
Manager.prototype.renderAsIndividuals = function (entities, force) {
|
|
9380
10004
|
var _a, _b;
|
|
9381
10005
|
if (force === void 0) { force = false; }
|
|
9382
10006
|
return __awaiter(this, void 0, void 0, function () {
|
|
9383
|
-
var cEntities, i, entity, id, cEntity, visual, clustered
|
|
10007
|
+
var cEntities, i, entity, id, cEntity, visual, clustered;
|
|
9384
10008
|
return __generator(this, function (_c) {
|
|
9385
10009
|
switch (_c.label) {
|
|
9386
|
-
case 0:
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
10010
|
+
case 0: return [4 /*yield*/, EntityRenderEngine.Render({
|
|
10011
|
+
viewer: this.viewer,
|
|
10012
|
+
apiGetter: this.apiGetter,
|
|
10013
|
+
entities: entities,
|
|
10014
|
+
menuItemId: this.item.id,
|
|
10015
|
+
visualRegister: this.visualsManager,
|
|
10016
|
+
zoomControl: this.item.CameraZoomSettings,
|
|
10017
|
+
force: force
|
|
10018
|
+
})];
|
|
9391
10019
|
case 1:
|
|
9392
|
-
_c.trys.push([1, 3, , 4]);
|
|
9393
|
-
return [4 /*yield*/, EntityRenderEngine.Render({
|
|
9394
|
-
viewer: this.viewer,
|
|
9395
|
-
apiGetter: this.apiGetter,
|
|
9396
|
-
entities: entities,
|
|
9397
|
-
menuItemId: this.item.id,
|
|
9398
|
-
visualRegister: this.visualsManager,
|
|
9399
|
-
zoomControl: this.item.CameraZoomSettings,
|
|
9400
|
-
force: force
|
|
9401
|
-
})];
|
|
9402
|
-
case 2:
|
|
9403
10020
|
cEntities = _c.sent();
|
|
9404
10021
|
for (i = 0; i < entities.length; i++) {
|
|
9405
10022
|
entity = entities[i];
|
|
@@ -9441,12 +10058,7 @@ var EntitiesIdsRenderManager;
|
|
|
9441
10058
|
if (this.clustering && entities.length) {
|
|
9442
10059
|
this.clustering.Update();
|
|
9443
10060
|
}
|
|
9444
|
-
return [
|
|
9445
|
-
case 3:
|
|
9446
|
-
e_2 = _c.sent();
|
|
9447
|
-
console.error(e_2);
|
|
9448
|
-
return [3 /*break*/, 4];
|
|
9449
|
-
case 4: return [2 /*return*/];
|
|
10061
|
+
return [2 /*return*/];
|
|
9450
10062
|
}
|
|
9451
10063
|
});
|
|
9452
10064
|
});
|
|
@@ -9662,7 +10274,7 @@ var EntityRenderManager;
|
|
|
9662
10274
|
EntityRenderManager.Manager = Manager;
|
|
9663
10275
|
})(EntityRenderManager || (EntityRenderManager = {}));
|
|
9664
10276
|
|
|
9665
|
-
function colorToCColor$
|
|
10277
|
+
function colorToCColor$5(color) {
|
|
9666
10278
|
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
9667
10279
|
}
|
|
9668
10280
|
/**
|
|
@@ -10282,7 +10894,7 @@ var TilesetRenderEngine;
|
|
|
10282
10894
|
Styler.prototype.loadStyles = function () {
|
|
10283
10895
|
var _a, _b;
|
|
10284
10896
|
return __awaiter(this, void 0, void 0, function () {
|
|
10285
|
-
var counter, fallbackStyleId, data, e_1, styleMapping, modelTree, entityTypeIds, _loop_2, i, i, styleMap, styleId, entityType, e_2, data, e_3;
|
|
10897
|
+
var counter, fallbackStyleId, data, e_1, styleMapping, modelTree, entityTypeIds, _loop_2, this_2, i, i, styleMap, styleId, entityType, e_2, data, e_3;
|
|
10286
10898
|
return __generator(this, function (_c) {
|
|
10287
10899
|
switch (_c.label) {
|
|
10288
10900
|
case 0:
|
|
@@ -10327,11 +10939,12 @@ var TilesetRenderEngine;
|
|
|
10327
10939
|
if (styleMapping.findIndex(function (x) { return x.EntityTypeID == entityTypeId; }) <= -1) {
|
|
10328
10940
|
styleMapping.push({
|
|
10329
10941
|
EntityTypeID: entityTypeId,
|
|
10330
|
-
StyleID:
|
|
10331
|
-
style:
|
|
10942
|
+
StyleID: this_2.fallbackStyle ? fallbackStyleId : 0,
|
|
10943
|
+
style: this_2.fallbackStyle
|
|
10332
10944
|
});
|
|
10333
10945
|
}
|
|
10334
10946
|
};
|
|
10947
|
+
this_2 = this;
|
|
10335
10948
|
for (i = 0; i < entityTypeIds.length; i++) {
|
|
10336
10949
|
_loop_2(i);
|
|
10337
10950
|
}
|
|
@@ -10539,7 +11152,7 @@ var TilesetRenderEngine;
|
|
|
10539
11152
|
cColor = Color.WHITE;
|
|
10540
11153
|
}
|
|
10541
11154
|
else {
|
|
10542
|
-
cColor = colorToCColor$
|
|
11155
|
+
cColor = colorToCColor$5(bColor);
|
|
10543
11156
|
}
|
|
10544
11157
|
CesiumEntityStyler.SetDefaultColor({
|
|
10545
11158
|
color: cColor,
|
|
@@ -20546,7 +21159,7 @@ var CesiumViewMonitor;
|
|
|
20546
21159
|
CesiumViewMonitor$$1.Monitor = Monitor;
|
|
20547
21160
|
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
20548
21161
|
|
|
20549
|
-
var VERSION$1 = "3.
|
|
21162
|
+
var VERSION$1 = "3.4.1";
|
|
20550
21163
|
|
|
20551
21164
|
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 };
|
|
20552
21165
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|