ol 9.0.0-dev.1708359055761 → 9.0.0-dev.1708373609339

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "9.0.0-dev.1708359055761",
3
+ "version": "9.0.0-dev.1708373609339",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
@@ -2,9 +2,6 @@ export default ZIndexContext;
2
2
  export type ZIndexContextProxy = CanvasRenderingContext2D & {
3
3
  globalAlpha: any;
4
4
  };
5
- /**
6
- * @module ol/render/canvas/ZIndexContext
7
- */
8
5
  /** @typedef {CanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
9
6
  /**
10
7
  * @extends {CanvasRenderingContext2D}
@@ -1 +1 @@
1
- {"version":3,"file":"ZIndexContext.d.ts","sourceRoot":"","sources":["ZIndexContext.js"],"names":[],"mappings":";iCAIc,wBAAwB,GAAG;IAAC,WAAW,EAAE,GAAG,CAAA;CAAC;AAJ3D;;GAEG;AAEH,kFAAkF;AAElF;;GAEG;AACH;IAEI;;;OAGG;IACH,sBAAuB;IACvB;;OAEG;IACH,QAFU,MAAM,CAED;IACf;;;OAGG;IACH,gBAAgB;IAEhB;;OAEG;IACH,UAFU,kBAAkB,CAuB3B;IAGH;;;;OAIG;IACH,wBAGE;IAEF;;;;;;OAMG;IACH,cAFY,kBAAkB,CAI7B;IAED;;OAEG;IACH,cAFW,wBAAwB,QAkBlC;IAED,cAIC;IAED;;;OAGG;IACH,eAGC;CACF"}
1
+ {"version":3,"file":"ZIndexContext.d.ts","sourceRoot":"","sources":["ZIndexContext.js"],"names":[],"mappings":";iCAMc,wBAAwB,GAAG;IAAC,WAAW,EAAE,GAAG,CAAA;CAAC;AAA3D,kFAAkF;AAElF;;GAEG;AACH;IAEI;;;OAGG;IACH,sBAAuB;IACvB;;OAEG;IACH,QAFU,MAAM,CAED;IACf;;;OAGG;IACH,gBAAgB;IAEhB;;OAEG;IACH,UAFU,kBAAkB,CA0B3B;IAGH;;;;OAIG;IACH,wBAGE;IAEF;;;;;;OAMG;IACH,cAFY,kBAAkB,CAI7B;IAED;;OAEG;IACH,cAFW,wBAAwB,QAkBlC;IAED,cAIC;IAED;;;OAGG;IACH,eAGC;CACF"}
@@ -2,6 +2,8 @@
2
2
  * @module ol/render/canvas/ZIndexContext
3
3
  */
4
4
 
5
+ import {getSharedCanvasContext2D} from '../../dom.js';
6
+
5
7
  /** @typedef {CanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */
6
8
 
