bruce-cesium 4.2.9 → 4.3.0
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 +97 -6
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +95 -4
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/widgets/widget-left-panel.js +94 -3
- package/dist/lib/widgets/widget-left-panel.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/widgets/widget-left-panel.d.ts +7 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi } from 'bruce-models';
|
|
1
|
+
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, Session } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, Entity, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -23238,6 +23238,10 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
|
|
|
23238
23238
|
};
|
|
23239
23239
|
WidgetLeftPanel.prototype.Dispose = function () {
|
|
23240
23240
|
_super.prototype.Dispose.call(this);
|
|
23241
|
+
if (this.envSubRemoval) {
|
|
23242
|
+
this.envSubRemoval();
|
|
23243
|
+
this.envSubRemoval = null;
|
|
23244
|
+
}
|
|
23241
23245
|
if (this._enabledTabContent) {
|
|
23242
23246
|
this._enabledTabContent.Dispose();
|
|
23243
23247
|
this._enabledTabContent = null;
|
|
@@ -23250,7 +23254,7 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
|
|
|
23250
23254
|
}
|
|
23251
23255
|
var style = document.createElement("style");
|
|
23252
23256
|
style.id = this.STYLESHEET_ID;
|
|
23253
|
-
style.innerHTML = "\n .NextspaceLeftPanel {\n align-items: center;\n background-color: #21272a;\n cursor: default;\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n height: 100%;\n padding-top: 15px;\n position: absolute;\n width: 50px;\n z-index: 1;\n top: 0;\n left: 0;\n box-sizing: border-box;\n }\n\n .NextspaceLeftPanel * {\n box-sizing: border-box;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelBreaker {\n background-color: hsla(0,0%,50%,.231);\n flex-shrink: 0;\n height: 2px;\n margin-bottom: 15px;\n width: calc(100% - 8px);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelBottomBreaker {\n margin-top: auto;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton {\n border-radius: 3px;\n color: #fff;\n cursor: pointer;\n font-size: 18px;\n height: 32px;\n overflow: hidden;\n width: 32px;\n margin-bottom: 15px;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton:first-of-type {\n margin-bottom: 8px;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon {\n align-items: center;\n display: flex;\n justify-content: center;\n position: relative;\n transition: .3s ease;\n height: 100%;\n width: 100%;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon:hover {\n transform: scale(1.2);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon >svg {\n cursor: pointer;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled=\"true\"] >.NextspaceLeftPanelButtonIcon {\n background-color: #fff;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled=\"true\"] >.NextspaceLeftPanelButtonIcon >svg {\n filter: invert(1);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelTabContent {\n display: none;\n width: 300px;\n height: 100%;\n position: absolute;\n top: 0;\n left: 50px;\n background-color: #21272a;\n padding: 40px 30px 30px;\n flex-direction: column;\n flex-grow: 1;\n flex-shrink: 1;\n overflow: hidden;\n }\n\n .NextspaceLeftPanel .NextspaceLeftPanelTabContentCloseButton {\n color: #fff;\n cursor: pointer;\n opacity: .7;\n position: absolute;\n right: 22px;\n top: 14px;\n transition: transform .3s ease;\n z-index: 1;\n }\n\n .NextspaceLeftPanel .NextspaceLeftPanelTabContentCloseButton:hover {\n transform: scale(1.2);\n }\n ";
|
|
23257
|
+
style.innerHTML = "\n .NextspaceLeftPanel {\n align-items: center;\n background-color: #21272a;\n cursor: default;\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n height: 100%;\n padding-top: 15px;\n position: absolute;\n width: 50px;\n z-index: 1;\n top: 0;\n left: 0;\n box-sizing: border-box;\n }\n\n .NextspaceLeftPanel * {\n box-sizing: border-box;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelBreaker {\n background-color: hsla(0,0%,50%,.231);\n flex-shrink: 0;\n height: 2px;\n margin-bottom: 15px;\n width: calc(100% - 8px);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelBottomBreaker {\n margin-top: auto;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton {\n border-radius: 3px;\n color: #fff;\n cursor: pointer;\n font-size: 18px;\n height: 32px;\n overflow: hidden;\n width: 32px;\n margin-bottom: 15px;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton:first-of-type {\n margin-bottom: 8px;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon {\n align-items: center;\n display: flex;\n justify-content: center;\n position: relative;\n transition: .3s ease;\n height: 100%;\n width: 100%;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon:hover {\n transform: scale(1.2);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[no-content=\"true\"] {\n cursor: default;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[no-content=\"true\"] >.NextspaceLeftPanelButtonIcon:hover {\n transform: none;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton >.NextspaceLeftPanelButtonIcon >svg {\n cursor: pointer;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled=\"true\"] >.NextspaceLeftPanelButtonIcon {\n background-color: #fff;\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-enabled=\"true\"] >.NextspaceLeftPanelButtonIcon >svg {\n filter: invert(1);\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelButton[is-disabled=\"true\"] {\n opacity: .5;\n pointer-events: none\n }\n\n .NextspaceLeftPanel >.NextspaceLeftPanelTabContent {\n display: none;\n width: 300px;\n height: 100%;\n position: absolute;\n top: 0;\n left: 50px;\n background-color: #21272a;\n padding: 40px 30px 30px;\n flex-direction: column;\n flex-grow: 1;\n flex-shrink: 1;\n overflow: hidden;\n }\n\n .NextspaceLeftPanel .NextspaceLeftPanelTabContentCloseButton {\n color: #fff;\n cursor: pointer;\n opacity: .7;\n position: absolute;\n right: 22px;\n top: 14px;\n transition: transform .3s ease;\n z-index: 1;\n }\n\n .NextspaceLeftPanel .NextspaceLeftPanelTabContentCloseButton:hover {\n transform: scale(1.2);\n }\n ";
|
|
23254
23258
|
document.head.appendChild(style);
|
|
23255
23259
|
};
|
|
23256
23260
|
WidgetLeftPanel.prototype._generateElement = function () {
|
|
@@ -23267,7 +23271,7 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
|
|
|
23267
23271
|
var bottomBreaker = document.createElement("div");
|
|
23268
23272
|
bottomBreaker.className = "NextspaceLeftPanelBottomBreaker";
|
|
23269
23273
|
this._element.appendChild(bottomBreaker);
|
|
23270
|
-
this.
|
|
23274
|
+
this._addUserProfileTab();
|
|
23271
23275
|
var panelContent = document.createElement("div");
|
|
23272
23276
|
panelContent.className = "NextspaceLeftPanelTabContent";
|
|
23273
23277
|
var panelContentCloseButton = document.createElement("div");
|
|
@@ -23330,6 +23334,83 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
|
|
|
23330
23334
|
tabButton.appendChild(buttonBookmarksIcon);
|
|
23331
23335
|
this._element.appendChild(tabButton);
|
|
23332
23336
|
};
|
|
23337
|
+
/**
|
|
23338
|
+
* User profile handled separately.
|
|
23339
|
+
* This is because for a while it will be just an indicator of logged in user session.
|
|
23340
|
+
* It won't have a tab content.
|
|
23341
|
+
*/
|
|
23342
|
+
WidgetLeftPanel.prototype._addUserProfileTab = function () {
|
|
23343
|
+
var tabButton = document.createElement("div");
|
|
23344
|
+
tabButton.className = "NextspaceLeftPanelButton";
|
|
23345
|
+
tabButton.setAttribute("title", "Not logged in");
|
|
23346
|
+
tabButton.setAttribute("no-content", "true");
|
|
23347
|
+
var buttonBookmarksIcon = document.createElement("div");
|
|
23348
|
+
buttonBookmarksIcon.className = "NextspaceLeftPanelButtonIcon";
|
|
23349
|
+
var LOGGED_OUT_ICON = "\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V19C4 19.55 4.45 20 5 20H19C19.55 20 20 19.55 20 19V18C20 15.34 14.67 14 12 14Z\" fill=\"white\"/>\n </svg>\n ";
|
|
23350
|
+
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
23351
|
+
tabButton.appendChild(buttonBookmarksIcon);
|
|
23352
|
+
this._element.appendChild(tabButton);
|
|
23353
|
+
function getInitials(name) {
|
|
23354
|
+
var nameSplit = name.split(" ");
|
|
23355
|
+
if (nameSplit.length > 1) {
|
|
23356
|
+
return nameSplit[0][0] + nameSplit[1][0];
|
|
23357
|
+
}
|
|
23358
|
+
else {
|
|
23359
|
+
return nameSplit[0][0];
|
|
23360
|
+
}
|
|
23361
|
+
}
|
|
23362
|
+
function GetColorForString(str) {
|
|
23363
|
+
var stringUniqueHash = [].concat(str).reduce(function (acc, char) { return char.charCodeAt(0) + ((acc << 5) - acc); }, 0);
|
|
23364
|
+
return "hsl(".concat(stringUniqueHash % 360, ", 95%, 35%)");
|
|
23365
|
+
}
|
|
23366
|
+
/**
|
|
23367
|
+
* Updates the tab button based on the current user session.
|
|
23368
|
+
*/
|
|
23369
|
+
function updateProfile() {
|
|
23370
|
+
var _a;
|
|
23371
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23372
|
+
var session, isLoggedIn, userName, initials, e_2;
|
|
23373
|
+
return __generator(this, function (_b) {
|
|
23374
|
+
switch (_b.label) {
|
|
23375
|
+
case 0:
|
|
23376
|
+
_b.trys.push([0, 2, , 3]);
|
|
23377
|
+
return [4 /*yield*/, Session.Get({
|
|
23378
|
+
sessionId: ENVIRONMENT.PARAMS.sessionId ? ENVIRONMENT.PARAMS.sessionId : "anonymous",
|
|
23379
|
+
})];
|
|
23380
|
+
case 1:
|
|
23381
|
+
session = (_b.sent()).session;
|
|
23382
|
+
isLoggedIn = session.ID != "anonymous" && ((_a = session.User) === null || _a === void 0 ? void 0 : _a.ID) != "anonymous";
|
|
23383
|
+
userName = session.User.FullName ? session.User.FullName : session.User.ID;
|
|
23384
|
+
tabButton.setAttribute("title", isLoggedIn ? userName : "Not logged in");
|
|
23385
|
+
// Draw a circle with the user's initials.
|
|
23386
|
+
if (isLoggedIn) {
|
|
23387
|
+
initials = getInitials(userName);
|
|
23388
|
+
buttonBookmarksIcon.innerHTML = "\n <div \n style=\"\n background-color: ".concat(GetColorForString(userName), "; \n color: white;\n border-radius: 50%;\n display: flex; \n align-items: center; \n justify-content: center; \n font-size: 12px;\n font-family: Arial;\n height: 100%; \n width: 100%;\">\n ").concat(initials, "\n </div>\n ");
|
|
23389
|
+
}
|
|
23390
|
+
else {
|
|
23391
|
+
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
23392
|
+
}
|
|
23393
|
+
return [3 /*break*/, 3];
|
|
23394
|
+
case 2:
|
|
23395
|
+
e_2 = _b.sent();
|
|
23396
|
+
console.error(e_2);
|
|
23397
|
+
tabButton.setAttribute("title", "Not logged in");
|
|
23398
|
+
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
23399
|
+
return [3 /*break*/, 3];
|
|
23400
|
+
case 3: return [2 /*return*/];
|
|
23401
|
+
}
|
|
23402
|
+
});
|
|
23403
|
+
});
|
|
23404
|
+
}
|
|
23405
|
+
if (this.envSubRemoval) {
|
|
23406
|
+
this.envSubRemoval();
|
|
23407
|
+
this.envSubRemoval = null;
|
|
23408
|
+
}
|
|
23409
|
+
this.envSubRemoval = ENVIRONMENT.OnParamsChange.Subscribe(function () {
|
|
23410
|
+
updateProfile();
|
|
23411
|
+
});
|
|
23412
|
+
updateProfile();
|
|
23413
|
+
};
|
|
23333
23414
|
/**
|
|
23334
23415
|
* Updates the panel styles based on the current state.
|
|
23335
23416
|
* Eg: if a tab is enabled, the button should be highlighted.
|
|
@@ -23338,8 +23419,14 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
|
|
|
23338
23419
|
var _this = this;
|
|
23339
23420
|
var buttons = this._element.querySelectorAll(".NextspaceLeftPanelButton");
|
|
23340
23421
|
buttons.forEach(function (button) {
|
|
23341
|
-
var
|
|
23422
|
+
var buttonTab = button.getAttribute("widget-left-panel-tab");
|
|
23423
|
+
var isEnabled = buttonTab === _this._enabledPanelTab;
|
|
23342
23424
|
button.setAttribute("is-enabled", isEnabled ? "true" : "false");
|
|
23425
|
+
// Disable for specific tabs.
|
|
23426
|
+
// Eg: bookmarks require a viewId.
|
|
23427
|
+
if (buttonTab === "bookmarks") {
|
|
23428
|
+
button.setAttribute("is-disabled", !_this._viewId ? "true" : "false");
|
|
23429
|
+
}
|
|
23343
23430
|
});
|
|
23344
23431
|
// Make the tab content visible/invisible based on the current state.
|
|
23345
23432
|
var contentDisplayState = this._enabledPanelTab ? "flex" : "none";
|
|
@@ -23366,6 +23453,10 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
|
|
|
23366
23453
|
});
|
|
23367
23454
|
break;
|
|
23368
23455
|
default:
|
|
23456
|
+
if (this.customTabs.has(this._enabledPanelTab) === false) {
|
|
23457
|
+
console.error("Tab ".concat(this._enabledPanelTab, " not found."));
|
|
23458
|
+
return;
|
|
23459
|
+
}
|
|
23369
23460
|
tabContent = new (this.customTabs.get(this._enabledPanelTab)({
|
|
23370
23461
|
widget: this,
|
|
23371
23462
|
container: container
|
|
@@ -26336,7 +26427,7 @@ var ViewerUtils;
|
|
|
26336
26427
|
ViewerUtils.AssertIonToken = AssertIonToken;
|
|
26337
26428
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
26338
26429
|
|
|
26339
|
-
var VERSION = "4.
|
|
26430
|
+
var VERSION = "4.3.0";
|
|
26340
26431
|
|
|
26341
26432
|
export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, WidgetSearchBar, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
|
|
26342
26433
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|