Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoogleMaps support #7604

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f2b9c2c
wip
mdastous-bentley Jan 24, 2025
038ca9c
wip
mdastous-bentley Jan 24, 2025
41e88af
removed absolute in comparaison
mdastous-bentley Jan 27, 2025
344b4c4
wip
mdastous-bentley Jan 29, 2025
3b2a92a
wip + recover expired session
mdastous-bentley Jan 30, 2025
b542ab2
merged master
mdastous-bentley Jan 30, 2025
6292d55
wip
mdastous-bentley Jan 31, 2025
d54ed24
wip
mdastous-bentley Jan 31, 2025
1169ed8
Honor session's tile size
mdastous-bentley Jan 31, 2025
ad39090
Improved deprecation of `addLogoCards`
mdastous-bentley Feb 4, 2025
51f9e58
lint error
mdastous-bentley Feb 4, 2025
ae31ddf
Get decorations for map tile ref...
mdastous-bentley Feb 4, 2025
5897c01
Cleanup decorator code
mdastous-bentley Feb 5, 2025
f87cedd
Got rid of some `GoogleMaps` prefix
mdastous-bentley Feb 6, 2025
ae93c2e
Added tests.
mdastous-bentley Feb 10, 2025
c6490dd
Make sure we deep copy provider properties.
mdastous-bentley Feb 10, 2025
d9af31c
Added Google maps ui to display-tes-app
mdastous-bentley Feb 11, 2025
84135d4
wip
mdastous-bentley Feb 11, 2025
0ede483
wip
mdastous-bentley Feb 11, 2025
bc8aad2
lint
mdastous-bentley Feb 11, 2025
457b214
Fixed issues in tile tree comparison
mdastous-bentley Feb 12, 2025
15b0635
wip
mdastous-bentley Feb 12, 2025
eacb75d
wip
mdastous-bentley Feb 12, 2025
9f3aa2a
added deprecated apis to NextVersion.md
mdastous-bentley Feb 12, 2025
b57feb2
added map-layers section to NextVersion.md
mdastous-bentley Feb 12, 2025
7609e35
updated NextVersion.md
mdastous-bentley Feb 12, 2025
91beceb
Update NextVersion.md
mdastous-bentley Feb 12, 2025
b4b1311
Update NextVersion.md
mdastous-bentley Feb 12, 2025
da13e1b
Update NextVersion.md
mdastous-bentley Feb 12, 2025
c039a7f
changelog
mdastous-bentley Feb 12, 2025
31bdb77
Merge branch 'MichelD/GoogleMaps' of https://github.com/imodeljs/imod…
mdastous-bentley Feb 12, 2025
f5ac2cc
wip
mdastous-bentley Feb 12, 2025
a8f495c
api extract
mdastous-bentley Feb 12, 2025
1c2f241
Attempt to better expose @internal api
mdastous-bentley Feb 12, 2025
3fa218d
adjust internal APIs
pmconne Feb 12, 2025
c550bcc
extract-api
mdastous-bentley Feb 12, 2025
4f6e052
merged with master
mdastous-bentley Feb 13, 2025
c9c0f0d
Fixed tests failures and improved existing tests
mdastous-bentley Feb 13, 2025
af4e8f2
clean up
mdastous-bentley Feb 13, 2025
a426fc3
Merge branch 'master' into MichelD/GoogleMaps
mdastous-bentley Feb 13, 2025
307a33f
api extract
mdastous-bentley Feb 13, 2025
7bd9048
Merge branch 'MichelD/GoogleMaps' of https://github.com/imodeljs/imod…
mdastous-bentley Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/api/core-bentley.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ export function compareNumbersOrUndefined(lhs?: number, rhs?: number): number;
// @public (undocumented)
export function comparePossiblyUndefined<T>(compareDefined: (lhs: T, rhs: T) => number, lhs?: T, rhs?: T): number;

// @beta (undocumented)
export function compareSimpleArrays(lhs?: Array<number | string | boolean>, rhs?: Array<number | string | boolean>): number;

