@itwin/map-layers-formats 5.1.0-dev.9 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/cjs/Feature/DefaultMarkerIcon.js +9 -9
- package/lib/cjs/Feature/DefaultMarkerIcon.js.map +1 -1
- package/lib/cjs/Feature/FeatureCanvasRenderer.js.map +1 -1
- package/lib/cjs/Feature/FeatureInfoReader.js.map +1 -1
- package/lib/cjs/Feature/FeatureSymbology.js.map +1 -1
- package/lib/cjs/Feature/RandomMapColor.js.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometry.js.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMaps.d.ts +8 -125
- package/lib/cjs/GoogleMaps/GoogleMaps.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMaps.js +10 -3
- package/lib/cjs/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.d.ts +8 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.js +10 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.d.ts +10 -7
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.d.ts.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.js +65 -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/Icons/MapInfoIcon.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -1
- package/lib/cjs/Tools/GeometryTerrainDraper.js.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.js.map +1 -1
- 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/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/esm/Feature/DefaultMarkerIcon.js +9 -9
- package/lib/esm/Feature/DefaultMarkerIcon.js.map +1 -1
- package/lib/esm/Feature/FeatureCanvasRenderer.js.map +1 -1
- package/lib/esm/Feature/FeatureInfoReader.js.map +1 -1
- package/lib/esm/Feature/FeatureSymbology.js.map +1 -1
- package/lib/esm/Feature/RandomMapColor.js.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometry.js.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.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/Icons/MapInfoIcon.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -1
- package/lib/esm/Tools/GeometryTerrainDraper.js.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.js.map +1 -1
- 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/lib/public/locales/en/mapLayersFormats.json +18 -18
- 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":"MapFeatureInfoTool.js","sourceRoot":"","sources":["../../../src/Tools/MapFeatureInfoTool.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAsD,MAAM,oBAAoB,CAAC;AAC/G,OAAO,EAEL,YAAY,EAEZ,SAAS,EACT,kBAAkB,EAClB,cAAc,EAId,+BAA+B,EAC/B,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,yBAAyB,GAI1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAYvE,MAAM,mBAAmB;IACf,gBAAgB,CAAuC;IAC/D,IAAW,eAAe,KAAK,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAA,CAAC;IAC7D,IAAW,eAAe,CAAC,MAA4C;QACrE,IAAI,CAA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,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,gEAAgE,CAAC,CAAC;QAErI,qBAAqB;QACrB,MAAM,iBAAiB,GAAgC,EAAE,CAAC;QAC1D,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;QACrJ,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;QACnJ,MAAM,QAAQ,GAA4B,EAAE,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QAE3F,mBAAmB;QACnB,MAAM,eAAe,GAAG,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAC1F,MAAM,YAAY,GAAG,cAAc,CAAC,kBAAkB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAElF,SAAS,CAAC,aAAa,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC1D,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 { BeEvent } from \"@itwin/core-bentley\";\nimport { ImageMapLayerSettings, MapImageryProps, MapImagerySettings, MapLayerProps } from \"@itwin/core-common\";\nimport {\n BeButtonEvent,\n EventHandled,\n HitDetail,\n IModelApp,\n LocateFilterStatus,\n LocateResponse,\n MapFeatureInfo,\n MapLayerInfoFromTileTree,\n MapLayerScaleRangeVisibility,\n MapTileTreeScaleRangeVisibility,\n PrimitiveTool,\n ToolAssistance,\n ToolAssistanceImage,\n ToolAssistanceInputMethod,\n ToolAssistanceInstruction,\n ToolAssistanceSection,\n Viewport,\n} from \"@itwin/core-frontend\";\nimport { mapInfoIcon } from \"../Icons/MapInfoIcon.js\";\nimport { MapFeatureInfoDecorator } from \"./MapFeatureInfoDecorator.js\";\n\n/**\n * Data provided every time [[MapFeatureInfoTool]] retrieves feature information.\n * @see [[MapFeatureInfoToolData]]\n * @beta\n */\nexport interface MapFeatureInfoToolData {\n hit: HitDetail;\n mapInfo?: MapFeatureInfo;\n}\n\nclass ActiveMapLayerState {\n private _activeMapLayers: MapLayerInfoFromTileTree[]|undefined;\n public get activeMapLayers() {return this._activeMapLayers;}\n public set activeMapLayers(active: MapLayerInfoFromTileTree[]|undefined) {\n this._activeMapLayers = active;\n this.isVisible = true;\n this.isInRange = true;\n this.existsInDisplayStyle = true;\n\n }\n public isVisible: boolean = true;\n public isInRange: boolean = true;\n public existsInDisplayStyle: boolean = true;\n\n public get hasMapLayers() { return (this.activeMapLayers && this.activeMapLayers.length > 0);}\n\n public updateWithImagerySettings(imagery: MapImageryProps) {\n const result = {exists: false, hidden: false};\n this.existsInDisplayStyle = false;\n this.isVisible = false;\n if (this.hasMapLayers) {\n const oldMls = this._activeMapLayers![0]; // consider only first layer for now\n\n let newMls: MapLayerProps|undefined;\n if (oldMls.isBaseLayer) {\n if (typeof (imagery.backgroundBase) !== \"number\") {\n newMls = imagery.backgroundBase;\n }\n } else if (oldMls.index?.isOverlay && imagery.overlayLayers && imagery.overlayLayers.length > oldMls.index.index) {\n newMls = imagery.overlayLayers[oldMls.index.index];\n\n } else if ((oldMls.index !== undefined) && imagery.backgroundLayers && imagery.backgroundLayers.length > oldMls.index.index) {\n newMls = imagery.backgroundLayers[oldMls.index.index];\n }\n\n // We want to make sure that newMls and OldMls are the same (but ignoring the 'visible' flag).\n // by using the serialized JSON object\n let tmpNewMls = newMls;\n if (newMls && newMls.visible !== oldMls.settings.visible) {\n tmpNewMls = {...newMls, visible: oldMls.settings.visible};\n }\n const newJson = tmpNewMls ? JSON.stringify(tmpNewMls) : \"\";\n const oldJson = JSON.stringify(oldMls.settings.toJSON());\n\n if (newJson === oldJson ) {\n // We consider newMls and OldMls to be the same mapLayer instance.\n this.existsInDisplayStyle = true;\n this.isVisible = newMls!.visible ? true : false;\n }\n\n }\n return result;\n }\n\n public updateWithScaleRangeVisibility(layerIndexes: MapLayerScaleRangeVisibility[]) {\n if (this.hasMapLayers) {\n const currentMls = this.activeMapLayers![0]; // consider only first layer for now\n for (const scaleRangeVisibility of layerIndexes) {\n if (currentMls.index?.index === scaleRangeVisibility.index) {\n this.isInRange = scaleRangeVisibility.visibility === MapTileTreeScaleRangeVisibility.Visible || scaleRangeVisibility.visibility === MapTileTreeScaleRangeVisibility.Partial;\n }\n }\n }\n\n }\n}\n\n/** Tools that allow extracting feature information from map-layers.\n * Simulate feature highlight by drawing overlay decorations. It also\n * fire an event that provide further feature information meant to be displayed in a UI / Widget.\n * @see [[MapFeatureInfoToolData]]\n * @beta\n */\nexport class MapFeatureInfoTool extends PrimitiveTool {\n public readonly onInfoReady = new BeEvent<(data: MapFeatureInfoToolData) => void>();\n public readonly onInfoCleared = new BeEvent();\n\n public static override toolId = \"MapFeatureInfoTool\";\n public static override iconSpec = mapInfoIcon.dataUri;\n\n private _decorator: MapFeatureInfoDecorator = new MapFeatureInfoDecorator();\n private _layerSettingsCache = new Map<string, MapLayerInfoFromTileTree[]>();\n\n private _state: ActiveMapLayerState = new ActiveMapLayerState();\n private readonly _detachListeners: VoidFunction[] = [];\n private _detachOnMapImageryChanged: VoidFunction|undefined;\n\n public override requireWriteableTarget(): boolean {\n return false;\n }\n\n /** @internal */\n protected setupAndPromptForNextAction(): void {\n this.showPrompt();\n }\n\n private updateDecorator(vp: Viewport) {\n if (this._state.existsInDisplayStyle) {\n if (this._state.isInRange) {\n this._decorator.hidden = !this._state.isVisible;\n }\n } else {\n // Flush existing decorations until a new selection is made\n this.onInfoCleared.raiseEvent();\n this._decorator.clearData();\n }\n vp.invalidateDecorations();\n }\n\n public override async onPostInstall() {\n await super.onPostInstall();\n\n this.setupAndPromptForNextAction();\n\n this.initLocateElements();\n IModelApp.locateManager.options.allowDecorations = true;\n\n this._layerSettingsCache.clear();\n\n // Listen of display style configuration changes, that way we don't have to restart the tool to be up to date.\n const vp = this.targetView;\n if (vp) {\n const mapImageryChangeHandler = (newImagery: Readonly<MapImagerySettings>) => {\n if (this._state.hasMapLayers) {\n this._state.updateWithImagerySettings(newImagery.toJSON());\n this.updateDecorator(vp);\n }\n this._layerSettingsCache.clear();\n };\n\n this._detachListeners.push(vp.onChangeView.addListener((viewport, _previousViewState) => {\n\n // When a saved view is loaded, 'onMapImageryChanged' events are no longer handled, we have to re-attach.\n if (this._detachOnMapImageryChanged) {\n this._detachOnMapImageryChanged();\n }\n this._detachOnMapImageryChanged = viewport.displayStyle.settings.onMapImageryChanged.addListener(mapImageryChangeHandler);\n\n if (this._state.hasMapLayers) {\n this._state.updateWithImagerySettings({\n backgroundBase: viewport.displayStyle.backgroundMapBase.toJSON(),\n backgroundLayers: viewport.displayStyle.getMapLayers(false).map((value) => value.toJSON()),\n overlayLayers: viewport.displayStyle.getMapLayers(true).map((value) => value.toJSON()),\n });\n this.updateDecorator(vp);\n }\n this._layerSettingsCache.clear();\n }));\n\n this._detachOnMapImageryChanged = vp.displayStyle.settings.onMapImageryChanged.addListener(mapImageryChangeHandler);\n\n // Every time a layer goes out of range it, its associated decoration should be hidden (and restore if enter again the range)\n this._detachListeners.push(vp.onMapLayerScaleRangeVisibilityChanged.addListener(((layerIndexes: MapLayerScaleRangeVisibility[]) => {\n if (this._state.hasMapLayers) {\n this._state.updateWithScaleRangeVisibility(layerIndexes);\n if (this._state.existsInDisplayStyle && this._state.isVisible) {\n this._decorator.hidden = !this._state.isInRange;\n vp.invalidateDecorations();\n }\n }\n this._layerSettingsCache.clear();\n })));\n\n }\n\n IModelApp.viewManager.addDecorator(this._decorator);\n\n }\n\n public override async onCleanup() {\n this._detachListeners.forEach((f) => f());\n this._detachListeners.length = 0;\n if (this._detachOnMapImageryChanged) {\n this._detachOnMapImageryChanged();\n }\n\n IModelApp.viewManager.dropDecorator(this._decorator);\n }\n\n /**\n * Get map layer information from a hit.\n * @param hit The hit to get info from.\n * @returns Returns a list of [[MapLayerInfoFromTileTree]]s.\n * @internal\n */\n private getMapLayerInfoFromHit(hit: HitDetail) {\n let mapLayerFromHit: MapLayerInfoFromTileTree[] = [];\n const fromCache = this._layerSettingsCache.get(hit.sourceId);\n if (fromCache) {\n mapLayerFromHit = fromCache;\n } else if (this.targetView) {\n mapLayerFromHit = this.targetView?.mapLayerFromHit(hit).filter(((info) => info.settings instanceof ImageMapLayerSettings && info.provider?.supportsMapFeatureInfo));\n this._layerSettingsCache.set(hit.sourceId, mapLayerFromHit);\n }\n\n return mapLayerFromHit;\n }\n\n public override async getToolTip(hit: HitDetail): Promise<HTMLElement | string> {\n const infos = this.getMapLayerInfoFromHit(hit);\n if (infos.length > 0) {\n const names = infos.map((info) => info.settings.name);\n return `Layer${names.length > 1 ? \"s\" : \"\"}: ${names.join(\", \")}`;\n }\n return \"\";\n }\n\n public override async filterHit(hit: HitDetail, _out?: LocateResponse): Promise<LocateFilterStatus> {\n return this.getMapLayerInfoFromHit(hit).length > 0 ? LocateFilterStatus.Accept : LocateFilterStatus.Reject;\n }\n\n public override async onDataButtonDown(\n ev: BeButtonEvent,\n ): Promise<EventHandled> {\n const hit = await IModelApp.locateManager.doLocate(\n new LocateResponse(),\n true,\n ev.point,\n ev.viewport,\n ev.inputSource,\n );\n if (hit !== undefined) {\n let mapInfo: MapFeatureInfo | undefined;\n\n const mapLayersHit = this.getMapLayerInfoFromHit(hit);\n if (mapLayersHit.length > 0) {\n this._state.activeMapLayers = mapLayersHit;\n IModelApp.toolAdmin.setCursor(\"wait\");\n try {\n const aperture = (hit.viewport.pixelsFromInches(IModelApp.locateManager.apertureInches) / 2.0) + 1.5;\n const pixelRadius = Math.floor(aperture + 0.5);\n mapInfo = await hit.viewport.getMapFeatureInfo(hit, {tolerance: pixelRadius});\n if (mapInfo) {\n this._decorator.setData({ hit, mapInfo });\n } else {\n IModelApp.toolAdmin.setCursor(undefined);\n }\n } catch {\n IModelApp.toolAdmin.setCursor(undefined);\n }\n }\n\n this.onInfoReady.raiseEvent({ hit, mapInfo });\n return EventHandled.Yes;\n }\n return EventHandled.No;\n }\n\n public override async onResetButtonUp(\n _ev: BeButtonEvent,\n ): Promise<EventHandled> {\n this._state.activeMapLayers = undefined;\n /* Common reset behavior for primitive tools is calling onReinitialize to restart or exitTool to terminate. */\n await this.onReinitialize();\n return EventHandled.No;\n }\n\n public override async onRestartTool() {\n const tool = new MapFeatureInfoTool();\n if (!(await tool.run()))\n return this.exitTool();\n }\n\n /** @internal */\n protected showPrompt(): void {\n\n const promptEnterPoint = IModelApp.localization.getLocalizedString(\"mapLayersFormats:tools.MapFeatureInfoTool.Prompts.EnterPoint\");\n const promptClickIdentify= IModelApp.localization.getLocalizedString(\"mapLayersFormats:tools.MapFeatureInfoTool.Prompts.clickToIdentify\");\n const promptClickClear = IModelApp.localization.getLocalizedString(\"mapLayersFormats:tools.MapFeatureInfoTool.Prompts.clickToClear\");\n\n // Mouse Instructions\n const mouseInstructions: ToolAssistanceInstruction[] = [];\n mouseInstructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.LeftClick, promptClickIdentify, false, ToolAssistanceInputMethod.Mouse));\n mouseInstructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.RightClick, promptClickClear, false, ToolAssistanceInputMethod.Mouse));\n const sections: ToolAssistanceSection[] = [];\n sections.push(ToolAssistance.createSection(mouseInstructions, ToolAssistance.inputsLabel));\n\n // Main Instruction\n const mainInstruction = ToolAssistance.createInstruction(this.iconSpec, promptEnterPoint);\n const instructions = ToolAssistance.createInstructions(mainInstruction, sections);\n\n IModelApp.notifications.setToolAssistance(instructions);\n }\n}\n"]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mBAAmB;QACnB,MAAM,eAAe,GAAG,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAC1F,MAAM,YAAY,GAAG,cAAc,CAAC,kBAAkB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QAElF,SAAS,CAAC,aAAa,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC1D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayersFormats\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { ImageMapLayerSettings, MapImageryProps, MapImagerySettings, MapLayerProps } from \"@itwin/core-common\";\r\nimport {\r\n BeButtonEvent,\r\n EventHandled,\r\n HitDetail,\r\n IModelApp,\r\n LocateFilterStatus,\r\n LocateResponse,\r\n MapFeatureInfo,\r\n MapLayerInfoFromTileTree,\r\n MapLayerScaleRangeVisibility,\r\n MapTileTreeScaleRangeVisibility,\r\n PrimitiveTool,\r\n ToolAssistance,\r\n ToolAssistanceImage,\r\n ToolAssistanceInputMethod,\r\n ToolAssistanceInstruction,\r\n ToolAssistanceSection,\r\n Viewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { mapInfoIcon } from \"../Icons/MapInfoIcon.js\";\r\nimport { MapFeatureInfoDecorator } from \"./MapFeatureInfoDecorator.js\";\r\n\r\n/**\r\n * Data provided every time [[MapFeatureInfoTool]] retrieves feature information.\r\n * @see [[MapFeatureInfoToolData]]\r\n * @beta\r\n */\r\nexport interface MapFeatureInfoToolData {\r\n hit: HitDetail;\r\n mapInfo?: MapFeatureInfo;\r\n}\r\n\r\nclass ActiveMapLayerState {\r\n private _activeMapLayers: MapLayerInfoFromTileTree[]|undefined;\r\n public get activeMapLayers() {return this._activeMapLayers;}\r\n public set activeMapLayers(active: MapLayerInfoFromTileTree[]|undefined) {\r\n this._activeMapLayers = active;\r\n this.isVisible = true;\r\n this.isInRange = true;\r\n this.existsInDisplayStyle = true;\r\n\r\n }\r\n public isVisible: boolean = true;\r\n public isInRange: boolean = true;\r\n public existsInDisplayStyle: boolean = true;\r\n\r\n public get hasMapLayers() { return (this.activeMapLayers && this.activeMapLayers.length > 0);}\r\n\r\n public updateWithImagerySettings(imagery: MapImageryProps) {\r\n const result = {exists: false, hidden: false};\r\n this.existsInDisplayStyle = false;\r\n this.isVisible = false;\r\n if (this.hasMapLayers) {\r\n const oldMls = this._activeMapLayers![0]; // consider only first layer for now\r\n\r\n let newMls: MapLayerProps|undefined;\r\n if (oldMls.isBaseLayer) {\r\n if (typeof (imagery.backgroundBase) !== \"number\") {\r\n newMls = imagery.backgroundBase;\r\n }\r\n } else if (oldMls.index?.isOverlay && imagery.overlayLayers && imagery.overlayLayers.length > oldMls.index.index) {\r\n newMls = imagery.overlayLayers[oldMls.index.index];\r\n\r\n } else if ((oldMls.index !== undefined) && imagery.backgroundLayers && imagery.backgroundLayers.length > oldMls.index.index) {\r\n newMls = imagery.backgroundLayers[oldMls.index.index];\r\n }\r\n\r\n // We want to make sure that newMls and OldMls are the same (but ignoring the 'visible' flag).\r\n // by using the serialized JSON object\r\n let tmpNewMls = newMls;\r\n if (newMls && newMls.visible !== oldMls.settings.visible) {\r\n tmpNewMls = {...newMls, visible: oldMls.settings.visible};\r\n }\r\n const newJson = tmpNewMls ? JSON.stringify(tmpNewMls) : \"\";\r\n const oldJson = JSON.stringify(oldMls.settings.toJSON());\r\n\r\n if (newJson === oldJson ) {\r\n // We consider newMls and OldMls to be the same mapLayer instance.\r\n this.existsInDisplayStyle = true;\r\n this.isVisible = newMls!.visible ? true : false;\r\n }\r\n\r\n }\r\n return result;\r\n }\r\n\r\n public updateWithScaleRangeVisibility(layerIndexes: MapLayerScaleRangeVisibility[]) {\r\n if (this.hasMapLayers) {\r\n const currentMls = this.activeMapLayers![0]; // consider only first layer for now\r\n for (const scaleRangeVisibility of layerIndexes) {\r\n if (currentMls.index?.index === scaleRangeVisibility.index) {\r\n this.isInRange = scaleRangeVisibility.visibility === MapTileTreeScaleRangeVisibility.Visible || scaleRangeVisibility.visibility === MapTileTreeScaleRangeVisibility.Partial;\r\n }\r\n }\r\n }\r\n\r\n }\r\n}\r\n\r\n/** Tools that allow extracting feature information from map-layers.\r\n * Simulate feature highlight by drawing overlay decorations. It also\r\n * fire an event that provide further feature information meant to be displayed in a UI / Widget.\r\n * @see [[MapFeatureInfoToolData]]\r\n * @beta\r\n */\r\nexport class MapFeatureInfoTool extends PrimitiveTool {\r\n public readonly onInfoReady = new BeEvent<(data: MapFeatureInfoToolData) => void>();\r\n public readonly onInfoCleared = new BeEvent();\r\n\r\n public static override toolId = \"MapFeatureInfoTool\";\r\n public static override iconSpec = mapInfoIcon.dataUri;\r\n\r\n private _decorator: MapFeatureInfoDecorator = new MapFeatureInfoDecorator();\r\n private _layerSettingsCache = new Map<string, MapLayerInfoFromTileTree[]>();\r\n\r\n private _state: ActiveMapLayerState = new ActiveMapLayerState();\r\n private readonly _detachListeners: VoidFunction[] = [];\r\n private _detachOnMapImageryChanged: VoidFunction|undefined;\r\n\r\n public override requireWriteableTarget(): boolean {\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n protected setupAndPromptForNextAction(): void {\r\n this.showPrompt();\r\n }\r\n\r\n private updateDecorator(vp: Viewport) {\r\n if (this._state.existsInDisplayStyle) {\r\n if (this._state.isInRange) {\r\n this._decorator.hidden = !this._state.isVisible;\r\n }\r\n } else {\r\n // Flush existing decorations until a new selection is made\r\n this.onInfoCleared.raiseEvent();\r\n this._decorator.clearData();\r\n }\r\n vp.invalidateDecorations();\r\n }\r\n\r\n public override async onPostInstall() {\r\n await super.onPostInstall();\r\n\r\n this.setupAndPromptForNextAction();\r\n\r\n this.initLocateElements();\r\n IModelApp.locateManager.options.allowDecorations = true;\r\n\r\n this._layerSettingsCache.clear();\r\n\r\n // Listen of display style configuration changes, that way we don't have to restart the tool to be up to date.\r\n const vp = this.targetView;\r\n if (vp) {\r\n const mapImageryChangeHandler = (newImagery: Readonly<MapImagerySettings>) => {\r\n if (this._state.hasMapLayers) {\r\n this._state.updateWithImagerySettings(newImagery.toJSON());\r\n this.updateDecorator(vp);\r\n }\r\n this._layerSettingsCache.clear();\r\n };\r\n\r\n this._detachListeners.push(vp.onChangeView.addListener((viewport, _previousViewState) => {\r\n\r\n // When a saved view is loaded, 'onMapImageryChanged' events are no longer handled, we have to re-attach.\r\n if (this._detachOnMapImageryChanged) {\r\n this._detachOnMapImageryChanged();\r\n }\r\n this._detachOnMapImageryChanged = viewport.displayStyle.settings.onMapImageryChanged.addListener(mapImageryChangeHandler);\r\n\r\n if (this._state.hasMapLayers) {\r\n this._state.updateWithImagerySettings({\r\n backgroundBase: viewport.displayStyle.backgroundMapBase.toJSON(),\r\n backgroundLayers: viewport.displayStyle.getMapLayers(false).map((value) => value.toJSON()),\r\n overlayLayers: viewport.displayStyle.getMapLayers(true).map((value) => value.toJSON()),\r\n });\r\n this.updateDecorator(vp);\r\n }\r\n this._layerSettingsCache.clear();\r\n }));\r\n\r\n this._detachOnMapImageryChanged = vp.displayStyle.settings.onMapImageryChanged.addListener(mapImageryChangeHandler);\r\n\r\n // Every time a layer goes out of range it, its associated decoration should be hidden (and restore if enter again the range)\r\n this._detachListeners.push(vp.onMapLayerScaleRangeVisibilityChanged.addListener(((layerIndexes: MapLayerScaleRangeVisibility[]) => {\r\n if (this._state.hasMapLayers) {\r\n this._state.updateWithScaleRangeVisibility(layerIndexes);\r\n if (this._state.existsInDisplayStyle && this._state.isVisible) {\r\n this._decorator.hidden = !this._state.isInRange;\r\n vp.invalidateDecorations();\r\n }\r\n }\r\n this._layerSettingsCache.clear();\r\n })));\r\n\r\n }\r\n\r\n IModelApp.viewManager.addDecorator(this._decorator);\r\n\r\n }\r\n\r\n public override async onCleanup() {\r\n this._detachListeners.forEach((f) => f());\r\n this._detachListeners.length = 0;\r\n if (this._detachOnMapImageryChanged) {\r\n this._detachOnMapImageryChanged();\r\n }\r\n\r\n IModelApp.viewManager.dropDecorator(this._decorator);\r\n }\r\n\r\n /**\r\n * Get map layer information from a hit.\r\n * @param hit The hit to get info from.\r\n * @returns Returns a list of [[MapLayerInfoFromTileTree]]s.\r\n * @internal\r\n */\r\n private getMapLayerInfoFromHit(hit: HitDetail) {\r\n let mapLayerFromHit: MapLayerInfoFromTileTree[] = [];\r\n const fromCache = this._layerSettingsCache.get(hit.sourceId);\r\n if (fromCache) {\r\n mapLayerFromHit = fromCache;\r\n } else if (this.targetView) {\r\n mapLayerFromHit = this.targetView?.mapLayerFromHit(hit).filter(((info) => info.settings instanceof ImageMapLayerSettings && info.provider?.supportsMapFeatureInfo));\r\n this._layerSettingsCache.set(hit.sourceId, mapLayerFromHit);\r\n }\r\n\r\n return mapLayerFromHit;\r\n }\r\n\r\n public override async getToolTip(hit: HitDetail): Promise<HTMLElement | string> {\r\n const infos = this.getMapLayerInfoFromHit(hit);\r\n if (infos.length > 0) {\r\n const names = infos.map((info) => info.settings.name);\r\n return `Layer${names.length > 1 ? \"s\" : \"\"}: ${names.join(\", \")}`;\r\n }\r\n return \"\";\r\n }\r\n\r\n public override async filterHit(hit: HitDetail, _out?: LocateResponse): Promise<LocateFilterStatus> {\r\n return this.getMapLayerInfoFromHit(hit).length > 0 ? LocateFilterStatus.Accept : LocateFilterStatus.Reject;\r\n }\r\n\r\n public override async onDataButtonDown(\r\n ev: BeButtonEvent,\r\n ): Promise<EventHandled> {\r\n const hit = await IModelApp.locateManager.doLocate(\r\n new LocateResponse(),\r\n true,\r\n ev.point,\r\n ev.viewport,\r\n ev.inputSource,\r\n );\r\n if (hit !== undefined) {\r\n let mapInfo: MapFeatureInfo | undefined;\r\n\r\n const mapLayersHit = this.getMapLayerInfoFromHit(hit);\r\n if (mapLayersHit.length > 0) {\r\n this._state.activeMapLayers = mapLayersHit;\r\n IModelApp.toolAdmin.setCursor(\"wait\");\r\n try {\r\n const aperture = (hit.viewport.pixelsFromInches(IModelApp.locateManager.apertureInches) / 2.0) + 1.5;\r\n const pixelRadius = Math.floor(aperture + 0.5);\r\n mapInfo = await hit.viewport.getMapFeatureInfo(hit, {tolerance: pixelRadius});\r\n if (mapInfo) {\r\n this._decorator.setData({ hit, mapInfo });\r\n } else {\r\n IModelApp.toolAdmin.setCursor(undefined);\r\n }\r\n } catch {\r\n IModelApp.toolAdmin.setCursor(undefined);\r\n }\r\n }\r\n\r\n this.onInfoReady.raiseEvent({ hit, mapInfo });\r\n return EventHandled.Yes;\r\n }\r\n return EventHandled.No;\r\n }\r\n\r\n public override async onResetButtonUp(\r\n _ev: BeButtonEvent,\r\n ): Promise<EventHandled> {\r\n this._state.activeMapLayers = undefined;\r\n /* Common reset behavior for primitive tools is calling onReinitialize to restart or exitTool to terminate. */\r\n await this.onReinitialize();\r\n return EventHandled.No;\r\n }\r\n\r\n public override async onRestartTool() {\r\n const tool = new MapFeatureInfoTool();\r\n if (!(await tool.run()))\r\n return this.exitTool();\r\n }\r\n\r\n /** @internal */\r\n protected showPrompt(): void {\r\n\r\n const promptEnterPoint = IModelApp.localization.getLocalizedString(\"mapLayersFormats:tools.MapFeatureInfoTool.Prompts.EnterPoint\");\r\n const promptClickIdentify= IModelApp.localization.getLocalizedString(\"mapLayersFormats:tools.MapFeatureInfoTool.Prompts.clickToIdentify\");\r\n const promptClickClear = IModelApp.localization.getLocalizedString(\"mapLayersFormats:tools.MapFeatureInfoTool.Prompts.clickToClear\");\r\n\r\n // Mouse Instructions\r\n const mouseInstructions: ToolAssistanceInstruction[] = [];\r\n mouseInstructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.LeftClick, promptClickIdentify, false, ToolAssistanceInputMethod.Mouse));\r\n mouseInstructions.push(ToolAssistance.createInstruction(ToolAssistanceImage.RightClick, promptClickClear, false, ToolAssistanceInputMethod.Mouse));\r\n const sections: ToolAssistanceSection[] = [];\r\n sections.push(ToolAssistance.createSection(mouseInstructions, ToolAssistance.inputsLabel));\r\n\r\n // Main Instruction\r\n const mainInstruction = ToolAssistance.createInstruction(this.iconSpec, promptEnterPoint);\r\n const instructions = ToolAssistance.createInstructions(mainInstruction, sections);\r\n\r\n IModelApp.notifications.setToolAssistance(instructions);\r\n }\r\n}\r\n"]}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { ImageMapLayerProps, MapLayerProviderProperties } from "@itwin/core-common";
|
|
2
|
-
import { GoogleMapsCreateSessionOptions
|
|
1
|
+
import { ImageMapLayerProps, ImageMapLayerSettings, MapLayerProviderProperties } from "@itwin/core-common";
|
|
2
|
+
import { GoogleMapsCreateSessionOptions } from "../map-layers-formats.js";
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare const GoogleMapsUtils: {
|
|
5
|
-
/**
|
|
6
|
-
* Creates a Google Maps session.
|
|
7
|
-
* @param apiKey Google Cloud API key
|
|
8
|
-
* @param opts Options to create the session
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
createSession: (apiKey: string, opts: GoogleMapsCreateSessionOptions) => Promise<GoogleMapsSession>;
|
|
12
5
|
/**
|
|
13
6
|
* Register the google maps format if it is not already registered.
|
|
14
7
|
* @internal
|
|
@@ -22,17 +15,17 @@ export declare const GoogleMapsUtils: {
|
|
|
22
15
|
*/
|
|
23
16
|
createMapLayerProps: (name?: string, opts?: GoogleMapsCreateSessionOptions) => ImageMapLayerProps;
|
|
24
17
|
/**
|
|
25
|
-
* Retrieves the maximum zoom level available within a bounding rectangle.
|
|
26
|
-
* @param rectangle The bounding rectangle
|
|
27
|
-
* @returns The maximum zoom level available within the bounding rectangle.
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
getViewportInfo: (params: ViewportInfoRequestParams) => Promise<ViewportInfo | undefined>;
|
|
31
|
-
/**
|
|
32
18
|
* Converts the session options to provider properties
|
|
33
19
|
* @param opts Options to create the session
|
|
34
20
|
* @internal
|
|
35
21
|
*/
|
|
36
22
|
createPropertiesFromSessionOptions: (opts: GoogleMapsCreateSessionOptions) => MapLayerProviderProperties;
|
|
23
|
+
/**
|
|
24
|
+
* Read the session options from the map layer settings.
|
|
25
|
+
* @param settings Map layer settings
|
|
26
|
+
* ```
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
getSessionOptionsFromMapLayer: (settings: ImageMapLayerSettings) => GoogleMapsCreateSessionOptions;
|
|
37
30
|
};
|
|
38
31
|
//# sourceMappingURL=GoogleMapsUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsUtils.d.ts","sourceRoot":"","sources":["../../../src/internal/GoogleMapsUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GoogleMapsUtils.d.ts","sourceRoot":"","sources":["../../../src/internal/GoogleMapsUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAG3G,OAAO,EAAE,8BAA8B,EAAoE,MAAM,0BAA0B,CAAC;AAK5I,gBAAgB;AAEhB,eAAO,MAAM,eAAe;IAE1B;;;MAGE;;IAOF;;;;;IAKA;iCAC4B,MAAM,SAAwB,8BAA8B,KAAG,kBAAkB;IAW3G;;;;IAIA;+CACyC,8BAA8B,KAAG,0BAA0B;IA0BtG;;;;;MAKE;8CACwC,qBAAqB,KAAG,8BAA8B;CAkCjG,CAAA"}
|
|
@@ -2,30 +2,13 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Logger } from "@itwin/core-bentley";
|
|
6
5
|
import { IModelApp } from "@itwin/core-frontend";
|
|
7
|
-
import { Angle } from "@itwin/core-geometry";
|
|
8
6
|
import { GoogleMapsMapLayerFormat } from "../GoogleMaps/GoogleMapsImageryFormat.js";
|
|
7
|
+
import { BentleyError, BentleyStatus, Logger } from "@itwin/core-bentley";
|
|
9
8
|
const loggerCategory = "MapLayersFormats.GoogleMaps";
|
|
10
9
|
/** @internal */
|
|
11
10
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
11
|
export const GoogleMapsUtils = {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a Google Maps session.
|
|
15
|
-
* @param apiKey Google Cloud API key
|
|
16
|
-
* @param opts Options to create the session
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
createSession: async (apiKey, opts) => {
|
|
20
|
-
const url = `https://tile.googleapis.com/v1/createSession?key=${apiKey}`;
|
|
21
|
-
const request = new Request(url, { method: "POST", body: JSON.stringify(opts) });
|
|
22
|
-
const response = await fetch(request);
|
|
23
|
-
if (!response.ok) {
|
|
24
|
-
throw new Error(`CreateSession request failed: ${response.status} - ${response.statusText}`);
|
|
25
|
-
}
|
|
26
|
-
Logger.logInfo(loggerCategory, `Session created successfully`);
|
|
27
|
-
return response.json();
|
|
28
|
-
},
|
|
29
12
|
/**
|
|
30
13
|
* Register the google maps format if it is not already registered.
|
|
31
14
|
* @internal
|
|
@@ -51,28 +34,6 @@ export const GoogleMapsUtils = {
|
|
|
51
34
|
};
|
|
52
35
|
},
|
|
53
36
|
/**
|
|
54
|
-
* Retrieves the maximum zoom level available within a bounding rectangle.
|
|
55
|
-
* @param rectangle The bounding rectangle
|
|
56
|
-
* @returns The maximum zoom level available within the bounding rectangle.
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
getViewportInfo: async (params) => {
|
|
60
|
-
const { rectangle, session, key, zoom } = params;
|
|
61
|
-
const north = Angle.radiansToDegrees(rectangle.north);
|
|
62
|
-
const south = Angle.radiansToDegrees(rectangle.south);
|
|
63
|
-
const east = Angle.radiansToDegrees(rectangle.east);
|
|
64
|
-
const west = Angle.radiansToDegrees(rectangle.west);
|
|
65
|
-
const url = `https://tile.googleapis.com/tile/v1/viewport?session=${session}&key=${key}&zoom=${zoom}&north=${north}&south=${south}&east=${east}&west=${west}`;
|
|
66
|
-
const request = new Request(url, { method: "GET" });
|
|
67
|
-
const response = await fetch(request);
|
|
68
|
-
if (!response.ok) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
const json = await response.json();
|
|
72
|
-
return json;
|
|
73
|
-
;
|
|
74
|
-
},
|
|
75
|
-
/**
|
|
76
37
|
* Converts the session options to provider properties
|
|
77
38
|
* @param opts Options to create the session
|
|
78
39
|
* @internal
|
|
@@ -97,5 +58,40 @@ export const GoogleMapsUtils = {
|
|
|
97
58
|
}
|
|
98
59
|
return properties;
|
|
99
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* Read the session options from the map layer settings.
|
|
63
|
+
* @param settings Map layer settings
|
|
64
|
+
* ```
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
getSessionOptionsFromMapLayer: (settings) => {
|
|
68
|
+
const layerPropertyKeys = settings.properties ? Object.keys(settings.properties) : undefined;
|
|
69
|
+
if (layerPropertyKeys === undefined ||
|
|
70
|
+
!layerPropertyKeys.includes("mapType") ||
|
|
71
|
+
!layerPropertyKeys.includes("language") ||
|
|
72
|
+
!layerPropertyKeys.includes("region")) {
|
|
73
|
+
const msg = "Missing session options";
|
|
74
|
+
Logger.logError(loggerCategory, msg);
|
|
75
|
+
throw new BentleyError(BentleyStatus.ERROR, msg);
|
|
76
|
+
}
|
|
77
|
+
const createSessionOptions = {
|
|
78
|
+
mapType: settings.properties.mapType,
|
|
79
|
+
region: settings.properties.region,
|
|
80
|
+
language: settings.properties.language,
|
|
81
|
+
};
|
|
82
|
+
if (Array.isArray(settings.properties?.layerTypes) && settings.properties.layerTypes.length > 0) {
|
|
83
|
+
createSessionOptions.layerTypes = settings.properties.layerTypes;
|
|
84
|
+
}
|
|
85
|
+
if (settings.properties?.scale !== undefined) {
|
|
86
|
+
createSessionOptions.scale = settings.properties.scale;
|
|
87
|
+
}
|
|
88
|
+
if (settings.properties?.overlay !== undefined) {
|
|
89
|
+
createSessionOptions.overlay = settings.properties.overlay;
|
|
90
|
+
}
|
|
91
|
+
if (settings.properties?.apiOptions !== undefined) {
|
|
92
|
+
createSessionOptions.apiOptions = settings.properties.apiOptions;
|
|
93
|
+
}
|
|
94
|
+
return createSessionOptions;
|
|
95
|
+
}
|
|
100
96
|
};
|
|
101
97
|
//# sourceMappingURL=GoogleMapsUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleMapsUtils.js","sourceRoot":"","sources":["../../../src/internal/GoogleMapsUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;
|
|
1
|
+
{"version":3,"file":"GoogleMapsUtils.js","sourceRoot":"","sources":["../../../src/internal/GoogleMapsUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAG/F,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAErD,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG;IAE7B;;;MAGE;IACF,qBAAqB,EAAE,GAAG,EAAE;QAC1B,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,YAAY,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtF,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;;;;IAKA;IACA,mBAAmB,EAAE,CAAC,OAAe,YAAY,EAAE,IAAqC,EAAsB,EAAE;QAC9G,eAAe,CAAC,qBAAqB,EAAE,CAAC;QAExC,OAAO;YACL,QAAQ,EAAE,wBAAwB,CAAC,QA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AC/E,CAAC;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;CACF,CAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { ImageMapLayerProps, ImageMapLayerSettings, MapLayerProviderProperties } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { GoogleMapsMapLayerFormat } from \"../GoogleMaps/GoogleMapsImageryFormat.js\";\r\nimport { GoogleMapsCreateSessionOptions, GoogleMapsLayerTypes, GoogleMapsMapTypes, GoogleMapsScaleFactors } from \"../map-layers-formats.js\";\r\nimport { BentleyError, BentleyStatus, Logger } from \"@itwin/core-bentley\";\r\n\r\nconst loggerCategory = \"MapLayersFormats.GoogleMaps\";\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const GoogleMapsUtils = {\r\n\r\n /**\r\n * Register the google maps format if it is not already registered.\r\n * @internal\r\n */\r\n checkFormatRegistered: () => {\r\n if (!IModelApp.mapLayerFormatRegistry.isRegistered(GoogleMapsMapLayerFormat.formatId)) {\r\n throw new Error(`GoogleMaps format is not registered`);\r\n }\r\n },\r\n\r\n /**\r\n * Creates a Google Maps layer props.\r\n * @param name Name of the layer (Defaults to \"GoogleMaps\")\r\n * @param opts Options to create the session (Defaults to satellite map type, English language, US region, and roadmap layer type)\r\n * @internal\r\n*/\r\n createMapLayerProps: (name: string = \"GoogleMaps\", opts?: GoogleMapsCreateSessionOptions): ImageMapLayerProps => {\r\n GoogleMapsUtils.checkFormatRegistered();\r\n\r\n return {\r\n formatId: GoogleMapsMapLayerFormat.formatId,\r\n url: \"\",\r\n name,\r\n properties: GoogleMapsUtils.createPropertiesFromSessionOptions(opts ?? {mapType: \"satellite\", language: \"en-US\", region: \"US:\", layerTypes: [\"layerRoadmap\"]}),\r\n };\r\n },\r\n\r\n /**\r\n * Converts the session options to provider properties\r\n * @param opts Options to create the session\r\n * @internal\r\n */\r\n createPropertiesFromSessionOptions: (opts: GoogleMapsCreateSessionOptions): MapLayerProviderProperties => {\r\n const properties: MapLayerProviderProperties = {\r\n mapType: opts.mapType,\r\n language: opts.language,\r\n region: opts.region,\r\n }\r\n\r\n if (opts.layerTypes !== undefined) {\r\n properties.layerTypes = [...opts.layerTypes];\r\n }\r\n\r\n if (opts.scale !== undefined) {\r\n properties.scale = opts.scale;\r\n }\r\n\r\n if (opts.overlay !== undefined) {\r\n properties.overlay = opts.overlay;\r\n }\r\n\r\n if (opts.apiOptions !== undefined) {\r\n properties.apiOptions = [...opts.apiOptions];\r\n }\r\n\r\n return properties;\r\n },\r\n\r\n /**\r\n * Read the session options from the map layer settings.\r\n * @param settings Map layer settings\r\n * ```\r\n * @internal\r\n */\r\n getSessionOptionsFromMapLayer: (settings: ImageMapLayerSettings): GoogleMapsCreateSessionOptions => {\r\n const layerPropertyKeys = settings.properties ? Object.keys(settings.properties) : undefined;\r\n if (layerPropertyKeys === undefined ||\r\n !layerPropertyKeys.includes(\"mapType\") ||\r\n !layerPropertyKeys.includes(\"language\") ||\r\n !layerPropertyKeys.includes(\"region\")) {\r\n const msg = \"Missing session options\";\r\n Logger.logError(loggerCategory, msg);\r\n throw new BentleyError(BentleyStatus.ERROR, msg);\r\n }\r\n\r\n const createSessionOptions: GoogleMapsCreateSessionOptions = {\r\n mapType: settings.properties!.mapType as GoogleMapsMapTypes,\r\n region: settings.properties!.region as string,\r\n language: settings.properties!.language as string,\r\n }\r\n\r\n if (Array.isArray(settings.properties?.layerTypes) && settings.properties.layerTypes.length > 0) {\r\n createSessionOptions.layerTypes = settings.properties.layerTypes as GoogleMapsLayerTypes[];\r\n }\r\n\r\n if (settings.properties?.scale !== undefined) {\r\n createSessionOptions.scale = settings.properties.scale as GoogleMapsScaleFactors;\r\n }\r\n\r\n if (settings.properties?.overlay !== undefined) {\r\n createSessionOptions.overlay = settings.properties.overlay as boolean;\r\n }\r\n\r\n if (settings.properties?.apiOptions !== undefined) {\r\n createSessionOptions.apiOptions = settings.properties.apiOptions as string[];\r\n }\r\n return createSessionOptions;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module MapLayersFormats
|
|
3
|
+
*/
|
|
4
|
+
import { MapCartoRectangle, QuadIdProps } from "@itwin/core-frontend";
|
|
5
|
+
import { BaseGoogleMapsSession, GoogleMapsCreateSessionOptions, GoogleMapsRequest, GoogleMapsSession, GoogleMapsSessionData, GoogleMapsSessionManager } from "../GoogleMaps/GoogleMapsSession.js";
|
|
6
|
+
export declare class NativeGoogleMapsSession extends BaseGoogleMapsSession {
|
|
7
|
+
static getTileApiBaseUrl: string;
|
|
8
|
+
static viewportApiBaseUrl: string;
|
|
9
|
+
readonly json: GoogleMapsSessionData;
|
|
10
|
+
readonly apiKey: string;
|
|
11
|
+
constructor(json: GoogleMapsSessionData, apiKey: string);
|
|
12
|
+
protected getTileApiBaseUrl(): string;
|
|
13
|
+
getTileSize(): number;
|
|
14
|
+
getTileRequest(position: QuadIdProps): GoogleMapsRequest;
|
|
15
|
+
getViewportInfoRequest(rectangle: MapCartoRectangle, zoomLevel: number): GoogleMapsRequest;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Google Maps session.
|
|
18
|
+
* @param apiKey Google Cloud API key
|
|
19
|
+
* @param opts Options to create the session
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
static create(apiKey: string, opts: GoogleMapsCreateSessionOptions): Promise<GoogleMapsSessionData>;
|
|
23
|
+
}
|
|
24
|
+
export declare class NativeGoogleMapsSessionManager extends GoogleMapsSessionManager {
|
|
25
|
+
readonly apiKey: string;
|
|
26
|
+
constructor(apiKey: string);
|
|
27
|
+
createSession(sessionOptions: GoogleMapsCreateSessionOptions): Promise<GoogleMapsSession>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=NativeGoogleMapsSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeGoogleMapsSession.d.ts","sourceRoot":"","sources":["../../../src/internal/NativeGoogleMapsSession.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AASlM,qBAAa,uBAAwB,SAAQ,qBAAqB;IAChE,OAAc,iBAAiB,SAA4C;IAC3E,OAAc,kBAAkB,SAAiD;IACjF,SAAgB,IAAI,EAAE,qBAAqB,CAAC;IAC5C,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM;IAM9D,SAAS,CAAC,iBAAiB;IAIpB,WAAW,IAAI,MAAM;IAIrB,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,iBAAiB;IAOxD,sBAAsB,CAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB;IAYhG;;;;;MAKE;WACkB,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAUpH;AAMD,qBAAa,8BAA+B,SAAQ,wBAAwB;IAC1E,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEnB,MAAM,EAAE,MAAM;IAKb,aAAa,CAAC,cAAc,EAAE,8BAA8B,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAKvG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
/** @packageDocumentation
|
|
6
|
+
* @module MapLayersFormats
|
|
7
|
+
*/
|
|
8
|
+
import { Logger } from "@itwin/core-bentley";
|
|
9
|
+
import { BaseGoogleMapsSession, GoogleMapsSessionManager } from "../GoogleMaps/GoogleMapsSession.js";
|
|
10
|
+
const loggerCategory = "MapLayersFormats.GoogleMaps";
|
|
11
|
+
/*
|
|
12
|
+
* Google Maps session
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export class NativeGoogleMapsSession extends BaseGoogleMapsSession {
|
|
16
|
+
static getTileApiBaseUrl = "https://tile.googleapis.com/v1/2dtiles";
|
|
17
|
+
static viewportApiBaseUrl = `https://tile.googleapis.com/tile/v1/viewport`;
|
|
18
|
+
json;
|
|
19
|
+
apiKey;
|
|
20
|
+
constructor(json, apiKey) {
|
|
21
|
+
super();
|
|
22
|
+
this.json = json;
|
|
23
|
+
this.apiKey = apiKey;
|
|
24
|
+
}
|
|
25
|
+
getTileApiBaseUrl() {
|
|
26
|
+
return NativeGoogleMapsSession.getTileApiBaseUrl;
|
|
27
|
+
}
|
|
28
|
+
getTileSize() {
|
|
29
|
+
return this.json.tileWidth;
|
|
30
|
+
}
|
|
31
|
+
getTileRequest(position) {
|
|
32
|
+
const url = this.getTilePositionUrl(position);
|
|
33
|
+
url.searchParams.append("key", this.apiKey);
|
|
34
|
+
url.searchParams.append("session", this.json.session);
|
|
35
|
+
return { url };
|
|
36
|
+
}
|
|
37
|
+
getViewportInfoRequest(rectangle, zoomLevel) {
|
|
38
|
+
const degrees = rectangle.toDegrees();
|
|
39
|
+
const url = new URL(`${this.getTileApiBaseUrl()}\
|
|
40
|
+
zoom=${zoomLevel}\
|
|
41
|
+
&north=${degrees.north}&south=${degrees.south}&east=${degrees.east}&west=${degrees.west}`);
|
|
42
|
+
url.searchParams.append("key", this.apiKey);
|
|
43
|
+
url.searchParams.append("session", this.json.session);
|
|
44
|
+
return { url };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a Google Maps session.
|
|
48
|
+
* @param apiKey Google Cloud API key
|
|
49
|
+
* @param opts Options to create the session
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
static async create(apiKey, opts) {
|
|
53
|
+
const url = `https://tile.googleapis.com/v1/createSession?key=${apiKey}`;
|
|
54
|
+
const request = new Request(url, { method: "POST", body: JSON.stringify(opts) });
|
|
55
|
+
const response = await fetch(request);
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
throw new Error(`CreateSession request failed: ${response.status} - ${response.statusText}`);
|
|
58
|
+
}
|
|
59
|
+
Logger.logInfo(loggerCategory, `Session created successfully`);
|
|
60
|
+
return response.json();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/*
|
|
64
|
+
* Google Maps session manager that uses standard API key to create a session.
|
|
65
|
+
* @beta
|
|
66
|
+
*/
|
|
67
|
+
export class NativeGoogleMapsSessionManager extends GoogleMapsSessionManager {
|
|
68
|
+
apiKey;
|
|
69
|
+
constructor(apiKey) {
|
|
70
|
+
super();
|
|
71
|
+
this.apiKey = apiKey;
|
|
72
|
+
}
|
|
73
|
+
async createSession(sessionOptions) {
|
|
74
|
+
const json = await NativeGoogleMapsSession.create(this.apiKey, sessionOptions);
|
|
75
|
+
return new NativeGoogleMapsSession(json, this.apiKey);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=NativeGoogleMapsSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeGoogleMapsSession.js","sourceRoot":"","sources":["../../../src/internal/NativeGoogleMapsSession.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAA+F,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAGlM,MAAM,cAA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,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,OAAO,EAAC,GAAG,EAAC,CAAC;IACf,CAAC;IAEC;;;;;MAKE;IACK,MAAM,CAAC,KAAK,CAAC,MAAM,CAAE,MAAc,EAAE,IAAoC;QAC9E,MAAM,GAAG,GAAG,oDAAoD,MAAM,EAAE,CAAC;QACzE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC;QAC/E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAE,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC/F,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,8BAA8B,CAAC,CAAC;QAC/D,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;;AAGL;;;EAGE;AACF,MAAM,OAAO,8BAA+B,SAAQ,wBAAwB;IAC1D,MAAM,CAAS;IAE/B,YAAY,MAAc;QACxB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,cAA8C;QACvE,MAAM,IAAI,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAC/E,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayersFormats\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { MapCartoRectangle, QuadIdProps } from \"@itwin/core-frontend\";\r\nimport { BaseGoogleMapsSession, GoogleMapsCreateSessionOptions, GoogleMapsRequest, GoogleMapsSession, GoogleMapsSessionData, GoogleMapsSessionManager } from \"../GoogleMaps/GoogleMapsSession.js\";\r\n\r\n\r\nconst loggerCategory = \"MapLayersFormats.GoogleMaps\";\r\n\r\n/*\r\n* Google Maps session\r\n* @internal\r\n*/\r\nexport class NativeGoogleMapsSession extends BaseGoogleMapsSession {\r\n public static getTileApiBaseUrl = \"https://tile.googleapis.com/v1/2dtiles\";\r\n public static viewportApiBaseUrl = `https://tile.googleapis.com/tile/v1/viewport`\r\n public readonly json: GoogleMapsSessionData;\r\n public readonly apiKey: string;\r\n\r\n public constructor(json: GoogleMapsSessionData, apiKey: string) {\r\n super();\r\n this.json = json;\r\n this.apiKey = apiKey;\r\n }\r\n\r\n protected getTileApiBaseUrl() {\r\n return NativeGoogleMapsSession.getTileApiBaseUrl;\r\n }\r\n\r\n public getTileSize(): number {\r\n return this.json.tileWidth;\r\n }\r\n\r\n public getTileRequest(position: QuadIdProps): GoogleMapsRequest {\r\n const url = this.getTilePositionUrl(position);\r\n url.searchParams.append(\"key\", this.apiKey);\r\n url.searchParams.append(\"session\", this.json.session);\r\n return {url};\r\n }\r\n\r\n public getViewportInfoRequest (rectangle: MapCartoRectangle, zoomLevel: number): GoogleMapsRequest {\r\n const degrees = rectangle.toDegrees();\r\n const url = new URL(\r\n `${this.getTileApiBaseUrl()}\\\r\n zoom=${zoomLevel}\\\r\n &north=${degrees.north}&south=${degrees.south}&east=${degrees.east}&west=${degrees.west}`\r\n );\r\n url.searchParams.append(\"key\", this.apiKey);\r\n url.searchParams.append(\"session\", this.json.session);\r\n return {url};\r\n }\r\n\r\n /**\r\n * Creates a Google Maps session.\r\n * @param apiKey Google Cloud API key\r\n * @param opts Options to create the session\r\n * @internal\r\n */\r\n public static async create (apiKey: string, opts: GoogleMapsCreateSessionOptions): Promise<GoogleMapsSessionData> {\r\n const url = `https://tile.googleapis.com/v1/createSession?key=${apiKey}`;\r\n const request = new Request(url, {method: \"POST\", body: JSON.stringify(opts)});\r\n const response = await fetch (request);\r\n if (!response.ok) {\r\n throw new Error(`CreateSession request failed: ${response.status} - ${response.statusText}`);\r\n }\r\n Logger.logInfo(loggerCategory, `Session created successfully`);\r\n return response.json();\r\n }\r\n}\r\n\r\n/*\r\n* Google Maps session manager that uses standard API key to create a session.\r\n* @beta\r\n*/\r\nexport class NativeGoogleMapsSessionManager extends GoogleMapsSessionManager {\r\n public readonly apiKey: string;\r\n\r\n constructor(apiKey: string) {\r\n super();\r\n this.apiKey = apiKey;\r\n }\r\n\r\n public async createSession(sessionOptions: GoogleMapsCreateSessionOptions): Promise<GoogleMapsSession> {\r\n const json = await NativeGoogleMapsSession.create(this.apiKey, sessionOptions);\r\n return new NativeGoogleMapsSession(json, this.apiKey);\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -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"}
|
|
@@ -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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport * from \"./ArcGisFeature/ArcGisFeatureProvider.js\";\r\nexport * from \"./GoogleMaps/GoogleMaps.js\";\r\nexport * from \"./GoogleMaps/GoogleMapsSession.js\";\r\nexport * from \"./GoogleMaps/GoogleMapsImageryFormat.js\"\r\nexport * from \"./mapLayersFormats.js\";\r\nexport * from \"./Tools/MapFeatureInfoTool.js\";\r\n\r\n/** @docs-package-description\r\n * This package provides support for additional map layer formats that are not included in the @itwin/core-frontend package.\r\n */\r\n\r\n/** @docs-group-description MapLayersFormats\r\n * APIs for working with the map layer formats provided by this package.\r\n */\r\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;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;
|
|
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;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAkBnE;;GAEG;AACH,MAAM,OAAO,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,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,kGAAkG,CAAC,CAAC;QAClI,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YAC1B,SAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;YACvE,SAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;YACxE,SAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;QACtE,CAAC;QAED,mEAAmE;QACnE,gBAAgB,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC;QAC/E,MAAM,gBAAgB,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module MapLayersFormats\r\n */\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { ArcGisFeatureMapLayerFormat } from \"./ArcGisFeature/ArcGisFeatureFormat.js\";\r\nimport { GoogleMapsMapLayerFormat } from \"./GoogleMaps/GoogleMapsImageryFormat.js\";\r\nimport { OgcApiFeaturesMapLayerFormat } from \"./OgcApiFeatures/OgcApiFeaturesFormat.js\";\r\nimport { MapFeatureInfoTool } from \"./Tools/MapFeatureInfoTool.js\";\r\nimport { GoogleMapsSessionManager } from \"./map-layers-formats.js\";\r\n\r\n/** Configuration options.\r\n * @beta\r\n */\r\nexport interface MapLayersFormatsConfig {\r\n localization?: Localization;\r\n googleMapsOpts?: GoogleMapsOptions;\r\n}\r\n\r\n/** Google Maps options.\r\n * @beta\r\n */\r\nexport interface GoogleMapsOptions {\r\n sessionManager?: GoogleMapsSessionManager\r\n}\r\n\r\n/** The primary API for the `@itwin/map-layers-formats` package. It allows the package's features to be [[initialize]]d.\r\n * @beta\r\n */\r\nexport class MapLayersFormats {\r\n\r\n private static _defaultNs = \"mapLayersFormats\";\r\n public static localization: Localization;\r\n\r\n private static _googleMapsOpts?: GoogleMapsOptions;\r\n\r\n /** Registers the [MapLayerFormat]($frontend)s provided by this package for use with [IModelApp]($frontend).\r\n * Typically, an application will call `MapLayersFormats.initialize` immediately after [IModelApp.startup]($frontend).\r\n * This function has no effect if called **before** [IModelApp.startup]($frontend) or **after** [IModelApp.shutdown]($frontend).\r\n */\r\n public static async initialize(config?: MapLayersFormatsConfig): Promise<void> {\r\n assert(IModelApp.initialized, \"MapLayersFormats.initialize must be called after IModelApp.startup and before IModelApp.shutdown\");\r\n if (IModelApp.initialized) {\r\n IModelApp.mapLayerFormatRegistry.register(ArcGisFeatureMapLayerFormat);\r\n IModelApp.mapLayerFormatRegistry.register(OgcApiFeaturesMapLayerFormat);\r\n IModelApp.mapLayerFormatRegistry.register(GoogleMapsMapLayerFormat);\r\n }\r\n\r\n // register namespace containing localized strings for this package\r\n MapLayersFormats.localization = config?.localization ?? IModelApp.localization;\r\n await MapLayersFormats.localization.registerNamespace(\r\n MapLayersFormats.localizationNamespace,\r\n );\r\n\r\n MapFeatureInfoTool.register(MapLayersFormats.localizationNamespace);\r\n MapLayersFormats._googleMapsOpts = config?.googleMapsOpts;\r\n }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return MapLayersFormats._defaultNs;\r\n }\r\n\r\n public static get googleMapsOpts() {\r\n return MapLayersFormats._googleMapsOpts;\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tools": {
|
|
3
|
-
"MapFeatureInfoTool": {
|
|
4
|
-
"keyin": "mlt map feature info",
|
|
5
|
-
"description": "Identify map layer features",
|
|
6
|
-
"flyover": "Map Layer Info",
|
|
7
|
-
"Prompts": {
|
|
8
|
-
"EnterPoint": "Identify map layer features",
|
|
9
|
-
"clickToIdentify": "Click to identify features",
|
|
10
|
-
"clickToClear": "Click to clear highlighted features"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"Messages": {
|
|
15
|
-
"MapFeatureInfoDecorator": {
|
|
16
|
-
"clusterZoomIn": "{{nbInstances}} instances found. Zoom in for more granularity."
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"tools": {
|
|
3
|
+
"MapFeatureInfoTool": {
|
|
4
|
+
"keyin": "mlt map feature info",
|
|
5
|
+
"description": "Identify map layer features",
|
|
6
|
+
"flyover": "Map Layer Info",
|
|
7
|
+
"Prompts": {
|
|
8
|
+
"EnterPoint": "Identify map layer features",
|
|
9
|
+
"clickToIdentify": "Click to identify features",
|
|
10
|
+
"clickToClear": "Click to clear highlighted features"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"Messages": {
|
|
15
|
+
"MapFeatureInfoDecorator": {
|
|
16
|
+
"clusterZoomIn": "{{nbInstances}} instances found. Zoom in for more granularity."
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
19
|
}
|