@itwin/core-frontend 3.1.0-dev.29 → 3.1.0-dev.31
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/RealityDataSource.d.ts +9 -1
- package/lib/cjs/RealityDataSource.d.ts.map +1 -1
- package/lib/cjs/RealityDataSource.js +11 -1
- package/lib/cjs/RealityDataSource.js.map +1 -1
- package/lib/cjs/tile/OPCFormatInterpreter.d.ts +1 -0
- package/lib/cjs/tile/OPCFormatInterpreter.d.ts.map +1 -1
- package/lib/cjs/tile/OPCFormatInterpreter.js +25 -14
- package/lib/cjs/tile/OPCFormatInterpreter.js.map +1 -1
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.d.ts +1 -0
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.d.ts.map +1 -1
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.js +66 -47
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.js.map +1 -1
- package/lib/esm/RealityDataSource.d.ts +9 -1
- package/lib/esm/RealityDataSource.d.ts.map +1 -1
- package/lib/esm/RealityDataSource.js +10 -1
- package/lib/esm/RealityDataSource.js.map +1 -1
- package/lib/esm/tile/OPCFormatInterpreter.d.ts +1 -0
- package/lib/esm/tile/OPCFormatInterpreter.d.ts.map +1 -1
- package/lib/esm/tile/OPCFormatInterpreter.js +26 -15
- package/lib/esm/tile/OPCFormatInterpreter.js.map +1 -1
- package/lib/esm/tile/ThreeDTileFormatInterpreter.d.ts +1 -0
- package/lib/esm/tile/ThreeDTileFormatInterpreter.d.ts.map +1 -1
- package/lib/esm/tile/ThreeDTileFormatInterpreter.js +67 -48
- package/lib/esm/tile/ThreeDTileFormatInterpreter.js.map +1 -1
- package/package.json +20 -20
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
|
-
import { GuidString } from "@itwin/core-bentley";
|
|
4
|
+
import { BentleyError, GuidString, LoggingMetaData, RealityDataStatus } from "@itwin/core-bentley";
|
|
5
5
|
import { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from "@itwin/core-common";
|
|
6
6
|
import { Range3d } from "@itwin/core-geometry";
|
|
7
|
+
/**
|
|
8
|
+
* Reality Data Operation error
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export declare class RealityDataError extends BentleyError {
|
|
12
|
+
constructor(errorNumber: RealityDataStatus, message: string, getMetaData?: LoggingMetaData);
|
|
13
|
+
}
|
|
7
14
|
/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`
|
|
8
15
|
* @alpha
|
|
9
16
|
*/
|
|
@@ -66,6 +73,7 @@ export interface RealityDataSource {
|
|
|
66
73
|
/** Gets spatial location and extents of this reality data source.
|
|
67
74
|
* Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)
|
|
68
75
|
* @returns spatial location and extents
|
|
76
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
69
77
|
* @alpha
|
|
70
78
|
*/
|
|
71
79
|
getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSource.d.ts","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"RealityDataSource.d.ts","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAU,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oB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G;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC;;;;;OAKG;IACH,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAAC;IAC/E;;;;OAIG;IACH,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;CACtE;AACD;;GAEG;AACH,yBAAiB,iBAAiB,CAAC;IACjC;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,mBAAmB,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAsB/I;IACD,gHAAgH;IAChH,SAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,mBAAmB,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAMhJ;IACD,yCAAyC;IACzC,SAAgB,6BAA6B,CAAC,WAAW,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,mBAAmB,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAUvK;IACD,yCAAyC;IACzC,SAAgB,6BAA6B,CAAC,WAAW,EAAE,oBAAoB,GAAG,gBAAgB,GAAG,SAAS,CAa7G;IACD,4DAA4D;IAC5D,SAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAGpG;IACD;;;OAGG;IACH,SAAsB,OAAO,CAAC,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAcxI;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RealityDataSource = void 0;
|
|
3
|
+
exports.RealityDataSource = exports.RealityDataError = void 0;
|
|
4
4
|
/*---------------------------------------------------------------------------------------------
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -16,6 +16,16 @@ const RealityDataSourceTilesetUrlImpl_1 = require("./RealityDataSourceTilesetUrl
|
|
|
16
16
|
const RealityDataSourceContextShareImpl_1 = require("./RealityDataSourceContextShareImpl");
|
|
17
17
|
const RealityDataSourceCesiumIonAssetImpl_1 = require("./RealityDataSourceCesiumIonAssetImpl");
|
|
18
18
|
const loggerCategory = FrontendLoggerCategory_1.FrontendLoggerCategory.RealityData;
|
|
19
|
+
/**
|
|
20
|
+
* Reality Data Operation error
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
class RealityDataError extends core_bentley_1.BentleyError {
|
|
24
|
+
constructor(errorNumber, message, getMetaData) {
|
|
25
|
+
super(errorNumber, message, getMetaData);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.RealityDataError = RealityDataError;
|
|
19
29
|
/** Utility functions for RealityDataSource
|
|
20
30
|
* @beta
|
|
21
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAyD;AACzD,oDAA6J;AAC7J,qEAAkE;AAClE,8CAAkG;AAClG,uFAAoF;AACpF,2FAAwF;AACxF,+FAA4F;AAG5F,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AA6ElE;;GAEG;AACH,IAAiB,iBAAiB,CAyFjC;AAzFD,WAAiB,iBAAiB;IAChC;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,aAAmC,EAAE,WAA+B;QACvH,IAAI,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,+BAAiB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gBACnC,OAAO,qEAAiC,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC/E,KAAK,iCAAmB,CAAC,WAAW;gBAClC,OAAO,iEAA+B,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7E;gBACE,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;SACpF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAdqB,yBAAO,UAc5B,CAAA;AACH,CAAC,EAzFgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAyFjC","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 Tiles\r\n */\r\nimport { GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from \"./tile/internal\";\r\nimport { RealityDataSourceTilesetUrlImpl } from \"./RealityDataSourceTilesetUrlImpl\";\r\nimport { RealityDataSourceContextShareImpl } from \"./RealityDataSourceContextShareImpl\";\r\nimport { RealityDataSourceCesiumIonAssetImpl } from \"./RealityDataSourceCesiumIonAssetImpl\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n\r\n/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @alpha\r\n */\r\nexport interface SpatialLocationAndExtents {\r\n /** location of the point at the center of the reaity data */\r\n location: Cartographic | EcefLocation;\r\n /** extents of the volume around location */\r\n worldRange: Range3d;\r\n /** true if this reality data is geolocated\r\n * A reality data is geolocated when we can compute a valid position relative to the earth surface.\r\n * Note that some reality data contains custom coordinate system without any information on the relative position on earth.\r\n * These reality data will have a location and worldRange but will be identified by the isGeoLocated set to false.\r\n */\r\n isGeolocated: boolean;\r\n}\r\n\r\n/** This interface provides information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\nexport interface PublisherProductInfo {\r\n /** product that create this reality data */\r\n product: string;\r\n /** engine that create this reality data */\r\n engine: string;\r\n /** the version of the engine that create this reality data */\r\n version: string;\r\n}\r\n\r\n/** This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /** This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /** Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /** Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /** Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n /** Gets spatial location and extents of this reality data source.\r\n * Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)\r\n * @returns spatial location and extents\r\n * @alpha\r\n */\r\n getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /** Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex + 2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** @internal - Is used by \"fdt attach cesium asset\" keyin*/\r\n export function createCesiumIonAssetKey(osmAssetId: number, requestKey: string): RealityDataSourceKey {\r\n const id = getCesiumAssetUrl(osmAssetId,requestKey);\r\n return {provider: RealityDataProvider.CesiumIonAsset, format: RealityDataFormat.ThreeDTile, id};\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @alpha\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n switch(rdSourceKey.provider) {\r\n case RealityDataProvider.CesiumIonAsset:\r\n return RealityDataSourceCesiumIonAssetImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.TilesetUrl:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.ContextShare:\r\n return RealityDataSourceContextShareImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.OrbitGtBlob:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n default:\r\n Logger.logError(loggerCategory, `Error realityModelFromJson - region undefined`);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA2G;AAC3G,oDAA6J;AAC7J,qEAAkE;AAClE,8CAAkG;AAClG,uFAAoF;AACpF,2FAAwF;AACxF,+FAA4F;AAG5F,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AAElE;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,2BAAY;IAChD,YAAmB,WAA8B,EAAE,OAAe,EAAE,WAA6B;QAC/F,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;CACF;AAJD,4CAIC;AA8ED;;GAEG;AACH,IAAiB,iBAAiB,CAyFjC;AAzFD,WAAiB,iBAAiB;IAChC;;;;;OAKG;IACH,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ACjF,KAAK,iCAAmB,CAAC,UAAU;gBACjC,OAAO,iEAA+B,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7E,KAAK,iCAAmB,CAAC,YAAY;gBACnC,OAAO,qEAAiC,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC/E,KAAK,iCAAmB,CAAC,WAAW;gBAClC,OAAO,iEAA+B,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7E;gBACE,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;SACpF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAdqB,yBAAO,UAc5B,CAAA;AACH,CAAC,EAzFgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAyFjC","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 Tiles\r\n */\r\nimport { BentleyError, GuidString, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from \"./tile/internal\";\r\nimport { RealityDataSourceTilesetUrlImpl } from \"./RealityDataSourceTilesetUrlImpl\";\r\nimport { RealityDataSourceContextShareImpl } from \"./RealityDataSourceContextShareImpl\";\r\nimport { RealityDataSourceCesiumIonAssetImpl } from \"./RealityDataSourceCesiumIonAssetImpl\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n\r\n/**\r\n * Reality Data Operation error\r\n * @alpha\r\n */\r\nexport class RealityDataError extends BentleyError {\r\n public constructor(errorNumber: RealityDataStatus, message: string, getMetaData?: LoggingMetaData) {\r\n super(errorNumber, message, getMetaData);\r\n }\r\n}\r\n\r\n/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @alpha\r\n */\r\nexport interface SpatialLocationAndExtents {\r\n /** location of the point at the center of the reaity data */\r\n location: Cartographic | EcefLocation;\r\n /** extents of the volume around location */\r\n worldRange: Range3d;\r\n /** true if this reality data is geolocated\r\n * A reality data is geolocated when we can compute a valid position relative to the earth surface.\r\n * Note that some reality data contains custom coordinate system without any information on the relative position on earth.\r\n * These reality data will have a location and worldRange but will be identified by the isGeoLocated set to false.\r\n */\r\n isGeolocated: boolean;\r\n}\r\n\r\n/** This interface provides information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\nexport interface PublisherProductInfo {\r\n /** product that create this reality data */\r\n product: string;\r\n /** engine that create this reality data */\r\n engine: string;\r\n /** the version of the engine that create this reality data */\r\n version: string;\r\n}\r\n\r\n/** This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /** This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /** Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /** Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /** Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n /** Gets spatial location and extents of this reality data source.\r\n * Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)\r\n * @returns spatial location and extents\r\n * @throws [[RealityDataError]] if source is invalid or cannot be read\r\n * @alpha\r\n */\r\n getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /** Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex + 2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** @internal - Is used by \"fdt attach cesium asset\" keyin*/\r\n export function createCesiumIonAssetKey(osmAssetId: number, requestKey: string): RealityDataSourceKey {\r\n const id = getCesiumAssetUrl(osmAssetId,requestKey);\r\n return {provider: RealityDataProvider.CesiumIonAsset, format: RealityDataFormat.ThreeDTile, id};\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @alpha\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n switch(rdSourceKey.provider) {\r\n case RealityDataProvider.CesiumIonAsset:\r\n return RealityDataSourceCesiumIonAssetImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.TilesetUrl:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.ContextShare:\r\n return RealityDataSourceContextShareImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.OrbitGtBlob:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n default:\r\n Logger.logError(loggerCategory, `Error realityModelFromJson - region undefined`);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -14,6 +14,7 @@ export declare class OPCFormatInterpreter {
|
|
|
14
14
|
/** Gets reality data spatial location and extents
|
|
15
15
|
* @param fileReader a file reader instance obtains from call to getFileReaderFromBlobFileURL
|
|
16
16
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
17
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
17
18
|
* @internal
|
|
18
19
|
*/
|
|
19
20
|
static getSpatialLocationAndExtents(fileReader: PointCloudReader): Promise<SpatialLocationAndExtents>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyF,gBAAgB,EAAS,MAAM,qBAAqB,CAAC;AAIrJ,OAAO,
|
|
1
|
+
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyF,gBAAgB,EAAS,MAAM,qBAAqB,CAAC;AAIrJ,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"}
|
|
@@ -11,6 +11,7 @@ const core_orbitgt_1 = require("@itwin/core-orbitgt");
|
|
|
11
11
|
const FrontendLoggerCategory_1 = require("../FrontendLoggerCategory");
|
|
12
12
|
const DownloaderNode_1 = require("@itwin/core-orbitgt/lib/cjs/system/runtime/DownloaderNode");
|
|
13
13
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
14
|
+
const RealityDataSource_1 = require("../RealityDataSource");
|
|
14
15
|
const loggerCategory = FrontendLoggerCategory_1.FrontendLoggerCategory.RealityData;
|
|
15
16
|
/**
|
|
16
17
|
* This class provide methods used to interpret Orbit Point Cloud (OPC) format
|
|
@@ -40,6 +41,7 @@ class OPCFormatInterpreter {
|
|
|
40
41
|
/** Gets reality data spatial location and extents
|
|
41
42
|
* @param fileReader a file reader instance obtains from call to getFileReaderFromBlobFileURL
|
|
42
43
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
44
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
43
45
|
* @internal
|
|
44
46
|
*/
|
|
45
47
|
static async getSpatialLocationAndExtents(fileReader) {
|
|
@@ -51,20 +53,29 @@ class OPCFormatInterpreter {
|
|
|
51
53
|
isGeolocated = false;
|
|
52
54
|
const fileCrs = fileReader.getFileCRS();
|
|
53
55
|
if (fileCrs) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
try {
|
|
57
|
+
await core_orbitgt_1.CRSManager.ENGINE.prepareForArea(fileCrs, bounds);
|
|
58
|
+
const wgs84ECEFCrs = "4978";
|
|
59
|
+
await core_orbitgt_1.CRSManager.ENGINE.prepareForArea(wgs84ECEFCrs, new core_orbitgt_1.OrbitGtBounds());
|
|
60
|
+
const ecefBounds = core_orbitgt_1.CRSManager.transformBounds(bounds, fileCrs, wgs84ECEFCrs);
|
|
61
|
+
const ecefRange = core_geometry_1.Range3d.createXYZXYZ(ecefBounds.getMinX(), ecefBounds.getMinY(), ecefBounds.getMinZ(), ecefBounds.getMaxX(), ecefBounds.getMaxY(), ecefBounds.getMaxZ());
|
|
62
|
+
const ecefCenter = ecefRange.localXYZToWorld(.5, .5, .5);
|
|
63
|
+
const cartoCenter = core_common_1.Cartographic.fromEcef(ecefCenter);
|
|
64
|
+
cartoCenter.height = 0;
|
|
65
|
+
const ecefLocation = core_common_1.EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
66
|
+
location = ecefLocation;
|
|
67
|
+
// this.iModelDb.setEcefLocation(ecefLocation);
|
|
68
|
+
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
69
|
+
worldRange = ecefToWorld.multiplyRange(ecefRange);
|
|
70
|
+
isGeolocated = true;
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
core_bentley_1.Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret point cloud`);
|
|
74
|
+
const errorProps = core_bentley_1.BentleyError.getErrorProps(e);
|
|
75
|
+
const getMetaData = () => { return { errorProps }; };
|
|
76
|
+
const error = new RealityDataSource_1.RealityDataError(core_bentley_1.RealityDataStatus.InvalidData, "Invalid or unknown data", getMetaData);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
68
79
|
}
|
|
69
80
|
else {
|
|
70
81
|
// NoGCS case
|
|
@@ -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,sDAAqJ;AACrJ,sEAAmE;AACnE,8FAA2F;AAC3F,
|
|
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,sDAAqJ;AACrJ,sEAAmE;AACnE,8FAA2F;AAC3F,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,+BAAc,EAAE,CAAC;QAC7C,IAAI,yBAAU,CAAC,MAAM,IAAI,IAAI;YAC3B,yBAAU,CAAC,MAAM,GAAG,M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ACpE,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, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, PointCloudReader, UrlFS } from \"@itwin/core-orbitgt\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { DownloaderNode } from \"@itwin/core-orbitgt/lib/cjs/system/runtime/DownloaderNode\";\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 DownloaderNode();\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"]}
|
|
@@ -16,6 +16,7 @@ export declare class ThreeDTileFormatInterpreter {
|
|
|
16
16
|
/** Gets reality data spatial location and extents
|
|
17
17
|
* @param json root document file in json format
|
|
18
18
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
19
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
19
20
|
* @internal
|
|
20
21
|
*/
|
|
21
22
|
static getSpatialLocationAndExtents(json: any): SpatialLocationAndExtents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDTileFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,OAAO,EAAE,SAAS,EAAgC,MAAM,sBAAsB,CAAC;AAE3G,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ThreeDTileFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,OAAO,EAAE,SAAS,EAAgC,MAAM,sBAAsB,CAAC;AAE3G,OAAO,EAAE,oBAAoB,EAAoB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGzG;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD;;;GAGG;AACH,qBAAa,2BAA2B;IACtC;;;;;OAKG;WACW,4BAA4B,CAAC,IAAI,EAAE,GAAG,GAAG,yBAAyB;IA8EhF;;;;;OAKG;WACW,uBAAuB,CAAC,WAAW,EAAE,GAAG,GAAG,oBAAoB;IAW7E;;;;;OAKG;WACW,WAAW,CAAC,WAAW,EAAE,GAAG,GAAG,kBAAkB;IAM/D;;;;OAIG;WACW,uBAAuB,CAAC,cAAc,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS;IA0B/E;;OAEG;WACW,iCAAiC,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;IAI/F;;OAEG;WACW,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;CAGrF"}
|
|
@@ -9,6 +9,7 @@ const core_bentley_1 = require("@itwin/core-bentley");
|
|
|
9
9
|
const core_common_1 = require("@itwin/core-common");
|
|
10
10
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
11
11
|
const FrontendLoggerCategory_1 = require("../FrontendLoggerCategory");
|
|
12
|
+
const RealityDataSource_1 = require("../RealityDataSource");
|
|
12
13
|
const loggerCategory = FrontendLoggerCategory_1.FrontendLoggerCategory.RealityData;
|
|
13
14
|
/**
|
|
14
15
|
* This class provide methods used to interpret Cesium 3dTile format
|
|
@@ -18,64 +19,82 @@ class ThreeDTileFormatInterpreter {
|
|
|
18
19
|
/** Gets reality data spatial location and extents
|
|
19
20
|
* @param json root document file in json format
|
|
20
21
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
22
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
21
23
|
* @internal
|
|
22
24
|
*/
|
|
23
25
|
static getSpatialLocationAndExtents(json) {
|
|
26
|
+
var _a, _b;
|
|
24
27
|
const worldRange = new core_geometry_1.Range3d();
|
|
25
28
|
let isGeolocated = true;
|
|
26
29
|
let location;
|
|
27
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData
|
|
28
|
-
if (undefined
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
const ecefLow = (core_common_1.Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();
|
|
36
|
-
const ecefHigh = (core_common_1.Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();
|
|
37
|
-
const ecefRange = core_geometry_1.Range3d.create(ecefLow, ecefHigh);
|
|
38
|
-
const cartoCenter = core_common_1.Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });
|
|
39
|
-
location = cartoCenter;
|
|
40
|
-
const ecefLocation = core_common_1.EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
41
|
-
// iModelDb.setEcefLocation(ecefLocation);
|
|
42
|
-
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
43
|
-
worldRange.extendRange(core_geometry_1.Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));
|
|
30
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData getSpatialLocationAndExtents");
|
|
31
|
+
if (undefined === (json === null || json === void 0 ? void 0 : json.root)) {
|
|
32
|
+
core_bentley_1.Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - no root in json`);
|
|
33
|
+
// return first 1024 char from the json
|
|
34
|
+
const getMetaData = () => { return { json: JSON.stringify(json).substring(0, 1024) }; };
|
|
35
|
+
const error = new RealityDataSource_1.RealityDataError(core_bentley_1.RealityDataStatus.InvalidData, "Invalid or unknown data - no root in json", getMetaData);
|
|
36
|
+
throw error;
|
|
44
37
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const centerOfEarth = new core_common_1.EcefLocation({ origin: { x: 0.0, y: 0.0, z: 0.0 }, orientation: { yaw: 0.0, pitch: 0.0, roll: 0.0 } });
|
|
60
|
-
location = centerOfEarth;
|
|
61
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData NOT Geolocated", () => ({ ...location }));
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
let ecefLocation;
|
|
65
|
-
const locationOrientation = core_geometry_1.YawPitchRollAngles.tryFromTransform(worldToEcefTransform);
|
|
66
|
-
// Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.
|
|
67
|
-
// Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.
|
|
68
|
-
if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)
|
|
69
|
-
ecefLocation = new core_common_1.EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });
|
|
70
|
-
else
|
|
71
|
-
ecefLocation = core_common_1.EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
72
|
-
location = ecefLocation;
|
|
73
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData is worldToEcefTransform.matrix.isIdentity", () => ({ isIdentity: worldToEcefTransform.matrix.isIdentity }));
|
|
38
|
+
try {
|
|
39
|
+
if (undefined !== ((_b = (_a = json === null || json === void 0 ? void 0 : json.root) === null || _a === void 0 ? void 0 : _a.boundingVolume) === null || _b === void 0 ? void 0 : _b.region)) {
|
|
40
|
+
const region = core_bentley_1.JsonUtils.asArray(json.root.boundingVolume.region);
|
|
41
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData json.root.boundingVolume.region", () => ({ ...region }));
|
|
42
|
+
if (undefined === region) {
|
|
43
|
+
core_bentley_1.Logger.logError(loggerCategory, `Error getSpatialLocationAndExtents - region undefined`);
|
|
44
|
+
throw new TypeError("Unable to determine GeoLocation - no root Transform or Region on root.");
|
|
45
|
+
}
|
|
46
|
+
const ecefLow = (core_common_1.Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();
|
|
47
|
+
const ecefHigh = (core_common_1.Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();
|
|
48
|
+
const ecefRange = core_geometry_1.Range3d.create(ecefLow, ecefHigh);
|
|
49
|
+
const cartoCenter = core_common_1.Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });
|
|
50
|
+
location = cartoCenter;
|
|
51
|
+
const ecefLocation = core_common_1.EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
74
52
|
// iModelDb.setEcefLocation(ecefLocation);
|
|
75
53
|
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
76
54
|
worldRange.extendRange(core_geometry_1.Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));
|
|
77
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData ecefToWorld", () => ({ ...ecefToWorld }));
|
|
78
55
|
}
|
|
56
|
+
else {
|
|
57
|
+
let worldToEcefTransform = ThreeDTileFormatInterpreter.transformFromJson(json.root.transform);
|
|
58
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData json.root.transform", () => ({ ...worldToEcefTransform }));
|
|
59
|
+
const range = ThreeDTileFormatInterpreter.rangeFromBoundingVolume(json.root.boundingVolume);
|
|
60
|
+
if (undefined === worldToEcefTransform)
|
|
61
|
+
worldToEcefTransform = core_geometry_1.Transform.createIdentity();
|
|
62
|
+
const ecefRange = worldToEcefTransform.multiplyRange(range); // range in model -> range in ecef
|
|
63
|
+
const ecefCenter = worldToEcefTransform.multiplyPoint3d(range.center); // range center in model -> range center in ecef
|
|
64
|
+
const cartoCenter = core_common_1.Cartographic.fromEcef(ecefCenter); // ecef center to cartographic center
|
|
65
|
+
const isNotNearEarthSurface = cartoCenter && (cartoCenter.height < -5000); // 5 km under ground!
|
|
66
|
+
const earthCenterToRangeCenterRayLenght = range.center.magnitude();
|
|
67
|
+
if (worldToEcefTransform.matrix.isIdentity && (earthCenterToRangeCenterRayLenght < 1.0E5 || isNotNearEarthSurface)) {
|
|
68
|
+
isGeolocated = false;
|
|
69
|
+
worldRange.extendRange(core_geometry_1.Range3d.fromJSON(ecefRange));
|
|
70
|
+
const centerOfEarth = new core_common_1.EcefLocation({ origin: { x: 0.0, y: 0.0, z: 0.0 }, orientation: { yaw: 0.0, pitch: 0.0, roll: 0.0 } });
|
|
71
|
+
location = centerOfEarth;
|
|
72
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData NOT Geolocated", () => ({ ...location }));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
let ecefLocation;
|
|
76
|
+
const locationOrientation = core_geometry_1.YawPitchRollAngles.tryFromTransform(worldToEcefTransform);
|
|
77
|
+
// Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.
|
|
78
|
+
// Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.
|
|
79
|
+
if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)
|
|
80
|
+
ecefLocation = new core_common_1.EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });
|
|
81
|
+
else
|
|
82
|
+
ecefLocation = core_common_1.EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
83
|
+
location = ecefLocation;
|
|
84
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData is worldToEcefTransform.matrix.isIdentity", () => ({ isIdentity: worldToEcefTransform.matrix.isIdentity }));
|
|
85
|
+
// iModelDb.setEcefLocation(ecefLocation);
|
|
86
|
+
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
87
|
+
worldRange.extendRange(core_geometry_1.Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));
|
|
88
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RealityData ecefToWorld", () => ({ ...ecefToWorld }));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
core_bentley_1.Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret json`);
|
|
94
|
+
// return first 1024 char from the json
|
|
95
|
+
const getMetaData = () => { return { json: JSON.stringify(json).substring(0, 1024) }; };
|
|
96
|
+
const error = new RealityDataSource_1.RealityDataError(core_bentley_1.RealityDataStatus.InvalidData, "Invalid or unknown data", getMetaData);
|
|
97
|
+
throw error;
|
|
79
98
|
}
|
|
80
99
|
const spatialLocation = { location, worldRange, isGeolocated };
|
|
81
100
|
return spatialLocation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDTileFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAwD;AACxD,oDAAgE;AAChE,wDAA2G;AAC3G,sEAAmE;AAGnE,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AASlE;;;GAGG;AACH,MAAa,2BAA2B;IACtC;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAS;QAClD,MAAM,UAAU,GAAG,IAAI,uBAAO,EAAE,CAAC;QACjC,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,IAAI,QAAqC,CAAC;QAC1C,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,kCAAkC,CAAC,CAAC;QAEpE,IAAI,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;YACjD,MAAM,MAAM,GAAG,wBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAElE,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6CAA6C,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC;YACtG,IAAI,SAAS,KAAK,MAAM,EAAE;gBACxB,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;gBACjF,MAAM,IAAI,SAAS,CAAC,wEAAwE,CAAC,CAAC;aAC/F;YACD,MAAM,OAAO,GAAG,CAAC,0BAAY,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CA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wBAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChQ,CAAC;CACF;AA9ID,kEA8IC","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 { JsonUtils, Logger } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation } from \"@itwin/core-common\";\r\nimport { Matrix3d, Point3d, Range3d, Transform, Vector3d, YawPitchRollAngles } from \"@itwin/core-geometry\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { PublisherProductInfo, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n/** This interface provides information about 3dTile files for this reality data\r\n * Currently only used for debbugging\r\n * @internal\r\n */\r\nexport interface ThreeDTileFileInfo {\r\n /** the number of children at the root of this reality data */\r\n rootChildren?: number;\r\n}\r\n/**\r\n * This class provide methods used to interpret Cesium 3dTile format\r\n * @internal\r\n */\r\nexport class ThreeDTileFormatInterpreter {\r\n /** Gets reality data spatial location and extents\r\n * @param json root document file in json format\r\n * @returns spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @internal\r\n */\r\n public static getSpatialLocationAndExtents(json: any): SpatialLocationAndExtents {\r\n const worldRange = new Range3d();\r\n let isGeolocated = true;\r\n let location: Cartographic | EcefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData realityModelFromJson\");\r\n\r\n if (undefined !== json.root.boundingVolume.region) {\r\n const region = JsonUtils.asArray(json.root.boundingVolume.region);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.boundingVolume.region\", () => ({ ...region }));\r\n if (undefined === region) {\r\n Logger.logError(loggerCategory, `Error realityModelFromJson - region undefined`);\r\n throw new TypeError(\"Unable to determine GeoLocation - no root Transform or Region on root.\");\r\n }\r\n const ecefLow = (Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();\r\n const ecefHigh = (Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();\r\n const ecefRange = Range3d.create(ecefLow, ecefHigh);\r\n const cartoCenter = Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });\r\n location = cartoCenter;\r\n const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n } else {\r\n let worldToEcefTransform = ThreeDTileFormatInterpreter.transformFromJson(json.root.transform);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.transform\", () => ({ ...worldToEcefTransform }));\r\n const range = ThreeDTileFormatInterpreter.rangeFromBoundingVolume(json.root.boundingVolume)!;\r\n if (undefined === worldToEcefTransform)\r\n worldToEcefTransform = Transform.createIdentity();\r\n\r\n const ecefRange = worldToEcefTransform.multiplyRange(range); // range in model -> range in ecef\r\n const ecefCenter = worldToEcefTransform.multiplyPoint3d(range.center); // range center in model -> range center in ecef\r\n const cartoCenter = Cartographic.fromEcef(ecefCenter); // ecef center to cartographic center\r\n const isNotNearEarthSurface = cartoCenter && (cartoCenter.height < -5000); // 5 km under ground!\r\n const earthCenterToRangeCenterRayLenght = range.center.magnitude();\r\n\r\n if (worldToEcefTransform.matrix.isIdentity && (earthCenterToRangeCenterRayLenght < 1.0E5 || isNotNearEarthSurface)) {\r\n isGeolocated = false;\r\n worldRange.extendRange(Range3d.fromJSON(ecefRange));\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, \"RealityData NOT Geolocated\", () => ({ ...location }));\r\n } else {\r\n let ecefLocation: EcefLocation;\r\n const locationOrientation = YawPitchRollAngles.tryFromTransform(worldToEcefTransform);\r\n // Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.\r\n // Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.\r\n if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)\r\n ecefLocation = new EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });\r\n else\r\n ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter!);\r\n location = ecefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData is worldToEcefTransform.matrix.isIdentity\", () => ({ isIdentity: worldToEcefTransform!.matrix.isIdentity }));\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n Logger.logTrace(loggerCategory, \"RealityData ecefToWorld\", () => ({ ...ecefToWorld }));\r\n }\r\n }\r\n const spatialLocation: SpatialLocationAndExtents = { location, worldRange, isGeolocated };\r\n return spatialLocation;\r\n }\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public static getPublisherProductInfo(rootDocjson: any): PublisherProductInfo {\r\n const info: PublisherProductInfo = {product: \"\", engine: \"\", version: \"\"};\r\n if (rootDocjson && rootDocjson.root) {\r\n if (rootDocjson.root.SMPublisherInfo) {\r\n info.product = rootDocjson.root.SMPublisherInfo.Product ? rootDocjson.root.SMPublisherInfo.Product : \"\";\r\n info.engine = rootDocjson.root.SMPublisherInfo.Publisher ? rootDocjson.root.SMPublisherInfo.Publisher : \"\";\r\n info.version = rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] ? rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] : \"\" ;\r\n }\r\n }\r\n return info;\r\n }\r\n /** Gets information about 3dTile file for this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information about 3dTile file for this reality data\r\n * @internal\r\n */\r\n public static getFileInfo(rootDocjson: any): ThreeDTileFileInfo {\r\n const info: ThreeDTileFileInfo = {\r\n rootChildren: rootDocjson?.root?.children?.length ?? 0,\r\n };\r\n return info;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @param boundingVolume the bounding volume to convert\r\n * @returns the range or undefined if cannot convert\r\n * @internal\r\n */\r\n public static rangeFromBoundingVolume(boundingVolume: any): Range3d | undefined {\r\n if (undefined === boundingVolume)\r\n return undefined;\r\n if (Array.isArray(boundingVolume.box)) {\r\n const box: number[] = boundingVolume.box;\r\n const center = Point3d.create(box[0], box[1], box[2]);\r\n const ux = Vector3d.create(box[3], box[4], box[5]);\r\n const uy = Vector3d.create(box[6], box[7], box[8]);\r\n const uz = Vector3d.create(box[9], box[10], box[11]);\r\n const corners: Point3d[] = [];\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n for (let l = 0; l < 2; l++) {\r\n corners.push(center.plus3Scaled(ux, (j ? -1.0 : 1.0), uy, (k ? -1.0 : 1.0), uz, (l ? -1.0 : 1.0)));\r\n }\r\n }\r\n }\r\n return Range3d.createArray(corners);\r\n } else if (Array.isArray(boundingVolume.sphere)) {\r\n const sphere: number[] = boundingVolume.sphere;\r\n const center = Point3d.create(sphere[0], sphere[1], sphere[2]);\r\n const radius = sphere[3];\r\n return Range3d.createXYZXYZ(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius);\r\n }\r\n return undefined;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static maximumSizeFromGeometricTolerance(range: Range3d, geometricError: number): number {\r\n const minToleranceRatio = .5; // Nominally the error on screen size of a tile. Increasing generally increases performance (fewer draw calls) at expense of higher load times.\r\n return minToleranceRatio * range.diagonal().magnitude() / geometricError;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static transformFromJson(jTrans: number[] | undefined): Transform | undefined {\r\n return (jTrans === undefined) ? undefined : Transform.createOriginAndMatrix(Point3d.create(jTrans[12], jTrans[13], jTrans[14]), Matrix3d.createRowValues(jTrans[0], jTrans[4], jTrans[8], jTrans[1], jTrans[5], jTrans[9], jTrans[2], jTrans[6], jTrans[10]));\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ThreeDTileFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAA4F;AAC5F,oDAAgE;AAChE,wDAA2G;AAC3G,sEAAmE;AACnE,4DAAyG;AAEzG,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AASlE;;;GAGG;AACH,MAAa,2BAA2B;IACtC;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAS;;QAClD,MAAM,UAAU,GAAG,IAAI,uBAAO,EAAE,CAAC;QACjC,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,IAAI,QAAqC,CAAC;QAC1C,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;QAC5E,IAAI,SAAS,MAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAA,EAAE;YAC5B,qBAAM,CAAC,UAAU,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CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,yBAAS,CAAC,qBAAqB,CAAC,uBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChQ,CAAC;CACF;AA9JD,kEA8JC","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 { JsonUtils, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation } from \"@itwin/core-common\";\r\nimport { Matrix3d, Point3d, Range3d, Transform, Vector3d, YawPitchRollAngles } from \"@itwin/core-geometry\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { PublisherProductInfo, RealityDataError, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n/** This interface provides information about 3dTile files for this reality data\r\n * Currently only used for debbugging\r\n * @internal\r\n */\r\nexport interface ThreeDTileFileInfo {\r\n /** the number of children at the root of this reality data */\r\n rootChildren?: number;\r\n}\r\n/**\r\n * This class provide methods used to interpret Cesium 3dTile format\r\n * @internal\r\n */\r\nexport class ThreeDTileFormatInterpreter {\r\n /** Gets reality data spatial location and extents\r\n * @param json root document file in json format\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 getSpatialLocationAndExtents(json: any): SpatialLocationAndExtents {\r\n const worldRange = new Range3d();\r\n let isGeolocated = true;\r\n let location: Cartographic | EcefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData getSpatialLocationAndExtents\");\r\n if (undefined === json?.root) {\r\n Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - no root in json`);\r\n // return first 1024 char from the json\r\n const getMetaData: LoggingMetaData = () => {return {json: JSON.stringify(json).substring(0,1024)};};\r\n const error = new RealityDataError(RealityDataStatus.InvalidData, \"Invalid or unknown data - no root in json\", getMetaData);\r\n throw error;\r\n }\r\n try {\r\n if (undefined !== json?.root?.boundingVolume?.region) {\r\n const region = JsonUtils.asArray(json.root.boundingVolume.region);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.boundingVolume.region\", () => ({ ...region }));\r\n if (undefined === region) {\r\n Logger.logError(loggerCategory, `Error getSpatialLocationAndExtents - region undefined`);\r\n throw new TypeError(\"Unable to determine GeoLocation - no root Transform or Region on root.\");\r\n }\r\n const ecefLow = (Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();\r\n const ecefHigh = (Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();\r\n const ecefRange = Range3d.create(ecefLow, ecefHigh);\r\n const cartoCenter = Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });\r\n location = cartoCenter;\r\n const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n } else {\r\n let worldToEcefTransform = ThreeDTileFormatInterpreter.transformFromJson(json.root.transform);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.transform\", () => ({ ...worldToEcefTransform }));\r\n const range = ThreeDTileFormatInterpreter.rangeFromBoundingVolume(json.root.boundingVolume)!;\r\n if (undefined === worldToEcefTransform)\r\n worldToEcefTransform = Transform.createIdentity();\r\n\r\n const ecefRange = worldToEcefTransform.multiplyRange(range); // range in model -> range in ecef\r\n const ecefCenter = worldToEcefTransform.multiplyPoint3d(range.center); // range center in model -> range center in ecef\r\n const cartoCenter = Cartographic.fromEcef(ecefCenter); // ecef center to cartographic center\r\n const isNotNearEarthSurface = cartoCenter && (cartoCenter.height < -5000); // 5 km under ground!\r\n const earthCenterToRangeCenterRayLenght = range.center.magnitude();\r\n\r\n if (worldToEcefTransform.matrix.isIdentity && (earthCenterToRangeCenterRayLenght < 1.0E5 || isNotNearEarthSurface)) {\r\n isGeolocated = false;\r\n worldRange.extendRange(Range3d.fromJSON(ecefRange));\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, \"RealityData NOT Geolocated\", () => ({ ...location }));\r\n } else {\r\n let ecefLocation: EcefLocation;\r\n const locationOrientation = YawPitchRollAngles.tryFromTransform(worldToEcefTransform);\r\n // Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.\r\n // Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.\r\n if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)\r\n ecefLocation = new EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });\r\n else\r\n ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter!);\r\n location = ecefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData is worldToEcefTransform.matrix.isIdentity\", () => ({ isIdentity: worldToEcefTransform!.matrix.isIdentity }));\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n Logger.logTrace(loggerCategory, \"RealityData ecefToWorld\", () => ({ ...ecefToWorld }));\r\n }\r\n }\r\n } catch (e) {\r\n Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret json`);\r\n // return first 1024 char from the json\r\n const getMetaData: LoggingMetaData = () => {return {json: JSON.stringify(json).substring(0,1024)};};\r\n const error = new RealityDataError(RealityDataStatus.InvalidData, \"Invalid or unknown data\", getMetaData);\r\n throw error;\r\n }\r\n\r\n const spatialLocation: SpatialLocationAndExtents = { location, worldRange, isGeolocated };\r\n return spatialLocation;\r\n }\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public static getPublisherProductInfo(rootDocjson: any): PublisherProductInfo {\r\n const info: PublisherProductInfo = {product: \"\", engine: \"\", version: \"\"};\r\n if (rootDocjson && rootDocjson.root) {\r\n if (rootDocjson.root.SMPublisherInfo) {\r\n info.product = rootDocjson.root.SMPublisherInfo.Product ? rootDocjson.root.SMPublisherInfo.Product : \"\";\r\n info.engine = rootDocjson.root.SMPublisherInfo.Publisher ? rootDocjson.root.SMPublisherInfo.Publisher : \"\";\r\n info.version = rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] ? rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] : \"\" ;\r\n }\r\n }\r\n return info;\r\n }\r\n /** Gets information about 3dTile file for this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information about 3dTile file for this reality data\r\n * @internal\r\n */\r\n public static getFileInfo(rootDocjson: any): ThreeDTileFileInfo {\r\n const info: ThreeDTileFileInfo = {\r\n rootChildren: rootDocjson?.root?.children?.length ?? 0,\r\n };\r\n return info;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @param boundingVolume the bounding volume to convert\r\n * @returns the range or undefined if cannot convert\r\n * @internal\r\n */\r\n public static rangeFromBoundingVolume(boundingVolume: any): Range3d | undefined {\r\n if (undefined === boundingVolume)\r\n return undefined;\r\n if (Array.isArray(boundingVolume.box)) {\r\n const box: number[] = boundingVolume.box;\r\n const center = Point3d.create(box[0], box[1], box[2]);\r\n const ux = Vector3d.create(box[3], box[4], box[5]);\r\n const uy = Vector3d.create(box[6], box[7], box[8]);\r\n const uz = Vector3d.create(box[9], box[10], box[11]);\r\n const corners: Point3d[] = [];\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n for (let l = 0; l < 2; l++) {\r\n corners.push(center.plus3Scaled(ux, (j ? -1.0 : 1.0), uy, (k ? -1.0 : 1.0), uz, (l ? -1.0 : 1.0)));\r\n }\r\n }\r\n }\r\n return Range3d.createArray(corners);\r\n } else if (Array.isArray(boundingVolume.sphere)) {\r\n const sphere: number[] = boundingVolume.sphere;\r\n const center = Point3d.create(sphere[0], sphere[1], sphere[2]);\r\n const radius = sphere[3];\r\n return Range3d.createXYZXYZ(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius);\r\n }\r\n return undefined;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static maximumSizeFromGeometricTolerance(range: Range3d, geometricError: number): number {\r\n const minToleranceRatio = .5; // Nominally the error on screen size of a tile. Increasing generally increases performance (fewer draw calls) at expense of higher load times.\r\n return minToleranceRatio * range.diagonal().magnitude() / geometricError;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static transformFromJson(jTrans: number[] | undefined): Transform | undefined {\r\n return (jTrans === undefined) ? undefined : Transform.createOriginAndMatrix(Point3d.create(jTrans[12], jTrans[13], jTrans[14]), Matrix3d.createRowValues(jTrans[0], jTrans[4], jTrans[8], jTrans[1], jTrans[5], jTrans[9], jTrans[2], jTrans[6], jTrans[10]));\r\n }\r\n}\r\n"]}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
|
-
import { GuidString } from "@itwin/core-bentley";
|
|
4
|
+
import { BentleyError, GuidString, LoggingMetaData, RealityDataStatus } from "@itwin/core-bentley";
|
|
5
5
|
import { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from "@itwin/core-common";
|
|
6
6
|
import { Range3d } from "@itwin/core-geometry";
|
|
7
|
+
/**
|
|
8
|
+
* Reality Data Operation error
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export declare class RealityDataError extends BentleyError {
|
|
12
|
+
constructor(errorNumber: RealityDataStatus, message: string, getMetaData?: LoggingMetaData);
|
|
13
|
+
}
|
|
7
14
|
/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`
|
|
8
15
|
* @alpha
|
|
9
16
|
*/
|
|
@@ -66,6 +73,7 @@ export interface RealityDataSource {
|
|
|
66
73
|
/** Gets spatial location and extents of this reality data source.
|
|
67
74
|
* Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)
|
|
68
75
|
* @returns spatial location and extents
|
|
76
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
69
77
|
* @alpha
|
|
70
78
|
*/
|
|
71
79
|
getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSource.d.ts","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"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W,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAcxI;CACF"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Tiles
|
|
7
7
|
*/
|
|
8
|
-
import { Logger } from "@itwin/core-bentley";
|
|
8
|
+
import { BentleyError, Logger } from "@itwin/core-bentley";
|
|
9
9
|
import { RealityDataFormat, RealityDataProvider } from "@itwin/core-common";
|
|
10
10
|
import { FrontendLoggerCategory } from "./FrontendLoggerCategory";
|
|
11
11
|
import { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from "./tile/internal";
|
|
@@ -13,6 +13,15 @@ import { RealityDataSourceTilesetUrlImpl } from "./RealityDataSourceTilesetUrlIm
|
|
|
13
13
|
import { RealityDataSourceContextShareImpl } from "./RealityDataSourceContextShareImpl";
|
|
14
14
|
import { RealityDataSourceCesiumIonAssetImpl } from "./RealityDataSourceCesiumIonAssetImpl";
|
|
15
15
|
const loggerCategory = FrontendLoggerCategory.RealityData;
|
|
16
|
+
/**
|
|
17
|
+
* Reality Data Operation error
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export class RealityDataError extends BentleyError {
|
|
21
|
+
constructor(errorNumber, message, getMetaData) {
|
|
22
|
+
super(errorNumber, message, getMetaData);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
16
25
|
/** Utility functions for RealityDataSource
|
|
17
26
|
* @beta
|
|
18
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAA6D,iBAAiB,EAAE,mBAAmB,EAAwB,MAAM,oBAAoB,CAAC;AAC7J,OAA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MAAM,EAAE,GAAG,iBAAiB,CAAC,UAAU,EAAC,UAAU,CAAC,CAAC;QACpD,OAAO,EAAC,QAAQ,EAAE,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,iBAAiB,CAAC,UAAU,EAAE,EAAE,EAAC,CAAC;IAClG,CAAC;IAHe,yCAAuB,0BAGtC,CAAA;IACD;;;OAGG;IACI,KAAK,UAAU,OAAO,CAAC,WAAiC,EAAE,OAA+B;QAC9F,QAAO,WAAW,CAAC,QAAQ,EAAE;YAC3B,KAAK,mBAAmB,CAAC,cAAc;gBACrC,OAAO,mCAAmC,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YACjF,KAAK,mBAAmB,CAAC,UAAU;gBACjC,OAAO,+BAA+B,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7E,KAAK,mBAAmB,CAAC,YAAY;gBACnC,OAAO,iCAAiC,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC/E,KAAK,mBAAmB,CAAC,WAAW;gBAClC,OAAO,+BAA+B,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC7E;gBACE,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;SACpF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAdqB,yBAAO,UAc5B,CAAA;AACH,CAAC,EAzFgB,iBAAiB,KAAjB,iBAAiB,QAyFjC","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 Tiles\r\n */\r\nimport { GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from \"./tile/internal\";\r\nimport { RealityDataSourceTilesetUrlImpl } from \"./RealityDataSourceTilesetUrlImpl\";\r\nimport { RealityDataSourceContextShareImpl } from \"./RealityDataSourceContextShareImpl\";\r\nimport { RealityDataSourceCesiumIonAssetImpl } from \"./RealityDataSourceCesiumIonAssetImpl\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n\r\n/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @alpha\r\n */\r\nexport interface SpatialLocationAndExtents {\r\n /** location of the point at the center of the reaity data */\r\n location: Cartographic | EcefLocation;\r\n /** extents of the volume around location */\r\n worldRange: Range3d;\r\n /** true if this reality data is geolocated\r\n * A reality data is geolocated when we can compute a valid position relative to the earth surface.\r\n * Note that some reality data contains custom coordinate system without any information on the relative position on earth.\r\n * These reality data will have a location and worldRange but will be identified by the isGeoLocated set to false.\r\n */\r\n isGeolocated: boolean;\r\n}\r\n\r\n/** This interface provides information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\nexport interface PublisherProductInfo {\r\n /** product that create this reality data */\r\n product: string;\r\n /** engine that create this reality data */\r\n engine: string;\r\n /** the version of the engine that create this reality data */\r\n version: string;\r\n}\r\n\r\n/** This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /** This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /** Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /** Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /** Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n /** Gets spatial location and extents of this reality data source.\r\n * Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)\r\n * @returns spatial location and extents\r\n * @alpha\r\n */\r\n getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /** Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex + 2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** @internal - Is used by \"fdt attach cesium asset\" keyin*/\r\n export function createCesiumIonAssetKey(osmAssetId: number, requestKey: string): RealityDataSourceKey {\r\n const id = getCesiumAssetUrl(osmAssetId,requestKey);\r\n return {provider: RealityDataProvider.CesiumIonAsset, format: RealityDataFormat.ThreeDTile, id};\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @alpha\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n switch(rdSourceKey.provider) {\r\n case RealityDataProvider.CesiumIonAsset:\r\n return RealityDataSourceCesiumIonAssetImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.TilesetUrl:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.ContextShare:\r\n return RealityDataSourceContextShareImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.OrbitGtBlob:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n default:\r\n Logger.logError(loggerCategory, `Error realityModelFromJson - region undefined`);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n"]}
|
|
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C;SACpF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAdqB,yBAAO,UAc5B,CAAA;AACH,CAAC,EAzFgB,iBAAiB,KAAjB,iBAAiB,QAyFjC","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 Tiles\r\n */\r\nimport { BentleyError, GuidString, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from \"./tile/internal\";\r\nimport { RealityDataSourceTilesetUrlImpl } from \"./RealityDataSourceTilesetUrlImpl\";\r\nimport { RealityDataSourceContextShareImpl } from \"./RealityDataSourceContextShareImpl\";\r\nimport { RealityDataSourceCesiumIonAssetImpl } from \"./RealityDataSourceCesiumIonAssetImpl\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n\r\n/**\r\n * Reality Data Operation error\r\n * @alpha\r\n */\r\nexport class RealityDataError extends BentleyError {\r\n public constructor(errorNumber: RealityDataStatus, message: string, getMetaData?: LoggingMetaData) {\r\n super(errorNumber, message, getMetaData);\r\n }\r\n}\r\n\r\n/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @alpha\r\n */\r\nexport interface SpatialLocationAndExtents {\r\n /** location of the point at the center of the reaity data */\r\n location: Cartographic | EcefLocation;\r\n /** extents of the volume around location */\r\n worldRange: Range3d;\r\n /** true if this reality data is geolocated\r\n * A reality data is geolocated when we can compute a valid position relative to the earth surface.\r\n * Note that some reality data contains custom coordinate system without any information on the relative position on earth.\r\n * These reality data will have a location and worldRange but will be identified by the isGeoLocated set to false.\r\n */\r\n isGeolocated: boolean;\r\n}\r\n\r\n/** This interface provides information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\nexport interface PublisherProductInfo {\r\n /** product that create this reality data */\r\n product: string;\r\n /** engine that create this reality data */\r\n engine: string;\r\n /** the version of the engine that create this reality data */\r\n version: string;\r\n}\r\n\r\n/** This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /** This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /** Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /** Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /** Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n /** Gets spatial location and extents of this reality data source.\r\n * Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)\r\n * @returns spatial location and extents\r\n * @throws [[RealityDataError]] if source is invalid or cannot be read\r\n * @alpha\r\n */\r\n getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /** Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex + 2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** @internal - Is used by \"fdt attach cesium asset\" keyin*/\r\n export function createCesiumIonAssetKey(osmAssetId: number, requestKey: string): RealityDataSourceKey {\r\n const id = getCesiumAssetUrl(osmAssetId,requestKey);\r\n return {provider: RealityDataProvider.CesiumIonAsset, format: RealityDataFormat.ThreeDTile, id};\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @alpha\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n switch(rdSourceKey.provider) {\r\n case RealityDataProvider.CesiumIonAsset:\r\n return RealityDataSourceCesiumIonAssetImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.TilesetUrl:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.ContextShare:\r\n return RealityDataSourceContextShareImpl.createFromKey(rdSourceKey, iTwinId);\r\n case RealityDataProvider.OrbitGtBlob:\r\n return RealityDataSourceTilesetUrlImpl.createFromKey(rdSourceKey, iTwinId);\r\n default:\r\n Logger.logError(loggerCategory, `Error realityModelFromJson - region undefined`);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -14,6 +14,7 @@ export declare class OPCFormatInterpreter {
|
|
|
14
14
|
/** Gets reality data spatial location and extents
|
|
15
15
|
* @param fileReader a file reader instance obtains from call to getFileReaderFromBlobFileURL
|
|
16
16
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
17
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
17
18
|
* @internal
|
|
18
19
|
*/
|
|
19
20
|
static getSpatialLocationAndExtents(fileReader: PointCloudReader): Promise<SpatialLocationAndExtents>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyF,gBAAgB,EAAS,MAAM,qBAAqB,CAAC;AAIrJ,OAAO,
|
|
1
|
+
{"version":3,"file":"OPCFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/OPCFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyF,gBAAgB,EAAS,MAAM,qBAAqB,CAAC;AAIrJ,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"}
|
|
@@ -7,7 +7,8 @@ import { Range3d } from "@itwin/core-geometry";
|
|
|
7
7
|
import { CRSManager, Downloader, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, UrlFS } from "@itwin/core-orbitgt";
|
|
8
8
|
import { FrontendLoggerCategory } from "../FrontendLoggerCategory";
|
|
9
9
|
import { DownloaderNode } from "@itwin/core-orbitgt/lib/cjs/system/runtime/DownloaderNode";
|
|
10
|
-
import { Logger } from "@itwin/core-bentley";
|
|
10
|
+
import { BentleyError, Logger, RealityDataStatus } from "@itwin/core-bentley";
|
|
11
|
+
import { RealityDataError } from "../RealityDataSource";
|
|
11
12
|
const loggerCategory = FrontendLoggerCategory.RealityData;
|
|
12
13
|
/**
|
|
13
14
|
* This class provide methods used to interpret Orbit Point Cloud (OPC) format
|
|
@@ -37,6 +38,7 @@ export class OPCFormatInterpreter {
|
|
|
37
38
|
/** Gets reality data spatial location and extents
|
|
38
39
|
* @param fileReader a file reader instance obtains from call to getFileReaderFromBlobFileURL
|
|
39
40
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
41
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
40
42
|
* @internal
|
|
41
43
|
*/
|
|
42
44
|
static async getSpatialLocationAndExtents(fileReader) {
|
|
@@ -48,20 +50,29 @@ export class OPCFormatInterpreter {
|
|
|
48
50
|
isGeolocated = false;
|
|
49
51
|
const fileCrs = fileReader.getFileCRS();
|
|
50
52
|
if (fileCrs) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
try {
|
|
54
|
+
await CRSManager.ENGINE.prepareForArea(fileCrs, bounds);
|
|
55
|
+
const wgs84ECEFCrs = "4978";
|
|
56
|
+
await CRSManager.ENGINE.prepareForArea(wgs84ECEFCrs, new OrbitGtBounds());
|
|
57
|
+
const ecefBounds = CRSManager.transformBounds(bounds, fileCrs, wgs84ECEFCrs);
|
|
58
|
+
const ecefRange = Range3d.createXYZXYZ(ecefBounds.getMinX(), ecefBounds.getMinY(), ecefBounds.getMinZ(), ecefBounds.getMaxX(), ecefBounds.getMaxY(), ecefBounds.getMaxZ());
|
|
59
|
+
const ecefCenter = ecefRange.localXYZToWorld(.5, .5, .5);
|
|
60
|
+
const cartoCenter = Cartographic.fromEcef(ecefCenter);
|
|
61
|
+
cartoCenter.height = 0;
|
|
62
|
+
const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
63
|
+
location = ecefLocation;
|
|
64
|
+
// this.iModelDb.setEcefLocation(ecefLocation);
|
|
65
|
+
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
66
|
+
worldRange = ecefToWorld.multiplyRange(ecefRange);
|
|
67
|
+
isGeolocated = true;
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret point cloud`);
|
|
71
|
+
const errorProps = BentleyError.getErrorProps(e);
|
|
72
|
+
const getMetaData = () => { return { errorProps }; };
|
|
73
|
+
const error = new RealityDataError(RealityDataStatus.InvalidData, "Invalid or unknown data", getMetaData);
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
65
76
|
}
|
|
66
77
|
else {
|
|
67
78
|
// NoGCS case
|
|
@@ -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;AACrJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,2DAA2D,CAAC;AAC3F,OAAO,EAAE,MAAM,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,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAoB,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACrJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,2DAA2D,CAAC;AAC3F,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;A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,CAAC;aACrB;YAAC,OAAO,CAAC,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, OnlineEngine, OPCReader, OrbitGtBounds, PageCachedFile, PointCloudReader, UrlFS } from \"@itwin/core-orbitgt\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { DownloaderNode } from \"@itwin/core-orbitgt/lib/cjs/system/runtime/DownloaderNode\";\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 DownloaderNode();\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"]}
|
|
@@ -16,6 +16,7 @@ export declare class ThreeDTileFormatInterpreter {
|
|
|
16
16
|
/** Gets reality data spatial location and extents
|
|
17
17
|
* @param json root document file in json format
|
|
18
18
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
19
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
19
20
|
* @internal
|
|
20
21
|
*/
|
|
21
22
|
static getSpatialLocationAndExtents(json: any): SpatialLocationAndExtents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDTileFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,OAAO,EAAE,SAAS,EAAgC,MAAM,sBAAsB,CAAC;AAE3G,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ThreeDTileFormatInterpreter.d.ts","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,OAAO,EAAE,SAAS,EAAgC,MAAM,sBAAsB,CAAC;AAE3G,OAAO,EAAE,oBAAoB,EAAoB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGzG;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD;;;GAGG;AACH,qBAAa,2BAA2B;IACtC;;;;;OAKG;WACW,4BAA4B,CAAC,IAAI,EAAE,GAAG,GAAG,yBAAyB;IA8EhF;;;;;OAKG;WACW,uBAAuB,CAAC,WAAW,EAAE,GAAG,GAAG,oBAAoB;IAW7E;;;;;OAKG;WACW,WAAW,CAAC,WAAW,EAAE,GAAG,GAAG,kBAAkB;IAM/D;;;;OAIG;WACW,uBAAuB,CAAC,cAAc,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS;IA0B/E;;OAEG;WACW,iCAAiC,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;IAI/F;;OAEG;WACW,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;CAGrF"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { JsonUtils, Logger } from "@itwin/core-bentley";
|
|
5
|
+
import { JsonUtils, Logger, RealityDataStatus } from "@itwin/core-bentley";
|
|
6
6
|
import { Cartographic, EcefLocation } from "@itwin/core-common";
|
|
7
7
|
import { Matrix3d, Point3d, Range3d, Transform, Vector3d, YawPitchRollAngles } from "@itwin/core-geometry";
|
|
8
8
|
import { FrontendLoggerCategory } from "../FrontendLoggerCategory";
|
|
9
|
+
import { RealityDataError } from "../RealityDataSource";
|
|
9
10
|
const loggerCategory = FrontendLoggerCategory.RealityData;
|
|
10
11
|
/**
|
|
11
12
|
* This class provide methods used to interpret Cesium 3dTile format
|
|
@@ -15,64 +16,82 @@ export class ThreeDTileFormatInterpreter {
|
|
|
15
16
|
/** Gets reality data spatial location and extents
|
|
16
17
|
* @param json root document file in json format
|
|
17
18
|
* @returns spatial location and volume of interest, in meters, centered around `spatial location`
|
|
19
|
+
* @throws [[RealityDataError]] if source is invalid or cannot be read
|
|
18
20
|
* @internal
|
|
19
21
|
*/
|
|
20
22
|
static getSpatialLocationAndExtents(json) {
|
|
23
|
+
var _a, _b;
|
|
21
24
|
const worldRange = new Range3d();
|
|
22
25
|
let isGeolocated = true;
|
|
23
26
|
let location;
|
|
24
|
-
Logger.logTrace(loggerCategory, "RealityData
|
|
25
|
-
if (undefined
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
const ecefLow = (Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();
|
|
33
|
-
const ecefHigh = (Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();
|
|
34
|
-
const ecefRange = Range3d.create(ecefLow, ecefHigh);
|
|
35
|
-
const cartoCenter = Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });
|
|
36
|
-
location = cartoCenter;
|
|
37
|
-
const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
38
|
-
// iModelDb.setEcefLocation(ecefLocation);
|
|
39
|
-
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
40
|
-
worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));
|
|
27
|
+
Logger.logTrace(loggerCategory, "RealityData getSpatialLocationAndExtents");
|
|
28
|
+
if (undefined === (json === null || json === void 0 ? void 0 : json.root)) {
|
|
29
|
+
Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - no root in json`);
|
|
30
|
+
// return first 1024 char from the json
|
|
31
|
+
const getMetaData = () => { return { json: JSON.stringify(json).substring(0, 1024) }; };
|
|
32
|
+
const error = new RealityDataError(RealityDataStatus.InvalidData, "Invalid or unknown data - no root in json", getMetaData);
|
|
33
|
+
throw error;
|
|
41
34
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const centerOfEarth = new EcefLocation({ origin: { x: 0.0, y: 0.0, z: 0.0 }, orientation: { yaw: 0.0, pitch: 0.0, roll: 0.0 } });
|
|
57
|
-
location = centerOfEarth;
|
|
58
|
-
Logger.logTrace(loggerCategory, "RealityData NOT Geolocated", () => ({ ...location }));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
let ecefLocation;
|
|
62
|
-
const locationOrientation = YawPitchRollAngles.tryFromTransform(worldToEcefTransform);
|
|
63
|
-
// Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.
|
|
64
|
-
// Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.
|
|
65
|
-
if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)
|
|
66
|
-
ecefLocation = new EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });
|
|
67
|
-
else
|
|
68
|
-
ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
69
|
-
location = ecefLocation;
|
|
70
|
-
Logger.logTrace(loggerCategory, "RealityData is worldToEcefTransform.matrix.isIdentity", () => ({ isIdentity: worldToEcefTransform.matrix.isIdentity }));
|
|
35
|
+
try {
|
|
36
|
+
if (undefined !== ((_b = (_a = json === null || json === void 0 ? void 0 : json.root) === null || _a === void 0 ? void 0 : _a.boundingVolume) === null || _b === void 0 ? void 0 : _b.region)) {
|
|
37
|
+
const region = JsonUtils.asArray(json.root.boundingVolume.region);
|
|
38
|
+
Logger.logTrace(loggerCategory, "RealityData json.root.boundingVolume.region", () => ({ ...region }));
|
|
39
|
+
if (undefined === region) {
|
|
40
|
+
Logger.logError(loggerCategory, `Error getSpatialLocationAndExtents - region undefined`);
|
|
41
|
+
throw new TypeError("Unable to determine GeoLocation - no root Transform or Region on root.");
|
|
42
|
+
}
|
|
43
|
+
const ecefLow = (Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();
|
|
44
|
+
const ecefHigh = (Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();
|
|
45
|
+
const ecefRange = Range3d.create(ecefLow, ecefHigh);
|
|
46
|
+
const cartoCenter = Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });
|
|
47
|
+
location = cartoCenter;
|
|
48
|
+
const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
71
49
|
// iModelDb.setEcefLocation(ecefLocation);
|
|
72
50
|
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
73
51
|
worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));
|
|
74
|
-
Logger.logTrace(loggerCategory, "RealityData ecefToWorld", () => ({ ...ecefToWorld }));
|
|
75
52
|
}
|
|
53
|
+
else {
|
|
54
|
+
let worldToEcefTransform = ThreeDTileFormatInterpreter.transformFromJson(json.root.transform);
|
|
55
|
+
Logger.logTrace(loggerCategory, "RealityData json.root.transform", () => ({ ...worldToEcefTransform }));
|
|
56
|
+
const range = ThreeDTileFormatInterpreter.rangeFromBoundingVolume(json.root.boundingVolume);
|
|
57
|
+
if (undefined === worldToEcefTransform)
|
|
58
|
+
worldToEcefTransform = Transform.createIdentity();
|
|
59
|
+
const ecefRange = worldToEcefTransform.multiplyRange(range); // range in model -> range in ecef
|
|
60
|
+
const ecefCenter = worldToEcefTransform.multiplyPoint3d(range.center); // range center in model -> range center in ecef
|
|
61
|
+
const cartoCenter = Cartographic.fromEcef(ecefCenter); // ecef center to cartographic center
|
|
62
|
+
const isNotNearEarthSurface = cartoCenter && (cartoCenter.height < -5000); // 5 km under ground!
|
|
63
|
+
const earthCenterToRangeCenterRayLenght = range.center.magnitude();
|
|
64
|
+
if (worldToEcefTransform.matrix.isIdentity && (earthCenterToRangeCenterRayLenght < 1.0E5 || isNotNearEarthSurface)) {
|
|
65
|
+
isGeolocated = false;
|
|
66
|
+
worldRange.extendRange(Range3d.fromJSON(ecefRange));
|
|
67
|
+
const centerOfEarth = new EcefLocation({ origin: { x: 0.0, y: 0.0, z: 0.0 }, orientation: { yaw: 0.0, pitch: 0.0, roll: 0.0 } });
|
|
68
|
+
location = centerOfEarth;
|
|
69
|
+
Logger.logTrace(loggerCategory, "RealityData NOT Geolocated", () => ({ ...location }));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
let ecefLocation;
|
|
73
|
+
const locationOrientation = YawPitchRollAngles.tryFromTransform(worldToEcefTransform);
|
|
74
|
+
// Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.
|
|
75
|
+
// Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.
|
|
76
|
+
if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)
|
|
77
|
+
ecefLocation = new EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });
|
|
78
|
+
else
|
|
79
|
+
ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);
|
|
80
|
+
location = ecefLocation;
|
|
81
|
+
Logger.logTrace(loggerCategory, "RealityData is worldToEcefTransform.matrix.isIdentity", () => ({ isIdentity: worldToEcefTransform.matrix.isIdentity }));
|
|
82
|
+
// iModelDb.setEcefLocation(ecefLocation);
|
|
83
|
+
const ecefToWorld = ecefLocation.getTransform().inverse();
|
|
84
|
+
worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));
|
|
85
|
+
Logger.logTrace(loggerCategory, "RealityData ecefToWorld", () => ({ ...ecefToWorld }));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret json`);
|
|
91
|
+
// return first 1024 char from the json
|
|
92
|
+
const getMetaData = () => { return { json: JSON.stringify(json).substring(0, 1024) }; };
|
|
93
|
+
const error = new RealityDataError(RealityDataStatus.InvalidData, "Invalid or unknown data", getMetaData);
|
|
94
|
+
throw error;
|
|
76
95
|
}
|
|
77
96
|
const spatialLocation = { location, worldRange, isGeolocated };
|
|
78
97
|
return spatialLocation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDTileFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,MAAM,cAAc,GAAW,sBAAsB,CAAC,WAAW,CAAC;AASlE;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IACtC;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAS;QAClD,MAAM,UAAU,GAAG,IAAI,OAAO,EAAE,CAAC;QACjC,IAAI,YAAY,GAAG,IAAI,CAAC;QACxB,IAAI,QAAqC,CAAC;QAC1C,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,kCAAkC,CAAC,CAAC;QAEpE,IAAI,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;YACjD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAElE,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6CAA6C,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GA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AC;IACD;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAAC,MAA4B;QAC1D,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChQ,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 { JsonUtils, Logger } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation } from \"@itwin/core-common\";\r\nimport { Matrix3d, Point3d, Range3d, Transform, Vector3d, YawPitchRollAngles } from \"@itwin/core-geometry\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { PublisherProductInfo, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n/** This interface provides information about 3dTile files for this reality data\r\n * Currently only used for debbugging\r\n * @internal\r\n */\r\nexport interface ThreeDTileFileInfo {\r\n /** the number of children at the root of this reality data */\r\n rootChildren?: number;\r\n}\r\n/**\r\n * This class provide methods used to interpret Cesium 3dTile format\r\n * @internal\r\n */\r\nexport class ThreeDTileFormatInterpreter {\r\n /** Gets reality data spatial location and extents\r\n * @param json root document file in json format\r\n * @returns spatial location and volume of interest, in meters, centered around `spatial location`\r\n * @internal\r\n */\r\n public static getSpatialLocationAndExtents(json: any): SpatialLocationAndExtents {\r\n const worldRange = new Range3d();\r\n let isGeolocated = true;\r\n let location: Cartographic | EcefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData realityModelFromJson\");\r\n\r\n if (undefined !== json.root.boundingVolume.region) {\r\n const region = JsonUtils.asArray(json.root.boundingVolume.region);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.boundingVolume.region\", () => ({ ...region }));\r\n if (undefined === region) {\r\n Logger.logError(loggerCategory, `Error realityModelFromJson - region undefined`);\r\n throw new TypeError(\"Unable to determine GeoLocation - no root Transform or Region on root.\");\r\n }\r\n const ecefLow = (Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();\r\n const ecefHigh = (Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();\r\n const ecefRange = Range3d.create(ecefLow, ecefHigh);\r\n const cartoCenter = Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });\r\n location = cartoCenter;\r\n const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n } else {\r\n let worldToEcefTransform = ThreeDTileFormatInterpreter.transformFromJson(json.root.transform);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.transform\", () => ({ ...worldToEcefTransform }));\r\n const range = ThreeDTileFormatInterpreter.rangeFromBoundingVolume(json.root.boundingVolume)!;\r\n if (undefined === worldToEcefTransform)\r\n worldToEcefTransform = Transform.createIdentity();\r\n\r\n const ecefRange = worldToEcefTransform.multiplyRange(range); // range in model -> range in ecef\r\n const ecefCenter = worldToEcefTransform.multiplyPoint3d(range.center); // range center in model -> range center in ecef\r\n const cartoCenter = Cartographic.fromEcef(ecefCenter); // ecef center to cartographic center\r\n const isNotNearEarthSurface = cartoCenter && (cartoCenter.height < -5000); // 5 km under ground!\r\n const earthCenterToRangeCenterRayLenght = range.center.magnitude();\r\n\r\n if (worldToEcefTransform.matrix.isIdentity && (earthCenterToRangeCenterRayLenght < 1.0E5 || isNotNearEarthSurface)) {\r\n isGeolocated = false;\r\n worldRange.extendRange(Range3d.fromJSON(ecefRange));\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, \"RealityData NOT Geolocated\", () => ({ ...location }));\r\n } else {\r\n let ecefLocation: EcefLocation;\r\n const locationOrientation = YawPitchRollAngles.tryFromTransform(worldToEcefTransform);\r\n // Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.\r\n // Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.\r\n if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)\r\n ecefLocation = new EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });\r\n else\r\n ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter!);\r\n location = ecefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData is worldToEcefTransform.matrix.isIdentity\", () => ({ isIdentity: worldToEcefTransform!.matrix.isIdentity }));\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n Logger.logTrace(loggerCategory, \"RealityData ecefToWorld\", () => ({ ...ecefToWorld }));\r\n }\r\n }\r\n const spatialLocation: SpatialLocationAndExtents = { location, worldRange, isGeolocated };\r\n return spatialLocation;\r\n }\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public static getPublisherProductInfo(rootDocjson: any): PublisherProductInfo {\r\n const info: PublisherProductInfo = {product: \"\", engine: \"\", version: \"\"};\r\n if (rootDocjson && rootDocjson.root) {\r\n if (rootDocjson.root.SMPublisherInfo) {\r\n info.product = rootDocjson.root.SMPublisherInfo.Product ? rootDocjson.root.SMPublisherInfo.Product : \"\";\r\n info.engine = rootDocjson.root.SMPublisherInfo.Publisher ? rootDocjson.root.SMPublisherInfo.Publisher : \"\";\r\n info.version = rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] ? rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] : \"\" ;\r\n }\r\n }\r\n return info;\r\n }\r\n /** Gets information about 3dTile file for this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information about 3dTile file for this reality data\r\n * @internal\r\n */\r\n public static getFileInfo(rootDocjson: any): ThreeDTileFileInfo {\r\n const info: ThreeDTileFileInfo = {\r\n rootChildren: rootDocjson?.root?.children?.length ?? 0,\r\n };\r\n return info;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @param boundingVolume the bounding volume to convert\r\n * @returns the range or undefined if cannot convert\r\n * @internal\r\n */\r\n public static rangeFromBoundingVolume(boundingVolume: any): Range3d | undefined {\r\n if (undefined === boundingVolume)\r\n return undefined;\r\n if (Array.isArray(boundingVolume.box)) {\r\n const box: number[] = boundingVolume.box;\r\n const center = Point3d.create(box[0], box[1], box[2]);\r\n const ux = Vector3d.create(box[3], box[4], box[5]);\r\n const uy = Vector3d.create(box[6], box[7], box[8]);\r\n const uz = Vector3d.create(box[9], box[10], box[11]);\r\n const corners: Point3d[] = [];\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n for (let l = 0; l < 2; l++) {\r\n corners.push(center.plus3Scaled(ux, (j ? -1.0 : 1.0), uy, (k ? -1.0 : 1.0), uz, (l ? -1.0 : 1.0)));\r\n }\r\n }\r\n }\r\n return Range3d.createArray(corners);\r\n } else if (Array.isArray(boundingVolume.sphere)) {\r\n const sphere: number[] = boundingVolume.sphere;\r\n const center = Point3d.create(sphere[0], sphere[1], sphere[2]);\r\n const radius = sphere[3];\r\n return Range3d.createXYZXYZ(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius);\r\n }\r\n return undefined;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static maximumSizeFromGeometricTolerance(range: Range3d, geometricError: number): number {\r\n const minToleranceRatio = .5; // Nominally the error on screen size of a tile. Increasing generally increases performance (fewer draw calls) at expense of higher load times.\r\n return minToleranceRatio * range.diagonal().magnitude() / geometricError;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static transformFromJson(jTrans: number[] | undefined): Transform | undefined {\r\n return (jTrans === undefined) ? undefined : Transform.createOriginAndMatrix(Point3d.create(jTrans[12], jTrans[13], jTrans[14]), Matrix3d.createRowValues(jTrans[0], jTrans[4], jTrans[8], jTrans[1], jTrans[5], jTrans[9], jTrans[2], jTrans[6], jTrans[10]));\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ThreeDTileFormatInterpreter.js","sourceRoot":"","sources":["../../../src/tile/ThreeDTileFormatInterpreter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,EAAmB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAA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GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;SAC/I;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACI,MAAM,CAAC,iCAAiC,CAAC,KAAc,EAAE,cAAsB;QACpF,MAAM,iBAAiB,GAAG,EAAE,CAAC,CAAG,gJAAgJ;QAChL,OAAO,iBAAiB,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,GAAG,cAAc,CAAC;IAC3E,CAAC;IACD;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAAC,MAA4B;QAC1D,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChQ,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 { JsonUtils, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\r\nimport { Cartographic, EcefLocation } from \"@itwin/core-common\";\r\nimport { Matrix3d, Point3d, Range3d, Transform, Vector3d, YawPitchRollAngles } from \"@itwin/core-geometry\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { PublisherProductInfo, RealityDataError, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\n\r\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\r\n/** This interface provides information about 3dTile files for this reality data\r\n * Currently only used for debbugging\r\n * @internal\r\n */\r\nexport interface ThreeDTileFileInfo {\r\n /** the number of children at the root of this reality data */\r\n rootChildren?: number;\r\n}\r\n/**\r\n * This class provide methods used to interpret Cesium 3dTile format\r\n * @internal\r\n */\r\nexport class ThreeDTileFormatInterpreter {\r\n /** Gets reality data spatial location and extents\r\n * @param json root document file in json format\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 getSpatialLocationAndExtents(json: any): SpatialLocationAndExtents {\r\n const worldRange = new Range3d();\r\n let isGeolocated = true;\r\n let location: Cartographic | EcefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData getSpatialLocationAndExtents\");\r\n if (undefined === json?.root) {\r\n Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - no root in json`);\r\n // return first 1024 char from the json\r\n const getMetaData: LoggingMetaData = () => {return {json: JSON.stringify(json).substring(0,1024)};};\r\n const error = new RealityDataError(RealityDataStatus.InvalidData, \"Invalid or unknown data - no root in json\", getMetaData);\r\n throw error;\r\n }\r\n try {\r\n if (undefined !== json?.root?.boundingVolume?.region) {\r\n const region = JsonUtils.asArray(json.root.boundingVolume.region);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.boundingVolume.region\", () => ({ ...region }));\r\n if (undefined === region) {\r\n Logger.logError(loggerCategory, `Error getSpatialLocationAndExtents - region undefined`);\r\n throw new TypeError(\"Unable to determine GeoLocation - no root Transform or Region on root.\");\r\n }\r\n const ecefLow = (Cartographic.fromRadians({ longitude: region[0], latitude: region[1], height: region[4] })).toEcef();\r\n const ecefHigh = (Cartographic.fromRadians({ longitude: region[2], latitude: region[3], height: region[5] })).toEcef();\r\n const ecefRange = Range3d.create(ecefLow, ecefHigh);\r\n const cartoCenter = Cartographic.fromRadians({ longitude: (region[0] + region[2]) / 2.0, latitude: (region[1] + region[3]) / 2.0, height: (region[4] + region[5]) / 2.0 });\r\n location = cartoCenter;\r\n const ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter);\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n } else {\r\n let worldToEcefTransform = ThreeDTileFormatInterpreter.transformFromJson(json.root.transform);\r\n\r\n Logger.logTrace(loggerCategory, \"RealityData json.root.transform\", () => ({ ...worldToEcefTransform }));\r\n const range = ThreeDTileFormatInterpreter.rangeFromBoundingVolume(json.root.boundingVolume)!;\r\n if (undefined === worldToEcefTransform)\r\n worldToEcefTransform = Transform.createIdentity();\r\n\r\n const ecefRange = worldToEcefTransform.multiplyRange(range); // range in model -> range in ecef\r\n const ecefCenter = worldToEcefTransform.multiplyPoint3d(range.center); // range center in model -> range center in ecef\r\n const cartoCenter = Cartographic.fromEcef(ecefCenter); // ecef center to cartographic center\r\n const isNotNearEarthSurface = cartoCenter && (cartoCenter.height < -5000); // 5 km under ground!\r\n const earthCenterToRangeCenterRayLenght = range.center.magnitude();\r\n\r\n if (worldToEcefTransform.matrix.isIdentity && (earthCenterToRangeCenterRayLenght < 1.0E5 || isNotNearEarthSurface)) {\r\n isGeolocated = false;\r\n worldRange.extendRange(Range3d.fromJSON(ecefRange));\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, \"RealityData NOT Geolocated\", () => ({ ...location }));\r\n } else {\r\n let ecefLocation: EcefLocation;\r\n const locationOrientation = YawPitchRollAngles.tryFromTransform(worldToEcefTransform);\r\n // Fix Bug 445630: [RDV][Regression] Orientation of georeferenced Reality Mesh is wrong.\r\n // Use json.root.transform only if defined and not identity -> otherwise will use a transform computed from cartographic center.\r\n if (!worldToEcefTransform.matrix.isIdentity && locationOrientation !== undefined && locationOrientation.angles !== undefined)\r\n ecefLocation = new EcefLocation({ origin: locationOrientation.origin, orientation: locationOrientation.angles.toJSON() });\r\n else\r\n ecefLocation = EcefLocation.createFromCartographicOrigin(cartoCenter!);\r\n location = ecefLocation;\r\n Logger.logTrace(loggerCategory, \"RealityData is worldToEcefTransform.matrix.isIdentity\", () => ({ isIdentity: worldToEcefTransform!.matrix.isIdentity }));\r\n // iModelDb.setEcefLocation(ecefLocation);\r\n const ecefToWorld = ecefLocation.getTransform().inverse()!;\r\n worldRange.extendRange(Range3d.fromJSON(ecefToWorld.multiplyRange(ecefRange)));\r\n Logger.logTrace(loggerCategory, \"RealityData ecefToWorld\", () => ({ ...ecefToWorld }));\r\n }\r\n }\r\n } catch (e) {\r\n Logger.logWarning(loggerCategory, `Error getSpatialLocationAndExtents - cannot interpret json`);\r\n // return first 1024 char from the json\r\n const getMetaData: LoggingMetaData = () => {return {json: JSON.stringify(json).substring(0,1024)};};\r\n const error = new RealityDataError(RealityDataStatus.InvalidData, \"Invalid or unknown data\", getMetaData);\r\n throw error;\r\n }\r\n\r\n const spatialLocation: SpatialLocationAndExtents = { location, worldRange, isGeolocated };\r\n return spatialLocation;\r\n }\r\n /** Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public static getPublisherProductInfo(rootDocjson: any): PublisherProductInfo {\r\n const info: PublisherProductInfo = {product: \"\", engine: \"\", version: \"\"};\r\n if (rootDocjson && rootDocjson.root) {\r\n if (rootDocjson.root.SMPublisherInfo) {\r\n info.product = rootDocjson.root.SMPublisherInfo.Product ? rootDocjson.root.SMPublisherInfo.Product : \"\";\r\n info.engine = rootDocjson.root.SMPublisherInfo.Publisher ? rootDocjson.root.SMPublisherInfo.Publisher : \"\";\r\n info.version = rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] ? rootDocjson.root.SMPublisherInfo[\"Publisher Version\"] : \"\" ;\r\n }\r\n }\r\n return info;\r\n }\r\n /** Gets information about 3dTile file for this reality data\r\n * Will return undefined if cannot be resolved\r\n * @param rootDocjson root document file in json format\r\n * @returns information about 3dTile file for this reality data\r\n * @internal\r\n */\r\n public static getFileInfo(rootDocjson: any): ThreeDTileFileInfo {\r\n const info: ThreeDTileFileInfo = {\r\n rootChildren: rootDocjson?.root?.children?.length ?? 0,\r\n };\r\n return info;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @param boundingVolume the bounding volume to convert\r\n * @returns the range or undefined if cannot convert\r\n * @internal\r\n */\r\n public static rangeFromBoundingVolume(boundingVolume: any): Range3d | undefined {\r\n if (undefined === boundingVolume)\r\n return undefined;\r\n if (Array.isArray(boundingVolume.box)) {\r\n const box: number[] = boundingVolume.box;\r\n const center = Point3d.create(box[0], box[1], box[2]);\r\n const ux = Vector3d.create(box[3], box[4], box[5]);\r\n const uy = Vector3d.create(box[6], box[7], box[8]);\r\n const uz = Vector3d.create(box[9], box[10], box[11]);\r\n const corners: Point3d[] = [];\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n for (let l = 0; l < 2; l++) {\r\n corners.push(center.plus3Scaled(ux, (j ? -1.0 : 1.0), uy, (k ? -1.0 : 1.0), uz, (l ? -1.0 : 1.0)));\r\n }\r\n }\r\n }\r\n return Range3d.createArray(corners);\r\n } else if (Array.isArray(boundingVolume.sphere)) {\r\n const sphere: number[] = boundingVolume.sphere;\r\n const center = Point3d.create(sphere[0], sphere[1], sphere[2]);\r\n const radius = sphere[3];\r\n return Range3d.createXYZXYZ(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius);\r\n }\r\n return undefined;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static maximumSizeFromGeometricTolerance(range: Range3d, geometricError: number): number {\r\n const minToleranceRatio = .5; // Nominally the error on screen size of a tile. Increasing generally increases performance (fewer draw calls) at expense of higher load times.\r\n return minToleranceRatio * range.diagonal().magnitude() / geometricError;\r\n }\r\n /** Convert a boundingVolume into a range\r\n * @internal\r\n */\r\n public static transformFromJson(jTrans: number[] | undefined): Transform | undefined {\r\n return (jTrans === undefined) ? undefined : Transform.createOriginAndMatrix(Point3d.create(jTrans[12], jTrans[13], jTrans[14]), Matrix3d.createRowValues(jTrans[0], jTrans[4], jTrans[8], jTrans[1], jTrans[5], jTrans[9], jTrans[2], jTrans[6], jTrans[10]));\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.1.0-dev.
|
|
3
|
+
"version": "3.1.0-dev.31",
|
|
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.1.0-dev.
|
|
27
|
-
"@itwin/core-bentley": "^3.1.0-dev.
|
|
28
|
-
"@itwin/core-common": "^3.1.0-dev.
|
|
29
|
-
"@itwin/core-geometry": "^3.1.0-dev.
|
|
30
|
-
"@itwin/core-orbitgt": "^3.1.0-dev.
|
|
31
|
-
"@itwin/core-quantity": "^3.1.0-dev.
|
|
32
|
-
"@itwin/webgl-compatibility": "^3.1.0-dev.
|
|
26
|
+
"@itwin/appui-abstract": "^3.1.0-dev.31",
|
|
27
|
+
"@itwin/core-bentley": "^3.1.0-dev.31",
|
|
28
|
+
"@itwin/core-common": "^3.1.0-dev.31",
|
|
29
|
+
"@itwin/core-geometry": "^3.1.0-dev.31",
|
|
30
|
+
"@itwin/core-orbitgt": "^3.1.0-dev.31",
|
|
31
|
+
"@itwin/core-quantity": "^3.1.0-dev.31",
|
|
32
|
+
"@itwin/webgl-compatibility": "^3.1.0-dev.31"
|
|
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.1.0-dev.
|
|
40
|
-
"@itwin/build-tools": "3.1.0-dev.
|
|
41
|
-
"@itwin/core-bentley": "3.1.0-dev.
|
|
42
|
-
"@itwin/core-common": "3.1.0-dev.
|
|
43
|
-
"@itwin/core-geometry": "3.1.0-dev.
|
|
44
|
-
"@itwin/core-orbitgt": "3.1.0-dev.
|
|
45
|
-
"@itwin/core-quantity": "3.1.0-dev.
|
|
46
|
-
"@itwin/certa": "3.1.0-dev.
|
|
47
|
-
"@itwin/eslint-plugin": "3.1.0-dev.
|
|
48
|
-
"@itwin/webgl-compatibility": "3.1.0-dev.
|
|
39
|
+
"@itwin/appui-abstract": "3.1.0-dev.31",
|
|
40
|
+
"@itwin/build-tools": "3.1.0-dev.31",
|
|
41
|
+
"@itwin/core-bentley": "3.1.0-dev.31",
|
|
42
|
+
"@itwin/core-common": "3.1.0-dev.31",
|
|
43
|
+
"@itwin/core-geometry": "3.1.0-dev.31",
|
|
44
|
+
"@itwin/core-orbitgt": "3.1.0-dev.31",
|
|
45
|
+
"@itwin/core-quantity": "3.1.0-dev.31",
|
|
46
|
+
"@itwin/certa": "3.1.0-dev.31",
|
|
47
|
+
"@itwin/eslint-plugin": "3.1.0-dev.31",
|
|
48
|
+
"@itwin/webgl-compatibility": "3.1.0-dev.31",
|
|
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.1.0-dev.
|
|
78
|
-
"@itwin/core-telemetry": "3.1.0-dev.
|
|
77
|
+
"@itwin/core-i18n": "3.1.0-dev.31",
|
|
78
|
+
"@itwin/core-telemetry": "3.1.0-dev.31",
|
|
79
79
|
"@loaders.gl/core": "^3.1.6",
|
|
80
80
|
"@loaders.gl/draco": "^3.1.6",
|
|
81
81
|
"deep-assign": "^2.0.0",
|