From df5e75164d896ca1f9d96c15e0e163e825545f46 Mon Sep 17 00:00:00 2001 From: David Brown Date: Thu, 19 Sep 2024 18:33:27 -0400 Subject: [PATCH 1/3] Issue#11474- Partial commit This is a partial commit to check whether I am making the correct changes --- .../Source/DataSources/BillboardGraphics.js | 85 ++-- .../engine/Source/DataSources/BoxGraphics.js | 8 +- .../DataSources/ConstantPositionProperty.js | 7 +- .../Source/DataSources/KmlDataSource.js | 432 +++++++++--------- .../BaseLayerPickerViewModel.js | 31 +- .../BaseLayerPicker/ProviderViewModel.js | 4 +- .../FullscreenButtonViewModel.js | 23 +- .../Source/Geocoder/GeocoderViewModel.js | 23 +- packages/widgets/Source/InspectorShared.js | 22 +- .../NavigationHelpButton.js | 33 +- .../PerformanceWatchdogViewModel.js | 13 +- .../SceneModePickerViewModel.js | 3 +- .../SelectionIndicatorViewModel.js | 11 +- .../Source/Timeline/TimelineHighlightRange.js | 12 +- .../widgets/Source/ToggleButtonViewModel.js | 6 +- .../Source/VRButton/VRButtonViewModel.js | 12 +- packages/widgets/Source/Viewer/Viewer.js | 149 +++--- .../Source/Viewer/viewerDragDropMixin.js | 18 +- .../Viewer/viewerPerformanceWatchdogMixin.js | 2 +- packages/widgets/Source/createCommand.js | 4 +- packages/widgets/Specs/createViewer.js | 7 +- 21 files changed, 422 insertions(+), 483 deletions(-) diff --git a/packages/engine/Source/DataSources/BillboardGraphics.js b/packages/engine/Source/DataSources/BillboardGraphics.js index bdd950736c2b..c42a9bf53263 100644 --- a/packages/engine/Source/DataSources/BillboardGraphics.js +++ b/packages/engine/Source/DataSources/BillboardGraphics.js @@ -92,8 +92,7 @@ function BillboardGraphics(options) { this._disableDepthTestDistanceSubscription = undefined; this._splitDirection = undefined; this._splitDirectionSubscription = undefined; - - this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); + this.merge(options ?? defaultValue.EMPTY_OBJECT); } Object.defineProperties(BillboardGraphics.prototype, { @@ -303,7 +302,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * @type {Property|undefined} */ pixelOffsetScaleByDistance: createPropertyDescriptor( - "pixelOffsetScaleByDistance" + "pixelOffsetScaleByDistance", ), /** @@ -321,7 +320,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( - "distanceDisplayCondition" + "distanceDisplayCondition", ), /** @@ -331,7 +330,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * @type {Property|undefined} */ disableDepthTestDistance: createPropertyDescriptor( - "disableDepthTestDistance" + "disableDepthTestDistance", ), /** @@ -390,56 +389,30 @@ BillboardGraphics.prototype.merge = function (source) { } //>>includeEnd('debug'); - this.show = defaultValue(this._show, source.show); - this.image = defaultValue(this._image, source.image); - this.scale = defaultValue(this._scale, source.scale); - this.pixelOffset = defaultValue(this._pixelOffset, source.pixelOffset); - this.eyeOffset = defaultValue(this._eyeOffset, source.eyeOffset); - this.horizontalOrigin = defaultValue( - this._horizontalOrigin, - source.horizontalOrigin - ); - this.verticalOrigin = defaultValue( - this._verticalOrigin, - source.verticalOrigin - ); - this.heightReference = defaultValue( - this._heightReference, - source.heightReference - ); - this.color = defaultValue(this._color, source.color); - this.rotation = defaultValue(this._rotation, source.rotation); - this.alignedAxis = defaultValue(this._alignedAxis, source.alignedAxis); - this.sizeInMeters = defaultValue(this._sizeInMeters, source.sizeInMeters); - this.width = defaultValue(this._width, source.width); - this.height = defaultValue(this._height, source.height); - this.scaleByDistance = defaultValue( - this._scaleByDistance, - source.scaleByDistance - ); - this.translucencyByDistance = defaultValue( - this._translucencyByDistance, - source.translucencyByDistance - ); - this.pixelOffsetScaleByDistance = defaultValue( - this._pixelOffsetScaleByDistance, - source.pixelOffsetScaleByDistance - ); - this.imageSubRegion = defaultValue( - this._imageSubRegion, - source.imageSubRegion - ); - this.distanceDisplayCondition = defaultValue( - this._distanceDisplayCondition, - source.distanceDisplayCondition - ); - this.disableDepthTestDistance = defaultValue( - this._disableDepthTestDistance, - source.disableDepthTestDistance - ); - this.splitDirection = defaultValue( - this.splitDirection, - source.splitDirection - ); + this.show = this._show ?? source.show; + this.image = this._image ?? source.image; + this.scale = this._scale ?? source.scale; + this.pixelOffset = this._pixelOffset ?? source.pixelOffset; + this.eyeOffset = this._eyeOffset ?? source.eyeOffset; + this.horizontalOrigin = this._horizontalOrigin ?? source.horizontalOrigin; + this.verticalOrigin = this._verticalOrigin ?? source.verticalOrigin; + this.heightReference = this._heightReference ?? source.heightReference; + this.color = this._color ?? source.color; + this.rotation = this._rotation ?? source.rotation; + this.alignedAxis = this._alignedAxis ?? source.alignedAxis; + this.sizeInMeters = this._sizeInMeters ?? source.sizeInMeters; + this.width = this._width ?? source.width; + this.height = this._height ?? source.height; + this.scaleByDistance = this._scaleByDistance ?? source.scaleByDistance; + this.translucencyByDistance = + this._translucencyByDistance ?? source.translucencyByDistance; + this.pixelOffsetScaleByDistance = + this._pixelOffsetScaleByDistance ?? source.pixelOffsetScaleByDistance; + this.imageSubRegion = this._imageSubRegion ?? source.imageSubRegion; + this.distanceDisplayCondition = + this._distanceDisplayCondition ?? source.distanceDisplayCondition; + this.disableDepthTestDistance = + this._disableDepthTestDistance ?? source.disableDepthTestDistance; + this.splitDirection = this.splitDirection ?? source.splitDirection; }; export default BillboardGraphics; diff --git a/packages/engine/Source/DataSources/BoxGraphics.js b/packages/engine/Source/DataSources/BoxGraphics.js index d922d1022850..4b8cd59918e6 100644 --- a/packages/engine/Source/DataSources/BoxGraphics.js +++ b/packages/engine/Source/DataSources/BoxGraphics.js @@ -56,7 +56,7 @@ function BoxGraphics(options) { this._distanceDisplayCondition = undefined; this._distanceDisplayConditionSubscription = undefined; - this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); + this.merge(options ?? defaultValue.EMPTY_OBJECT); } Object.defineProperties(BoxGraphics.prototype, { @@ -153,7 +153,7 @@ Object.defineProperties(BoxGraphics.prototype, { * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( - "distanceDisplayCondition" + "distanceDisplayCondition", ), }); @@ -197,7 +197,7 @@ BoxGraphics.prototype.merge = function (source) { this.dimensions = defaultValue(this.dimensions, source.dimensions); this.heightReference = defaultValue( this.heightReference, - source.heightReference + source.heightReference, ); this.fill = defaultValue(this.fill, source.fill); this.material = defaultValue(this.material, source.material); @@ -207,7 +207,7 @@ BoxGraphics.prototype.merge = function (source) { this.shadows = defaultValue(this.shadows, source.shadows); this.distanceDisplayCondition = defaultValue( this.distanceDisplayCondition, - source.distanceDisplayCondition + source.distanceDisplayCondition, ); }; export default BoxGraphics; diff --git a/packages/engine/Source/DataSources/ConstantPositionProperty.js b/packages/engine/Source/DataSources/ConstantPositionProperty.js index b2a436383bf5..3069f8750fc3 100644 --- a/packages/engine/Source/DataSources/ConstantPositionProperty.js +++ b/packages/engine/Source/DataSources/ConstantPositionProperty.js @@ -1,5 +1,4 @@ import Cartesian3 from "../Core/Cartesian3.js"; -import defaultValue from "../Core/defaultValue.js"; import defined from "../Core/defined.js"; import DeveloperError from "../Core/DeveloperError.js"; import Event from "../Core/Event.js"; @@ -20,7 +19,7 @@ import PositionProperty from "./PositionProperty.js"; function ConstantPositionProperty(value, referenceFrame) { this._definitionChanged = new Event(); this._value = Cartesian3.clone(value); - this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED); + this._referenceFrame = referenceFrame ?? ReferenceFrame.FIXED; } Object.defineProperties(ConstantPositionProperty.prototype, { @@ -114,7 +113,7 @@ ConstantPositionProperty.prototype.setValue = function (value, referenceFrame) { ConstantPositionProperty.prototype.getValueInReferenceFrame = function ( time, referenceFrame, - result + result, ) { //>>includeStart('debug', pragmas.debug); if (!defined(time)) { @@ -130,7 +129,7 @@ ConstantPositionProperty.prototype.getValueInReferenceFrame = function ( this._value, this._referenceFrame, referenceFrame, - result + result, ); }; diff --git a/packages/engine/Source/DataSources/KmlDataSource.js b/packages/engine/Source/DataSources/KmlDataSource.js index d800e7d9a64b..4238e91993e5 100644 --- a/packages/engine/Source/DataSources/KmlDataSource.js +++ b/packages/engine/Source/DataSources/KmlDataSource.js @@ -319,7 +319,7 @@ function isZipFile(blob) { const reader = new FileReader(); reader.addEventListener("load", function () { deferred.resolve( - new DataView(reader.result).getUint32(0, false) === 0x504b0304 + new DataView(reader.result).getUint32(0, false) === 0x504b0304, ); }); reader.addEventListener("error", function () { @@ -391,24 +391,22 @@ function removeDuplicateNamespaces(text) { } function loadXmlFromZip(entry, uriResolver) { - return Promise.resolve(entry.getData(new zip.TextWriter())).then(function ( - text - ) { - text = insertNamespaces(text); - text = removeDuplicateNamespaces(text); - uriResolver.kml = parser.parseFromString(text, "application/xml"); - }); + return Promise.resolve(entry.getData(new zip.TextWriter())).then( + function (text) { + text = insertNamespaces(text); + text = removeDuplicateNamespaces(text); + uriResolver.kml = parser.parseFromString(text, "application/xml"); + }, + ); } function loadDataUriFromZip(entry, uriResolver) { - const mimeType = defaultValue( - MimeTypes.detectFromFilename(entry.filename), - "application/octet-stream" - ); + const mimeType = + MimeTypes.detectFromFilename(entry.filename) ?? "application/octet-stream"; return Promise.resolve(entry.getData(new zip.Data64URIWriter(mimeType))).then( function (dataUri) { uriResolver[entry.filename] = dataUri; - } + }, ); } @@ -720,7 +718,7 @@ function queryColorValue(node, tagName, namespace) { } return parseColorString( value, - queryStringValue(node, "colorMode", namespace) === "random" + queryStringValue(node, "colorMode", namespace) === "random", ); } @@ -743,7 +741,7 @@ function processTimeStamp(featureNode) { new TimeInterval({ start: when, stop: Iso8601.MAXIMUM_VALUE, - }) + }), ); return result; } @@ -776,7 +774,7 @@ function processTimeSpan(featureNode) { new TimeInterval({ start: beginDate, stop: endDate, - }) + }), ); } else if (defined(beginDate)) { result = new TimeIntervalCollection(); @@ -784,7 +782,7 @@ function processTimeSpan(featureNode) { new TimeInterval({ start: beginDate, stop: Iso8601.MAXIMUM_VALUE, - }) + }), ); } else if (defined(endDate)) { result = new TimeIntervalCollection(); @@ -792,7 +790,7 @@ function processTimeSpan(featureNode) { new TimeInterval({ start: Iso8601.MINIMUM_VALUE, stop: endDate, - }) + }), ); } @@ -807,13 +805,13 @@ function createDefaultBillboard() { BILLBOARD_NEAR_DISTANCE, BILLBOARD_NEAR_RATIO, BILLBOARD_FAR_DISTANCE, - BILLBOARD_FAR_RATIO + BILLBOARD_FAR_RATIO, ); billboard.pixelOffsetScaleByDistance = new NearFarScalar( BILLBOARD_NEAR_DISTANCE, BILLBOARD_NEAR_RATIO, BILLBOARD_FAR_DISTANCE, - BILLBOARD_FAR_RATIO + BILLBOARD_FAR_RATIO, ); return billboard; } @@ -840,7 +838,7 @@ function getIconHref( dataSource, sourceResource, uriResolver, - canRefresh + canRefresh, ) { let href = queryStringValue(iconNode, "href", namespaces.kml); if (!defined(href) || href.length === 0) { @@ -851,8 +849,8 @@ function getIconHref( const palette = href.charAt(21); // Get the icon number - let x = defaultValue(queryNumericValue(iconNode, "x", namespaces.gx), 0); - let y = defaultValue(queryNumericValue(iconNode, "y", namespaces.gx), 0); + let x = queryNumericValue(iconNode, "x", namespaces.gx) ?? 0; + let y = queryNumericValue(iconNode, "y", namespaces.gx) ?? 0; x = Math.min(x / 32, 7); y = 7 - Math.min(y / 32, 7); const iconNum = 8 * y + x; @@ -866,28 +864,28 @@ function getIconHref( const refreshMode = queryStringValue( iconNode, "refreshMode", - namespaces.kml + namespaces.kml, ); const viewRefreshMode = queryStringValue( iconNode, "viewRefreshMode", - namespaces.kml + namespaces.kml, ); if (refreshMode === "onInterval" || refreshMode === "onExpire") { oneTimeWarning( `kml-refreshMode-${refreshMode}`, - `KML - Unsupported Icon refreshMode: ${refreshMode}` + `KML - Unsupported Icon refreshMode: ${refreshMode}`, ); } else if (viewRefreshMode === "onStop" || viewRefreshMode === "onRegion") { oneTimeWarning( `kml-refreshMode-${viewRefreshMode}`, - `KML - Unsupported Icon viewRefreshMode: ${viewRefreshMode}` + `KML - Unsupported Icon viewRefreshMode: ${viewRefreshMode}`, ); } const viewBoundScale = defaultValue( queryStringValue(iconNode, "viewBoundScale", namespaces.kml), - 1.0 + 1.0, ); const defaultViewFormat = viewRefreshMode === "onStop" @@ -895,7 +893,7 @@ function getIconHref( : ""; const viewFormat = defaultValue( queryStringValue(iconNode, "viewFormat", namespaces.kml), - defaultViewFormat + defaultViewFormat, ); const httpQuery = queryStringValue(iconNode, "httpQuery", namespaces.kml); if (defined(viewFormat)) { @@ -912,7 +910,7 @@ function getIconHref( dataSource.canvas, viewBoundScale, dataSource._lastCameraView.bbox, - ellipsoid + ellipsoid, ); return hrefResource; @@ -926,7 +924,7 @@ function processBillboardIcon( node, targetEntity, sourceResource, - uriResolver + uriResolver, ) { let scale = queryNumericValue(node, "scale", namespaces.kml); const heading = queryNumericValue(node, "heading", namespaces.kml); @@ -938,7 +936,7 @@ function processBillboardIcon( dataSource, sourceResource, uriResolver, - false + false, ); // If icon tags are present but blank, we do not want to show an icon @@ -1019,7 +1017,7 @@ function applyStyle( styleNode, targetEntity, sourceResource, - uriResolver + uriResolver, ) { for (let i = 0, len = styleNode.childNodes.length; i < len; i++) { const node = styleNode.childNodes.item(i); @@ -1029,7 +1027,7 @@ function applyStyle( node, targetEntity, sourceResource, - uriResolver + uriResolver, ); } else if (node.localName === "LabelStyle") { let label = targetEntity.label; @@ -1039,11 +1037,11 @@ function applyStyle( } label.scale = defaultValue( queryNumericValue(node, "scale", namespaces.kml), - label.scale + label.scale, ); label.fillColor = defaultValue( queryColorValue(node, "color", namespaces.kml), - label.fillColor + label.fillColor, ); label.text = targetEntity.name; } else if (node.localName === "LineStyle") { @@ -1057,25 +1055,25 @@ function applyStyle( if (defined(queryColorValue(node, "outerColor", namespaces.gx))) { oneTimeWarning( "kml-gx:outerColor", - "KML - gx:outerColor is not supported in a LineStyle" + "KML - gx:outerColor is not supported in a LineStyle", ); } if (defined(queryNumericValue(node, "outerWidth", namespaces.gx))) { oneTimeWarning( "kml-gx:outerWidth", - "KML - gx:outerWidth is not supported in a LineStyle" + "KML - gx:outerWidth is not supported in a LineStyle", ); } if (defined(queryNumericValue(node, "physicalWidth", namespaces.gx))) { oneTimeWarning( "kml-gx:physicalWidth", - "KML - gx:physicalWidth is not supported in a LineStyle" + "KML - gx:physicalWidth is not supported in a LineStyle", ); } if (defined(queryBooleanValue(node, "labelVisibility", namespaces.gx))) { oneTimeWarning( "kml-gx:labelVisibility", - "KML - gx:labelVisibility is not supported in a LineStyle" + "KML - gx:labelVisibility is not supported in a LineStyle", ); } } else if (node.localName === "PolyStyle") { @@ -1086,24 +1084,24 @@ function applyStyle( } polygon.material = defaultValue( queryColorValue(node, "color", namespaces.kml), - polygon.material + polygon.material, ); polygon.fill = defaultValue( queryBooleanValue(node, "fill", namespaces.kml), - polygon.fill + polygon.fill, ); polygon.outline = defaultValue( queryBooleanValue(node, "outline", namespaces.kml), - polygon.outline + polygon.outline, ); } else if (node.localName === "BalloonStyle") { const bgColor = defaultValue( parseColorString(queryStringValue(node, "bgColor", namespaces.kml)), - Color.WHITE + Color.WHITE, ); const textColor = defaultValue( parseColorString(queryStringValue(node, "textColor", namespaces.kml)), - Color.BLACK + Color.BLACK, ); const text = queryStringValue(node, "text", namespaces.kml); @@ -1119,12 +1117,12 @@ function applyStyle( const listItemType = queryStringValue( node, "listItemType", - namespaces.kml + namespaces.kml, ); if (listItemType === "radioFolder" || listItemType === "checkOffOnly") { oneTimeWarning( `kml-listStyle-${listItemType}`, - `KML - Unsupported ListStyle with listItemType: ${listItemType}` + `KML - Unsupported ListStyle with listItemType: ${listItemType}`, ); } } @@ -1137,7 +1135,7 @@ function computeFinalStyle( placeMark, styleCollection, sourceResource, - uriResolver + uriResolver, ) { const result = new Entity(); let styleEntity; @@ -1161,7 +1159,7 @@ function computeFinalStyle( inlineStyleNode, result, sourceResource, - uriResolver + uriResolver, ); } else { // StyleMap @@ -1186,7 +1184,7 @@ function computeFinalStyle( } else { oneTimeWarning( `kml-styleMap-${key}`, - `KML - Unsupported StyleMap key: ${key}` + `KML - Unsupported StyleMap key: ${key}`, ); } } @@ -1236,7 +1234,7 @@ function processStyles( styleCollection, sourceResource, isExternal, - uriResolver + uriResolver, ) { let i; let id; @@ -1264,7 +1262,7 @@ function processStyles( node, styleEntity, sourceResource, - uriResolver + uriResolver, ); } } @@ -1311,14 +1309,14 @@ function processStyles( node, styleEntity, sourceResource, - uriResolver + uriResolver, ); } } } else { oneTimeWarning( `kml-styleMap-${key}`, - `KML - Unsupported StyleMap key: ${key}` + `KML - Unsupported StyleMap key: ${key}`, ); } } @@ -1344,7 +1342,7 @@ function processStyles( }); promises.push( - processExternalStyles(dataSource, resource, styleCollection) + processExternalStyles(dataSource, resource, styleCollection), ); } } @@ -1386,7 +1384,7 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { if (gxAltitudeMode === "clampToSeaFloor") { oneTimeWarning( "kml-gx:altitudeMode-clampToSeaFloor", - "KML - :clampToSeaFloor is currently not supported, using :clampToGround." + "KML - :clampToSeaFloor is currently not supported, using :clampToGround.", ); return HeightReference.CLAMP_TO_GROUND; } @@ -1394,7 +1392,7 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { if (gxAltitudeMode === "relativeToSeaFloor") { oneTimeWarning( "kml-gx:altitudeMode-relativeToSeaFloor", - "KML - :relativeToSeaFloor is currently not supported, using :relativeToGround." + "KML - :relativeToSeaFloor is currently not supported, using :relativeToGround.", ); return HeightReference.RELATIVE_TO_GROUND; } @@ -1402,12 +1400,12 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { if (defined(altitudeMode)) { oneTimeWarning( "kml-altitudeMode-unknown", - `KML - Unknown :${altitudeMode}, using :CLAMP_TO_GROUND.` + `KML - Unknown :${altitudeMode}, using :CLAMP_TO_GROUND.`, ); } else { oneTimeWarning( "kml-gx:altitudeMode-unknown", - `KML - Unknown :${gxAltitudeMode}, using :CLAMP_TO_GROUND.` + `KML - Unknown :${gxAltitudeMode}, using :CLAMP_TO_GROUND.`, ); } @@ -1418,7 +1416,7 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { function createPositionPropertyFromAltitudeMode( property, altitudeMode, - gxAltitudeMode + gxAltitudeMode, ) { if ( gxAltitudeMode === "relativeToSeaFloor" || @@ -1437,8 +1435,8 @@ function createPositionPropertyFromAltitudeMode( "kml-altitudeMode-unknown", `KML - Unknown altitudeMode: ${defaultValue( altitudeMode, - gxAltitudeMode - )}` + gxAltitudeMode, + )}`, ); } @@ -1450,7 +1448,7 @@ function createPositionPropertyArrayFromAltitudeMode( properties, altitudeMode, gxAltitudeMode, - ellipsoid + ellipsoid, ) { if (!defined(properties)) { return undefined; @@ -1473,8 +1471,8 @@ function createPositionPropertyArrayFromAltitudeMode( "kml-altitudeMode-unknown", `KML - Unknown altitudeMode: ${defaultValue( altitudeMode, - gxAltitudeMode - )}` + gxAltitudeMode, + )}`, ); } @@ -1491,7 +1489,7 @@ function processPositionGraphics( dataSource, entity, styleEntity, - heightReference + heightReference, ) { let label = entity.label; if (!defined(label)) { @@ -1558,22 +1556,22 @@ function processPoint( entityCollection, geometryNode, entity, - styleEntity + styleEntity, ) { const coordinatesString = queryStringValue( geometryNode, "coordinates", - namespaces.kml + namespaces.kml, ); const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml + namespaces.kml, ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx + namespaces.gx, ); const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml); const ellipsoid = dataSource._ellipsoid; @@ -1584,7 +1582,7 @@ function processPoint( dataSource, entity, styleEntity, - heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) + heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode), ); if (extrude && isExtrudable(altitudeMode, gxAltitudeMode)) { @@ -1599,28 +1597,28 @@ function processLineStringOrLinearRing( entityCollection, geometryNode, entity, - styleEntity + styleEntity, ) { const coordinatesNode = queryFirstNode( geometryNode, "coordinates", - namespaces.kml + namespaces.kml, ); const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml + namespaces.kml, ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx + namespaces.gx, ); const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml); const tessellate = queryBooleanValue( geometryNode, "tessellate", - namespaces.kml + namespaces.kml, ); const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode); const zIndex = queryNumericValue(geometryNode, "drawOrder", namespaces.gx); @@ -1670,13 +1668,13 @@ function processLineStringOrLinearRing( if (defined(zIndex)) { oneTimeWarning( "kml-gx:drawOrder", - "KML - gx:drawOrder is not supported in LineStrings when clampToGround is false" + "KML - gx:drawOrder is not supported in LineStrings when clampToGround is false", ); } if (dataSource._clampToGround && !tessellate) { oneTimeWarning( "kml-line-tesselate", - "Ignoring clampToGround for KML lines without the tessellate flag." + "Ignoring clampToGround for KML lines without the tessellate flag.", ); } @@ -1686,7 +1684,7 @@ function processLineStringOrLinearRing( coordinates, altitudeMode, gxAltitudeMode, - ellipsoid + ellipsoid, ); if (!tessellate || canExtrude) { polyline.arcType = ArcType.NONE; @@ -1701,22 +1699,22 @@ function processPolygon( entityCollection, geometryNode, entity, - styleEntity + styleEntity, ) { const outerBoundaryIsNode = queryFirstNode( geometryNode, "outerBoundaryIs", - namespaces.kml + namespaces.kml, ); let linearRingNode = queryFirstNode( outerBoundaryIsNode, "LinearRing", - namespaces.kml + namespaces.kml, ); let coordinatesNode = queryFirstNode( linearRingNode, "coordinates", - namespaces.kml + namespaces.kml, ); const ellipsoid = dataSource._ellipsoid; let coordinates = readCoordinates(coordinatesNode, ellipsoid); @@ -1724,12 +1722,12 @@ function processPolygon( const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml + namespaces.kml, ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx + namespaces.gx, ); const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode); @@ -1758,19 +1756,19 @@ function processPolygon( const innerBoundaryIsNodes = queryChildNodes( geometryNode, "innerBoundaryIs", - namespaces.kml + namespaces.kml, ); for (let j = 0; j < innerBoundaryIsNodes.length; j++) { linearRingNode = queryChildNodes( innerBoundaryIsNodes[j], "LinearRing", - namespaces.kml + namespaces.kml, ); for (let k = 0; k < linearRingNode.length; k++) { coordinatesNode = queryFirstNode( linearRingNode[k], "coordinates", - namespaces.kml + namespaces.kml, ); coordinates = readCoordinates(coordinatesNode, ellipsoid); if (defined(coordinates)) { @@ -1789,17 +1787,17 @@ function processTrack( entityCollection, geometryNode, entity, - styleEntity + styleEntity, ) { const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml + namespaces.kml, ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx + namespaces.gx, ); const coordNodes = queryChildNodes(geometryNode, "coord", namespaces.gx); const angleNodes = queryChildNodes(geometryNode, "angles", namespaces.gx); @@ -1811,7 +1809,7 @@ function processTrack( if (angleNodes.length > 0) { oneTimeWarning( "kml-gx:angles", - "KML - gx:angles are not supported in gx:Tracks" + "KML - gx:angles are not supported in gx:Tracks", ); } @@ -1830,7 +1828,7 @@ function processTrack( dataSource, entity, styleEntity, - heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) + heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode), ); processPathGraphics(entity, styleEntity); @@ -1841,7 +1839,7 @@ function processTrack( new TimeInterval({ start: times[0], stop: times[times.length - 1], - }) + }), ); } @@ -1861,7 +1859,7 @@ function addToMultiTrack( extrude, altitudeMode, gxAltitudeMode, - includeEndPoints + includeEndPoints, ) { const start = times[0]; const stop = times[times.length - 1]; @@ -1878,9 +1876,9 @@ function addToMultiTrack( data: createPositionPropertyFromAltitudeMode( data, altitudeMode, - gxAltitudeMode + gxAltitudeMode, ), - }) + }), ); availability.addInterval( new TimeInterval({ @@ -1888,7 +1886,7 @@ function addToMultiTrack( stop: stop, isStartIncluded: includeEndPoints, isStopIncluded: includeEndPoints, - }) + }), ); dropShowProperty.intervals.addInterval( new TimeInterval({ @@ -1897,7 +1895,7 @@ function addToMultiTrack( isStartIncluded: includeEndPoints, isStopIncluded: includeEndPoints, data: extrude, - }) + }), ); } @@ -1906,7 +1904,7 @@ function processMultiTrack( entityCollection, geometryNode, entity, - styleEntity + styleEntity, ) { // Multitrack options do not work in GE as detailed in the spec, // rather than altitudeMode being at the MultiTrack level, @@ -1915,7 +1913,7 @@ function processMultiTrack( const interpolate = queryBooleanValue( geometryNode, "interpolate", - namespaces.gx + namespaces.gx, ); const trackNodes = queryChildNodes(geometryNode, "Track", namespaces.gx); @@ -1934,12 +1932,12 @@ function processMultiTrack( const altitudeMode = queryStringValue( trackNode, "altitudeMode", - namespaces.kml + namespaces.kml, ); const gxAltitudeMode = queryStringValue( trackNode, "altitudeMode", - namespaces.gx + namespaces.gx, ); const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode); const extrude = queryBooleanValue(trackNode, "extrude", namespaces.kml); @@ -1969,7 +1967,7 @@ function processMultiTrack( false, "absolute", undefined, - false + false, ); } lastStop = times[length - 1]; @@ -1985,7 +1983,7 @@ function processMultiTrack( canExtrude && extrude, altitudeMode, gxAltitudeMode, - true + true, ); needDropLine = needDropLine || (canExtrude && extrude); } @@ -2019,7 +2017,7 @@ function processMultiGeometry( geometryNode, entity, styleEntity, - context + context, ) { const childNodes = geometryNode.childNodes; let hasGeometry = false; @@ -2039,7 +2037,7 @@ function processMultiGeometry( entityCollection, childNode, childEntity, - styleEntity + styleEntity, ) ) { hasGeometry = true; @@ -2055,11 +2053,11 @@ function processUnsupportedGeometry( entityCollection, geometryNode, entity, - styleEntity + styleEntity, ) { oneTimeWarning( "kml-unsupportedGeometry", - `KML - Unsupported geometry: ${geometryNode.localName}` + `KML - Unsupported geometry: ${geometryNode.localName}`, ); return false; } @@ -2077,7 +2075,7 @@ function processExtendedData(node, entity) { if (defined(queryStringAttribute(extendedDataNode, "xmlns:prefix"))) { oneTimeWarning( "kml-extendedData", - "KML - ExtendedData with xmlns:prefix is unsupported" + "KML - ExtendedData with xmlns:prefix is unsupported", ); } @@ -2093,7 +2091,7 @@ function processExtendedData(node, entity) { displayName: queryStringValue( dataNode, "displayName", - namespaces.kml + namespaces.kml, ), value: queryStringValue(dataNode, "value", namespaces.kml), }; @@ -2113,7 +2111,7 @@ function processDescription( entity, styleEntity, uriResolver, - sourceResource + sourceResource, ) { let i; let key; @@ -2125,7 +2123,7 @@ function processDescription( const balloonStyle = defaultValue( entity.balloonStyle, - styleEntity.balloonStyle + styleEntity.balloonStyle, ); let background = Color.WHITE; @@ -2181,7 +2179,7 @@ function processDescription( value = extendedData[key]; text += `${defaultValue( value.displayName, - key + key, )}${defaultValue(value.value, "")}`; } text += ""; @@ -2258,7 +2256,7 @@ function processFeature(dataSource, featureNode, processingData) { const entity = createEntity( featureNode, entityCollection, - processingData.context + processingData.context, ); const kmlData = entity.kml; const styleEntity = computeFinalStyle( @@ -2266,7 +2264,7 @@ function processFeature(dataSource, featureNode, processingData) { featureNode, processingData.styleCollection, sourceResource, - uriResolver + uriResolver, ); const name = queryStringValue(featureNode, "name", namespaces.kml); @@ -2292,7 +2290,7 @@ function processFeature(dataSource, featureNode, processingData) { const visibility = queryBooleanValue( featureNode, "visibility", - namespaces.kml + namespaces.kml, ); entity.show = ancestryIsVisible(parent) && defaultValue(visibility, true); //const open = queryBooleanValue(featureNode, 'open', namespaces.kml); @@ -2316,7 +2314,7 @@ function processFeature(dataSource, featureNode, processingData) { kmlData.phoneNumber = queryStringValue( featureNode, "phoneNumber", - namespaces.kml + namespaces.kml, ); kmlData.snippet = queryStringValue(featureNode, "Snippet", namespaces.kml); @@ -2326,7 +2324,7 @@ function processFeature(dataSource, featureNode, processingData) { entity, styleEntity, uriResolver, - sourceResource + sourceResource, ); const ellipsoid = dataSource._ellipsoid; @@ -2359,7 +2357,7 @@ function processPlacemark( dataSource, placemark, processingData, - deferredLoading + deferredLoading, ) { const r = processFeature(dataSource, placemark, processingData); const entity = r.entity; @@ -2379,7 +2377,7 @@ function processPlacemark( childNode, entity, styleEntity, - entity.id + entity.id, ); hasGeometry = true; } @@ -2417,7 +2415,7 @@ function processTour(dataSource, node, processingData, deferredLoading) { playlistNodeProcessor(tour, entryNode, ellipsoid); } else { console.log( - `Unknown KML Tour playlist entry type ${entryNode.localName}` + `Unknown KML Tour playlist entry type ${entryNode.localName}`, ); } } @@ -2456,28 +2454,28 @@ function processCamera(featureNode, entity, ellipsoid) { if (defined(camera)) { const lon = defaultValue( queryNumericValue(camera, "longitude", namespaces.kml), - 0.0 + 0.0, ); const lat = defaultValue( queryNumericValue(camera, "latitude", namespaces.kml), - 0.0 + 0.0, ); const altitude = defaultValue( queryNumericValue(camera, "altitude", namespaces.kml), - 0.0 + 0.0, ); const heading = defaultValue( queryNumericValue(camera, "heading", namespaces.kml), - 0.0 + 0.0, ); const tilt = defaultValue( queryNumericValue(camera, "tilt", namespaces.kml), - 0.0 + 0.0, ); const roll = defaultValue( queryNumericValue(camera, "roll", namespaces.kml), - 0.0 + 0.0, ); const position = Cartesian3.fromDegrees(lon, lat, altitude, ellipsoid); @@ -2492,21 +2490,21 @@ function processLookAt(featureNode, entity, ellipsoid) { if (defined(lookAt)) { const lon = defaultValue( queryNumericValue(lookAt, "longitude", namespaces.kml), - 0.0 + 0.0, ); const lat = defaultValue( queryNumericValue(lookAt, "latitude", namespaces.kml), - 0.0 + 0.0, ); const altitude = defaultValue( queryNumericValue(lookAt, "altitude", namespaces.kml), - 0.0 + 0.0, ); let heading = queryNumericValue(lookAt, "heading", namespaces.kml); let tilt = queryNumericValue(lookAt, "tilt", namespaces.kml); const range = defaultValue( queryNumericValue(lookAt, "range", namespaces.kml), - 0.0 + 0.0, ); tilt = CesiumMath.toRadians(defaultValue(tilt, 0.0)); @@ -2515,7 +2513,7 @@ function processLookAt(featureNode, entity, ellipsoid) { const hpr = new HeadingPitchRange( heading, tilt - CesiumMath.PI_OVER_TWO, - range + range, ); const viewPoint = Cartesian3.fromDegrees(lon, lat, altitude, ellipsoid); @@ -2527,7 +2525,7 @@ function processScreenOverlay( dataSource, screenOverlayNode, processingData, - deferredLoading + deferredLoading, ) { const screenOverlay = processingData.screenOverlayContainer; if (!defined(screenOverlay)) { @@ -2543,7 +2541,7 @@ function processScreenOverlay( dataSource, sourceResource, uriResolver, - false + false, ); if (!defined(icon)) { @@ -2560,12 +2558,12 @@ function processScreenOverlay( const screenXY = queryFirstNode( screenOverlayNode, "screenXY", - namespaces.kml + namespaces.kml, ); const overlayXY = queryFirstNode( screenOverlayNode, "overlayXY", - namespaces.kml + namespaces.kml, ); const size = queryFirstNode(screenOverlayNode, "size", namespaces.kml); @@ -2642,7 +2640,7 @@ function processScreenOverlay( if (defined(x)) { if (xUnit === "fraction") { xStyle = `${"left: " + "calc("}${Math.floor( - x * 100 + x * 100, )}% - ${xOrigin}px)`; } else if (xUnit === "pixels") { xStyle = `left: ${x - xOrigin}px`; @@ -2656,7 +2654,7 @@ function processScreenOverlay( if (defined(y)) { if (yUnit === "fraction") { yStyle = `${"bottom: " + "calc("}${Math.floor( - y * 100 + y * 100, )}% - ${yOrigin}px)`; } else if (yUnit === "pixels") { yStyle = `bottom: ${y - yOrigin}px`; @@ -2678,7 +2676,7 @@ function processGroundOverlay( dataSource, groundOverlay, processingData, - deferredLoading + deferredLoading, ) { const r = processFeature(dataSource, groundOverlay, processingData); const entity = r.entity; @@ -2689,7 +2687,7 @@ function processGroundOverlay( const ellipsoid = dataSource._ellipsoid; const positions = readCoordinates( queryFirstNode(groundOverlay, "LatLonQuad", namespaces.gx), - ellipsoid + ellipsoid, ); const zIndex = queryNumericValue(groundOverlay, "drawOrder", namespaces.kml); if (defined(positions)) { @@ -2706,7 +2704,7 @@ function processGroundOverlay( const latLonBox = queryFirstNode( groundOverlay, "LatLonBox", - namespaces.kml + namespaces.kml, ); if (defined(latLonBox)) { let west = queryNumericValue(latLonBox, "west", namespaces.kml); @@ -2743,13 +2741,13 @@ function processGroundOverlay( dataSource, processingData.sourceResource, processingData.uriResolver, - true + true, ); if (defined(href)) { if (isLatLonQuad) { oneTimeWarning( "kml-gx:LatLonQuad", - "KML - gx:LatLonQuad Icon does not support texture projection." + "KML - gx:LatLonQuad Icon does not support texture projection.", ); } const x = queryNumericValue(iconNode, "x", namespaces.gx); @@ -2760,7 +2758,7 @@ function processGroundOverlay( if (defined(x) || defined(y) || defined(w) || defined(h)) { oneTimeWarning( "kml-groundOverlay-xywh", - "KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays" + "KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays", ); } @@ -2768,7 +2766,7 @@ function processGroundOverlay( geometry.material.color = queryColorValue( groundOverlay, "color", - namespaces.kml + namespaces.kml, ); geometry.material.transparent = true; } else { @@ -2778,7 +2776,7 @@ function processGroundOverlay( let altitudeMode = queryStringValue( groundOverlay, "altitudeMode", - namespaces.kml + namespaces.kml, ); if (defined(altitudeMode)) { @@ -2787,13 +2785,13 @@ function processGroundOverlay( geometry.height = queryNumericValue( groundOverlay, "altitude", - namespaces.kml + namespaces.kml, ); geometry.zIndex = undefined; } else if (altitudeMode !== "clampToGround") { oneTimeWarning( "kml-altitudeMode-unknown", - `KML - Unknown altitudeMode: ${altitudeMode}` + `KML - Unknown altitudeMode: ${altitudeMode}`, ); } // else just use the default of 0 until we support 'clampToGround' @@ -2801,28 +2799,28 @@ function processGroundOverlay( altitudeMode = queryStringValue( groundOverlay, "altitudeMode", - namespaces.gx + namespaces.gx, ); if (altitudeMode === "relativeToSeaFloor") { oneTimeWarning( "kml-altitudeMode-relativeToSeaFloor", - "KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute." + "KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute.", ); geometry.height = queryNumericValue( groundOverlay, "altitude", - namespaces.kml + namespaces.kml, ); geometry.zIndex = undefined; } else if (altitudeMode === "clampToSeaFloor") { oneTimeWarning( "kml-altitudeMode-clampToSeaFloor", - "KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround." + "KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround.", ); } else if (defined(altitudeMode)) { oneTimeWarning( "kml-altitudeMode-unknown", - `KML - Unknown altitudeMode: ${altitudeMode}` + `KML - Unknown altitudeMode: ${altitudeMode}`, ); } } @@ -2832,7 +2830,7 @@ function processUnsupportedFeature( dataSource, node, processingData, - deferredLoading + deferredLoading, ) { dataSource._unsupportedNode.raiseEvent( dataSource, @@ -2841,11 +2839,11 @@ function processUnsupportedFeature( processingData.entityCollection, processingData.styleCollection, processingData.sourceResource, - processingData.uriResolver + processingData.uriResolver, ); oneTimeWarning( `kml-unsupportedFeature-${node.nodeName}`, - `KML - Unsupported feature: ${node.nodeName}` + `KML - Unsupported feature: ${node.nodeName}`, ); } @@ -2879,7 +2877,7 @@ function processNetworkLinkQueryString( canvas, viewBoundScale, bbox, - ellipsoid + ellipsoid, ) { function fixLatitude(value) { if (value < -CesiumMath.PI_OVER_TWO) { @@ -2916,14 +2914,14 @@ function processNetworkLinkQueryString( centerCartesian = camera.pickEllipsoid( scratchCartesian2, ellipsoid, - scratchCartesian3 + scratchCartesian3, ); } if (defined(centerCartesian)) { centerCartographic = ellipsoid.cartesianToCartographic( centerCartesian, - scratchCartographic + scratchCartographic, ); } else { centerCartographic = Rectangle.center(bbox, scratchCartographic); @@ -2940,25 +2938,25 @@ function processNetworkLinkQueryString( fixLongitude(centerCartographic.longitude - newHalfWidth), fixLatitude(centerCartographic.latitude - newHalfHeight), fixLongitude(centerCartographic.longitude + newHalfWidth), - fixLatitude(centerCartographic.latitude + newHalfHeight) + fixLatitude(centerCartographic.latitude + newHalfHeight), ); } queryString = queryString.replace( "[bboxWest]", - CesiumMath.toDegrees(bbox.west).toString() + CesiumMath.toDegrees(bbox.west).toString(), ); queryString = queryString.replace( "[bboxSouth]", - CesiumMath.toDegrees(bbox.south).toString() + CesiumMath.toDegrees(bbox.south).toString(), ); queryString = queryString.replace( "[bboxEast]", - CesiumMath.toDegrees(bbox.east).toString() + CesiumMath.toDegrees(bbox.east).toString(), ); queryString = queryString.replace( "[bboxNorth]", - CesiumMath.toDegrees(bbox.north).toString() + CesiumMath.toDegrees(bbox.north).toString(), ); const lon = CesiumMath.toDegrees(centerCartographic.longitude).toString(); @@ -2967,35 +2965,35 @@ function processNetworkLinkQueryString( queryString = queryString.replace("[lookatLat]", lat); queryString = queryString.replace( "[lookatTilt]", - CesiumMath.toDegrees(camera.pitch).toString() + CesiumMath.toDegrees(camera.pitch).toString(), ); queryString = queryString.replace( "[lookatHeading]", - CesiumMath.toDegrees(camera.heading).toString() + CesiumMath.toDegrees(camera.heading).toString(), ); queryString = queryString.replace( "[lookatRange]", - Cartesian3.distance(camera.positionWC, centerCartesian) + Cartesian3.distance(camera.positionWC, centerCartesian), ); queryString = queryString.replace("[lookatTerrainLon]", lon); queryString = queryString.replace("[lookatTerrainLat]", lat); queryString = queryString.replace( "[lookatTerrainAlt]", - centerCartographic.height.toString() + centerCartographic.height.toString(), ); ellipsoid.cartesianToCartographic(camera.positionWC, scratchCartographic); queryString = queryString.replace( "[cameraLon]", - CesiumMath.toDegrees(scratchCartographic.longitude).toString() + CesiumMath.toDegrees(scratchCartographic.longitude).toString(), ); queryString = queryString.replace( "[cameraLat]", - CesiumMath.toDegrees(scratchCartographic.latitude).toString() + CesiumMath.toDegrees(scratchCartographic.latitude).toString(), ); queryString = queryString.replace( "[cameraAlt]", - CesiumMath.toDegrees(scratchCartographic.height).toString() + CesiumMath.toDegrees(scratchCartographic.height).toString(), ); const frustum = camera.frustum; @@ -3087,18 +3085,18 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { viewRefreshMode = queryStringValue( link, "viewRefreshMode", - namespaces.kml + namespaces.kml, ); if (viewRefreshMode === "onRegion") { oneTimeWarning( "kml-refrehMode-onRegion", - "KML - Unsupported viewRefreshMode: onRegion" + "KML - Unsupported viewRefreshMode: onRegion", ); return; } viewBoundScale = defaultValue( queryStringValue(link, "viewBoundScale", namespaces.kml), - 1.0 + 1.0, ); const defaultViewFormat = viewRefreshMode === "onStop" @@ -3106,7 +3104,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { : ""; const viewFormat = defaultValue( queryStringValue(link, "viewFormat", namespaces.kml), - defaultViewFormat + defaultViewFormat, ); const httpQuery = queryStringValue(link, "httpQuery", namespaces.kml); if (defined(viewFormat)) { @@ -3123,7 +3121,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { dataSource.canvas, viewBoundScale, dataSource._lastCameraView.bbox, - ellipsoid + ellipsoid, ); } @@ -3154,11 +3152,11 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { const refreshMode = queryStringValue( link, "refreshMode", - namespaces.kml + namespaces.kml, ); let refreshInterval = defaultValue( queryNumericValue(link, "refreshInterval", namespaces.kml), - 0 + 0, ); if ( (refreshMode === "onInterval" && refreshInterval > 0) || @@ -3168,7 +3166,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { const networkLinkControl = queryFirstNode( rootElement, "NetworkLinkControl", - namespaces.kml + namespaces.kml, ); const hasNetworkLinkControl = defined(networkLinkControl); @@ -3192,18 +3190,18 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { queryStringValue( networkLinkControl, "cookie", - namespaces.kml + namespaces.kml, ), - "" - ) + "", + ), ); minRefreshPeriod = defaultValue( queryNumericValue( networkLinkControl, "minRefreshPeriod", - namespaces.kml + namespaces.kml, ), - 0 + 0, ); } @@ -3219,7 +3217,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { expires = queryStringValue( networkLinkControl, "expires", - namespaces.kml + namespaces.kml, ); } if (defined(expires)) { @@ -3234,13 +3232,13 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { } catch (e) { oneTimeWarning( "kml-refreshMode-onInterval-onExpire", - "KML - NetworkLinkControl expires is not a valid date" + "KML - NetworkLinkControl expires is not a valid date", ); } } else { oneTimeWarning( "kml-refreshMode-onExpire", - "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element" + "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element", ); } } else if (defined(dataSource.camera)) { @@ -3248,12 +3246,12 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { networkLinkInfo.refreshMode = RefreshMode.STOP; networkLinkInfo.time = defaultValue( queryNumericValue(link, "viewRefreshTime", namespaces.kml), - 0 + 0, ); } else { oneTimeWarning( "kml-refrehMode-onStop-noCamera", - "A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined." + "A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined.", ); } @@ -3282,7 +3280,7 @@ function processFeatureNode(dataSource, node, processingData, deferredLoading) { dataSource, node, processingData, - deferredLoading + deferredLoading, ); } @@ -3293,7 +3291,7 @@ function loadKml( sourceResource, uriResolver, screenOverlayContainer, - context + context, ) { entityCollection.removeAll(); @@ -3321,8 +3319,8 @@ function loadKml( styleCollection, sourceResource, false, - uriResolver - ) + uriResolver, + ), ).then(function () { let element = kml.documentElement; if (element.localName === "kml") { @@ -3361,7 +3359,7 @@ function loadKmz( entityCollection, blob, sourceResource, - screenOverlayContainer + screenOverlayContainer, ) { const zWorkerUrl = buildModuleUrl("ThirdParty/Workers/z-worker-pako.js"); zip.configure({ @@ -3415,7 +3413,7 @@ function loadKmz( uriResolver.kml, sourceResource, uriResolver, - screenOverlayContainer + screenOverlayContainer, ); }); }); @@ -3463,7 +3461,7 @@ function load(dataSource, entityCollection, data, options) { entityCollection, dataToLoad, sourceUri, - screenOverlayContainer + screenOverlayContainer, ); } return readBlobAsText(dataToLoad).then(function (text) { @@ -3512,7 +3510,7 @@ function load(dataSource, entityCollection, data, options) { sourceUri, uriResolver, screenOverlayContainer, - context + context, ); }); }); @@ -3524,7 +3522,7 @@ function load(dataSource, entityCollection, data, options) { sourceUri, uriResolver, screenOverlayContainer, - context + context, ); }) .catch(function (error) { @@ -3892,8 +3890,8 @@ KmlDataSource.prototype.load = function (data, options) { clock.multiplier = Math.round( Math.min( Math.max(JulianDate.secondsDifference(stop, start) / 60, 1), - 3.15569e7 - ) + 3.15569e7, + ), ); } @@ -3953,7 +3951,7 @@ function getNetworkLinkUpdateCallback( networkLink, newEntityCollection, networkLinks, - processedHref + processedHref, ) { return function (rootElement) { if (!networkLinks.contains(networkLink.id)) { @@ -3965,7 +3963,7 @@ function getNetworkLinkUpdateCallback( const networkLinkControl = queryFirstNode( rootElement, "NetworkLinkControl", - namespaces.kml + namespaces.kml, ); const hasNetworkLinkControl = defined(networkLinkControl); @@ -3976,7 +3974,7 @@ function getNetworkLinkUpdateCallback( ) { oneTimeWarning( "kml-networkLinkControl-update", - "KML - NetworkLinkControl updates aren't supported." + "KML - NetworkLinkControl updates aren't supported.", ); networkLink.updating = false; networkLinks.remove(networkLink.id); @@ -3985,16 +3983,16 @@ function getNetworkLinkUpdateCallback( networkLink.cookie = queryToObject( defaultValue( queryStringValue(networkLinkControl, "cookie", namespaces.kml), - "" - ) + "", + ), ); minRefreshPeriod = defaultValue( queryNumericValue( networkLinkControl, "minRefreshPeriod", - namespaces.kml + namespaces.kml, ), - 0 + 0, ); } @@ -4010,7 +4008,7 @@ function getNetworkLinkUpdateCallback( expires = queryStringValue( networkLinkControl, "expires", - namespaces.kml + namespaces.kml, ); } if (defined(expires)) { @@ -4024,14 +4022,14 @@ function getNetworkLinkUpdateCallback( } catch (e) { oneTimeWarning( "kml-networkLinkControl-expires", - "KML - NetworkLinkControl expires is not a valid date" + "KML - NetworkLinkControl expires is not a valid date", ); remove = true; } } else { oneTimeWarning( "kml-refreshMode-onExpire", - "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element" + "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element", ); remove = true; } @@ -4102,7 +4100,7 @@ function getNetworkLinkUpdateCallback( networkLink.needsUpdate = false; dataSource._refresh.raiseEvent( dataSource, - processedHref.getUrlComponent(true) + processedHref.getUrlComponent(true), ); }; } @@ -4144,11 +4142,11 @@ KmlDataSource.prototype.update = function (time) { !( camera.positionWC.equalsEpsilon( lastCameraView.position, - CesiumMath.EPSILON7 + CesiumMath.EPSILON7, ) && camera.directionWC.equalsEpsilon( lastCameraView.direction, - CesiumMath.EPSILON7 + CesiumMath.EPSILON7, ) && camera.upWC.equalsEpsilon(lastCameraView.up, CesiumMath.EPSILON7) ) @@ -4211,7 +4209,7 @@ KmlDataSource.prototype.update = function (time) { that.canvas, networkLink.viewBoundScale, lastCameraView.bbox, - ellipsoid + ellipsoid, ); load(that, newEntityCollection, href, { @@ -4223,8 +4221,8 @@ KmlDataSource.prototype.update = function (time) { networkLink, newEntityCollection, newNetworkLinks, - href - ) + href, + ), ) .catch(function (error) { const msg = `NetworkLink ${networkLink.href} refresh failed: ${error}`; diff --git a/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js b/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js index 1e35d2f25a9d..47ca6538e4c1 100644 --- a/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js +++ b/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js @@ -25,17 +25,11 @@ import createCommand from "../createCommand.js"; * @exception {DeveloperError} terrainProviderViewModels must be an array. */ function BaseLayerPickerViewModel(options) { - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; const globe = options.globe; - const imageryProviderViewModels = defaultValue( - options.imageryProviderViewModels, - [] - ); - const terrainProviderViewModels = defaultValue( - options.terrainProviderViewModels, - [] - ); + const imageryProviderViewModels = options.imageryProviderViewModels ?? []; + const terrainProviderViewModels = options.terrainProviderViewModels ?? []; //>>includeStart('debug', pragmas.debug); if (!defined(globe)) { @@ -74,7 +68,7 @@ function BaseLayerPickerViewModel(options) { const imageryObservable = knockout.getObservable( this, - "imageryProviderViewModels" + "imageryProviderViewModels", ); const imageryProviders = knockout.pureComputed(function () { const providers = imageryObservable(); @@ -105,7 +99,7 @@ function BaseLayerPickerViewModel(options) { const terrainObservable = knockout.getObservable( this, - "terrainProviderViewModels" + "terrainProviderViewModels", ); const terrainProviders = knockout.pureComputed(function () { const providers = terrainObservable(); @@ -269,12 +263,11 @@ function BaseLayerPickerViewModel(options) { this._globe.terrainProvider = newProvider; } else if (defined(newProvider)) { let cancelUpdate = false; - const removeCancelListener = this._globe.terrainProviderChanged.addEventListener( - () => { + const removeCancelListener = + this._globe.terrainProviderChanged.addEventListener(() => { cancelUpdate = true; removeCancelListener(); - } - ); + }); const terrain = new Terrain(newProvider); const removeEventListener = terrain.readyEvent.addEventListener( @@ -289,7 +282,7 @@ function BaseLayerPickerViewModel(options) { ); this._globe.terrainProvider = terrainProvider; removeEventListener(); - } + }, ); } @@ -303,10 +296,8 @@ function BaseLayerPickerViewModel(options) { that.dropDownVisible = !that.dropDownVisible; }); - this.selectedImagery = defaultValue( - options.selectedImageryProviderViewModel, - imageryProviderViewModels[0] - ); + this.selectedImagery = + options.selectedImageryProviderViewModel ?? imageryProviderViewModels[0]; this.selectedTerrain = options.selectedTerrainProviderViewModel; } diff --git a/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js b/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js index 0e43a3ce5f58..8ac79343f2db 100644 --- a/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js +++ b/packages/widgets/Source/BaseLayerPicker/ProviderViewModel.js @@ -1,4 +1,4 @@ -import { defaultValue, defined, DeveloperError } from "@cesium/engine"; +import { defined, DeveloperError } from "@cesium/engine"; import knockout from "../ThirdParty/knockout.js"; import createCommand from "../createCommand.js"; @@ -61,7 +61,7 @@ function ProviderViewModel(options) { */ this.iconUrl = options.iconUrl; - this._category = defaultValue(options.category, ""); + this._category = options.category ?? ""; knockout.track(this, ["name", "tooltip", "iconUrl"]); } diff --git a/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js b/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js index 15e01ec5ba1f..7e4b3e09f414 100644 --- a/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js +++ b/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -71,19 +70,19 @@ function FullscreenButtonViewModel(fullscreenElement, container) { return tmpIsFullscreen() ? "Exit full screen" : "Full screen"; }); - this._command = createCommand(function () { - if (Fullscreen.fullscreen) { - Fullscreen.exitFullscreen(); - } else { - Fullscreen.requestFullscreen(that._fullscreenElement); - } - }, knockout.getObservable(this, "isFullscreenEnabled")); - - this._fullscreenElement = defaultValue( - getElement(fullscreenElement), - ownerDocument.body + this._command = createCommand( + function () { + if (Fullscreen.fullscreen) { + Fullscreen.exitFullscreen(); + } else { + Fullscreen.requestFullscreen(that._fullscreenElement); + } + }, + knockout.getObservable(this, "isFullscreenEnabled"), ); + this._fullscreenElement = getElement(fullscreenElement) ?? ownerDocument.body; + this._callback = function () { tmpIsFullscreen(Fullscreen.fullscreen); }; diff --git a/packages/widgets/Source/Geocoder/GeocoderViewModel.js b/packages/widgets/Source/Geocoder/GeocoderViewModel.js index 97b48677a014..865b2e0db705 100644 --- a/packages/widgets/Source/Geocoder/GeocoderViewModel.js +++ b/packages/widgets/Source/Geocoder/GeocoderViewModel.js @@ -1,6 +1,5 @@ import { computeFlyToLocationForRectangle, - defaultValue, defined, DeveloperError, destroyObject, @@ -71,7 +70,7 @@ function GeocoderViewModel(options) { }); this._searchCommand = createCommand(function (geocodeType) { - geocodeType = defaultValue(geocodeType, GeocodeType.SEARCH); + geocodeType = geocodeType ?? GeocodeType.SEARCH; that._focusTextbox = false; if (defined(that._selectedSuggestion)) { that.activateSuggestion(that._selectedSuggestion); @@ -153,16 +152,14 @@ function GeocoderViewModel(options) { * @type {boolean} * @default true */ - this.autoComplete = defaultValue(options.autocomplete, true); + this.autoComplete = options.autocomplete ?? true; /** * Gets and sets the command called when a geocode destination is found * @type {Geocoder.DestinationFoundFunction} */ - this.destinationFound = defaultValue( - options.destinationFound, - GeocoderViewModel.flyToDestination - ); + this.destinationFound = + options.destinationFound ?? GeocoderViewModel.flyToDestination; this._focusTextbox = false; @@ -318,7 +315,7 @@ function handleArrowUp(viewModel) { return; } const currentIndex = viewModel._suggestions.indexOf( - viewModel._selectedSuggestion + viewModel._selectedSuggestion, ); if (currentIndex === -1 || currentIndex === 0) { viewModel._selectedSuggestion = undefined; @@ -335,7 +332,7 @@ function handleArrowDown(viewModel) { } const numberOfSuggestions = viewModel._suggestions.length; const currentIndex = viewModel._suggestions.indexOf( - viewModel._selectedSuggestion + viewModel._selectedSuggestion, ); const next = (currentIndex + 1) % numberOfSuggestions; viewModel._selectedSuggestion = viewModel._suggestions[next]; @@ -358,7 +355,7 @@ function computeFlyToLocationForCartographic(cartographic, terrainProvider) { cartographic = positionOnTerrain[0]; cartographic.height += DEFAULT_HEIGHT; return cartographic; - } + }, ); } @@ -377,12 +374,12 @@ function flyToDestination(viewModel, destination) { CesiumMath.equalsEpsilon( destination.south, destination.north, - CesiumMath.EPSILON7 + CesiumMath.EPSILON7, ) && CesiumMath.equalsEpsilon( destination.east, destination.west, - CesiumMath.EPSILON7 + CesiumMath.EPSILON7, ) ) { // destination is now a Cartographic @@ -474,7 +471,7 @@ async function geocode(viewModel, geocoderServices, geocodeType) { viewModel.destinationFound(viewModel, geocoderResults[0].destination); const credits = updateCredits( viewModel, - GeocoderService.getCreditsFromResult(geocoderResults[0]) + GeocoderService.getCreditsFromResult(geocoderResults[0]), ); // If the result does not contain any credits, default to the service credit. if (!defined(credits)) { diff --git a/packages/widgets/Source/InspectorShared.js b/packages/widgets/Source/InspectorShared.js index 25e4d1326b85..eafb8151c602 100644 --- a/packages/widgets/Source/InspectorShared.js +++ b/packages/widgets/Source/InspectorShared.js @@ -1,4 +1,4 @@ -import { Check, defaultValue, defined } from "@cesium/engine"; +import { Check, defined } from "@cesium/engine"; /** * A static class with helper functions used by CesiumInspector, Cesium3DTilesInspector, and VoxelInspector @@ -16,7 +16,7 @@ const InspectorShared = {}; InspectorShared.createCheckbox = function ( labelText, checkedBinding, - enableBinding + enableBinding, ) { //>>includeStart('debug', pragmas.debug); Check.typeOf.string("labelText", labelText); @@ -50,7 +50,7 @@ InspectorShared.createSection = function ( panel, headerText, sectionVisibleBinding, - toggleSectionVisibilityBinding + toggleSectionVisibilityBinding, ) { //>>includeStart('debug', pragmas.debug); Check.defined("panel", panel); @@ -58,14 +58,14 @@ InspectorShared.createSection = function ( Check.typeOf.string("sectionVisibleBinding", sectionVisibleBinding); Check.typeOf.string( "toggleSectionVisibilityBinding", - toggleSectionVisibilityBinding + toggleSectionVisibilityBinding, ); //>>includeEnd('debug'); const section = document.createElement("div"); section.className = "cesium-cesiumInspector-section"; section.setAttribute( "data-bind", - `css: { "cesium-cesiumInspector-section-collapsed": !${sectionVisibleBinding} }` + `css: { "cesium-cesiumInspector-section-collapsed": !${sectionVisibleBinding} }`, ); panel.appendChild(section); @@ -74,7 +74,7 @@ InspectorShared.createSection = function ( sectionHeader.appendChild(document.createTextNode(headerText)); sectionHeader.setAttribute( "data-bind", - `click: ${toggleSectionVisibilityBinding}` + `click: ${toggleSectionVisibilityBinding}`, ); section.appendChild(sectionHeader); @@ -100,7 +100,7 @@ InspectorShared.createRangeInput = function ( min, max, step, - inputValueBinding + inputValueBinding, ) { //>>includeStart('debug', pragmas.debug); Check.typeOf.string("rangeText", rangeText); @@ -109,7 +109,7 @@ InspectorShared.createRangeInput = function ( Check.typeOf.number("max", max); //>>includeEnd('debug'); - inputValueBinding = defaultValue(inputValueBinding, sliderValueBinding); + inputValueBinding = inputValueBinding ?? sliderValueBinding; const input = document.createElement("input"); input.setAttribute("data-bind", `value: ${inputValueBinding}`); input.type = "number"; @@ -118,10 +118,10 @@ InspectorShared.createRangeInput = function ( slider.type = "range"; slider.min = min; slider.max = max; - slider.step = defaultValue(step, "any"); + slider.step = step ?? "any"; slider.setAttribute( "data-bind", - `valueUpdate: "input", value: ${sliderValueBinding}` + `valueUpdate: "input", value: ${sliderValueBinding}`, ); const wrapper = document.createElement("div"); @@ -146,7 +146,7 @@ InspectorShared.createRangeInput = function ( InspectorShared.createButton = function ( buttonText, clickedBinding, - activeBinding + activeBinding, ) { //>>includeStart('debug', pragmas.debug); Check.typeOf.string("buttonText", buttonText); diff --git a/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js b/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js index 05b7573eb54d..861861f1ef43 100644 --- a/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js +++ b/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js @@ -1,6 +1,5 @@ import { buildModuleUrl, - defaultValue, defined, destroyObject, DeveloperError, @@ -42,11 +41,7 @@ function NavigationHelpButton(options) { const viewModel = new NavigationHelpButtonViewModel(); - const showInsructionsDefault = defaultValue( - options.instructionsInitiallyVisible, - false - ); - viewModel.showInstructions = showInsructionsDefault; + viewModel.showInstructions = options.instructionsInitiallyVisible ?? false; viewModel._svgPath = "M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z"; @@ -64,7 +59,7 @@ function NavigationHelpButton(options) { "\ attr: { title: tooltip },\ click: command,\ -cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" +cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", ); wrapper.appendChild(button); @@ -72,7 +67,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" instructionContainer.className = "cesium-navigation-help"; instructionContainer.setAttribute( "data-bind", - 'css: { "cesium-navigation-help-visible" : showInstructions}' + 'css: { "cesium-navigation-help-visible" : showInstructions}', ); wrapper.appendChild(instructionContainer); @@ -82,7 +77,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" "cesium-navigation-button cesium-navigation-button-left"; mouseButton.setAttribute( "data-bind", - 'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}' + 'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}', ); const mouseIcon = document.createElement("img"); mouseIcon.src = buildModuleUrl("Widgets/Images/NavigationHelp/Mouse.svg"); @@ -98,7 +93,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" "cesium-navigation-button cesium-navigation-button-right"; touchButton.setAttribute( "data-bind", - 'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}' + 'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}', ); const touchIcon = document.createElement("img"); touchIcon.src = buildModuleUrl("Widgets/Images/NavigationHelp/Touch.svg"); @@ -116,13 +111,13 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" "cesium-click-navigation-help cesium-navigation-help-instructions"; clickInstructions.setAttribute( "data-bind", - 'css: { "cesium-click-navigation-help-visible" : !_touch}' + 'css: { "cesium-click-navigation-help-visible" : !_touch}', ); clickInstructions.innerHTML = `\ \ \ \ \ \ \ \ \ \
\
Pan view
\ @@ -131,7 +126,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"
\
Zoom view
\ @@ -141,7 +136,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"
\
Rotate view
\ @@ -158,13 +153,13 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" "cesium-touch-navigation-help cesium-navigation-help-instructions"; touchInstructions.setAttribute( "data-bind", - 'css: { "cesium-touch-navigation-help-visible" : _touch}' + 'css: { "cesium-touch-navigation-help-visible" : _touch}', ); touchInstructions.innerHTML = `\ \ \ \ \ \ \ \ \ \ \ \ \ `; } text += "
\
Pan view
\ @@ -173,7 +168,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"
\
Zoom view
\ @@ -182,7 +177,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"
\
Tilt view
\ @@ -191,7 +186,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"
\
Rotate view
\ diff --git a/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js b/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js index 5f0fd411344b..9294c7c5de07 100644 --- a/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js +++ b/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -33,10 +32,10 @@ function PerformanceWatchdogViewModel(options) { * Gets or sets the message to display when a low frame rate is detected. This string will be interpreted as HTML. * @type {string} */ - this.lowFrameRateMessage = defaultValue( - options.lowFrameRateMessage, - "This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers." - ); + this.lowFrameRateMessage = + options.lowFrameRateMessage ?? + "This application appears to be performing poorly on your system. " + + "Please try using a different web browser or updating your video drivers."; /** * Gets or sets a value indicating whether the low frame rate message has previously been dismissed by the user. If it has @@ -70,13 +69,13 @@ function PerformanceWatchdogViewModel(options) { if (!that.lowFrameRateMessageDismissed) { that.showingLowFrameRateMessage = true; } - } + }, ); this._unsubscribeNominalFrameRate = monitor.nominalFrameRate.addEventListener( function () { that.showingLowFrameRateMessage = false; - } + }, ); } diff --git a/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js b/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js index 33884b8902ff..84f2a48f954d 100644 --- a/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js +++ b/packages/widgets/Source/SceneModePicker/SceneModePickerViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -36,7 +35,7 @@ function SceneModePickerViewModel(scene, duration) { this._eventHelper = new EventHelper(); this._eventHelper.add(scene.morphStart, morphStart); - this._duration = defaultValue(duration, 2.0); + this._duration = duration ?? 2.0; /** * Gets or sets the current SceneMode. This property is observable. diff --git a/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js b/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js index d6ba66c211ec..0156030dacea 100644 --- a/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js +++ b/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js @@ -1,6 +1,5 @@ import { Cartesian2, - defaultValue, defined, DeveloperError, EasingFunction, @@ -23,7 +22,7 @@ const offScreen = "-1000px"; function SelectionIndicatorViewModel( scene, selectionIndicatorElement, - container + container, ) { //>>includeStart('debug', pragmas.debug); if (!defined(scene)) { @@ -43,7 +42,7 @@ function SelectionIndicatorViewModel( this._screenPositionX = offScreen; this._screenPositionY = offScreen; this._tweens = scene.tweens; - this._container = defaultValue(container, document.body); + this._container = container ?? document.body; this._selectionIndicatorElement = selectionIndicatorElement; this._scale = 1; @@ -110,7 +109,7 @@ SelectionIndicatorViewModel.prototype.update = function () { if (this.showSelection && defined(this.position)) { const screenPosition = this.computeScreenSpacePosition( this.position, - screenSpacePos + screenSpacePos, ); if (!defined(screenPosition)) { this._screenPositionX = offScreen; @@ -125,12 +124,12 @@ SelectionIndicatorViewModel.prototype.update = function () { screenPosition.x = Math.min( Math.max(screenPosition.x, -indicatorSize), - containerWidth + indicatorSize + containerWidth + indicatorSize, ) - halfSize; screenPosition.y = Math.min( Math.max(screenPosition.y, -indicatorSize), - containerHeight + indicatorSize + containerHeight + indicatorSize, ) - halfSize; this._screenPositionX = `${Math.floor(screenPosition.x + 0.25)}px`; diff --git a/packages/widgets/Source/Timeline/TimelineHighlightRange.js b/packages/widgets/Source/Timeline/TimelineHighlightRange.js index 0d2baec78599..81a8554ddeae 100644 --- a/packages/widgets/Source/Timeline/TimelineHighlightRange.js +++ b/packages/widgets/Source/Timeline/TimelineHighlightRange.js @@ -1,4 +1,4 @@ -import { defaultValue, JulianDate } from "@cesium/engine"; +import { JulianDate } from "@cesium/engine"; /** * @private @@ -6,7 +6,7 @@ import { defaultValue, JulianDate } from "@cesium/engine"; function TimelineHighlightRange(color, heightInPx, base) { this._color = color; this._height = heightInPx; - this._base = defaultValue(base, 0); + this._base = base ?? 0; } TimelineHighlightRange.prototype.getHeight = function () { @@ -35,18 +35,18 @@ TimelineHighlightRange.prototype.render = function (renderState) { if (this._start && this._stop && this._color) { const highlightStart = JulianDate.secondsDifference( this._start, - renderState.epochJulian + renderState.epochJulian, ); let highlightLeft = Math.round( - renderState.timeBarWidth * renderState.getAlpha(highlightStart) + renderState.timeBarWidth * renderState.getAlpha(highlightStart), ); const highlightStop = JulianDate.secondsDifference( this._stop, - renderState.epochJulian + renderState.epochJulian, ); let highlightWidth = Math.round( - renderState.timeBarWidth * renderState.getAlpha(highlightStop) + renderState.timeBarWidth * renderState.getAlpha(highlightStop), ) - highlightLeft; if (highlightLeft < 0) { highlightWidth += highlightLeft; diff --git a/packages/widgets/Source/ToggleButtonViewModel.js b/packages/widgets/Source/ToggleButtonViewModel.js index b8f339a16e5c..fc5ce62b807b 100644 --- a/packages/widgets/Source/ToggleButtonViewModel.js +++ b/packages/widgets/Source/ToggleButtonViewModel.js @@ -20,21 +20,21 @@ function ToggleButtonViewModel(command, options) { this._command = command; - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; /** * Gets or sets whether the button is currently toggled. This property is observable. * @type {boolean} * @default false */ - this.toggled = defaultValue(options.toggled, false); + this.toggled = options.toggled ?? false; /** * Gets or sets the button's tooltip. This property is observable. * @type {string} * @default '' */ - this.tooltip = defaultValue(options.tooltip, ""); + this.tooltip = options.tooltip ?? ""; knockout.track(this, ["toggled", "tooltip"]); } diff --git a/packages/widgets/Source/VRButton/VRButtonViewModel.js b/packages/widgets/Source/VRButton/VRButtonViewModel.js index 1f5697fbb39e..55e3e8efb58c 100644 --- a/packages/widgets/Source/VRButton/VRButtonViewModel.js +++ b/packages/widgets/Source/VRButton/VRButtonViewModel.js @@ -1,5 +1,4 @@ import { - defaultValue, defined, destroyObject, DeveloperError, @@ -149,11 +148,14 @@ function VRButtonViewModel(scene, vrElement) { this._locked = false; this._noSleep = new NoSleep(); - this._command = createCommand(function () { - toggleVR(that, scene, isVRMode, isOrthographic); - }, knockout.getObservable(this, "isVREnabled")); + this._command = createCommand( + function () { + toggleVR(that, scene, isVRMode, isOrthographic); + }, + knockout.getObservable(this, "isVREnabled"), + ); - this._vrElement = defaultValue(getElement(vrElement), document.body); + this._vrElement = getElement(vrElement) ?? document.body; this._callback = function () { if (!Fullscreen.fullscreen && isVRMode()) { diff --git a/packages/widgets/Source/Viewer/Viewer.js b/packages/widgets/Source/Viewer/Viewer.js index 20572ebece87..14dff625f1da 100644 --- a/packages/widgets/Source/Viewer/Viewer.js +++ b/packages/widgets/Source/Viewer/Viewer.js @@ -116,7 +116,7 @@ function getCesium3DTileFeatureName(feature) { function pickEntity(viewer, e) { const picked = viewer.scene.pick(e.position); if (defined(picked)) { - const id = defaultValue(picked.id, picked.primitive.id); + const id = picked.id ?? picked.primitive.id; if (id instanceof Entity) { return id; } @@ -152,7 +152,7 @@ function trackDataSourceClock(timeline, clock, dataSource) { stopTime = JulianDate.addSeconds( startTime, CesiumMath.EPSILON2, - scratchStopTime + scratchStopTime, ); } timeline.updateFromClock(); @@ -167,10 +167,8 @@ const cartesian3Scratch = new Cartesian3(); function pickImageryLayerFeature(viewer, windowPosition) { const scene = viewer.scene; const pickRay = scene.camera.getPickRay(windowPosition); - const imageryLayerFeaturePromise = scene.imageryLayers.pickImageryLayerFeatures( - pickRay, - scene - ); + const imageryLayerFeaturePromise = + scene.imageryLayers.pickImageryLayerFeatures(pickRay, scene); if (!defined(imageryLayerFeaturePromise)) { return; } @@ -204,7 +202,7 @@ function pickImageryLayerFeature(viewer, windowPosition) { if (defined(feature.position)) { const ecfPosition = viewer.scene.ellipsoid.cartographicToCartesian( feature.position, - cartesian3Scratch + cartesian3Scratch, ); entity.position = new ConstantPositionProperty(ecfPosition); } @@ -217,7 +215,7 @@ function pickImageryLayerFeature(viewer, windowPosition) { return; } viewer.selectedEntity = createNoFeaturesEntity(); - } + }, ); return loadingMessage; @@ -418,7 +416,7 @@ function Viewer(container, options) { //>>includeEnd('debug'); container = getElement(container); - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; const createBaseLayerPicker = (!defined(options.globe) || options.globe !== false) && @@ -432,7 +430,7 @@ function Viewer(container, options) { ) { throw new DeveloperError( "options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. \ -Either specify options.baseLayer instead or set options.baseLayerPicker to true." +Either specify options.baseLayer instead or set options.baseLayerPicker to true.", ); } @@ -443,7 +441,7 @@ Either specify options.baseLayer instead or set options.baseLayerPicker to true. ) { throw new DeveloperError( "options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. \ -Either specify options.terrainProvider instead or set options.baseLayerPicker to true." +Either specify options.terrainProvider instead or set options.baseLayerPicker to true.", ); } //>>includeEnd('debug') @@ -465,7 +463,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(bottomContainer); - const scene3DOnly = defaultValue(options.scene3DOnly, false); + const scene3DOnly = options.scene3DOnly ?? false; let clock; let clockViewModel; @@ -551,7 +549,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(selectionIndicatorContainer); selectionIndicator = new SelectionIndicator( selectionIndicatorContainer, - scene + scene, ); } @@ -567,12 +565,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( infoBoxViewModel.cameraClicked, Viewer.prototype._onInfoBoxCameraClicked, - this + this, ); eventHelper.add( infoBoxViewModel.closeClicked, Viewer.prototype._onInfoBoxClockClicked, - this + this, ); } @@ -602,7 +600,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( geocoder.viewModel.search.beforeExecute, Viewer.prototype._clearObjects, - this + this, ); } @@ -623,7 +621,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( homeButton.viewModel.command.beforeExecute, Viewer.prototype._clearTrackedObject, - this + this, ); } @@ -633,7 +631,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //>>includeStart('debug', pragmas.debug); if (options.sceneModePicker === true && scene3DOnly) { throw new DeveloperError( - "options.sceneModePicker is not available when options.scene3DOnly is set to true." + "options.sceneModePicker is not available when options.scene3DOnly is set to true.", ); } //>>includeEnd('debug'); @@ -655,14 +653,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to let baseLayerPicker; let baseLayerPickerDropDown; if (createBaseLayerPicker) { - const imageryProviderViewModels = defaultValue( - options.imageryProviderViewModels, - createDefaultImageryProviderViewModels() - ); - const terrainProviderViewModels = defaultValue( - options.terrainProviderViewModels, - createDefaultTerrainProviderViewModels() - ); + const imageryProviderViewModels = + options.imageryProviderViewModels ?? + createDefaultImageryProviderViewModels(); + const terrainProviderViewModels = + options.terrainProviderViewModels ?? + createDefaultTerrainProviderViewModels; baseLayerPicker = new BaseLayerPicker(toolbar, { globe: scene.globe, @@ -676,7 +672,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //Grab the dropdown for resize code. const elements = toolbar.getElementsByClassName( - "cesium-baseLayerPicker-dropDown" + "cesium-baseLayerPicker-dropDown", ); baseLayerPickerDropDown = elements[0]; } @@ -701,7 +697,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //>>includeStart('debug', pragmas.debug); if (defined(options.terrainProvider)) { throw new DeveloperError( - "Specify either options.terrainProvider or options.terrain." + "Specify either options.terrainProvider or options.terrain.", ); } //>>includeEnd('debug') @@ -725,7 +721,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //window.localStorage is null if disabled in Firefox or undefined in browsers with implementation if (defined(window.localStorage)) { const hasSeenNavHelp = window.localStorage.getItem( - "cesium-hasSeenNavHelp" + "cesium-hasSeenNavHelp", ); if (defined(hasSeenNavHelp) && Boolean(hasSeenNavHelp)) { showNavHelp = false; @@ -739,10 +735,8 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to } navigationHelpButton = new NavigationHelpButton({ container: toolbar, - instructionsInitiallyVisible: defaultValue( - options.navigationInstructionsInitiallyVisible, - showNavHelp - ), + instructionsInitiallyVisible: + options.navigationInstructionsInitiallyVisible ?? showNavHelp, }); } @@ -754,7 +748,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(animationContainer); animation = new Animation( animationContainer, - new AnimationViewModel(clockViewModel) + new AnimationViewModel(clockViewModel), ); } @@ -782,7 +776,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(fullscreenContainer); fullscreenButton = new FullscreenButton( fullscreenContainer, - options.fullscreenElement + options.fullscreenElement, ); //Subscribe to fullscreenButton.viewModel.isFullscreenEnabled so @@ -798,7 +792,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to timeline.container.style.right = `${fullscreenContainer.clientWidth}px`; timeline.resize(); } - } + }, ); } @@ -824,7 +818,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to timeline.container.style.right = `${vrContainer.clientWidth}px`; timeline.resize(); } - } + }, ); vrModeSubscription = subscribeAndEvaluate( @@ -832,7 +826,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to "isVRMode", function (isVRMode) { enableVRUI(that, isVRMode); - } + }, ); } @@ -843,10 +837,8 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to this._vrSubscription = vrSubscription; this._vrModeSubscription = vrModeSubscription; this._dataSourceChangedListeners = {}; - this._automaticallyTrackDataSourceClocks = defaultValue( - options.automaticallyTrackDataSourceClocks, - true - ); + this._automaticallyTrackDataSourceClocks = + options.automaticallyTrackDataSourceClocks ?? true; this._container = container; this._bottomContainer = bottomContainer; this._element = viewerContainer; @@ -896,12 +888,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( dataSourceCollection.dataSourceAdded, Viewer.prototype._onDataSourceAdded, - this + this, ); eventHelper.add( dataSourceCollection.dataSourceRemoved, Viewer.prototype._onDataSourceRemoved, - this + this, ); // Prior to each render, check if anything needs to be resized. @@ -921,12 +913,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( dataSourceCollection.dataSourceAdded, Viewer.prototype._dataSourceAdded, - this + this, ); eventHelper.add( dataSourceCollection.dataSourceRemoved, Viewer.prototype._dataSourceRemoved, - this + this, ); // Subscribe to left clicks and zoom to the picked object. @@ -952,11 +944,11 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to cesiumWidget.screenSpaceEventHandler.setInputAction( pickAndSelectObject, - ScreenSpaceEventType.LEFT_CLICK + ScreenSpaceEventType.LEFT_CLICK, ); cesiumWidget.screenSpaceEventHandler.setInputAction( pickAndTrackObject, - ScreenSpaceEventType.LEFT_DOUBLE_CLICK + ScreenSpaceEventType.LEFT_DOUBLE_CLICK, ); } @@ -1746,10 +1738,10 @@ Viewer.prototype.destroy = function () { !this.screenSpaceEventHandler.isDestroyed() ) { this.screenSpaceEventHandler.removeInputAction( - ScreenSpaceEventType.LEFT_CLICK + ScreenSpaceEventType.LEFT_CLICK, ); this.screenSpaceEventHandler.removeInputAction( - ScreenSpaceEventType.LEFT_DOUBLE_CLICK + ScreenSpaceEventType.LEFT_DOUBLE_CLICK, ); } @@ -1795,7 +1787,7 @@ Viewer.prototype.destroy = function () { this._timeline.removeEventListener( "settime", onTimelineScrubfunction, - false + false, ); this._element.removeChild(this._timeline.container); this._timeline = this._timeline.destroy(); @@ -1842,12 +1834,12 @@ Viewer.prototype.destroy = function () { */ Viewer.prototype._dataSourceAdded = function ( dataSourceCollection, - dataSource + dataSource, ) { const entityCollection = dataSource.entities; entityCollection.collectionChanged.addEventListener( Viewer.prototype._onEntityCollectionChanged, - this + this, ); }; @@ -1856,12 +1848,12 @@ Viewer.prototype._dataSourceAdded = function ( */ Viewer.prototype._dataSourceRemoved = function ( dataSourceCollection, - dataSource + dataSource, ) { const entityCollection = dataSource.entities; entityCollection.collectionChanged.removeEventListener( Viewer.prototype._onEntityCollectionChanged, - this + this, ); if (defined(this.trackedEntity)) { @@ -1898,7 +1890,7 @@ Viewer.prototype._onTick = function (clock) { const trackedState = this._dataSourceDisplay.getBoundingSphere( trackedEntity, false, - boundingSphereScratch + boundingSphereScratch, ); if (trackedState === BoundingSphereState.DONE) { entityView.update(time, boundingSphereScratch); @@ -1918,7 +1910,7 @@ Viewer.prototype._onTick = function (clock) { const state = this._dataSourceDisplay.getBoundingSphere( selectedEntity, true, - boundingSphereScratch + boundingSphereScratch, ); if (state !== BoundingSphereState.FAILED) { position = boundingSphereScratch.center; @@ -1934,7 +1926,7 @@ Viewer.prototype._onTick = function (clock) { if (defined(selectionIndicatorViewModel)) { selectionIndicatorViewModel.position = Cartesian3.clone( position, - selectionIndicatorViewModel.position + selectionIndicatorViewModel.position, ); selectionIndicatorViewModel.showSelection = showSelection && enableCamera; selectionIndicatorViewModel.update(); @@ -1950,14 +1942,11 @@ Viewer.prototype._onTick = function (clock) { this.trackedEntity === this.selectedEntity; if (showSelection) { - infoBoxViewModel.titleText = defaultValue( - selectedEntity.name, - selectedEntity.id - ); + infoBoxViewModel.titleText = selectedEntity.name ?? selectedEntity.id; infoBoxViewModel.description = Property.getValueOrDefault( selectedEntity.description, time, - "" + "", ); } else { infoBoxViewModel.titleText = ""; @@ -1972,7 +1961,7 @@ Viewer.prototype._onTick = function (clock) { Viewer.prototype._onEntityCollectionChanged = function ( collection, added, - removed + removed, ) { const length = removed.length; for (let i = 0; i < length; i++) { @@ -2042,7 +2031,7 @@ Viewer.prototype._onDataSourceChanged = function (dataSource) { */ Viewer.prototype._onDataSourceAdded = function ( dataSourceCollection, - dataSource + dataSource, ) { if (this._automaticallyTrackDataSourceClocks) { this.clockTrackedDataSource = dataSource; @@ -2051,7 +2040,7 @@ Viewer.prototype._onDataSourceAdded = function ( const removalFunc = this._eventHelper.add( dataSource.changedEvent, Viewer.prototype._onDataSourceChanged, - this + this, ); this._dataSourceChangedListeners[id] = removalFunc; }; @@ -2061,7 +2050,7 @@ Viewer.prototype._onDataSourceAdded = function ( */ Viewer.prototype._onDataSourceRemoved = function ( dataSourceCollection, - dataSource + dataSource, ) { const resetClock = this.clockTrackedDataSource === dataSource; const id = dataSource.entities.id; @@ -2071,7 +2060,7 @@ Viewer.prototype._onDataSourceRemoved = function ( const numDataSources = dataSourceCollection.length; if (this._automaticallyTrackDataSourceClocks && numDataSources > 0) { this.clockTrackedDataSource = dataSourceCollection.get( - numDataSources - 1 + numDataSources - 1, ); } else { this.clockTrackedDataSource = undefined; @@ -2215,7 +2204,7 @@ function zoomToOrFly(that, zoomTarget, options, isFlight) { } //If zoomTarget is an EntityCollection, this will retrieve the array - zoomTarget = defaultValue(zoomTarget.values, zoomTarget); + zoomTarget = zoomTarget.values ?? zoomTarget; //If zoomTarget is a DataSource, this will retrieve the array. if (defined(zoomTarget.entities)) { @@ -2265,7 +2254,7 @@ function updateZoomTarget(viewer) { const scene = viewer.scene; const camera = scene.camera; - const zoomOptions = defaultValue(viewer._zoomOptions, {}); + const zoomOptions = viewer._zoomOptions ?? {}; let options; function zoomToBoundingSphere(boundingSphere) { // If offset was originally undefined then give it base value instead of empty object @@ -2273,7 +2262,7 @@ function updateZoomTarget(viewer) { zoomOptions.offset = new HeadingPitchRange( 0.0, -0.5, - boundingSphere.radius + boundingSphere.radius, ); } @@ -2309,12 +2298,12 @@ function updateZoomTarget(viewer) { } // Otherwise, the first "frame" needs to have been rendered - const removeEventListener = target.frameChanged.addEventListener(function ( - timeDynamicPointCloud - ) { - zoomToBoundingSphere(timeDynamicPointCloud.boundingSphere); - removeEventListener(); - }); + const removeEventListener = target.frameChanged.addEventListener( + function (timeDynamicPointCloud) { + zoomToBoundingSphere(timeDynamicPointCloud.boundingSphere); + removeEventListener(); + }, + ); return; } @@ -2354,7 +2343,7 @@ function updateZoomTarget(viewer) { const state = viewer._dataSourceDisplay.getBoundingSphere( entities[i], false, - boundingSphereScratch + boundingSphereScratch, ); if (state === BoundingSphereState.PENDING) { @@ -2408,7 +2397,7 @@ function updateTrackedEntity(viewer) { //computed. In this case, we will track the entity once it comes back into existence. const currentPosition = Property.getValueOrUndefined( trackedEntity.position, - currentTime + currentTime, ); if (!defined(currentPosition)) { @@ -2420,7 +2409,7 @@ function updateTrackedEntity(viewer) { const state = viewer._dataSourceDisplay.getBoundingSphere( trackedEntity, false, - boundingSphereScratch + boundingSphereScratch, ); if (state === BoundingSphereState.PENDING) { return; diff --git a/packages/widgets/Source/Viewer/viewerDragDropMixin.js b/packages/widgets/Source/Viewer/viewerDragDropMixin.js index 24f6b896f50c..32db22f5ed8f 100644 --- a/packages/widgets/Source/Viewer/viewerDragDropMixin.js +++ b/packages/widgets/Source/Viewer/viewerDragDropMixin.js @@ -48,7 +48,7 @@ function viewerDragDropMixin(viewer, options) { } if (viewer.hasOwnProperty("dropEnabled")) { throw new DeveloperError( - "dropEnabled is already defined by another mixin." + "dropEnabled is already defined by another mixin.", ); } if (viewer.hasOwnProperty("dropError")) { @@ -56,25 +56,25 @@ function viewerDragDropMixin(viewer, options) { } if (viewer.hasOwnProperty("clearOnDrop")) { throw new DeveloperError( - "clearOnDrop is already defined by another mixin." + "clearOnDrop is already defined by another mixin.", ); } if (viewer.hasOwnProperty("flyToOnDrop")) { throw new DeveloperError( - "flyToOnDrop is already defined by another mixin." + "flyToOnDrop is already defined by another mixin.", ); } //>>includeEnd('debug'); - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; //Local variables to be closed over by defineProperties. let dropEnabled = true; - let flyToOnDrop = defaultValue(options.flyToOnDrop, true); + let flyToOnDrop = options.flyToOnDrop ?? true; const dropError = new Event(); - let clearOnDrop = defaultValue(options.clearOnDrop, true); - let dropTarget = defaultValue(options.dropTarget, viewer.container); - let clampToGround = defaultValue(options.clampToGround, true); + let clearOnDrop = options.clearOnDrop ?? true; + let dropTarget = options.dropTarget ?? viewer.container; + let clampToGround = options.clampToGround ?? true; let proxy = options.proxy; dropTarget = getElement(dropTarget); @@ -283,7 +283,7 @@ function createOnLoadCallback(viewer, file, proxy, clampToGround) { viewer.dropError.raiseEvent( viewer, fileName, - `Unrecognized file: ${fileName}` + `Unrecognized file: ${fileName}`, ); return; } diff --git a/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js b/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js index accaf51a8d55..c6b557a8686c 100644 --- a/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js +++ b/packages/widgets/Source/Viewer/viewerPerformanceWatchdogMixin.js @@ -28,7 +28,7 @@ function viewerPerformanceWatchdogMixin(viewer, options) { } //>>includeEnd('debug'); - options = defaultValue(options, defaultValue.EMPTY_OBJECT); + options = options ?? defaultValue.EMPTY_OBJECT; const performanceWatchdog = new PerformanceWatchdog({ scene: viewer.scene, diff --git a/packages/widgets/Source/createCommand.js b/packages/widgets/Source/createCommand.js index 305905a3c9c3..f98d7ecacac9 100644 --- a/packages/widgets/Source/createCommand.js +++ b/packages/widgets/Source/createCommand.js @@ -1,4 +1,4 @@ -import { defaultValue, defined, DeveloperError, Event } from "@cesium/engine"; +import { defined, DeveloperError, Event } from "@cesium/engine"; import knockout from "./ThirdParty/knockout.js"; /** @@ -21,7 +21,7 @@ function createCommand(func, canExecute) { } //>>includeEnd('debug'); - canExecute = defaultValue(canExecute, true); + canExecute = canExecute ?? true; const beforeExecute = new Event(); const afterExecute = new Event(); diff --git a/packages/widgets/Specs/createViewer.js b/packages/widgets/Specs/createViewer.js index 6a55487f99aa..bcc65f813c6a 100644 --- a/packages/widgets/Specs/createViewer.js +++ b/packages/widgets/Specs/createViewer.js @@ -1,12 +1,11 @@ -import { defaultValue } from "@cesium/engine"; import { Viewer } from "../index.js"; import getWebGLStub from "../../../Specs/getWebGLStub.js"; function createViewer(container, options) { - options = defaultValue(options, {}); - options.contextOptions = defaultValue(options.contextOptions, {}); - options.contextOptions.webgl = defaultValue(options.contextOptions.webgl, {}); + options = options ?? {}; + options.contextOptions = options.contextOptions ?? {}; + options.contextOptions.webgl = options.contextOptions.webgl ?? {}; if (!!window.webglStub) { options.contextOptions.getWebGLStub = getWebGLStub; } From 76f02a92fac6140a704ef73bf71c5f117480f80d Mon Sep 17 00:00:00 2001 From: David Brown Date: Thu, 19 Sep 2024 22:20:54 -0400 Subject: [PATCH 2/3] fixed errors - accidentally changed createDefaultTerrainProviderViewModels() to createDefaultTerrainProviderViewModels --- packages/widgets/Source/Viewer/Viewer.js | 112 ++++++++++++----------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/packages/widgets/Source/Viewer/Viewer.js b/packages/widgets/Source/Viewer/Viewer.js index 14dff625f1da..f1d9612e785a 100644 --- a/packages/widgets/Source/Viewer/Viewer.js +++ b/packages/widgets/Source/Viewer/Viewer.js @@ -152,7 +152,7 @@ function trackDataSourceClock(timeline, clock, dataSource) { stopTime = JulianDate.addSeconds( startTime, CesiumMath.EPSILON2, - scratchStopTime, + scratchStopTime ); } timeline.updateFromClock(); @@ -167,8 +167,10 @@ const cartesian3Scratch = new Cartesian3(); function pickImageryLayerFeature(viewer, windowPosition) { const scene = viewer.scene; const pickRay = scene.camera.getPickRay(windowPosition); - const imageryLayerFeaturePromise = - scene.imageryLayers.pickImageryLayerFeatures(pickRay, scene); + const imageryLayerFeaturePromise = scene.imageryLayers.pickImageryLayerFeatures( + pickRay, + scene + ); if (!defined(imageryLayerFeaturePromise)) { return; } @@ -202,7 +204,7 @@ function pickImageryLayerFeature(viewer, windowPosition) { if (defined(feature.position)) { const ecfPosition = viewer.scene.ellipsoid.cartographicToCartesian( feature.position, - cartesian3Scratch, + cartesian3Scratch ); entity.position = new ConstantPositionProperty(ecfPosition); } @@ -215,7 +217,7 @@ function pickImageryLayerFeature(viewer, windowPosition) { return; } viewer.selectedEntity = createNoFeaturesEntity(); - }, + } ); return loadingMessage; @@ -430,7 +432,7 @@ function Viewer(container, options) { ) { throw new DeveloperError( "options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. \ -Either specify options.baseLayer instead or set options.baseLayerPicker to true.", +Either specify options.baseLayer instead or set options.baseLayerPicker to true." ); } @@ -441,7 +443,7 @@ Either specify options.baseLayer instead or set options.baseLayerPicker to true. ) { throw new DeveloperError( "options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. \ -Either specify options.terrainProvider instead or set options.baseLayerPicker to true.", +Either specify options.terrainProvider instead or set options.baseLayerPicker to true." ); } //>>includeEnd('debug') @@ -549,7 +551,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(selectionIndicatorContainer); selectionIndicator = new SelectionIndicator( selectionIndicatorContainer, - scene, + scene ); } @@ -565,12 +567,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( infoBoxViewModel.cameraClicked, Viewer.prototype._onInfoBoxCameraClicked, - this, + this ); eventHelper.add( infoBoxViewModel.closeClicked, Viewer.prototype._onInfoBoxClockClicked, - this, + this ); } @@ -600,7 +602,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( geocoder.viewModel.search.beforeExecute, Viewer.prototype._clearObjects, - this, + this ); } @@ -621,7 +623,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( homeButton.viewModel.command.beforeExecute, Viewer.prototype._clearTrackedObject, - this, + this ); } @@ -631,7 +633,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //>>includeStart('debug', pragmas.debug); if (options.sceneModePicker === true && scene3DOnly) { throw new DeveloperError( - "options.sceneModePicker is not available when options.scene3DOnly is set to true.", + "options.sceneModePicker is not available when options.scene3DOnly is set to true." ); } //>>includeEnd('debug'); @@ -658,7 +660,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to createDefaultImageryProviderViewModels(); const terrainProviderViewModels = options.terrainProviderViewModels ?? - createDefaultTerrainProviderViewModels; + createDefaultTerrainProviderViewModels(); baseLayerPicker = new BaseLayerPicker(toolbar, { globe: scene.globe, @@ -672,7 +674,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //Grab the dropdown for resize code. const elements = toolbar.getElementsByClassName( - "cesium-baseLayerPicker-dropDown", + "cesium-baseLayerPicker-dropDown" ); baseLayerPickerDropDown = elements[0]; } @@ -697,7 +699,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //>>includeStart('debug', pragmas.debug); if (defined(options.terrainProvider)) { throw new DeveloperError( - "Specify either options.terrainProvider or options.terrain.", + "Specify either options.terrainProvider or options.terrain." ); } //>>includeEnd('debug') @@ -721,7 +723,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to //window.localStorage is null if disabled in Firefox or undefined in browsers with implementation if (defined(window.localStorage)) { const hasSeenNavHelp = window.localStorage.getItem( - "cesium-hasSeenNavHelp", + "cesium-hasSeenNavHelp" ); if (defined(hasSeenNavHelp) && Boolean(hasSeenNavHelp)) { showNavHelp = false; @@ -748,7 +750,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(animationContainer); animation = new Animation( animationContainer, - new AnimationViewModel(clockViewModel), + new AnimationViewModel(clockViewModel) ); } @@ -776,7 +778,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to viewerContainer.appendChild(fullscreenContainer); fullscreenButton = new FullscreenButton( fullscreenContainer, - options.fullscreenElement, + options.fullscreenElement ); //Subscribe to fullscreenButton.viewModel.isFullscreenEnabled so @@ -792,7 +794,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to timeline.container.style.right = `${fullscreenContainer.clientWidth}px`; timeline.resize(); } - }, + } ); } @@ -818,7 +820,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to timeline.container.style.right = `${vrContainer.clientWidth}px`; timeline.resize(); } - }, + } ); vrModeSubscription = subscribeAndEvaluate( @@ -826,7 +828,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to "isVRMode", function (isVRMode) { enableVRUI(that, isVRMode); - }, + } ); } @@ -888,12 +890,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( dataSourceCollection.dataSourceAdded, Viewer.prototype._onDataSourceAdded, - this, + this ); eventHelper.add( dataSourceCollection.dataSourceRemoved, Viewer.prototype._onDataSourceRemoved, - this, + this ); // Prior to each render, check if anything needs to be resized. @@ -913,12 +915,12 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to eventHelper.add( dataSourceCollection.dataSourceAdded, Viewer.prototype._dataSourceAdded, - this, + this ); eventHelper.add( dataSourceCollection.dataSourceRemoved, Viewer.prototype._dataSourceRemoved, - this, + this ); // Subscribe to left clicks and zoom to the picked object. @@ -944,11 +946,11 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to cesiumWidget.screenSpaceEventHandler.setInputAction( pickAndSelectObject, - ScreenSpaceEventType.LEFT_CLICK, + ScreenSpaceEventType.LEFT_CLICK ); cesiumWidget.screenSpaceEventHandler.setInputAction( pickAndTrackObject, - ScreenSpaceEventType.LEFT_DOUBLE_CLICK, + ScreenSpaceEventType.LEFT_DOUBLE_CLICK ); } @@ -1738,10 +1740,10 @@ Viewer.prototype.destroy = function () { !this.screenSpaceEventHandler.isDestroyed() ) { this.screenSpaceEventHandler.removeInputAction( - ScreenSpaceEventType.LEFT_CLICK, + ScreenSpaceEventType.LEFT_CLICK ); this.screenSpaceEventHandler.removeInputAction( - ScreenSpaceEventType.LEFT_DOUBLE_CLICK, + ScreenSpaceEventType.LEFT_DOUBLE_CLICK ); } @@ -1787,7 +1789,7 @@ Viewer.prototype.destroy = function () { this._timeline.removeEventListener( "settime", onTimelineScrubfunction, - false, + false ); this._element.removeChild(this._timeline.container); this._timeline = this._timeline.destroy(); @@ -1834,12 +1836,12 @@ Viewer.prototype.destroy = function () { */ Viewer.prototype._dataSourceAdded = function ( dataSourceCollection, - dataSource, + dataSource ) { const entityCollection = dataSource.entities; entityCollection.collectionChanged.addEventListener( Viewer.prototype._onEntityCollectionChanged, - this, + this ); }; @@ -1848,12 +1850,12 @@ Viewer.prototype._dataSourceAdded = function ( */ Viewer.prototype._dataSourceRemoved = function ( dataSourceCollection, - dataSource, + dataSource ) { const entityCollection = dataSource.entities; entityCollection.collectionChanged.removeEventListener( Viewer.prototype._onEntityCollectionChanged, - this, + this ); if (defined(this.trackedEntity)) { @@ -1890,7 +1892,7 @@ Viewer.prototype._onTick = function (clock) { const trackedState = this._dataSourceDisplay.getBoundingSphere( trackedEntity, false, - boundingSphereScratch, + boundingSphereScratch ); if (trackedState === BoundingSphereState.DONE) { entityView.update(time, boundingSphereScratch); @@ -1910,7 +1912,7 @@ Viewer.prototype._onTick = function (clock) { const state = this._dataSourceDisplay.getBoundingSphere( selectedEntity, true, - boundingSphereScratch, + boundingSphereScratch ); if (state !== BoundingSphereState.FAILED) { position = boundingSphereScratch.center; @@ -1926,7 +1928,7 @@ Viewer.prototype._onTick = function (clock) { if (defined(selectionIndicatorViewModel)) { selectionIndicatorViewModel.position = Cartesian3.clone( position, - selectionIndicatorViewModel.position, + selectionIndicatorViewModel.position ); selectionIndicatorViewModel.showSelection = showSelection && enableCamera; selectionIndicatorViewModel.update(); @@ -1946,7 +1948,7 @@ Viewer.prototype._onTick = function (clock) { infoBoxViewModel.description = Property.getValueOrDefault( selectedEntity.description, time, - "", + "" ); } else { infoBoxViewModel.titleText = ""; @@ -1961,7 +1963,7 @@ Viewer.prototype._onTick = function (clock) { Viewer.prototype._onEntityCollectionChanged = function ( collection, added, - removed, + removed ) { const length = removed.length; for (let i = 0; i < length; i++) { @@ -2031,7 +2033,7 @@ Viewer.prototype._onDataSourceChanged = function (dataSource) { */ Viewer.prototype._onDataSourceAdded = function ( dataSourceCollection, - dataSource, + dataSource ) { if (this._automaticallyTrackDataSourceClocks) { this.clockTrackedDataSource = dataSource; @@ -2040,7 +2042,7 @@ Viewer.prototype._onDataSourceAdded = function ( const removalFunc = this._eventHelper.add( dataSource.changedEvent, Viewer.prototype._onDataSourceChanged, - this, + this ); this._dataSourceChangedListeners[id] = removalFunc; }; @@ -2050,7 +2052,7 @@ Viewer.prototype._onDataSourceAdded = function ( */ Viewer.prototype._onDataSourceRemoved = function ( dataSourceCollection, - dataSource, + dataSource ) { const resetClock = this.clockTrackedDataSource === dataSource; const id = dataSource.entities.id; @@ -2060,7 +2062,7 @@ Viewer.prototype._onDataSourceRemoved = function ( const numDataSources = dataSourceCollection.length; if (this._automaticallyTrackDataSourceClocks && numDataSources > 0) { this.clockTrackedDataSource = dataSourceCollection.get( - numDataSources - 1, + numDataSources - 1 ); } else { this.clockTrackedDataSource = undefined; @@ -2254,7 +2256,7 @@ function updateZoomTarget(viewer) { const scene = viewer.scene; const camera = scene.camera; - const zoomOptions = viewer._zoomOptions ?? {}; + const zoomOptions = viewer._zoomOptions ?? defaultValue.EMPTY_OBJECT; let options; function zoomToBoundingSphere(boundingSphere) { // If offset was originally undefined then give it base value instead of empty object @@ -2262,7 +2264,7 @@ function updateZoomTarget(viewer) { zoomOptions.offset = new HeadingPitchRange( 0.0, -0.5, - boundingSphere.radius, + boundingSphere.radius ); } @@ -2298,12 +2300,12 @@ function updateZoomTarget(viewer) { } // Otherwise, the first "frame" needs to have been rendered - const removeEventListener = target.frameChanged.addEventListener( - function (timeDynamicPointCloud) { - zoomToBoundingSphere(timeDynamicPointCloud.boundingSphere); - removeEventListener(); - }, - ); + const removeEventListener = target.frameChanged.addEventListener(function ( + timeDynamicPointCloud + ) { + zoomToBoundingSphere(timeDynamicPointCloud.boundingSphere); + removeEventListener(); + }); return; } @@ -2343,7 +2345,7 @@ function updateZoomTarget(viewer) { const state = viewer._dataSourceDisplay.getBoundingSphere( entities[i], false, - boundingSphereScratch, + boundingSphereScratch ); if (state === BoundingSphereState.PENDING) { @@ -2397,7 +2399,7 @@ function updateTrackedEntity(viewer) { //computed. In this case, we will track the entity once it comes back into existence. const currentPosition = Property.getValueOrUndefined( trackedEntity.position, - currentTime, + currentTime ); if (!defined(currentPosition)) { @@ -2409,7 +2411,7 @@ function updateTrackedEntity(viewer) { const state = viewer._dataSourceDisplay.getBoundingSphere( trackedEntity, false, - boundingSphereScratch, + boundingSphereScratch ); if (state === BoundingSphereState.PENDING) { return; From c6feb271981063a1a31208ab80b891b5c0514348 Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 20 Sep 2024 09:53:32 -0400 Subject: [PATCH 3/3] ran prettier to fix formatting --- .../Source/DataSources/BillboardGraphics.js | 6 +- .../engine/Source/DataSources/BoxGraphics.js | 6 +- .../DataSources/ConstantPositionProperty.js | 4 +- .../Source/DataSources/KmlDataSource.js | 422 +++++++++--------- .../BaseLayerPickerViewModel.js | 13 +- .../FullscreenButtonViewModel.js | 17 +- .../Source/Geocoder/GeocoderViewModel.js | 12 +- packages/widgets/Source/InspectorShared.js | 16 +- .../NavigationHelpButton.js | 26 +- .../PerformanceWatchdogViewModel.js | 4 +- .../SelectionIndicatorViewModel.js | 8 +- .../Source/Timeline/TimelineHighlightRange.js | 8 +- .../Source/VRButton/VRButtonViewModel.js | 9 +- .../Source/Viewer/viewerDragDropMixin.js | 8 +- 14 files changed, 277 insertions(+), 282 deletions(-) diff --git a/packages/engine/Source/DataSources/BillboardGraphics.js b/packages/engine/Source/DataSources/BillboardGraphics.js index c42a9bf53263..6cf66e33e2e5 100644 --- a/packages/engine/Source/DataSources/BillboardGraphics.js +++ b/packages/engine/Source/DataSources/BillboardGraphics.js @@ -302,7 +302,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * @type {Property|undefined} */ pixelOffsetScaleByDistance: createPropertyDescriptor( - "pixelOffsetScaleByDistance", + "pixelOffsetScaleByDistance" ), /** @@ -320,7 +320,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( - "distanceDisplayCondition", + "distanceDisplayCondition" ), /** @@ -330,7 +330,7 @@ Object.defineProperties(BillboardGraphics.prototype, { * @type {Property|undefined} */ disableDepthTestDistance: createPropertyDescriptor( - "disableDepthTestDistance", + "disableDepthTestDistance" ), /** diff --git a/packages/engine/Source/DataSources/BoxGraphics.js b/packages/engine/Source/DataSources/BoxGraphics.js index 4b8cd59918e6..cd7e7df30f72 100644 --- a/packages/engine/Source/DataSources/BoxGraphics.js +++ b/packages/engine/Source/DataSources/BoxGraphics.js @@ -153,7 +153,7 @@ Object.defineProperties(BoxGraphics.prototype, { * @type {Property|undefined} */ distanceDisplayCondition: createPropertyDescriptor( - "distanceDisplayCondition", + "distanceDisplayCondition" ), }); @@ -197,7 +197,7 @@ BoxGraphics.prototype.merge = function (source) { this.dimensions = defaultValue(this.dimensions, source.dimensions); this.heightReference = defaultValue( this.heightReference, - source.heightReference, + source.heightReference ); this.fill = defaultValue(this.fill, source.fill); this.material = defaultValue(this.material, source.material); @@ -207,7 +207,7 @@ BoxGraphics.prototype.merge = function (source) { this.shadows = defaultValue(this.shadows, source.shadows); this.distanceDisplayCondition = defaultValue( this.distanceDisplayCondition, - source.distanceDisplayCondition, + source.distanceDisplayCondition ); }; export default BoxGraphics; diff --git a/packages/engine/Source/DataSources/ConstantPositionProperty.js b/packages/engine/Source/DataSources/ConstantPositionProperty.js index 3069f8750fc3..0195059b2c13 100644 --- a/packages/engine/Source/DataSources/ConstantPositionProperty.js +++ b/packages/engine/Source/DataSources/ConstantPositionProperty.js @@ -113,7 +113,7 @@ ConstantPositionProperty.prototype.setValue = function (value, referenceFrame) { ConstantPositionProperty.prototype.getValueInReferenceFrame = function ( time, referenceFrame, - result, + result ) { //>>includeStart('debug', pragmas.debug); if (!defined(time)) { @@ -129,7 +129,7 @@ ConstantPositionProperty.prototype.getValueInReferenceFrame = function ( this._value, this._referenceFrame, referenceFrame, - result, + result ); }; diff --git a/packages/engine/Source/DataSources/KmlDataSource.js b/packages/engine/Source/DataSources/KmlDataSource.js index 4238e91993e5..4da574751877 100644 --- a/packages/engine/Source/DataSources/KmlDataSource.js +++ b/packages/engine/Source/DataSources/KmlDataSource.js @@ -319,7 +319,7 @@ function isZipFile(blob) { const reader = new FileReader(); reader.addEventListener("load", function () { deferred.resolve( - new DataView(reader.result).getUint32(0, false) === 0x504b0304, + new DataView(reader.result).getUint32(0, false) === 0x504b0304 ); }); reader.addEventListener("error", function () { @@ -391,13 +391,13 @@ function removeDuplicateNamespaces(text) { } function loadXmlFromZip(entry, uriResolver) { - return Promise.resolve(entry.getData(new zip.TextWriter())).then( - function (text) { - text = insertNamespaces(text); - text = removeDuplicateNamespaces(text); - uriResolver.kml = parser.parseFromString(text, "application/xml"); - }, - ); + return Promise.resolve(entry.getData(new zip.TextWriter())).then(function ( + text + ) { + text = insertNamespaces(text); + text = removeDuplicateNamespaces(text); + uriResolver.kml = parser.parseFromString(text, "application/xml"); + }); } function loadDataUriFromZip(entry, uriResolver) { @@ -406,7 +406,7 @@ function loadDataUriFromZip(entry, uriResolver) { return Promise.resolve(entry.getData(new zip.Data64URIWriter(mimeType))).then( function (dataUri) { uriResolver[entry.filename] = dataUri; - }, + } ); } @@ -718,7 +718,7 @@ function queryColorValue(node, tagName, namespace) { } return parseColorString( value, - queryStringValue(node, "colorMode", namespace) === "random", + queryStringValue(node, "colorMode", namespace) === "random" ); } @@ -741,7 +741,7 @@ function processTimeStamp(featureNode) { new TimeInterval({ start: when, stop: Iso8601.MAXIMUM_VALUE, - }), + }) ); return result; } @@ -774,7 +774,7 @@ function processTimeSpan(featureNode) { new TimeInterval({ start: beginDate, stop: endDate, - }), + }) ); } else if (defined(beginDate)) { result = new TimeIntervalCollection(); @@ -782,7 +782,7 @@ function processTimeSpan(featureNode) { new TimeInterval({ start: beginDate, stop: Iso8601.MAXIMUM_VALUE, - }), + }) ); } else if (defined(endDate)) { result = new TimeIntervalCollection(); @@ -790,7 +790,7 @@ function processTimeSpan(featureNode) { new TimeInterval({ start: Iso8601.MINIMUM_VALUE, stop: endDate, - }), + }) ); } @@ -805,13 +805,13 @@ function createDefaultBillboard() { BILLBOARD_NEAR_DISTANCE, BILLBOARD_NEAR_RATIO, BILLBOARD_FAR_DISTANCE, - BILLBOARD_FAR_RATIO, + BILLBOARD_FAR_RATIO ); billboard.pixelOffsetScaleByDistance = new NearFarScalar( BILLBOARD_NEAR_DISTANCE, BILLBOARD_NEAR_RATIO, BILLBOARD_FAR_DISTANCE, - BILLBOARD_FAR_RATIO, + BILLBOARD_FAR_RATIO ); return billboard; } @@ -838,7 +838,7 @@ function getIconHref( dataSource, sourceResource, uriResolver, - canRefresh, + canRefresh ) { let href = queryStringValue(iconNode, "href", namespaces.kml); if (!defined(href) || href.length === 0) { @@ -864,28 +864,28 @@ function getIconHref( const refreshMode = queryStringValue( iconNode, "refreshMode", - namespaces.kml, + namespaces.kml ); const viewRefreshMode = queryStringValue( iconNode, "viewRefreshMode", - namespaces.kml, + namespaces.kml ); if (refreshMode === "onInterval" || refreshMode === "onExpire") { oneTimeWarning( `kml-refreshMode-${refreshMode}`, - `KML - Unsupported Icon refreshMode: ${refreshMode}`, + `KML - Unsupported Icon refreshMode: ${refreshMode}` ); } else if (viewRefreshMode === "onStop" || viewRefreshMode === "onRegion") { oneTimeWarning( `kml-refreshMode-${viewRefreshMode}`, - `KML - Unsupported Icon viewRefreshMode: ${viewRefreshMode}`, + `KML - Unsupported Icon viewRefreshMode: ${viewRefreshMode}` ); } const viewBoundScale = defaultValue( queryStringValue(iconNode, "viewBoundScale", namespaces.kml), - 1.0, + 1.0 ); const defaultViewFormat = viewRefreshMode === "onStop" @@ -893,7 +893,7 @@ function getIconHref( : ""; const viewFormat = defaultValue( queryStringValue(iconNode, "viewFormat", namespaces.kml), - defaultViewFormat, + defaultViewFormat ); const httpQuery = queryStringValue(iconNode, "httpQuery", namespaces.kml); if (defined(viewFormat)) { @@ -910,7 +910,7 @@ function getIconHref( dataSource.canvas, viewBoundScale, dataSource._lastCameraView.bbox, - ellipsoid, + ellipsoid ); return hrefResource; @@ -924,7 +924,7 @@ function processBillboardIcon( node, targetEntity, sourceResource, - uriResolver, + uriResolver ) { let scale = queryNumericValue(node, "scale", namespaces.kml); const heading = queryNumericValue(node, "heading", namespaces.kml); @@ -936,7 +936,7 @@ function processBillboardIcon( dataSource, sourceResource, uriResolver, - false, + false ); // If icon tags are present but blank, we do not want to show an icon @@ -1017,7 +1017,7 @@ function applyStyle( styleNode, targetEntity, sourceResource, - uriResolver, + uriResolver ) { for (let i = 0, len = styleNode.childNodes.length; i < len; i++) { const node = styleNode.childNodes.item(i); @@ -1027,7 +1027,7 @@ function applyStyle( node, targetEntity, sourceResource, - uriResolver, + uriResolver ); } else if (node.localName === "LabelStyle") { let label = targetEntity.label; @@ -1037,11 +1037,11 @@ function applyStyle( } label.scale = defaultValue( queryNumericValue(node, "scale", namespaces.kml), - label.scale, + label.scale ); label.fillColor = defaultValue( queryColorValue(node, "color", namespaces.kml), - label.fillColor, + label.fillColor ); label.text = targetEntity.name; } else if (node.localName === "LineStyle") { @@ -1055,25 +1055,25 @@ function applyStyle( if (defined(queryColorValue(node, "outerColor", namespaces.gx))) { oneTimeWarning( "kml-gx:outerColor", - "KML - gx:outerColor is not supported in a LineStyle", + "KML - gx:outerColor is not supported in a LineStyle" ); } if (defined(queryNumericValue(node, "outerWidth", namespaces.gx))) { oneTimeWarning( "kml-gx:outerWidth", - "KML - gx:outerWidth is not supported in a LineStyle", + "KML - gx:outerWidth is not supported in a LineStyle" ); } if (defined(queryNumericValue(node, "physicalWidth", namespaces.gx))) { oneTimeWarning( "kml-gx:physicalWidth", - "KML - gx:physicalWidth is not supported in a LineStyle", + "KML - gx:physicalWidth is not supported in a LineStyle" ); } if (defined(queryBooleanValue(node, "labelVisibility", namespaces.gx))) { oneTimeWarning( "kml-gx:labelVisibility", - "KML - gx:labelVisibility is not supported in a LineStyle", + "KML - gx:labelVisibility is not supported in a LineStyle" ); } } else if (node.localName === "PolyStyle") { @@ -1084,24 +1084,24 @@ function applyStyle( } polygon.material = defaultValue( queryColorValue(node, "color", namespaces.kml), - polygon.material, + polygon.material ); polygon.fill = defaultValue( queryBooleanValue(node, "fill", namespaces.kml), - polygon.fill, + polygon.fill ); polygon.outline = defaultValue( queryBooleanValue(node, "outline", namespaces.kml), - polygon.outline, + polygon.outline ); } else if (node.localName === "BalloonStyle") { const bgColor = defaultValue( parseColorString(queryStringValue(node, "bgColor", namespaces.kml)), - Color.WHITE, + Color.WHITE ); const textColor = defaultValue( parseColorString(queryStringValue(node, "textColor", namespaces.kml)), - Color.BLACK, + Color.BLACK ); const text = queryStringValue(node, "text", namespaces.kml); @@ -1117,12 +1117,12 @@ function applyStyle( const listItemType = queryStringValue( node, "listItemType", - namespaces.kml, + namespaces.kml ); if (listItemType === "radioFolder" || listItemType === "checkOffOnly") { oneTimeWarning( `kml-listStyle-${listItemType}`, - `KML - Unsupported ListStyle with listItemType: ${listItemType}`, + `KML - Unsupported ListStyle with listItemType: ${listItemType}` ); } } @@ -1135,7 +1135,7 @@ function computeFinalStyle( placeMark, styleCollection, sourceResource, - uriResolver, + uriResolver ) { const result = new Entity(); let styleEntity; @@ -1159,7 +1159,7 @@ function computeFinalStyle( inlineStyleNode, result, sourceResource, - uriResolver, + uriResolver ); } else { // StyleMap @@ -1184,7 +1184,7 @@ function computeFinalStyle( } else { oneTimeWarning( `kml-styleMap-${key}`, - `KML - Unsupported StyleMap key: ${key}`, + `KML - Unsupported StyleMap key: ${key}` ); } } @@ -1234,7 +1234,7 @@ function processStyles( styleCollection, sourceResource, isExternal, - uriResolver, + uriResolver ) { let i; let id; @@ -1262,7 +1262,7 @@ function processStyles( node, styleEntity, sourceResource, - uriResolver, + uriResolver ); } } @@ -1309,14 +1309,14 @@ function processStyles( node, styleEntity, sourceResource, - uriResolver, + uriResolver ); } } } else { oneTimeWarning( `kml-styleMap-${key}`, - `KML - Unsupported StyleMap key: ${key}`, + `KML - Unsupported StyleMap key: ${key}` ); } } @@ -1342,7 +1342,7 @@ function processStyles( }); promises.push( - processExternalStyles(dataSource, resource, styleCollection), + processExternalStyles(dataSource, resource, styleCollection) ); } } @@ -1384,7 +1384,7 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { if (gxAltitudeMode === "clampToSeaFloor") { oneTimeWarning( "kml-gx:altitudeMode-clampToSeaFloor", - "KML - :clampToSeaFloor is currently not supported, using :clampToGround.", + "KML - :clampToSeaFloor is currently not supported, using :clampToGround." ); return HeightReference.CLAMP_TO_GROUND; } @@ -1392,7 +1392,7 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { if (gxAltitudeMode === "relativeToSeaFloor") { oneTimeWarning( "kml-gx:altitudeMode-relativeToSeaFloor", - "KML - :relativeToSeaFloor is currently not supported, using :relativeToGround.", + "KML - :relativeToSeaFloor is currently not supported, using :relativeToGround." ); return HeightReference.RELATIVE_TO_GROUND; } @@ -1400,12 +1400,12 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { if (defined(altitudeMode)) { oneTimeWarning( "kml-altitudeMode-unknown", - `KML - Unknown :${altitudeMode}, using :CLAMP_TO_GROUND.`, + `KML - Unknown :${altitudeMode}, using :CLAMP_TO_GROUND.` ); } else { oneTimeWarning( "kml-gx:altitudeMode-unknown", - `KML - Unknown :${gxAltitudeMode}, using :CLAMP_TO_GROUND.`, + `KML - Unknown :${gxAltitudeMode}, using :CLAMP_TO_GROUND.` ); } @@ -1416,7 +1416,7 @@ function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) { function createPositionPropertyFromAltitudeMode( property, altitudeMode, - gxAltitudeMode, + gxAltitudeMode ) { if ( gxAltitudeMode === "relativeToSeaFloor" || @@ -1435,8 +1435,8 @@ function createPositionPropertyFromAltitudeMode( "kml-altitudeMode-unknown", `KML - Unknown altitudeMode: ${defaultValue( altitudeMode, - gxAltitudeMode, - )}`, + gxAltitudeMode + )}` ); } @@ -1448,7 +1448,7 @@ function createPositionPropertyArrayFromAltitudeMode( properties, altitudeMode, gxAltitudeMode, - ellipsoid, + ellipsoid ) { if (!defined(properties)) { return undefined; @@ -1471,8 +1471,8 @@ function createPositionPropertyArrayFromAltitudeMode( "kml-altitudeMode-unknown", `KML - Unknown altitudeMode: ${defaultValue( altitudeMode, - gxAltitudeMode, - )}`, + gxAltitudeMode + )}` ); } @@ -1489,7 +1489,7 @@ function processPositionGraphics( dataSource, entity, styleEntity, - heightReference, + heightReference ) { let label = entity.label; if (!defined(label)) { @@ -1556,22 +1556,22 @@ function processPoint( entityCollection, geometryNode, entity, - styleEntity, + styleEntity ) { const coordinatesString = queryStringValue( geometryNode, "coordinates", - namespaces.kml, + namespaces.kml ); const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml, + namespaces.kml ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx, + namespaces.gx ); const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml); const ellipsoid = dataSource._ellipsoid; @@ -1582,7 +1582,7 @@ function processPoint( dataSource, entity, styleEntity, - heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode), + heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) ); if (extrude && isExtrudable(altitudeMode, gxAltitudeMode)) { @@ -1597,28 +1597,28 @@ function processLineStringOrLinearRing( entityCollection, geometryNode, entity, - styleEntity, + styleEntity ) { const coordinatesNode = queryFirstNode( geometryNode, "coordinates", - namespaces.kml, + namespaces.kml ); const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml, + namespaces.kml ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx, + namespaces.gx ); const extrude = queryBooleanValue(geometryNode, "extrude", namespaces.kml); const tessellate = queryBooleanValue( geometryNode, "tessellate", - namespaces.kml, + namespaces.kml ); const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode); const zIndex = queryNumericValue(geometryNode, "drawOrder", namespaces.gx); @@ -1668,13 +1668,13 @@ function processLineStringOrLinearRing( if (defined(zIndex)) { oneTimeWarning( "kml-gx:drawOrder", - "KML - gx:drawOrder is not supported in LineStrings when clampToGround is false", + "KML - gx:drawOrder is not supported in LineStrings when clampToGround is false" ); } if (dataSource._clampToGround && !tessellate) { oneTimeWarning( "kml-line-tesselate", - "Ignoring clampToGround for KML lines without the tessellate flag.", + "Ignoring clampToGround for KML lines without the tessellate flag." ); } @@ -1684,7 +1684,7 @@ function processLineStringOrLinearRing( coordinates, altitudeMode, gxAltitudeMode, - ellipsoid, + ellipsoid ); if (!tessellate || canExtrude) { polyline.arcType = ArcType.NONE; @@ -1699,22 +1699,22 @@ function processPolygon( entityCollection, geometryNode, entity, - styleEntity, + styleEntity ) { const outerBoundaryIsNode = queryFirstNode( geometryNode, "outerBoundaryIs", - namespaces.kml, + namespaces.kml ); let linearRingNode = queryFirstNode( outerBoundaryIsNode, "LinearRing", - namespaces.kml, + namespaces.kml ); let coordinatesNode = queryFirstNode( linearRingNode, "coordinates", - namespaces.kml, + namespaces.kml ); const ellipsoid = dataSource._ellipsoid; let coordinates = readCoordinates(coordinatesNode, ellipsoid); @@ -1722,12 +1722,12 @@ function processPolygon( const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml, + namespaces.kml ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx, + namespaces.gx ); const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode); @@ -1756,19 +1756,19 @@ function processPolygon( const innerBoundaryIsNodes = queryChildNodes( geometryNode, "innerBoundaryIs", - namespaces.kml, + namespaces.kml ); for (let j = 0; j < innerBoundaryIsNodes.length; j++) { linearRingNode = queryChildNodes( innerBoundaryIsNodes[j], "LinearRing", - namespaces.kml, + namespaces.kml ); for (let k = 0; k < linearRingNode.length; k++) { coordinatesNode = queryFirstNode( linearRingNode[k], "coordinates", - namespaces.kml, + namespaces.kml ); coordinates = readCoordinates(coordinatesNode, ellipsoid); if (defined(coordinates)) { @@ -1787,17 +1787,17 @@ function processTrack( entityCollection, geometryNode, entity, - styleEntity, + styleEntity ) { const altitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.kml, + namespaces.kml ); const gxAltitudeMode = queryStringValue( geometryNode, "altitudeMode", - namespaces.gx, + namespaces.gx ); const coordNodes = queryChildNodes(geometryNode, "coord", namespaces.gx); const angleNodes = queryChildNodes(geometryNode, "angles", namespaces.gx); @@ -1809,7 +1809,7 @@ function processTrack( if (angleNodes.length > 0) { oneTimeWarning( "kml-gx:angles", - "KML - gx:angles are not supported in gx:Tracks", + "KML - gx:angles are not supported in gx:Tracks" ); } @@ -1828,7 +1828,7 @@ function processTrack( dataSource, entity, styleEntity, - heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode), + heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) ); processPathGraphics(entity, styleEntity); @@ -1839,7 +1839,7 @@ function processTrack( new TimeInterval({ start: times[0], stop: times[times.length - 1], - }), + }) ); } @@ -1859,7 +1859,7 @@ function addToMultiTrack( extrude, altitudeMode, gxAltitudeMode, - includeEndPoints, + includeEndPoints ) { const start = times[0]; const stop = times[times.length - 1]; @@ -1876,9 +1876,9 @@ function addToMultiTrack( data: createPositionPropertyFromAltitudeMode( data, altitudeMode, - gxAltitudeMode, + gxAltitudeMode ), - }), + }) ); availability.addInterval( new TimeInterval({ @@ -1886,7 +1886,7 @@ function addToMultiTrack( stop: stop, isStartIncluded: includeEndPoints, isStopIncluded: includeEndPoints, - }), + }) ); dropShowProperty.intervals.addInterval( new TimeInterval({ @@ -1895,7 +1895,7 @@ function addToMultiTrack( isStartIncluded: includeEndPoints, isStopIncluded: includeEndPoints, data: extrude, - }), + }) ); } @@ -1904,7 +1904,7 @@ function processMultiTrack( entityCollection, geometryNode, entity, - styleEntity, + styleEntity ) { // Multitrack options do not work in GE as detailed in the spec, // rather than altitudeMode being at the MultiTrack level, @@ -1913,7 +1913,7 @@ function processMultiTrack( const interpolate = queryBooleanValue( geometryNode, "interpolate", - namespaces.gx, + namespaces.gx ); const trackNodes = queryChildNodes(geometryNode, "Track", namespaces.gx); @@ -1932,12 +1932,12 @@ function processMultiTrack( const altitudeMode = queryStringValue( trackNode, "altitudeMode", - namespaces.kml, + namespaces.kml ); const gxAltitudeMode = queryStringValue( trackNode, "altitudeMode", - namespaces.gx, + namespaces.gx ); const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode); const extrude = queryBooleanValue(trackNode, "extrude", namespaces.kml); @@ -1967,7 +1967,7 @@ function processMultiTrack( false, "absolute", undefined, - false, + false ); } lastStop = times[length - 1]; @@ -1983,7 +1983,7 @@ function processMultiTrack( canExtrude && extrude, altitudeMode, gxAltitudeMode, - true, + true ); needDropLine = needDropLine || (canExtrude && extrude); } @@ -2017,7 +2017,7 @@ function processMultiGeometry( geometryNode, entity, styleEntity, - context, + context ) { const childNodes = geometryNode.childNodes; let hasGeometry = false; @@ -2037,7 +2037,7 @@ function processMultiGeometry( entityCollection, childNode, childEntity, - styleEntity, + styleEntity ) ) { hasGeometry = true; @@ -2053,11 +2053,11 @@ function processUnsupportedGeometry( entityCollection, geometryNode, entity, - styleEntity, + styleEntity ) { oneTimeWarning( "kml-unsupportedGeometry", - `KML - Unsupported geometry: ${geometryNode.localName}`, + `KML - Unsupported geometry: ${geometryNode.localName}` ); return false; } @@ -2075,7 +2075,7 @@ function processExtendedData(node, entity) { if (defined(queryStringAttribute(extendedDataNode, "xmlns:prefix"))) { oneTimeWarning( "kml-extendedData", - "KML - ExtendedData with xmlns:prefix is unsupported", + "KML - ExtendedData with xmlns:prefix is unsupported" ); } @@ -2091,7 +2091,7 @@ function processExtendedData(node, entity) { displayName: queryStringValue( dataNode, "displayName", - namespaces.kml, + namespaces.kml ), value: queryStringValue(dataNode, "value", namespaces.kml), }; @@ -2111,7 +2111,7 @@ function processDescription( entity, styleEntity, uriResolver, - sourceResource, + sourceResource ) { let i; let key; @@ -2123,7 +2123,7 @@ function processDescription( const balloonStyle = defaultValue( entity.balloonStyle, - styleEntity.balloonStyle, + styleEntity.balloonStyle ); let background = Color.WHITE; @@ -2179,7 +2179,7 @@ function processDescription( value = extendedData[key]; text += `
${defaultValue( value.displayName, - key, + key )}${defaultValue(value.value, "")}
"; @@ -2256,7 +2256,7 @@ function processFeature(dataSource, featureNode, processingData) { const entity = createEntity( featureNode, entityCollection, - processingData.context, + processingData.context ); const kmlData = entity.kml; const styleEntity = computeFinalStyle( @@ -2264,7 +2264,7 @@ function processFeature(dataSource, featureNode, processingData) { featureNode, processingData.styleCollection, sourceResource, - uriResolver, + uriResolver ); const name = queryStringValue(featureNode, "name", namespaces.kml); @@ -2290,7 +2290,7 @@ function processFeature(dataSource, featureNode, processingData) { const visibility = queryBooleanValue( featureNode, "visibility", - namespaces.kml, + namespaces.kml ); entity.show = ancestryIsVisible(parent) && defaultValue(visibility, true); //const open = queryBooleanValue(featureNode, 'open', namespaces.kml); @@ -2314,7 +2314,7 @@ function processFeature(dataSource, featureNode, processingData) { kmlData.phoneNumber = queryStringValue( featureNode, "phoneNumber", - namespaces.kml, + namespaces.kml ); kmlData.snippet = queryStringValue(featureNode, "Snippet", namespaces.kml); @@ -2324,7 +2324,7 @@ function processFeature(dataSource, featureNode, processingData) { entity, styleEntity, uriResolver, - sourceResource, + sourceResource ); const ellipsoid = dataSource._ellipsoid; @@ -2357,7 +2357,7 @@ function processPlacemark( dataSource, placemark, processingData, - deferredLoading, + deferredLoading ) { const r = processFeature(dataSource, placemark, processingData); const entity = r.entity; @@ -2377,7 +2377,7 @@ function processPlacemark( childNode, entity, styleEntity, - entity.id, + entity.id ); hasGeometry = true; } @@ -2415,7 +2415,7 @@ function processTour(dataSource, node, processingData, deferredLoading) { playlistNodeProcessor(tour, entryNode, ellipsoid); } else { console.log( - `Unknown KML Tour playlist entry type ${entryNode.localName}`, + `Unknown KML Tour playlist entry type ${entryNode.localName}` ); } } @@ -2454,28 +2454,28 @@ function processCamera(featureNode, entity, ellipsoid) { if (defined(camera)) { const lon = defaultValue( queryNumericValue(camera, "longitude", namespaces.kml), - 0.0, + 0.0 ); const lat = defaultValue( queryNumericValue(camera, "latitude", namespaces.kml), - 0.0, + 0.0 ); const altitude = defaultValue( queryNumericValue(camera, "altitude", namespaces.kml), - 0.0, + 0.0 ); const heading = defaultValue( queryNumericValue(camera, "heading", namespaces.kml), - 0.0, + 0.0 ); const tilt = defaultValue( queryNumericValue(camera, "tilt", namespaces.kml), - 0.0, + 0.0 ); const roll = defaultValue( queryNumericValue(camera, "roll", namespaces.kml), - 0.0, + 0.0 ); const position = Cartesian3.fromDegrees(lon, lat, altitude, ellipsoid); @@ -2490,21 +2490,21 @@ function processLookAt(featureNode, entity, ellipsoid) { if (defined(lookAt)) { const lon = defaultValue( queryNumericValue(lookAt, "longitude", namespaces.kml), - 0.0, + 0.0 ); const lat = defaultValue( queryNumericValue(lookAt, "latitude", namespaces.kml), - 0.0, + 0.0 ); const altitude = defaultValue( queryNumericValue(lookAt, "altitude", namespaces.kml), - 0.0, + 0.0 ); let heading = queryNumericValue(lookAt, "heading", namespaces.kml); let tilt = queryNumericValue(lookAt, "tilt", namespaces.kml); const range = defaultValue( queryNumericValue(lookAt, "range", namespaces.kml), - 0.0, + 0.0 ); tilt = CesiumMath.toRadians(defaultValue(tilt, 0.0)); @@ -2513,7 +2513,7 @@ function processLookAt(featureNode, entity, ellipsoid) { const hpr = new HeadingPitchRange( heading, tilt - CesiumMath.PI_OVER_TWO, - range, + range ); const viewPoint = Cartesian3.fromDegrees(lon, lat, altitude, ellipsoid); @@ -2525,7 +2525,7 @@ function processScreenOverlay( dataSource, screenOverlayNode, processingData, - deferredLoading, + deferredLoading ) { const screenOverlay = processingData.screenOverlayContainer; if (!defined(screenOverlay)) { @@ -2541,7 +2541,7 @@ function processScreenOverlay( dataSource, sourceResource, uriResolver, - false, + false ); if (!defined(icon)) { @@ -2558,12 +2558,12 @@ function processScreenOverlay( const screenXY = queryFirstNode( screenOverlayNode, "screenXY", - namespaces.kml, + namespaces.kml ); const overlayXY = queryFirstNode( screenOverlayNode, "overlayXY", - namespaces.kml, + namespaces.kml ); const size = queryFirstNode(screenOverlayNode, "size", namespaces.kml); @@ -2640,7 +2640,7 @@ function processScreenOverlay( if (defined(x)) { if (xUnit === "fraction") { xStyle = `${"left: " + "calc("}${Math.floor( - x * 100, + x * 100 )}% - ${xOrigin}px)`; } else if (xUnit === "pixels") { xStyle = `left: ${x - xOrigin}px`; @@ -2654,7 +2654,7 @@ function processScreenOverlay( if (defined(y)) { if (yUnit === "fraction") { yStyle = `${"bottom: " + "calc("}${Math.floor( - y * 100, + y * 100 )}% - ${yOrigin}px)`; } else if (yUnit === "pixels") { yStyle = `bottom: ${y - yOrigin}px`; @@ -2676,7 +2676,7 @@ function processGroundOverlay( dataSource, groundOverlay, processingData, - deferredLoading, + deferredLoading ) { const r = processFeature(dataSource, groundOverlay, processingData); const entity = r.entity; @@ -2687,7 +2687,7 @@ function processGroundOverlay( const ellipsoid = dataSource._ellipsoid; const positions = readCoordinates( queryFirstNode(groundOverlay, "LatLonQuad", namespaces.gx), - ellipsoid, + ellipsoid ); const zIndex = queryNumericValue(groundOverlay, "drawOrder", namespaces.kml); if (defined(positions)) { @@ -2704,7 +2704,7 @@ function processGroundOverlay( const latLonBox = queryFirstNode( groundOverlay, "LatLonBox", - namespaces.kml, + namespaces.kml ); if (defined(latLonBox)) { let west = queryNumericValue(latLonBox, "west", namespaces.kml); @@ -2741,13 +2741,13 @@ function processGroundOverlay( dataSource, processingData.sourceResource, processingData.uriResolver, - true, + true ); if (defined(href)) { if (isLatLonQuad) { oneTimeWarning( "kml-gx:LatLonQuad", - "KML - gx:LatLonQuad Icon does not support texture projection.", + "KML - gx:LatLonQuad Icon does not support texture projection." ); } const x = queryNumericValue(iconNode, "x", namespaces.gx); @@ -2758,7 +2758,7 @@ function processGroundOverlay( if (defined(x) || defined(y) || defined(w) || defined(h)) { oneTimeWarning( "kml-groundOverlay-xywh", - "KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays", + "KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays" ); } @@ -2766,7 +2766,7 @@ function processGroundOverlay( geometry.material.color = queryColorValue( groundOverlay, "color", - namespaces.kml, + namespaces.kml ); geometry.material.transparent = true; } else { @@ -2776,7 +2776,7 @@ function processGroundOverlay( let altitudeMode = queryStringValue( groundOverlay, "altitudeMode", - namespaces.kml, + namespaces.kml ); if (defined(altitudeMode)) { @@ -2785,13 +2785,13 @@ function processGroundOverlay( geometry.height = queryNumericValue( groundOverlay, "altitude", - namespaces.kml, + namespaces.kml ); geometry.zIndex = undefined; } else if (altitudeMode !== "clampToGround") { oneTimeWarning( "kml-altitudeMode-unknown", - `KML - Unknown altitudeMode: ${altitudeMode}`, + `KML - Unknown altitudeMode: ${altitudeMode}` ); } // else just use the default of 0 until we support 'clampToGround' @@ -2799,28 +2799,28 @@ function processGroundOverlay( altitudeMode = queryStringValue( groundOverlay, "altitudeMode", - namespaces.gx, + namespaces.gx ); if (altitudeMode === "relativeToSeaFloor") { oneTimeWarning( "kml-altitudeMode-relativeToSeaFloor", - "KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute.", + "KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute." ); geometry.height = queryNumericValue( groundOverlay, "altitude", - namespaces.kml, + namespaces.kml ); geometry.zIndex = undefined; } else if (altitudeMode === "clampToSeaFloor") { oneTimeWarning( "kml-altitudeMode-clampToSeaFloor", - "KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround.", + "KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround." ); } else if (defined(altitudeMode)) { oneTimeWarning( "kml-altitudeMode-unknown", - `KML - Unknown altitudeMode: ${altitudeMode}`, + `KML - Unknown altitudeMode: ${altitudeMode}` ); } } @@ -2830,7 +2830,7 @@ function processUnsupportedFeature( dataSource, node, processingData, - deferredLoading, + deferredLoading ) { dataSource._unsupportedNode.raiseEvent( dataSource, @@ -2839,11 +2839,11 @@ function processUnsupportedFeature( processingData.entityCollection, processingData.styleCollection, processingData.sourceResource, - processingData.uriResolver, + processingData.uriResolver ); oneTimeWarning( `kml-unsupportedFeature-${node.nodeName}`, - `KML - Unsupported feature: ${node.nodeName}`, + `KML - Unsupported feature: ${node.nodeName}` ); } @@ -2877,7 +2877,7 @@ function processNetworkLinkQueryString( canvas, viewBoundScale, bbox, - ellipsoid, + ellipsoid ) { function fixLatitude(value) { if (value < -CesiumMath.PI_OVER_TWO) { @@ -2914,14 +2914,14 @@ function processNetworkLinkQueryString( centerCartesian = camera.pickEllipsoid( scratchCartesian2, ellipsoid, - scratchCartesian3, + scratchCartesian3 ); } if (defined(centerCartesian)) { centerCartographic = ellipsoid.cartesianToCartographic( centerCartesian, - scratchCartographic, + scratchCartographic ); } else { centerCartographic = Rectangle.center(bbox, scratchCartographic); @@ -2938,25 +2938,25 @@ function processNetworkLinkQueryString( fixLongitude(centerCartographic.longitude - newHalfWidth), fixLatitude(centerCartographic.latitude - newHalfHeight), fixLongitude(centerCartographic.longitude + newHalfWidth), - fixLatitude(centerCartographic.latitude + newHalfHeight), + fixLatitude(centerCartographic.latitude + newHalfHeight) ); } queryString = queryString.replace( "[bboxWest]", - CesiumMath.toDegrees(bbox.west).toString(), + CesiumMath.toDegrees(bbox.west).toString() ); queryString = queryString.replace( "[bboxSouth]", - CesiumMath.toDegrees(bbox.south).toString(), + CesiumMath.toDegrees(bbox.south).toString() ); queryString = queryString.replace( "[bboxEast]", - CesiumMath.toDegrees(bbox.east).toString(), + CesiumMath.toDegrees(bbox.east).toString() ); queryString = queryString.replace( "[bboxNorth]", - CesiumMath.toDegrees(bbox.north).toString(), + CesiumMath.toDegrees(bbox.north).toString() ); const lon = CesiumMath.toDegrees(centerCartographic.longitude).toString(); @@ -2965,35 +2965,35 @@ function processNetworkLinkQueryString( queryString = queryString.replace("[lookatLat]", lat); queryString = queryString.replace( "[lookatTilt]", - CesiumMath.toDegrees(camera.pitch).toString(), + CesiumMath.toDegrees(camera.pitch).toString() ); queryString = queryString.replace( "[lookatHeading]", - CesiumMath.toDegrees(camera.heading).toString(), + CesiumMath.toDegrees(camera.heading).toString() ); queryString = queryString.replace( "[lookatRange]", - Cartesian3.distance(camera.positionWC, centerCartesian), + Cartesian3.distance(camera.positionWC, centerCartesian) ); queryString = queryString.replace("[lookatTerrainLon]", lon); queryString = queryString.replace("[lookatTerrainLat]", lat); queryString = queryString.replace( "[lookatTerrainAlt]", - centerCartographic.height.toString(), + centerCartographic.height.toString() ); ellipsoid.cartesianToCartographic(camera.positionWC, scratchCartographic); queryString = queryString.replace( "[cameraLon]", - CesiumMath.toDegrees(scratchCartographic.longitude).toString(), + CesiumMath.toDegrees(scratchCartographic.longitude).toString() ); queryString = queryString.replace( "[cameraLat]", - CesiumMath.toDegrees(scratchCartographic.latitude).toString(), + CesiumMath.toDegrees(scratchCartographic.latitude).toString() ); queryString = queryString.replace( "[cameraAlt]", - CesiumMath.toDegrees(scratchCartographic.height).toString(), + CesiumMath.toDegrees(scratchCartographic.height).toString() ); const frustum = camera.frustum; @@ -3085,18 +3085,18 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { viewRefreshMode = queryStringValue( link, "viewRefreshMode", - namespaces.kml, + namespaces.kml ); if (viewRefreshMode === "onRegion") { oneTimeWarning( "kml-refrehMode-onRegion", - "KML - Unsupported viewRefreshMode: onRegion", + "KML - Unsupported viewRefreshMode: onRegion" ); return; } viewBoundScale = defaultValue( queryStringValue(link, "viewBoundScale", namespaces.kml), - 1.0, + 1.0 ); const defaultViewFormat = viewRefreshMode === "onStop" @@ -3104,7 +3104,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { : ""; const viewFormat = defaultValue( queryStringValue(link, "viewFormat", namespaces.kml), - defaultViewFormat, + defaultViewFormat ); const httpQuery = queryStringValue(link, "httpQuery", namespaces.kml); if (defined(viewFormat)) { @@ -3121,7 +3121,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { dataSource.canvas, viewBoundScale, dataSource._lastCameraView.bbox, - ellipsoid, + ellipsoid ); } @@ -3152,11 +3152,11 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { const refreshMode = queryStringValue( link, "refreshMode", - namespaces.kml, + namespaces.kml ); let refreshInterval = defaultValue( queryNumericValue(link, "refreshInterval", namespaces.kml), - 0, + 0 ); if ( (refreshMode === "onInterval" && refreshInterval > 0) || @@ -3166,7 +3166,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { const networkLinkControl = queryFirstNode( rootElement, "NetworkLinkControl", - namespaces.kml, + namespaces.kml ); const hasNetworkLinkControl = defined(networkLinkControl); @@ -3190,18 +3190,18 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { queryStringValue( networkLinkControl, "cookie", - namespaces.kml, + namespaces.kml ), - "", - ), + "" + ) ); minRefreshPeriod = defaultValue( queryNumericValue( networkLinkControl, "minRefreshPeriod", - namespaces.kml, + namespaces.kml ), - 0, + 0 ); } @@ -3217,7 +3217,7 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { expires = queryStringValue( networkLinkControl, "expires", - namespaces.kml, + namespaces.kml ); } if (defined(expires)) { @@ -3232,13 +3232,13 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { } catch (e) { oneTimeWarning( "kml-refreshMode-onInterval-onExpire", - "KML - NetworkLinkControl expires is not a valid date", + "KML - NetworkLinkControl expires is not a valid date" ); } } else { oneTimeWarning( "kml-refreshMode-onExpire", - "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element", + "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element" ); } } else if (defined(dataSource.camera)) { @@ -3246,12 +3246,12 @@ function processNetworkLink(dataSource, node, processingData, deferredLoading) { networkLinkInfo.refreshMode = RefreshMode.STOP; networkLinkInfo.time = defaultValue( queryNumericValue(link, "viewRefreshTime", namespaces.kml), - 0, + 0 ); } else { oneTimeWarning( "kml-refrehMode-onStop-noCamera", - "A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined.", + "A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined." ); } @@ -3280,7 +3280,7 @@ function processFeatureNode(dataSource, node, processingData, deferredLoading) { dataSource, node, processingData, - deferredLoading, + deferredLoading ); } @@ -3291,7 +3291,7 @@ function loadKml( sourceResource, uriResolver, screenOverlayContainer, - context, + context ) { entityCollection.removeAll(); @@ -3319,8 +3319,8 @@ function loadKml( styleCollection, sourceResource, false, - uriResolver, - ), + uriResolver + ) ).then(function () { let element = kml.documentElement; if (element.localName === "kml") { @@ -3359,7 +3359,7 @@ function loadKmz( entityCollection, blob, sourceResource, - screenOverlayContainer, + screenOverlayContainer ) { const zWorkerUrl = buildModuleUrl("ThirdParty/Workers/z-worker-pako.js"); zip.configure({ @@ -3413,7 +3413,7 @@ function loadKmz( uriResolver.kml, sourceResource, uriResolver, - screenOverlayContainer, + screenOverlayContainer ); }); }); @@ -3461,7 +3461,7 @@ function load(dataSource, entityCollection, data, options) { entityCollection, dataToLoad, sourceUri, - screenOverlayContainer, + screenOverlayContainer ); } return readBlobAsText(dataToLoad).then(function (text) { @@ -3510,7 +3510,7 @@ function load(dataSource, entityCollection, data, options) { sourceUri, uriResolver, screenOverlayContainer, - context, + context ); }); }); @@ -3522,7 +3522,7 @@ function load(dataSource, entityCollection, data, options) { sourceUri, uriResolver, screenOverlayContainer, - context, + context ); }) .catch(function (error) { @@ -3890,8 +3890,8 @@ KmlDataSource.prototype.load = function (data, options) { clock.multiplier = Math.round( Math.min( Math.max(JulianDate.secondsDifference(stop, start) / 60, 1), - 3.15569e7, - ), + 3.15569e7 + ) ); } @@ -3951,7 +3951,7 @@ function getNetworkLinkUpdateCallback( networkLink, newEntityCollection, networkLinks, - processedHref, + processedHref ) { return function (rootElement) { if (!networkLinks.contains(networkLink.id)) { @@ -3963,7 +3963,7 @@ function getNetworkLinkUpdateCallback( const networkLinkControl = queryFirstNode( rootElement, "NetworkLinkControl", - namespaces.kml, + namespaces.kml ); const hasNetworkLinkControl = defined(networkLinkControl); @@ -3974,7 +3974,7 @@ function getNetworkLinkUpdateCallback( ) { oneTimeWarning( "kml-networkLinkControl-update", - "KML - NetworkLinkControl updates aren't supported.", + "KML - NetworkLinkControl updates aren't supported." ); networkLink.updating = false; networkLinks.remove(networkLink.id); @@ -3983,16 +3983,16 @@ function getNetworkLinkUpdateCallback( networkLink.cookie = queryToObject( defaultValue( queryStringValue(networkLinkControl, "cookie", namespaces.kml), - "", - ), + "" + ) ); minRefreshPeriod = defaultValue( queryNumericValue( networkLinkControl, "minRefreshPeriod", - namespaces.kml, + namespaces.kml ), - 0, + 0 ); } @@ -4008,7 +4008,7 @@ function getNetworkLinkUpdateCallback( expires = queryStringValue( networkLinkControl, "expires", - namespaces.kml, + namespaces.kml ); } if (defined(expires)) { @@ -4022,14 +4022,14 @@ function getNetworkLinkUpdateCallback( } catch (e) { oneTimeWarning( "kml-networkLinkControl-expires", - "KML - NetworkLinkControl expires is not a valid date", + "KML - NetworkLinkControl expires is not a valid date" ); remove = true; } } else { oneTimeWarning( "kml-refreshMode-onExpire", - "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element", + "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element" ); remove = true; } @@ -4100,7 +4100,7 @@ function getNetworkLinkUpdateCallback( networkLink.needsUpdate = false; dataSource._refresh.raiseEvent( dataSource, - processedHref.getUrlComponent(true), + processedHref.getUrlComponent(true) ); }; } @@ -4142,11 +4142,11 @@ KmlDataSource.prototype.update = function (time) { !( camera.positionWC.equalsEpsilon( lastCameraView.position, - CesiumMath.EPSILON7, + CesiumMath.EPSILON7 ) && camera.directionWC.equalsEpsilon( lastCameraView.direction, - CesiumMath.EPSILON7, + CesiumMath.EPSILON7 ) && camera.upWC.equalsEpsilon(lastCameraView.up, CesiumMath.EPSILON7) ) @@ -4209,7 +4209,7 @@ KmlDataSource.prototype.update = function (time) { that.canvas, networkLink.viewBoundScale, lastCameraView.bbox, - ellipsoid, + ellipsoid ); load(that, newEntityCollection, href, { @@ -4221,8 +4221,8 @@ KmlDataSource.prototype.update = function (time) { networkLink, newEntityCollection, newNetworkLinks, - href, - ), + href + ) ) .catch(function (error) { const msg = `NetworkLink ${networkLink.href} refresh failed: ${error}`; diff --git a/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js b/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js index 47ca6538e4c1..984ef2447ec4 100644 --- a/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js +++ b/packages/widgets/Source/BaseLayerPicker/BaseLayerPickerViewModel.js @@ -68,7 +68,7 @@ function BaseLayerPickerViewModel(options) { const imageryObservable = knockout.getObservable( this, - "imageryProviderViewModels", + "imageryProviderViewModels" ); const imageryProviders = knockout.pureComputed(function () { const providers = imageryObservable(); @@ -99,7 +99,7 @@ function BaseLayerPickerViewModel(options) { const terrainObservable = knockout.getObservable( this, - "terrainProviderViewModels", + "terrainProviderViewModels" ); const terrainProviders = knockout.pureComputed(function () { const providers = terrainObservable(); @@ -263,11 +263,12 @@ function BaseLayerPickerViewModel(options) { this._globe.terrainProvider = newProvider; } else if (defined(newProvider)) { let cancelUpdate = false; - const removeCancelListener = - this._globe.terrainProviderChanged.addEventListener(() => { + const removeCancelListener = this._globe.terrainProviderChanged.addEventListener( + () => { cancelUpdate = true; removeCancelListener(); - }); + } + ); const terrain = new Terrain(newProvider); const removeEventListener = terrain.readyEvent.addEventListener( @@ -282,7 +283,7 @@ function BaseLayerPickerViewModel(options) { ); this._globe.terrainProvider = terrainProvider; removeEventListener(); - }, + } ); } diff --git a/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js b/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js index 7e4b3e09f414..8fa5c52be42b 100644 --- a/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js +++ b/packages/widgets/Source/FullscreenButton/FullscreenButtonViewModel.js @@ -70,16 +70,13 @@ function FullscreenButtonViewModel(fullscreenElement, container) { return tmpIsFullscreen() ? "Exit full screen" : "Full screen"; }); - this._command = createCommand( - function () { - if (Fullscreen.fullscreen) { - Fullscreen.exitFullscreen(); - } else { - Fullscreen.requestFullscreen(that._fullscreenElement); - } - }, - knockout.getObservable(this, "isFullscreenEnabled"), - ); + this._command = createCommand(function () { + if (Fullscreen.fullscreen) { + Fullscreen.exitFullscreen(); + } else { + Fullscreen.requestFullscreen(that._fullscreenElement); + } + }, knockout.getObservable(this, "isFullscreenEnabled")); this._fullscreenElement = getElement(fullscreenElement) ?? ownerDocument.body; diff --git a/packages/widgets/Source/Geocoder/GeocoderViewModel.js b/packages/widgets/Source/Geocoder/GeocoderViewModel.js index 865b2e0db705..94ffac6daa3c 100644 --- a/packages/widgets/Source/Geocoder/GeocoderViewModel.js +++ b/packages/widgets/Source/Geocoder/GeocoderViewModel.js @@ -315,7 +315,7 @@ function handleArrowUp(viewModel) { return; } const currentIndex = viewModel._suggestions.indexOf( - viewModel._selectedSuggestion, + viewModel._selectedSuggestion ); if (currentIndex === -1 || currentIndex === 0) { viewModel._selectedSuggestion = undefined; @@ -332,7 +332,7 @@ function handleArrowDown(viewModel) { } const numberOfSuggestions = viewModel._suggestions.length; const currentIndex = viewModel._suggestions.indexOf( - viewModel._selectedSuggestion, + viewModel._selectedSuggestion ); const next = (currentIndex + 1) % numberOfSuggestions; viewModel._selectedSuggestion = viewModel._suggestions[next]; @@ -355,7 +355,7 @@ function computeFlyToLocationForCartographic(cartographic, terrainProvider) { cartographic = positionOnTerrain[0]; cartographic.height += DEFAULT_HEIGHT; return cartographic; - }, + } ); } @@ -374,12 +374,12 @@ function flyToDestination(viewModel, destination) { CesiumMath.equalsEpsilon( destination.south, destination.north, - CesiumMath.EPSILON7, + CesiumMath.EPSILON7 ) && CesiumMath.equalsEpsilon( destination.east, destination.west, - CesiumMath.EPSILON7, + CesiumMath.EPSILON7 ) ) { // destination is now a Cartographic @@ -471,7 +471,7 @@ async function geocode(viewModel, geocoderServices, geocodeType) { viewModel.destinationFound(viewModel, geocoderResults[0].destination); const credits = updateCredits( viewModel, - GeocoderService.getCreditsFromResult(geocoderResults[0]), + GeocoderService.getCreditsFromResult(geocoderResults[0]) ); // If the result does not contain any credits, default to the service credit. if (!defined(credits)) { diff --git a/packages/widgets/Source/InspectorShared.js b/packages/widgets/Source/InspectorShared.js index eafb8151c602..a3c2198545aa 100644 --- a/packages/widgets/Source/InspectorShared.js +++ b/packages/widgets/Source/InspectorShared.js @@ -16,7 +16,7 @@ const InspectorShared = {}; InspectorShared.createCheckbox = function ( labelText, checkedBinding, - enableBinding, + enableBinding ) { //>>includeStart('debug', pragmas.debug); Check.typeOf.string("labelText", labelText); @@ -50,7 +50,7 @@ InspectorShared.createSection = function ( panel, headerText, sectionVisibleBinding, - toggleSectionVisibilityBinding, + toggleSectionVisibilityBinding ) { //>>includeStart('debug', pragmas.debug); Check.defined("panel", panel); @@ -58,14 +58,14 @@ InspectorShared.createSection = function ( Check.typeOf.string("sectionVisibleBinding", sectionVisibleBinding); Check.typeOf.string( "toggleSectionVisibilityBinding", - toggleSectionVisibilityBinding, + toggleSectionVisibilityBinding ); //>>includeEnd('debug'); const section = document.createElement("div"); section.className = "cesium-cesiumInspector-section"; section.setAttribute( "data-bind", - `css: { "cesium-cesiumInspector-section-collapsed": !${sectionVisibleBinding} }`, + `css: { "cesium-cesiumInspector-section-collapsed": !${sectionVisibleBinding} }` ); panel.appendChild(section); @@ -74,7 +74,7 @@ InspectorShared.createSection = function ( sectionHeader.appendChild(document.createTextNode(headerText)); sectionHeader.setAttribute( "data-bind", - `click: ${toggleSectionVisibilityBinding}`, + `click: ${toggleSectionVisibilityBinding}` ); section.appendChild(sectionHeader); @@ -100,7 +100,7 @@ InspectorShared.createRangeInput = function ( min, max, step, - inputValueBinding, + inputValueBinding ) { //>>includeStart('debug', pragmas.debug); Check.typeOf.string("rangeText", rangeText); @@ -121,7 +121,7 @@ InspectorShared.createRangeInput = function ( slider.step = step ?? "any"; slider.setAttribute( "data-bind", - `valueUpdate: "input", value: ${sliderValueBinding}`, + `valueUpdate: "input", value: ${sliderValueBinding}` ); const wrapper = document.createElement("div"); @@ -146,7 +146,7 @@ InspectorShared.createRangeInput = function ( InspectorShared.createButton = function ( buttonText, clickedBinding, - activeBinding, + activeBinding ) { //>>includeStart('debug', pragmas.debug); Check.typeOf.string("buttonText", buttonText); diff --git a/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js b/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js index 861861f1ef43..768587732bc1 100644 --- a/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js +++ b/packages/widgets/Source/NavigationHelpButton/NavigationHelpButton.js @@ -59,7 +59,7 @@ function NavigationHelpButton(options) { "\ attr: { title: tooltip },\ click: command,\ -cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", +cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }" ); wrapper.appendChild(button); @@ -67,7 +67,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", instructionContainer.className = "cesium-navigation-help"; instructionContainer.setAttribute( "data-bind", - 'css: { "cesium-navigation-help-visible" : showInstructions}', + 'css: { "cesium-navigation-help-visible" : showInstructions}' ); wrapper.appendChild(instructionContainer); @@ -77,7 +77,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", "cesium-navigation-button cesium-navigation-button-left"; mouseButton.setAttribute( "data-bind", - 'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}', + 'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}' ); const mouseIcon = document.createElement("img"); mouseIcon.src = buildModuleUrl("Widgets/Images/NavigationHelp/Mouse.svg"); @@ -93,7 +93,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", "cesium-navigation-button cesium-navigation-button-right"; touchButton.setAttribute( "data-bind", - 'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}', + 'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}' ); const touchIcon = document.createElement("img"); touchIcon.src = buildModuleUrl("Widgets/Images/NavigationHelp/Touch.svg"); @@ -111,13 +111,13 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", "cesium-click-navigation-help cesium-navigation-help-instructions"; clickInstructions.setAttribute( "data-bind", - 'css: { "cesium-click-navigation-help-visible" : !_touch}', + 'css: { "cesium-click-navigation-help-visible" : !_touch}' ); clickInstructions.innerHTML = `\ \ \ \ \ \ \ \ \ \
\
Pan view
\ @@ -126,7 +126,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }",
\
Zoom view
\ @@ -136,7 +136,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }",
\
Rotate view
\ @@ -153,13 +153,13 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }", "cesium-touch-navigation-help cesium-navigation-help-instructions"; touchInstructions.setAttribute( "data-bind", - 'css: { "cesium-touch-navigation-help-visible" : _touch}', + 'css: { "cesium-touch-navigation-help-visible" : _touch}' ); touchInstructions.innerHTML = `\ \ \ \ \ \ \ \ \ \ \ \ \
\
Pan view
\ @@ -168,7 +168,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }",
\
Zoom view
\ @@ -177,7 +177,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }",
\
Tilt view
\ @@ -186,7 +186,7 @@ cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }",
\
Rotate view
\ diff --git a/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js b/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js index 9294c7c5de07..47d94cd987d3 100644 --- a/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js +++ b/packages/widgets/Source/PerformanceWatchdog/PerformanceWatchdogViewModel.js @@ -69,13 +69,13 @@ function PerformanceWatchdogViewModel(options) { if (!that.lowFrameRateMessageDismissed) { that.showingLowFrameRateMessage = true; } - }, + } ); this._unsubscribeNominalFrameRate = monitor.nominalFrameRate.addEventListener( function () { that.showingLowFrameRateMessage = false; - }, + } ); } diff --git a/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js b/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js index 0156030dacea..a63b3f046b07 100644 --- a/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js +++ b/packages/widgets/Source/SelectionIndicator/SelectionIndicatorViewModel.js @@ -22,7 +22,7 @@ const offScreen = "-1000px"; function SelectionIndicatorViewModel( scene, selectionIndicatorElement, - container, + container ) { //>>includeStart('debug', pragmas.debug); if (!defined(scene)) { @@ -109,7 +109,7 @@ SelectionIndicatorViewModel.prototype.update = function () { if (this.showSelection && defined(this.position)) { const screenPosition = this.computeScreenSpacePosition( this.position, - screenSpacePos, + screenSpacePos ); if (!defined(screenPosition)) { this._screenPositionX = offScreen; @@ -124,12 +124,12 @@ SelectionIndicatorViewModel.prototype.update = function () { screenPosition.x = Math.min( Math.max(screenPosition.x, -indicatorSize), - containerWidth + indicatorSize, + containerWidth + indicatorSize ) - halfSize; screenPosition.y = Math.min( Math.max(screenPosition.y, -indicatorSize), - containerHeight + indicatorSize, + containerHeight + indicatorSize ) - halfSize; this._screenPositionX = `${Math.floor(screenPosition.x + 0.25)}px`; diff --git a/packages/widgets/Source/Timeline/TimelineHighlightRange.js b/packages/widgets/Source/Timeline/TimelineHighlightRange.js index 81a8554ddeae..909eee97a2a8 100644 --- a/packages/widgets/Source/Timeline/TimelineHighlightRange.js +++ b/packages/widgets/Source/Timeline/TimelineHighlightRange.js @@ -35,18 +35,18 @@ TimelineHighlightRange.prototype.render = function (renderState) { if (this._start && this._stop && this._color) { const highlightStart = JulianDate.secondsDifference( this._start, - renderState.epochJulian, + renderState.epochJulian ); let highlightLeft = Math.round( - renderState.timeBarWidth * renderState.getAlpha(highlightStart), + renderState.timeBarWidth * renderState.getAlpha(highlightStart) ); const highlightStop = JulianDate.secondsDifference( this._stop, - renderState.epochJulian, + renderState.epochJulian ); let highlightWidth = Math.round( - renderState.timeBarWidth * renderState.getAlpha(highlightStop), + renderState.timeBarWidth * renderState.getAlpha(highlightStop) ) - highlightLeft; if (highlightLeft < 0) { highlightWidth += highlightLeft; diff --git a/packages/widgets/Source/VRButton/VRButtonViewModel.js b/packages/widgets/Source/VRButton/VRButtonViewModel.js index 55e3e8efb58c..2ecdb97c4695 100644 --- a/packages/widgets/Source/VRButton/VRButtonViewModel.js +++ b/packages/widgets/Source/VRButton/VRButtonViewModel.js @@ -148,12 +148,9 @@ function VRButtonViewModel(scene, vrElement) { this._locked = false; this._noSleep = new NoSleep(); - this._command = createCommand( - function () { - toggleVR(that, scene, isVRMode, isOrthographic); - }, - knockout.getObservable(this, "isVREnabled"), - ); + this._command = createCommand(function () { + toggleVR(that, scene, isVRMode, isOrthographic); + }, knockout.getObservable(this, "isVREnabled")); this._vrElement = getElement(vrElement) ?? document.body; diff --git a/packages/widgets/Source/Viewer/viewerDragDropMixin.js b/packages/widgets/Source/Viewer/viewerDragDropMixin.js index 32db22f5ed8f..1e389083c1fd 100644 --- a/packages/widgets/Source/Viewer/viewerDragDropMixin.js +++ b/packages/widgets/Source/Viewer/viewerDragDropMixin.js @@ -48,7 +48,7 @@ function viewerDragDropMixin(viewer, options) { } if (viewer.hasOwnProperty("dropEnabled")) { throw new DeveloperError( - "dropEnabled is already defined by another mixin.", + "dropEnabled is already defined by another mixin." ); } if (viewer.hasOwnProperty("dropError")) { @@ -56,12 +56,12 @@ function viewerDragDropMixin(viewer, options) { } if (viewer.hasOwnProperty("clearOnDrop")) { throw new DeveloperError( - "clearOnDrop is already defined by another mixin.", + "clearOnDrop is already defined by another mixin." ); } if (viewer.hasOwnProperty("flyToOnDrop")) { throw new DeveloperError( - "flyToOnDrop is already defined by another mixin.", + "flyToOnDrop is already defined by another mixin." ); } //>>includeEnd('debug'); @@ -283,7 +283,7 @@ function createOnLoadCallback(viewer, file, proxy, clampToGround) { viewer.dropError.raiseEvent( viewer, fileName, - `Unrecognized file: ${fileName}`, + `Unrecognized file: ${fileName}` ); return; }