@itwin/core-frontend 3.6.0 → 3.6.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 CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log - @itwin/core-frontend
2
2
 
3
- This log was last generated on Wed, 08 Feb 2023 14:58:40 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 17 Mar 2023 17:52:32 GMT and should not be manually modified.
4
+
5
+ ## 3.6.2
6
+ Fri, 17 Mar 2023 17:52:32 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.6.1
11
+ Fri, 24 Feb 2023 22:00:48 GMT
12
+
13
+ _Version update only_
4
14
 
5
15
  ## 3.6.0
6
16
  Wed, 08 Feb 2023 14:58:40 GMT
@@ -25,6 +35,13 @@ Wed, 08 Feb 2023 14:58:40 GMT
25
35
  - Make the contents of a Viewport react more smoothly when the containing div is resized."
26
36
  - React to RPC deprecations.
27
37
 
38
+ ## 3.5.6
39
+ Fri, 24 Feb 2023 16:02:47 GMT
40
+
41
+ ### Updates
42
+
43
+ - Batch coordinate reprojection requests to prevent frequent small requests.
44
+
28
45
  ## 3.5.5
29
46
  Thu, 26 Jan 2023 22:53:27 GMT
30
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"ElementLocateManager.d.ts","sourceRoot":"","sources":["../../src/ElementLocateManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAW,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAmB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtD;;;GAGG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,UAAU,IAAI;CACf;AAED;;;;GAIG;AACH,oBAAY,kBA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EAAE,WAAW,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAYlM"}
1
+ {"version":3,"file":"ElementLocateManager.d.ts","sourceRoot":"","sources":["../../src/ElementLocateManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAW,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAmB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtD;;;GAGG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,UAAU,IAAI;CACf;AAED;;;;GAIG;AACH,oBAAY,kBAAkB;IAC5B,MAAM,IAAI;IACV,MAAM,IAAI;CACX;AAED;;;GAGG;AACH,oBAAY,UAAU;IACpB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,UAAU,IAAI;IACd,QAAQ,MAAM;IACd,cAAc,MAAM;IACpB,YAAY,MAAM;IAClB,aAAa,MAAM;IACnB,oBAAoB,MAAM;CAC3B;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,yDAAyD;IAClD,gBAAgB,UAAS;IAChC,+DAA+D;IACxD,iBAAiB,UAAS;IACjC,wCAAwC;IACjC,OAAO,SAAM;IACpB,gDAAgD;IACzC,SAAS,YAAuB;IACvC;;;;OAIG;IACI,oBAAoB,UAAS;IACpC;;;OAGG;IACI,8BAA8B,UAAS;IAE9C,yCAAyC;IAClC,KAAK,IAAI,aAAa;IAStB,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAOnC,IAAI;CAKZ;AAED;;;GAGG;AACH,qBAAa,cAAc;IAClB,UAAU,aAAsB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,SAAM;IAExB,gBAAgB;IACT,KAAK,IAAI,cAAc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C,KAAK,IAAI,IAAI;IACb,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC;IACpC,UAAU,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI;IACjC,UAAU,IAAI,SAAS,GAAG,SAAS;IAE1C,0FAA0F;IACnF,gBAAgB,IAAI,SAAS,GAAG,SAAS;IAiBnC,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAqCxG,iBAAiB;IACjB,cAAc;YAOP,SAAS;IAiCV,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAYlM"}
@@ -200,6 +200,8 @@ class ElementPicker {
200
200
  const testPointView = new core_geometry_1.Point2d(Math.floor(pickPointView.x + 0.5), Math.floor(pickPointView.y + 0.5));
201
201
  let pixelRadius = Math.floor(pickRadiusView + 0.5);
202
202
  const rect = new ViewRect_1.ViewRect(testPointView.x - pixelRadius, testPointView.y - pixelRadius, testPointView.x + pixelRadius, testPointView.y + pixelRadius);
203
+ if (rect.isNull)
204
+ return 0;
203
205
  let result = 0;
204
206
  vp.readPixels(rect, Pixel_1.Pixel.Selector.All, (pixels) => {
205
207
  if (undefined === pixels)
@@ -1 +1 @@
1
- {"version":3,"file":"ElementLocateManager.js","sourceRoot":"","sources":["../../src/ElementLocateManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2C;AAC3C,wDAAwD;AACxD,2CAAyE;AACzE,2CAAwC;AACxC,0CAAuC;AACvC,uCAA4D;AAE5D,yCAAsC;AAEtC;;;GAGG;AACH,IAAY,YAGX;AAHD,WAAY,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AAO,CAAC,CAAC;SAC1B;QAED,IAAI,MAA6B,CAAC;QAClC,OAAO,SAAS,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE;YACjD,IAAI,CAAC,UAAU,IAAI,kBAAkB,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAC5G,OAAO,MAAM,CAAC;YAChB,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC,CAAC,8CAA8C;SAChF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,QAAwB,EAAE,SAAkB,EAAE,SAAkB,EAAE,IAAgC,EAAE,MAAmB,EAAE,UAAU,GAAG,IAAI;QAC9J,QAAQ,CAAC,MAAM,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QAC1E,QAAQ,CAAC,WAAW,GAAG,EAAE,CAAC;QAE1B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAC3F,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAErB,8FAA8F;QAC9F,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO;YACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA7HD,oDA6HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module LocatingElements\n */\n\nimport { Id64 } from \"@itwin/core-bentley\";\nimport { Point2d, Point3d } from \"@itwin/core-geometry\";\nimport { HitDetail, HitList, HitPriority, HitSource } from \"./HitDetail\";\nimport { IModelApp } from \"./IModelApp\";\nimport { Pixel } from \"./render/Pixel\";\nimport { InputSource, InteractiveTool } from \"./tools/Tool\";\nimport { ScreenViewport, Viewport } from \"./Viewport\";\nimport { ViewRect } from \"./ViewRect\";\n\n/** The possible actions for which a locate filter can be called.\n * @public\n * @extensions\n */\nexport enum LocateAction {\n Identify = 0,\n AutoLocate = 1,\n}\n\n/** Values to return from a locate filter.\n * Return `Reject` to indicate the element is unacceptable.\n * @public\n * @extensions\n */\nexport enum LocateFilterStatus {\n Accept = 0,\n Reject = 1,\n}\n\n/**\n * @public\n * @extensions\n */\nexport enum SnapStatus {\n Success = 0,\n Aborted = 1,\n NoElements = 2,\n Disabled = 100,\n NoSnapPossible = 200,\n NotSnappable = 300,\n FilteredByApp = 600,\n FilteredByAppQuietly = 700,\n}\n\n/** Options that customize the way element location (i.e. *picking*) works.\n * @public\n * @extensions\n */\nexport class LocateOptions {\n /** If true, also test graphics from view decorations. */\n public allowDecorations = false;\n /** If true, also test graphics with non-locatable flag set. */\n public allowNonLocatable = false;\n /** Maximum number of hits to return. */\n public maxHits = 20;\n /** The [[HitSource]] identifying the caller. */\n public hitSource = HitSource.DataPoint;\n /** If true, also test graphics from an IModelConnection other than the one associated with the Viewport. This can occur if, e.g., a\n * [[TiledGraphicsProvider]] is used to display graphics from a different iModel into the [[Viewport]].\n * @note If you override this, you must be prepared to properly handle [[HitDetail]]s originating from other IModelConnections.\n * @see [[HitDetail.iModel]] and [[HitDetail.isExternalIModelHit]]\n */\n public allowExternalIModels = false;\n /** If true, then the world point of a hit on a model will preserve any transforms applied to the model at display time,\n * such as those supplied by a [[ModelDisplayTransformProvider]] or [PlanProjectionSettings.elevation]($common).\n * Otherwise, the world point will be multiplied by the inverse of any such transforms to correlate it with the model's true coordinate space.\n */\n public preserveModelDisplayTransforms = false;\n\n /** Make a copy of this LocateOptions. */\n public clone(): LocateOptions {\n const other = new LocateOptions();\n other.allowDecorations = this.allowDecorations;\n other.allowNonLocatable = this.allowNonLocatable;\n other.maxHits = this.maxHits;\n other.hitSource = this.hitSource;\n other.allowExternalIModels = this.allowExternalIModels;\n return other;\n }\n public setFrom(other: LocateOptions): void {\n this.allowDecorations = other.allowDecorations;\n this.allowNonLocatable = other.allowNonLocatable;\n this.maxHits = other.maxHits;\n this.hitSource = other.hitSource;\n this.allowExternalIModels = other.allowExternalIModels;\n }\n public init() {\n this.allowDecorations = this.allowNonLocatable = this.allowExternalIModels = false;\n this.maxHits = 20;\n this.hitSource = HitSource.DataPoint;\n }\n}\n\n/**\n * @public\n * @extensions\n */\nexport class LocateResponse {\n public snapStatus = SnapStatus.Success;\n public reason?: string;\n public explanation = \"\";\n\n /** @internal */\n public clone(): LocateResponse {\n const other = new LocateResponse();\n other.snapStatus = this.snapStatus;\n other.reason = this.reason;\n other.explanation = this.explanation;\n return other;\n }\n\n /** @internal */\n public setFrom(other: LocateResponse): void {\n this.snapStatus = other.snapStatus;\n this.reason = other.reason;\n this.explanation = other.explanation;\n }\n}\n\n/**\n * @public\n * @extensions\n */\nexport interface HitListHolder {\n setHitList(list: HitList<HitDetail> | undefined): void;\n}\n\n/**\n * @public\n * @extensions\n */\nexport class ElementPicker {\n public viewport?: Viewport;\n public readonly pickPointWorld = new Point3d();\n public hitList?: HitList<HitDetail>;\n\n public empty() {\n this.pickPointWorld.setZero();\n this.viewport = undefined;\n if (this.hitList)\n this.hitList.empty();\n else\n this.hitList = new HitList<HitDetail>();\n }\n\n /** return the HitList for the last Pick performed. Optionally allows the caller to take ownership of the list. */\n public getHitList(takeOwnership: boolean): HitList<HitDetail> {\n const list = this.hitList!;\n if (takeOwnership)\n this.hitList = undefined;\n return list;\n }\n\n public getNextHit(): HitDetail | undefined { return this.hitList ? this.hitList.getNextHit() : undefined; }\n\n /** Return a hit from the list of hits created the last time pickElements was called. */\n public getHit(i: number): HitDetail | undefined { return this.hitList ? this.hitList.getHit(i) : undefined; }\n\n public resetCurrentHit(): void {\n if (this.hitList)\n this.hitList.resetCurrentHit();\n }\n\n private getPixelPriority(pixel: Pixel.Data) {\n switch (pixel.type) {\n case Pixel.GeometryType.Surface:\n return Pixel.Planarity.Planar === pixel.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\n case Pixel.GeometryType.Linear:\n return HitPriority.WireEdge;\n case Pixel.GeometryType.Edge:\n return Pixel.Planarity.Planar === pixel.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\n case Pixel.GeometryType.Silhouette:\n return HitPriority.SilhouetteEdge;\n default:\n return HitPriority.Unknown;\n }\n }\n\n private comparePixel(pixel1: Pixel.Data, pixel2: Pixel.Data, distXY1: number, distXY2: number) {\n const priority1 = this.getPixelPriority(pixel1);\n const priority2 = this.getPixelPriority(pixel2);\n if (priority1 < priority2)\n return -1;\n if (priority1 > priority2)\n return 1;\n if (distXY1 < distXY2)\n return -1;\n if (distXY1 > distXY2)\n return 1;\n if (pixel1.distanceFraction > pixel2.distanceFraction)\n return -1;\n if (pixel1.distanceFraction < pixel2.distanceFraction)\n return 1;\n\n return 0;\n }\n\n /** Generate a list of elements that are close to a given point.\n * @returns The number of hits in the hitList of this object.\n */\n public doPick(vp: ScreenViewport, pickPointWorld: Point3d, pickRadiusView: number, options: LocateOptions): number {\n if (this.hitList && this.hitList.length > 0 && vp === this.viewport && pickPointWorld.isAlmostEqual(this.pickPointWorld)) {\n this.hitList.resetCurrentHit();\n return this.hitList.length;\n }\n\n this.empty(); // empty the hit list\n this.viewport = vp;\n this.pickPointWorld.setFrom(pickPointWorld);\n\n const pickPointView = vp.worldToView(pickPointWorld);\n const testPointView = new Point2d(Math.floor(pickPointView.x + 0.5), Math.floor(pickPointView.y + 0.5));\n let pixelRadius = Math.floor(pickRadiusView + 0.5);\n const rect = new ViewRect(testPointView.x - pixelRadius, testPointView.y - pixelRadius, testPointView.x + pixelRadius, testPointView.y + pixelRadius);\n let result: number = 0;\n vp.readPixels(rect, Pixel.Selector.All, (pixels) => {\n if (undefined === pixels)\n return;\n\n testPointView.x = vp.cssPixelsToDevicePixels(testPointView.x);\n testPointView.y = vp.cssPixelsToDevicePixels(testPointView.y);\n pixelRadius = vp.cssPixelsToDevicePixels(pixelRadius);\n\n const elmHits = new Map<string, Point2d>();\n const testPoint = Point2d.createZero();\n for (testPoint.x = testPointView.x - pixelRadius; testPoint.x <= testPointView.x + pixelRadius; ++testPoint.x) {\n for (testPoint.y = testPointView.y - pixelRadius; testPoint.y <= testPointView.y + pixelRadius; ++testPoint.y) {\n const pixel = pixels.getPixel(testPoint.x, testPoint.y);\n if (undefined === pixel || undefined === pixel.elementId || Id64.isInvalid(pixel.elementId))\n continue; // no geometry at this location...\n\n const distXY = testPointView.distance(testPoint);\n if (distXY > pixelRadius)\n continue; // ignore corners. it's a locate circle not square...\n\n const oldPoint = elmHits.get(pixel.elementId);\n if (undefined !== oldPoint) {\n if (this.comparePixel(pixel, pixels.getPixel(oldPoint.x, oldPoint.y), distXY, testPointView.distance(oldPoint)) < 0)\n oldPoint.setFrom(testPoint); // new hit is better, update location...\n } else {\n elmHits.set(pixel.elementId, testPoint.clone());\n }\n }\n }\n if (0 === elmHits.size)\n return;\n\n for (const elmPoint of elmHits.values()) {\n const pixel = pixels.getPixel(elmPoint.x, elmPoint.y);\n if (undefined === pixel || undefined === pixel.elementId)\n continue;\n\n const hitPointWorld = vp.getPixelDataWorldPoint({\n pixels,\n x: elmPoint.x,\n y: elmPoint.y,\n preserveModelDisplayTransforms: options.preserveModelDisplayTransforms,\n });\n\n if (!hitPointWorld)\n continue;\n\n const modelId = undefined !== pixel.featureTable ? pixel.featureTable.modelId : undefined;\n const hit = new HitDetail(pickPointWorld, vp, options.hitSource, hitPointWorld, pixel.elementId, this.getPixelPriority(pixel), testPointView.distance(elmPoint), pixel.distanceFraction, pixel.subCategoryId, pixel.geometryClass, modelId, pixel.iModel, pixel.tileId, pixel.isClassifier);\n this.hitList!.addHit(hit);\n\n if (this.hitList!.hits.length > options.maxHits)\n this.hitList!.hits.length = options.maxHits; // truncate array...\n }\n\n result = this.hitList!.length;\n }, !options.allowNonLocatable);\n\n return result;\n }\n\n public testHit(hit: HitDetail, vp: ScreenViewport, pickPointWorld: Point3d, pickRadiusView: number, options: LocateOptions): boolean {\n if (0 === this.doPick(vp, pickPointWorld, pickRadiusView, options))\n return false;\n\n return this.hitList!.hits.some((thisHit) => hit.isSameHit(thisHit));\n }\n}\n\n/**\n * @public\n * @extensions\n */\nexport class ElementLocateManager {\n public hitList?: HitList<HitDetail>;\n public currHit?: HitDetail;\n public readonly options = new LocateOptions();\n public readonly picker = new ElementPicker();\n\n /** get the full message key for a locate failure */\n public static getFailureMessageKey(key: string) { return `LocateFailure.${key}`; }\n public onInitialized() { }\n public get apertureInches() { return 0.11; }\n public get touchApertureInches() { return 0.22; }\n\n public clear(): void { this.setCurrHit(undefined); }\n public setHitList(list?: HitList<HitDetail>) { this.hitList = list; }\n public setCurrHit(hit?: HitDetail): void { this.currHit = hit; }\n public getNextHit(): HitDetail | undefined { return this.hitList ? this.hitList.getNextHit() : undefined; }\n\n /** return the current path from either the snapping logic or the pre-locating systems. */\n public getPreLocatedHit(): HitDetail | undefined {\n // NOTE: Check AccuSnap first as Tentative is used to build intersect snap. For normal snaps when a Tentative is active there should be no AccuSnap.\n let preLocated = IModelApp.accuSnap.getHitAndList(this);\n\n if (!preLocated && !!(preLocated = IModelApp.tentativePoint.getHitAndList(this))) {\n const vp = preLocated.viewport;\n this.picker.empty(); // Get new hit list at hit point; want reset to cycle hits using adjusted point location...\n this.picker.doPick(vp, preLocated.getPoint(), (vp.pixelsFromInches(this.apertureInches) / 2.0) + 1.5, this.options);\n this.setHitList(this.picker.getHitList(true));\n }\n\n if (this.hitList)\n this.hitList.resetCurrentHit();\n\n return preLocated;\n }\n\n public async filterHit(hit: HitDetail, _action: LocateAction, out: LocateResponse): Promise<LocateFilterStatus> {\n // Tools must opt-in to locate of transient geometry as it requires special treatment.\n if (!this.options.allowDecorations && !hit.isElementHit) {\n if (hit.isModelHit)\n out.reason = ElementLocateManager.getFailureMessageKey(\"RealityModel\");\n else if (hit.isMapHit)\n out.reason = ElementLocateManager.getFailureMessageKey(\"Map\");\n else\n out.reason = ElementLocateManager.getFailureMessageKey(\"Transient\");\n return LocateFilterStatus.Reject;\n }\n\n // Tools must opt-in to locate geometry from external iModels.\n if (!this.options.allowExternalIModels && hit.isExternalIModelHit) {\n out.reason = ElementLocateManager.getFailureMessageKey(\"ExternalIModel\");\n return LocateFilterStatus.Reject;\n }\n\n if (undefined !== hit.subCategoryId && !hit.isExternalIModelHit) {\n const appearance = hit.viewport.getSubCategoryAppearance(hit.subCategoryId);\n if (appearance.dontLocate) {\n out.reason = ElementLocateManager.getFailureMessageKey(\"NotLocatableSubCategory\");\n return LocateFilterStatus.Reject;\n }\n }\n\n const tool = IModelApp.toolAdmin.activeTool;\n if (!(tool && tool instanceof InteractiveTool))\n return LocateFilterStatus.Accept;\n\n const status = await tool.filterHit(hit, out);\n if (LocateFilterStatus.Reject === status)\n out.reason = ElementLocateManager.getFailureMessageKey(\"ByApp\");\n\n return status;\n }\n\n public initLocateOptions() { this.options.init(); }\n public initToolLocate() {\n this.initLocateOptions();\n this.clear();\n this.picker.empty();\n IModelApp.tentativePoint.clear(true);\n }\n\n private async _doLocate(response: LocateResponse, newSearch: boolean, testPoint: Point3d, vp: ScreenViewport | undefined, source: InputSource, filterHits: boolean): Promise<HitDetail | undefined> {\n if (!vp)\n return;\n\n // the \"newSearch\" flag indicates whether the caller wants us to conduct a new search at the testPoint, or just continue returning paths from the previous search.\n if (newSearch) {\n const hit = this.getPreLocatedHit();\n\n // if we're snapped to something, that path has the highest priority and becomes the active hit.\n if (hit) {\n if (!filterHits || LocateFilterStatus.Accept === await this.filterHit(hit, LocateAction.Identify, response))\n return hit;\n\n response = new LocateResponse(); // we have the reason and explanation we want.\n }\n\n this.picker.empty();\n this.picker.doPick(vp, testPoint, (vp.pixelsFromInches(InputSource.Touch === source ? this.touchApertureInches : this.apertureInches) / 2.0) + 1.5, this.options);\n\n const hitList = this.picker.getHitList(true);\n this.setHitList(hitList);\n }\n\n let newHit: HitDetail | undefined;\n while (undefined !== (newHit = this.getNextHit())) {\n if (!filterHits || LocateFilterStatus.Accept === await this.filterHit(newHit, LocateAction.Identify, response))\n return newHit;\n response = new LocateResponse(); // we have the reason and explanation we want.\n }\n\n return undefined;\n }\n\n public async doLocate(response: LocateResponse, newSearch: boolean, testPoint: Point3d, view: ScreenViewport | undefined, source: InputSource, filterHits = true): Promise<HitDetail | undefined> {\n response.reason = ElementLocateManager.getFailureMessageKey(\"NoElements\");\n response.explanation = \"\";\n\n const hit = await this._doLocate(response, newSearch, testPoint, view, source, filterHits);\n this.setCurrHit(hit);\n\n // if we found a hit, remove it from the list of remaining hits near the current search point.\n if (hit && this.hitList)\n this.hitList.removeHitsFrom(hit.sourceId);\n return hit;\n }\n}\n"]}
1
+ {"version":3,"file":"ElementLocateManager.js","sourceRoot":"","sources":["../../src/ElementLocateManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2C;AAC3C,wDAAwD;AACxD,2CAAyE;AACzE,2CAAwC;AACxC,0CAAuC;AACvC,uCAA4D;AAE5D,yCAAsC;AAEtC;;;GAGG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,2DAAc,CAAA;AAChB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED;;;;GAIG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+DAAU,CAAA;IACV,+DAAU,CAAA;AACZ,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B;AAED;;;GAGG;AACH,IAAY,UASX;AATD,WAAY,UAAU;IACpB,iDAAW,CAAA;IACX,iDAAW,CAAA;IACX,uDAAc,CAAA;IACd,qDAAc,CAAA;IACd,iEAAoB,CAA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;SAChF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,QAAwB,EAAE,SAAkB,EAAE,SAAkB,EAAE,IAAgC,EAAE,MAAmB,EAAE,UAAU,GAAG,IAAI;QAC9J,QAAQ,CAAC,MAAM,GAAG,oBAAoB,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QAC1E,QAAQ,CAAC,WAAW,GAAG,EAAE,CAAC;QAE1B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAC3F,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAErB,8FAA8F;QAC9F,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO;YACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA7HD,oDA6HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module LocatingElements\n */\n\nimport { Id64 } from \"@itwin/core-bentley\";\nimport { Point2d, Point3d } from \"@itwin/core-geometry\";\nimport { HitDetail, HitList, HitPriority, HitSource } from \"./HitDetail\";\nimport { IModelApp } from \"./IModelApp\";\nimport { Pixel } from \"./render/Pixel\";\nimport { InputSource, InteractiveTool } from \"./tools/Tool\";\nimport { ScreenViewport, Viewport } from \"./Viewport\";\nimport { ViewRect } from \"./ViewRect\";\n\n/** The possible actions for which a locate filter can be called.\n * @public\n * @extensions\n */\nexport enum LocateAction {\n Identify = 0,\n AutoLocate = 1,\n}\n\n/** Values to return from a locate filter.\n * Return `Reject` to indicate the element is unacceptable.\n * @public\n * @extensions\n */\nexport enum LocateFilterStatus {\n Accept = 0,\n Reject = 1,\n}\n\n/**\n * @public\n * @extensions\n */\nexport enum SnapStatus {\n Success = 0,\n Aborted = 1,\n NoElements = 2,\n Disabled = 100,\n NoSnapPossible = 200,\n NotSnappable = 300,\n FilteredByApp = 600,\n FilteredByAppQuietly = 700,\n}\n\n/** Options that customize the way element location (i.e. *picking*) works.\n * @public\n * @extensions\n */\nexport class LocateOptions {\n /** If true, also test graphics from view decorations. */\n public allowDecorations = false;\n /** If true, also test graphics with non-locatable flag set. */\n public allowNonLocatable = false;\n /** Maximum number of hits to return. */\n public maxHits = 20;\n /** The [[HitSource]] identifying the caller. */\n public hitSource = HitSource.DataPoint;\n /** If true, also test graphics from an IModelConnection other than the one associated with the Viewport. This can occur if, e.g., a\n * [[TiledGraphicsProvider]] is used to display graphics from a different iModel into the [[Viewport]].\n * @note If you override this, you must be prepared to properly handle [[HitDetail]]s originating from other IModelConnections.\n * @see [[HitDetail.iModel]] and [[HitDetail.isExternalIModelHit]]\n */\n public allowExternalIModels = false;\n /** If true, then the world point of a hit on a model will preserve any transforms applied to the model at display time,\n * such as those supplied by a [[ModelDisplayTransformProvider]] or [PlanProjectionSettings.elevation]($common).\n * Otherwise, the world point will be multiplied by the inverse of any such transforms to correlate it with the model's true coordinate space.\n */\n public preserveModelDisplayTransforms = false;\n\n /** Make a copy of this LocateOptions. */\n public clone(): LocateOptions {\n const other = new LocateOptions();\n other.allowDecorations = this.allowDecorations;\n other.allowNonLocatable = this.allowNonLocatable;\n other.maxHits = this.maxHits;\n other.hitSource = this.hitSource;\n other.allowExternalIModels = this.allowExternalIModels;\n return other;\n }\n public setFrom(other: LocateOptions): void {\n this.allowDecorations = other.allowDecorations;\n this.allowNonLocatable = other.allowNonLocatable;\n this.maxHits = other.maxHits;\n this.hitSource = other.hitSource;\n this.allowExternalIModels = other.allowExternalIModels;\n }\n public init() {\n this.allowDecorations = this.allowNonLocatable = this.allowExternalIModels = false;\n this.maxHits = 20;\n this.hitSource = HitSource.DataPoint;\n }\n}\n\n/**\n * @public\n * @extensions\n */\nexport class LocateResponse {\n public snapStatus = SnapStatus.Success;\n public reason?: string;\n public explanation = \"\";\n\n /** @internal */\n public clone(): LocateResponse {\n const other = new LocateResponse();\n other.snapStatus = this.snapStatus;\n other.reason = this.reason;\n other.explanation = this.explanation;\n return other;\n }\n\n /** @internal */\n public setFrom(other: LocateResponse): void {\n this.snapStatus = other.snapStatus;\n this.reason = other.reason;\n this.explanation = other.explanation;\n }\n}\n\n/**\n * @public\n * @extensions\n */\nexport interface HitListHolder {\n setHitList(list: HitList<HitDetail> | undefined): void;\n}\n\n/**\n * @public\n * @extensions\n */\nexport class ElementPicker {\n public viewport?: Viewport;\n public readonly pickPointWorld = new Point3d();\n public hitList?: HitList<HitDetail>;\n\n public empty() {\n this.pickPointWorld.setZero();\n this.viewport = undefined;\n if (this.hitList)\n this.hitList.empty();\n else\n this.hitList = new HitList<HitDetail>();\n }\n\n /** return the HitList for the last Pick performed. Optionally allows the caller to take ownership of the list. */\n public getHitList(takeOwnership: boolean): HitList<HitDetail> {\n const list = this.hitList!;\n if (takeOwnership)\n this.hitList = undefined;\n return list;\n }\n\n public getNextHit(): HitDetail | undefined { return this.hitList ? this.hitList.getNextHit() : undefined; }\n\n /** Return a hit from the list of hits created the last time pickElements was called. */\n public getHit(i: number): HitDetail | undefined { return this.hitList ? this.hitList.getHit(i) : undefined; }\n\n public resetCurrentHit(): void {\n if (this.hitList)\n this.hitList.resetCurrentHit();\n }\n\n private getPixelPriority(pixel: Pixel.Data) {\n switch (pixel.type) {\n case Pixel.GeometryType.Surface:\n return Pixel.Planarity.Planar === pixel.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\n case Pixel.GeometryType.Linear:\n return HitPriority.WireEdge;\n case Pixel.GeometryType.Edge:\n return Pixel.Planarity.Planar === pixel.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\n case Pixel.GeometryType.Silhouette:\n return HitPriority.SilhouetteEdge;\n default:\n return HitPriority.Unknown;\n }\n }\n\n private comparePixel(pixel1: Pixel.Data, pixel2: Pixel.Data, distXY1: number, distXY2: number) {\n const priority1 = this.getPixelPriority(pixel1);\n const priority2 = this.getPixelPriority(pixel2);\n if (priority1 < priority2)\n return -1;\n if (priority1 > priority2)\n return 1;\n if (distXY1 < distXY2)\n return -1;\n if (distXY1 > distXY2)\n return 1;\n if (pixel1.distanceFraction > pixel2.distanceFraction)\n return -1;\n if (pixel1.distanceFraction < pixel2.distanceFraction)\n return 1;\n\n return 0;\n }\n\n /** Generate a list of elements that are close to a given point.\n * @returns The number of hits in the hitList of this object.\n */\n public doPick(vp: ScreenViewport, pickPointWorld: Point3d, pickRadiusView: number, options: LocateOptions): number {\n if (this.hitList && this.hitList.length > 0 && vp === this.viewport && pickPointWorld.isAlmostEqual(this.pickPointWorld)) {\n this.hitList.resetCurrentHit();\n return this.hitList.length;\n }\n\n this.empty(); // empty the hit list\n this.viewport = vp;\n this.pickPointWorld.setFrom(pickPointWorld);\n\n const pickPointView = vp.worldToView(pickPointWorld);\n const testPointView = new Point2d(Math.floor(pickPointView.x + 0.5), Math.floor(pickPointView.y + 0.5));\n let pixelRadius = Math.floor(pickRadiusView + 0.5);\n const rect = new ViewRect(testPointView.x - pixelRadius, testPointView.y - pixelRadius, testPointView.x + pixelRadius, testPointView.y + pixelRadius);\n if (rect.isNull)\n return 0;\n let result: number = 0;\n vp.readPixels(rect, Pixel.Selector.All, (pixels) => {\n if (undefined === pixels)\n return;\n\n testPointView.x = vp.cssPixelsToDevicePixels(testPointView.x);\n testPointView.y = vp.cssPixelsToDevicePixels(testPointView.y);\n pixelRadius = vp.cssPixelsToDevicePixels(pixelRadius);\n\n const elmHits = new Map<string, Point2d>();\n const testPoint = Point2d.createZero();\n for (testPoint.x = testPointView.x - pixelRadius; testPoint.x <= testPointView.x + pixelRadius; ++testPoint.x) {\n for (testPoint.y = testPointView.y - pixelRadius; testPoint.y <= testPointView.y + pixelRadius; ++testPoint.y) {\n const pixel = pixels.getPixel(testPoint.x, testPoint.y);\n if (undefined === pixel || undefined === pixel.elementId || Id64.isInvalid(pixel.elementId))\n continue; // no geometry at this location...\n\n const distXY = testPointView.distance(testPoint);\n if (distXY > pixelRadius)\n continue; // ignore corners. it's a locate circle not square...\n\n const oldPoint = elmHits.get(pixel.elementId);\n if (undefined !== oldPoint) {\n if (this.comparePixel(pixel, pixels.getPixel(oldPoint.x, oldPoint.y), distXY, testPointView.distance(oldPoint)) < 0)\n oldPoint.setFrom(testPoint); // new hit is better, update location...\n } else {\n elmHits.set(pixel.elementId, testPoint.clone());\n }\n }\n }\n if (0 === elmHits.size)\n return;\n\n for (const elmPoint of elmHits.values()) {\n const pixel = pixels.getPixel(elmPoint.x, elmPoint.y);\n if (undefined === pixel || undefined === pixel.elementId)\n continue;\n\n const hitPointWorld = vp.getPixelDataWorldPoint({\n pixels,\n x: elmPoint.x,\n y: elmPoint.y,\n preserveModelDisplayTransforms: options.preserveModelDisplayTransforms,\n });\n\n if (!hitPointWorld)\n continue;\n\n const modelId = undefined !== pixel.featureTable ? pixel.featureTable.modelId : undefined;\n const hit = new HitDetail(pickPointWorld, vp, options.hitSource, hitPointWorld, pixel.elementId, this.getPixelPriority(pixel), testPointView.distance(elmPoint), pixel.distanceFraction, pixel.subCategoryId, pixel.geometryClass, modelId, pixel.iModel, pixel.tileId, pixel.isClassifier);\n this.hitList!.addHit(hit);\n\n if (this.hitList!.hits.length > options.maxHits)\n this.hitList!.hits.length = options.maxHits; // truncate array...\n }\n\n result = this.hitList!.length;\n }, !options.allowNonLocatable);\n\n return result;\n }\n\n public testHit(hit: HitDetail, vp: ScreenViewport, pickPointWorld: Point3d, pickRadiusView: number, options: LocateOptions): boolean {\n if (0 === this.doPick(vp, pickPointWorld, pickRadiusView, options))\n return false;\n\n return this.hitList!.hits.some((thisHit) => hit.isSameHit(thisHit));\n }\n}\n\n/**\n * @public\n * @extensions\n */\nexport class ElementLocateManager {\n public hitList?: HitList<HitDetail>;\n public currHit?: HitDetail;\n public readonly options = new LocateOptions();\n public readonly picker = new ElementPicker();\n\n /** get the full message key for a locate failure */\n public static getFailureMessageKey(key: string) { return `LocateFailure.${key}`; }\n public onInitialized() { }\n public get apertureInches() { return 0.11; }\n public get touchApertureInches() { return 0.22; }\n\n public clear(): void { this.setCurrHit(undefined); }\n public setHitList(list?: HitList<HitDetail>) { this.hitList = list; }\n public setCurrHit(hit?: HitDetail): void { this.currHit = hit; }\n public getNextHit(): HitDetail | undefined { return this.hitList ? this.hitList.getNextHit() : undefined; }\n\n /** return the current path from either the snapping logic or the pre-locating systems. */\n public getPreLocatedHit(): HitDetail | undefined {\n // NOTE: Check AccuSnap first as Tentative is used to build intersect snap. For normal snaps when a Tentative is active there should be no AccuSnap.\n let preLocated = IModelApp.accuSnap.getHitAndList(this);\n\n if (!preLocated && !!(preLocated = IModelApp.tentativePoint.getHitAndList(this))) {\n const vp = preLocated.viewport;\n this.picker.empty(); // Get new hit list at hit point; want reset to cycle hits using adjusted point location...\n this.picker.doPick(vp, preLocated.getPoint(), (vp.pixelsFromInches(this.apertureInches) / 2.0) + 1.5, this.options);\n this.setHitList(this.picker.getHitList(true));\n }\n\n if (this.hitList)\n this.hitList.resetCurrentHit();\n\n return preLocated;\n }\n\n public async filterHit(hit: HitDetail, _action: LocateAction, out: LocateResponse): Promise<LocateFilterStatus> {\n // Tools must opt-in to locate of transient geometry as it requires special treatment.\n if (!this.options.allowDecorations && !hit.isElementHit) {\n if (hit.isModelHit)\n out.reason = ElementLocateManager.getFailureMessageKey(\"RealityModel\");\n else if (hit.isMapHit)\n out.reason = ElementLocateManager.getFailureMessageKey(\"Map\");\n else\n out.reason = ElementLocateManager.getFailureMessageKey(\"Transient\");\n return LocateFilterStatus.Reject;\n }\n\n // Tools must opt-in to locate geometry from external iModels.\n if (!this.options.allowExternalIModels && hit.isExternalIModelHit) {\n out.reason = ElementLocateManager.getFailureMessageKey(\"ExternalIModel\");\n return LocateFilterStatus.Reject;\n }\n\n if (undefined !== hit.subCategoryId && !hit.isExternalIModelHit) {\n const appearance = hit.viewport.getSubCategoryAppearance(hit.subCategoryId);\n if (appearance.dontLocate) {\n out.reason = ElementLocateManager.getFailureMessageKey(\"NotLocatableSubCategory\");\n return LocateFilterStatus.Reject;\n }\n }\n\n const tool = IModelApp.toolAdmin.activeTool;\n if (!(tool && tool instanceof InteractiveTool))\n return LocateFilterStatus.Accept;\n\n const status = await tool.filterHit(hit, out);\n if (LocateFilterStatus.Reject === status)\n out.reason = ElementLocateManager.getFailureMessageKey(\"ByApp\");\n\n return status;\n }\n\n public initLocateOptions() { this.options.init(); }\n public initToolLocate() {\n this.initLocateOptions();\n this.clear();\n this.picker.empty();\n IModelApp.tentativePoint.clear(true);\n }\n\n private async _doLocate(response: LocateResponse, newSearch: boolean, testPoint: Point3d, vp: ScreenViewport | undefined, source: InputSource, filterHits: boolean): Promise<HitDetail | undefined> {\n if (!vp)\n return;\n\n // the \"newSearch\" flag indicates whether the caller wants us to conduct a new search at the testPoint, or just continue returning paths from the previous search.\n if (newSearch) {\n const hit = this.getPreLocatedHit();\n\n // if we're snapped to something, that path has the highest priority and becomes the active hit.\n if (hit) {\n if (!filterHits || LocateFilterStatus.Accept === await this.filterHit(hit, LocateAction.Identify, response))\n return hit;\n\n response = new LocateResponse(); // we have the reason and explanation we want.\n }\n\n this.picker.empty();\n this.picker.doPick(vp, testPoint, (vp.pixelsFromInches(InputSource.Touch === source ? this.touchApertureInches : this.apertureInches) / 2.0) + 1.5, this.options);\n\n const hitList = this.picker.getHitList(true);\n this.setHitList(hitList);\n }\n\n let newHit: HitDetail | undefined;\n while (undefined !== (newHit = this.getNextHit())) {\n if (!filterHits || LocateFilterStatus.Accept === await this.filterHit(newHit, LocateAction.Identify, response))\n return newHit;\n response = new LocateResponse(); // we have the reason and explanation we want.\n }\n\n return undefined;\n }\n\n public async doLocate(response: LocateResponse, newSearch: boolean, testPoint: Point3d, view: ScreenViewport | undefined, source: InputSource, filterHits = true): Promise<HitDetail | undefined> {\n response.reason = ElementLocateManager.getFailureMessageKey(\"NoElements\");\n response.explanation = \"\";\n\n const hit = await this._doLocate(response, newSearch, testPoint, view, source, filterHits);\n this.setCurrHit(hit);\n\n // if we found a hit, remove it from the list of remaining hits near the current search point.\n if (hit && this.hitList)\n this.hitList.removeHitsFrom(hit.sourceId);\n return hit;\n }\n}\n"]}
@@ -1,6 +1,58 @@
1
- import { XYZProps } from "@itwin/core-geometry";
1
+ import { BeEvent, Dictionary, SortedArray } from "@itwin/core-bentley";
2
+ import { WritableXYAndZ, XYAndZ, XYZProps } from "@itwin/core-geometry";
2
3
  import { GeoCoordinatesResponseProps, GeographicCRSProps, IModelCoordinatesResponseProps, PointWithStatus } from "@itwin/core-common";
3
4
  import { IModelConnection } from "./IModelConnection";
5
+ /** Options used to create a [[CoordinateConverter]].
6
+ * @internal exported strictly for tests.
7
+ */
8
+ export interface CoordinateConverterOptions {
9
+ /** The iModel for which to perform the conversions. */
10
+ iModel: IModelConnection;
11
+ /** Asynchronously convert each point. The resultant array should have the same number and order of points as the input. */
12
+ requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;
13
+ /** Maximum number of points to include in each request. Default: 300. */
14
+ maxPointsPerRequest?: number;
15
+ }
16
+ declare type CoordinateConverterState = "idle" | "scheduled" | "in-flight";
17
+ /** Performs conversion of coordinates from one coordinate system to another.
18
+ * A [[GeoConverter]] has a pair of these for converting between iModel coordinates and geographic coordinates.
19
+ * Uses a cache to avoid repeatedly requesting the same points, and a batching strategy to avoid making frequent small requests.
20
+ * The cache stores every point that was ever converted by [[convert]]. It is currently permitted to grow to unbounded size.
21
+ * The batching works as follows:
22
+ * When a conversion is requested via [[convert]], if all the requested points are in the cache, they are returned immediately.
23
+ * 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.
24
+ * A pending request is scheduled if one hasn't already been scheduled, via requestAnimationFrame.
25
+ * In the animation frame callback, the pending requests are split into batches of no more than options.maxPointsPerRequest and dispatched to the backend.
26
+ * Once the response is received, the results are loaded into and returned from the cache.
27
+ * If more calls to convert occurred while the request was in flight, another request is dispatched.
28
+ * @internal exported strictly for tests.
29
+ */
30
+ export declare class CoordinateConverter {
31
+ protected readonly _cache: Dictionary<XYAndZ, PointWithStatus>;
32
+ protected _state: CoordinateConverterState;
33
+ protected _pending: SortedArray<XYAndZ>;
34
+ protected _inflight: SortedArray<XYAndZ>;
35
+ protected _onCompleted: BeEvent<() => void>;
36
+ protected readonly _scratchXYZ: {
37
+ x: number;
38
+ y: number;
39
+ z: number;
40
+ };
41
+ protected readonly _maxPointsPerRequest: number;
42
+ protected readonly _iModel: IModelConnection;
43
+ protected readonly _requestPoints: (points: XYAndZ[]) => Promise<PointWithStatus[]>;
44
+ protected toXYAndZ(input: XYZProps, output: WritableXYAndZ): XYAndZ;
45
+ constructor(opts: CoordinateConverterOptions);
46
+ protected dispatch(): Promise<void>;
47
+ protected enqueue(points: XYZProps[]): number;
48
+ protected getFromCache(inputs: XYZProps[]): PointWithStatus[];
49
+ protected scheduleDispatch(): Promise<void>;
50
+ convert(inputs: XYZProps[]): Promise<{
51
+ points: PointWithStatus[];
52
+ fromCache: number;
53
+ }>;
54
+ findCached(inputs: XYZProps[]): CachedIModelCoordinatesResponseProps;
55
+ }
4
56
  /** Response to a request to obtain imodel coordinates from cache.
5
57
  * @internal
6
58
  */
@@ -14,13 +66,12 @@ export interface CachedIModelCoordinatesResponseProps {
14
66
  * @internal
15
67
  */
16
68
  export declare class GeoConverter {
17
- private _datumOrGCRS;
18
- private _gCtoIMCResultCache;
19
- private _iMCtoGCResultCache;
69
+ private readonly _geoToIModel;
70
+ private readonly _iModelToGeo;
20
71
  constructor(iModel: IModelConnection, datumOrGCRS: string | GeographicCRSProps);
21
72
  getIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): Promise<IModelCoordinatesResponseProps>;
22
- getCachedIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): CachedIModelCoordinatesResponseProps;
23
73
  getGeoCoordinatesFromIModelCoordinates(iModelPoints: XYZProps[]): Promise<GeoCoordinatesResponseProps>;
74
+ getCachedIModelCoordinatesFromGeoCoordinates(geoPoints: XYZProps[]): CachedIModelCoordinatesResponseProps;
24
75
  }
25
76
  /** The Geographic Services available for an [[IModelConnection]].
26
77
  * @internal
@@ -30,4 +81,5 @@ export declare class GeoServices {
30
81
  constructor(iModel: IModelConnection);
31
82
  getConverter(datumOrGCRS?: string | GeographicCRSProps): GeoConverter | undefined;
32
83
  }
84
+ export {};
33
85
  //# sourceMappingURL=GeoServices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GeoServices.d.ts","sourceRoot":"","sources":["../../src/GeoServices.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACuB,2BAA2B,EAAkB,kBAAkB,EAAiC,8BAA8B,EAClI,eAAe,EACxC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD,oIAAoI;IACpI,MAAM,EAAE,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC3C,mIAAmI;IACnI,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB;AA+LD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,mBAAmB,CAAqB;gBACpC,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB;IASjE,sCAAsC,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAK5G,4CAA4C,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,oCAAoC;IAInG,sCAAsC,CAAC,YAAY,EAAE,QAAQ,E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