Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cesium/widgets

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cesium/widgets - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

Source/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png

10

index.js

@@ -1,2 +0,2 @@

globalThis.CESIUM_VERSION = "1.104";
globalThis.CESIUM_VERSION = "1.105";
export { default as ClockViewModel } from './Source/ClockViewModel.js';

@@ -16,8 +16,6 @@ export { default as Command } from './Source/Command.js';

export { default as createDefaultTerrainProviderViewModels } from './Source/BaseLayerPicker/createDefaultTerrainProviderViewModels.js';
export { default as Cesium3DTilesInspector } from './Source/Cesium3DTilesInspector/Cesium3DTilesInspector.js';
export { default as Cesium3DTilesInspectorViewModel } from './Source/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js';
export { default as CesiumInspector } from './Source/CesiumInspector/CesiumInspector.js';
export { default as CesiumInspectorViewModel } from './Source/CesiumInspector/CesiumInspectorViewModel.js';
export { default as Cesium3DTilesInspector } from './Source/Cesium3DTilesInspector/Cesium3DTilesInspector.js';
export { default as Cesium3DTilesInspectorViewModel } from './Source/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js';
export { default as Geocoder } from './Source/Geocoder/Geocoder.js';
export { default as GeocoderViewModel } from './Source/Geocoder/GeocoderViewModel.js';
export { default as FullscreenButton } from './Source/FullscreenButton/FullscreenButton.js';

@@ -27,2 +25,4 @@ export { default as FullscreenButtonViewModel } from './Source/FullscreenButton/FullscreenButtonViewModel.js';

export { default as HomeButtonViewModel } from './Source/HomeButton/HomeButtonViewModel.js';
export { default as Geocoder } from './Source/Geocoder/Geocoder.js';
export { default as GeocoderViewModel } from './Source/Geocoder/GeocoderViewModel.js';
export { default as InfoBox } from './Source/InfoBox/InfoBox.js';

@@ -29,0 +29,0 @@ export { default as InfoBoxViewModel } from './Source/InfoBox/InfoBoxViewModel.js';

