bruce-cesium 2.8.4 → 2.8.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 +182 -95
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +181 -94
- 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 +182 -93
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +12 -5
- package/package.json +1 -1
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, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1,
|
|
3
|
+
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, JulianDate, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, SceneMode, Primitive, Cesium3DTileFeature, KmlDataSource, SceneTransforms, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, Cesium3DTileset, Model, OrthographicFrustum, EasingFunction, PolygonPipeline, CesiumInspector, Matrix4, Matrix3, IonResource, Ion, ColorMaterialProperty, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -3739,28 +3739,27 @@ var EntityLabel;
|
|
|
3739
3739
|
EntityLabel.ATTACH_KEY = "nextspace-navigator-entity-label";
|
|
3740
3740
|
var Label = /** @class */ (function () {
|
|
3741
3741
|
function Label(params) {
|
|
3742
|
-
var
|
|
3742
|
+
var _a;
|
|
3743
|
+
// Counter to help differentiate between createLabel calls.
|
|
3744
|
+
this.counter = 0;
|
|
3743
3745
|
// The label element itself.
|
|
3744
3746
|
this.label = null;
|
|
3745
3747
|
// Callback to kill render listener.
|
|
3746
3748
|
this.renderRemoval = null;
|
|
3749
|
+
// Callback to kill terrain listener.
|
|
3750
|
+
this.terrChangedRemoval = null;
|
|
3747
3751
|
// Indicates the label was disposed and any actions will be ignored.
|
|
3748
3752
|
this.disposed = false;
|
|
3749
|
-
this.creating = false;
|
|
3750
3753
|
// Calculated pos3d for the label.
|
|
3751
3754
|
// Override to make it draw at a different position.
|
|
3752
|
-
this.
|
|
3755
|
+
this._pos3d = null;
|
|
3756
|
+
this.prePositioned = false;
|
|
3753
3757
|
this.rego = params.rego;
|
|
3754
3758
|
this.viewer = params.viewer;
|
|
3755
3759
|
this.api = params.api;
|
|
3756
3760
|
this.visualRegister = params.visualRegister;
|
|
3757
|
-
this.
|
|
3758
|
-
this.
|
|
3759
|
-
_this.creating = false;
|
|
3760
|
-
}).catch(function (e) {
|
|
3761
|
-
console.error("Failed to create label", e);
|
|
3762
|
-
_this.creating = false;
|
|
3763
|
-
});
|
|
3761
|
+
this.prePositioned = !isNaN((_a = params.pos3d) === null || _a === void 0 ? void 0 : _a.x);
|
|
3762
|
+
this.createLabel(params.pos3d);
|
|
3764
3763
|
}
|
|
3765
3764
|
Object.defineProperty(Label.prototype, "Rego", {
|
|
3766
3765
|
get: function () {
|
|
@@ -3776,9 +3775,14 @@ var EntityLabel;
|
|
|
3776
3775
|
enumerable: false,
|
|
3777
3776
|
configurable: true
|
|
3778
3777
|
});
|
|
3779
|
-
Object.defineProperty(Label.prototype, "
|
|
3778
|
+
Object.defineProperty(Label.prototype, "pos3d", {
|
|
3780
3779
|
get: function () {
|
|
3781
|
-
return this.
|
|
3780
|
+
return this._pos3d;
|
|
3781
|
+
},
|
|
3782
|
+
set: function (val) {
|
|
3783
|
+
this._pos3d = val;
|
|
3784
|
+
this.prePositioned = !isNaN(val === null || val === void 0 ? void 0 : val.x);
|
|
3785
|
+
this.createLabel(val);
|
|
3782
3786
|
},
|
|
3783
3787
|
enumerable: false,
|
|
3784
3788
|
configurable: true
|
|
@@ -3792,49 +3796,107 @@ var EntityLabel;
|
|
|
3792
3796
|
return;
|
|
3793
3797
|
}
|
|
3794
3798
|
this.disposed = true;
|
|
3795
|
-
|
|
3796
|
-
this.label.parentElement) {
|
|
3797
|
-
this.label.parentElement.removeChild(this.label);
|
|
3798
|
-
this.label = null;
|
|
3799
|
-
}
|
|
3800
|
-
if (this.renderRemoval) {
|
|
3801
|
-
this.renderRemoval();
|
|
3802
|
-
this.renderRemoval = null;
|
|
3803
|
-
}
|
|
3799
|
+
this.removeLabel();
|
|
3804
3800
|
};
|
|
3805
3801
|
/**
|
|
3806
3802
|
* Creates cesium entity for the label if one does not exist.
|
|
3807
|
-
* @param
|
|
3803
|
+
* @param starterPos3d optional position to create label at. Ignored for billboard labels.
|
|
3808
3804
|
*/
|
|
3809
|
-
Label.prototype.
|
|
3810
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3805
|
+
Label.prototype.createLabel = function (starterPos3d) {
|
|
3806
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3811
3807
|
return __awaiter(this, void 0, void 0, function () {
|
|
3812
|
-
var
|
|
3808
|
+
var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, size, height, scale, posses, centerIndex, text, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel, terrTimeout;
|
|
3813
3809
|
var _this = this;
|
|
3814
|
-
return __generator(this, function (
|
|
3815
|
-
switch (
|
|
3810
|
+
return __generator(this, function (_k) {
|
|
3811
|
+
switch (_k.label) {
|
|
3816
3812
|
case 0:
|
|
3817
|
-
|
|
3813
|
+
pos3d = starterPos3d ? starterPos3d.clone() : null;
|
|
3814
|
+
counter = ++this.counter;
|
|
3815
|
+
if (this.disposed) {
|
|
3818
3816
|
return [2 /*return*/];
|
|
3819
3817
|
}
|
|
3818
|
+
this.removeLabel();
|
|
3819
|
+
sizeInM = 0;
|
|
3820
3820
|
heightRef = null;
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3821
|
+
pixelOffset = new Cartesian2(0, -5);
|
|
3822
|
+
if (!isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3823
|
+
heightRef = HeightReference.NONE;
|
|
3824
|
+
pixelOffset.y = -15;
|
|
3825
|
+
}
|
|
3824
3826
|
visual = (_a = this.rego) === null || _a === void 0 ? void 0 : _a.visual;
|
|
3827
|
+
// If pos3d is already set we'll run through the visuals to figure out the entity's size.
|
|
3828
|
+
// If unset then we'll use the entity's position to draw the label.
|
|
3825
3829
|
if (visual && visual instanceof Entity) {
|
|
3826
|
-
if (visual.polygon) {
|
|
3827
|
-
|
|
3830
|
+
if (!this.prePositioned && visual.polygon) {
|
|
3831
|
+
hierarchy = getValue$1(this.viewer, visual.polygon.hierarchy);
|
|
3832
|
+
if ((_b = hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.positions) === null || _b === void 0 ? void 0 : _b.length) {
|
|
3833
|
+
posses = [].concat(hierarchy.positions);
|
|
3834
|
+
try {
|
|
3835
|
+
sizeInM = (_c = MeasureUtils.MeasurePolygon({
|
|
3836
|
+
posses: posses,
|
|
3837
|
+
})) === null || _c === void 0 ? void 0 : _c.area;
|
|
3838
|
+
if (isNaN(sizeInM)) {
|
|
3839
|
+
sizeInM = 0;
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
catch (e) {
|
|
3843
|
+
console.error("Failed to measure polygon", e);
|
|
3844
|
+
}
|
|
3845
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3846
|
+
heightRef = getValue$1(this.viewer, visual.polygon.heightReference);
|
|
3847
|
+
if (Cartes.IsRing3Closed(posses)) {
|
|
3848
|
+
posses.pop();
|
|
3849
|
+
}
|
|
3850
|
+
centerIndex = Math.floor(posses.length / 2);
|
|
3851
|
+
if (posses.length >= 3) {
|
|
3852
|
+
pos1 = posses[centerIndex];
|
|
3853
|
+
pos2 = posses[0];
|
|
3854
|
+
pos3 = posses[posses.length - 1];
|
|
3855
|
+
if (pos1 && pos2 && pos3) {
|
|
3856
|
+
pos3d = Cartesian3.midpoint(pos1, pos2, new Cartesian3());
|
|
3857
|
+
pos3d = Cartesian3.midpoint(pos3d, pos3, new Cartesian3());
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3861
|
+
pos3d = posses[centerIndex];
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3828
3865
|
}
|
|
3829
|
-
else if (visual.polyline) {
|
|
3830
|
-
|
|
3831
|
-
|
|
3866
|
+
else if (!this.prePositioned && visual.polyline) {
|
|
3867
|
+
posses = getValue$1(this.viewer, visual.polyline.positions);
|
|
3868
|
+
if (posses === null || posses === void 0 ? void 0 : posses.length) {
|
|
3869
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3870
|
+
isClamped = getValue$1(this.viewer, visual.polyline.clampToGround);
|
|
3871
|
+
heightRef = isClamped == false ? HeightReference.NONE : HeightReference.CLAMP_TO_GROUND;
|
|
3872
|
+
centerIndex = Math.floor(posses.length / 2);
|
|
3873
|
+
pos3d = posses[centerIndex];
|
|
3874
|
+
}
|
|
3875
|
+
try {
|
|
3876
|
+
sizeInM = (_d = MeasureUtils.MeasurePolyline({
|
|
3877
|
+
posses: posses,
|
|
3878
|
+
})) === null || _d === void 0 ? void 0 : _d.totalLength;
|
|
3879
|
+
if (isNaN(sizeInM)) {
|
|
3880
|
+
sizeInM = 0;
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
catch (e) {
|
|
3884
|
+
console.error("Failed to measure polyline", e);
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3832
3887
|
}
|
|
3833
3888
|
else if (visual.model) {
|
|
3834
|
-
|
|
3889
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3890
|
+
heightRef = getValue$1(this.viewer, visual.model.heightReference);
|
|
3891
|
+
}
|
|
3835
3892
|
}
|
|
3836
3893
|
else if (visual.point) {
|
|
3837
3894
|
heightRef = getValue$1(this.viewer, visual.point.heightReference);
|
|
3895
|
+
size = getValue$1(this.viewer, visual.point.pixelSize);
|
|
3896
|
+
if (size) {
|
|
3897
|
+
pixelOffset.y = -(size / 2);
|
|
3898
|
+
pixelOffset.y -= 5;
|
|
3899
|
+
}
|
|
3838
3900
|
}
|
|
3839
3901
|
else if (visual.billboard) {
|
|
3840
3902
|
heightRef = getValue$1(this.viewer, visual.billboard.heightReference);
|
|
@@ -3842,63 +3904,57 @@ var EntityLabel;
|
|
|
3842
3904
|
if (height) {
|
|
3843
3905
|
scale = EnsureNumber(getValue$1(this.viewer, visual.billboard.scale), 1);
|
|
3844
3906
|
pixelOffset.y = -(height * scale);
|
|
3907
|
+
pixelOffset.y -= 5;
|
|
3845
3908
|
}
|
|
3846
|
-
// Flat padding.
|
|
3847
|
-
pixelOffset.y -= 5;
|
|
3848
|
-
heightOffset = 0;
|
|
3849
|
-
}
|
|
3850
|
-
else if (visual.corridor) {
|
|
3851
|
-
heightRef = getValue$1(this.viewer, visual.corridor.heightReference);
|
|
3852
3909
|
}
|
|
3853
|
-
else if (visual.
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
lonIsRad = typeof lon == "number" && lon > -Math.PI && lon < Math.PI;
|
|
3869
|
-
latIsDeg = typeof lat == "number" && lat > -180 && lat < 180;
|
|
3870
|
-
lonIsDeg = typeof lon == "number" && lon > -180 && lon < 180;
|
|
3871
|
-
if (latIsRad && lonIsRad) {
|
|
3872
|
-
pos3d = Cartographic.toCartesian(Cartographic.fromRadians(lon, lat, 0));
|
|
3910
|
+
else if (!this.prePositioned && visual.corridor) {
|
|
3911
|
+
posses = getValue$1(this.viewer, visual.corridor.positions);
|
|
3912
|
+
if (posses === null || posses === void 0 ? void 0 : posses.length) {
|
|
3913
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3914
|
+
heightRef = getValue$1(this.viewer, visual.corridor.heightReference);
|
|
3915
|
+
centerIndex = Math.floor(posses.length / 2);
|
|
3916
|
+
pos3d = posses[centerIndex];
|
|
3917
|
+
}
|
|
3918
|
+
try {
|
|
3919
|
+
sizeInM = (_e = MeasureUtils.MeasurePolyline({
|
|
3920
|
+
posses: posses,
|
|
3921
|
+
})) === null || _e === void 0 ? void 0 : _e.totalLength;
|
|
3922
|
+
if (isNaN(sizeInM)) {
|
|
3923
|
+
sizeInM = 0;
|
|
3924
|
+
}
|
|
3873
3925
|
}
|
|
3874
|
-
|
|
3875
|
-
|
|
3926
|
+
catch (e) {
|
|
3927
|
+
console.error("Failed to measure polyline", e);
|
|
3876
3928
|
}
|
|
3877
|
-
heightRef = HeightReference.CLAMP_TO_GROUND;
|
|
3878
3929
|
}
|
|
3879
3930
|
}
|
|
3931
|
+
else if (visual.ellipse) {
|
|
3932
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3933
|
+
heightRef = getValue$1(this.viewer, visual.ellipse.heightReference);
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
if (visual.billboard || visual.point || isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3937
|
+
pos3d = getValue$1(this.viewer, visual.position);
|
|
3938
|
+
}
|
|
3880
3939
|
}
|
|
3881
3940
|
if (!isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 2];
|
|
3882
3941
|
return [4 /*yield*/, EntityUtils.GetPosAsync({
|
|
3883
3942
|
viewer: this.viewer,
|
|
3884
3943
|
api: this.api,
|
|
3885
|
-
entityId: (
|
|
3944
|
+
entityId: (_f = this.rego) === null || _f === void 0 ? void 0 : _f.entityId,
|
|
3886
3945
|
returnHeightRef: HeightReference.NONE,
|
|
3887
|
-
|
|
3946
|
+
recordHeightRef: heightRef == null || isNaN(heightRef) ? HeightReference.NONE : heightRef,
|
|
3947
|
+
tilesetId: (_g = this.rego) === null || _g === void 0 ? void 0 : _g.tilesetId,
|
|
3888
3948
|
visualRegister: this.visualRegister
|
|
3889
3949
|
})];
|
|
3890
3950
|
case 1:
|
|
3891
|
-
pos3d =
|
|
3951
|
+
pos3d = _k.sent();
|
|
3892
3952
|
heightRef = HeightReference.NONE;
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
heightOffset = 0;
|
|
3899
|
-
pixelOffset.y = -15;
|
|
3900
|
-
_g.label = 4;
|
|
3901
|
-
case 4:
|
|
3953
|
+
if (this.counter != counter) {
|
|
3954
|
+
return [2 /*return*/];
|
|
3955
|
+
}
|
|
3956
|
+
_k.label = 2;
|
|
3957
|
+
case 2:
|
|
3902
3958
|
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3903
3959
|
return [2 /*return*/];
|
|
3904
3960
|
}
|
|
@@ -3911,18 +3967,11 @@ var EntityLabel;
|
|
|
3911
3967
|
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3912
3968
|
return [2 /*return*/];
|
|
3913
3969
|
}
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
// TODO: Check if we need to use heightRef and adjust to absolute height.
|
|
3917
|
-
// TODO: We should be smarter and not just add 10m to the height. Eg: use polygon extrusion.
|
|
3918
|
-
carto.height += heightOffset;
|
|
3919
|
-
pos3d = Cartographic.toCartesian(carto);
|
|
3920
|
-
}
|
|
3921
|
-
this.pos3d = pos3d;
|
|
3922
|
-
text = (_f = (_e = this.rego) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : "Unnamed Entity";
|
|
3970
|
+
this._pos3d = pos3d;
|
|
3971
|
+
text = (_j = (_h = this.rego) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : "Unnamed Entity";
|
|
3923
3972
|
ele = document.createElement("div");
|
|
3924
3973
|
ele.innerHTML = text;
|
|
3925
|
-
ele.setAttribute("style", "\n position: absolute;\n z-index:
|
|
3974
|
+
ele.setAttribute("style", "\n position: absolute;\n z-index: 0;\n display: none;\n pointer-events: none;\n padding: 6px 8px;\n border-radius: 6px;\n font-family: Arial;\n font-size: 12px;\n -webkit-backdrop-filter: blur(20px);\n backdrop-filter: blur(20px);\n background: rgba(33,39,42,.8);\n border-radius: 9px;\n box-shadow: 0 0 1px rgba(18,22,25,.36),0 18px 36px -4px rgba(18,22,25,.36);\n color: #ffffff;\n }");
|
|
3926
3975
|
this.label = ele;
|
|
3927
3976
|
this.viewer.container.appendChild(ele);
|
|
3928
3977
|
_lastDistance = null;
|
|
@@ -3972,23 +4021,30 @@ var EntityLabel;
|
|
|
3972
4021
|
// }
|
|
3973
4022
|
// }
|
|
3974
4023
|
// }
|
|
3975
|
-
var distance = Cartesian3.distance(cameraPos, _this.
|
|
4024
|
+
var distance = Cartesian3.distance(cameraPos, _this._pos3d);
|
|
3976
4025
|
_lastDistance = distance;
|
|
3977
4026
|
_lastCameraPos = cameraPos.clone();
|
|
3978
4027
|
return distance;
|
|
3979
4028
|
};
|
|
3980
4029
|
MAX_DISTANCE = 5000;
|
|
4030
|
+
if (sizeInM > 30) {
|
|
4031
|
+
MAX_DISTANCE = Math.max(MAX_DISTANCE, sizeInM / 2);
|
|
4032
|
+
}
|
|
3981
4033
|
updateLabel = function () {
|
|
3982
4034
|
var _a;
|
|
3983
|
-
if (_this.disposed || isNaN((_a = _this.
|
|
4035
|
+
if (_this.disposed || isNaN((_a = _this._pos3d) === null || _a === void 0 ? void 0 : _a.x)) {
|
|
4036
|
+
return;
|
|
4037
|
+
}
|
|
4038
|
+
if (!_this.viewer || _this.viewer.isDestroyed()) {
|
|
4039
|
+
_this.Dispose();
|
|
3984
4040
|
return;
|
|
3985
4041
|
}
|
|
3986
4042
|
var distance = getDistance();
|
|
3987
|
-
if (isNaN(distance) || distance >= MAX_DISTANCE) {
|
|
4043
|
+
if (isNaN(distance) || (!_this.prePositioned && distance >= MAX_DISTANCE)) {
|
|
3988
4044
|
ele.style.display = "none";
|
|
3989
4045
|
return;
|
|
3990
4046
|
}
|
|
3991
|
-
var pos2d = SceneTransforms.wgs84ToWindowCoordinates(_this.viewer.scene, _this.
|
|
4047
|
+
var pos2d = SceneTransforms.wgs84ToWindowCoordinates(_this.viewer.scene, _this._pos3d);
|
|
3992
4048
|
if (isNaN(pos2d === null || pos2d === void 0 ? void 0 : pos2d.x)) {
|
|
3993
4049
|
ele.style.display = "none";
|
|
3994
4050
|
return;
|
|
@@ -4002,7 +4058,7 @@ var EntityLabel;
|
|
|
4002
4058
|
ele.style.display = "block";
|
|
4003
4059
|
// Check scale to apply based on distance between camera and pos3d.
|
|
4004
4060
|
// We'll make the label smaller and less transparent when further away.
|
|
4005
|
-
var scale = 1 - (distance / MAX_DISTANCE);
|
|
4061
|
+
var scale = _this.prePositioned ? 1 : 1 - (distance / MAX_DISTANCE);
|
|
4006
4062
|
if (scale && scale > 0.15) {
|
|
4007
4063
|
ele.style.transform = "scale(".concat(scale, ")");
|
|
4008
4064
|
ele.style.opacity = "".concat(scale);
|
|
@@ -4018,11 +4074,42 @@ var EntityLabel;
|
|
|
4018
4074
|
};
|
|
4019
4075
|
this.renderRemoval = this.viewer.scene.postUpdate.addEventListener(updateLabel);
|
|
4020
4076
|
updateLabel();
|
|
4077
|
+
terrTimeout = null;
|
|
4078
|
+
this.terrChangedRemoval = this.viewer.scene.terrainProviderChanged.addEventListener(function () {
|
|
4079
|
+
if (_this.disposed) {
|
|
4080
|
+
return;
|
|
4081
|
+
}
|
|
4082
|
+
clearTimeout(terrTimeout);
|
|
4083
|
+
terrTimeout = setTimeout(function () {
|
|
4084
|
+
if (counter != _this.counter) {
|
|
4085
|
+
return;
|
|
4086
|
+
}
|
|
4087
|
+
_this.createLabel(starterPos3d);
|
|
4088
|
+
}, 2500);
|
|
4089
|
+
});
|
|
4021
4090
|
return [2 /*return*/];
|
|
4022
4091
|
}
|
|
4023
4092
|
});
|
|
4024
4093
|
});
|
|
4025
4094
|
};
|
|
4095
|
+
/**
|
|
4096
|
+
* Removes label from the viewer and unsubscribes from events.
|
|
4097
|
+
*/
|
|
4098
|
+
Label.prototype.removeLabel = function () {
|
|
4099
|
+
if (this.label &&
|
|
4100
|
+
this.label.parentElement) {
|
|
4101
|
+
this.label.parentElement.removeChild(this.label);
|
|
4102
|
+
this.label = null;
|
|
4103
|
+
}
|
|
4104
|
+
if (this.renderRemoval) {
|
|
4105
|
+
this.renderRemoval();
|
|
4106
|
+
this.renderRemoval = null;
|
|
4107
|
+
}
|
|
4108
|
+
if (this.terrChangedRemoval) {
|
|
4109
|
+
this.terrChangedRemoval();
|
|
4110
|
+
this.terrChangedRemoval = null;
|
|
4111
|
+
}
|
|
4112
|
+
};
|
|
4026
4113
|
return Label;
|
|
4027
4114
|
}());
|
|
4028
4115
|
EntityLabel.Label = Label;
|
|
@@ -16008,7 +16095,7 @@ var ViewerUtils;
|
|
|
16008
16095
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
16009
16096
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
16010
16097
|
|
|
16011
|
-
var VERSION$1 = "2.8.
|
|
16098
|
+
var VERSION$1 = "2.8.5";
|
|
16012
16099
|
|
|
16013
16100
|
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 };
|
|
16014
16101
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|