@itwin/core-frontend 3.2.0-dev.13 → 3.2.0-dev.14
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/tile/OPCFormatInterpreter.d.ts.map +1 -1
- package/lib/cjs/tile/OPCFormatInterpreter.js +1 -2
- package/lib/cjs/tile/OPCFormatInterpreter.js.map +1 -1
- package/lib/esm/tile/OPCFormatInterpreter.d.ts.map +1 -1
- package/lib/esm/tile/OPCFormatInterpreter.js +2 -3
- package/lib/esm/tile/OPCFormatInterpreter.js.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAwG,gBAAgB,EAAS,MAAM,qBAAqB,CAAC;AAGpK,OAAO,EAAoB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAInF;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B;;;;OAIG;WACiB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiBhG;;;;;OAKG;WACiB,4BAA4B,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CA2CnH"}
|
|
@@ -9,7 +9,6 @@ const core_common_1 = require("@itwin/core-common");
|
|
|
9
9
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
10
10
|
const core_orbitgt_1 = require("@itwin/core-orbitgt");
|
|
11
11
|
const FrontendLoggerCategory_1 = require("../FrontendLoggerCategory");
|
|
12
|
-
const DownloaderNode_1 = require("@itwin/core-orbitgt/lib/cjs/system/runtime/DownloaderNode");
|
|
13
12
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
14
13
|
const RealityDataSource_1 = require("../RealityDataSource");
|
|
15
14
|
const loggerCategory = FrontendLoggerCategory_1.FrontendLoggerCategory.RealityData;
|
|
@@ -25,7 +24,7 @@ class OPCFormatInterpreter {
|
|
|
25
24
|
*/
|
|
26
25
|
static async getFileReaderFromBlobFileURL(blobFileURL) {
|
|
27
26
|
if (core_orbitgt_1.Downloader.INSTANCE == null)
|
|
28
|
-
core_orbitgt_1.Downloader.INSTANCE = new
|
|
27
|
+
core_orbitgt_1.Downloader.INSTANCE = new core_orbitgt_1.DownloaderXhr();
|
|
29
28
|
if (core_orbitgt_1.CRSManager.ENGINE == null)
|
|
30
29
|
core_orbitgt_1.CRSManager.ENGINE = await core_orbitgt_1.OnlineEngine.create();
|
|
31
30
|
// let blobFileURL: string = rdUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPCFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oDAAgE;AAChE,wDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"OPCFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oDAAgE;AAChE,wDAA+C;AAC/C,sDAAoK;AACpK,sEAAmE;AACnE,sDAA+F;AAC/F,4DAAmF;AAEnF,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AAElE;;;GAGG;AACH,MAAa,oBAAoB;IAC/B;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,WAAmB;QAClE,IAAI,yBAAU,CAAC,QAAQ,IAAI,IAAI;YAC7B,yBAAU,CAAC,QAAQ,GAAG,IAAI,4BAAa,EAAE,CAAC;QAC5C,IAAI,yBAAU,CAAC,MAAM,IAAI,IAAI;YAC3B,yBAAU,CAAC,MAA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,CAAC;gBACpE,MAAM,KAAK,GAAG,IAAI,oCAAgB,CAAC,gCAAiB,CAAC,WAAW,EAAE,yBAAyB,EAAE,WAAW,CAAC,CAAC;gBAC1G,MAAM,KAAK,CAAC;aACb;SACF;aAAM;YACL,aAAa;YACb,YAAY,GAAG,KAAK,CAAC;YACrB,MAAM,aAAa,GAAG,IAAI,0BAAY,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YACjI,QAAQ,GAAG,aAAa,CAAC;YACzB,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,gCAAgC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC5F;QACD,MAAM,eAAe,GAA8B,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;QAC1F,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAxED,oDAwEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Cartographic, EcefLocation } from \"@itwin/core-common\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { ALong, CRSManager, Downloader, DownloaderXhr, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, PointCloudReader, UrlFS } from \"@itwin/core-orbitgt\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { BentleyError, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\r\nimport { RealityDataError, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n\r\n/**\r\n * This class provide methods used to interpret Orbit Point Cloud (OPC) format\r\n * @internal\r\n */\r\nexport class OPCFormatInterpreter {\r\n /** Gets an OPC file reader from a blobFileUrl\r\n * @param blobFileURL the name of the file.\r\n * @returns return a file reader open to read provided blob file\r\n * @internal\r\n */\r\n public static async getFileReaderFromBlobFileURL(blobFileURL: string): Promise<PointCloudReader> {\r\n if (Downloader.INSTANCE == null)\r\n Downloader.INSTANCE = new DownloaderXhr();\r\n if (CRSManager.ENGINE == null)\r\n CRSManager.ENGINE = await OnlineEngine.create();\r\n\r\n // let blobFileURL: string = rdUrl;\r\n // if (accountName.length > 0) blobFileURL = UrlFS.getAzureBlobSasUrl(opcConfig.accountName, opcConfig.containerName, opcConfig.blobFileName, opcConfig.sasToken);\r\n const urlFS: UrlFS = new UrlFS();\r\n // wrap a caching layer (16 MB) around the blob file\r\n const blobFileSize: ALong = await urlFS.getFileLength(blobFileURL);\r\n Logger.logTrace(loggerCategory, `OPC File Size is ${blobFileSize}`);\r\n const blobFile: PageCachedFile = new PageCachedFile(urlFS, blobFileURL, blobFileSize, 128 * 1024 /* pageSize */, 128 /* maxPageCount */);\r\n const fileReader: PointCloudReader = await OPCReader.openFile(blobFile, blobFileURL, true/* lazyLoading */);\r\n return fileReader;\r\n }\r\n\r\n /** Gets reality data spatial location and extents\r\n * @param fileReader a file reader instance obtains from call to getFileReaderFromBlobFileURL\r\n * @returns spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @throws [[RealityDataError]] if source is invalid or cannot be read\r\n * @internal\r\n */\r\n public static async getSpatialLocationAndExtents(fileReader: PointCloudReader): Promise<SpatialLocationAndExtents> {\r\n let worldRange = new Range3d();\r\n let location: Cartographic | EcefLocation;\r\n let isGeolocated = true;\r\n\r\n const bounds = fileReader.getFileBounds();\r\n worldRange = Range3d.createXYZXYZ(bounds.getMinX(), bounds.getMinY(), bounds.getMinZ(), bounds.getMaxX(), bounds.getMaxY(), bounds.getMaxZ());\r\n isGeolocated = false;\r\n const fileCrs = fileReader.getFileCRS();\r\n if (fileCrs) {\r\n try {\r\n await CRSManager.ENGINE.prepareForArea(fileCrs, bounds);\r\n const wgs84ECEFCrs = \"4978\";\r\n await CRSManager.ENGINE.prepareForArea(wgs84ECEFCrs, new OrbitGtBounds());\r\n\r\n const ecefBounds = CRSManager.transformBounds(bounds, fileCrs, wgs84ECEFCrs);\r\n const ecefRange = Range3d.createXYZXYZ(ecefBounds.getMinX(), ecefBounds.getMinY(), ecefBounds.getMinZ(), ecefBounds.getMaxX(), ecefBounds.getMaxY(), ecefBounds.getMaxZ());\r\n const ecefCenter = ecefRange.localXYZToWorld(.5, .5, .5)!;\r\n const cartoCenter = Cartographic.fromEcef(ecefCenter)!;\r\n cartoCenter.height = 0;\r\n const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);\r\n location = ecefLocation;\r\n // this.iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange = ecefToWorld.multiplyRange(ecefRange);\r\n isGeolocated = true;\r\n } catch (e) {\r\n Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret point cloud`);\r\n const errorProps = BentleyError.getErrorProps(e);\r\n const getMetaData: LoggingMetaData = () => {return { errorProps };};\r\n const error = new RealityDataError(RealityDataStatus.InvalidData, \"Invalid or unknown data\", getMetaData);\r\n throw error;\r\n }\r\n } else {\r\n // NoGCS case\r\n isGeolocated = false;\r\n const centerOfEarth = new EcefLocation({ origin: { x: 0.0, y: 0.0, z: 0.0 }, orientation: { yaw: 0.0, pitch: 0.0, roll: 0.0 } });\r\n location = centerOfEarth;\r\n Logger.logTrace(loggerCategory, \"OPC RealityData NOT Geolocated\", () => ({ ...location }));\r\n }\r\n const spatialLocation: SpatialLocationAndExtents = { location, worldRange, isGeolocated };\r\n return spatialLocation;\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAwG,gBAAgB,EAAS,MAAM,qBAAqB,CAAC;AAGpK,OAAO,EAAoB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAInF;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B;;;;OAIG;WACiB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiBhG;;;;;OAKG;WACiB,4BAA4B,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CA2CnH"}
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Cartographic, EcefLocation } from "@itwin/core-common";
|
|
6
6
|
import { Range3d } from "@itwin/core-geometry";
|
|
7
|
-
import { CRSManager, Downloader, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, UrlFS } from "@itwin/core-orbitgt";
|
|
7
|
+
import { CRSManager, Downloader, DownloaderXhr, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, UrlFS } from "@itwin/core-orbitgt";
|
|
8
8
|
import { FrontendLoggerCategory } from "../FrontendLoggerCategory";
|
|
9
|
-
import { DownloaderNode } from "@itwin/core-orbitgt/lib/cjs/system/runtime/DownloaderNode";
|
|
10
9
|
import { BentleyError, Logger, RealityDataStatus } from "@itwin/core-bentley";
|
|
11
10
|
import { RealityDataError } from "../RealityDataSource";
|
|
12
11
|
const loggerCategory = FrontendLoggerCategory.RealityData;
|
|
@@ -22,7 +21,7 @@ export class OPCFormatInterpreter {
|
|
|
22
21
|
*/
|
|
23
22
|
static async getFileReaderFromBlobFileURL(blobFileURL) {
|
|
24
23
|
if (Downloader.INSTANCE == null)
|
|
25
|
-
Downloader.INSTANCE = new
|
|
24
|
+
Downloader.INSTANCE = new DownloaderXhr();
|
|
26
25
|
if (CRSManager.ENGINE == null)
|
|
27
26
|
CRSManager.ENGINE = await OnlineEngine.create();
|
|
28
27
|
// let blobFileURL: string = rdUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPCFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAS,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAoB,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"OPCFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAS,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAoB,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACpK,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAmB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAA6B,MAAM,sBAAsB,CAAC;AAEnF,MAAM,cAAc,GAAW,sBAAsB,CAAC,WAAW,CAAC;AAElE;;;GAGG;AACH,MAAM,OA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AAC,EAAE;gBACV,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,mEAAmE,CAAC,CAAC;gBACvG,MAAM,UAAU,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;gBACjD,MAAM,WAAW,GAAoB,GAAG,EAAE,GAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA,CAAC,CAAC;gBACpE,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,WAAW,EAAE,yBAAyB,EAAE,WAAW,CAAC,CAAC;gBAC1G,MAAM,KAAK,CAAC;aACb;SACF;aAAM;YACL,aAAa;YACb,YAAY,GAAG,KAAK,CAAC;YACrB,MAAM,aAAa,GAAG,IAAI,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YACjI,QAAQ,GAAG,aAAa,CAAC;YACzB,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,gCAAgC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC5F;QACD,MAAM,eAAe,GAA8B,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;QAC1F,OAAO,eAAe,CAAC;IACzB,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\r\nimport { Cartographic, EcefLocation } from \"@itwin/core-common\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { ALong, CRSManager, Downloader, DownloaderXhr, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, PointCloudReader, UrlFS } from \"@itwin/core-orbitgt\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { BentleyError, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\r\nimport { RealityDataError, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n\r\n/**\r\n * This class provide methods used to interpret Orbit Point Cloud (OPC) format\r\n * @internal\r\n */\r\nexport class OPCFormatInterpreter {\r\n /** Gets an OPC file reader from a blobFileUrl\r\n * @param blobFileURL the name of the file.\r\n * @returns return a file reader open to read provided blob file\r\n * @internal\r\n */\r\n public static async getFileReaderFromBlobFileURL(blobFileURL: string): Promise<PointCloudReader> {\r\n if (Downloader.INSTANCE == null)\r\n Downloader.INSTANCE = new DownloaderXhr();\r\n if (CRSManager.ENGINE == null)\r\n CRSManager.ENGINE = await OnlineEngine.create();\r\n\r\n // let blobFileURL: string = rdUrl;\r\n // if (accountName.length > 0) blobFileURL = UrlFS.getAzureBlobSasUrl(opcConfig.accountName, opcConfig.containerName, opcConfig.blobFileName, opcConfig.sasToken);\r\n const urlFS: UrlFS = new UrlFS();\r\n // wrap a caching layer (16 MB) around the blob file\r\n const blobFileSize: ALong = await urlFS.getFileLength(blobFileURL);\r\n Logger.logTrace(loggerCategory, `OPC File Size is ${blobFileSize}`);\r\n const blobFile: PageCachedFile = new PageCachedFile(urlFS, blobFileURL, blobFileSize, 128 * 1024 /* pageSize */, 128 /* maxPageCount */);\r\n const fileReader: PointCloudReader = await OPCReader.openFile(blobFile, blobFileURL, true/* lazyLoading */);\r\n return fileReader;\r\n }\r\n\r\n /** Gets reality data spatial location and extents\r\n * @param fileReader a file reader instance obtains from call to getFileReaderFromBlobFileURL\r\n * @returns spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @throws [[RealityDataError]] if source is invalid or cannot be read\r\n * @internal\r\n */\r\n public static async getSpatialLocationAndExtents(fileReader: PointCloudReader): Promise<SpatialLocationAndExtents> {\r\n let worldRange = new Range3d();\r\n let location: Cartographic | EcefLocation;\r\n let isGeolocated = true;\r\n\r\n const bounds = fileReader.getFileBounds();\r\n worldRange = Range3d.createXYZXYZ(bounds.getMinX(), bounds.getMinY(), bounds.getMinZ(), bounds.getMaxX(), bounds.getMaxY(), bounds.getMaxZ());\r\n isGeolocated = false;\r\n const fileCrs = fileReader.getFileCRS();\r\n if (fileCrs) {\r\n try {\r\n await CRSManager.ENGINE.prepareForArea(fileCrs, bounds);\r\n const wgs84ECEFCrs = \"4978\";\r\n await CRSManager.ENGINE.prepareForArea(wgs84ECEFCrs, new OrbitGtBounds());\r\n\r\n const ecefBounds = CRSManager.transformBounds(bounds, fileCrs, wgs84ECEFCrs);\r\n const ecefRange = Range3d.createXYZXYZ(ecefBounds.getMinX(), ecefBounds.getMinY(), ecefBounds.getMinZ(), ecefBounds.getMaxX(), ecefBounds.getMaxY(), ecefBounds.getMaxZ());\r\n const ecefCenter = ecefRange.localXYZToWorld(.5, .5, .5)!;\r\n const cartoCenter = Cartographic.fromEcef(ecefCenter)!;\r\n cartoCenter.height = 0;\r\n const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);\r\n location = ecefLocation;\r\n // this.iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange = ecefToWorld.multiplyRange(ecefRange);\r\n isGeolocated = true;\r\n } catch (e) {\r\n Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret point cloud`);\r\n const errorProps = BentleyError.getErrorProps(e);\r\n const getMetaData: LoggingMetaData = () => {return { errorProps };};\r\n const error = new RealityDataError(RealityDataStatus.InvalidData, \"Invalid or unknown data\", getMetaData);\r\n throw error;\r\n }\r\n } else {\r\n // NoGCS case\r\n isGeolocated = false;\r\n const centerOfEarth = new EcefLocation({ origin: { x: 0.0, y: 0.0, z: 0.0 }, orientation: { yaw: 0.0, pitch: 0.0, roll: 0.0 } });\r\n location = centerOfEarth;\r\n Logger.logTrace(loggerCategory, \"OPC RealityData NOT Geolocated\", () => ({ ...location }));\r\n }\r\n const spatialLocation: SpatialLocationAndExtents = { location, worldRange, isGeolocated };\r\n return spatialLocation;\r\n }\r\n}\r\n\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-frontend",
|
|
3
|
-
"version": "3.2.0-dev.
|
|
3
|
+
"version": "3.2.0-dev.14",
|
|
4
4
|
"description": "iTwin.js frontend components",
|
|
5
5
|
"main": "lib/cjs/core-frontend.js",
|
|
6
6
|
"module": "lib/esm/core-frontend.js",
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
"url": "http://www.bentley.com"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@itwin/appui-abstract": "^3.2.0-dev.
|
|
27
|
-
"@itwin/core-bentley": "^3.2.0-dev.
|
|
28
|
-
"@itwin/core-common": "^3.2.0-dev.
|
|
29
|
-
"@itwin/core-geometry": "^3.2.0-dev.
|
|
30
|
-
"@itwin/core-orbitgt": "^3.2.0-dev.
|
|
31
|
-
"@itwin/core-quantity": "^3.2.0-dev.
|
|
32
|
-
"@itwin/webgl-compatibility": "^3.2.0-dev.
|
|
26
|
+
"@itwin/appui-abstract": "^3.2.0-dev.14",
|
|
27
|
+
"@itwin/core-bentley": "^3.2.0-dev.14",
|
|
28
|
+
"@itwin/core-common": "^3.2.0-dev.14",
|
|
29
|
+
"@itwin/core-geometry": "^3.2.0-dev.14",
|
|
30
|
+
"@itwin/core-orbitgt": "^3.2.0-dev.14",
|
|
31
|
+
"@itwin/core-quantity": "^3.2.0-dev.14",
|
|
32
|
+
"@itwin/webgl-compatibility": "^3.2.0-dev.14"
|
|
33
33
|
},
|
|
34
34
|
"//devDependencies": [
|
|
35
35
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
36
36
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@itwin/appui-abstract": "3.2.0-dev.
|
|
40
|
-
"@itwin/build-tools": "3.2.0-dev.
|
|
41
|
-
"@itwin/core-bentley": "3.2.0-dev.
|
|
42
|
-
"@itwin/core-common": "3.2.0-dev.
|
|
43
|
-
"@itwin/core-geometry": "3.2.0-dev.
|
|
44
|
-
"@itwin/core-orbitgt": "3.2.0-dev.
|
|
45
|
-
"@itwin/core-quantity": "3.2.0-dev.
|
|
46
|
-
"@itwin/certa": "3.2.0-dev.
|
|
47
|
-
"@itwin/eslint-plugin": "3.2.0-dev.
|
|
48
|
-
"@itwin/webgl-compatibility": "3.2.0-dev.
|
|
39
|
+
"@itwin/appui-abstract": "3.2.0-dev.14",
|
|
40
|
+
"@itwin/build-tools": "3.2.0-dev.14",
|
|
41
|
+
"@itwin/core-bentley": "3.2.0-dev.14",
|
|
42
|
+
"@itwin/core-common": "3.2.0-dev.14",
|
|
43
|
+
"@itwin/core-geometry": "3.2.0-dev.14",
|
|
44
|
+
"@itwin/core-orbitgt": "3.2.0-dev.14",
|
|
45
|
+
"@itwin/core-quantity": "3.2.0-dev.14",
|
|
46
|
+
"@itwin/certa": "3.2.0-dev.14",
|
|
47
|
+
"@itwin/eslint-plugin": "3.2.0-dev.14",
|
|
48
|
+
"@itwin/webgl-compatibility": "3.2.0-dev.14",
|
|
49
49
|
"@types/chai": "^4.1.4",
|
|
50
50
|
"@types/chai-as-promised": "^7",
|
|
51
51
|
"@types/deep-assign": "^0.1.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@itwin/core-i18n": "3.2.0-dev.
|
|
78
|
-
"@itwin/core-telemetry": "3.2.0-dev.
|
|
77
|
+
"@itwin/core-i18n": "3.2.0-dev.14",
|
|
78
|
+
"@itwin/core-telemetry": "3.2.0-dev.14",
|
|
79
79
|
"@loaders.gl/core": "^3.1.6",
|
|
80
80
|
"@loaders.gl/draco": "^3.1.6",
|
|
81
81
|
"deep-assign": "^2.0.0",
|