@itwin/map-layers-formats 5.0.0-dev.98 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -1
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.d.ts +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMaps.d.ts +8 -125
- package/lib/cjs/GoogleMaps/GoogleMaps.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMaps.js +10 -3
- package/lib/cjs/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.d.ts +8 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.js +10 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.d.ts +10 -7
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.js +65 -67
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsSession.d.ts +152 -0
- package/lib/cjs/GoogleMaps/GoogleMapsSession.d.ts.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMapsSession.js +33 -0
- package/lib/cjs/GoogleMaps/GoogleMapsSession.js.map +1 -0
- package/lib/cjs/internal/GoogleMapsUtils.d.ts +9 -16
- package/lib/cjs/internal/GoogleMapsUtils.d.ts.map +1 -1
- package/lib/cjs/internal/GoogleMapsUtils.js +36 -40
- package/lib/cjs/internal/GoogleMapsUtils.js.map +1 -1
- package/lib/cjs/internal/NativeGoogleMapsSession.d.ts +29 -0
- package/lib/cjs/internal/NativeGoogleMapsSession.d.ts.map +1 -0
- package/lib/cjs/internal/NativeGoogleMapsSession.js +83 -0
- package/lib/cjs/internal/NativeGoogleMapsSession.js.map +1 -0
- package/lib/cjs/map-layers-formats.d.ts +2 -0
- package/lib/cjs/map-layers-formats.d.ts.map +1 -1
- package/lib/cjs/map-layers-formats.js +2 -0
- package/lib/cjs/map-layers-formats.js.map +1 -1
- package/lib/cjs/mapLayersFormats.d.ts +10 -0
- package/lib/cjs/mapLayersFormats.d.ts.map +1 -1
- package/lib/cjs/mapLayersFormats.js +5 -0
- package/lib/cjs/mapLayersFormats.js.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapDecorator.d.ts +1 -1
- package/lib/esm/GoogleMaps/GoogleMapDecorator.d.ts.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapDecorator.js.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMaps.d.ts +8 -125
- package/lib/esm/GoogleMaps/GoogleMaps.d.ts.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMaps.js +10 -3
- package/lib/esm/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.d.ts +8 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.d.ts.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.js +10 -1
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.js.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.d.ts +10 -7
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.d.ts.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.js +66 -68
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.js.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapsSession.d.ts +152 -0
- package/lib/esm/GoogleMaps/GoogleMapsSession.d.ts.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMapsSession.js +28 -0
- package/lib/esm/GoogleMaps/GoogleMapsSession.js.map +1 -0
- package/lib/esm/internal/GoogleMapsUtils.d.ts +9 -16
- package/lib/esm/internal/GoogleMapsUtils.d.ts.map +1 -1
- package/lib/esm/internal/GoogleMapsUtils.js +36 -40
- package/lib/esm/internal/GoogleMapsUtils.js.map +1 -1
- package/lib/esm/internal/NativeGoogleMapsSession.d.ts +29 -0
- package/lib/esm/internal/NativeGoogleMapsSession.d.ts.map +1 -0
- package/lib/esm/internal/NativeGoogleMapsSession.js +78 -0
- package/lib/esm/internal/NativeGoogleMapsSession.js.map +1 -0
- package/lib/esm/map-layers-formats.d.ts +2 -0
- package/lib/esm/map-layers-formats.d.ts.map +1 -1
- package/lib/esm/map-layers-formats.js +2 -0
- package/lib/esm/map-layers-formats.js.map +1 -1
- package/lib/esm/mapLayersFormats.d.ts +10 -0
- package/lib/esm/mapLayersFormats.d.ts.map +1 -1
- package/lib/esm/mapLayersFormats.js +5 -0
- package/lib/esm/mapLayersFormats.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
# Change Log - @itwin/map-layers-formats
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 13 Jun 2025 20:25:38 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.0.0
|
|
6
|
+
Fri, 13 Jun 2025 20:25:38 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Bug fix: Google Maps would only use the supplied session manager if an API key was also configured.
|
|
11
|
+
- Exposed some missing Google maps sessions structures.
|
|
12
|
+
- Added Google Maps 2D tiles support.
|
|
13
|
+
- Revisted the Google Maps 2D tiles support to allow a custom session manager to be passed.
|
|
14
|
+
- Upgrade compile target to ES2023 and module to ES2022
|
|
15
|
+
- change map-layers-formats to pure esm
|
|
16
|
+
|
|
17
|
+
## 4.11.5
|
|
18
|
+
Fri, 06 Jun 2025 13:41:18 GMT
|
|
19
|
+
|
|
20
|
+
_Version update only_
|
|
21
|
+
|
|
22
|
+
## 4.11.4
|
|
23
|
+
Tue, 03 Jun 2025 16:15:19 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
26
|
+
|
|
27
|
+
## 4.11.3
|
|
28
|
+
Wed, 28 May 2025 13:56:23 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
31
|
+
|
|
32
|
+
## 4.11.2
|
|
33
|
+
Tue, 20 May 2025 20:14:46 GMT
|
|
34
|
+
|
|
35
|
+
_Version update only_
|
|
36
|
+
|
|
37
|
+
## 4.11.1
|
|
38
|
+
Wed, 30 Apr 2025 13:13:21 GMT
|
|
39
|
+
|
|
40
|
+
_Version update only_
|
|
41
|
+
|
|
42
|
+
## 4.11.0
|
|
43
|
+
Wed, 16 Apr 2025 15:50:28 GMT
|
|
44
|
+
|
|
45
|
+
_Version update only_
|
|
46
|
+
|
|
47
|
+
## 4.10.13
|
|
48
|
+
Thu, 10 Apr 2025 17:47:21 GMT
|
|
49
|
+
|
|
50
|
+
_Version update only_
|
|
4
51
|
|
|
5
52
|
## 4.10.12
|
|
6
53
|
Wed, 02 Apr 2025 19:35:47 GMT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasDecoration, DecorateContext, Decorator, Sprite } from "@itwin/core-frontend";
|
|
2
2
|
import { Point3d } from "@itwin/core-geometry";
|
|
3
|
-
import { GoogleMapsMapTypes } from "./
|
|
3
|
+
import { GoogleMapsMapTypes } from "./GoogleMapsSession.js";
|
|
4
4
|
/** A simple decorator that show logo at the a given screen position.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapDecorator.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapDecorator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAA0B,MAAM,E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,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC;CACH;AAvBD,kDAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { CanvasDecoration, DecorateContext, Decorator, IconSprites, IModelApp, Sprite } from \"@itwin/core-frontend\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { GoogleMapsMapTypes } from \"./
|
|
1
|
+
{"version":3,"file":"GoogleMapDecorator.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapDecorator.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wDAAoH;AACpH,wDAA+C;AAI/C;;GAEG;AACH,MAAa,cAAc;IACjB,OAAO,CAAU;IAEzB,4DAA4D;IAC5C,QAAQ,GAAG,IAAI,uBAAO,EAAE,CAAC;IAEjC,OAAO,CAAoB;IAEnC,IAAW,MAAM,CAAC,MAAyB;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEH,0CAA0C;IAC1C,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,4DAA4D;IACrD,qBAAqB,CAAC,OAAwB;QACnD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ;YACzC,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjF,IAAI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AAyD;QACzD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,2BAAW,CAAC,gBAAgB,CAAC,GAAG,yBAAS,CAAC,UAAU,UAAU,SAAS,MAAM,CAAC,CAAC,CAAC;IAC5G,CAAC;IAAA,CAAC;IAEF,8BAA8B;IACvB,QAAQ,GAAG,CAAC,OAAwB,EAAE,EAAE;QAC7C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;YACrB,OAAO;QACT,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC;CACH;AAvBD,kDAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { CanvasDecoration, DecorateContext, Decorator, IconSprites, IModelApp, Sprite } from \"@itwin/core-frontend\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { GoogleMapsMapTypes } from \"./GoogleMapsSession.js\";\n\n\n/** A simple decorator that show logo at the a given screen position.\n * @internal\n */\nexport class LogoDecoration implements CanvasDecoration {\n private _sprite?: Sprite;\n\n /** The current position of the logo in view coordinates. */\n public readonly position = new Point3d();\n\n private _offset: Point3d|undefined;\n\n public set offset(offset: Point3d|undefined) {\n this._offset = offset;\n }\n\n /** The logo offset in view coordinates.*/\n public get offset() {\n return this._offset;\n }\n\n /** Move the logo to the lower left corner of the screen. */\n public moveToLowerLeftCorner(context: DecorateContext) : boolean{\n if (!this._sprite || !this._sprite.isLoaded)\n return false;\n\n this.position.x = this._offset?.x ?? 0;\n this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;\n if (this._offset?.y)\n this.position.y -= this._offset.y;\n return true;\n }\n\n /* TODO: Add other move methods as needed */\n\n /** Indicate if the logo is loaded and ready to be drawn. */\n public get isLoaded() { return this._sprite?.isLoaded ?? false; }\n\n public async activate(sprite: Sprite): Promise<boolean> {\n this._sprite = sprite;\n return new Promise<boolean>((resolve, _reject) => {\n sprite.loadPromise.then(() => {\n resolve(true);\n }).catch(() => {\n resolve (false);\n });\n });\n }\n\n /** Draw this sprite onto the supplied canvas.\n * @see [[CanvasDecoration.drawDecoration]]\n */\n public drawDecoration(ctx: CanvasRenderingContext2D): void {\n if (this.isLoaded) {\n // Draw image with an origin at the top left corner\n ctx.drawImage(this._sprite!.image!, 0, 0);\n }\n }\n\n public decorate(context: DecorateContext) {\n context.addCanvasDecoration(this);\n }\n}\n\n/** A decorator that adds the Google Maps logo to the lower left corner of the screen.\n * @internal\n*/\nexport class GoogleMapsDecorator implements Decorator {\n public readonly logo = new LogoDecoration();\n\n /** Activate the logo based on the given map type. */\n public async activate(mapType: GoogleMapsMapTypes): Promise<boolean> {\n // Pick the logo that is the most visible on the background map\n const imageName = mapType === \"roadmap\" ?\n \"google_on_white\" :\n \"google_on_non_white\";\n\n // We need to move the logo right after the 'i.js' button\n this.logo.offset = new Point3d(45, 10);\n\n return this.logo.activate(IconSprites.getSpriteFromUrl(`${IModelApp.publicPath}images/${imageName}.png`));\n };\n\n /** Decorate implementation */\n public decorate = (context: DecorateContext) => {\n if (!this.logo.isLoaded)\n return;\n this.logo.moveToLowerLeftCorner(context);\n this.logo.decorate(context);\n };\n}\n"]}
|
|
@@ -2,131 +2,7 @@
|
|
|
2
2
|
* @module MapLayersFormats
|
|
3
3
|
*/
|
|
4
4
|
import { BaseMapLayerSettings, ImageMapLayerSettings } from "@itwin/core-common";
|
|
5
|
-
import {
|
|
6
|
-
/**
|
|
7
|
-
* The type of base map.
|
|
8
|
-
* @beta*/
|
|
9
|
-
export type GoogleMapsLayerTypes = "layerRoadmap" | "layerStreetview";
|
|
10
|
-
/**
|
|
11
|
-
* Layer types that can be added to the map.
|
|
12
|
-
* @beta
|
|
13
|
-
* */
|
|
14
|
-
export type GoogleMapsMapTypes = "roadmap" | "satellite" | "terrain";
|
|
15
|
-
/**
|
|
16
|
-
* Scale factors that can be applied to labels and objects in the map.
|
|
17
|
-
* @beta
|
|
18
|
-
* */
|
|
19
|
-
export type GoogleMapsScaleFactors = "scaleFactor1x" | "scaleFactor2x" | "scaleFactor4x";
|
|
20
|
-
/**
|
|
21
|
-
* Represents the options to create a Google Maps session.
|
|
22
|
-
* @beta
|
|
23
|
-
*/
|
|
24
|
-
export interface GoogleMapsCreateSessionOptions {
|
|
25
|
-
/**
|
|
26
|
-
* The type of base map.
|
|
27
|
-
*
|
|
28
|
-
* `roadmap`: The standard Google Maps painted map tiles.
|
|
29
|
-
*
|
|
30
|
-
* `satellite`: Satellite imagery.
|
|
31
|
-
*
|
|
32
|
-
* `terrain`: Terrain imagery. When selecting `terrain` as the map type, you must also include the `layerRoadmap` layer type.
|
|
33
|
-
* @beta
|
|
34
|
-
* */
|
|
35
|
-
mapType: GoogleMapsMapTypes;
|
|
36
|
-
/**
|
|
37
|
-
* An {@link https://en.wikipedia.org/wiki/IETF_language_tag | IETF language tag} that specifies the language used to display information on the tiles. For example, `en-US` specifies the English language as spoken in the United States.
|
|
38
|
-
*/
|
|
39
|
-
language: string;
|
|
40
|
-
/**
|
|
41
|
-
* A {@link https://cldr.unicode.org/ | Common Locale Data Repository} region identifier (two uppercase letters) that represents the physical location of the user. For example, `US`.
|
|
42
|
-
*/
|
|
43
|
-
region: string;
|
|
44
|
-
/**
|
|
45
|
-
* An array of values that specifies the layer types added to the map.
|
|
46
|
-
*
|
|
47
|
-
* `layerRoadmap`: Required if you specify terrain as the map type. Can also be optionally overlaid on the satellite map type. Has no effect on roadmap tiles.
|
|
48
|
-
*
|
|
49
|
-
* `layerStreetview`: Shows Street View-enabled streets and locations using blue outlines on the map.
|
|
50
|
-
*
|
|
51
|
-
* @beta
|
|
52
|
-
* */
|
|
53
|
-
layerTypes?: GoogleMapsLayerTypes[];
|
|
54
|
-
/**
|
|
55
|
-
* Scales-up the size of map elements (such as road labels), while retaining the tile size and coverage area of the default tile.
|
|
56
|
-
* Increasing the scale also reduces the number of labels on the map, which reduces clutter.
|
|
57
|
-
*
|
|
58
|
-
* `scaleFactor1x`: The default.
|
|
59
|
-
*
|
|
60
|
-
* `scaleFactor2x`: Doubles label size and removes minor feature labels.
|
|
61
|
-
*
|
|
62
|
-
* `scaleFactor4x`: Quadruples label size and removes minor feature labels.
|
|
63
|
-
* @beta
|
|
64
|
-
* */
|
|
65
|
-
scale?: GoogleMapsScaleFactors;
|
|
66
|
-
/**
|
|
67
|
-
* A boolean value that specifies whether layerTypes should be rendered as a separate overlay, or combined with the base imagery.
|
|
68
|
-
* When true, the base map isn't displayed. If you haven't defined any layerTypes, then this value is ignored.
|
|
69
|
-
* Default is false.
|
|
70
|
-
* @beta
|
|
71
|
-
* */
|
|
72
|
-
overlay?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* An array of values specifying additional options to apply.
|
|
75
|
-
* @beta
|
|
76
|
-
* */
|
|
77
|
-
apiOptions?: string[];
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Structure representing a Google Maps session.
|
|
81
|
-
* @beta
|
|
82
|
-
*/
|
|
83
|
-
export interface GoogleMapsSession {
|
|
84
|
-
/** A session token value that you must include in all of your Map Tiles API requests. */
|
|
85
|
-
session: string;
|
|
86
|
-
/** string that contains the time (in seconds since the epoch) at which the token expires. A session token is valid for two weeks from its creation time, but this policy might change without notice. */
|
|
87
|
-
expiry: number;
|
|
88
|
-
/** The width of the tiles measured in pixels. */
|
|
89
|
-
tileWidth: number;
|
|
90
|
-
/** he height of the tiles measured in pixels. */
|
|
91
|
-
tileHeight: number;
|
|
92
|
-
/** The image format, which can be either `png` or `jpeg`. */
|
|
93
|
-
imageFormat: string;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Represents the maximum zoom level available within a bounding rectangle.
|
|
97
|
-
* @beta
|
|
98
|
-
*/
|
|
99
|
-
export interface MaxZoomRectangle {
|
|
100
|
-
maxZoom: number;
|
|
101
|
-
north: number;
|
|
102
|
-
south: number;
|
|
103
|
-
east: number;
|
|
104
|
-
west: number;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Indicate which areas of given viewport have imagery, and at which zoom levels.
|
|
108
|
-
* @beta
|
|
109
|
-
*/
|
|
110
|
-
export interface ViewportInfo {
|
|
111
|
-
/** Attribution string that you must display on your map when you display roadmap and satellite tiles. */
|
|
112
|
-
copyright: string;
|
|
113
|
-
/** Array of bounding rectangles that overlap with the current viewport. Also contains the maximum zoom level available within each rectangle.. */
|
|
114
|
-
maxZoomRects: MaxZoomRectangle[];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Request parameters for the getViewportInfo method.
|
|
118
|
-
* @beta
|
|
119
|
-
*/
|
|
120
|
-
export interface ViewportInfoRequestParams {
|
|
121
|
-
/** Bounding rectangle */
|
|
122
|
-
rectangle: MapCartoRectangle;
|
|
123
|
-
/** Session token */
|
|
124
|
-
session: string;
|
|
125
|
-
/** The Google Cloud API key */
|
|
126
|
-
key: string;
|
|
127
|
-
/** Zoom level of the viewport */
|
|
128
|
-
zoom: number;
|
|
129
|
-
}
|
|
5
|
+
import { GoogleMapsCreateSessionOptions } from "./GoogleMapsSession.js";
|
|
130
6
|
/**
|
|
131
7
|
* Google Maps API
|
|
132
8
|
* @beta
|
|
@@ -162,5 +38,12 @@ export declare const GoogleMaps: {
|
|
|
162
38
|
* @beta
|
|
163
39
|
*/
|
|
164
40
|
createBaseLayerSettings: (opts?: GoogleMapsCreateSessionOptions) => BaseMapLayerSettings;
|
|
41
|
+
/**
|
|
42
|
+
* Read the session options from the map layer settings.
|
|
43
|
+
* @param settings Map layer settings
|
|
44
|
+
* ```
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
getMapLayerSessionOptions: (settings: ImageMapLayerSettings) => GoogleMapsCreateSessionOptions;
|
|
165
48
|
};
|
|
166
49
|
//# sourceMappingURL=GoogleMaps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMaps.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMaps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"GoogleMaps.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMaps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAIxE;;;EAGE;AAEF,eAAO,MAAM,UAAU;IACrB;;;;;;;;;;;;;MAaE;oCAC8B,MAAM,SAAS,8BAA8B;IAI7E;;;;;;;;;;;;;MAaE;qCAC+B,8BAA8B;IAI/D;;;;;MAKE;0CACoC,qBAAqB;CAG5D,CAAC"}
|
|
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.GoogleMaps = void 0;
|
|
11
11
|
const core_common_1 = require("@itwin/core-common");
|
|
12
12
|
const GoogleMapsUtils_js_1 = require("../internal/GoogleMapsUtils.js");
|
|
13
|
-
;
|
|
14
|
-
;
|
|
15
13
|
/**
|
|
16
14
|
* Google Maps API
|
|
17
15
|
* @beta
|
|
@@ -51,6 +49,15 @@ exports.GoogleMaps = {
|
|
|
51
49
|
*/
|
|
52
50
|
createBaseLayerSettings: (opts) => {
|
|
53
51
|
return core_common_1.BaseMapLayerSettings.fromJSON(GoogleMapsUtils_js_1.GoogleMapsUtils.createMapLayerProps("GoogleMaps", opts));
|
|
54
|
-
}
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Read the session options from the map layer settings.
|
|
55
|
+
* @param settings Map layer settings
|
|
56
|
+
* ```
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
getMapLayerSessionOptions: (settings) => {
|
|
60
|
+
return GoogleMapsUtils_js_1.GoogleMapsUtils.getSessionOptionsFromMapLayer(settings);
|
|
61
|
+
},
|
|
55
62
|
};
|
|
56
63
|
//# sourceMappingURL=GoogleMaps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMaps.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMaps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAiF;AAEjF,uEAAiE;
|
|
1
|
+
{"version":3,"file":"GoogleMaps.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMaps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAiF;AAEjF,uEAAiE;AAGjE;;;EAGE;AACF,gEAAgE;AACnD,QAAA,UAAU,GAAG;IACxB;;;;;;;;;;;;;MAaE;IACF,sBAAsB,EAAE,CAAC,IAAa,EAAE,IAAqC,EAAE,EAAE;QAC/E,OAAO,mCAAqB,CAAC,QAAQ,CAAC,oCAAe,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;MAaE;IACF,uBAAuB,EAAE,CAAC,IAAqC,EAAE,EAAE;QACjE,OAAO,kCAAoB,CAAC,QAAQ,CAAC,oCAAe,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;IAChG,CAAC;IAED;;;;;MAKE;IACF,yBAAyB,EAAE,CAAC,QAA+B,EAAE,EAAE;QAC7D,OAAO,oCAAe,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module MapLayersFormats\n */\n\nimport { BaseMapLayerSettings, ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { GoogleMapsCreateSessionOptions } from \"./GoogleMapsSession.js\";\nimport { GoogleMapsUtils } from \"../internal/GoogleMapsUtils.js\";\n\n\n/**\n * Google Maps API\n * @beta\n*/\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const GoogleMaps = {\n /**\n * Creates Google Maps map-layer settings.\n * @param name Name of the layer (Defaults to \"GoogleMaps\")\n * @param opts Options to create the session (Defaults to satellite map type, English language, US region, and roadmap layer type)\n *\n * The following examples illustrates how a Googles Map layer can be attached to a viewport:\n * ```ts\n * [[include:GoogleMaps_AttachMapLayerSimple]]\n * ```\n * ```ts\n * [[include:GoogleMaps_AttachMapLayerOpts]]\n * ```\n * @beta\n */\n createMapLayerSettings: (name?: string, opts?: GoogleMapsCreateSessionOptions) => {\n return ImageMapLayerSettings.fromJSON(GoogleMapsUtils.createMapLayerProps(name, opts));\n },\n\n /**\n * Creates Google Maps base layer settings.\n * @param name Name of the layer (Defaults to \"GoogleMaps\")\n * @param opts Options to create the session (Defaults to satellite map type, English language, US region, and roadmap layer type)\n *\n * The following examples illustrates how a Google Maps base layer can be set on a viewport:\n * ```ts\n * [[include:GoogleMaps_BaseMapSimple]]\n * ```\n * ```ts\n * [[include:GoogleMaps_BaseMapOpts]]\n * ```\n * @beta\n */\n createBaseLayerSettings: (opts?: GoogleMapsCreateSessionOptions) => {\n return BaseMapLayerSettings.fromJSON(GoogleMapsUtils.createMapLayerProps(\"GoogleMaps\", opts));\n },\n\n /**\n * Read the session options from the map layer settings.\n * @param settings Map layer settings\n * ```\n * @beta\n */\n getMapLayerSessionOptions: (settings: ImageMapLayerSettings) => {\n return GoogleMapsUtils.getSessionOptionsFromMapLayer(settings);\n },\n};\n"]}
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { ImageMapLayerSettings } from "@itwin/core-common";
|
|
5
5
|
import { ImageryMapLayerFormat, MapLayerImageryProvider } from "@itwin/core-frontend";
|
|
6
|
+
/**
|
|
7
|
+
* Google Maps imagery layer format.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
6
10
|
export declare class GoogleMapsMapLayerFormat extends ImageryMapLayerFormat {
|
|
11
|
+
/** Google Maps imagery layer format.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
7
14
|
static formatId: string;
|
|
15
|
+
/** @internal */
|
|
8
16
|
static createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined;
|
|
9
17
|
}
|
|
10
18
|
//# sourceMappingURL=GoogleMapsImageryFormat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsImageryFormat.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryFormat.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"GoogleMapsImageryFormat.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryFormat.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAItF;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,qBAAqB;IACjE;;OAEG;IACH,OAAuB,QAAQ,SAAgB;IAE/C,gBAAgB;WACO,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,GAAG,SAAS;CAGnH"}
|
|
@@ -10,10 +10,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.GoogleMapsMapLayerFormat = void 0;
|
|
11
11
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
12
|
const GoogleMapsImageryProvider_js_1 = require("./GoogleMapsImageryProvider.js");
|
|
13
|
+
const mapLayersFormats_js_1 = require("../mapLayersFormats.js");
|
|
14
|
+
/**
|
|
15
|
+
* Google Maps imagery layer format.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
13
18
|
class GoogleMapsMapLayerFormat extends core_frontend_1.ImageryMapLayerFormat {
|
|
19
|
+
/** Google Maps imagery layer format.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
14
22
|
static formatId = "GoogleMaps";
|
|
23
|
+
/** @internal */
|
|
15
24
|
static createImageryProvider(settings) {
|
|
16
|
-
return new GoogleMapsImageryProvider_js_1.GoogleMapsImageryProvider(settings);
|
|
25
|
+
return new GoogleMapsImageryProvider_js_1.GoogleMapsImageryProvider(settings, mapLayersFormats_js_1.MapLayersFormats.googleMapsOpts?.sessionManager);
|
|
17
26
|
}
|
|
18
27
|
}
|
|
19
28
|
exports.GoogleMapsMapLayerFormat = GoogleMapsMapLayerFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsImageryFormat.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAsF;AACtF,iFAA2E;
|
|
1
|
+
{"version":3,"file":"GoogleMapsImageryFormat.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAsF;AACtF,iFAA2E;AAC3E,gEAA0D;AAE1D;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,qCAAqB;IACjE;;OAEG;IACI,MAAM,CAAU,QAAQ,GAAG,YAAY,CAAC;IAE/C,gBAAgB;IACT,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,OAAO,IAAI,wDAAyB,CAAC,QAAQ,EAAE,sCAAgB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAClG,CAAC;;AATH,4DAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module MapLayersFormats\n */\n\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { ImageryMapLayerFormat, MapLayerImageryProvider } from \"@itwin/core-frontend\";\nimport { GoogleMapsImageryProvider } from \"./GoogleMapsImageryProvider.js\";\nimport { MapLayersFormats } from \"../mapLayersFormats.js\";\n\n/**\n * Google Maps imagery layer format.\n * @public\n */\nexport class GoogleMapsMapLayerFormat extends ImageryMapLayerFormat {\n /** Google Maps imagery layer format.\n * @public\n */\n public static override formatId = \"GoogleMaps\";\n\n /** @internal */\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\n return new GoogleMapsImageryProvider(settings, MapLayersFormats.googleMapsOpts?.sessionManager);\n }\n}\n"]}
|
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
* @module MapLayersFormats
|
|
3
3
|
*/
|
|
4
4
|
import { ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
|
|
5
|
-
import { DecorateContext,
|
|
6
|
-
import {
|
|
5
|
+
import { DecorateContext, MapCartoRectangle, MapLayerImageryProvider, ScreenViewport } from "@itwin/core-frontend";
|
|
6
|
+
import { GoogleMapsCreateSessionOptions, GoogleMapsSessionManager, ViewportInfo } from "./GoogleMapsSession.js";
|
|
7
7
|
export declare class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
8
8
|
private _decorator;
|
|
9
9
|
private _hadUnrecoverableError;
|
|
10
10
|
private _tileSize;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
private _sessionManager?;
|
|
12
|
+
private _sessionOptions;
|
|
13
|
+
private _activeSession?;
|
|
14
|
+
constructor(settings: ImageMapLayerSettings, sessionManager?: GoogleMapsSessionManager);
|
|
14
15
|
get tileSize(): number;
|
|
15
16
|
initialize(): Promise<void>;
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
protected getSessionManager(): Promise<GoogleMapsSessionManager>;
|
|
18
|
+
protected createCreateSessionOptions(settings: ImageMapLayerSettings): GoogleMapsCreateSessionOptions;
|
|
19
|
+
constructUrl(_row: number, _column: number, _level: number): Promise<string>;
|
|
20
|
+
fetchViewportInfo(rectangle: MapCartoRectangle, zoomLevel: number): Promise<ViewportInfo>;
|
|
18
21
|
private fetchAttributions;
|
|
19
22
|
private logJsonError;
|
|
20
23
|
loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsImageryProvider.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"GoogleMapsImageryProvider.d.ts","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAa,iBAAiB,EAAE,uBAAuB,EAAwB,cAAc,EAAQ,MAAM,sBAAsB,CAAC;AAE1J,OAAO,EAAG,8BAA8B,EAAuF,wBAAwB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAUtM,qBAAa,yBAA0B,SAAQ,uBAAuB;IAEpE,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,SAAS,CAAO;IACxB,OAAO,CAAC,eAAe,CAAC,CAA2B;IACnD,OAAO,CAAC,eAAe,CAA2C;IAClE,OAAO,CAAC,cAAc,CAAC,CAAoB;gBAC/B,QAAQ,EAAE,qBAAqB,EAAE,cAAc,CAAC,EAAE,wBAAwB;IAMtF,IAAoB,QAAQ,IAAI,MAAM,CAA2B;IAE3C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;cAajC,iBAAiB,IAAK,OAAO,CAAC,wBAAwB,CAAC;IAavE,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,qBAAqB,GAAG,8BAA8B;IAoCxF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI5E,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;YAoBxF,iBAAiB;YAiCjB,YAAY;IASJ,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAiDhG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAIxD,OAAO,CAAC,gBAAgB;IAIF,eAAe,CAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBnG"}
|
|
@@ -10,68 +10,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.GoogleMapsImageryProvider = void 0;
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
12
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
|
-
const GoogleMapsUtils_js_1 = require("../internal/GoogleMapsUtils.js");
|
|
14
13
|
const GoogleMapDecorator_js_1 = require("./GoogleMapDecorator.js");
|
|
14
|
+
const NativeGoogleMapsSession_js_1 = require("../internal/NativeGoogleMapsSession.js");
|
|
15
|
+
const GoogleMapsUtils_js_1 = require("../internal/GoogleMapsUtils.js");
|
|
15
16
|
const loggerCategory = "MapLayersFormats.GoogleMaps";
|
|
16
|
-
const levelToken = "{level}";
|
|
17
|
-
const rowToken = "{row}";
|
|
18
|
-
const columnToken = "{column}";
|
|
19
|
-
const urlTemplate = `https://tile.googleapis.com/v1/2dtiles/${levelToken}/${columnToken}/${rowToken}`;
|
|
20
17
|
/*
|
|
21
18
|
* Google Maps imagery provider
|
|
22
|
-
* @
|
|
19
|
+
* @beta
|
|
23
20
|
*/
|
|
24
21
|
class GoogleMapsImageryProvider extends core_frontend_1.MapLayerImageryProvider {
|
|
25
22
|
_decorator;
|
|
26
23
|
_hadUnrecoverableError = false;
|
|
27
24
|
_tileSize = 256;
|
|
28
|
-
|
|
25
|
+
_sessionManager;
|
|
26
|
+
_sessionOptions;
|
|
27
|
+
_activeSession;
|
|
28
|
+
constructor(settings, sessionManager) {
|
|
29
29
|
super(settings, true);
|
|
30
30
|
this._decorator = new GoogleMapDecorator_js_1.GoogleMapsDecorator();
|
|
31
|
-
|
|
32
|
-
static validateUrlTemplate(template) {
|
|
33
|
-
return { status: (template.indexOf(levelToken) > 0 && template.indexOf(columnToken) > 0 && template.indexOf(rowToken) > 0) ? core_frontend_1.MapLayerSourceStatus.Valid : core_frontend_1.MapLayerSourceStatus.InvalidUrl };
|
|
34
|
-
}
|
|
35
|
-
async createSession() {
|
|
36
|
-
const sessionOptions = this.createCreateSessionOptions();
|
|
37
|
-
if (this._settings.accessKey) {
|
|
38
|
-
// Create session and store in query parameters
|
|
39
|
-
const sessionObj = await GoogleMapsUtils_js_1.GoogleMapsUtils.createSession(this._settings.accessKey.value, sessionOptions);
|
|
40
|
-
this._settings.unsavedQueryParams = { session: sessionObj.session };
|
|
41
|
-
return sessionObj;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
core_bentley_1.Logger.logError(loggerCategory, `Missing GoogleMaps api key`);
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
31
|
+
this._sessionManager = sessionManager;
|
|
47
32
|
}
|
|
48
33
|
get tileSize() { return this._tileSize; }
|
|
49
34
|
async initialize() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
this._sessionOptions = GoogleMapsUtils_js_1.GoogleMapsUtils.getSessionOptionsFromMapLayer(this._settings);
|
|
36
|
+
this._sessionManager = await this.getSessionManager();
|
|
37
|
+
this._activeSession = await this._sessionManager.createSession(this._sessionOptions);
|
|
38
|
+
;
|
|
39
|
+
this._tileSize = this._activeSession.getTileSize();
|
|
40
|
+
const isActivated = await this._decorator.activate(this._settings.properties.mapType);
|
|
41
|
+
if (!isActivated) {
|
|
42
|
+
const msg = `Failed to activate decorator`;
|
|
56
43
|
core_bentley_1.Logger.logError(loggerCategory, msg);
|
|
57
44
|
throw new core_bentley_1.BentleyError(core_bentley_1.BentleyStatus.ERROR, msg);
|
|
58
45
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
}
|
|
47
|
+
async getSessionManager() {
|
|
48
|
+
if (this._sessionManager)
|
|
49
|
+
return this._sessionManager;
|
|
50
|
+
if (this._settings.accessKey?.value) {
|
|
51
|
+
return new NativeGoogleMapsSession_js_1.NativeGoogleMapsSessionManager(this._settings.accessKey.value);
|
|
64
52
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!isActivated) {
|
|
68
|
-
const msg = `Failed to activate decorator`;
|
|
53
|
+
else {
|
|
54
|
+
const msg = `Missing GoogleMaps api key`;
|
|
69
55
|
core_bentley_1.Logger.logError(loggerCategory, msg);
|
|
70
56
|
throw new core_bentley_1.BentleyError(core_bentley_1.BentleyStatus.ERROR, msg);
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
|
-
createCreateSessionOptions() {
|
|
74
|
-
const layerPropertyKeys =
|
|
59
|
+
createCreateSessionOptions(settings) {
|
|
60
|
+
const layerPropertyKeys = settings.properties ? Object.keys(settings.properties) : undefined;
|
|
75
61
|
if (layerPropertyKeys === undefined ||
|
|
76
62
|
!layerPropertyKeys.includes("mapType") ||
|
|
77
63
|
!layerPropertyKeys.includes("language") ||
|
|
@@ -81,11 +67,11 @@ class GoogleMapsImageryProvider extends core_frontend_1.MapLayerImageryProvider
|
|
|
81
67
|
throw new core_bentley_1.BentleyError(core_bentley_1.BentleyStatus.ERROR, msg);
|
|
82
68
|
}
|
|
83
69
|
const createSessionOptions = {
|
|
84
|
-
mapType:
|
|
70
|
+
mapType: settings.properties.mapType,
|
|
85
71
|
region: this._settings.properties.region,
|
|
86
72
|
language: this._settings.properties.language,
|
|
87
73
|
};
|
|
88
|
-
if (this._settings.properties?.layerTypes
|
|
74
|
+
if (Array.isArray(this._settings.properties?.layerTypes) && this._settings.properties.layerTypes.length > 0) {
|
|
89
75
|
createSessionOptions.layerTypes = this._settings.properties.layerTypes;
|
|
90
76
|
}
|
|
91
77
|
if (this._settings.properties?.scale !== undefined) {
|
|
@@ -99,15 +85,27 @@ class GoogleMapsImageryProvider extends core_frontend_1.MapLayerImageryProvider
|
|
|
99
85
|
}
|
|
100
86
|
return createSessionOptions;
|
|
101
87
|
}
|
|
102
|
-
//
|
|
103
|
-
async constructUrl(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
// not used, see loadTile
|
|
89
|
+
async constructUrl(_row, _column, _level) {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
async fetchViewportInfo(rectangle, zoomLevel) {
|
|
93
|
+
if (!this._activeSession) {
|
|
94
|
+
core_bentley_1.Logger.logError(loggerCategory, `Session is not initialized`);
|
|
95
|
+
throw new core_bentley_1.BentleyError(core_bentley_1.BentleyStatus.ERROR, "Session is not initialized");
|
|
96
|
+
}
|
|
97
|
+
const req = this._activeSession.getViewportInfoRequest(rectangle, zoomLevel);
|
|
98
|
+
const request = new Request(req.url, { method: "GET" });
|
|
99
|
+
if (req.authorization) {
|
|
100
|
+
request.headers.set("Authorization", req.authorization);
|
|
101
|
+
}
|
|
102
|
+
// Add the session token to the request
|
|
103
|
+
const response = await fetch(request);
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
core_bentley_1.Logger.logError(loggerCategory, `Error while loading viewport info: ${response.statusText}`);
|
|
106
|
+
throw new core_bentley_1.BentleyError(core_bentley_1.BentleyStatus.ERROR, `Error while loading viewport info: ${response.statusText}`);
|
|
107
|
+
}
|
|
108
|
+
return response.json();
|
|
111
109
|
}
|
|
112
110
|
async fetchAttributions(tiles) {
|
|
113
111
|
const zooms = new Set();
|
|
@@ -126,14 +124,9 @@ class GoogleMapsImageryProvider extends core_frontend_1.MapLayerImageryProvider
|
|
|
126
124
|
cartoRect = rect;
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
|
-
if (cartoRect) {
|
|
127
|
+
if (cartoRect && this._activeSession) {
|
|
130
128
|
try {
|
|
131
|
-
const viewportInfo = await
|
|
132
|
-
rectangle: cartoRect,
|
|
133
|
-
session: this._settings.collectQueryParams().session,
|
|
134
|
-
key: this._settings.accessKey.value,
|
|
135
|
-
zoom
|
|
136
|
-
});
|
|
129
|
+
const viewportInfo = await this.fetchViewportInfo(cartoRect, zoom);
|
|
137
130
|
if (viewportInfo?.copyright) {
|
|
138
131
|
matchingAttributions.push(viewportInfo.copyright);
|
|
139
132
|
}
|
|
@@ -155,18 +148,23 @@ class GoogleMapsImageryProvider extends core_frontend_1.MapLayerImageryProvider
|
|
|
155
148
|
}
|
|
156
149
|
}
|
|
157
150
|
async loadTile(row, column, zoomLevel) {
|
|
151
|
+
const tilePos = { row, column, level: zoomLevel };
|
|
158
152
|
if (this._hadUnrecoverableError)
|
|
159
153
|
return undefined;
|
|
154
|
+
if (this._activeSession === undefined || this._sessionOptions === undefined) {
|
|
155
|
+
core_bentley_1.Logger.logError(loggerCategory, `Session manager is not initialized`);
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
160
158
|
try {
|
|
161
|
-
let
|
|
162
|
-
let tileResponse = await this.makeTileRequest(
|
|
159
|
+
let tileRequest = this._activeSession.getTileRequest(tilePos);
|
|
160
|
+
let tileResponse = await this.makeTileRequest(tileRequest.url.toString(), undefined, tileRequest.authorization);
|
|
163
161
|
if (!tileResponse.ok) {
|
|
164
|
-
if (tileResponse.headers.get("content-type")?.includes("application/json")) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
tileResponse = await this.makeTileRequest(
|
|
162
|
+
if (tileResponse.headers.get("content-type")?.includes("application/json") && this._sessionManager) {
|
|
163
|
+
try {
|
|
164
|
+
// Session might have expired, lets try to refresh it
|
|
165
|
+
this._activeSession = await this._sessionManager.createSession(this._sessionOptions);
|
|
166
|
+
tileRequest = this._activeSession.getTileRequest(tilePos);
|
|
167
|
+
tileResponse = await this.makeTileRequest(tileRequest.url.toString(), undefined, tileRequest.authorization);
|
|
170
168
|
if (!tileResponse.ok) {
|
|
171
169
|
if (tileResponse.headers.get("content-type")?.includes("application/json")) {
|
|
172
170
|
await this.logJsonError(tileResponse);
|
|
@@ -178,7 +176,7 @@ class GoogleMapsImageryProvider extends core_frontend_1.MapLayerImageryProvider
|
|
|
178
176
|
return undefined;
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
|
-
|
|
179
|
+
catch {
|
|
182
180
|
await this.logJsonError(tileResponse);
|
|
183
181
|
}
|
|
184
182
|
}
|