bruce-cesium 2.8.2 → 2.8.4
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 +581 -62
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +575 -60
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +2 -1
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +55 -28
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/menu-item-manager.js +22 -4
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +407 -0
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -0
- package/dist/lib/rendering/view-render-engine.js +25 -14
- package/dist/lib/rendering/view-render-engine.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +107 -10
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/viewer/viewer-utils.js +5 -2
- package/dist/lib/viewer/viewer-utils.js.map +1 -1
- package/dist/lib/widgets/widget-info-view.js +1 -1
- package/dist/types/bruce-cesium.d.ts +2 -1
- package/dist/types/rendering/menu-item-manager.d.ts +3 -0
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +67 -0
- package/dist/types/rendering/visuals-register.d.ts +41 -2
- package/dist/types/viewer/viewer-utils.d.ts +1 -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, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1,
|
|
3
|
+
import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, Entity, Primitive, Cesium3DTileFeature, JulianDate, HeightReference, DistanceDisplayCondition, NearFarScalar, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, EllipsoidTerrainProvider, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Model, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Matrix4, Matrix3, IonResource, Ion, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, GeometryInstance, BoundingSphere } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -1741,7 +1741,7 @@ function getName(api, entity) {
|
|
|
1741
1741
|
type: type,
|
|
1742
1742
|
defaultToId: false
|
|
1743
1743
|
});
|
|
1744
|
-
return [2 /*return*/, name_1 ? name_1 : "Unnamed
|
|
1744
|
+
return [2 /*return*/, name_1 ? name_1 : "Unnamed Entity"];
|
|
1745
1745
|
}
|
|
1746
1746
|
return [3 /*break*/, 4];
|
|
1747
1747
|
case 3:
|
|
@@ -1844,6 +1844,7 @@ function getRenderGroupId(zoomItem, terrain) {
|
|
|
1844
1844
|
return zoomItem.MinZoom + "-" + zoomItem.MaxZoom + "-" + shouldApplyFlatFix(terrain);
|
|
1845
1845
|
}
|
|
1846
1846
|
var _fileValidationCache = {};
|
|
1847
|
+
var _fileHeightCache = {};
|
|
1847
1848
|
/**
|
|
1848
1849
|
* @param min
|
|
1849
1850
|
* @param max
|
|
@@ -2198,7 +2199,7 @@ var EntityRenderEngine;
|
|
|
2198
2199
|
(function (Point) {
|
|
2199
2200
|
function Render(params) {
|
|
2200
2201
|
return __awaiter(this, void 0, void 0, function () {
|
|
2201
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon,
|
|
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;
|
|
2202
2203
|
return __generator(this, function (_a) {
|
|
2203
2204
|
switch (_a.label) {
|
|
2204
2205
|
case 0:
|
|
@@ -2213,7 +2214,7 @@ var EntityRenderEngine;
|
|
|
2213
2214
|
}
|
|
2214
2215
|
cEntity = null;
|
|
2215
2216
|
siblings = [];
|
|
2216
|
-
if (!(type == Style.EPointType.Icon)) return [3 /*break*/,
|
|
2217
|
+
if (!(type == Style.EPointType.Icon)) return [3 /*break*/, 12];
|
|
2217
2218
|
iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
2218
2219
|
iconUrlRows.forEach(function (row) {
|
|
2219
2220
|
if (row.type == Calculator.EValueType.Color) {
|
|
@@ -2221,41 +2222,66 @@ var EntityRenderEngine;
|
|
|
2221
2222
|
}
|
|
2222
2223
|
});
|
|
2223
2224
|
icon = Calculator.GetString(iconUrlRows, entity, params.tags);
|
|
2224
|
-
|
|
2225
|
+
iconUrl_1 = null;
|
|
2225
2226
|
if (typeof icon == "string") {
|
|
2226
|
-
|
|
2227
|
+
iconUrl_1 = icon;
|
|
2227
2228
|
}
|
|
2228
|
-
if (!
|
|
2229
|
-
|
|
2229
|
+
if (!iconUrl_1 && style.iconId) {
|
|
2230
|
+
iconUrl_1 = ClientFile.GetUrl({
|
|
2230
2231
|
api: params.api,
|
|
2231
2232
|
fileId: style.iconId
|
|
2232
2233
|
});
|
|
2233
2234
|
}
|
|
2234
|
-
if (!
|
|
2235
|
+
if (!iconUrl_1) return [3 /*break*/, 11];
|
|
2235
2236
|
_a.label = 1;
|
|
2236
2237
|
case 1:
|
|
2237
|
-
_a.trys.push([1,
|
|
2238
|
-
if (!(_fileValidationCache[
|
|
2239
|
-
return [4 /*yield*/, fetch(
|
|
2238
|
+
_a.trys.push([1, 10, , 11]);
|
|
2239
|
+
if (!(_fileValidationCache[iconUrl_1] == null)) return [3 /*break*/, 8];
|
|
2240
|
+
return [4 /*yield*/, fetch(iconUrl_1)];
|
|
2240
2241
|
case 2:
|
|
2241
2242
|
res = _a.sent();
|
|
2242
|
-
if (res.status != 200)
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
_fileValidationCache[iconUrl] = Boolean(iconUrl);
|
|
2246
|
-
return [3 /*break*/, 4];
|
|
2243
|
+
if (!(res.status != 200)) return [3 /*break*/, 3];
|
|
2244
|
+
iconUrl_1 = null;
|
|
2245
|
+
return [3 /*break*/, 7];
|
|
2247
2246
|
case 3:
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2247
|
+
_a.trys.push([3, 6, , 7]);
|
|
2248
|
+
return [4 /*yield*/, res.blob()];
|
|
2249
|
+
case 4:
|
|
2250
|
+
blob_1 = _a.sent();
|
|
2251
|
+
return [4 /*yield*/, new Promise(function (res) {
|
|
2252
|
+
var img = new Image();
|
|
2253
|
+
img.onload = function () {
|
|
2254
|
+
_fileHeightCache[iconUrl_1] = img.height;
|
|
2255
|
+
res(null);
|
|
2256
|
+
};
|
|
2257
|
+
img.onerror = function () {
|
|
2258
|
+
_fileHeightCache[iconUrl_1] = undefined;
|
|
2259
|
+
res(null);
|
|
2260
|
+
};
|
|
2261
|
+
img.src = URL.createObjectURL(blob_1);
|
|
2262
|
+
})];
|
|
2253
2263
|
case 5:
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
return [3 /*break*/, 6];
|
|
2264
|
+
_a.sent();
|
|
2265
|
+
return [3 /*break*/, 7];
|
|
2257
2266
|
case 6:
|
|
2258
|
-
|
|
2267
|
+
e_4 = _a.sent();
|
|
2268
|
+
console.error(e_4);
|
|
2269
|
+
return [3 /*break*/, 7];
|
|
2270
|
+
case 7:
|
|
2271
|
+
_fileValidationCache[iconUrl_1] = Boolean(iconUrl_1);
|
|
2272
|
+
return [3 /*break*/, 9];
|
|
2273
|
+
case 8:
|
|
2274
|
+
if (!_fileValidationCache[iconUrl_1]) {
|
|
2275
|
+
iconUrl_1 = null;
|
|
2276
|
+
}
|
|
2277
|
+
_a.label = 9;
|
|
2278
|
+
case 9: return [3 /*break*/, 11];
|
|
2279
|
+
case 10:
|
|
2280
|
+
e_5 = _a.sent();
|
|
2281
|
+
iconUrl_1 = null;
|
|
2282
|
+
return [3 /*break*/, 11];
|
|
2283
|
+
case 11:
|
|
2284
|
+
if (iconUrl_1) {
|
|
2259
2285
|
iconScale = EnsureNumber(Calculator.GetNumber(style.iconScale, entity, params.tags));
|
|
2260
2286
|
if (!iconScale && iconScale != 0) {
|
|
2261
2287
|
iconScale = 1;
|
|
@@ -2267,11 +2293,12 @@ var EntityRenderEngine;
|
|
|
2267
2293
|
billboard: {
|
|
2268
2294
|
horizontalOrigin: HorizontalOrigin.CENTER,
|
|
2269
2295
|
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
2270
|
-
image:
|
|
2296
|
+
image: iconUrl_1,
|
|
2271
2297
|
heightReference: getHeightRef(style),
|
|
2272
2298
|
scale: iconScale,
|
|
2273
2299
|
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
2274
2300
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
2301
|
+
height: _fileHeightCache[iconUrl_1]
|
|
2275
2302
|
// Would be great once we have a setting for this.
|
|
2276
2303
|
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
2277
2304
|
},
|
|
@@ -2285,8 +2312,8 @@ var EntityRenderEngine;
|
|
|
2285
2312
|
});
|
|
2286
2313
|
}
|
|
2287
2314
|
}
|
|
2288
|
-
_a.label =
|
|
2289
|
-
case
|
|
2315
|
+
_a.label = 12;
|
|
2316
|
+
case 12:
|
|
2290
2317
|
if (type == Style.EPointType.Cylinder) {
|
|
2291
2318
|
radius = EnsureNumber(Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
|
|
2292
2319
|
if (radius <= 0) {
|
|
@@ -3689,6 +3716,370 @@ var RelationRenderEngine;
|
|
|
3689
3716
|
})(Parabola = RelationRenderEngine.Parabola || (RelationRenderEngine.Parabola = {}));
|
|
3690
3717
|
})(RelationRenderEngine || (RelationRenderEngine = {}));
|
|
3691
3718
|
|
|
3719
|
+
/**
|
|
3720
|
+
* Returns cesium property's value.
|
|
3721
|
+
* This will check if it's one that changes over time, or just a fixed value.
|
|
3722
|
+
* Eg: const pos3d = getValue<Cesium.Cartesian3>(cViewer, cEntity.point.position);
|
|
3723
|
+
* @param viewer
|
|
3724
|
+
* @param obj
|
|
3725
|
+
*/
|
|
3726
|
+
function getValue$1(viewer, obj) {
|
|
3727
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
3728
|
+
return obj.getValue(viewer.scene.lastRenderTime);
|
|
3729
|
+
}
|
|
3730
|
+
return obj;
|
|
3731
|
+
}
|
|
3732
|
+
/**
|
|
3733
|
+
* Util for generating labels within cesium space on entities.
|
|
3734
|
+
*/
|
|
3735
|
+
var EntityLabel;
|
|
3736
|
+
(function (EntityLabel) {
|
|
3737
|
+
// Key where the label instance is stored within the cesium entity.
|
|
3738
|
+
// Eg: rego[ATTACH_KEY] = new EntityLabel(...);
|
|
3739
|
+
EntityLabel.ATTACH_KEY = "nextspace-navigator-entity-label";
|
|
3740
|
+
var Label = /** @class */ (function () {
|
|
3741
|
+
function Label(params) {
|
|
3742
|
+
var _this = this;
|
|
3743
|
+
// The label element itself.
|
|
3744
|
+
this.label = null;
|
|
3745
|
+
// Callback to kill render listener.
|
|
3746
|
+
this.renderRemoval = null;
|
|
3747
|
+
// Indicates the label was disposed and any actions will be ignored.
|
|
3748
|
+
this.disposed = false;
|
|
3749
|
+
this.creating = false;
|
|
3750
|
+
// Calculated pos3d for the label.
|
|
3751
|
+
// Override to make it draw at a different position.
|
|
3752
|
+
this.pos3d = null;
|
|
3753
|
+
this.rego = params.rego;
|
|
3754
|
+
this.viewer = params.viewer;
|
|
3755
|
+
this.api = params.api;
|
|
3756
|
+
this.visualRegister = params.visualRegister;
|
|
3757
|
+
this.creating = true;
|
|
3758
|
+
this.createCLabel(params.pos3d).then(function () {
|
|
3759
|
+
_this.creating = false;
|
|
3760
|
+
}).catch(function (e) {
|
|
3761
|
+
console.error("Failed to create label", e);
|
|
3762
|
+
_this.creating = false;
|
|
3763
|
+
});
|
|
3764
|
+
}
|
|
3765
|
+
Object.defineProperty(Label.prototype, "Rego", {
|
|
3766
|
+
get: function () {
|
|
3767
|
+
return this.rego;
|
|
3768
|
+
},
|
|
3769
|
+
enumerable: false,
|
|
3770
|
+
configurable: true
|
|
3771
|
+
});
|
|
3772
|
+
Object.defineProperty(Label.prototype, "Disposed", {
|
|
3773
|
+
get: function () {
|
|
3774
|
+
return this.disposed;
|
|
3775
|
+
},
|
|
3776
|
+
enumerable: false,
|
|
3777
|
+
configurable: true
|
|
3778
|
+
});
|
|
3779
|
+
Object.defineProperty(Label.prototype, "Creating", {
|
|
3780
|
+
get: function () {
|
|
3781
|
+
return this.creating;
|
|
3782
|
+
},
|
|
3783
|
+
enumerable: false,
|
|
3784
|
+
configurable: true
|
|
3785
|
+
});
|
|
3786
|
+
/**
|
|
3787
|
+
* Disposes label and marks instance as disposed.
|
|
3788
|
+
* Recalling will be ignored.
|
|
3789
|
+
*/
|
|
3790
|
+
Label.prototype.Dispose = function () {
|
|
3791
|
+
if (this.disposed) {
|
|
3792
|
+
return;
|
|
3793
|
+
}
|
|
3794
|
+
this.disposed = true;
|
|
3795
|
+
if (this.label &&
|
|
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
|
+
}
|
|
3804
|
+
};
|
|
3805
|
+
/**
|
|
3806
|
+
* Creates cesium entity for the label if one does not exist.
|
|
3807
|
+
* @param pos23 optional position to create label at.
|
|
3808
|
+
*/
|
|
3809
|
+
Label.prototype.createCLabel = function (pos3d) {
|
|
3810
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3811
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3812
|
+
var heightRef, heightOffset, pixelOffset, visual, isClamped, height, scale, featureAny, propertyNames, latProp, lonProp, lat, lon, latIsRad, lonIsRad, latIsDeg, lonIsDeg, carto, text, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel;
|
|
3813
|
+
var _this = this;
|
|
3814
|
+
return __generator(this, function (_g) {
|
|
3815
|
+
switch (_g.label) {
|
|
3816
|
+
case 0:
|
|
3817
|
+
if (this.label || this.disposed) {
|
|
3818
|
+
return [2 /*return*/];
|
|
3819
|
+
}
|
|
3820
|
+
heightRef = null;
|
|
3821
|
+
heightOffset = 10;
|
|
3822
|
+
pixelOffset = new Cartesian2(0, 0);
|
|
3823
|
+
if (!isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 3];
|
|
3824
|
+
visual = (_a = this.rego) === null || _a === void 0 ? void 0 : _a.visual;
|
|
3825
|
+
if (visual && visual instanceof Entity) {
|
|
3826
|
+
if (visual.polygon) {
|
|
3827
|
+
heightRef = getValue$1(this.viewer, visual.polygon.heightReference);
|
|
3828
|
+
}
|
|
3829
|
+
else if (visual.polyline) {
|
|
3830
|
+
isClamped = getValue$1(this.viewer, visual.polyline.clampToGround);
|
|
3831
|
+
heightRef = isClamped == false ? HeightReference.NONE : HeightReference.CLAMP_TO_GROUND;
|
|
3832
|
+
}
|
|
3833
|
+
else if (visual.model) {
|
|
3834
|
+
heightRef = getValue$1(this.viewer, visual.model.heightReference);
|
|
3835
|
+
}
|
|
3836
|
+
else if (visual.point) {
|
|
3837
|
+
heightRef = getValue$1(this.viewer, visual.point.heightReference);
|
|
3838
|
+
}
|
|
3839
|
+
else if (visual.billboard) {
|
|
3840
|
+
heightRef = getValue$1(this.viewer, visual.billboard.heightReference);
|
|
3841
|
+
height = getValue$1(this.viewer, visual.billboard.height);
|
|
3842
|
+
if (height) {
|
|
3843
|
+
scale = EnsureNumber(getValue$1(this.viewer, visual.billboard.scale), 1);
|
|
3844
|
+
pixelOffset.y = -(height * scale);
|
|
3845
|
+
}
|
|
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
|
+
}
|
|
3853
|
+
else if (visual.ellipse) {
|
|
3854
|
+
heightRef = getValue$1(this.viewer, visual.ellipse.heightReference);
|
|
3855
|
+
}
|
|
3856
|
+
pos3d = getValue$1(this.viewer, visual.position);
|
|
3857
|
+
}
|
|
3858
|
+
else if (visual instanceof Cesium3DTileFeature) {
|
|
3859
|
+
featureAny = visual;
|
|
3860
|
+
propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_b = featureAny.getPropertyIds) === null || _b === void 0 ? void 0 : _b.call(featureAny);
|
|
3861
|
+
if (propertyNames === null || propertyNames === void 0 ? void 0 : propertyNames.length) {
|
|
3862
|
+
latProp = propertyNames.find(function (x) { return x.toLowerCase().includes("lat"); });
|
|
3863
|
+
lonProp = propertyNames.find(function (x) { return x.toLowerCase().includes("lon"); });
|
|
3864
|
+
lat = latProp ? featureAny.getProperty(latProp) : null;
|
|
3865
|
+
lon = lonProp ? featureAny.getProperty(lonProp) : null;
|
|
3866
|
+
if (lat && lon) {
|
|
3867
|
+
latIsRad = typeof lat == "number" && lat > -Math.PI && lat < Math.PI;
|
|
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));
|
|
3873
|
+
}
|
|
3874
|
+
else if (latIsDeg && lonIsDeg) {
|
|
3875
|
+
pos3d = Cartographic.toCartesian(Cartographic.fromDegrees(lon, lat, 0));
|
|
3876
|
+
}
|
|
3877
|
+
heightRef = HeightReference.CLAMP_TO_GROUND;
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
if (!isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 2];
|
|
3882
|
+
return [4 /*yield*/, EntityUtils.GetPosAsync({
|
|
3883
|
+
viewer: this.viewer,
|
|
3884
|
+
api: this.api,
|
|
3885
|
+
entityId: (_c = this.rego) === null || _c === void 0 ? void 0 : _c.entityId,
|
|
3886
|
+
returnHeightRef: HeightReference.NONE,
|
|
3887
|
+
tilesetId: (_d = this.rego) === null || _d === void 0 ? void 0 : _d.tilesetId,
|
|
3888
|
+
visualRegister: this.visualRegister
|
|
3889
|
+
})];
|
|
3890
|
+
case 1:
|
|
3891
|
+
pos3d = _g.sent();
|
|
3892
|
+
heightRef = HeightReference.NONE;
|
|
3893
|
+
_g.label = 2;
|
|
3894
|
+
case 2: return [3 /*break*/, 4];
|
|
3895
|
+
case 3:
|
|
3896
|
+
heightRef = HeightReference.NONE;
|
|
3897
|
+
// Flat padding.
|
|
3898
|
+
heightOffset = 0;
|
|
3899
|
+
pixelOffset.y = -15;
|
|
3900
|
+
_g.label = 4;
|
|
3901
|
+
case 4:
|
|
3902
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3903
|
+
return [2 /*return*/];
|
|
3904
|
+
}
|
|
3905
|
+
pos3d = DrawingUtils.EnsurePosHeight({
|
|
3906
|
+
desiredHeightRef: HeightReference.NONE,
|
|
3907
|
+
heightRef: heightRef,
|
|
3908
|
+
pos3d: pos3d,
|
|
3909
|
+
viewer: this.viewer
|
|
3910
|
+
});
|
|
3911
|
+
if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
3912
|
+
return [2 /*return*/];
|
|
3913
|
+
}
|
|
3914
|
+
if (heightOffset) {
|
|
3915
|
+
carto = Cartographic.fromCartesian(pos3d);
|
|
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";
|
|
3923
|
+
ele = document.createElement("div");
|
|
3924
|
+
ele.innerHTML = text;
|
|
3925
|
+
ele.setAttribute("style", "\n position: absolute;\n z-index: 1;\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
|
+
this.label = ele;
|
|
3927
|
+
this.viewer.container.appendChild(ele);
|
|
3928
|
+
_lastDistance = null;
|
|
3929
|
+
_lastCameraPos = null;
|
|
3930
|
+
getDistance = function () {
|
|
3931
|
+
var _a;
|
|
3932
|
+
if (_this.disposed) {
|
|
3933
|
+
return null;
|
|
3934
|
+
}
|
|
3935
|
+
var cameraPos = (_a = _this.viewer.camera) === null || _a === void 0 ? void 0 : _a.position;
|
|
3936
|
+
if (isNaN(cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.x)) {
|
|
3937
|
+
return null;
|
|
3938
|
+
}
|
|
3939
|
+
// If camera hasn't moved much then we can use the last distance.
|
|
3940
|
+
var TOLERANCE = 0.1;
|
|
3941
|
+
if (_lastCameraPos) {
|
|
3942
|
+
var totalMovement = Math.abs(_lastCameraPos.x - cameraPos.x) +
|
|
3943
|
+
Math.abs(_lastCameraPos.y - cameraPos.y) +
|
|
3944
|
+
Math.abs(_lastCameraPos.z - cameraPos.z);
|
|
3945
|
+
if (totalMovement < TOLERANCE) {
|
|
3946
|
+
return _lastDistance;
|
|
3947
|
+
}
|
|
3948
|
+
}
|
|
3949
|
+
// Check if there is a raycast collision between camera and pos3d.
|
|
3950
|
+
// We'll let the labels draw through a ground collision.
|
|
3951
|
+
// Commented out while it is WIP.
|
|
3952
|
+
// const direction = Cesium.Cartesian3.subtract(pos3d, cameraPos, new Cesium.Cartesian3());
|
|
3953
|
+
// const ray = new Cesium.Ray(pos3d.clone(), direction);
|
|
3954
|
+
// const objects = (this.viewer.scene as any).drillPickFromRay(ray, 1, [visuals]);
|
|
3955
|
+
// if (objects && objects.length > 0) {
|
|
3956
|
+
// for (let i = 0; i < objects.length; ++i) {
|
|
3957
|
+
// const obj = objects[i];
|
|
3958
|
+
// if (!visuals.find(x => x == obj?.id)) {
|
|
3959
|
+
// let isGround = true;
|
|
3960
|
+
// if (obj.object) {
|
|
3961
|
+
// const url = obj.object?.primitive?._basePath;
|
|
3962
|
+
// if (url && typeof url == "string") {
|
|
3963
|
+
// isGround = url.includes("tile.googleapis.com");
|
|
3964
|
+
// }
|
|
3965
|
+
// else {
|
|
3966
|
+
// isGround = false;
|
|
3967
|
+
// }
|
|
3968
|
+
// }
|
|
3969
|
+
// if (!isGround) {
|
|
3970
|
+
// return null;
|
|
3971
|
+
// }
|
|
3972
|
+
// }
|
|
3973
|
+
// }
|
|
3974
|
+
// }
|
|
3975
|
+
var distance = Cartesian3.distance(cameraPos, _this.pos3d);
|
|
3976
|
+
_lastDistance = distance;
|
|
3977
|
+
_lastCameraPos = cameraPos.clone();
|
|
3978
|
+
return distance;
|
|
3979
|
+
};
|
|
3980
|
+
MAX_DISTANCE = 5000;
|
|
3981
|
+
updateLabel = function () {
|
|
3982
|
+
var _a;
|
|
3983
|
+
if (_this.disposed || isNaN((_a = _this.pos3d) === null || _a === void 0 ? void 0 : _a.x)) {
|
|
3984
|
+
return;
|
|
3985
|
+
}
|
|
3986
|
+
var distance = getDistance();
|
|
3987
|
+
if (isNaN(distance) || distance >= MAX_DISTANCE) {
|
|
3988
|
+
ele.style.display = "none";
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3991
|
+
var pos2d = SceneTransforms.wgs84ToWindowCoordinates(_this.viewer.scene, _this.pos3d);
|
|
3992
|
+
if (isNaN(pos2d === null || pos2d === void 0 ? void 0 : pos2d.x)) {
|
|
3993
|
+
ele.style.display = "none";
|
|
3994
|
+
return;
|
|
3995
|
+
}
|
|
3996
|
+
// If out of the screen then we can hide it.
|
|
3997
|
+
if (pos2d.x < 0 || pos2d.x > _this.viewer.canvas.clientWidth ||
|
|
3998
|
+
pos2d.y < 0 || pos2d.y > _this.viewer.canvas.clientHeight) {
|
|
3999
|
+
ele.style.display = "none";
|
|
4000
|
+
return;
|
|
4001
|
+
}
|
|
4002
|
+
ele.style.display = "block";
|
|
4003
|
+
// Check scale to apply based on distance between camera and pos3d.
|
|
4004
|
+
// We'll make the label smaller and less transparent when further away.
|
|
4005
|
+
var scale = 1 - (distance / MAX_DISTANCE);
|
|
4006
|
+
if (scale && scale > 0.15) {
|
|
4007
|
+
ele.style.transform = "scale(".concat(scale, ")");
|
|
4008
|
+
ele.style.opacity = "".concat(scale);
|
|
4009
|
+
var left = pos2d.x - (ele.clientWidth / 2) + pixelOffset.x;
|
|
4010
|
+
ele.style.left = "".concat(left, "px");
|
|
4011
|
+
var top_1 = pos2d.y - ele.clientHeight + (pixelOffset.y * scale);
|
|
4012
|
+
ele.style.top = "".concat(top_1, "px");
|
|
4013
|
+
}
|
|
4014
|
+
else {
|
|
4015
|
+
ele.style.transform = "";
|
|
4016
|
+
ele.style.opacity = "0";
|
|
4017
|
+
}
|
|
4018
|
+
};
|
|
4019
|
+
this.renderRemoval = this.viewer.scene.postUpdate.addEventListener(updateLabel);
|
|
4020
|
+
updateLabel();
|
|
4021
|
+
return [2 /*return*/];
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
});
|
|
4025
|
+
};
|
|
4026
|
+
return Label;
|
|
4027
|
+
}());
|
|
4028
|
+
EntityLabel.Label = Label;
|
|
4029
|
+
/**
|
|
4030
|
+
* Creates an entity label for a given rego.
|
|
4031
|
+
* If one exists then the action is ignored.
|
|
4032
|
+
*/
|
|
4033
|
+
function Attach(params) {
|
|
4034
|
+
var rego = params.rego, viewer = params.viewer, pos3d = params.pos3d, visualRegister = params.visualRegister, api = params.api;
|
|
4035
|
+
if (!rego || !viewer || rego[EntityLabel.ATTACH_KEY]) {
|
|
4036
|
+
return;
|
|
4037
|
+
}
|
|
4038
|
+
rego[EntityLabel.ATTACH_KEY] = new Label({
|
|
4039
|
+
rego: rego,
|
|
4040
|
+
viewer: viewer,
|
|
4041
|
+
pos3d: pos3d,
|
|
4042
|
+
visualRegister: visualRegister,
|
|
4043
|
+
api: api
|
|
4044
|
+
});
|
|
4045
|
+
return rego[EntityLabel.ATTACH_KEY];
|
|
4046
|
+
}
|
|
4047
|
+
EntityLabel.Attach = Attach;
|
|
4048
|
+
/**
|
|
4049
|
+
* Removes an entity label from a given rego.
|
|
4050
|
+
* If one doesn't exist then the action is ignored.
|
|
4051
|
+
*/
|
|
4052
|
+
function Detatch(params) {
|
|
4053
|
+
var _a, _b, _c;
|
|
4054
|
+
var rego = params.rego, label = params.label;
|
|
4055
|
+
if (!rego && label) {
|
|
4056
|
+
rego = label.Rego;
|
|
4057
|
+
}
|
|
4058
|
+
if (!rego || !rego[EntityLabel.ATTACH_KEY]) {
|
|
4059
|
+
if (label) {
|
|
4060
|
+
(_a = label.Dispose) === null || _a === void 0 ? void 0 : _a.call(label);
|
|
4061
|
+
}
|
|
4062
|
+
return;
|
|
4063
|
+
}
|
|
4064
|
+
(_c = (_b = rego[EntityLabel.ATTACH_KEY]).Dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4065
|
+
rego[EntityLabel.ATTACH_KEY] = null;
|
|
4066
|
+
}
|
|
4067
|
+
EntityLabel.Detatch = Detatch;
|
|
4068
|
+
/**
|
|
4069
|
+
* Returns label instance from given rego if one exists.
|
|
4070
|
+
* @param params
|
|
4071
|
+
* @returns
|
|
4072
|
+
*/
|
|
4073
|
+
function GetLabel(params) {
|
|
4074
|
+
var rego = params.rego;
|
|
4075
|
+
if (!rego) {
|
|
4076
|
+
return null;
|
|
4077
|
+
}
|
|
4078
|
+
return rego[EntityLabel.ATTACH_KEY];
|
|
4079
|
+
}
|
|
4080
|
+
EntityLabel.GetLabel = GetLabel;
|
|
4081
|
+
})(EntityLabel || (EntityLabel = {}));
|
|
4082
|
+
|
|
3692
4083
|
/**
|
|
3693
4084
|
* Returns if a given visual is alive and in the scene.
|
|
3694
4085
|
* @param viewer
|
|
@@ -3817,7 +4208,26 @@ function updateEntity(viewer, entityId, register) {
|
|
|
3817
4208
|
for (var i = 0; i < regos.length; i++) {
|
|
3818
4209
|
var rego = regos[i];
|
|
3819
4210
|
rego.best = rego === highestPriority;
|
|
3820
|
-
|
|
4211
|
+
var visible = rego.suppressShow ? false : getShowState(rego);
|
|
4212
|
+
updateEntityShow(viewer, rego.visual, visible);
|
|
4213
|
+
if (rego.best) {
|
|
4214
|
+
var isLabelled = register.GetIsLabelled({
|
|
4215
|
+
entityId: entityId
|
|
4216
|
+
});
|
|
4217
|
+
if (isLabelled && visible) {
|
|
4218
|
+
EntityLabel.Attach({
|
|
4219
|
+
rego: rego,
|
|
4220
|
+
viewer: viewer,
|
|
4221
|
+
api: register.ApiGetters.GetBruceApi(),
|
|
4222
|
+
visualRegister: register
|
|
4223
|
+
});
|
|
4224
|
+
}
|
|
4225
|
+
else {
|
|
4226
|
+
EntityLabel.Detatch({
|
|
4227
|
+
rego: rego
|
|
4228
|
+
});
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
3821
4231
|
}
|
|
3822
4232
|
}
|
|
3823
4233
|
function markEntity(register, rego, visual, ignoreParent) {
|
|
@@ -3990,7 +4400,7 @@ var VisualsRegister;
|
|
|
3990
4400
|
EVisualUpdateType["DeselectAll"] = "DESELECT_ALL";
|
|
3991
4401
|
})(EVisualUpdateType = VisualsRegister.EVisualUpdateType || (VisualsRegister.EVisualUpdateType = {}));
|
|
3992
4402
|
var Register = /** @class */ (function () {
|
|
3993
|
-
function Register(
|
|
4403
|
+
function Register(params) {
|
|
3994
4404
|
this.id = ObjectUtils.UId();
|
|
3995
4405
|
this.rego = {};
|
|
3996
4406
|
this.onUpdate = null;
|
|
@@ -3999,7 +4409,12 @@ var VisualsRegister;
|
|
|
3999
4409
|
this.hiddenIds = [];
|
|
4000
4410
|
// Entity id -> opacity for visual.
|
|
4001
4411
|
this.opacity = {};
|
|
4002
|
-
|
|
4412
|
+
// Array of entity ids for entities who have labels drawn for them.
|
|
4413
|
+
// It will be drawn on the "best" visual, and only while the entity is visible.
|
|
4414
|
+
// Warning: this sucks for CAD entities.
|
|
4415
|
+
this.labelledEntityIds = [];
|
|
4416
|
+
this.viewer = params.viewer;
|
|
4417
|
+
this.apiGetters = params.apiGetters;
|
|
4003
4418
|
}
|
|
4004
4419
|
Object.defineProperty(Register.prototype, "Id", {
|
|
4005
4420
|
get: function () {
|
|
@@ -4015,6 +4430,13 @@ var VisualsRegister;
|
|
|
4015
4430
|
enumerable: false,
|
|
4016
4431
|
configurable: true
|
|
4017
4432
|
});
|
|
4433
|
+
Object.defineProperty(Register.prototype, "ApiGetters", {
|
|
4434
|
+
get: function () {
|
|
4435
|
+
return this.apiGetters;
|
|
4436
|
+
},
|
|
4437
|
+
enumerable: false,
|
|
4438
|
+
configurable: true
|
|
4439
|
+
});
|
|
4018
4440
|
Object.defineProperty(Register.prototype, "OnUpdate", {
|
|
4019
4441
|
get: function () {
|
|
4020
4442
|
if (!this.onUpdate) {
|
|
@@ -4037,6 +4459,71 @@ var VisualsRegister;
|
|
|
4037
4459
|
}
|
|
4038
4460
|
this.viewer.scene.requestRender();
|
|
4039
4461
|
};
|
|
4462
|
+
/**
|
|
4463
|
+
* Marks given entityIds as either labelled or not labelled.
|
|
4464
|
+
* When an entity is labelled a label will be drawn on the "best" visual for it.
|
|
4465
|
+
* @param params
|
|
4466
|
+
*/
|
|
4467
|
+
Register.prototype.SetLabelled = function (params) {
|
|
4468
|
+
var labelled = params.labelled, entityIds = params.entityIds, requestRender = params.requestRender;
|
|
4469
|
+
var _loop_3 = function (i) {
|
|
4470
|
+
var id = entityIds[i];
|
|
4471
|
+
var index = this_1.labelledEntityIds.findIndex(function (x) { return x == id; });
|
|
4472
|
+
if (labelled) {
|
|
4473
|
+
if (index <= -1) {
|
|
4474
|
+
this_1.labelledEntityIds.push(id);
|
|
4475
|
+
updateEntity(this_1.viewer, id, this_1);
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
else {
|
|
4479
|
+
if (index > -1) {
|
|
4480
|
+
this_1.labelledEntityIds.splice(index, 1);
|
|
4481
|
+
updateEntity(this_1.viewer, id, this_1);
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
};
|
|
4485
|
+
var this_1 = this;
|
|
4486
|
+
for (var i = 0; i < entityIds.length; i++) {
|
|
4487
|
+
_loop_3(i);
|
|
4488
|
+
}
|
|
4489
|
+
if (requestRender != false) {
|
|
4490
|
+
this.viewer.scene.requestRender();
|
|
4491
|
+
}
|
|
4492
|
+
};
|
|
4493
|
+
/**
|
|
4494
|
+
* Returns if given entity id is labelled.
|
|
4495
|
+
* @param params
|
|
4496
|
+
*/
|
|
4497
|
+
Register.prototype.GetIsLabelled = function (params) {
|
|
4498
|
+
var id = params.entityId;
|
|
4499
|
+
return this.labelledEntityIds.indexOf(id) !== -1;
|
|
4500
|
+
};
|
|
4501
|
+
/**
|
|
4502
|
+
* Clears all labelled entities.
|
|
4503
|
+
* @param params
|
|
4504
|
+
*/
|
|
4505
|
+
Register.prototype.ClearLabelled = function (params) {
|
|
4506
|
+
var ids = [].concat(this.labelledEntityIds);
|
|
4507
|
+
this.labelledEntityIds = [];
|
|
4508
|
+
for (var i = 0; i < ids.length; i++) {
|
|
4509
|
+
var id = ids[i];
|
|
4510
|
+
updateEntity(this.viewer, id, this);
|
|
4511
|
+
}
|
|
4512
|
+
if ((params === null || params === void 0 ? void 0 : params.requestRender) != false) {
|
|
4513
|
+
this.viewer.scene.requestRender();
|
|
4514
|
+
}
|
|
4515
|
+
};
|
|
4516
|
+
/**
|
|
4517
|
+
* Returns all labelled entity ids.
|
|
4518
|
+
*/
|
|
4519
|
+
Register.prototype.GetLabelled = function () {
|
|
4520
|
+
return this.labelledEntityIds;
|
|
4521
|
+
};
|
|
4522
|
+
/**
|
|
4523
|
+
* Updates the selection color.
|
|
4524
|
+
* This will not update the selection color for already selected entities.
|
|
4525
|
+
* @param color
|
|
4526
|
+
*/
|
|
4040
4527
|
Register.prototype.SetSelectionColor = function (color) {
|
|
4041
4528
|
this.selectionColor = color;
|
|
4042
4529
|
};
|
|
@@ -4362,26 +4849,26 @@ var VisualsRegister;
|
|
|
4362
4849
|
return;
|
|
4363
4850
|
}
|
|
4364
4851
|
var menuItems = menuItemId ? [menuItemId] : entityRegos.map(function (x) { return x.menuItemId; });
|
|
4365
|
-
var
|
|
4852
|
+
var _loop_4 = function (i) {
|
|
4366
4853
|
var menuItemId_2 = menuItems[i];
|
|
4367
4854
|
var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId_2; });
|
|
4368
4855
|
if (!rego) {
|
|
4369
4856
|
return { value: void 0 };
|
|
4370
4857
|
}
|
|
4371
|
-
removeEntity(
|
|
4372
|
-
(_b =
|
|
4858
|
+
removeEntity(this_2.viewer, rego.visual);
|
|
4859
|
+
(_b = this_2.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({
|
|
4373
4860
|
type: EVisualUpdateType.Remove,
|
|
4374
4861
|
entityId: rego.entityId,
|
|
4375
4862
|
rego: rego
|
|
4376
4863
|
});
|
|
4377
|
-
|
|
4864
|
+
this_2.rego[entityId] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId_2; });
|
|
4378
4865
|
if (doUpdate && menuItemId_2) {
|
|
4379
|
-
updateEntity(
|
|
4866
|
+
updateEntity(this_2.viewer, entityId, this_2);
|
|
4380
4867
|
}
|
|
4381
4868
|
};
|
|
4382
|
-
var
|
|
4869
|
+
var this_2 = this;
|
|
4383
4870
|
for (var i = 0; i < menuItems.length; i++) {
|
|
4384
|
-
var state_1 =
|
|
4871
|
+
var state_1 = _loop_4(i);
|
|
4385
4872
|
if (typeof state_1 === "object")
|
|
4386
4873
|
return state_1.value;
|
|
4387
4874
|
}
|
|
@@ -9546,15 +10033,29 @@ var MenuItemManager;
|
|
|
9546
10033
|
function Manager(params) {
|
|
9547
10034
|
this.items = [];
|
|
9548
10035
|
this.onUpdate = null;
|
|
9549
|
-
var viewer = params.viewer, visualsRegister = params.visualsRegister;
|
|
10036
|
+
var viewer = params.viewer, visualsRegister = params.visualsRegister, getters = params.getters;
|
|
9550
10037
|
this.viewer = viewer;
|
|
10038
|
+
if (!getters) {
|
|
10039
|
+
getters = ENVIRONMENT.Api();
|
|
10040
|
+
}
|
|
10041
|
+
this.getters = getters;
|
|
9551
10042
|
if (!visualsRegister) {
|
|
9552
|
-
visualsRegister = new VisualsRegister.Register(
|
|
10043
|
+
visualsRegister = new VisualsRegister.Register({
|
|
10044
|
+
viewer: this.viewer,
|
|
10045
|
+
apiGetters: getters
|
|
10046
|
+
});
|
|
9553
10047
|
}
|
|
9554
10048
|
this.visualsRegister = visualsRegister;
|
|
9555
10049
|
this.sharedGetters = new SharedGetters.Cache();
|
|
9556
10050
|
this.sharedMonitor = new CesiumViewMonitor(this.viewer);
|
|
9557
10051
|
}
|
|
10052
|
+
Object.defineProperty(Manager.prototype, "Getters", {
|
|
10053
|
+
get: function () {
|
|
10054
|
+
return this.getters;
|
|
10055
|
+
},
|
|
10056
|
+
enumerable: false,
|
|
10057
|
+
configurable: true
|
|
10058
|
+
});
|
|
9558
10059
|
Object.defineProperty(Manager.prototype, "Viewer", {
|
|
9559
10060
|
get: function () {
|
|
9560
10061
|
return this.viewer;
|
|
@@ -9597,11 +10098,15 @@ var MenuItemManager;
|
|
|
9597
10098
|
if (this.viewer.isDestroyed()) {
|
|
9598
10099
|
return null;
|
|
9599
10100
|
}
|
|
10101
|
+
if (!params.getters) {
|
|
10102
|
+
params.getters = this.getters;
|
|
10103
|
+
}
|
|
10104
|
+
// Deprecated. Backwards compatibility.
|
|
9600
10105
|
if (!params.getters) {
|
|
9601
10106
|
params.getters = ENVIRONMENT.Api();
|
|
9602
10107
|
}
|
|
9603
|
-
if (params.apiGetter && !
|
|
9604
|
-
console.warn("RenderItem(): Please pass getters
|
|
10108
|
+
if (params.apiGetter && !this.getters) {
|
|
10109
|
+
console.warn("RenderItem(): Please pass getters within menu-item-manager constructor. 'getters' and 'apiGetter' within RenderItem are now deprecated.");
|
|
9605
10110
|
}
|
|
9606
10111
|
else if (!params.apiGetter) {
|
|
9607
10112
|
params.apiGetter = params.getters.GetBruceGetter();
|
|
@@ -12266,11 +12771,11 @@ function renderLegacyNavigator(iteration, params, bookmark, view) {
|
|
|
12266
12771
|
* @param view
|
|
12267
12772
|
*/
|
|
12268
12773
|
function renderNavigator(iteration, params, bookmark, view) {
|
|
12269
|
-
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;
|
|
12774
|
+
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;
|
|
12270
12775
|
return __awaiter(this, void 0, void 0, function () {
|
|
12271
|
-
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, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem, gOcclusion;
|
|
12272
|
-
return __generator(this, function (
|
|
12273
|
-
switch (
|
|
12776
|
+
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, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem, gOcclusion;
|
|
12777
|
+
return __generator(this, function (_7) {
|
|
12778
|
+
switch (_7.label) {
|
|
12274
12779
|
case 0:
|
|
12275
12780
|
viewer = params.manager.Viewer;
|
|
12276
12781
|
scene = viewer.scene;
|
|
@@ -12332,11 +12837,11 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12332
12837
|
viewer: params.manager.Viewer,
|
|
12333
12838
|
})];
|
|
12334
12839
|
case 1:
|
|
12335
|
-
|
|
12840
|
+
_7.sent();
|
|
12336
12841
|
if (!assertIteration$1(params.viewer, iteration)) {
|
|
12337
12842
|
return [2 /*return*/];
|
|
12338
12843
|
}
|
|
12339
|
-
|
|
12844
|
+
_7.label = 2;
|
|
12340
12845
|
case 2:
|
|
12341
12846
|
hillShades = (_o = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Settings) === null || _o === void 0 ? void 0 : _o.hillShades;
|
|
12342
12847
|
if (hillShades == null) {
|
|
@@ -12496,10 +13001,21 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12496
13001
|
entityIds: isolatedIds
|
|
12497
13002
|
});
|
|
12498
13003
|
}
|
|
13004
|
+
params.manager.VisualsRegister.ClearLabelled();
|
|
13005
|
+
labelledIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.labelledEntityIds;
|
|
13006
|
+
if (labelledIds == null) {
|
|
13007
|
+
labelledIds = (_2 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _2 === void 0 ? void 0 : _2.labelledEntityIds;
|
|
13008
|
+
}
|
|
13009
|
+
if (labelledIds != null) {
|
|
13010
|
+
params.manager.VisualsRegister.SetLabelled({
|
|
13011
|
+
labelled: true,
|
|
13012
|
+
entityIds: labelledIds
|
|
13013
|
+
});
|
|
13014
|
+
}
|
|
12499
13015
|
params.manager.VisualsRegister.ClearOpacity();
|
|
12500
13016
|
entityOpacityMap = bSettings === null || bSettings === void 0 ? void 0 : bSettings.entityOpacityMap;
|
|
12501
13017
|
if (entityOpacityMap == null) {
|
|
12502
|
-
entityOpacityMap = (
|
|
13018
|
+
entityOpacityMap = (_3 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _3 === void 0 ? void 0 : _3.entityOpacityMap;
|
|
12503
13019
|
}
|
|
12504
13020
|
if (entityOpacityMap != null) {
|
|
12505
13021
|
for (entityId in entityOpacityMap) {
|
|
@@ -12512,7 +13028,7 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12512
13028
|
}
|
|
12513
13029
|
}
|
|
12514
13030
|
}
|
|
12515
|
-
imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (
|
|
13031
|
+
imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_4 = defaults.settings) === null || _4 === void 0 ? void 0 : _4.imagery;
|
|
12516
13032
|
if (imagery == null) {
|
|
12517
13033
|
// TODO: Need global default.
|
|
12518
13034
|
imagery = [
|
|
@@ -12539,7 +13055,7 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12539
13055
|
renderedRelationEntityIds = [];
|
|
12540
13056
|
}
|
|
12541
13057
|
curEnabled = params.manager.GetEnabledItemIds();
|
|
12542
|
-
newItemIds = (
|
|
13058
|
+
newItemIds = (_5 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _5 !== void 0 ? _5 : [];
|
|
12543
13059
|
for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
|
|
12544
13060
|
id = curEnabled_1[_i];
|
|
12545
13061
|
if (newItemIds.indexOf(id) === -1 ||
|
|
@@ -12557,11 +13073,11 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12557
13073
|
bookmark: bookmark
|
|
12558
13074
|
})];
|
|
12559
13075
|
case 3:
|
|
12560
|
-
|
|
13076
|
+
_7.sent();
|
|
12561
13077
|
if (!assertIteration$1(params.viewer, iteration)) {
|
|
12562
13078
|
return [2 /*return*/];
|
|
12563
13079
|
}
|
|
12564
|
-
|
|
13080
|
+
_7.label = 4;
|
|
12565
13081
|
case 4:
|
|
12566
13082
|
if (!renderedRelationEntityIds.length) return [3 /*break*/, 6];
|
|
12567
13083
|
menuItem = {
|
|
@@ -12577,15 +13093,15 @@ function renderNavigator(iteration, params, bookmark, view) {
|
|
|
12577
13093
|
item: menuItem
|
|
12578
13094
|
})];
|
|
12579
13095
|
case 5:
|
|
12580
|
-
|
|
13096
|
+
_7.sent();
|
|
12581
13097
|
if (!assertIteration$1(params.viewer, iteration)) {
|
|
12582
13098
|
return [2 /*return*/];
|
|
12583
13099
|
}
|
|
12584
|
-
|
|
13100
|
+
_7.label = 6;
|
|
12585
13101
|
case 6:
|
|
12586
13102
|
gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
|
|
12587
13103
|
if (gOcclusion == null) {
|
|
12588
|
-
gOcclusion = (
|
|
13104
|
+
gOcclusion = (_6 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _6 === void 0 ? void 0 : _6.groundOcclusion;
|
|
12589
13105
|
}
|
|
12590
13106
|
if (gOcclusion == null) {
|
|
12591
13107
|
// TODO: Need global default.
|
|
@@ -15199,7 +15715,7 @@ var WidgetInfoView = /** @class */ (function (_super) {
|
|
|
15199
15715
|
defaultToId: false
|
|
15200
15716
|
});
|
|
15201
15717
|
if (!name_1) {
|
|
15202
|
-
name_1 = "Unnamed
|
|
15718
|
+
name_1 = "Unnamed Entity";
|
|
15203
15719
|
}
|
|
15204
15720
|
this._title.style.display = "block";
|
|
15205
15721
|
this._flyTo.style.display = "flex";
|
|
@@ -15425,12 +15941,15 @@ var ViewerUtils;
|
|
|
15425
15941
|
* @returns
|
|
15426
15942
|
*/
|
|
15427
15943
|
function GetManager(params) {
|
|
15428
|
-
var viewer = params.viewer, createIfMissing = params.createIfMissing;
|
|
15944
|
+
var viewer = params.viewer, createIfMissing = params.createIfMissing, getters = params.getters;
|
|
15429
15945
|
if (viewer[CESIUM_VIEWER_MANAGER_KEY]) {
|
|
15430
15946
|
return viewer[CESIUM_VIEWER_MANAGER_KEY];
|
|
15431
15947
|
}
|
|
15432
15948
|
else if (createIfMissing != false) {
|
|
15433
|
-
var manager = new MenuItemManager.Manager({
|
|
15949
|
+
var manager = new MenuItemManager.Manager({
|
|
15950
|
+
viewer: viewer,
|
|
15951
|
+
getters: getters
|
|
15952
|
+
});
|
|
15434
15953
|
viewer[CESIUM_VIEWER_MANAGER_KEY] = manager;
|
|
15435
15954
|
return manager;
|
|
15436
15955
|
}
|
|
@@ -15489,7 +16008,7 @@ var ViewerUtils;
|
|
|
15489
16008
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15490
16009
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
15491
16010
|
|
|
15492
|
-
var VERSION$1 = "2.8.
|
|
16011
|
+
var VERSION$1 = "2.8.4";
|
|
15493
16012
|
|
|
15494
|
-
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, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
|
|
16013
|
+
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 };
|
|
15495
16014
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|