@itwin/core-frontend 4.1.0-dev.29 → 4.1.0-dev.30
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/lib/cjs/BackgroundMapGeometry.d.ts +2 -2
- package/lib/cjs/BackgroundMapGeometry.d.ts.map +1 -1
- package/lib/cjs/BackgroundMapGeometry.js +18 -7
- package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
- package/lib/cjs/GeoServices.d.ts +37 -7
- package/lib/cjs/GeoServices.d.ts.map +1 -1
- package/lib/cjs/GeoServices.js +74 -24
- package/lib/cjs/GeoServices.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts +23 -6
- package/lib/cjs/IModelConnection.d.ts.map +1 -1
- package/lib/cjs/IModelConnection.js +74 -7
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/ViewGlobalLocation.d.ts.map +1 -1
- package/lib/cjs/ViewGlobalLocation.js +4 -3
- package/lib/cjs/ViewGlobalLocation.js.map +1 -1
- package/lib/cjs/ViewState.d.ts +22 -4
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +36 -6
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/Viewport.js +1 -1
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +1 -1
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/BackgroundMapGeometry.d.ts +2 -2
- package/lib/esm/BackgroundMapGeometry.d.ts.map +1 -1
- package/lib/esm/BackgroundMapGeometry.js +18 -7
- package/lib/esm/BackgroundMapGeometry.js.map +1 -1
- package/lib/esm/GeoServices.d.ts +37 -7
- package/lib/esm/GeoServices.d.ts.map +1 -1
- package/lib/esm/GeoServices.js +74 -24
- package/lib/esm/GeoServices.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +23 -6
- package/lib/esm/IModelConnection.d.ts.map +1 -1
- package/lib/esm/IModelConnection.js +74 -7
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/ViewGlobalLocation.d.ts.map +1 -1
- package/lib/esm/ViewGlobalLocation.js +4 -3
- package/lib/esm/ViewGlobalLocation.js.map +1 -1
- package/lib/esm/ViewState.d.ts +22 -4
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +36 -6
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/Viewport.js +1 -1
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +1 -1
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoServices.js","sourceRoot":"","sources":["../../src/GeoServices.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,qBAAqB;AACrB,OAAO,EACL,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GACjD,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACwB,cAAc,EAAsD,sBAAsB,GACxH,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAczE,SAAS,aAAa,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC;AAUD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,mBAAmB;IAepB,QAAQ,CAAC,KAAe,EAAE,MAAsB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QAC/E,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,gBAAgB;IACT,KAAK,CAAC,sCAAsC,CAAC,SAAqB;QACvE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1D,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,MAAM;YAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,KAAK,CAAC,sCAAsC,CAAC,YAAwB;QAC1E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7D,OAAO;YACL,SAAS,EAAE,MAAM,CAAC,MAAM;YACxB,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,4CAA4C,CAAC,SAAqB;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,WAAW;IAGtB,gBAAgB;IAChB,YAAY,MAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,WAAyC;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF","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 IModelConnection\r\n */\r\n\r\n// cspell:ignore GCRS\r\nimport {\r\n assert, BeEvent, Dictionary, Logger, SortedArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { WritableXYAndZ, XYAndZ, XYZProps } from \"@itwin/core-geometry\";\r\nimport {\r\n GeoCoordinatesResponseProps, GeoCoordStatus, GeographicCRSProps, IModelCoordinatesResponseProps, IModelReadRpcInterface, PointWithStatus,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\n\r\n/** Options used to create a [[CoordinateConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface CoordinateConverterOptions {\r\n /** The iModel for which to perform the conversions. */\r\n iModel: IModelConnection;\r\n /** Asynchronously convert each point. The resultant array should have the same number and order of points as the input. */\r\n requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n /** Maximum number of points to include in each request. Default: 300. */\r\n maxPointsPerRequest?: number;\r\n}\r\n\r\nfunction compareXYAndZ(lhs: XYAndZ, rhs: XYAndZ): number {\r\n return lhs.x - rhs.x || lhs.y - rhs.y || lhs.z - rhs.z;\r\n}\r\n\r\nfunction cloneXYAndZ(xyz: XYAndZ): XYAndZ {\r\n return { x: xyz.x, y: xyz.y, z: xyz.z };\r\n}\r\n\r\ntype CoordinateConverterState =\r\n // No pending requests.\r\n \"idle\" |\r\n // We have scheduled a requestAnimationFrame to dispatch all pending requests.\r\n \"scheduled\" |\r\n // We have dispatched all requests that were pending at the most recent requestAnimationFrame callback.\r\n \"in-flight\";\r\n\r\n/** Performs conversion of coordinates from one coordinate system to another.\r\n * A [[GeoConverter]] has a pair of these for converting between iModel coordinates and geographic coordinates.\r\n * Uses a cache to avoid repeatedly requesting the same points, and a batching strategy to avoid making frequent small requests.\r\n * The cache stores every point that was ever converted by [[convert]]. It is currently permitted to grow to unbounded size.\r\n * The batching works as follows:\r\n * When a conversion is requested via [[convert]], if all the requested points are in the cache, they are returned immediately.\r\n * Otherwise, any points not in the cache and not in the current in-flight request (if any) are placed onto the queue of pending requests.\r\n * A pending request is scheduled if one hasn't already been scheduled, via requestAnimationFrame.\r\n * In the animation frame callback, the pending requests are split into batches of no more than options.maxPointsPerRequest and dispatched to the backend.\r\n * Once the response is received, the results are loaded into and returned from the cache.\r\n * If more calls to convert occurred while the request was in flight, another request is dispatched.\r\n * @internal exported strictly for tests.\r\n */\r\nexport class CoordinateConverter {\r\n protected readonly _cache: Dictionary<XYAndZ, PointWithStatus>;\r\n protected _state: CoordinateConverterState = \"idle\";\r\n // The accumulated set of points to be converted by the next request.\r\n protected _pending: SortedArray<XYAndZ>;\r\n // The set of points that were included in the current in-flight request, if any.\r\n protected _inflight: SortedArray<XYAndZ>;\r\n // An event fired when the next request completes.\r\n protected _onCompleted = new BeEvent<() => void>();\r\n // Used for creating cache keys (XYAndZ) from XYZProps without having to allocate temporary objects.\r\n protected readonly _scratchXYZ = { x: 0, y: 0, z: 0 };\r\n protected readonly _maxPointsPerRequest: number;\r\n protected readonly _iModel: IModelConnection;\r\n protected readonly _requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n\r\n protected toXYAndZ(input: XYZProps, output: WritableXYAndZ): XYAndZ {\r\n if (Array.isArray(input)) {\r\n output.x = input[0] ?? 0;\r\n output.y = input[1] ?? 0;\r\n output.z = input[2] ?? 0;\r\n } else {\r\n output.x = input.x ?? 0;\r\n output.y = input.y ?? 0;\r\n output.z = input.z ?? 0;\r\n }\r\n\r\n return output;\r\n }\r\n\r\n public constructor(opts: CoordinateConverterOptions) {\r\n this._maxPointsPerRequest = Math.max(1, opts.maxPointsPerRequest ?? 300);\r\n this._iModel = opts.iModel;\r\n this._requestPoints = opts.requestPoints;\r\n\r\n this._cache = new Dictionary<XYAndZ, PointWithStatus>(compareXYAndZ, cloneXYAndZ);\r\n this._pending = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n this._inflight = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n }\r\n\r\n protected async dispatch(): Promise<void> {\r\n assert(this._state === \"scheduled\");\r\n if (this._iModel.isClosed || this._pending.isEmpty) {\r\n this._state = \"idle\";\r\n this._onCompleted.raiseEvent();\r\n return;\r\n }\r\n\r\n this._state = \"in-flight\";\r\n\r\n // Ensure subsequently-enqueued requests listen for the *next* response to be received.\r\n const onCompleted = this._onCompleted;\r\n this._onCompleted = new BeEvent<() => void>();\r\n\r\n // Pending requests are now in flight. Start a new list of pending requests. It's cheaper to swap than to allocate new objects.\r\n const inflight = this._pending;\r\n this._pending = this._inflight;\r\n assert(this._pending.isEmpty);\r\n this._inflight = inflight;\r\n\r\n // Split requests if necessary to avoid requesting more than the maximum allowed number of points.\r\n const promises: Array<Promise<void>> = [];\r\n for (let i = 0; i < inflight.length; i += this._maxPointsPerRequest) {\r\n const requests = inflight.slice(i, i + this._maxPointsPerRequest).extractArray();\r\n const promise = this._requestPoints(requests).then((results) => {\r\n if (this._iModel.isClosed)\r\n return;\r\n\r\n if (results.length !== requests.length)\r\n Logger.logError(`${FrontendLoggerCategory.Package}.geoservices`, `requested conversion of ${requests.length} points, but received ${results.length} points`);\r\n\r\n for (let j = 0; j < results.length; j++) {\r\n if (j < requests.length)\r\n this._cache.set(requests[j], results[j]);\r\n }\r\n }).catch((err) => {\r\n Logger.logException(`${FrontendLoggerCategory.Package}.geoservices`, err);\r\n });\r\n\r\n promises.push(promise);\r\n }\r\n\r\n await Promise.all(promises);\r\n\r\n assert(this._state === \"in-flight\");\r\n this._state = \"idle\";\r\n this._inflight.clear();\r\n\r\n // If any more pending conversions arrived while awaiting this request, schedule another request.\r\n if (!this._pending.isEmpty)\r\n this.scheduleDispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n // Resolve promises of all callers who were awaiting this request.\r\n onCompleted.raiseEvent();\r\n }\r\n\r\n // Add any points not present in cache to pending request list.\r\n // Return the number of points present in cache.\r\n protected enqueue(points: XYZProps[]): number {\r\n let numInCache = 0;\r\n for (const point of points) {\r\n const xyz = this.toXYAndZ(point, this._scratchXYZ);\r\n if (this._cache.get(xyz))\r\n ++numInCache;\r\n else if (!this._inflight.contains(xyz))\r\n this._pending.insert(xyz);\r\n }\r\n\r\n return numInCache;\r\n }\r\n\r\n // Obtain converted points from the cache. The assumption is that every point in `inputs` is already present in the cache.\r\n // Any point not present will be returned unconverted with an error status.\r\n protected getFromCache(inputs: XYZProps[]): PointWithStatus[] {\r\n const outputs: PointWithStatus[] = [];\r\n for (const input of inputs) {\r\n const xyz = this.toXYAndZ(input, this._scratchXYZ);\r\n let output = this._cache.get(xyz);\r\n if (!output)\r\n output = { p: { ...xyz }, s: GeoCoordStatus.CSMapError };\r\n\r\n outputs.push(output);\r\n }\r\n\r\n return outputs;\r\n }\r\n\r\n protected async scheduleDispatch(): Promise<void> {\r\n if (\"idle\" === this._state) {\r\n this._state = \"scheduled\";\r\n requestAnimationFrame(() => {\r\n this.dispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n });\r\n }\r\n\r\n return new Promise((resolve) => {\r\n this._onCompleted.addOnce(() => resolve());\r\n });\r\n }\r\n\r\n public async convert(inputs: XYZProps[]): Promise<{ points: PointWithStatus[], fromCache: number }> {\r\n const fromCache = this.enqueue(inputs);\r\n assert(fromCache >= 0);\r\n assert(fromCache <= inputs.length);\r\n\r\n if (fromCache === inputs.length)\r\n return { points: this.getFromCache(inputs), fromCache };\r\n\r\n await this.scheduleDispatch();\r\n\r\n return { points: this.getFromCache(inputs), fromCache };\r\n }\r\n\r\n public findCached(inputs: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n const result: Array<PointWithStatus | undefined> = [];\r\n let missing: XYZProps[] | undefined;\r\n for (const input of inputs) {\r\n const key = this.toXYAndZ(input, this._scratchXYZ);\r\n const output = this._cache.get(key);\r\n result.push(output);\r\n if (!output) {\r\n if (!missing)\r\n missing = [];\r\n\r\n missing.push(input);\r\n }\r\n }\r\n\r\n return { result, missing };\r\n }\r\n}\r\n\r\n/** Response to a request to obtain imodel coordinates from cache.\r\n * @internal\r\n */\r\nexport interface CachedIModelCoordinatesResponseProps {\r\n /** An array of the same length as the input array, with undefined entries at indices corresponding to points not found in cache. */\r\n result: Array<PointWithStatus | undefined>;\r\n /** An array of points in the input array which were not found in the cache, or undefined if all points were found in the cache. */\r\n missing?: XYZProps[];\r\n}\r\n\r\n/** An object capable of communicating with the backend to convert between coordinates in a geographic coordinate system and coordinates in an [[IModelConnection]]'s own coordinate system.\r\n * @see [[GeoServices.getConverter]] to obtain a converter.\r\n * @see [GeographicCRS]($common) for more information about geographic coordinate reference systems.\r\n * @public\r\n */\r\nexport class GeoConverter {\r\n private readonly _geoToIModel: CoordinateConverter;\r\n private readonly _iModelToGeo: CoordinateConverter;\r\n\r\n /** @internal */\r\n constructor(iModel: IModelConnection, datumOrGCRS: string | GeographicCRSProps) {\r\n const datum = typeof datumOrGCRS === \"object\" ? JSON.stringify(datumOrGCRS) : datumOrGCRS;\r\n\r\n this._geoToIModel = new CoordinateConverter({\r\n iModel,\r\n requestPoints: async (geoCoords: XYAndZ[]) => {\r\n const request = { source: datum, geoCoords };\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getIModelCoordinatesFromGeoCoordinates(iModel.getRpcProps(), request);\r\n return response.iModelCoords;\r\n },\r\n });\r\n\r\n this._iModelToGeo = new CoordinateConverter({\r\n iModel,\r\n requestPoints: async (iModelCoords: XYAndZ[]) => {\r\n const request = { target: datum, iModelCoords };\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getGeoCoordinatesFromIModelCoordinates(iModel.getRpcProps(), request);\r\n return response.geoCoords;\r\n },\r\n });\r\n }\r\n\r\n /** Convert the specified geographic coordinates into iModel coordinates. */\r\n public async convertToIModelCoords(geoPoints: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getIModelCoordinatesFromGeoCoordinates(geoPoints);\r\n return result.iModelCoords;\r\n }\r\n\r\n /** Convert the specified iModel coordinates into geographic coordinates. */\r\n public async convertFromIModelCoords(iModelCoords: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getGeoCoordinatesFromIModelCoordinates(iModelCoords);\r\n return result.geoCoords;\r\n }\r\n\r\n /** @internal */\r\n public async getIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): Promise<IModelCoordinatesResponseProps> {\r\n const result = await this._geoToIModel.convert(geoPoints);\r\n return {\r\n iModelCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public async getGeoCoordinatesFromIModelCoordinates(iModelPoints: XYZProps[]): Promise<GeoCoordinatesResponseProps> {\r\n const result = await this._iModelToGeo.convert(iModelPoints);\r\n return {\r\n geoCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public getCachedIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n return this._geoToIModel.findCached(geoPoints);\r\n }\r\n}\r\n\r\n/** The Geographic Services available for an [[IModelConnection]].\r\n * @see [[IModelConnection.geoServices]] to obtain the GeoServices for a specific iModel.\r\n * @public\r\n */\r\nexport class GeoServices {\r\n private _iModel: IModelConnection;\r\n\r\n /** @internal */\r\n constructor(iModel: IModelConnection) {\r\n this._iModel = iModel;\r\n }\r\n\r\n /** Obtain a converter that can convert between a geographic coordinate system and the iModel's own coordinate system.\r\n * @param datumOrGCRS The name or JSON representation of the geographic coordinate system datum - for example, \"WGS84\".\r\n * @returns a converter, or `undefined` if the iModel is not open.\r\n * @note A [[BlankConnection]] has no connection to a backend, so it is never \"open\"; therefore it always returns `undefined`.\r\n */\r\n public getConverter(datumOrGCRS?: string | GeographicCRSProps): GeoConverter | undefined {\r\n return this._iModel.isOpen ? new GeoConverter(this._iModel, datumOrGCRS ? datumOrGCRS : \"\") : undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":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AAQ,CAAC,cAAc,EAAE;YAChC,OAAO,SAAS,CAAC;QAEnB,MAAM,KAAK,GAAG,CAAC,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAElG,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,EAAE;YACd,SAAS,GAAG,IAAI,YAAY,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAElC,SAAS,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC5C,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;oBACtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","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 IModelConnection\r\n */\r\n\r\n// cspell:ignore GCRS\r\nimport {\r\n assert, BeEvent, Dictionary, Logger, SortedArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { WritableXYAndZ, XYAndZ, XYZProps } from \"@itwin/core-geometry\";\r\nimport {\r\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeoCoordStatus, GeographicCRSProps, IModelCoordinatesRequestProps, IModelCoordinatesResponseProps,\r\n IModelReadRpcInterface, PointWithStatus,\r\n} from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\r\n\r\n/** Options used to create a [[CoordinateConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface CoordinateConverterOptions {\r\n isIModelClosed: () => boolean;\r\n /** Asynchronously convert each point. The resultant array should have the same number and order of points as the input. */\r\n requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n /** Maximum number of points to include in each request. Default: 300. */\r\n maxPointsPerRequest?: number;\r\n}\r\n\r\nfunction compareXYAndZ(lhs: XYAndZ, rhs: XYAndZ): number {\r\n return lhs.x - rhs.x || lhs.y - rhs.y || lhs.z - rhs.z;\r\n}\r\n\r\nfunction cloneXYAndZ(xyz: XYAndZ): XYAndZ {\r\n return { x: xyz.x, y: xyz.y, z: xyz.z };\r\n}\r\n\r\ntype CoordinateConverterState =\r\n // No pending requests.\r\n \"idle\" |\r\n // We have scheduled a requestAnimationFrame to dispatch all pending requests.\r\n \"scheduled\" |\r\n // We have dispatched all requests that were pending at the most recent requestAnimationFrame callback.\r\n \"in-flight\";\r\n\r\n/** Performs conversion of coordinates from one coordinate system to another.\r\n * A [[GeoConverter]] has a pair of these for converting between iModel coordinates and geographic coordinates.\r\n * Uses a cache to avoid repeatedly requesting the same points, and a batching strategy to avoid making frequent small requests.\r\n * The cache stores every point that was ever converted by [[convert]]. It is currently permitted to grow to unbounded size.\r\n * The batching works as follows:\r\n * When a conversion is requested via [[convert]], if all the requested points are in the cache, they are returned immediately.\r\n * Otherwise, any points not in the cache and not in the current in-flight request (if any) are placed onto the queue of pending requests.\r\n * A pending request is scheduled if one hasn't already been scheduled, via requestAnimationFrame.\r\n * In the animation frame callback, the pending requests are split into batches of no more than options.maxPointsPerRequest and dispatched to the backend.\r\n * Once the response is received, the results are loaded into and returned from the cache.\r\n * If more calls to convert occurred while the request was in flight, another request is dispatched.\r\n * @internal exported strictly for tests.\r\n */\r\nexport class CoordinateConverter {\r\n protected readonly _cache: Dictionary<XYAndZ, PointWithStatus>;\r\n protected _state: CoordinateConverterState = \"idle\";\r\n // The accumulated set of points to be converted by the next request.\r\n protected _pending: SortedArray<XYAndZ>;\r\n // The set of points that were included in the current in-flight request, if any.\r\n protected _inflight: SortedArray<XYAndZ>;\r\n // An event fired when the next request completes.\r\n protected _onCompleted = new BeEvent<() => void>();\r\n // Used for creating cache keys (XYAndZ) from XYZProps without having to allocate temporary objects.\r\n protected readonly _scratchXYZ = { x: 0, y: 0, z: 0 };\r\n protected readonly _maxPointsPerRequest: number;\r\n protected readonly _isIModelClosed: () => boolean;\r\n protected readonly _requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;\r\n // If true, [[dispatch]] will schedule another dispatch after it receives a response.\r\n // This is needed when all the points requested after the most recent dispatch were included in the currently-in-flight request -\r\n // _pending will be empty but new callers will be awaiting the results of the in-flight request.\r\n protected _redispatchOnCompletion = false;\r\n\r\n public get isIdle(): boolean {\r\n return \"idle\" === this._state;\r\n }\r\n\r\n protected toXYAndZ(input: XYZProps, output: WritableXYAndZ): XYAndZ {\r\n if (Array.isArray(input)) {\r\n output.x = input[0] ?? 0;\r\n output.y = input[1] ?? 0;\r\n output.z = input[2] ?? 0;\r\n } else {\r\n output.x = input.x ?? 0;\r\n output.y = input.y ?? 0;\r\n output.z = input.z ?? 0;\r\n }\r\n\r\n return output;\r\n }\r\n\r\n public constructor(opts: CoordinateConverterOptions) {\r\n this._maxPointsPerRequest = Math.max(1, opts.maxPointsPerRequest ?? 300);\r\n this._isIModelClosed = opts.isIModelClosed;\r\n this._requestPoints = opts.requestPoints;\r\n\r\n this._cache = new Dictionary<XYAndZ, PointWithStatus>(compareXYAndZ, cloneXYAndZ);\r\n this._pending = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n this._inflight = new SortedArray<XYAndZ>(compareXYAndZ, false, cloneXYAndZ);\r\n }\r\n\r\n protected async dispatch(): Promise<void> {\r\n assert(this._state === \"scheduled\");\r\n if (this._isIModelClosed() || this._pending.isEmpty) {\r\n this._state = \"idle\";\r\n this._onCompleted.raiseEvent();\r\n return;\r\n }\r\n\r\n this._state = \"in-flight\";\r\n\r\n // Ensure subsequently-enqueued requests listen for the *next* response to be received.\r\n const onCompleted = this._onCompleted;\r\n this._onCompleted = new BeEvent<() => void>();\r\n\r\n // Pending requests are now in flight. Start a new list of pending requests. It's cheaper to swap than to allocate new objects.\r\n const inflight = this._pending;\r\n this._pending = this._inflight;\r\n assert(this._pending.isEmpty);\r\n this._inflight = inflight;\r\n\r\n // Split requests if necessary to avoid requesting more than the maximum allowed number of points.\r\n const promises: Array<Promise<void>> = [];\r\n for (let i = 0; i < inflight.length; i += this._maxPointsPerRequest) {\r\n const requests = inflight.slice(i, i + this._maxPointsPerRequest).extractArray();\r\n const promise = this._requestPoints(requests).then((results) => {\r\n if (this._isIModelClosed())\r\n return;\r\n\r\n if (results.length !== requests.length)\r\n Logger.logError(`${FrontendLoggerCategory.Package}.geoservices`, `requested conversion of ${requests.length} points, but received ${results.length} points`);\r\n\r\n for (let j = 0; j < results.length; j++) {\r\n if (j < requests.length)\r\n this._cache.set(requests[j], results[j]);\r\n }\r\n }).catch((err) => {\r\n Logger.logException(`${FrontendLoggerCategory.Package}.geoservices`, err);\r\n });\r\n\r\n promises.push(promise);\r\n }\r\n\r\n await Promise.all(promises);\r\n\r\n assert(this._state === \"in-flight\");\r\n this._state = \"idle\";\r\n this._inflight.clear();\r\n\r\n // If any more pending conversions arrived while awaiting this request, schedule another request.\r\n if (!this._pending.isEmpty || this._redispatchOnCompletion) {\r\n this._redispatchOnCompletion = false;\r\n this.scheduleDispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n // Resolve promises of all callers who were awaiting this request.\r\n onCompleted.raiseEvent();\r\n }\r\n\r\n // Add any points not present in cache to pending request list.\r\n // Return the number of points present in cache.\r\n protected enqueue(points: XYZProps[]): number {\r\n let numInCache = 0;\r\n for (const point of points) {\r\n const xyz = this.toXYAndZ(point, this._scratchXYZ);\r\n if (this._cache.get(xyz))\r\n ++numInCache;\r\n else if (this._inflight.contains(xyz))\r\n this._redispatchOnCompletion = true;\r\n else\r\n this._pending.insert(xyz);\r\n }\r\n\r\n return numInCache;\r\n }\r\n\r\n // Obtain converted points from the cache. The assumption is that every point in `inputs` is already present in the cache.\r\n // Any point not present will be returned unconverted with an error status.\r\n protected getFromCache(inputs: XYZProps[]): PointWithStatus[] {\r\n const outputs: PointWithStatus[] = [];\r\n for (const input of inputs) {\r\n const xyz = this.toXYAndZ(input, this._scratchXYZ);\r\n let output = this._cache.get(xyz);\r\n if (!output)\r\n output = { p: { ...xyz }, s: GeoCoordStatus.CSMapError };\r\n\r\n outputs.push(output);\r\n }\r\n\r\n return outputs;\r\n }\r\n\r\n protected async scheduleDispatch(): Promise<void> {\r\n if (\"idle\" === this._state) {\r\n this._state = \"scheduled\";\r\n requestAnimationFrame(() => {\r\n this.dispatch(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n });\r\n }\r\n\r\n return new Promise((resolve) => {\r\n this._onCompleted.addOnce(() => resolve());\r\n });\r\n }\r\n\r\n public async convert(inputs: XYZProps[]): Promise<{ points: PointWithStatus[], fromCache: number }> {\r\n const fromCache = this.enqueue(inputs);\r\n assert(fromCache >= 0);\r\n assert(fromCache <= inputs.length);\r\n\r\n if (fromCache === inputs.length)\r\n return { points: this.getFromCache(inputs), fromCache };\r\n\r\n await this.scheduleDispatch();\r\n\r\n return { points: this.getFromCache(inputs), fromCache };\r\n }\r\n\r\n public findCached(inputs: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n const result: Array<PointWithStatus | undefined> = [];\r\n let missing: XYZProps[] | undefined;\r\n for (const input of inputs) {\r\n const key = this.toXYAndZ(input, this._scratchXYZ);\r\n const output = this._cache.get(key);\r\n result.push(output);\r\n if (!output) {\r\n if (!missing)\r\n missing = [];\r\n\r\n missing.push(input);\r\n }\r\n }\r\n\r\n return { result, missing };\r\n }\r\n}\r\n\r\n/** Response to a request to obtain imodel coordinates from cache.\r\n * @internal\r\n */\r\nexport interface CachedIModelCoordinatesResponseProps {\r\n /** An array of the same length as the input array, with undefined entries at indices corresponding to points not found in cache. */\r\n result: Array<PointWithStatus | undefined>;\r\n /** An array of points in the input array which were not found in the cache, or undefined if all points were found in the cache. */\r\n missing?: XYZProps[];\r\n}\r\n\r\n/** Options used to create a [[GeoConverter]].\r\n * @internal exported strictly for tests.\r\n */\r\nexport interface GeoConverterOptions {\r\n readonly datum: string;\r\n isIModelClosed: () => boolean;\r\n toIModelCoords: (request: IModelCoordinatesRequestProps) => Promise<PointWithStatus[]>;\r\n fromIModelCoords: (request: GeoCoordinatesRequestProps) => Promise<PointWithStatus[]>;\r\n}\r\n\r\n/** An object capable of communicating with the backend to convert between coordinates in a geographic coordinate system and coordinates in an [[IModelConnection]]'s own coordinate system.\r\n * @see [[GeoServices.getConverter]] to obtain a converter.\r\n * @see [GeographicCRS]($common) for more information about geographic coordinate reference systems.\r\n * @public\r\n */\r\nexport class GeoConverter {\r\n private readonly _geoToIModel: CoordinateConverter;\r\n private readonly _iModelToGeo: CoordinateConverter;\r\n /** Used for removing this converter from GeoServices' cache after all requests are completed.\r\n * @internal\r\n */\r\n public readonly onAllRequestsCompleted = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n constructor(opts: GeoConverterOptions) {\r\n const isIModelClosed = opts.isIModelClosed;\r\n this._geoToIModel = new CoordinateConverter({\r\n isIModelClosed,\r\n requestPoints: async (geoCoords: XYAndZ[]) => opts.toIModelCoords({ source: opts.datum, geoCoords }),\r\n });\r\n\r\n this._iModelToGeo = new CoordinateConverter({\r\n isIModelClosed,\r\n requestPoints: async (iModelCoords: XYAndZ[]) => opts.fromIModelCoords({ target: opts.datum, iModelCoords }),\r\n });\r\n }\r\n\r\n /** Convert the specified geographic coordinates into iModel coordinates. */\r\n public async convertToIModelCoords(geoPoints: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getIModelCoordinatesFromGeoCoordinates(geoPoints);\r\n return result.iModelCoords;\r\n }\r\n\r\n /** Convert the specified iModel coordinates into geographic coordinates. */\r\n public async convertFromIModelCoords(iModelCoords: XYZProps[]): Promise<PointWithStatus[]> {\r\n const result = await this.getGeoCoordinatesFromIModelCoordinates(iModelCoords);\r\n return result.geoCoords;\r\n }\r\n\r\n /** @internal */\r\n public async getIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): Promise<IModelCoordinatesResponseProps> {\r\n const result = await this._geoToIModel.convert(geoPoints);\r\n this.checkCompletion();\r\n return {\r\n iModelCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n /** @internal */\r\n public async getGeoCoordinatesFromIModelCoordinates(iModelPoints: XYZProps[]): Promise<GeoCoordinatesResponseProps> {\r\n const result = await this._iModelToGeo.convert(iModelPoints);\r\n this.checkCompletion();\r\n return {\r\n geoCoords: result.points,\r\n fromCache: result.fromCache,\r\n };\r\n }\r\n\r\n private checkCompletion(): void {\r\n if (this._geoToIModel.isIdle && this._iModelToGeo.isIdle)\r\n this.onAllRequestsCompleted.raiseEvent();\r\n }\r\n\r\n /** @internal */\r\n public getCachedIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): CachedIModelCoordinatesResponseProps {\r\n return this._geoToIModel.findCached(geoPoints);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type GeoServicesOptions = Omit<GeoConverterOptions, \"datum\">;\r\n\r\n/** The Geographic Services available for an [[IModelConnection]].\r\n * @see [[IModelConnection.geoServices]] to obtain the GeoServices for a specific iModel.\r\n * @public\r\n */\r\nexport class GeoServices {\r\n private readonly _options: GeoServicesOptions;\r\n /** Each GeoConverter has its own independent request queue and cache of previously-converted points.\r\n * Some callers like RealityTileTree obtain a single GeoConverter and reuse it throughout their own lifetime. Therefore they benefit from both batching and caching, and\r\n * the cache gets deleted once the RealityTileTree becomes disused.\r\n *\r\n * Other callers like IModelConnection.spatialToCartographic obtain a new GeoConverter every time they need one, use it to convert a single point(!), and then discard the converter.\r\n * This entirely prevents batching - e.g., calling spatialToCartographic 20 times in one frame results in 20 http requests.\r\n * To address that, we cache each GeoConverter returned by getConverter until it has converted at least one point and has no further outstanding conversion requests.\r\n * In this way, the converter lives for as long as (and no longer than) any caller is awaiting conversion to/from its datum - it and its cache are deleted once it becomes disused.\r\n * This makes the coordinate caching generally less useful, but at least bounded - and maximizes batching of requests.\r\n */\r\n private readonly _cache = new Map<string, GeoConverter>();\r\n\r\n /** @internal */\r\n public constructor(options: GeoServicesOptions) {\r\n this._options = options;\r\n }\r\n\r\n /** @internal */\r\n public static createForIModel(iModel: IModelConnection): GeoServices {\r\n return new GeoServices({\r\n isIModelClosed: () => iModel.isClosed,\r\n toIModelCoords: async (request) => {\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getIModelCoordinatesFromGeoCoordinates(iModel.getRpcProps(), request);\r\n return response.iModelCoords;\r\n },\r\n fromIModelCoords: async (request) => {\r\n const rpc = IModelReadRpcInterface.getClientForRouting(iModel.routingContext.token);\r\n const response = await rpc.getGeoCoordinatesFromIModelCoordinates(iModel.getRpcProps(), request);\r\n return response.geoCoords;\r\n },\r\n });\r\n }\r\n\r\n /** Obtain a converter that can convert between a geographic coordinate system and the iModel's own coordinate system.\r\n * @param datumOrGCRS The name or JSON representation of the geographic coordinate system datum - for example, \"WGS84\".\r\n * @returns a converter, or `undefined` if the iModel is not open.\r\n * @note A [[BlankConnection]] has no connection to a backend, so it is never \"open\"; therefore it always returns `undefined`.\r\n */\r\n public getConverter(datumOrGCRS?: string | GeographicCRSProps): GeoConverter | undefined {\r\n if (this._options.isIModelClosed())\r\n return undefined;\r\n\r\n const datum = (typeof datumOrGCRS === \"object\" ? JSON.stringify(datumOrGCRS) : datumOrGCRS) ?? \"\";\r\n\r\n let converter = this._cache.get(datum);\r\n if (!converter) {\r\n converter = new GeoConverter({ ...this._options, datum });\r\n this._cache.set(datum, converter);\r\n\r\n converter.onAllRequestsCompleted.addOnce(() => {\r\n if (converter === this._cache.get(datum))\r\n this._cache.delete(datum);\r\n });\r\n }\r\n\r\n return converter;\r\n }\r\n}\r\n"]}
|
|
@@ -258,6 +258,7 @@ export declare abstract class IModelConnection extends IModel {
|
|
|
258
258
|
* @param result If defined, use this for output
|
|
259
259
|
* @returns A Cartographic location
|
|
260
260
|
* @throws IModelError if [[isGeoLocated]] is false or point could not be converted.
|
|
261
|
+
* @see [[cartographicFromSpatial]] if you have more than one point to convert, or you don't know whether the iModel has a GCS.
|
|
261
262
|
*/
|
|
262
263
|
spatialToCartographicFromGcs(spatial: XYAndZ, result?: Cartographic): Promise<Cartographic>;
|
|
263
264
|
/** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using the Geographic location services for this IModelConnection or [[IModel.ecefLocation]].
|
|
@@ -265,26 +266,42 @@ export declare abstract class IModelConnection extends IModel {
|
|
|
265
266
|
* @param result If defined, use this for output
|
|
266
267
|
* @returns A Cartographic location
|
|
267
268
|
* @throws IModelError if [[isGeoLocated]] is false or point could not be converted.
|
|
268
|
-
* @see [[
|
|
269
|
-
* @see [[spatialToCartographicFromEcef]]
|
|
269
|
+
* @see [[cartographicFromSpatial]] to convert multiple points at once.
|
|
270
|
+
* @see [[spatialToCartographicFromEcef]] to synchronously convert points using the iModel's ECEF transform.
|
|
270
271
|
*/
|
|
271
272
|
spatialToCartographic(spatial: XYAndZ, result?: Cartographic): Promise<Cartographic>;
|
|
272
|
-
/** Convert
|
|
273
|
+
/** Convert points in this iModel's spatial coordinate system to [Cartographic]($common) coordinates using either a [[GeoConverter]] or the iModel's [EcefLocation]($common).
|
|
274
|
+
* @param spatial Coordiantes to be converted from the iModel's spatial coordinate system
|
|
275
|
+
* @returns The `spatial` coordinates converted to cartographic coordinates, of the same length and order as the `spatial`.
|
|
276
|
+
* @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
|
|
277
|
+
* @see [[spatialFromCartographic]] to perform the inverse conversion.
|
|
278
|
+
* @see [[spatialToCartographicFromEcef]] to synchronously convert points using the iModel's ECEF transform.
|
|
279
|
+
*/
|
|
280
|
+
cartographicFromSpatial(spatial: XYAndZ[]): Promise<Cartographic[]>;
|
|
281
|
+
/** Convert a [Cartographic]($common) to a point in this iModel's spatial coordinate system using a [[GeoConverter]].
|
|
273
282
|
* @param cartographic A cartographic location
|
|
274
283
|
* @param result If defined, use this for output
|
|
275
284
|
* @returns A point in this iModel's spatial coordinates
|
|
276
285
|
* @throws IModelError if [[isGeoLocated]] is false or cartographic location could not be converted.
|
|
286
|
+
* @see [[spatialFromCartographic]] to convert multiple points at once, or you don't know whether the iModel has a GCS.
|
|
277
287
|
*/
|
|
278
288
|
cartographicToSpatialFromGcs(cartographic: Cartographic, result?: Point3d): Promise<Point3d>;
|
|
279
|
-
/** Convert a [
|
|
289
|
+
/** Convert a [Cartographic]($common) to a point in this iModel's Spatial coordinates using a [[GeoConverter]] or[[IModel.ecefLocation]($common).
|
|
280
290
|
* @param cartographic A cartographic location
|
|
281
291
|
* @param result If defined, use this for output
|
|
282
292
|
* @returns A point in this iModel's spatial coordinates
|
|
283
293
|
* @throws IModelError if [[isGeoLocated]] is false or cartographic location could not be converted.
|
|
284
|
-
* @see [[
|
|
285
|
-
* @see [[cartographicToSpatialFromEcef]]
|
|
294
|
+
* @see [[spatialFromCartographic]] to convert multiple points at once.
|
|
295
|
+
* @see [[cartographicToSpatialFromEcef]] to synchronously convert points using the iModel's ECEF transform.
|
|
286
296
|
*/
|
|
287
297
|
cartographicToSpatial(cartographic: Cartographic, result?: Point3d): Promise<Point3d>;
|
|
298
|
+
/** Convert [Cartographic]($common) coordinates into points in this iModel's spatial coordinate system using a [[GeoConverter]] or the iModel's [EcefLocation]($common).
|
|
299
|
+
* @param cartographic Coordinates to be converted to the iModel's spatial coordinate system.
|
|
300
|
+
* @returns The `cartographic` coordinates converted to spatial coordinates, of the same length and order as `cartographic`.
|
|
301
|
+
* @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
|
|
302
|
+
* @see [[cartographicFromSpatial]] to perform the inverse conversion.
|
|
303
|
+
*/
|
|
304
|
+
spatialFromCartographic(cartographic: Cartographic[]): Promise<Point3d[]>;
|
|
288
305
|
/** Expand this iModel's [[displayedExtents]] to include the specified range.
|
|
289
306
|
* This is done automatically when reality models are added to a spatial view. In some cases a [[TiledGraphicsProvider]] may wish to expand
|
|
290
307
|
* the extents explicitly to include its geometry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelConnection.d.ts","sourceRoot":"","sources":["../../src/IModelConnection.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACG,OAAO,EAAE,iBAAiB,EAAoB,UAAU,EAAQ,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsC,mBAAmB,EAC9J,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAA0C,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EACxK,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAkB,+BAA+B,EAAE,gCAAgC,EAC3H,2BAA2B,EAAqB,MAAM,EAAE,qBAAqB,EACtD,sCAAsC,EAAE,uCAAuC,EAAE,0BAA0B,EAAE,2BAA2B,EAC/J,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAkB,SAAS,EAA4B,WAAW,EAAE,YAAY,EACnH,gBAAgB,EAAE,iBAAiB,EAA8B,qBAAqB,EAAE,oBAAoB,EACxH,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAsB,cAAc,EACxH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,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B,8IAA8I;YAC9I,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;SAC1D;KACF;IAED;;;OAGG;IACH,MAAa,UAAU;QACrB,gBAAgB;QAChB,SAAgB,KAAK,EAAE,kBAAkB,CAAC;QAE1C,gBAAgB;oBACG,MAAM,EAAE,gBAAgB;QAI3C,mEAAmE;QACtD,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QAIlH,sHAAsH;QACzG,kBAAkB,CAAC,IAAI,EAAE;YACpC,QAAQ,EAAE,UAAU,CAAC;YACrB,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;SACrC,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;KAGzD;CACF"}
|
|
@@ -133,7 +133,7 @@ class IModelConnection extends IModel {
|
|
|
133
133
|
this.selectionSet = new SelectionSet(this);
|
|
134
134
|
this.hilited = new HiliteSet(this);
|
|
135
135
|
this.tiles = new Tiles(this);
|
|
136
|
-
this.geoServices =
|
|
136
|
+
this.geoServices = GeoServices.createForIModel(this);
|
|
137
137
|
/* eslint-disable-next-line deprecation/deprecation */
|
|
138
138
|
this.displayedExtents = Range3d.fromJSON(this.projectExtents);
|
|
139
139
|
this.onProjectExtentsChanged.addListener(() => {
|
|
@@ -314,6 +314,7 @@ class IModelConnection extends IModel {
|
|
|
314
314
|
* @param result If defined, use this for output
|
|
315
315
|
* @returns A Cartographic location
|
|
316
316
|
* @throws IModelError if [[isGeoLocated]] is false or point could not be converted.
|
|
317
|
+
* @see [[cartographicFromSpatial]] if you have more than one point to convert, or you don't know whether the iModel has a GCS.
|
|
317
318
|
*/
|
|
318
319
|
async spatialToCartographicFromGcs(spatial, result) {
|
|
319
320
|
if (!this.isGeoLocated && this.noGcsDefined)
|
|
@@ -334,17 +335,51 @@ class IModelConnection extends IModel {
|
|
|
334
335
|
* @param result If defined, use this for output
|
|
335
336
|
* @returns A Cartographic location
|
|
336
337
|
* @throws IModelError if [[isGeoLocated]] is false or point could not be converted.
|
|
337
|
-
* @see [[
|
|
338
|
-
* @see [[spatialToCartographicFromEcef]]
|
|
338
|
+
* @see [[cartographicFromSpatial]] to convert multiple points at once.
|
|
339
|
+
* @see [[spatialToCartographicFromEcef]] to synchronously convert points using the iModel's ECEF transform.
|
|
339
340
|
*/
|
|
340
341
|
async spatialToCartographic(spatial, result) {
|
|
341
342
|
return (this.noGcsDefined ? this.spatialToCartographicFromEcef(spatial, result) : this.spatialToCartographicFromGcs(spatial, result));
|
|
342
343
|
}
|
|
343
|
-
/** Convert
|
|
344
|
+
/** Convert points in this iModel's spatial coordinate system to [Cartographic]($common) coordinates using either a [[GeoConverter]] or the iModel's [EcefLocation]($common).
|
|
345
|
+
* @param spatial Coordiantes to be converted from the iModel's spatial coordinate system
|
|
346
|
+
* @returns The `spatial` coordinates converted to cartographic coordinates, of the same length and order as the `spatial`.
|
|
347
|
+
* @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
|
|
348
|
+
* @see [[spatialFromCartographic]] to perform the inverse conversion.
|
|
349
|
+
* @see [[spatialToCartographicFromEcef]] to synchronously convert points using the iModel's ECEF transform.
|
|
350
|
+
*/
|
|
351
|
+
async cartographicFromSpatial(spatial) {
|
|
352
|
+
if (this.noGcsDefined)
|
|
353
|
+
return spatial.map((p) => this.spatialToCartographicFromEcef(p));
|
|
354
|
+
if (!this.isGeoLocated)
|
|
355
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not GeoLocated");
|
|
356
|
+
if (!this.isOpen)
|
|
357
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not open");
|
|
358
|
+
if (spatial.length === 0)
|
|
359
|
+
return [];
|
|
360
|
+
const geoConverter = this.geoServices.getConverter();
|
|
361
|
+
assert(undefined !== geoConverter);
|
|
362
|
+
const coordResponse = await geoConverter.getGeoCoordinatesFromIModelCoordinates(spatial);
|
|
363
|
+
if (coordResponse.geoCoords.length !== spatial.length)
|
|
364
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not GeoLocated");
|
|
365
|
+
return coordResponse.geoCoords.map((coord) => {
|
|
366
|
+
switch (coord.s) {
|
|
367
|
+
case GeoCoordStatus.NoGCSDefined:
|
|
368
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not GeoLocated");
|
|
369
|
+
case GeoCoordStatus.Success:
|
|
370
|
+
const llh = Point3d.fromJSON(coord.p);
|
|
371
|
+
return Cartographic.fromDegrees({ longitude: llh.x, latitude: llh.y, height: llh.z });
|
|
372
|
+
default:
|
|
373
|
+
throw new IModelError(mapToGeoServiceStatus(coord.s), "Error converting spatial to cartographic");
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** Convert a [Cartographic]($common) to a point in this iModel's spatial coordinate system using a [[GeoConverter]].
|
|
344
378
|
* @param cartographic A cartographic location
|
|
345
379
|
* @param result If defined, use this for output
|
|
346
380
|
* @returns A point in this iModel's spatial coordinates
|
|
347
381
|
* @throws IModelError if [[isGeoLocated]] is false or cartographic location could not be converted.
|
|
382
|
+
* @see [[spatialFromCartographic]] to convert multiple points at once, or you don't know whether the iModel has a GCS.
|
|
348
383
|
*/
|
|
349
384
|
async cartographicToSpatialFromGcs(cartographic, result) {
|
|
350
385
|
if (!this.isGeoLocated && this.noGcsDefined)
|
|
@@ -362,17 +397,49 @@ class IModelConnection extends IModel {
|
|
|
362
397
|
result.setFromJSON(coordResponse.iModelCoords[0].p);
|
|
363
398
|
return result;
|
|
364
399
|
}
|
|
365
|
-
/** Convert a [
|
|
400
|
+
/** Convert a [Cartographic]($common) to a point in this iModel's Spatial coordinates using a [[GeoConverter]] or[[IModel.ecefLocation]($common).
|
|
366
401
|
* @param cartographic A cartographic location
|
|
367
402
|
* @param result If defined, use this for output
|
|
368
403
|
* @returns A point in this iModel's spatial coordinates
|
|
369
404
|
* @throws IModelError if [[isGeoLocated]] is false or cartographic location could not be converted.
|
|
370
|
-
* @see [[
|
|
371
|
-
* @see [[cartographicToSpatialFromEcef]]
|
|
405
|
+
* @see [[spatialFromCartographic]] to convert multiple points at once.
|
|
406
|
+
* @see [[cartographicToSpatialFromEcef]] to synchronously convert points using the iModel's ECEF transform.
|
|
372
407
|
*/
|
|
373
408
|
async cartographicToSpatial(cartographic, result) {
|
|
374
409
|
return (this.noGcsDefined ? this.cartographicToSpatialFromEcef(cartographic, result) : this.cartographicToSpatialFromGcs(cartographic, result));
|
|
375
410
|
}
|
|
411
|
+
/** Convert [Cartographic]($common) coordinates into points in this iModel's spatial coordinate system using a [[GeoConverter]] or the iModel's [EcefLocation]($common).
|
|
412
|
+
* @param cartographic Coordinates to be converted to the iModel's spatial coordinate system.
|
|
413
|
+
* @returns The `cartographic` coordinates converted to spatial coordinates, of the same length and order as `cartographic`.
|
|
414
|
+
* @throws IModelError if [[isGeoLocated]] is false or any point could not be converted.
|
|
415
|
+
* @see [[cartographicFromSpatial]] to perform the inverse conversion.
|
|
416
|
+
*/
|
|
417
|
+
async spatialFromCartographic(cartographic) {
|
|
418
|
+
if (this.noGcsDefined)
|
|
419
|
+
return cartographic.map((p) => this.cartographicToSpatialFromEcef(p));
|
|
420
|
+
if (!this.isGeoLocated)
|
|
421
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not GeoLocated");
|
|
422
|
+
if (!this.isOpen)
|
|
423
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not open");
|
|
424
|
+
if (cartographic.length === 0)
|
|
425
|
+
return [];
|
|
426
|
+
const geoConverter = this.geoServices.getConverter();
|
|
427
|
+
assert(undefined !== geoConverter);
|
|
428
|
+
const geoCoords = cartographic.map((p) => Point3d.create(p.longitudeDegrees, p.latitudeDegrees, p.height));
|
|
429
|
+
const coordResponse = await geoConverter.getIModelCoordinatesFromGeoCoordinates(geoCoords);
|
|
430
|
+
if (coordResponse.iModelCoords.length !== cartographic.length)
|
|
431
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not GeoLocated");
|
|
432
|
+
return coordResponse.iModelCoords.map((coord) => {
|
|
433
|
+
switch (coord.s) {
|
|
434
|
+
case GeoCoordStatus.NoGCSDefined:
|
|
435
|
+
throw new IModelError(GeoServiceStatus.NoGeoLocation, "iModel is not GeoLocated");
|
|
436
|
+
case GeoCoordStatus.Success:
|
|
437
|
+
return Point3d.fromJSON(coord.p);
|
|
438
|
+
default:
|
|
439
|
+
throw new IModelError(mapToGeoServiceStatus(coord.s), "Error converting cartographic to spatial");
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
376
443
|
/** Expand this iModel's [[displayedExtents]] to include the specified range.
|
|
377
444
|
* This is done automatically when reality models are added to a spatial view. In some cases a [[TiledGraphicsProvider]] may wish to expand
|
|
378
445
|
* the extents explicitly to include its geometry.
|