bruce-cesium 3.0.1 → 3.0.2
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 +48 -18
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +47 -17
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/visual-register-culler.js +37 -9
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +7 -7
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/drawing-utils.js +3 -0
- package/dist/lib/utils/drawing-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 { BruceEvent, Cartes, ProjectViewTile, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, Entity, Primitive, Cesium3DTileFeature,
|
|
3
|
+
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, JulianDate, SceneMode, Entity, Primitive, Cesium3DTileFeature, HeightReference, DistanceDisplayCondition, NearFarScalar, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, SceneTransforms, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Model, Matrix4, Matrix3, IonResource, Ion, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, GeometryInstance, BoundingSphere, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -549,6 +549,9 @@ var DrawingUtils;
|
|
|
549
549
|
function EnsurePosHeight(params) {
|
|
550
550
|
var pos3d = params.pos3d, viewer = params.viewer, desiredHeightRef = params.desiredHeightRef, heightRef = params.heightRef;
|
|
551
551
|
var carto = Cartes.ValidateCartes3(pos3d) ? Cartographic.fromCartesian(pos3d) : null;
|
|
552
|
+
if (!(carto === null || carto === void 0 ? void 0 : carto.latitude)) {
|
|
553
|
+
return pos3d;
|
|
554
|
+
}
|
|
552
555
|
if (heightRef == null) {
|
|
553
556
|
heightRef = HeightReference.CLAMP_TO_GROUND;
|
|
554
557
|
}
|
|
@@ -5028,36 +5031,50 @@ function getValue$2(viewer, obj) {
|
|
|
5028
5031
|
}
|
|
5029
5032
|
return obj;
|
|
5030
5033
|
}
|
|
5034
|
+
function isFlatTerrain(viewer) {
|
|
5035
|
+
var _a;
|
|
5036
|
+
if (!viewer) {
|
|
5037
|
+
return false;
|
|
5038
|
+
}
|
|
5039
|
+
return ((_a = ViewUtils.GatherTerrainTile({
|
|
5040
|
+
viewer: viewer
|
|
5041
|
+
}).terrain) === null || _a === void 0 ? void 0 : _a.tilesetId) == ProjectViewTile.EDefaultTerrain.FlatTerrain;
|
|
5042
|
+
}
|
|
5031
5043
|
var boundingSphereCache = {};
|
|
5032
5044
|
function getPositionsFromEntity(viewer, entity) {
|
|
5045
|
+
var positions = [];
|
|
5046
|
+
var heightRef;
|
|
5033
5047
|
if (entity.billboard) {
|
|
5034
5048
|
var pos3d = getValue$2(viewer, entity.position);
|
|
5035
5049
|
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5036
5050
|
return null;
|
|
5037
5051
|
}
|
|
5038
|
-
|
|
5052
|
+
positions.push(pos3d);
|
|
5053
|
+
heightRef = getValue$2(viewer, entity.billboard.heightReference);
|
|
5039
5054
|
}
|
|
5040
5055
|
else if (entity.polyline) {
|
|
5041
|
-
|
|
5056
|
+
positions = getValue$2(viewer, entity.polyline.positions);
|
|
5057
|
+
heightRef = getValue$2(viewer, entity.polyline.clampToGround) == false ? HeightReference.NONE : HeightReference.CLAMP_TO_GROUND;
|
|
5042
5058
|
}
|
|
5043
5059
|
else if (entity.polygon) {
|
|
5044
5060
|
var hierarchy = getValue$2(viewer, entity.polygon.hierarchy);
|
|
5045
|
-
|
|
5061
|
+
positions = hierarchy.positions;
|
|
5062
|
+
heightRef = getValue$2(viewer, entity.polygon.heightReference);
|
|
5046
5063
|
}
|
|
5047
5064
|
else if (entity.corridor) {
|
|
5048
|
-
|
|
5065
|
+
positions = getValue$2(viewer, entity.corridor.positions);
|
|
5049
5066
|
}
|
|
5050
5067
|
else if (entity.ellipse) {
|
|
5051
5068
|
var position = getValue$2(viewer, entity.position);
|
|
5052
5069
|
if (!(position === null || position === void 0 ? void 0 : position.x)) {
|
|
5053
5070
|
return null;
|
|
5054
5071
|
}
|
|
5072
|
+
heightRef = getValue$2(viewer, entity.ellipse.heightReference);
|
|
5055
5073
|
var semiMajorAxis = getValue$2(viewer, entity.ellipse.semiMajorAxis);
|
|
5056
5074
|
var semiMinorAxis = getValue$2(viewer, entity.ellipse.semiMinorAxis);
|
|
5057
5075
|
var rotation = getValue$2(viewer, entity.ellipse.rotation);
|
|
5058
5076
|
// More subdivisions means a more accurate ellipse but worse performance.
|
|
5059
5077
|
var numberOfSubdivisions = 5;
|
|
5060
|
-
var positions = [];
|
|
5061
5078
|
for (var i = 0; i < numberOfSubdivisions; i++) {
|
|
5062
5079
|
var theta = i * (2 * Math.PI / numberOfSubdivisions);
|
|
5063
5080
|
var x = semiMajorAxis * Math.cos(theta);
|
|
@@ -5069,23 +5086,36 @@ function getPositionsFromEntity(viewer, entity) {
|
|
|
5069
5086
|
var point = new Cartesian3(position.x + rotatedX, position.y + rotatedY, position.z);
|
|
5070
5087
|
positions.push(point);
|
|
5071
5088
|
}
|
|
5072
|
-
return positions;
|
|
5073
5089
|
}
|
|
5074
5090
|
else if (entity.model) {
|
|
5075
5091
|
var pos3d = getValue$2(viewer, entity.position);
|
|
5076
5092
|
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5077
5093
|
return null;
|
|
5078
5094
|
}
|
|
5079
|
-
|
|
5095
|
+
positions.push(pos3d);
|
|
5096
|
+
heightRef = getValue$2(viewer, entity.model.heightReference);
|
|
5080
5097
|
}
|
|
5081
5098
|
else if (entity.point) {
|
|
5082
5099
|
var pos3d = getValue$2(viewer, entity.position);
|
|
5083
5100
|
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5084
5101
|
return null;
|
|
5085
5102
|
}
|
|
5086
|
-
|
|
5103
|
+
positions.push(pos3d);
|
|
5104
|
+
heightRef = getValue$2(viewer, entity.point.heightReference);
|
|
5087
5105
|
}
|
|
5088
|
-
|
|
5106
|
+
if (!(positions === null || positions === void 0 ? void 0 : positions.length)) {
|
|
5107
|
+
return;
|
|
5108
|
+
}
|
|
5109
|
+
// We need to zero the heights.
|
|
5110
|
+
if (heightRef == HeightReference.CLAMP_TO_GROUND && isFlatTerrain(viewer)) {
|
|
5111
|
+
for (var i = 0; i < positions.length; i++) {
|
|
5112
|
+
var pos = positions[i];
|
|
5113
|
+
var carto = Cartographic.fromCartesian(pos);
|
|
5114
|
+
carto.height = 0;
|
|
5115
|
+
positions[i] = Cartographic.toCartesian(carto);
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5118
|
+
return positions;
|
|
5089
5119
|
}
|
|
5090
5120
|
function computeBoundingSphereFromPositions(positions) {
|
|
5091
5121
|
return BoundingSphere.fromPoints(positions);
|
|
@@ -5334,8 +5364,8 @@ function removeEntity(viewer, visual) {
|
|
|
5334
5364
|
}
|
|
5335
5365
|
}
|
|
5336
5366
|
}
|
|
5337
|
-
function updateCEntityShow(viewer, visual, show, ignoreParent) {
|
|
5338
|
-
if (show) {
|
|
5367
|
+
function updateCEntityShow(viewer, isRelationship, visual, show, ignoreParent) {
|
|
5368
|
+
if (show && !isRelationship) {
|
|
5339
5369
|
// Culling is controlled by "visual-register-culler.ts".
|
|
5340
5370
|
// When an object is unculled then the 'updateEntityShow' function is re-called to reveal it and related objects.
|
|
5341
5371
|
// A sub-object can be culled while the siblings are not.
|
|
@@ -5343,12 +5373,12 @@ function updateCEntityShow(viewer, visual, show, ignoreParent) {
|
|
|
5343
5373
|
show = !isCulled;
|
|
5344
5374
|
}
|
|
5345
5375
|
if (visual._parentEntity && !ignoreParent) {
|
|
5346
|
-
updateCEntityShow(viewer, visual._parentEntity, show, false);
|
|
5376
|
+
updateCEntityShow(viewer, isRelationship, visual._parentEntity, show, false);
|
|
5347
5377
|
}
|
|
5348
5378
|
if (visual._siblingGraphics) {
|
|
5349
5379
|
for (var i = 0; i < visual._siblingGraphics.length; i++) {
|
|
5350
5380
|
var sibling = visual._siblingGraphics[i];
|
|
5351
|
-
updateCEntityShow(viewer, sibling, show, true);
|
|
5381
|
+
updateCEntityShow(viewer, isRelationship, sibling, show, true);
|
|
5352
5382
|
}
|
|
5353
5383
|
}
|
|
5354
5384
|
/**
|
|
@@ -5362,12 +5392,12 @@ function updateCEntityShow(viewer, visual, show, ignoreParent) {
|
|
|
5362
5392
|
viewer.entities.add(visual);
|
|
5363
5393
|
}
|
|
5364
5394
|
}
|
|
5365
|
-
function updateEntityShow(viewer, visual, show) {
|
|
5395
|
+
function updateEntityShow(viewer, isRelationship, visual, show) {
|
|
5366
5396
|
if (visual instanceof Entity) {
|
|
5367
5397
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
5368
5398
|
return;
|
|
5369
5399
|
}
|
|
5370
|
-
updateCEntityShow(viewer, visual, show, false);
|
|
5400
|
+
updateCEntityShow(viewer, isRelationship, visual, show, false);
|
|
5371
5401
|
return;
|
|
5372
5402
|
}
|
|
5373
5403
|
if (!isAlive$1(viewer, visual)) {
|
|
@@ -5417,7 +5447,7 @@ function updateEntity(viewer, entityId, register) {
|
|
|
5417
5447
|
var rego = regos[i];
|
|
5418
5448
|
rego.best = rego === highestPriority;
|
|
5419
5449
|
var visible = rego.suppressShow ? false : getShowState(rego);
|
|
5420
|
-
updateEntityShow(viewer, rego.visual, visible);
|
|
5450
|
+
updateEntityShow(viewer, rego.relation != null, rego.visual, visible);
|
|
5421
5451
|
if (rego.best) {
|
|
5422
5452
|
var isLabelled = register.GetIsLabelled({
|
|
5423
5453
|
entityId: entityId
|
|
@@ -18181,7 +18211,7 @@ var ViewerUtils;
|
|
|
18181
18211
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
18182
18212
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
18183
18213
|
|
|
18184
|
-
var VERSION$1 = "3.0.
|
|
18214
|
+
var VERSION$1 = "3.0.2";
|
|
18185
18215
|
|
|
18186
18216
|
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 };
|
|
18187
18217
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|