bruce-cesium 3.1.3 → 3.1.5
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 +21 -47
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +20 -46
- 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 +15 -34
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +4 -11
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cartes, ProjectViewTile, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, BruceEvent, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic,
|
|
3
|
+
import { Cartographic, Color, HeightReference, Cartesian3, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Math as Math$1, Transforms, ColorBlendMode, Model, JulianDate, Cartesian2, CallbackProperty, Rectangle, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Primitive, Cesium3DTileFeature, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, CesiumInspector, defined, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Matrix4, Matrix3, IonResource, Ion, PolygonPipeline, ColorMaterialProperty, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -976,7 +976,7 @@ var EntityUtils;
|
|
|
976
976
|
});
|
|
977
977
|
}); };
|
|
978
978
|
getEntityPositions = function (sample) { return __awaiter(_this, void 0, void 0, function () {
|
|
979
|
-
var entityId, entity, tileset, tilesetId, e_1, evaluateRendered, evaluateRecord, renderedPosses, recordPosses, e_2, tSettings, pos3d, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset
|
|
979
|
+
var entityId, entity, tileset, tilesetId, e_1, evaluateRendered, evaluateRecord, renderedPosses, recordPosses, e_2, tSettings, pos3d, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset;
|
|
980
980
|
var _this = this;
|
|
981
981
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
982
982
|
return __generator(this, function (_l) {
|
|
@@ -1102,7 +1102,7 @@ var EntityUtils;
|
|
|
1102
1102
|
posses.push(pos3d_1);
|
|
1103
1103
|
if (visual.model) {
|
|
1104
1104
|
modelExt = visual.model;
|
|
1105
|
-
if (modelExt._radius) {
|
|
1105
|
+
if (modelExt._radius && modelExt._radius > -1) {
|
|
1106
1106
|
sphere = BoundingSphere.fromPoints([pos3d_1]);
|
|
1107
1107
|
sphere.radius = modelExt._radius;
|
|
1108
1108
|
spheres.push(sphere);
|
|
@@ -1229,7 +1229,7 @@ var EntityUtils;
|
|
|
1229
1229
|
case 12:
|
|
1230
1230
|
tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
|
|
1231
1231
|
pos3d = null;
|
|
1232
|
-
if (!(((_b = entity === null || entity === void 0 ? void 0 : entity.location) === null || _b === void 0 ? void 0 : _b.longitude) || ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _c === void 0 ? void 0 : _c.longitude))) return [3 /*break*/,
|
|
1232
|
+
if (!(((_b = entity === null || entity === void 0 ? void 0 : entity.location) === null || _b === void 0 ? void 0 : _b.longitude) || ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _c === void 0 ? void 0 : _c.longitude))) return [3 /*break*/, 14];
|
|
1233
1233
|
if ((_d = entity === null || entity === void 0 ? void 0 : entity.location) === null || _d === void 0 ? void 0 : _d.longitude) {
|
|
1234
1234
|
alt = +entity.location.altitude;
|
|
1235
1235
|
if (isNaN(alt)) {
|
|
@@ -1244,7 +1244,7 @@ var EntityUtils;
|
|
|
1244
1244
|
}
|
|
1245
1245
|
pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
|
|
1246
1246
|
}
|
|
1247
|
-
if (!(entity === null || entity === void 0 ? void 0 : entity.worldPosition)) return [3 /*break*/,
|
|
1247
|
+
if (!(entity === null || entity === void 0 ? void 0 : entity.worldPosition)) return [3 /*break*/, 14];
|
|
1248
1248
|
heading = 0;
|
|
1249
1249
|
pitch = 0;
|
|
1250
1250
|
roll = 0;
|
|
@@ -1295,13 +1295,6 @@ var EntityUtils;
|
|
|
1295
1295
|
pos3d = _l.sent();
|
|
1296
1296
|
_l.label = 14;
|
|
1297
1297
|
case 14:
|
|
1298
|
-
if ((entity === null || entity === void 0 ? void 0 : entity.geometryRadius) && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
1299
|
-
sphere = BoundingSphere.fromPoints([pos3d]);
|
|
1300
|
-
sphere.radius = entity.geometryRadius;
|
|
1301
|
-
spheres.push(sphere);
|
|
1302
|
-
}
|
|
1303
|
-
_l.label = 15;
|
|
1304
|
-
case 15:
|
|
1305
1298
|
if (pos3d) {
|
|
1306
1299
|
return [2 /*return*/, [pos3d]];
|
|
1307
1300
|
}
|
|
@@ -5000,7 +4993,7 @@ var EntityLabel;
|
|
|
5000
4993
|
Label.prototype.createLabel = function (starterPos3d) {
|
|
5001
4994
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
5002
4995
|
return __awaiter(this, void 0, void 0, function () {
|
|
5003
|
-
var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, size, height, scale, posses, centerIndex, text, type, e_1, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel, terrTimeout;
|
|
4996
|
+
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_1, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel, terrTimeout;
|
|
5004
4997
|
var _this = this;
|
|
5005
4998
|
return __generator(this, function (_h) {
|
|
5006
4999
|
switch (_h.label) {
|
|
@@ -5028,7 +5021,7 @@ var EntityLabel;
|
|
|
5028
5021
|
posses = [].concat(hierarchy.positions);
|
|
5029
5022
|
try {
|
|
5030
5023
|
sizeInM = (_c = MeasureUtils.MeasurePolygon({
|
|
5031
|
-
posses: posses
|
|
5024
|
+
posses: posses
|
|
5032
5025
|
})) === null || _c === void 0 ? void 0 : _c.area;
|
|
5033
5026
|
if (isNaN(sizeInM)) {
|
|
5034
5027
|
sizeInM = 0;
|
|
@@ -5069,7 +5062,7 @@ var EntityLabel;
|
|
|
5069
5062
|
}
|
|
5070
5063
|
try {
|
|
5071
5064
|
sizeInM = (_d = MeasureUtils.MeasurePolyline({
|
|
5072
|
-
posses: posses
|
|
5065
|
+
posses: posses
|
|
5073
5066
|
})) === null || _d === void 0 ? void 0 : _d.totalLength;
|
|
5074
5067
|
if (isNaN(sizeInM)) {
|
|
5075
5068
|
sizeInM = 0;
|
|
@@ -5084,6 +5077,10 @@ var EntityLabel;
|
|
|
5084
5077
|
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5085
5078
|
heightRef = getValue$2(this.viewer, visual.model.heightReference);
|
|
5086
5079
|
}
|
|
5080
|
+
model = visual.model;
|
|
5081
|
+
if (model._radiusLoaded && model._radius > 0) {
|
|
5082
|
+
sizeInM = model._radius;
|
|
5083
|
+
}
|
|
5087
5084
|
}
|
|
5088
5085
|
else if (visual.point) {
|
|
5089
5086
|
heightRef = getValue$2(this.viewer, visual.point.heightReference);
|
|
@@ -5112,7 +5109,7 @@ var EntityLabel;
|
|
|
5112
5109
|
}
|
|
5113
5110
|
try {
|
|
5114
5111
|
sizeInM = (_e = MeasureUtils.MeasurePolyline({
|
|
5115
|
-
posses: posses
|
|
5112
|
+
posses: posses
|
|
5116
5113
|
})) === null || _e === void 0 ? void 0 : _e.totalLength;
|
|
5117
5114
|
if (isNaN(sizeInM)) {
|
|
5118
5115
|
sizeInM = 0;
|
|
@@ -5234,40 +5231,17 @@ var EntityLabel;
|
|
|
5234
5231
|
return _lastDistance;
|
|
5235
5232
|
}
|
|
5236
5233
|
}
|
|
5237
|
-
// Check if there is a raycast collision between camera and pos3d.
|
|
5238
|
-
// We'll let the labels draw through a ground collision.
|
|
5239
|
-
// Commented out while it is WIP.
|
|
5240
|
-
// const direction = Cesium.Cartesian3.subtract(pos3d, cameraPos, new Cesium.Cartesian3());
|
|
5241
|
-
// const ray = new Cesium.Ray(pos3d.clone(), direction);
|
|
5242
|
-
// const objects = (this.viewer.scene as any).drillPickFromRay(ray, 1, [visuals]);
|
|
5243
|
-
// if (objects && objects.length > 0) {
|
|
5244
|
-
// for (let i = 0; i < objects.length; ++i) {
|
|
5245
|
-
// const obj = objects[i];
|
|
5246
|
-
// if (!visuals.find(x => x == obj?.id)) {
|
|
5247
|
-
// let isGround = true;
|
|
5248
|
-
// if (obj.object) {
|
|
5249
|
-
// const url = obj.object?.primitive?._basePath;
|
|
5250
|
-
// if (url && typeof url == "string") {
|
|
5251
|
-
// isGround = url.includes("tile.googleapis.com");
|
|
5252
|
-
// }
|
|
5253
|
-
// else {
|
|
5254
|
-
// isGround = false;
|
|
5255
|
-
// }
|
|
5256
|
-
// }
|
|
5257
|
-
// if (!isGround) {
|
|
5258
|
-
// return null;
|
|
5259
|
-
// }
|
|
5260
|
-
// }
|
|
5261
|
-
// }
|
|
5262
|
-
// }
|
|
5263
5234
|
var distance = Cartesian3.distance(cameraPos, _this._pos3d);
|
|
5264
5235
|
_lastDistance = distance;
|
|
5265
5236
|
_lastCameraPos = cameraPos.clone();
|
|
5266
5237
|
return distance;
|
|
5267
5238
|
};
|
|
5268
|
-
MAX_DISTANCE = 5000;
|
|
5269
|
-
if (
|
|
5270
|
-
|
|
5239
|
+
MAX_DISTANCE = Math.max(5000, sizeInM * 10);
|
|
5240
|
+
if (visual && visual instanceof Entity) {
|
|
5241
|
+
// Consistent sized things.
|
|
5242
|
+
if (visual.polyline || visual.billboard || visual.point) {
|
|
5243
|
+
MAX_DISTANCE = Infinity;
|
|
5244
|
+
}
|
|
5271
5245
|
}
|
|
5272
5246
|
updateLabel = function () {
|
|
5273
5247
|
var _a;
|
|
@@ -5297,7 +5271,7 @@ var EntityLabel;
|
|
|
5297
5271
|
ele.style.display = "block";
|
|
5298
5272
|
// Check scale to apply based on distance between camera and pos3d.
|
|
5299
5273
|
// We'll make the label smaller and less transparent when further away.
|
|
5300
|
-
var scale = _this.prePositioned ? 1 : 1 - (distance / MAX_DISTANCE);
|
|
5274
|
+
var scale = _this.prePositioned || MAX_DISTANCE == Infinity ? 1 : 1 - (distance / MAX_DISTANCE);
|
|
5301
5275
|
if (scale && scale > 0.15) {
|
|
5302
5276
|
ele.style.transform = "scale(".concat(scale, ")");
|
|
5303
5277
|
ele.style.opacity = "".concat(scale);
|
|
@@ -18754,7 +18728,7 @@ var CesiumViewMonitor;
|
|
|
18754
18728
|
CesiumViewMonitor$$1.Monitor = Monitor;
|
|
18755
18729
|
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
18756
18730
|
|
|
18757
|
-
var VERSION$1 = "3.1.
|
|
18731
|
+
var VERSION$1 = "3.1.5";
|
|
18758
18732
|
|
|
18759
18733
|
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 };
|
|
18760
18734
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|