7
9
  /**
@@ -30,7 +32,10 @@ class ZIndexContext {
30
32
  this.context_ = /** @type {ZIndexContextProxy} */ (
31
33
  new Proxy(CanvasRenderingContext2D.prototype, {
32
34
  get: (target, property) => {
33
- if (typeof (/** @type {*} */ (target)[property]) !== 'function') {
35
+ if (
36
+ typeof (/** @type {*} */ (getSharedCanvasContext2D())[property]) !==
37
+ 'function'
38
+ ) {
34
39
  // we only accept calling functions on the proxy, not accessing properties
35
40
  return undefined;
36
41
  }
@@ -56,6 +56,10 @@ declare class CanvasTileLayerRenderer<LayerType extends import("../../layer/Tile
56
56
  * @type {import("../../TileRange.js").default}
57
57
  */
58
58
  private tmpTileRange_;
59
+ /**
60
+ * @type {ZIndexContext}
61
+ */
62
+ deferredContext_: ZIndexContext;
59
63
  /**
60
64
  * @protected
61
65
  * @param {import("../../Tile.js").default} tile Tile.
@@ -142,4 +146,5 @@ declare class CanvasTileLayerRenderer<LayerType extends import("../../layer/Tile
142
146
  protected manageTilePyramid(frameState: import("../../Map.js").FrameState, tileSource: import("../../source/Tile.js").default, tileGrid: import("../../tilegrid/TileGrid.js").default, pixelRatio: number, projection: import("../../proj/Projection.js").default, extent: import("../../extent.js").Extent, currentZ: number, preload: number, tileCallback?: ((arg0: import("../../Tile.js").default) => void) | undefined): void;
143
147
  }
144
148
  import CanvasLayerRenderer from './Layer.js';
149
+ import ZIndexContext from '../../render/canvas/ZIndexContext.js';
145
150
  //# sourceMappingURL=TileLayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":";AA8BA;;;;;;GAMG;AACH;IACE;;OAEG;IACH,uBAFW,SAAS,EA0DnB;IArDC;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,8BAFU,MAAM,CAEO;IAEvB;;;OAGG;IACH,8BAFU,OAAO,0BAA0B,EAAE,OAAO,CAEtB;IAE9B;;;OAGG;IACH,4BAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,yBAFW,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CAE1B;IAEvB;;;OAGG;IACH,kBAAsB;IAEtB;;;OAGG;IACH,qBAFU,OAAO,iBAAiB,EAAE,MAAM,CAEZ;IAE9B;;;OAGG;IACH,sBAA8C;IAGhD;;;;OAIG;IACH,+BAHW,OAAO,eAAe,EAAE,OAAO,GAC9B,OAAO,CAWlB;IAED;;;;;;OAMG;IACH,WANW,MAAM,KACN,MAAM,KACN,MAAM,cACN,OAAO,cAAc,EAAE,UAAU,GAC/B,OAAO,eAAe,EAAE,OAAO,CAkB3C;IAED;;;OAGG;IACH,eAHW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,iBAAiB,CA4E5B;IAwBD;;;;;OAKG;IACH,wBAJW,OAAO,cAAc,EAAE,UAAU,UACjC,WAAW,GACV,WAAW,CAsUtB;IAED;;;;;;;;;OASG;IACH,oBATW,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,cAAc,EAAE,UAAU,KACjC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,cACN,OAAO,QAqCjB;IAED;;OAEG;IACH,YAFY,iBAAiB,CAK5B;IAED;;;;;OAKG;IACH,6BAJW,OAAO,oBAAoB,EAAE,OAAO,GACnC,iB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H,WANW,MAAM,KACN,MAAM,KACN,MAAM,cACN,OAAO,cAAc,EAAE,UAAU,GAC/B,OAAO,eAAe,EAAE,OAAO,CAkB3C;IAED;;;OAGG;IACH,eAHW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,iBAAiB,CA4E5B;IAwBD;;;;;OAKG;IACH,wBAJW,OAAO,cAAc,EAAE,UAAU,UACjC,WAAW,GACV,WAAW,CAwUtB;IAYD;;;;;;;;;OASG;IACH,oBATW,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,cAAc,EAAE,UAAU,KACjC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,cACN,OAAO,QAyCjB;IAED;;OAEG;IACH,YAFY,iBAAiB,CAK5B;IAED;;;;;OAKG;IACH,6BAJW,OAAO,oBAAoB,EAAE,OAAO,GACnC,iBAAiB,GAAC,gBAAgB,GAAC,gBAAgB,CAK9D;IAED;;;;OAIG;IACH,0CAJW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,OAAO,QA0BhD;IAED;;;;;OAKG;IACH;YALmB,MAAM;gBAAU,MAAM,GAAE,OAAO;;mBACvC,OAAO,sBAAsB,EAAE,OAAO,QACtC,OAAO,eAAe,EAAE,OAAO,QAUzC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,wCAXW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,OAAO,YACtC,OAAO,4BAA4B,EAAE,OAAO,cAC5C,MAAM,cACN,OAAO,0BAA0B,EAAE,OAAO,UAC1C,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,WACN,MAAM,yBACG,OAAO,eAAe,EAAE,OAAO,KAAE,IAAI,qBAmExD;CACF;gCApxB+B,YAAY;0BAKlB,sCAAsC"}
@@ -6,6 +6,7 @@ import ImageTile from '../../ImageTile.js';
6
6
  import ReprojTile from '../../reproj/Tile.js';
7
7
  import TileRange from '../../TileRange.js';
8
8
  import TileState from '../../TileState.js';
9
+ import ZIndexContext from '../../render/canvas/ZIndexContext.js';
9
10
  import {
10
11
  apply as applyTransform,
11
12
  compose as composeTransform,
@@ -95,6 +96,13 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
95
96
  * @type {import("../../TileRange.js").default}
96
97
  */
97
98
  this.tmpTileRange_ = new TileRange(0, 0, 0, 0);
99
+
100
+ /**
101
+ * @type {ZIndexContext}
102
+ */
103
+ this.deferredContext_ = tileLayer.getDeclutter()
104
+ ? new ZIndexContext()
105
+ : null;
98
106
  }
99
107
 
100
108
  /**
@@ -383,8 +391,10 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
383
391
  const canvasTransform = toTransformString(this.pixelTransform);
384
392
 
385
393
  this.useContainer(target, canvasTransform, this.getBackground(frameState));
386
- const context = this.context;
387
- const canvas = context.canvas;
394
+ const context = this.deferredContext_
395
+ ? this.deferredContext_.getContext()
396
+ : this.context;
397
+ const canvas = this.context.canvas;
388
398
 
389
399
  makeInverse(this.inversePixelTransform, this.pixelTransform);
390
400
 
@@ -558,7 +568,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
558
568
  );
559
569
  this.scheduleExpireCache(frameState, tileSource);
560
570
 
561
- this.postRender(context, frameState);
571
+ this.postRender(this.context, frameState);
562
572
 
563
573
  if (layerState.extent) {
564
574
  context.restore();
@@ -572,6 +582,16 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
572
582
  return this.container;
573
583
  }
574
584
 
585
+ /**
586
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
587
+ */
588
+ renderDeferredInternal(frameState) {
589
+ if (this.deferredContext_) {
590
+ this.deferredContext_.draw(this.context);
591
+ this.deferredContext_.clear();
592
+ }
593
+ }
594
+
575
595
  /**
576
596
  * @param {import("../../ImageTile.js").default} tile Tile.
577
597
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -587,17 +607,21 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
587
607
  if (!image) {
588
608
  return;
589
609
  }
610
+ /** @type {import('../../render/canvas/ZIndexContext.js').ZIndexContextProxy} */
611
+ const context = this.deferredContext_
612
+ ? this.deferredContext_.getContext()
613
+ : this.context;
590
614
  const uid = getUid(this);
591
615
  const layerState = frameState.layerStatesArray[frameState.layerIndex];
592
616
  const alpha =
593
617
  layerState.opacity *
594
618
  (transition ? tile.getAlpha(uid, frameState.time) : 1);
595
- const alphaChanged = alpha !== this.context.globalAlpha;
619
+ const alphaChanged = alpha !== context.globalAlpha;
596
620
  if (alphaChanged) {
597
- this.context.save();
598
- this.context.globalAlpha = alpha;
621
+ context.save();
622
+ context.globalAlpha = alpha;
599
623
  }
600
- this.context.drawImage(
624
+ context.drawImage(
601
625
  image,
602
626
  gutter,
603
627
  gutter,
@@ -610,7 +634,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
610
634
  );
611
635
 
612
636
  if (alphaChanged) {
613
- this.context.restore();
637
+ context.restore();
614
638
  }
615
639
  if (alpha !== layerState.opacity) {
616
640
  frameState.animate = true;
@@ -77,7 +77,6 @@ declare class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer<impo
77
77
  * @param {import("../../layer/Layer.js").State} layerState Layer state.
78
78
  */
79
79
  renderDeclutter(frameState: import("../../Map.js").FrameState, layerState: import("../../layer/Layer.js").State): void;
80
- renderDeferredInternal(): void;
81
80
  getTileRenderTransform(tile: any, frameState: any): number[];
82
81
  /**
83
82
  * @param {import("../../Feature.js").FeatureLike} feature Feature.
@@ -1 +1 @@
1
- {"version":3,"file":"VectorTileLayer.d.ts","sourceRoot":"","sources":["VectorTileLayer.js"],"names":[],"mappings":";AA4DA;;;;;GAKG;AACH;IACE;;OAEG;IACH,mBAFW,OAAO,2BAA2B,EAAE,OAAO,EA2CrD;IAtCC,eAAe;IACf,qCAA2E;IAE3E;;;OAGG;IACH,+BAA2B;IAE3B;;;OAGG;IACH,4CAA+C;IAE/C;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IAC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C,SAAS,CAY5B;IAkCD;;;OAGG;IACH,qBAHW,OAAO,2BAA2B,EAAE,OAAO,GAC1C,OAAO,CAUlB;IAED;;OAEG;IACH,6BAEC;IAgBD;;;;;OAKG;IACH,6BAqHC;IAyND;;;;OAIG;IACH,gCAEC;IAED;;;;OAIG;IACH,4BAHW,OAAO,cAAc,EAAE,UAAU,cACjC,OAAO,sBAAsB,EAAE,KAAK,QAiC9C;IAqDD,6DA+BC;IAgID;;;;;;;;OAQG;IACH,uBARW,OAAO,kBAAkB,EAAE,WAAW,oBACtC,MAAM,UACN,OAAO,sBAAsB,EAAE,OAAO,GAAC,MAAM,OAAO,sBAAsB,EAAE,OAAO,CAAC,gBACpF,OAAO,qCAAqC,EAAE,OAAO,gEAGpD,OAAO,CAyClB;IAED;;;;OAIG;IACH,8BAcC;IAED;;;;OAIG;IACH,yBAwDC;CACF;oCAz5BmC,gBAAgB"}
@@ -583,7 +583,11 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
583
583
  context.globalAlpha = alpha;
584
584
  }
585
585
 
586
- renderDeferredInternal() {
586
+ /**
587
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
588
+ */
589
+ renderDeferredInternal(frameState) {
590
+ super.renderDeferredInternal(frameState);
587
591
  const tiles =
588
592
  /** @type {Array<import("../../VectorRenderTile.js").default>} */ (
589
593
  this.renderedTiles
@@ -0,0 +1,255 @@
1
+ export default Google;
2
+ export type Options = {
3
+ /**
4
+ * Google Map Tiles API key. Get yours at https://developers.google.com/maps/documentation/tile/get-api-key.
5
+ */
6
+ key: string;
7
+ /**
8
+ * The type of [base map](https://developers.google.com/maps/documentation/tile/session_tokens#required_fields).
9
+ */
10
+ mapType?: string | undefined;
11
+ /**
12
+ * An [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) for information displayed on the tiles.
13
+ */
14
+ language?: string | undefined;
15
+ /**
16
+ * A [Common Locale Data Repository](https://cldr.unicode.org/) (CLDR) region identifier that represents the user location.
17
+ */
18
+ region?: string | undefined;
19
+ /**
20
+ * The image format used for the map tiles (e.g. `'jpeg'`, or `'png'`).
21
+ */
22
+ imageFormat?: string | undefined;
23
+ /**
24
+ * Scale for map elements (`'scaleFactor1x'`, `'scaleFactor2x'`, or `'scaleFactor4x'`).
25
+ */
26
+ scale?: string | undefined;
27
+ /**
28
+ * Use high-resolution tiles.
29
+ */
30
+ highDpi?: boolean | undefined;
31
+ /**
32
+ * The layer types added to the map (e.g. `'layerRoadmap'`, `'layerStreetview'`, or `'layerTraffic'`).
33
+ */
34
+ layerTypes?: string[] | undefined;
35
+ /**
36
+ * Display only the `layerTypes` and not the underlying `mapType` (only works if `layerTypes` is provided).
37
+ */
38
+ overlay?: boolean | undefined;
39
+ /**
40
+ * [Custom styles](https://developers.google.com/maps/documentation/tile/style-reference) applied to the map.
41
+ */
42
+ styles?: any[] | undefined;
43
+ /**
44
+ * Attributions.
45
+ */
46
+ attributions?: import("./Source.js").AttributionLike | undefined;
47
+ /**
48
+ * Use interpolated values when resampling. By default,
49
+ * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
50
+ */
51
+ interpolate?: boolean | undefined;
52
+ /**
53
+ * Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
54
+ */
55
+ cacheSize?: number | undefined;
56
+ /**
57
+ * Maximum allowed reprojection error (in pixels).
58
+ * Higher values can increase reprojection performance, but decrease precision.
59
+ */
60
+ reprojectionErrorThreshold?: number | undefined;
61
+ /**
62
+ * Optional function to load a tile given a URL. The default is
63
+ * ```js
64
+ * function(imageTile, src) {
65
+ * imageTile.getImage().src = src;
66
+ * };
67
+ * ```
68
+ */
69
+ tileLoadFunction?: import("../Tile.js").LoadFunction | undefined;
70
+ /**
71
+ * Wrap the world horizontally.
72
+ */
73
+ wrapX?: boolean | undefined;
74
+ /**
75
+ * Duration of the opacity transition for rendering.
76
+ * To disable the opacity transition, pass `transition: 0`.
77
+ */
78
+ transition?: number | undefined;
79
+ /**
80
+ * Choose whether to use tiles with a higher or lower zoom level when between integer
81
+ * zoom levels. See {@link module :ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
82
+ */
83
+ zDirection?: number | import("../array.js").NearestDirectionFunction | undefined;
84
+ };
85
+ export type SessionTokenRequest = {
86
+ /**
87
+ * The map type.
88
+ */
89
+ mapType: string;
90
+ /**
91
+ * The language.
92
+ */
93
+ language: string;
94
+ /**
95
+ * The region.
96
+ */
97
+ region: string;
98
+ /**
99
+ * The image format.
100
+ */
101
+ imageFormat?: string | undefined;
102
+ /**
103
+ * The scale.
104
+ */
105
+ scale?: string | undefined;
106
+ /**
107
+ * Use high resolution tiles.
108
+ */
109
+ highDpi?: boolean | undefined;
110
+ /**
111
+ * The layer types.
112
+ */
113
+ layerTypes?: string[] | undefined;
114
+ /**
115
+ * The overlay.
116
+ */
117
+ overlay?: boolean | undefined;
118
+ /**
119
+ * The styles.
120
+ */
121
+ styles?: any[] | undefined;
122
+ };
123
+ export type SessionTokenResponse = {
124
+ /**
125
+ * The session token.
126
+ */
127
+ session: string;
128
+ /**
129
+ * The session token expiry (seconds since the epoch as a string).
130
+ */
131
+ expiry: string;
132
+ /**
133
+ * The tile width.
134
+ */
135
+ tileWidth: number;
136
+ /**
137
+ * The tile height.
138
+ */
139
+ tileHeight: number;
140
+ /**
141
+ * The image format.
142
+ */
143
+ imageFormat: string;
144
+ };
145
+ /**
146
+ * @typedef {Object} Options
147
+ * @property {string} key Google Map Tiles API key. Get yours at https://developers.google.com/maps/documentation/tile/get-api-key.
148
+ * @property {string} [mapType='roadmap'] The type of [base map](https://developers.google.com/maps/documentation/tile/session_tokens#required_fields).
149
+ * @property {string} [language='en-US'] An [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) for information displayed on the tiles.
150
+ * @property {string} [region='US'] A [Common Locale Data Repository](https://cldr.unicode.org/) (CLDR) region identifier that represents the user location.
151
+ * @property {string} [imageFormat] The image format used for the map tiles (e.g. `'jpeg'`, or `'png'`).
152
+ * @property {string} [scale] Scale for map elements (`'scaleFactor1x'`, `'scaleFactor2x'`, or `'scaleFactor4x'`).
153
+ * @property {boolean} [highDpi=false] Use high-resolution tiles.
154
+ * @property {Array<string>} [layerTypes] The layer types added to the map (e.g. `'layerRoadmap'`, `'layerStreetview'`, or `'layerTraffic'`).
155
+ * @property {boolean} [overlay=false] Display only the `layerTypes` and not the underlying `mapType` (only works if `layerTypes` is provided).
156
+ * @property {Array<Object>} [styles] [Custom styles](https://developers.google.com/maps/documentation/tile/style-reference) applied to the map.
157
+ * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
158
+ * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
159
+ * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
160
+ * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
161
+ * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
162
+ * Higher values can increase reprojection performance, but decrease precision.
163
+ * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
164
+ * ```js
165
+ * function(imageTile, src) {
166
+ * imageTile.getImage().src = src;
167
+ * };
168
+ * ```
169
+ * @property {boolean} [wrapX=true] Wrap the world horizontally.
170
+ * @property {number} [transition] Duration of the opacity transition for rendering.
171
+ * To disable the opacity transition, pass `transition: 0`.
172
+ * @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
173
+ * Choose whether to use tiles with a higher or lower zoom level when between integer
174
+ * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
175
+ */
176
+ /**
177
+ * @typedef {Object} SessionTokenRequest
178
+ * @property {string} mapType The map type.
179
+ * @property {string} language The language.
180
+ * @property {string} region The region.
181
+ * @property {string} [imageFormat] The image format.
182
+ * @property {string} [scale] The scale.
183
+ * @property {boolean} [highDpi] Use high resolution tiles.
184
+ * @property {Array<string>} [layerTypes] The layer types.
185
+ * @property {boolean} [overlay] The overlay.
186
+ * @property {Array<Object>} [styles] The styles.
187
+ */
188
+ /**
189
+ * @typedef {Object} SessionTokenResponse
190
+ * @property {string} session The session token.
191
+ * @property {string} expiry The session token expiry (seconds since the epoch as a string).
192
+ * @property {number} tileWidth The tile width.
193
+ * @property {number} tileHeight The tile height.
194
+ * @property {string} imageFormat The image format.
195
+ */
196
+ /**
197
+ * @classdesc
198
+ * A tile layer source that renders tiles from the Google [Map Tiles API](https://developers.google.com/maps/documentation/tile/overview).
199
+ * The constructor takes options that are passed to the request to create a session token. Refer to the
200
+ * [documentation](https://developers.google.com/maps/documentation/tile/session_tokens#required_fields)
201
+ * for additional details.
202
+ * @api
203
+ */
204
+ declare class Google extends TileImage {
205
+ /**
206
+ * @param {Options} options Google Maps options.
207
+ */
208
+ constructor(options: Options);
209
+ /**
210
+ * @type {string}
211
+ * @private
212
+ */
213
+ private apiKey_;
214
+ /**
215
+ * @type {Error|null}
216
+ */
217
+ error_: Error | null;
218
+ /**
219
+ * @type {SessionTokenRequest}
220
+ * @private
221
+ */
222
+ private sessionTokenRequest_;
223
+ /**
224
+ * @type {ReturnType<typeof setTimeout>}
225
+ * @private
226
+ */
227
+ private sessionRefreshId_;
228
+ /**
229
+ * @return {Error|null} A source loading error. When the source state is `error`, use this function
230
+ * to get more information about the error. To debug a faulty configuration, you may want to use
231
+ * a listener like
232
+ * ```js
233
+ * source.on('change', () => {
234
+ * if (source.getState() === 'error') {
235
+ * console.error(source.getError());
236
+ * }
237
+ * });
238
+ * ```
239
+ */
240
+ getError(): Error | null;
241
+ /**
242
+ * Exposed here so it can be overridden in the tests.
243
+ * @param {string} url The URL.
244
+ * @param {RequestInit} config The config.
245
+ * @return {Promise<Response>} A promise that resolves with the response.
246
+ */
247
+ fetchSessionToken(url: string, config: RequestInit): Promise<Response>;
248
+ /**
249
+ * Get or renew a session token for use with tile requests.
250
+ * @private
251
+ */
252
+ private createSession_;
253
+ }
254
+ import TileImage from './TileImage.js';
255
+ //# sourceMappingURL=Google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Google.d.ts","sourceRoot":"","sources":["Google.js"],"names":[],"mappings":";;;;;SAmBc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAgCN,MAAM;;;;cACN,MAAM;;;;YACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAWN,MAAM;;;;YACN,MAAM;;;;eACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM;;AAnDpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA0EjB;IAnDC;;;OAGG;IACH,gBAA0B;IAE1B;;OAEG;IACH,QAFU,KAAK,GAAC,IAAI,CAEF;IA6BlB;;;OAGG;IACH,6BAA+C;IAE/C;;;OAGG;IACH,0BAAsB;IAKxB;;;;;;;;;;;OAWG;IACH,YAXY,KAAK,GAAC,IAAI,CAarB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,WAAW,GACV,QAAQ,QAAQ,CAAC,CAI5B;IAED;;;OAGG;IACH,uBAuDC;CAMF;sBApPqB,gBAAgB"}