BingMapsApi.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import defined from "./defined.js";
  2. import deprecationWarning from "./deprecationWarning.js";
  3. var defaultKey;
  4. /**
  5. * Object for setting and retrieving the default Bing Maps API key.
  6. *
  7. * A Bing API key is only required if you are using {@link BingMapsImageryProvider}
  8. * or {@link BingMapsGeocoderService}. You can create your own key at
  9. * {@link https://www.bingmapsportal.com/}.
  10. *
  11. * @namespace BingMapsApi
  12. * @deprecated
  13. */
  14. var BingMapsApi = {};
  15. Object.defineProperties(BingMapsApi, {
  16. /**
  17. * The default Bing Maps API key to use if one is not provided to the
  18. * constructor of an object that uses the Bing Maps API.
  19. *
  20. * @type {String}
  21. * @memberof BingMapsApi
  22. * @deprecated
  23. */
  24. defaultKey: {
  25. set: function (value) {
  26. defaultKey = value;
  27. deprecationWarning(
  28. "bing-maps-api-default-key",
  29. "BingMapsApi.defaultKey is deprecated and will be removed in CesiumJS 1.73. Pass your access token directly to the BingMapsGeocoderService or BingMapsImageryProvider constructors."
  30. );
  31. },
  32. get: function () {
  33. return defaultKey;
  34. },
  35. },
  36. });
  37. /**
  38. * Gets the key to use to access the Bing Maps API. If the provided
  39. * key is defined, it is returned. Otherwise, returns {@link BingMapsApi.defaultKey}.
  40. * @param {string|null|undefined} providedKey The provided key to use if defined.
  41. * @returns {string|undefined} The Bing Maps API key to use.
  42. * @deprecated
  43. */
  44. BingMapsApi.getKey = function (providedKey) {
  45. deprecationWarning(
  46. "bing-maps-api-get-key",
  47. "BingMapsApi.getKey is deprecated and will be removed in CesiumJS 1.73. Pass your access token directly to the BingMapsGeocoderService or BingMapsImageryProvider constructors."
  48. );
  49. return BingMapsApi._getKeyNoDeprecate(providedKey);
  50. };
  51. BingMapsApi._getKeyNoDeprecate = function (providedKey) {
  52. if (defined(providedKey)) {
  53. return providedKey;
  54. }
  55. return BingMapsApi.defaultKey;
  56. };
  57. export default BingMapsApi;