{
"name": "@cesium/widgets",
"version": "2.1.1",
"version": "2.2.0",
"description": "A widgets library for use with CesiumJS. CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.",

@@ -31,3 +31,3 @@ "keywords": [

"dependencies": {
"@cesium/engine": "2.2.0",
"@cesium/engine": "2.3.0",
"nosleep.js": "^0.12.0"

@@ -34,0 +34,0 @@ },

@@ -9,2 +9,3 @@ import {

TileMapServiceImageryProvider,
ArcGisBaseMapType,
} from "@cesium/engine";

@@ -64,19 +65,20 @@ import ProviderViewModel from "./ProviderViewModel.js";

new ProviderViewModel({
name: "ESRI World Imagery",
name: "ArcGIS World Imagery",
iconUrl: buildModuleUrl(
"Widgets/Images/ImageryProviders/esriWorldImagery.png"
"Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png"
),
tooltip:
"\
World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution \
satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales \
(above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat \
imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in \
parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, \
i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been \
contributed by the GIS User Community.\nhttp://www.esri.com",
ArcGIS World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower \
resolution satellite imagery worldwide. The map includes 15m TerraColor imagery at small and mid-scales (~1:591M down to ~1:288k) \
for the world. The map features Maxar imagery at 0.3m resolution for select metropolitan areas around the world, 0.5m \
resolution across the United States and parts of Western Europe, and 1m resolution imagery across the rest of the world. \
In addition to commercial sources, the World Imagery map features high-resolution aerial photography contributed by the \
GIS User Community. This imagery ranges from 0.3m to 0.03m resolution (down to ~1:280 nin select communities). \
For more information on this map, including the terms of use, visit us online at \n\
https://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9",
category: "Other",
creationFunction: function () {
return ArcGisMapServerImageryProvider.fromUrl(
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
return ArcGisMapServerImageryProvider.fromBasemapType(
ArcGisBaseMapType.SATELLITE,
{

@@ -92,16 +94,17 @@ enablePickFeatures: false,

new ProviderViewModel({
name: "ESRI World Street Map",
name: "ArcGIS World Hillshade",
iconUrl: buildModuleUrl(
"Widgets/Images/ImageryProviders/esriWorldStreetMap.png"
"Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png"
),
tooltip:
"\
This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of \
Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, \
Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.\n\
http://www.esri.com",
ArcGIS World Hillshade map portrays elevation as an artistic hillshade. This map is designed to be used as a backdrop for topographical, soil, hydro, \
landcover or other outdoor recreational maps. The map was compiled from a variety of sources from several data providers. \
The basemap has global coverage down to a scale of ~1:72k. In select areas of the United States and Europe, coverage is available \
down to ~1:9k. For more information on this map, including the terms of use, visit us online at \n\
https://www.arcgis.com/home/item.html?id=1b243539f4514b6ba35e7d995890db1d",
category: "Other",
creationFunction: function () {
return ArcGisMapServerImageryProvider.fromUrl(
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",
return ArcGisMapServerImageryProvider.fromBasemapType(
ArcGisBaseMapType.HILLSHADE,
{

@@ -117,15 +120,20 @@ enablePickFeatures: false,

new ProviderViewModel({
name: "ESRI National Geographic",
name: "Esri World Ocean",
iconUrl: buildModuleUrl(
"Widgets/Images/ImageryProviders/esriNationalGeographic.png"
"Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png"
),
tooltip:
"\
This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map \
for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web \
mapping applications.\nhttp://www.esri.com",
ArcGIS World Ocean map is designed to be used as a base map by marine GIS professionals and as a reference map by anyone interested in ocean data. \
The base map features marine bathymetry. Land features include inland waters and roads overlaid on land cover and shaded relief imagery. \
The map was compiled from a variety of best available sources from several data providers, including General Bathymetric Chart of the Oceans GEBCO_08 Grid, \
National Oceanic and Atmospheric Administration (NOAA), and National Geographic, Garmin, HERE, Geonames.org, and Esri, and various other contributors. \
The base map currently provides coverage for the world down to a scale of ~1:577k, and coverage down to 1:72k in US coastal areas, and various other areas. \
Coverage down to ~ 1:9k is available limited areas based on regional hydrographic survey data. The base map was designed and developed by Esri. \
For more information on this map, including our terms of use, visit us online at \n\
https://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500",
category: "Other",
creationFunction: function () {
return ArcGisMapServerImageryProvider.fromUrl(
"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",
return ArcGisMapServerImageryProvider.fromBasemapType(
ArcGisBaseMapType.OCEANS,
{

@@ -132,0 +140,0 @@ enablePickFeatures: false,

@@ -7,3 +7,5 @@ import {

DeveloperError,
destroyObject,
Event,
GeocoderService,
GeocodeType,

@@ -57,3 +59,4 @@ getElement,

this._isSearchInProgress = false;
this._geocodePromise = undefined;
this._wasGeocodeCancelled = false;
this._previousCredits = [];
this._complete = new Event();

@@ -87,3 +90,3 @@ this._suggestions = [];

} else {
geocode(that, that._geocoderServices, geocodeType);
return geocode(that, that._geocoderServices, geocodeType);
}

@@ -424,25 +427,16 @@ });

function chainPromise(promise, geocoderService, query, geocodeType) {
return promise.then(function (result) {
if (
defined(result) &&
result.state === "fulfilled" &&
result.value.length > 0
) {
return result;
}
const nextPromise = geocoderService
.geocode(query, geocodeType)
.then(function (result) {
return { state: "fulfilled", value: result };
})
.catch(function (err) {
return { state: "rejected", reason: err };
});
return nextPromise;
});
async function attemptGeocode(geocoderService, query, geocodeType) {
try {
const result = await geocoderService.geocode(query, geocodeType);
return {
state: "fulfilled",
value: result,
credits: geocoderService.credit,
};
} catch (error) {
return { state: "rejected", reason: error };
}
}
function geocode(viewModel, geocoderServices, geocodeType) {
async function geocode(viewModel, geocoderServices, geocodeType) {
const query = viewModel._searchText;

@@ -456,29 +450,82 @@

viewModel._isSearchInProgress = true;
viewModel._wasGeocodeCancelled = false;
let promise = Promise.resolve();
for (let i = 0; i < geocoderServices.length; i++) {
promise = chainPromise(promise, geocoderServices[i], query, geocodeType);
}
viewModel._geocodePromise = promise;
promise.then(function (result) {
if (promise.cancel) {
let i;
let result;
for (i = 0; i < geocoderServices.length; i++) {
if (viewModel._wasGeocodeCancelled) {
return;
}
viewModel._isSearchInProgress = false;
const geocoderResults = result.value;
result = await attemptGeocode(geocoderServices[i], query, geocodeType);
if (
defined(result) &&
result.state === "fulfilled" &&
defined(geocoderResults) &&
geocoderResults.length > 0
result.value.length > 0
) {
viewModel._searchText = geocoderResults[0].displayName;
viewModel.destinationFound(viewModel, geocoderResults[0].destination);
return;
break;
}
viewModel._searchText = `${query} (not found)`;
});
}
if (viewModel._wasGeocodeCancelled) {
return;
}
viewModel._isSearchInProgress = false;
clearCredits(viewModel);
const geocoderResults = result.value;
if (
result.state === "fulfilled" &&
defined(geocoderResults) &&
geocoderResults.length > 0
) {
viewModel._searchText = geocoderResults[0].displayName;
viewModel.destinationFound(viewModel, geocoderResults[0].destination);
const credits = updateCredits(
viewModel,
GeocoderService.getCreditsFromResult(geocoderResults[0])
);
// If the result does not contain any credits, default to the service credit.
if (!defined(credits)) {
updateCredit(viewModel, geocoderServices[i].credit);
}
return;
}
viewModel._searchText = `${query} (not found)`;
}
function updateCredit(viewModel, credit) {
if (
defined(credit) &&
!viewModel._scene.isDestroyed() &&
!viewModel._scene.frameState.creditDisplay.isDestroyed()
) {
viewModel._scene.frameState.creditDisplay.addStaticCredit(credit);
viewModel._previousCredits.push(credit);
}
}
function updateCredits(viewModel, credits) {
if (defined(credits)) {
credits.forEach((credit) => updateCredit(viewModel, credit));
}
return credits;
}
function clearCredits(viewModel) {
if (
!viewModel._scene.isDestroyed() &&
!viewModel._scene.frameState.creditDisplay.isDestroyed()
) {
viewModel._previousCredits.forEach((credit) => {
viewModel._scene.frameState.creditDisplay.removeStaticCredit(credit);
});
}
viewModel._previousCredits.length = 0;
}
function adjustSuggestionsScroll(viewModel, focusedItemIndex) {

@@ -504,6 +551,5 @@ const container = getElement(viewModel._viewContainer);

function cancelGeocode(viewModel) {
viewModel._isSearchInProgress = false;
if (defined(viewModel._geocodePromise)) {
viewModel._geocodePromise.cancel = true;
viewModel._geocodePromise = undefined;
if (viewModel._isSearchInProgress) {
viewModel._isSearchInProgress = false;
viewModel._wasGeocodeCancelled = true;
}

@@ -520,3 +566,3 @@ }

function updateSearchSuggestions(viewModel) {
async function updateSearchSuggestions(viewModel) {
if (!viewModel.autoComplete) {

@@ -529,2 +575,4 @@ return;

clearSuggestions(viewModel);
clearCredits(viewModel);
if (hasOnlyWhitespace(query)) {

@@ -534,22 +582,23 @@ return;

let promise = Promise.resolve([]);
viewModel._geocoderServices.forEach(function (service) {
promise = promise.then(function (results) {
if (results.length >= 5) {
return results;
for (const service of viewModel._geocoderServices) {
const newResults = await service.geocode(query, GeocodeType.AUTOCOMPLETE);
viewModel._suggestions = viewModel._suggestions.concat(newResults);
if (newResults.length > 0) {
let useDefaultCredit = true;
newResults.forEach((result) => {
const credits = GeocoderService.getCreditsFromResult(result);
useDefaultCredit = useDefaultCredit && !defined(credits);
updateCredits(viewModel, credits);
});
// Use the service credit if there were no attributions in the results
if (useDefaultCredit) {
updateCredit(viewModel, service.credit);
}
return service
.geocode(query, GeocodeType.AUTOCOMPLETE)
.then(function (newResults) {
results = results.concat(newResults);
return results;
});
});
});
return promise.then(function (results) {
const suggestions = viewModel._suggestions;
for (let i = 0; i < results.length; i++) {
suggestions.push(results[i]);
}
});
if (viewModel._suggestions.length >= 5) {
return;
}
}
}

@@ -566,2 +615,18 @@

GeocoderViewModel._adjustSuggestionsScroll = adjustSuggestionsScroll;
/**
* @returns {boolean} true if the object has been destroyed, false otherwise.
*/
GeocoderViewModel.prototype.isDestroyed = function () {
return false;
};
/**
* Destroys the widget. Should be called if permanently
* removing the widget from layout.
*/
GeocoderViewModel.prototype.destroy = function () {
clearCredits(this);
return destroyObject(this);
};
export default GeocoderViewModel;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc