@itwin/map-layers-formats 5.1.0-dev.9 → 5.2.0-dev.1
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 +60 -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 -68
- 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/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 +65 -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 +18 -16
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.d.ts +0 -36
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.d.ts.map +0 -1
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.js +0 -87
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.js.map +0 -1
- package/lib/esm/GoogleMaps/GoogleMapDecorator.d.ts +0 -36
- package/lib/esm/GoogleMaps/GoogleMapDecorator.d.ts.map +0 -1
- package/lib/esm/GoogleMaps/GoogleMapDecorator.js +0 -82
- package/lib/esm/GoogleMaps/GoogleMapDecorator.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./ArcGisFeature/ArcGisFeatureProvider.js";
|
|
2
2
|
export * from "./GoogleMaps/GoogleMaps.js";
|
|
3
|
+
export * from "./GoogleMaps/GoogleMapsSession.js";
|
|
4
|
+
export * from "./GoogleMaps/GoogleMapsImageryFormat.js";
|
|
3
5
|
export * from "./mapLayersFormats.js";
|
|
4
6
|
export * from "./Tools/MapFeatureInfoTool.js";
|
|
5
7
|
/** @docs-package-description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers-formats.d.ts","sourceRoot":"","sources":["../../src/map-layers-formats.ts"],"names":[],"mappings":"AAKA,cAAc,0CAA0C,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAE9C;;GAEG;AAEH;;GAEG"}
|
|
1
|
+
{"version":3,"file":"map-layers-formats.d.ts","sourceRoot":"","sources":["../../src/map-layers-formats.ts"],"names":[],"mappings":"AAKA,cAAc,0CAA0C,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAA;AACvD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAE9C;;GAEG;AAEH;;GAEG"}
|
|
@@ -20,6 +20,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
__exportStar(require("./ArcGisFeature/ArcGisFeatureProvider.js"), exports);
|
|
22
22
|
__exportStar(require("./GoogleMaps/GoogleMaps.js"), exports);
|
|
23
|
+
__exportStar(require("./GoogleMaps/GoogleMapsSession.js"), exports);
|
|
24
|
+
__exportStar(require("./GoogleMaps/GoogleMapsImageryFormat.js"), exports);
|
|
23
25
|
__exportStar(require("./mapLayersFormats.js"), exports);
|
|
24
26
|
__exportStar(require("./Tools/MapFeatureInfoTool.js"), exports);
|
|
25
27
|
/** @docs-package-description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers-formats.js","sourceRoot":"","sources":["../../src/map-layers-formats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,2EAAyD;AACzD,6DAA2C;AAC3C,wDAAsC;AACtC,gEAA8C;AAE9C;;GAEG;AAEH;;GAEG","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\nexport * from \"./ArcGisFeature/ArcGisFeatureProvider.js\";\nexport * from \"./GoogleMaps/GoogleMaps.js\";\nexport * from \"./mapLayersFormats.js\";\nexport * from \"./Tools/MapFeatureInfoTool.js\";\n\n/** @docs-package-description\n * This package provides support for additional map layer formats that are not included in the @itwin/core-frontend package.\n */\n\n/** @docs-group-description MapLayersFormats\n * APIs for working with the map layer formats provided by this package.\n */\n"]}
|
|
1
|
+
{"version":3,"file":"map-layers-formats.js","sourceRoot":"","sources":["../../src/map-layers-formats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,2EAAyD;AACzD,6DAA2C;AAC3C,oEAAkD;AAClD,0EAAuD;AACvD,wDAAsC;AACtC,gEAA8C;AAE9C;;GAEG;AAEH;;GAEG","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\nexport * from \"./ArcGisFeature/ArcGisFeatureProvider.js\";\nexport * from \"./GoogleMaps/GoogleMaps.js\";\nexport * from \"./GoogleMaps/GoogleMapsSession.js\";\nexport * from \"./GoogleMaps/GoogleMapsImageryFormat.js\"\nexport * from \"./mapLayersFormats.js\";\nexport * from \"./Tools/MapFeatureInfoTool.js\";\n\n/** @docs-package-description\n * This package provides support for additional map layer formats that are not included in the @itwin/core-frontend package.\n */\n\n/** @docs-group-description MapLayersFormats\n * APIs for working with the map layer formats provided by this package.\n */\n"]}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { Localization } from "@itwin/core-common";
|
|
2
|
+
import { GoogleMapsSessionManager } from "./map-layers-formats.js";
|
|
2
3
|
/** Configuration options.
|
|
3
4
|
* @beta
|
|
4
5
|
*/
|
|
5
6
|
export interface MapLayersFormatsConfig {
|
|
6
7
|
localization?: Localization;
|
|
8
|
+
googleMapsOpts?: GoogleMapsOptions;
|
|
9
|
+
}
|
|
10
|
+
/** Google Maps options.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface GoogleMapsOptions {
|
|
14
|
+
sessionManager?: GoogleMapsSessionManager;
|
|
7
15
|
}
|
|
8
16
|
/** The primary API for the `@itwin/map-layers-formats` package. It allows the package's features to be [[initialize]]d.
|
|
9
17
|
* @beta
|
|
@@ -11,6 +19,7 @@ export interface MapLayersFormatsConfig {
|
|
|
11
19
|
export declare class MapLayersFormats {
|
|
12
20
|
private static _defaultNs;
|
|
13
21
|
static localization: Localization;
|
|
22
|
+
private static _googleMapsOpts?;
|
|
14
23
|
/** Registers the [MapLayerFormat]($frontend)s provided by this package for use with [IModelApp]($frontend).
|
|
15
24
|
* Typically, an application will call `MapLayersFormats.initialize` immediately after [IModelApp.startup]($frontend).
|
|
16
25
|
* This function has no effect if called **before** [IModelApp.startup]($frontend) or **after** [IModelApp.shutdown]($frontend).
|
|
@@ -18,5 +27,6 @@ export declare class MapLayersFormats {
|
|
|
18
27
|
static initialize(config?: MapLayersFormatsConfig): Promise<void>;
|
|
19
28
|
/** The internationalization service namespace. */
|
|
20
29
|
static get localizationNamespace(): string;
|
|
30
|
+
static get googleMapsOpts(): GoogleMapsOptions | undefined;
|
|
21
31
|
}
|
|
22
32
|
//# sourceMappingURL=mapLayersFormats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayersFormats.d.ts","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"mapLayersFormats.d.ts","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,wBAAwB,CAAA;CAC1C;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAsB;IAC/C,OAAc,YAAY,EAAE,YAAY,CAAC;IAEzC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAoB;IAEnD;;;OAGG;WACiB,UAAU,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9E,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,WAAkB,cAAc,kCAE/B;CAEF"}
|
|
@@ -20,6 +20,7 @@ const MapFeatureInfoTool_js_1 = require("./Tools/MapFeatureInfoTool.js");
|
|
|
20
20
|
class MapLayersFormats {
|
|
21
21
|
static _defaultNs = "mapLayersFormats";
|
|
22
22
|
static localization;
|
|
23
|
+
static _googleMapsOpts;
|
|
23
24
|
/** Registers the [MapLayerFormat]($frontend)s provided by this package for use with [IModelApp]($frontend).
|
|
24
25
|
* Typically, an application will call `MapLayersFormats.initialize` immediately after [IModelApp.startup]($frontend).
|
|
25
26
|
* This function has no effect if called **before** [IModelApp.startup]($frontend) or **after** [IModelApp.shutdown]($frontend).
|
|
@@ -35,11 +36,15 @@ class MapLayersFormats {
|
|
|
35
36
|
MapLayersFormats.localization = config?.localization ?? core_frontend_1.IModelApp.localization;
|
|
36
37
|
await MapLayersFormats.localization.registerNamespace(MapLayersFormats.localizationNamespace);
|
|
37
38
|
MapFeatureInfoTool_js_1.MapFeatureInfoTool.register(MapLayersFormats.localizationNamespace);
|
|
39
|
+
MapLayersFormats._googleMapsOpts = config?.googleMapsOpts;
|
|
38
40
|
}
|
|
39
41
|
/** The internationalization service namespace. */
|
|
40
42
|
static get localizationNamespace() {
|
|
41
43
|
return MapLayersFormats._defaultNs;
|
|
42
44
|
}
|
|
45
|
+
static get googleMapsOpts() {
|
|
46
|
+
return MapLayersFormats._googleMapsOpts;
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
exports.MapLayersFormats = MapLayersFormats;
|
|
45
50
|
//# sourceMappingURL=mapLayersFormats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayersFormats.js","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,sDAA6C;AAE7C,wDAAiD;AACjD,mFAAqF;AACrF,wFAAmF;AACnF,sFAAwF;AACxF,yEAAmE;
|
|
1
|
+
{"version":3,"file":"mapLayersFormats.js","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,sDAA6C;AAE7C,wDAAiD;AACjD,mFAAqF;AACrF,wFAAmF;AACnF,sFAAwF;AACxF,yEAAmE;AAkBnE;;GAEG;AACH,MAAa,gBAAgB;IAEnB,MAAM,CAAC,UAAU,GAAG,kBAAkB,CAAC;IACxC,MAAM,CAAC,YAAY,CAAe;IAEjC,MAAM,CAAC,eAAe,CAAqB;IAEnD;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAA+B;QAC5D,IAAA,qBAAM,EAAC,yBAAS,CAAC,WAAW,EAAE,kGAAkG,CAAC,CAAC;QAClI,IAAI,yBAAS,CAAC,WAAW,EAAE,CAAC;YAC1B,yBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,oDAA2B,CAAC,CAAC;YACvE,yBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,sDAA4B,CAAC,CAAC;YACxE,yBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,qDAAwB,CAAC,CAAC;QACtE,CAAC;QAED,mEAAmE;QACnE,gBAAgB,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,yBAAS,CAAC,YAAY,CAAC;QAC/E,MAAM,gBAAgB,CAAC,YAAY,CAAC,iBAAiB,CACnD,gBAAgB,CAAC,qBAAqB,CACvC,CAAC;QAEF,0CAAkB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;QACpE,gBAAgB,CAAC,eAAe,GAAG,MAAM,EAAE,cAAc,CAAC;IAC5D,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACrC,CAAC;IAEM,MAAM,KAAK,cAAc;QAC9B,OAAO,gBAAgB,CAAC,eAAe,CAAC;IAC1C,CAAC;;AApCH,4CAsCC","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\n/** @packageDocumentation\n * @module MapLayersFormats\n */\nimport { assert } from \"@itwin/core-bentley\";\nimport { Localization } from \"@itwin/core-common\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { ArcGisFeatureMapLayerFormat } from \"./ArcGisFeature/ArcGisFeatureFormat.js\";\nimport { GoogleMapsMapLayerFormat } from \"./GoogleMaps/GoogleMapsImageryFormat.js\";\nimport { OgcApiFeaturesMapLayerFormat } from \"./OgcApiFeatures/OgcApiFeaturesFormat.js\";\nimport { MapFeatureInfoTool } from \"./Tools/MapFeatureInfoTool.js\";\nimport { GoogleMapsSessionManager } from \"./map-layers-formats.js\";\n\n/** Configuration options.\n * @beta\n */\nexport interface MapLayersFormatsConfig {\n localization?: Localization;\n googleMapsOpts?: GoogleMapsOptions;\n}\n\n/** Google Maps options.\n * @beta\n */\nexport interface GoogleMapsOptions {\n sessionManager?: GoogleMapsSessionManager\n}\n\n/** The primary API for the `@itwin/map-layers-formats` package. It allows the package's features to be [[initialize]]d.\n * @beta\n */\nexport class MapLayersFormats {\n\n private static _defaultNs = \"mapLayersFormats\";\n public static localization: Localization;\n\n private static _googleMapsOpts?: GoogleMapsOptions;\n\n /** Registers the [MapLayerFormat]($frontend)s provided by this package for use with [IModelApp]($frontend).\n * Typically, an application will call `MapLayersFormats.initialize` immediately after [IModelApp.startup]($frontend).\n * This function has no effect if called **before** [IModelApp.startup]($frontend) or **after** [IModelApp.shutdown]($frontend).\n */\n public static async initialize(config?: MapLayersFormatsConfig): Promise<void> {\n assert(IModelApp.initialized, \"MapLayersFormats.initialize must be called after IModelApp.startup and before IModelApp.shutdown\");\n if (IModelApp.initialized) {\n IModelApp.mapLayerFormatRegistry.register(ArcGisFeatureMapLayerFormat);\n IModelApp.mapLayerFormatRegistry.register(OgcApiFeaturesMapLayerFormat);\n IModelApp.mapLayerFormatRegistry.register(GoogleMapsMapLayerFormat);\n }\n\n // register namespace containing localized strings for this package\n MapLayersFormats.localization = config?.localization ?? IModelApp.localization;\n await MapLayersFormats.localization.registerNamespace(\n MapLayersFormats.localizationNamespace,\n );\n\n MapFeatureInfoTool.register(MapLayersFormats.localizationNamespace);\n MapLayersFormats._googleMapsOpts = config?.googleMapsOpts;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return MapLayersFormats._defaultNs;\n }\n\n public static get googleMapsOpts() {\n return MapLayersFormats._googleMapsOpts;\n }\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"}
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { BaseMapLayerSettings, ImageMapLayerSettings } from "@itwin/core-common";
|
|
9
9
|
import { GoogleMapsUtils } from "../internal/GoogleMapsUtils.js";
|
|
10
|
-
;
|
|
11
|
-
;
|
|
12
10
|
/**
|
|
13
11
|
* Google Maps API
|
|
14
12
|
* @beta
|
|
@@ -48,6 +46,15 @@ export const GoogleMaps = {
|
|
|
48
46
|
*/
|
|
49
47
|
createBaseLayerSettings: (opts) => {
|
|
50
48
|
return BaseMapLayerSettings.fromJSON(GoogleMapsUtils.createMapLayerProps("GoogleMaps", opts));
|
|
51
|
-
}
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Read the session options from the map layer settings.
|
|
52
|
+
* @param settings Map layer settings
|
|
53
|
+
* ```
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
getMapLayerSessionOptions: (settings) => {
|
|
57
|
+
return GoogleMapsUtils.getSessionOptionsFromMapLayer(settings);
|
|
58
|
+
},
|
|
52
59
|
};
|
|
53
60
|
//# 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,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"GoogleMaps.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMaps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE;;;EAGE;AACF,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;;;;;;;;;;;MAaE;IACF,sBAAsB,EAAE,CAAC,IAAa,EAAE,IAAqC,EAAE,EAAE;QAC/E,OAAO,qBAAqB,CAAC,QAAQ,CAAC,eAAe,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;MAaE;IACF,uBAAuB,EAAE,CAAC,IAAqC,EAAE,EAAE;QACjE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,eAAe,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;IAChG,CAAC;IAED;;;;;MAKE;IACF,yBAAyB,EAAE,CAAC,QAA+B,EAAE,EAAE;QAC7D,OAAO,eAAe,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"}
|
|
@@ -7,10 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ImageryMapLayerFormat } from "@itwin/core-frontend";
|
|
9
9
|
import { GoogleMapsImageryProvider } from "./GoogleMapsImageryProvider.js";
|
|
10
|
+
import { MapLayersFormats } from "../mapLayersFormats.js";
|
|
11
|
+
/**
|
|
12
|
+
* Google Maps imagery layer format.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
10
15
|
export class GoogleMapsMapLayerFormat extends ImageryMapLayerFormat {
|
|
16
|
+
/** Google Maps imagery layer format.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
11
19
|
static formatId = "GoogleMaps";
|
|
20
|
+
/** @internal */
|
|
12
21
|
static createImageryProvider(settings) {
|
|
13
|
-
return new GoogleMapsImageryProvider(settings);
|
|
22
|
+
return new GoogleMapsImageryProvider(settings, MapLayersFormats.googleMapsOpts?.sessionManager);
|
|
14
23
|
}
|
|
15
24
|
}
|
|
16
25
|
//# sourceMappingURL=GoogleMapsImageryFormat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsImageryFormat.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryFormat.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAA2B,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"GoogleMapsImageryFormat.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapsImageryFormat.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAA2B,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,qBAAqB;IACjE;;OAEG;IACI,MAAM,CAAU,QAAQ,GAAG,YAAY,CAAC;IAE/C,gBAAgB;IACT,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,OAAO,IAAI,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAClG,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 { 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,EAAkC,iBAAiB,EAAE,uBAAuB,EAAwB,cAAc,EAAQ,MAAM,sBAAsB,CAAC;AAC/K,OAAO,EAAE,8BAA8B,EAAuF,wBAAwB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAUrM,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"}
|
|
@@ -6,69 +6,54 @@
|
|
|
6
6
|
* @module MapLayersFormats
|
|
7
7
|
*/
|
|
8
8
|
import { BentleyError, BentleyStatus, Logger } from "@itwin/core-bentley";
|
|
9
|
-
import { IModelApp, MapCartoRectangle, MapLayerImageryProvider,
|
|
9
|
+
import { GoogleMapsDecorator, IModelApp, MapCartoRectangle, MapLayerImageryProvider, MapTile } from "@itwin/core-frontend";
|
|
10
|
+
import { NativeGoogleMapsSessionManager } from "../internal/NativeGoogleMapsSession.js";
|
|
10
11
|
import { GoogleMapsUtils } from "../internal/GoogleMapsUtils.js";
|
|
11
|
-
import { GoogleMapsDecorator } from "./GoogleMapDecorator.js";
|
|
12
12
|
const loggerCategory = "MapLayersFormats.GoogleMaps";
|
|
13
|
-
const levelToken = "{level}";
|
|
14
|
-
const rowToken = "{row}";
|
|
15
|
-
const columnToken = "{column}";
|
|
16
|
-
const urlTemplate = `https://tile.googleapis.com/v1/2dtiles/${levelToken}/${columnToken}/${rowToken}`;
|
|
17
13
|
/*
|
|
18
14
|
* Google Maps imagery provider
|
|
19
|
-
* @
|
|
15
|
+
* @beta
|
|
20
16
|
*/
|
|
21
17
|
export class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
22
18
|
_decorator;
|
|
23
19
|
_hadUnrecoverableError = false;
|
|
24
20
|
_tileSize = 256;
|
|
25
|
-
|
|
21
|
+
_sessionManager;
|
|
22
|
+
_sessionOptions;
|
|
23
|
+
_activeSession;
|
|
24
|
+
constructor(settings, sessionManager) {
|
|
26
25
|
super(settings, true);
|
|
27
26
|
this._decorator = new GoogleMapsDecorator();
|
|
28
|
-
|
|
29
|
-
static validateUrlTemplate(template) {
|
|
30
|
-
return { status: (template.indexOf(levelToken) > 0 && template.indexOf(columnToken) > 0 && template.indexOf(rowToken) > 0) ? MapLayerSourceStatus.Valid : MapLayerSourceStatus.InvalidUrl };
|
|
31
|
-
}
|
|
32
|
-
async createSession() {
|
|
33
|
-
const sessionOptions = this.createCreateSessionOptions();
|
|
34
|
-
if (this._settings.accessKey) {
|
|
35
|
-
// Create session and store in query parameters
|
|
36
|
-
const sessionObj = await GoogleMapsUtils.createSession(this._settings.accessKey.value, sessionOptions);
|
|
37
|
-
this._settings.unsavedQueryParams = { session: sessionObj.session };
|
|
38
|
-
return sessionObj;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
Logger.logError(loggerCategory, `Missing GoogleMaps api key`);
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
27
|
+
this._sessionManager = sessionManager;
|
|
44
28
|
}
|
|
45
29
|
get tileSize() { return this._tileSize; }
|
|
46
30
|
async initialize() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
this._sessionOptions = GoogleMapsUtils.getSessionOptionsFromMapLayer(this._settings);
|
|
32
|
+
this._sessionManager = await this.getSessionManager();
|
|
33
|
+
this._activeSession = await this._sessionManager.createSession(this._sessionOptions);
|
|
34
|
+
;
|
|
35
|
+
this._tileSize = this._activeSession.getTileSize();
|
|
36
|
+
const isActivated = await this._decorator.activate(this._settings.properties.mapType);
|
|
37
|
+
if (!isActivated) {
|
|
38
|
+
const msg = `Failed to activate decorator`;
|
|
53
39
|
Logger.logError(loggerCategory, msg);
|
|
54
40
|
throw new BentleyError(BentleyStatus.ERROR, msg);
|
|
55
41
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
}
|
|
43
|
+
async getSessionManager() {
|
|
44
|
+
if (this._sessionManager)
|
|
45
|
+
return this._sessionManager;
|
|
46
|
+
if (this._settings.accessKey?.value) {
|
|
47
|
+
return new NativeGoogleMapsSessionManager(this._settings.accessKey.value);
|
|
61
48
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!isActivated) {
|
|
65
|
-
const msg = `Failed to activate decorator`;
|
|
49
|
+
else {
|
|
50
|
+
const msg = `Missing GoogleMaps api key`;
|
|
66
51
|
Logger.logError(loggerCategory, msg);
|
|
67
52
|
throw new BentleyError(BentleyStatus.ERROR, msg);
|
|
68
53
|
}
|
|
69
54
|
}
|
|
70
|
-
createCreateSessionOptions() {
|
|
71
|
-
const layerPropertyKeys =
|
|
55
|
+
createCreateSessionOptions(settings) {
|
|
56
|
+
const layerPropertyKeys = settings.properties ? Object.keys(settings.properties) : undefined;
|
|
72
57
|
if (layerPropertyKeys === undefined ||
|
|
73
58
|
!layerPropertyKeys.includes("mapType") ||
|
|
74
59
|
!layerPropertyKeys.includes("language") ||
|
|
@@ -78,11 +63,11 @@ export class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
|
78
63
|
throw new BentleyError(BentleyStatus.ERROR, msg);
|
|
79
64
|
}
|
|
80
65
|
const createSessionOptions = {
|
|
81
|
-
mapType:
|
|
66
|
+
mapType: settings.properties.mapType,
|
|
82
67
|
region: this._settings.properties.region,
|
|
83
68
|
language: this._settings.properties.language,
|
|
84
69
|
};
|
|
85
|
-
if (this._settings.properties?.layerTypes
|
|
70
|
+
if (Array.isArray(this._settings.properties?.layerTypes) && this._settings.properties.layerTypes.length > 0) {
|
|
86
71
|
createSessionOptions.layerTypes = this._settings.properties.layerTypes;
|
|
87
72
|
}
|
|
88
73
|
if (this._settings.properties?.scale !== undefined) {
|
|
@@ -96,15 +81,27 @@ export class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
|
96
81
|
}
|
|
97
82
|
return createSessionOptions;
|
|
98
83
|
}
|
|
99
|
-
//
|
|
100
|
-
async constructUrl(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
84
|
+
// not used, see loadTile
|
|
85
|
+
async constructUrl(_row, _column, _level) {
|
|
86
|
+
return "";
|
|
87
|
+
}
|
|
88
|
+
async fetchViewportInfo(rectangle, zoomLevel) {
|
|
89
|
+
if (!this._activeSession) {
|
|
90
|
+
Logger.logError(loggerCategory, `Session is not initialized`);
|
|
91
|
+
throw new BentleyError(BentleyStatus.ERROR, "Session is not initialized");
|
|
92
|
+
}
|
|
93
|
+
const req = this._activeSession.getViewportInfoRequest(rectangle, zoomLevel);
|
|
94
|
+
const request = new Request(req.url, { method: "GET" });
|
|
95
|
+
if (req.authorization) {
|
|
96
|
+
request.headers.set("Authorization", req.authorization);
|
|
97
|
+
}
|
|
98
|
+
// Add the session token to the request
|
|
99
|
+
const response = await fetch(request);
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
Logger.logError(loggerCategory, `Error while loading viewport info: ${response.statusText}`);
|
|
102
|
+
throw new BentleyError(BentleyStatus.ERROR, `Error while loading viewport info: ${response.statusText}`);
|
|
103
|
+
}
|
|
104
|
+
return response.json();
|
|
108
105
|
}
|
|
109
106
|
async fetchAttributions(tiles) {
|
|
110
107
|
const zooms = new Set();
|
|
@@ -123,14 +120,9 @@ export class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
|
123
120
|
cartoRect = rect;
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
|
-
if (cartoRect) {
|
|
123
|
+
if (cartoRect && this._activeSession) {
|
|
127
124
|
try {
|
|
128
|
-
const viewportInfo = await
|
|
129
|
-
rectangle: cartoRect,
|
|
130
|
-
session: this._settings.collectQueryParams().session,
|
|
131
|
-
key: this._settings.accessKey.value,
|
|
132
|
-
zoom
|
|
133
|
-
});
|
|
125
|
+
const viewportInfo = await this.fetchViewportInfo(cartoRect, zoom);
|
|
134
126
|
if (viewportInfo?.copyright) {
|
|
135
127
|
matchingAttributions.push(viewportInfo.copyright);
|
|
136
128
|
}
|
|
@@ -152,18 +144,23 @@ export class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
|
152
144
|
}
|
|
153
145
|
}
|
|
154
146
|
async loadTile(row, column, zoomLevel) {
|
|
147
|
+
const tilePos = { row, column, level: zoomLevel };
|
|
155
148
|
if (this._hadUnrecoverableError)
|
|
156
149
|
return undefined;
|
|
150
|
+
if (this._activeSession === undefined || this._sessionOptions === undefined) {
|
|
151
|
+
Logger.logError(loggerCategory, `Session manager is not initialized`);
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
157
154
|
try {
|
|
158
|
-
let
|
|
159
|
-
let tileResponse = await this.makeTileRequest(
|
|
155
|
+
let tileRequest = this._activeSession.getTileRequest(tilePos);
|
|
156
|
+
let tileResponse = await this.makeTileRequest(tileRequest.url.toString(), undefined, tileRequest.authorization);
|
|
160
157
|
if (!tileResponse.ok) {
|
|
161
|
-
if (tileResponse.headers.get("content-type")?.includes("application/json")) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
tileResponse = await this.makeTileRequest(
|
|
158
|
+
if (tileResponse.headers.get("content-type")?.includes("application/json") && this._sessionManager) {
|
|
159
|
+
try {
|
|
160
|
+
// Session might have expired, lets try to refresh it
|
|
161
|
+
this._activeSession = await this._sessionManager.createSession(this._sessionOptions);
|
|
162
|
+
tileRequest = this._activeSession.getTileRequest(tilePos);
|
|
163
|
+
tileResponse = await this.makeTileRequest(tileRequest.url.toString(), undefined, tileRequest.authorization);
|
|
167
164
|
if (!tileResponse.ok) {
|
|
168
165
|
if (tileResponse.headers.get("content-type")?.includes("application/json")) {
|
|
169
166
|
await this.logJsonError(tileResponse);
|
|
@@ -175,7 +172,7 @@ export class GoogleMapsImageryProvider extends MapLayerImageryProvider {
|
|
|
175
172
|
return undefined;
|
|
176
173
|
}
|
|
177
174
|
}
|
|
178
|
-
|
|
175
|
+
catch {
|
|
179
176
|
await this.logJsonError(tileResponse);
|
|
180
177
|
}
|
|
181
178
|
}
|