// @beta (undocumented)
export function compareSimpleTypes(lhs: number | string | boolean, rhs: number | string | boolean): number;

// @public (undocumented)
export function compareStrings(a: string, b: string): number;

Expand Down
13 changes: 13 additions & 0 deletions common/api/core-common.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4786,6 +4786,8 @@ export interface ImageMapLayerProps extends CommonMapLayerProps {
// @internal (undocumented)
modelId?: never;
// @beta
properties?: MapLayerProviderProperties;
// @beta
queryParams?: {
[key: string]: string;
};
Expand Down Expand Up @@ -4820,6 +4822,8 @@ export class ImageMapLayerSettings extends MapLayerSettings {
// (undocumented)
password?: string;
// @beta
readonly properties?: MapLayerProviderProperties;
// @beta
savedQueryParams?: {
[key: string]: string;
};
Expand Down Expand Up @@ -5727,6 +5731,15 @@ export interface MapLayerKey {
// @public
export type MapLayerProps = ImageMapLayerProps | ModelMapLayerProps;

// @beta (undocumented)
export type MapLayerProviderArrayProperty = Array<number | string | boolean>;

// @beta (undocumented)
export interface MapLayerProviderProperties {
// (undocumented)
[key: string]: number | string | boolean | MapLayerProviderArrayProperty;
}

// @public
export abstract class MapLayerSettings {
// @internal
Expand Down
17 changes: 17 additions & 0 deletions common/api/core-frontend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4675,6 +4675,8 @@ export class ImageryMapLayerTreeReference extends MapLayerTileTreeReference {
export class ImageryMapTileTree extends RealityTileTree {
constructor(params: RealityTileTreeParams, _imageryLoader: ImageryTileLoader);
// (undocumented)
addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;
// @deprecated (undocumented)
addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void;
// (undocumented)
cartoRectangleFromQuadId(quadId: QuadId): MapCartoRectangle;
Expand Down Expand Up @@ -5657,6 +5659,8 @@ export type MapLayerFormatType = typeof MapLayerFormat;
// @beta
export abstract class MapLayerImageryProvider {
constructor(_settings: ImageMapLayerSettings, _usesCachedTiles: boolean);
addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;
// @deprecated (undocumented)
addLogoCards(_cards: HTMLTableElement, _viewport: ScreenViewport): void;
// @internal
protected appendCustomParams(url: string): string;
Expand All @@ -5666,6 +5670,8 @@ export abstract class MapLayerImageryProvider {
cartoRange?: MapCartoRectangle;
// (undocumented)
abstract constructUrl(row: number, column: number, zoomLevel: number): Promise<string>;
// @internal (undocumented)
decorate(_context: DecorateContext): void;
// @internal
protected readonly defaultMaximumZoomLevel = 22;
// @internal
Expand Down Expand Up @@ -5905,6 +5911,8 @@ export abstract class MapLayerTileTreeReference extends TileTreeReference {
// (undocumented)
canSupplyToolTip(hit: HitDetail): boolean;
// (undocumented)
decorate(_context: DecorateContext): void;
// (undocumented)
getToolTip(hit: HitDetail): Promise<HTMLElement | string | undefined>;
get imageryProvider(): MapLayerImageryProvider | undefined;
// (undocumented)
Expand Down Expand Up @@ -6160,6 +6168,8 @@ export class MapTileTree extends RealityTileTree {
// @internal
export class MapTileTreeReference extends TileTreeReference {
constructor(settings: BackgroundMapSettings, _baseLayerSettings: BaseLayerSettings | undefined, _layerSettings: MapLayerSettings[], iModel: IModelConnection, tileUserId: number, isOverlay: boolean, _isDrape: boolean, _overrideTerrainDisplay?: CheckTerrainDisplayOverride | undefined);
addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;
// @deprecated (undocumented)
addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void;
addToScene(context: SceneContext): void;
// (undocumented)
Expand All @@ -6175,6 +6185,8 @@ export class MapTileTreeReference extends TileTreeReference {
// (undocumented)
protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined;
// (undocumented)
decorate(context: DecorateContext): void;
// (undocumented)
discloseTileTrees(trees: DisclosedTileTreeSet): void;
// (undocumented)
forEachLayerTileTreeRef(func: (ref: TileTreeReference) => void): void;
Expand Down Expand Up @@ -10148,6 +10160,8 @@ export class TerrainDisplayOverrides {

// @public
export abstract class TerrainMeshProvider {
addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;
// @deprecated (undocumented)
addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void;
forceTileLoad(_tile: MapTile): boolean;
getChildHeightRange(quadId: QuadId, rectangle: MapCartoRectangle, parent: MapTile): Range1d | undefined;
Expand Down Expand Up @@ -11043,6 +11057,9 @@ export interface TileTreeParams {
export abstract class TileTreeReference {
// (undocumented)
accumulateTransformedRange(range: Range3d, matrix: Matrix4d, frustumPlanes?: FrustumPlanes): void;
// @beta
addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;
// @deprecated (undocumented)
addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void;
addToScene(context: SceneContext): void;
canSupplyToolTip(_hit: HitDetail): boolean;
Expand Down
65 changes: 65 additions & 0 deletions common/api/map-layers-formats.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
```ts

import { ArcGISImageryProvider } from '@itwin/core-frontend';
import { BaseMapLayerSettings } from '@itwin/core-common';
import { BeButtonEvent } from '@itwin/core-frontend';
import { BeEvent } from '@itwin/core-bentley';
import { Cartographic } from '@itwin/core-common';
Expand All @@ -18,6 +19,7 @@ import { Listener } from '@itwin/core-bentley';
import { Localization } from '@itwin/core-common';
import { LocateFilterStatus } from '@itwin/core-frontend';
import { LocateResponse } from '@itwin/core-frontend';
import { MapCartoRectangle } from '@itwin/core-frontend';
import { MapFeatureInfo } from '@itwin/core-frontend';
import { MapFeatureInfoOptions } from '@itwin/core-frontend';
import { MapLayerFeatureInfo } from '@itwin/core-frontend';
Expand Down Expand Up @@ -56,6 +58,17 @@ export class ArcGisFeatureProvider extends ArcGISImageryProvider {
get tileSize(): number;
}

// @beta
export interface CreateSessionOptions {
apiOptions?: string[];
language: string;
layerTypes?: LayerTypes[];
mapType: MapTypes;
overlay?: boolean;
region: string;
scale?: ScaleFactors;
}

// @internal (undocumented)
export class DefaultArcGiSymbology implements FeatureDefaultSymbology {
// (undocumented)
Expand All @@ -72,6 +85,24 @@ export class DefaultArcGiSymbology implements FeatureDefaultSymbology {
initialize(): Promise<void>;
}

// @beta
export const GoogleMaps: {
createMapLayerSettings: (name?: string, opts?: CreateSessionOptions) => ImageMapLayerSettings;
createBaseLayerSettings: (opts?: CreateSessionOptions) => BaseMapLayerSettings;
};

// @beta
export interface GoogleMapsSession {
expiry: number;
imageFormat: string;
session: string;
tileHeight: number;
tileWidth: number;
}

// @beta (undocumented)
export type LayerTypes = "layerRoadmap" | "layerStreetview";

// @beta
export class MapFeatureInfoTool extends PrimitiveTool {
// (undocumented)
Expand Down Expand Up @@ -126,6 +157,40 @@ export interface MapLayersFormatsConfig {
localization?: Localization;
}

// @beta (undocumented)
export type MapTypes = "roadmap" | "satellite" | "terrain";

// @beta
export interface MaxZoomRectangle {
// (undocumented)
east: number;
// (undocumented)
maxZoom: number;
// (undocumented)
north: number;
// (undocumented)
south: number;
// (undocumented)
west: number;
}

// @beta (undocumented)
export type ScaleFactors = "scaleFactor1x" | "scaleFactor2x" | "scaleFactor4x";

// @beta
export interface ViewportInfo {
copyright: string;
maxZoomRects: MaxZoomRectangle[];
}

// @beta
export interface ViewportInfoRequestParams {
key: string;
rectangle: MapCartoRectangle;
session: string;
zoom: number;
}

// (No @packageDocumentation comment for this package)

```
2 changes: 2 additions & 0 deletions common/api/summary/core-bentley.exports.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public;function;compareBooleansOrUndefined
public;function;compareNumbers
public;function;compareNumbersOrUndefined
public;function;comparePossiblyUndefined
beta;function;compareSimpleArrays
beta;function;compareSimpleTypes
public;function;compareStrings
public;function;compareStringsOrUndefined
public;function;compareWithTolerance
Expand Down
2 changes: 2 additions & 0 deletions common/api/summary/core-common.exports.csv
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ public;interface;MapImageryProps
public;class;MapImagerySettings
public;interface;MapLayerKey
public;type;MapLayerProps
beta;type;MapLayerProviderArrayProperty
beta;interface;MapLayerProviderProperties
public;class;MapLayerSettings
public;interface;MapSubLayerProps
public;class;MapSubLayerSettings
Expand Down
11 changes: 10 additions & 1 deletion common/api/summary/map-layers-formats.exports.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
sep=;
Release Tag;API Item Type;API Item Name
internal;class;ArcGisFeatureProvider
beta;interface;CreateSessionOptions
internal;class;DefaultArcGiSymbology
beta;const;GoogleMaps
beta;interface;GoogleMapsSession
beta;type;LayerTypes
beta;class;MapFeatureInfoTool
beta;interface;MapFeatureInfoToolData
beta;class;MapLayersFormats
beta;interface;MapLayersFormatsConfig
beta;interface;MapLayersFormatsConfig
beta;type;MapTypes
beta;interface;MaxZoomRectangle
beta;type;ScaleFactors
beta;interface;ViewportInfo
beta;interface;ViewportInfoRequestParams
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-bentley",
"comment": "Add `compareSimpleTypes` and `compareSimpleArrays` to compare simple data.",
"type": "none"
}
],
"packageName": "@itwin/core-bentley"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-common",
"comment": "Add new `properties` property to `ImageMapLayerSettings` class.",
"type": "none"
}
],
"packageName": "@itwin/core-common"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "Add new async `addAttributions` method on `TileTreeReference`. Also make sure ImageryTileTree / providers are included when decorating the view.",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/map-layers-formats",
"comment": "Added Google Maps 2D tiles support.",
"type": "none"
}
],
"packageName": "@itwin/map-layers-formats"
}
45 changes: 45 additions & 0 deletions core/bentley/src/Compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,48 @@ export function areEqualPossiblyUndefined<T, U>(t: T | undefined, u: U | undefin
else
return areEqual(t, u);
}

/** @beta */
export function compareSimpleTypes(lhs: number | string | boolean, rhs: number | string | boolean): number {
// Make sure the types are the same
if (typeof lhs !== typeof rhs) {
return 1;
}

let cmp = 0;
// Compare actual values
switch (typeof lhs) {
case "number":
cmp = compareNumbers(lhs, rhs as number);
break;
case "string":
cmp = compareStrings(lhs, rhs as string);
break;
case "boolean":
cmp = compareBooleans(lhs, rhs as boolean);
break;
}
return cmp;
}

/** @beta */
export function compareSimpleArrays (lhs?: Array<number | string | boolean>, rhs?: Array<number | string | boolean> ) {
if (undefined === lhs)
return undefined === rhs ? 0 : -1;
else if (undefined === rhs)
return 1;
else if (lhs.length === 0 && rhs.length === 0) {
return 0;
} else if (lhs.length !== rhs.length) {
return lhs.length - rhs.length;
}

let cmp = 0;
for (let i = 0; i < lhs.length; i++) {
cmp = compareSimpleTypes(lhs[i], rhs[i]);
if (cmp !== 0) {
break;
}
}
return cmp;
}
Loading