bruce-cesium 2.8.8 → 2.8.9
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 +108 -56
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +107 -55
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +47 -7
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/render-managers/other/relations-render-manager.js +10 -4
- package/dist/lib/rendering/render-managers/other/relations-render-manager.js.map +1 -1
- package/dist/lib/rendering/view-render-engine.js +42 -40
- package/dist/lib/rendering/view-render-engine.js.map +1 -1
- package/dist/lib/utils/view-utils.js.map +1 -1
- package/dist/lib/viewer/viewer-utils.js +6 -2
- package/dist/lib/viewer/viewer-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/entity-render-engine.d.ts +3 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, BatchedDataGetter, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic,
|
|
3
|
+
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, SceneMode, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, createOsmBuildings, SceneTransforms, KmlDataSource, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, Ion, EllipsoidTerrainProvider, CesiumInspector, defined, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, GeometryInstance, BoundingSphere } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -1939,6 +1939,34 @@ function getSizeOfPolygonEntity(entity) {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
return length;
|
|
1941
1941
|
}
|
|
1942
|
+
var _billboardCache = new LRUCache(100);
|
|
1943
|
+
var POINT_BILLBOARD_PADDING = 1;
|
|
1944
|
+
var createCircleBillboard = function (size, colorCss) {
|
|
1945
|
+
var key = size + "-" + colorCss;
|
|
1946
|
+
var cacheData = _billboardCache.Get(key);
|
|
1947
|
+
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvas) instanceof HTMLCanvasElement) {
|
|
1948
|
+
return cacheData;
|
|
1949
|
+
}
|
|
1950
|
+
// Slight padding to avoid corners clipping.
|
|
1951
|
+
var canvasSize = size + (POINT_BILLBOARD_PADDING * 4);
|
|
1952
|
+
var canvas = document.createElement("canvas");
|
|
1953
|
+
canvas.width = canvasSize;
|
|
1954
|
+
canvas.height = canvasSize;
|
|
1955
|
+
var context = canvas.getContext("2d");
|
|
1956
|
+
context.beginPath();
|
|
1957
|
+
context.arc(canvasSize / 2, canvasSize / 2, size / 2, 0, 2 * Math.PI, false);
|
|
1958
|
+
context.fillStyle = colorCss;
|
|
1959
|
+
context.fill();
|
|
1960
|
+
var data = {
|
|
1961
|
+
canvas: canvas,
|
|
1962
|
+
colorCss: colorCss,
|
|
1963
|
+
size: size,
|
|
1964
|
+
height: canvasSize,
|
|
1965
|
+
width: canvasSize
|
|
1966
|
+
};
|
|
1967
|
+
_billboardCache.Set(key, data);
|
|
1968
|
+
return data;
|
|
1969
|
+
};
|
|
1942
1970
|
var EntityRenderEngine;
|
|
1943
1971
|
(function (EntityRenderEngine) {
|
|
1944
1972
|
function Render(params) {
|
|
@@ -2199,7 +2227,7 @@ var EntityRenderEngine;
|
|
|
2199
2227
|
(function (Point) {
|
|
2200
2228
|
function Render(params) {
|
|
2201
2229
|
return __awaiter(this, void 0, void 0, function () {
|
|
2202
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl_1, res, blob_1, e_4, e_5, iconScale, disableDepthTest, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, outlineExtrusion, bColor, cColor, size, heightRef;
|
|
2230
|
+
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl_1, res, blob_1, e_4, e_5, iconScale, disableDepthTest, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, outlineExtrusion, bColor, cColor, size, heightRef, circleBillboard;
|
|
2203
2231
|
return __generator(this, function (_a) {
|
|
2204
2232
|
switch (_a.label) {
|
|
2205
2233
|
case 0:
|
|
@@ -2297,8 +2325,7 @@ var EntityRenderEngine;
|
|
|
2297
2325
|
heightReference: getHeightRef(style),
|
|
2298
2326
|
scale: iconScale,
|
|
2299
2327
|
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
2300
|
-
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
2301
|
-
height: _fileHeightCache[iconUrl_1]
|
|
2328
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
2302
2329
|
// Would be great once we have a setting for this.
|
|
2303
2330
|
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
2304
2331
|
},
|
|
@@ -2310,6 +2337,7 @@ var EntityRenderEngine;
|
|
|
2310
2337
|
}),
|
|
2311
2338
|
show: true
|
|
2312
2339
|
});
|
|
2340
|
+
cEntity.billboard._billboardSize = _fileHeightCache[iconUrl_1];
|
|
2313
2341
|
}
|
|
2314
2342
|
}
|
|
2315
2343
|
_a.label = 12;
|
|
@@ -2389,11 +2417,22 @@ var EntityRenderEngine;
|
|
|
2389
2417
|
return [2 /*return*/, null];
|
|
2390
2418
|
}
|
|
2391
2419
|
heightRef = getHeightRef(style);
|
|
2420
|
+
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
2392
2421
|
cEntity = new Entity({
|
|
2393
|
-
point: {
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2422
|
+
// point: {
|
|
2423
|
+
// pixelSize: size,
|
|
2424
|
+
// color: cColor,
|
|
2425
|
+
// heightReference: getHeightRef(style),
|
|
2426
|
+
// distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
2427
|
+
// },
|
|
2428
|
+
// We are generating a billboard instead of using the point.
|
|
2429
|
+
// This is because points were behaving strangely where they would appear oblong shapes.
|
|
2430
|
+
// This occurred consistently when rendering many icons and points at the same time.
|
|
2431
|
+
billboard: {
|
|
2432
|
+
height: circleBillboard.height,
|
|
2433
|
+
width: circleBillboard.width,
|
|
2434
|
+
image: circleBillboard.canvas,
|
|
2435
|
+
heightReference: heightRef,
|
|
2397
2436
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
2398
2437
|
},
|
|
2399
2438
|
position: EntityUtils.GetPos({
|
|
@@ -2404,6 +2443,7 @@ var EntityRenderEngine;
|
|
|
2404
2443
|
}),
|
|
2405
2444
|
show: true
|
|
2406
2445
|
});
|
|
2446
|
+
cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
|
|
2407
2447
|
}
|
|
2408
2448
|
if (cEntity) {
|
|
2409
2449
|
cEntity._siblingGraphics = siblings;
|
|
@@ -3900,7 +3940,7 @@ var EntityLabel;
|
|
|
3900
3940
|
}
|
|
3901
3941
|
else if (visual.billboard) {
|
|
3902
3942
|
heightRef = getValue$1(this.viewer, visual.billboard.heightReference);
|
|
3903
|
-
height =
|
|
3943
|
+
height = visual.billboard._billboardSize;
|
|
3904
3944
|
if (height) {
|
|
3905
3945
|
scale = EnsureNumber(getValue$1(this.viewer, visual.billboard.scale), 1);
|
|
3906
3946
|
pixelOffset.y = -(height * scale);
|
|
@@ -9971,11 +10011,17 @@ var RelationsRenderManager;
|
|
|
9971
10011
|
* @param relation
|
|
9972
10012
|
*/
|
|
9973
10013
|
Manager.prototype.shouldRenderRelation = function (relation) {
|
|
9974
|
-
var _a, _b, _c;
|
|
9975
|
-
if ((
|
|
9976
|
-
|
|
10014
|
+
var _a, _b, _c, _d;
|
|
10015
|
+
if ((_a = this.item.relations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10016
|
+
// Find group for the same relationship type.
|
|
10017
|
+
var typeRelations = this.item.relations.find(function (x) { return x.relationTypeId == relation["Relation.Type.ID"]; });
|
|
10018
|
+
// See if group contains the parent entity ID.
|
|
10019
|
+
if ((_b = typeRelations === null || typeRelations === void 0 ? void 0 : typeRelations.entityIds) === null || _b === void 0 ? void 0 : _b.find(function (x) { return x == relation["Principal.Entity.ID"]; })) {
|
|
10020
|
+
return true;
|
|
10021
|
+
}
|
|
9977
10022
|
}
|
|
9978
|
-
|
|
10023
|
+
// Backwards compatability.
|
|
10024
|
+
var renderedIds = (_d = (_c = this.item) === null || _c === void 0 ? void 0 : _c.BruceEntity) === null || _d === void 0 ? void 0 : _d.EntityIds;
|
|
9979
10025
|
if (!renderedIds) {
|
|
9980
10026
|
return false;
|
|
9981
10027
|
}
|
|
@@ -12760,6 +12806,7 @@ function assertIteration$1(viewer, iteration) {
|
|
|
12760
12806
|
}
|
|
12761
12807
|
/**
|
|
12762
12808
|
* Renders DATA_VERSION = 1 navigator.
|
|
12809
|
+
* param iteration
|
|
12763
12810
|
* @param params
|
|
12764
12811
|
* @param bookmark
|
|
12765
12812
|
* @param view
|
|
@@ -12883,33 +12930,32 @@ function renderLegacyNavigator(iteration, params, bookmark, view) {
|
|
|
12883
12930
|
}
|
|
12884
12931
|
_f.label = 3;
|
|
12885
12932
|
case 3:
|
|
12886
|
-
if (
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12933
|
+
if ((_e = bSettings === null || bSettings === void 0 ? void 0 : bSettings.drawnRelationEntityIDs) === null || _e === void 0 ? void 0 : _e.length) {
|
|
12934
|
+
menuItem = {
|
|
12935
|
+
id: RELATION_MENU_ITEM_ID,
|
|
12936
|
+
Caption: "Entity relations",
|
|
12937
|
+
BruceEntity: {
|
|
12938
|
+
EntityIds: bSettings.drawnRelationEntityIDs
|
|
12939
|
+
},
|
|
12940
|
+
Type: MenuItem.EType.Relations
|
|
12941
|
+
};
|
|
12942
|
+
params.manager.RenderItem({
|
|
12896
12943
|
apiGetter: params.apiGetter,
|
|
12897
12944
|
getters: params.getters,
|
|
12898
12945
|
item: menuItem
|
|
12899
|
-
})
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
return [2 /*return*/];
|
|
12946
|
+
});
|
|
12947
|
+
if (!assertIteration$1(params.viewer, iteration)) {
|
|
12948
|
+
return [2 /*return*/];
|
|
12949
|
+
}
|
|
12904
12950
|
}
|
|
12905
|
-
|
|
12906
|
-
case 5: return [2 /*return*/];
|
|
12951
|
+
return [2 /*return*/];
|
|
12907
12952
|
}
|
|
12908
12953
|
});
|
|
12909
12954
|
});
|
|
12910
12955
|
}
|
|
12911
12956
|
/**
|
|
12912
12957
|
* Renders DATA_VERSION > 1 navigator.
|
|
12958
|
+
* @param iteration
|
|
12913
12959
|
* @param params
|
|
12914
12960
|
* @param bookmark
|
|
12915
12961
|
* @param view
|
|
@@ -12917,7 +12963,7 @@ function renderLegacyNavigator(iteration, params, bookmark, view) {
|
|
|
12917
12963
|
function renderNavigator(iteration, params, bookmark, view) {
|
|
12918
12964
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
12919
12965
|
return __awaiter(this, void 0, void 0, function () {
|
|
12920
|
-
var viewer, scene, vSettings, bSettings, defaults, camera, newLens, shouldBe2d, curIs2d, transition, pos, terrain, hillShades, baseColor, globeHidden, terrainWireframe, globeAlpha, shadows, size, ambientOcclusion, AO, lighting, light, quality, fxaa, dateTime, clock, selectedIds, hiddenIds, isolatedIds, labelledIds, curLabelledIds, toUnLabel, entityOpacityMap, entityId, opacity, imagery,
|
|
12966
|
+
var viewer, scene, vSettings, bSettings, defaults, camera, newLens, shouldBe2d, curIs2d, transition, pos, terrain, hillShades, baseColor, globeHidden, terrainWireframe, globeAlpha, shadows, size, ambientOcclusion, AO, lighting, light, quality, fxaa, dateTime, clock, selectedIds, hiddenIds, isolatedIds, labelledIds, curLabelledIds, toUnLabel, entityOpacityMap, entityId, opacity, imagery, legacyRelationIds, relations, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem, gOcclusion;
|
|
12921
12967
|
return __generator(this, function (_7) {
|
|
12922
12968
|
switch (_7.label) {
|
|
12923
12969
|
case 0:
|
|
@@ -13203,16 +13249,20 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
13203
13249
|
tiles: imagery,
|
|
13204
13250
|
viewer: params.manager.Viewer,
|
|
13205
13251
|
});
|
|
13206
|
-
|
|
13207
|
-
if (!
|
|
13208
|
-
|
|
13252
|
+
legacyRelationIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedEntityRelations;
|
|
13253
|
+
if (!legacyRelationIds) {
|
|
13254
|
+
legacyRelationIds = [];
|
|
13255
|
+
}
|
|
13256
|
+
relations = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedRelations;
|
|
13257
|
+
if (!relations) {
|
|
13258
|
+
relations = [];
|
|
13209
13259
|
}
|
|
13210
13260
|
curEnabled = params.manager.GetEnabledItemIds();
|
|
13211
13261
|
newItemIds = (_5 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _5 !== void 0 ? _5 : [];
|
|
13212
13262
|
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
13213
13263
|
id = curEnabled_1[_i];
|
|
13214
|
-
if (newItemIds.indexOf(id) === -1 ||
|
|
13215
|
-
(id == RELATION_MENU_ITEM_ID && !
|
|
13264
|
+
if ((newItemIds.indexOf(id) === -1 && id != RELATION_MENU_ITEM_ID) ||
|
|
13265
|
+
(id == RELATION_MENU_ITEM_ID && !legacyRelationIds.length && !relations.length)) {
|
|
13216
13266
|
params.manager.RemoveItemById({
|
|
13217
13267
|
menuItemId: id
|
|
13218
13268
|
});
|
|
@@ -13232,26 +13282,24 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
13232
13282
|
}
|
|
13233
13283
|
_7.label = 4;
|
|
13234
13284
|
case 4:
|
|
13235
|
-
if (
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13285
|
+
if (legacyRelationIds.length || relations.length) {
|
|
13286
|
+
menuItem = {
|
|
13287
|
+
id: RELATION_MENU_ITEM_ID,
|
|
13288
|
+
Caption: "Entity relations",
|
|
13289
|
+
BruceEntity: {
|
|
13290
|
+
EntityIds: legacyRelationIds
|
|
13291
|
+
},
|
|
13292
|
+
relations: relations,
|
|
13293
|
+
Type: MenuItem.EType.Relations
|
|
13294
|
+
};
|
|
13295
|
+
params.manager.RenderItem({
|
|
13245
13296
|
getters: params.getters,
|
|
13246
13297
|
item: menuItem
|
|
13247
|
-
})
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
return [2 /*return*/];
|
|
13298
|
+
});
|
|
13299
|
+
if (!assertIteration$1(params.viewer, iteration)) {
|
|
13300
|
+
return [2 /*return*/];
|
|
13301
|
+
}
|
|
13252
13302
|
}
|
|
13253
|
-
_7.label = 6;
|
|
13254
|
-
case 6:
|
|
13255
13303
|
gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
|
|
13256
13304
|
if (gOcclusion == null) {
|
|
13257
13305
|
gOcclusion = (_6 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _6 === void 0 ? void 0 : _6.groundOcclusion;
|
|
@@ -16005,9 +16053,13 @@ function backgroundRendering(viewer) {
|
|
|
16005
16053
|
// We check in case something else is also requesting renders.
|
|
16006
16054
|
var lastRenderTime = viewer.scene.lastRenderTime;
|
|
16007
16055
|
if (!lastRenderTime || JulianDate.secondsDifference(JulianDate.now(), lastRenderTime) > 3) {
|
|
16008
|
-
|
|
16056
|
+
// Check if window is active/in focus.
|
|
16057
|
+
// TODO: Should render the moment it is in focus as well.
|
|
16058
|
+
if (document.hasFocus()) {
|
|
16059
|
+
viewer.scene.requestRender();
|
|
16060
|
+
}
|
|
16009
16061
|
}
|
|
16010
|
-
},
|
|
16062
|
+
}, 1500);
|
|
16011
16063
|
}
|
|
16012
16064
|
var ViewerUtils;
|
|
16013
16065
|
(function (ViewerUtils) {
|
|
@@ -16161,7 +16213,7 @@ var ViewerUtils;
|
|
|
16161
16213
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
16162
16214
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
16163
16215
|
|
|
16164
|
-
var VERSION$1 = "2.8.
|
|
16216
|
+
var VERSION$1 = "2.8.9";
|
|
16165
16217
|
|
|
16166
16218
|
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 };
|
|
16167
16219
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|