@itwin/core-frontend 5.14.0-dev.9 → 5.15.0-dev.2
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 +38 -1
- package/lib/cjs/GeoServices.d.ts +3 -0
- package/lib/cjs/GeoServices.d.ts.map +1 -1
- package/lib/cjs/GeoServices.js +8 -1
- package/lib/cjs/GeoServices.js.map +1 -1
- package/lib/cjs/IModelApp.d.ts +1 -0
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +1 -0
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts.map +1 -1
- package/lib/cjs/IModelConnection.js +7 -2
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/extension/ExtensionAdmin.d.ts +0 -2
- package/lib/cjs/extension/ExtensionAdmin.d.ts.map +1 -1
- package/lib/cjs/extension/ExtensionAdmin.js +44 -22
- package/lib/cjs/extension/ExtensionAdmin.js.map +1 -1
- package/lib/cjs/extension/ExtensionRuntime.js +1 -0
- package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
- package/lib/cjs/extension/providers/RemoteExtensionProvider.d.ts +1 -1
- package/lib/cjs/extension/providers/RemoteExtensionProvider.d.ts.map +1 -1
- package/lib/cjs/extension/providers/RemoteExtensionProvider.js +2 -2
- package/lib/cjs/extension/providers/RemoteExtensionProvider.js.map +1 -1
- package/lib/cjs/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/SceneCompositor.js +16 -19
- package/lib/cjs/internal/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/cjs/internal/render/webgl/Target.d.ts +2 -0
- package/lib/cjs/internal/render/webgl/Target.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/Target.js +1 -0
- package/lib/cjs/internal/render/webgl/Target.js.map +1 -1
- package/lib/cjs/internal/tile/OrbitGtTileTree.d.ts +11 -5
- package/lib/cjs/internal/tile/OrbitGtTileTree.d.ts.map +1 -1
- package/lib/cjs/internal/tile/OrbitGtTileTree.js +37 -13
- package/lib/cjs/internal/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +5 -3
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +7 -2
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +3 -1
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/esm/GeoServices.d.ts +3 -0
- package/lib/esm/GeoServices.d.ts.map +1 -1
- package/lib/esm/GeoServices.js +8 -1
- package/lib/esm/GeoServices.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +1 -0
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +1 -0
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts.map +1 -1
- package/lib/esm/IModelConnection.js +7 -2
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/extension/ExtensionAdmin.d.ts +0 -2
- package/lib/esm/extension/ExtensionAdmin.d.ts.map +1 -1
- package/lib/esm/extension/ExtensionAdmin.js +44 -22
- package/lib/esm/extension/ExtensionAdmin.js.map +1 -1
- package/lib/esm/extension/ExtensionRuntime.js +1 -0
- package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
- package/lib/esm/extension/providers/RemoteExtensionProvider.d.ts +1 -1
- package/lib/esm/extension/providers/RemoteExtensionProvider.d.ts.map +1 -1
- package/lib/esm/extension/providers/RemoteExtensionProvider.js +2 -2
- package/lib/esm/extension/providers/RemoteExtensionProvider.js.map +1 -1
- package/lib/esm/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/SceneCompositor.js +16 -19
- package/lib/esm/internal/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/esm/internal/render/webgl/Target.d.ts +2 -0
- package/lib/esm/internal/render/webgl/Target.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/Target.js +1 -0
- package/lib/esm/internal/render/webgl/Target.js.map +1 -1
- package/lib/esm/internal/tile/OrbitGtTileTree.d.ts +11 -5
- package/lib/esm/internal/tile/OrbitGtTileTree.d.ts.map +1 -1
- package/lib/esm/internal/tile/OrbitGtTileTree.js +36 -12
- package/lib/esm/internal/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +5 -3
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +7 -2
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +3 -1
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
# Change Log - @itwin/core-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 01 Oct 2026 15:17:55 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.13.7
|
|
6
|
+
Thu, 01 Oct 2026 15:15:30 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.13.6
|
|
11
|
+
Fri, 25 Sep 2026 22:27:22 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 5.13.5
|
|
16
|
+
Tue, 22 Sep 2026 22:38:08 GMT
|
|
17
|
+
|
|
18
|
+
### Updates
|
|
19
|
+
|
|
20
|
+
- Fixed GL_INVALID_FRAMEBUFFER_OPERATION that could occur when reading pixels right after a second viewport was closed
|
|
21
|
+
|
|
22
|
+
## 5.13.4
|
|
23
|
+
Fri, 18 Sep 2026 15:11:19 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
26
|
+
|
|
27
|
+
## 5.13.3
|
|
28
|
+
Tue, 15 Sep 2026 20:25:28 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
31
|
+
|
|
32
|
+
## 5.13.2
|
|
33
|
+
Mon, 14 Sep 2026 20:22:20 GMT
|
|
34
|
+
|
|
35
|
+
_Version update only_
|
|
36
|
+
|
|
37
|
+
## 5.13.1
|
|
38
|
+
Tue, 08 Sep 2026 18:43:29 GMT
|
|
39
|
+
|
|
40
|
+
_Version update only_
|
|
4
41
|
|
|
5
42
|
## 5.13.0
|
|
6
43
|
Thu, 03 Sep 2026 18:49:56 GMT
|
package/lib/cjs/GeoServices.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { IModelConnection } from "./IModelConnection";
|
|
|
9
9
|
* @internal exported strictly for tests.
|
|
10
10
|
*/
|
|
11
11
|
export interface CoordinateConverterOptions {
|
|
12
|
+
/** Conversion direction included in error diagnostics. */
|
|
13
|
+
direction: "geoToIModel" | "iModelToGeo";
|
|
12
14
|
isIModelClosed: () => boolean;
|
|
13
15
|
/** Asynchronously convert each point. The resultant array should have the same number and order of points as the input. */
|
|
14
16
|
requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;
|
|
@@ -43,6 +45,7 @@ export declare class CoordinateConverter {
|
|
|
43
45
|
protected readonly _maxPointsPerRequest: number;
|
|
44
46
|
protected readonly _isIModelClosed: () => boolean;
|
|
45
47
|
protected readonly _requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;
|
|
48
|
+
private readonly _direction;
|
|
46
49
|
protected _redispatchOnCompletion: boolean;
|
|
47
50
|
get isIdle(): boolean;
|
|
48
51
|
protected toXYAndZ(input: XYZProps, output: WritableXYAndZ): XYAndZ;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoServices.d.ts","sourceRoot":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W;IAgBpE;;;;OAIG;IACI,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,YAAY,GAAG,SAAS;CAmBzF"}
|
package/lib/cjs/GeoServices.js
CHANGED
|
@@ -45,6 +45,7 @@ class CoordinateConverter {
|
|
|
45
45
|
_maxPointsPerRequest;
|
|
46
46
|
_isIModelClosed;
|
|
47
47
|
_requestPoints;
|
|
48
|
+
_direction;
|
|
48
49
|
// If true, [[dispatch]] will schedule another dispatch after it receives a response.
|
|
49
50
|
// This is needed when all the points requested after the most recent dispatch were included in the currently-in-flight request -
|
|
50
51
|
// _pending will be empty but new callers will be awaiting the results of the in-flight request.
|
|
@@ -69,6 +70,7 @@ class CoordinateConverter {
|
|
|
69
70
|
this._maxPointsPerRequest = Math.max(1, opts.maxPointsPerRequest ?? 300);
|
|
70
71
|
this._isIModelClosed = opts.isIModelClosed;
|
|
71
72
|
this._requestPoints = opts.requestPoints;
|
|
73
|
+
this._direction = opts.direction;
|
|
72
74
|
this._cache = new core_bentley_1.Dictionary(compareXYAndZ, cloneXYAndZ);
|
|
73
75
|
this._pending = new core_bentley_1.SortedArray(compareXYAndZ, false, cloneXYAndZ);
|
|
74
76
|
this._inflight = new core_bentley_1.SortedArray(compareXYAndZ, false, cloneXYAndZ);
|
|
@@ -103,7 +105,10 @@ class CoordinateConverter {
|
|
|
103
105
|
this._cache.set(requests[j], results[j]);
|
|
104
106
|
}
|
|
105
107
|
}).catch((err) => {
|
|
106
|
-
core_bentley_1.Logger.logError(`${FrontendLoggerCategory_1.FrontendLoggerCategory.Package}.geoservices`, err)
|
|
108
|
+
core_bentley_1.Logger.logError(`${FrontendLoggerCategory_1.FrontendLoggerCategory.Package}.geoservices`, err, () => ({
|
|
109
|
+
direction: this._direction,
|
|
110
|
+
pointCount: requests.length,
|
|
111
|
+
}));
|
|
107
112
|
});
|
|
108
113
|
promises.push(promise);
|
|
109
114
|
}
|
|
@@ -200,10 +205,12 @@ class GeoConverter {
|
|
|
200
205
|
constructor(opts) {
|
|
201
206
|
const isIModelClosed = opts.isIModelClosed;
|
|
202
207
|
this._geoToIModel = new CoordinateConverter({
|
|
208
|
+
direction: "geoToIModel",
|
|
203
209
|
isIModelClosed,
|
|
204
210
|
requestPoints: async (geoCoords) => opts.toIModelCoords({ source: opts.datum, geoCoords }),
|
|
205
211
|
});
|
|
206
212
|
this._iModelToGeo = new CoordinateConverter({
|
|
213
|
+
direction: "iModelToGeo",
|
|
207
214
|
isIModelClosed,
|
|
208
215
|
requestPoints: async (iModelCoords) => opts.fromIModelCoords({ target: opts.datum, iModelCoords }),
|
|
209
216
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoServices.js","sourceRoot":"","sources":["../../src/GeoServices.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AACrB,sDAE6B;AAE7B,oDAG4B;AAE5B,4EAAyE;AAazE,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,MAAa,mBAAmB;IACX,MAAM,CAAsC;IACrD,MAAM,GAA6B,MAAM,CAAC;IACpD,qEAAqE;IAC3D,QAAQ,CAAsB;IACxC,iFAAiF;IACvE,SAAS,CAAsB;IACzC,kDAAkD;IACxC,YAAY,GAAG,IAAI,sBAAO,EAAc,CAAC;IACnD,oGAAoG;IACjF,WAAW,GAAG,EAAE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AI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;oBACtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA5DD,kCA4DC","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.logError(`${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"]}
|
|
1
|
+
{"version":3,"file":"GeoServices.js","sourceRoot":"","sources":["../../src/GeoServices.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AACrB,sDAE6B;AAE7B,oDAG4B;AAE5B,4EAAyE;AAezE,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,EAA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AIG;IACI,YAAY,CAAC,WAAyC;QAC3D,IAAI,IAAI,CAAC,QAAQ,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,CAAC;YACf,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;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA5DD,kCA4DC","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 /** Conversion direction included in error diagnostics. */\r\n direction: \"geoToIModel\" | \"iModelToGeo\";\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 private readonly _direction: CoordinateConverterOptions[\"direction\"];\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 this._direction = opts.direction;\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.logError(`${FrontendLoggerCategory.Package}.geoservices`, err, () => ({\r\n direction: this._direction,\r\n pointCount: requests.length,\r\n }));\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 direction: \"geoToIModel\",\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 direction: \"iModelToGeo\",\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"]}
|
package/lib/cjs/IModelApp.d.ts
CHANGED
|
@@ -414,6 +414,7 @@ export declare class IModelApp {
|
|
|
414
414
|
*/
|
|
415
415
|
static makeIModelJsLogoCard(): HTMLTableRowElement;
|
|
416
416
|
/** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].
|
|
417
|
+
* @note Each string is interpreted as HTML. Any untrusted content must be HTML-escaped or sanitized before calling this method.
|
|
417
418
|
* @alpha
|
|
418
419
|
*/
|
|
419
420
|
static formatElementToolTip(msg: string[]): HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelApp.d.ts","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,cAAc;AACd,eAAO,MAAM,oBAAoB,EAA0B,MAAM,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAyD,UAAU,EAAyC,MAAM,qBAAqB,CAAC;AACjL,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAoB,sBAAsB,EAAqC,MAAM,oBAAoB,CAAC;AAEvK,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAA4B,4BAA4B,EAAE,MAAM,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BAAoB;IAQlC;;;OAGG;WACW,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW;IAQ9D;;;;OAIG;WACW,eAAe,CAAC,MAAM,EAAE,MAAM;IAiB5C;;;OAGG;WACW,oBAAoB;IAIlC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAKrC"}
|
package/lib/cjs/IModelApp.js
CHANGED
|
@@ -624,6 +624,7 @@ class IModelApp {
|
|
|
624
624
|
});
|
|
625
625
|
}
|
|
626
626
|
/** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].
|
|
627
|
+
* @note Each string is interpreted as HTML. Any untrusted content must be HTML-escaped or sanitized before calling this method.
|
|
627
628
|
* @alpha
|
|
628
629
|
*/
|
|
629
630
|
static formatElementToolTip(msg) {
|