@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 +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"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export * from "./ArcGisFeature/ArcGisFeatureProvider.js";
|
|
6
6
|
export * from "./GoogleMaps/GoogleMaps.js";
|
|
7
|
+
export * from "./GoogleMaps/GoogleMapsSession.js";
|
|
8
|
+
export * from "./GoogleMaps/GoogleMapsImageryFormat.js";
|
|
7
9
|
export * from "./mapLayersFormats.js";
|
|
8
10
|
export * from "./Tools/MapFeatureInfoTool.js";
|
|
9
11
|
/** @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,cAAc,0CAA0C,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;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,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","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"}
|
|
@@ -17,6 +17,7 @@ import { MapFeatureInfoTool } from "./Tools/MapFeatureInfoTool.js";
|
|
|
17
17
|
export class MapLayersFormats {
|
|
18
18
|
static _defaultNs = "mapLayersFormats";
|
|
19
19
|
static localization;
|
|
20
|
+
static _googleMapsOpts;
|
|
20
21
|
/** Registers the [MapLayerFormat]($frontend)s provided by this package for use with [IModelApp]($frontend).
|
|
21
22
|
* Typically, an application will call `MapLayersFormats.initialize` immediately after [IModelApp.startup]($frontend).
|
|
22
23
|
* This function has no effect if called **before** [IModelApp.startup]($frontend) or **after** [IModelApp.shutdown]($frontend).
|
|
@@ -32,10 +33,14 @@ export class MapLayersFormats {
|
|
|
32
33
|
MapLayersFormats.localization = config?.localization ?? IModelApp.localization;
|
|
33
34
|
await MapLayersFormats.localization.registerNamespace(MapLayersFormats.localizationNamespace);
|
|
34
35
|
MapFeatureInfoTool.register(MapLayersFormats.localizationNamespace);
|
|
36
|
+
MapLayersFormats._googleMapsOpts = config?.googleMapsOpts;
|
|
35
37
|
}
|
|
36
38
|
/** The internationalization service namespace. */
|
|
37
39
|
static get localizationNamespace() {
|
|
38
40
|
return MapLayersFormats._defaultNs;
|
|
39
41
|
}
|
|
42
|
+
static get googleMapsOpts() {
|
|
43
|
+
return MapLayersFormats._googleMapsOpts;
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
//# 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,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACr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,CAAC,YAAY,CAAC,iBAAiB,CACnD,gBAAgB,CAAC,qBAAqB,CACvC,CAAC;QAEF,kBAAkB,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","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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/map-layers-formats",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0-dev.1",
|
|
4
4
|
"description": "Enables additional map-layers formats in iTwin.js",
|
|
5
5
|
"main": "lib/cjs/map-layers-formats.js",
|
|
6
6
|
"module": "lib/esm/map-layers-formats.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./lib/esm/map-layers-formats.js",
|
|
12
12
|
"require": "./lib/cjs/map-layers-formats.js"
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
14
15
|
},
|
|
15
16
|
"license": "MIT",
|
|
16
17
|
"repository": {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"url": "http://www.bentley.com"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@itwin/eslint-plugin": "5.
|
|
33
|
+
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
33
34
|
"@types/chai": "4.3.1",
|
|
34
35
|
"@types/chai-as-promised": "^7",
|
|
35
36
|
"@types/geojson": "~7946.0.14",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"chai": "^4.3.10",
|
|
42
43
|
"chai-as-promised": "^7.1.1",
|
|
43
44
|
"cpx2": "^8.0.0",
|
|
44
|
-
"eslint": "^9.
|
|
45
|
+
"eslint": "^9.31.0",
|
|
45
46
|
"jsdom": "^26.0.0",
|
|
46
47
|
"mocha": "^11.1.0",
|
|
47
48
|
"nyc": "^17.1.0",
|
|
@@ -52,20 +53,20 @@
|
|
|
52
53
|
"typemoq": "^2.1.0",
|
|
53
54
|
"typescript": "~5.6.2",
|
|
54
55
|
"fetch-mock": "~11.1.3",
|
|
55
|
-
"@itwin/appui-abstract": "5.
|
|
56
|
-
"@itwin/core-
|
|
57
|
-
"@itwin/core-
|
|
58
|
-
"
|
|
59
|
-
"@itwin/
|
|
60
|
-
"@itwin/core-
|
|
61
|
-
"
|
|
56
|
+
"@itwin/appui-abstract": "5.2.0-dev.1",
|
|
57
|
+
"@itwin/core-common": "5.2.0-dev.1",
|
|
58
|
+
"@itwin/core-bentley": "5.2.0-dev.1",
|
|
59
|
+
"internal-tools": "3.0.0-dev.69",
|
|
60
|
+
"@itwin/build-tools": "5.2.0-dev.1",
|
|
61
|
+
"@itwin/core-frontend": "5.2.0-dev.1",
|
|
62
|
+
"@itwin/core-geometry": "5.2.0-dev.1"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
|
-
"@itwin/
|
|
65
|
-
"@itwin/core-
|
|
66
|
-
"@itwin/
|
|
67
|
-
"@itwin/core-
|
|
68
|
-
"@itwin/core-
|
|
65
|
+
"@itwin/core-bentley": "5.2.0-dev.1",
|
|
66
|
+
"@itwin/core-common": "5.2.0-dev.1",
|
|
67
|
+
"@itwin/appui-abstract": "5.2.0-dev.1",
|
|
68
|
+
"@itwin/core-frontend": "5.2.0-dev.1",
|
|
69
|
+
"@itwin/core-geometry": "5.2.0-dev.1"
|
|
69
70
|
},
|
|
70
71
|
"dependencies": {
|
|
71
72
|
"google-protobuf": "~3.20.1",
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
"docs": "betools docs --json=../../generated-docs/core/map-layers-formats/file.json --tsIndexFile=./map-layers-formats.ts --onlyJson --excludes=**/ArcGisFeature/*.ts,**/*.gen.ts",
|
|
103
104
|
"extract-api": "betools extract-api --entry=map-layers-formats",
|
|
104
105
|
"lint": "eslint \"./src/**/*.{ts,tsx}\" 1>&2",
|
|
106
|
+
"lint-deprecation": "eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \"./src/**/*.ts\"",
|
|
105
107
|
"pseudolocalize": "betools pseudolocalize --englishDir=./src/public/locales/en --out=./src/public/locales/en-PSEUDO",
|
|
106
108
|
"test": "mocha",
|
|
107
109
|
"rebuild": "npm run -s clean && npm run -s build"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CanvasDecoration, DecorateContext, Decorator, Sprite } from "@itwin/core-frontend";
|
|
2
|
-
import { Point3d } from "@itwin/core-geometry";
|
|
3
|
-
import { GoogleMapsMapTypes } from "./GoogleMaps.js";
|
|
4
|
-
/** A simple decorator that show logo at the a given screen position.
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare class LogoDecoration implements CanvasDecoration {
|
|
8
|
-
private _sprite?;
|
|
9
|
-
/** The current position of the logo in view coordinates. */
|
|
10
|
-
readonly position: Point3d;
|
|
11
|
-
private _offset;
|
|
12
|
-
set offset(offset: Point3d | undefined);
|
|
13
|
-
/** The logo offset in view coordinates.*/
|
|
14
|
-
get offset(): Point3d | undefined;
|
|
15
|
-
/** Move the logo to the lower left corner of the screen. */
|
|
16
|
-
moveToLowerLeftCorner(context: DecorateContext): boolean;
|
|
17
|
-
/** Indicate if the logo is loaded and ready to be drawn. */
|
|
18
|
-
get isLoaded(): boolean;
|
|
19
|
-
activate(sprite: Sprite): Promise<boolean>;
|
|
20
|
-
/** Draw this sprite onto the supplied canvas.
|
|
21
|
-
* @see [[CanvasDecoration.drawDecoration]]
|
|
22
|
-
*/
|
|
23
|
-
drawDecoration(ctx: CanvasRenderingContext2D): void;
|
|
24
|
-
decorate(context: DecorateContext): void;
|
|
25
|
-
}
|
|
26
|
-
/** A decorator that adds the Google Maps logo to the lower left corner of the screen.
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export declare class GoogleMapsDecorator implements Decorator {
|
|
30
|
-
readonly logo: LogoDecoration;
|
|
31
|
-
/** Activate the logo based on the given map type. */
|
|
32
|
-
activate(mapType: GoogleMapsMapTypes): Promise<boolean>;
|
|
33
|
-
/** Decorate implementation */
|
|
34
|
-
decorate: (context: DecorateContext) => void;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=GoogleMapDecorator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;GAEG;AACH,qBAAa,cAAe,YAAW,gBAAgB;IACrD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB,4DAA4D;IAC5D,SAAgB,QAAQ,UAAiB;IAEzC,OAAO,CAAC,OAAO,CAAoB;IAEnC,IAAW,MAAM,CAAC,MAAM,EAAE,OAAO,GAAC,SAAS,EAExC;IAEH,0CAA0C;IAC1C,IAAW,MAAM,IALS,OAAO,GAAC,SAAS,CAO1C;IAED,4DAA4D;IACrD,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAI,OAAO;IAahE,4DAA4D;IAC5D,IAAW,QAAQ,YAA8C;IAEpD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWvD;;OAEG;IACI,cAAc,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI;IAOnD,QAAQ,CAAC,OAAO,EAAE,eAAe;CAGzC;AAED;;EAEE;AACF,qBAAa,mBAAoB,YAAW,SAAS;IACnD,SAAgB,IAAI,iBAAwB;IAE5C,qDAAqD;IACxC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAYpE,8BAA8B;IACvB,QAAQ,YAAa,eAAe,UAKzC;CACH"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleMapsDecorator = exports.LogoDecoration = void 0;
|
|
4
|
-
/*---------------------------------------------------------------------------------------------
|
|
5
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
-
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
9
|
-
const core_geometry_1 = require("@itwin/core-geometry");
|
|
10
|
-
/** A simple decorator that show logo at the a given screen position.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
class LogoDecoration {
|
|
14
|
-
_sprite;
|
|
15
|
-
/** The current position of the logo in view coordinates. */
|
|
16
|
-
position = new core_geometry_1.Point3d();
|
|
17
|
-
_offset;
|
|
18
|
-
set offset(offset) {
|
|
19
|
-
this._offset = offset;
|
|
20
|
-
}
|
|
21
|
-
/** The logo offset in view coordinates.*/
|
|
22
|
-
get offset() {
|
|
23
|
-
return this._offset;
|
|
24
|
-
}
|
|
25
|
-
/** Move the logo to the lower left corner of the screen. */
|
|
26
|
-
moveToLowerLeftCorner(context) {
|
|
27
|
-
if (!this._sprite || !this._sprite.isLoaded)
|
|
28
|
-
return false;
|
|
29
|
-
this.position.x = this._offset?.x ?? 0;
|
|
30
|
-
this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;
|
|
31
|
-
if (this._offset?.y)
|
|
32
|
-
this.position.y -= this._offset.y;
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
/* TODO: Add other move methods as needed */
|
|
36
|
-
/** Indicate if the logo is loaded and ready to be drawn. */
|
|
37
|
-
get isLoaded() { return this._sprite?.isLoaded ?? false; }
|
|
38
|
-
async activate(sprite) {
|
|
39
|
-
this._sprite = sprite;
|
|
40
|
-
return new Promise((resolve, _reject) => {
|
|
41
|
-
sprite.loadPromise.then(() => {
|
|
42
|
-
resolve(true);
|
|
43
|
-
}).catch(() => {
|
|
44
|
-
resolve(false);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/** Draw this sprite onto the supplied canvas.
|
|
49
|
-
* @see [[CanvasDecoration.drawDecoration]]
|
|
50
|
-
*/
|
|
51
|
-
drawDecoration(ctx) {
|
|
52
|
-
if (this.isLoaded) {
|
|
53
|
-
// Draw image with an origin at the top left corner
|
|
54
|
-
ctx.drawImage(this._sprite.image, 0, 0);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
decorate(context) {
|
|
58
|
-
context.addCanvasDecoration(this);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.LogoDecoration = LogoDecoration;
|
|
62
|
-
/** A decorator that adds the Google Maps logo to the lower left corner of the screen.
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
class GoogleMapsDecorator {
|
|
66
|
-
logo = new LogoDecoration();
|
|
67
|
-
/** Activate the logo based on the given map type. */
|
|
68
|
-
async activate(mapType) {
|
|
69
|
-
// Pick the logo that is the most visible on the background map
|
|
70
|
-
const imageName = mapType === "roadmap" ?
|
|
71
|
-
"google_on_white" :
|
|
72
|
-
"google_on_non_white";
|
|
73
|
-
// We need to move the logo right after the 'i.js' button
|
|
74
|
-
this.logo.offset = new core_geometry_1.Point3d(45, 10);
|
|
75
|
-
return this.logo.activate(core_frontend_1.IconSprites.getSpriteFromUrl(`${core_frontend_1.IModelApp.publicPath}images/${imageName}.png`));
|
|
76
|
-
}
|
|
77
|
-
;
|
|
78
|
-
/** Decorate implementation */
|
|
79
|
-
decorate = (context) => {
|
|
80
|
-
if (!this.logo.isLoaded)
|
|
81
|
-
return;
|
|
82
|
-
this.logo.moveToLowerLeftCorner(context);
|
|
83
|
-
this.logo.decorate(context);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
exports.GoogleMapsDecorator = GoogleMapsDecorator;
|
|
87
|
-
//# sourceMappingURL=GoogleMapDecorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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AmB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AA1DD,wCA0DC;AAED;;EAEE;AACF,MAAa,mBAAmB;IACd,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;IAE5C,qDAAqD;IAC9C,KAAK,CAAC,QAAQ,CAAC,OAA2B;QAC/C,+DAA+D;QAC/D,MAAM,SAAS,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC;YACzC,iBAAiB,CAAC,CAAC;YACnB,qBAAqB,CAAC;QAEtB,yDAAyD;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 \"./GoogleMaps.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"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CanvasDecoration, DecorateContext, Decorator, Sprite } from "@itwin/core-frontend";
|
|
2
|
-
import { Point3d } from "@itwin/core-geometry";
|
|
3
|
-
import { GoogleMapsMapTypes } from "./GoogleMaps.js";
|
|
4
|
-
/** A simple decorator that show logo at the a given screen position.
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare class LogoDecoration implements CanvasDecoration {
|
|
8
|
-
private _sprite?;
|
|
9
|
-
/** The current position of the logo in view coordinates. */
|
|
10
|
-
readonly position: Point3d;
|
|
11
|
-
private _offset;
|
|
12
|
-
set offset(offset: Point3d | undefined);
|
|
13
|
-
/** The logo offset in view coordinates.*/
|
|
14
|
-
get offset(): Point3d | undefined;
|
|
15
|
-
/** Move the logo to the lower left corner of the screen. */
|
|
16
|
-
moveToLowerLeftCorner(context: DecorateContext): boolean;
|
|
17
|
-
/** Indicate if the logo is loaded and ready to be drawn. */
|
|
18
|
-
get isLoaded(): boolean;
|
|
19
|
-
activate(sprite: Sprite): Promise<boolean>;
|
|
20
|
-
/** Draw this sprite onto the supplied canvas.
|
|
21
|
-
* @see [[CanvasDecoration.drawDecoration]]
|
|
22
|
-
*/
|
|
23
|
-
drawDecoration(ctx: CanvasRenderingContext2D): void;
|
|
24
|
-
decorate(context: DecorateContext): void;
|
|
25
|
-
}
|
|
26
|
-
/** A decorator that adds the Google Maps logo to the lower left corner of the screen.
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export declare class GoogleMapsDecorator implements Decorator {
|
|
30
|
-
readonly logo: LogoDecoration;
|
|
31
|
-
/** Activate the logo based on the given map type. */
|
|
32
|
-
activate(mapType: GoogleMapsMapTypes): Promise<boolean>;
|
|
33
|
-
/** Decorate implementation */
|
|
34
|
-
decorate: (context: DecorateContext) => void;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=GoogleMapDecorator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;GAEG;AACH,qBAAa,cAAe,YAAW,gBAAgB;IACrD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB,4DAA4D;IAC5D,SAAgB,QAAQ,UAAiB;IAEzC,OAAO,CAAC,OAAO,CAAoB;IAEnC,IAAW,MAAM,CAAC,MAAM,EAAE,OAAO,GAAC,SAAS,EAExC;IAEH,0CAA0C;IAC1C,IAAW,MAAM,IALS,OAAO,GAAC,SAAS,CAO1C;IAED,4DAA4D;IACrD,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAI,OAAO;IAahE,4DAA4D;IAC5D,IAAW,QAAQ,YAA8C;IAEpD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWvD;;OAEG;IACI,cAAc,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI;IAOnD,QAAQ,CAAC,OAAO,EAAE,eAAe;CAGzC;AAED;;EAEE;AACF,qBAAa,mBAAoB,YAAW,SAAS;IACnD,SAAgB,IAAI,iBAAwB;IAE5C,qDAAqD;IACxC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAYpE,8BAA8B;IACvB,QAAQ,YAAa,eAAe,UAKzC;CACH"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { IconSprites, IModelApp } from "@itwin/core-frontend";
|
|
6
|
-
import { Point3d } from "@itwin/core-geometry";
|
|
7
|
-
/** A simple decorator that show logo at the a given screen position.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export class LogoDecoration {
|
|
11
|
-
_sprite;
|
|
12
|
-
/** The current position of the logo in view coordinates. */
|
|
13
|
-
position = new Point3d();
|
|
14
|
-
_offset;
|
|
15
|
-
set offset(offset) {
|
|
16
|
-
this._offset = offset;
|
|
17
|
-
}
|
|
18
|
-
/** The logo offset in view coordinates.*/
|
|
19
|
-
get offset() {
|
|
20
|
-
return this._offset;
|
|
21
|
-
}
|
|
22
|
-
/** Move the logo to the lower left corner of the screen. */
|
|
23
|
-
moveToLowerLeftCorner(context) {
|
|
24
|
-
if (!this._sprite || !this._sprite.isLoaded)
|
|
25
|
-
return false;
|
|
26
|
-
this.position.x = this._offset?.x ?? 0;
|
|
27
|
-
this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;
|
|
28
|
-
if (this._offset?.y)
|
|
29
|
-
this.position.y -= this._offset.y;
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
/* TODO: Add other move methods as needed */
|
|
33
|
-
/** Indicate if the logo is loaded and ready to be drawn. */
|
|
34
|
-
get isLoaded() { return this._sprite?.isLoaded ?? false; }
|
|
35
|
-
async activate(sprite) {
|
|
36
|
-
this._sprite = sprite;
|
|
37
|
-
return new Promise((resolve, _reject) => {
|
|
38
|
-
sprite.loadPromise.then(() => {
|
|
39
|
-
resolve(true);
|
|
40
|
-
}).catch(() => {
|
|
41
|
-
resolve(false);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** Draw this sprite onto the supplied canvas.
|
|
46
|
-
* @see [[CanvasDecoration.drawDecoration]]
|
|
47
|
-
*/
|
|
48
|
-
drawDecoration(ctx) {
|
|
49
|
-
if (this.isLoaded) {
|
|
50
|
-
// Draw image with an origin at the top left corner
|
|
51
|
-
ctx.drawImage(this._sprite.image, 0, 0);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
decorate(context) {
|
|
55
|
-
context.addCanvasDecoration(this);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/** A decorator that adds the Google Maps logo to the lower left corner of the screen.
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
|
-
export class GoogleMapsDecorator {
|
|
62
|
-
logo = new LogoDecoration();
|
|
63
|
-
/** Activate the logo based on the given map type. */
|
|
64
|
-
async activate(mapType) {
|
|
65
|
-
// Pick the logo that is the most visible on the background map
|
|
66
|
-
const imageName = mapType === "roadmap" ?
|
|
67
|
-
"google_on_white" :
|
|
68
|
-
"google_on_non_white";
|
|
69
|
-
// We need to move the logo right after the 'i.js' button
|
|
70
|
-
this.logo.offset = new Point3d(45, 10);
|
|
71
|
-
return this.logo.activate(IconSprites.getSpriteFromUrl(`${IModelApp.publicPath}images/${imageName}.png`));
|
|
72
|
-
}
|
|
73
|
-
;
|
|
74
|
-
/** Decorate implementation */
|
|
75
|
-
decorate = (context) => {
|
|
76
|
-
if (!this.logo.isLoaded)
|
|
77
|
-
return;
|
|
78
|
-
this.logo.moveToLowerLeftCorner(context);
|
|
79
|
-
this.logo.decorate(context);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=GoogleMapDecorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapDecorator.js","sourceRoot":"","sources":["../../../src/GoogleMaps/GoogleMapDecorator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAgD,WAAW,EAAE,SAAS,EAAU,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI/C;;GAE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AE;gBACZ,OAAO,CAAE,KAAK,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,GAA6B;QACjD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,mDAAmD;YACnD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,OAAQ,CAAC,KAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,OAAwB;QACtC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AAED;;EAEE;AACF,MAAM,OAAO,mBAAmB;IACd,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;IAE5C,qDAAqD;IAC9C,KAAK,CAAC,QAAQ,CAAC,OAA2B;QAC/C,+DAA+D;QAC/D,MAAM,SAAS,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC;YACzC,iBAAiB,CAAC,CAAC;YACnB,qBAAqB,CAAC;QAEtB,yDAAyD;QACzD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,SAAS,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","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 \"./GoogleMaps.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"]}
|