@itwin/core-backend 4.6.0-dev.8 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -1
- package/lib/cjs/BackendHubAccess.js +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +0 -5
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +1 -6
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts +1 -1
- package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
- package/lib/cjs/BisCoreSchema.js +3 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.js +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.js +2 -2
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +1 -1
- package/lib/cjs/Category.js +1 -1
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +1 -1
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +2 -2
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js +2 -2
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js +4 -4
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +13 -4
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +29 -12
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.js +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.js +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js +2 -2
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +10 -19
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +17 -26
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.js +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts +0 -3
- package/lib/cjs/ElementGraphics.d.ts.map +1 -1
- package/lib/cjs/ElementGraphics.js +2 -5
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +5 -0
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +1 -1
- package/lib/cjs/Entity.js +1 -1
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +1 -1
- package/lib/cjs/ExportGraphics.js +2 -2
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +1 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +5 -5
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.js +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +8 -2
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +62 -21
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.js +2 -2
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.js +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +1 -1
- package/lib/cjs/LineStyle.js +2 -2
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.js +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js +21 -21
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts +0 -3
- package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
- package/lib/cjs/PromiseMemoizer.js +2 -5
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SQLiteDb.js +2 -2
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js +2 -2
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.d.ts +54 -0
- package/lib/cjs/TextAnnotationElement.d.ts.map +1 -0
- package/lib/cjs/TextAnnotationElement.js +94 -0
- package/lib/cjs/TextAnnotationElement.js.map +1 -0
- package/lib/cjs/TextAnnotationGeometry.d.ts +28 -0
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/cjs/TextAnnotationGeometry.js +154 -0
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -0
- package/lib/cjs/TextAnnotationLayout.d.ts +124 -0
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -0
- package/lib/cjs/TextAnnotationLayout.js +399 -0
- package/lib/cjs/TextAnnotationLayout.js.map +1 -0
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +53 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js +4 -4
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts +1 -0
- package/lib/cjs/ViewStateHydrator.d.ts.map +1 -1
- package/lib/cjs/ViewStateHydrator.js +1 -0
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +46 -61
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +46 -61
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js +2 -2
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js +2 -2
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +0 -5
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js +1 -10
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.js +4 -4
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportGraphics.js","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAAgG;AAkQhG;;GAEG;AACH,IAAiB,cAAc,CAuD9B;AAvDD,WAAiB,cAAc;IAC7B;;OAEG;IACH,SAAgB,wBAAwB,CAAC,GAA0B,EAAE,GAA0B;QAC7F,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;YACnC,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,aAAa,KAAK,GAAG,CAAC,aAAa;YACzC,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;YACnC,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,eAAe,KAAK,GAAG,CAAC,eAAe;YAC7C,OAAO,KAAK,C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AK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YAC5D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF;AA5ID,8DA4IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { assert, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\nimport { ColorDefProps, GeometryClass } from \"@itwin/core-common\";\n\n/** A collection of line segments, suitable for direct use with graphics APIs.\n * The structure of this data matches GL_LINES in OpenGL.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsLines {\n /** Zero-based vertex indices, every two indices represent a line segment */\n indices: Int32Array;\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\n points: Float64Array;\n}\n\n/** Info provided to ExportLinesFunction about linework graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportLinesInfo {\n /** The element ID for the element the graphics originated from */\n elementId: Id64String;\n /** ID for the [SubCategory]($core-backend) for these graphics */\n subCategory: Id64String;\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** The linework for these graphics */\n lines: ExportGraphicsLines;\n}\n\n/** A callback function that receives generated line graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\n\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsMesh {\n /** Zero-based vertex indices, every three indices represent a triangle */\n indices: Int32Array;\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\n points: Float64Array;\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\n normals: Float32Array;\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\n params: Float32Array;\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\n isTwoSided: boolean;\n}\n\n/** Info provided to ExportGraphicsFunction about graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsInfo {\n /** The element ID for the element the graphics originated from */\n elementId: Id64String;\n /** ID for the [SubCategory]($core-backend) for these graphics */\n subCategory: Id64String;\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\n materialId?: Id64String;\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\n textureId?: Id64String;\n /** The mesh for these graphics */\n mesh: ExportGraphicsMesh;\n}\n\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\n * same graphics (with a different transform).\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\n * graphics.\n * @public\n */\nexport interface ExportPartDisplayInfo {\n categoryId: Id64String;\n subCategoryId: Id64String;\n geometryClass: GeometryClass;\n materialId: Id64String;\n elmTransparency: number;\n lineColor: number;\n}\n\n/** Information about references to [GeometryPart]($core-backend) elements found during\n * a call to [IModelDb.exportGraphics]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\n * @public\n */\nexport interface ExportPartInstanceInfo {\n /** ID for the [GeometryPart]($core-backend) */\n partId: Id64String;\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\n partInstanceId: Id64String;\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\n displayProps: ExportPartDisplayInfo;\n /** A row-major storage 4x3 transform for this instance.\n * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.\n */\n transform?: Float64Array;\n}\n\n/** A callback function that receives generated graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\n\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsOptions {\n /** The source elements for the exported graphics */\n elementIdArray: Id64Array;\n /** A function to call for each unique element ID, color and texture combination */\n onGraphics: ExportGraphicsFunction;\n /** An optional function to call if line graphics are desired. */\n onLineGraphics?: ExportLinesFunction;\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\n * recorded in this array. In this case, graphics that would result from the GeometryPart\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\n */\n partInstanceArray?: ExportPartInstanceInfo[];\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\n */\n chordTol?: number;\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to PI/12 (15 degrees).\n */\n angleTol?: number;\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry).\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\n * that it's necessary, it's almost certainly not!)\n */\n maxEdgeLength?: number;\n /** The longest dimension of a line style's largest component must be at least this size in order for\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\n * line strings.\n */\n minLineStyleComponentSize?: number;\n /** Max distance between mesh vertices for them to be collapsed.\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\n * anomalies so it is important to choose an appropriate setting for your use case.\n */\n decimationTol?: number;\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\n * like screws and screw holes.\n */\n minBRepFeatureSize?: number;\n}\n\n/** Info provided to ExportPartFunction about graphics.\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartInfo {\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\n materialId?: Id64String;\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\n textureId?: Id64String;\n /** The mesh for these graphics */\n mesh: ExportGraphicsMesh;\n}\n\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\n\n/** Info provided to ExportPartFunction about line graphics.\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartLinesInfo {\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** The linework for these graphics */\n lines: ExportGraphicsLines;\n}\n\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\n\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartGraphicsOptions {\n /** The ID for the source [GeometryPart]($core-backend) */\n elementId: Id64String;\n /** The base display properties to use for generating the graphics. This should come from an\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\n */\n displayProps: ExportPartDisplayInfo;\n /** A function to call for each unique color and texture combination. */\n onPartGraphics: ExportPartFunction;\n /** An optional function to call if line graphics are desired. */\n onPartLineGraphics?: ExportPartLinesFunction;\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\n */\n chordTol?: number;\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to PI/12 (15 degrees).\n */\n angleTol?: number;\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry)\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\n * that it's necessary, it's almost certainly not!)\n */\n maxEdgeLength?: number;\n /** The longest dimension of a line style's largest component must be at least this size in order for\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\n * line strings.\n */\n minLineStyleComponentSize?: number;\n /** Max distance between mesh vertices for them to be collapsed.\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\n * anomalies so it is important to choose an appropriate setting for your use case.\n */\n decimationTol?: number;\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\n * like screws and screw holes.\n */\n minBRepFeatureSize?: number;\n}\n\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport namespace ExportGraphics {\n /** Test if ExportPartDisplayInfos have exactly the same values.\n * @public\n */\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\n if (lhs.categoryId !== rhs.categoryId)\n return false;\n if (lhs.subCategoryId !== rhs.subCategoryId)\n return false;\n if (lhs.materialId !== rhs.materialId)\n return false;\n if (lhs.elmTransparency !== rhs.elmTransparency)\n return false;\n if (lhs.lineColor !== rhs.lineColor)\n return false;\n return true;\n }\n\n /**\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\n * @public\n */\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\n\n const p: Float64Array = mesh.points;\n for (let i = 0; i < p.length; i += 3)\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\n\n const n: Float32Array = mesh.normals;\n assert(undefined !== polyface.data.normal);\n for (let i = 0; i < n.length; i += 3)\n polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);\n\n const uv: Float32Array = mesh.params;\n assert(undefined !== polyface.data.param);\n for (let i = 0; i < uv.length; i += 2)\n polyface.data.param.pushXY(uv[i], uv[i + 1]);\n\n const indices = mesh.indices;\n const addIndex = (idx: number) => {\n polyface.addPointIndex(idx, true);\n polyface.addNormalIndex(idx);\n polyface.addParamIndex(idx);\n };\n for (let i = 0; i < indices.length; i += 3) {\n addIndex(indices[i]);\n addIndex(indices[i + 1]);\n addIndex(indices[i + 2]);\n polyface.terminateFacet(false);\n }\n\n return polyface;\n }\n}\n/**\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\n * * Because the ExportGraphicsMesh has limited data:\n * * There is no auxData in this visitor.\n * * There is no color in this visitor.\n * * All edgeVisible are true.\n * @public\n */\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _polyface: ExportGraphicsMesh;\n // to be called from static factory method that validates the polyface ...\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\n this._polyface = facets;\n this._numWrap = numWrap;\n\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n this.twoSided = facets.isTwoSided;\n this.reset();\n }\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\n * Typical wrap counts are:\n * * 0 -- leave the point arrays with \"missing final edge\"\n * * 1 -- add point 0 as closure point\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\n */\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /** Select a facet by simple index. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this.point.length = 0;\n const points = this.point;\n points.length = 0;\n this.pointIndex.length = 0;\n this.point.length = 0;\n this.edgeVisible.length = 0;\n const sourcePoints = this._polyface.points;\n const indices = this._polyface.indices;\n const i0 = 3 * facetIndex;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 3 * indices[i];\n this.pointIndex.push(indices[i]);\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\n this.edgeVisible.push(true);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.point.pushFromGrowableXYZArray(this.point, i);\n }\n\n const sourceParams = this._polyface.params;\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\n this.paramIndex.length = 0;\n this.param.length = 0;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 2 * indices[i];\n this.paramIndex.push(indices[i]);\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.param.pushFromGrowableXYArray(this.param, i);\n }\n }\n\n const sourceNormals = this._polyface.normals;\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\n this.normalIndex.length = 0;\n this.normal.length = 0;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 3 * indices[i];\n this.normalIndex.push(indices[i]);\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.normal.pushFromGrowableXYZArray(this.normal, i);\n }\n }\n return true;\n }\n public moveToNextFacet(): boolean {\n return this.moveToReadIndex(this._nextFacetIndex);\n }\n /** Set the number of vertices to replicate in visitor arrays. */\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\n\n /** Return the index (in the client polyface) of the current facet */\n public currentReadIndex(): number { return this._currentFacetIndex; }\n /** Return the point index of vertex i within the currently loaded facet */\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\n /** Return the param index of vertex i within the currently loaded facet.\n * Use the artificial paramIndex, which matches pointIndex.\n */\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\n /** Return the normal index of vertex i within the currently loaded facet.\n * Use the artificial paramIndex, which matches pointIndex.\n */\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\n /** Return the color index of vertex i within the currently loaded facet */\n public clientColorIndex(_i: number): number { return 1; }\n /** Return the aux data index of vertex i within the currently loaded facet */\n public clientAuxIndex(_i: number): number { return -1; }\n\n /** return the client polyface */\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\n public clearArrays(): void {\n if (this.point !== undefined)\n this.point.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n // ignore color and aux -- they never exist.\n }\n /** transfer interpolated data from the other visitor.\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n }\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExportGraphics.js","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAAgG;AAkQhG;;GAEG;AACH,IAAiB,cAAc,CAuD9B;AAvDD,WAAiB,cAAc;IAC7B;;OAEG;IACH,SAAgB,wBAAwB,CAAC,GAA0B,EAAE,GAA0B;QAC7F,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;YACnC,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,aAAa,KAAK,GAAG,CAAC,aAAa;YACzC,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;YACnC,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,eAAe,KAAK,GAAG,CAAC,eAAe;YAC7C,OAAO,KAAK,CAAC;QACf,IAAI,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,SAAS;YACjC,OAAO,KAAK,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAZe,uCAA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C,CAAC;QACzD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YAC5D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF;AA5ID,8DA4IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ExportGraphics\n */\n\nimport { assert, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\nimport { ColorDefProps, GeometryClass } from \"@itwin/core-common\";\n\n/** A collection of line segments, suitable for direct use with graphics APIs.\n * The structure of this data matches GL_LINES in OpenGL.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsLines {\n /** Zero-based vertex indices, every two indices represent a line segment */\n indices: Int32Array;\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\n points: Float64Array;\n}\n\n/** Info provided to ExportLinesFunction about linework graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportLinesInfo {\n /** The element ID for the element the graphics originated from */\n elementId: Id64String;\n /** ID for the [SubCategory]($core-backend) for these graphics */\n subCategory: Id64String;\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** The linework for these graphics */\n lines: ExportGraphicsLines;\n}\n\n/** A callback function that receives generated line graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\n\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsMesh {\n /** Zero-based vertex indices, every three indices represent a triangle */\n indices: Int32Array;\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\n points: Float64Array;\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\n normals: Float32Array;\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\n params: Float32Array;\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\n isTwoSided: boolean;\n}\n\n/** Info provided to ExportGraphicsFunction about graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsInfo {\n /** The element ID for the element the graphics originated from */\n elementId: Id64String;\n /** ID for the [SubCategory]($core-backend) for these graphics */\n subCategory: Id64String;\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\n materialId?: Id64String;\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\n textureId?: Id64String;\n /** The mesh for these graphics */\n mesh: ExportGraphicsMesh;\n}\n\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\n * same graphics (with a different transform).\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\n * graphics.\n * @public\n */\nexport interface ExportPartDisplayInfo {\n categoryId: Id64String;\n subCategoryId: Id64String;\n geometryClass: GeometryClass;\n materialId: Id64String;\n elmTransparency: number;\n lineColor: number;\n}\n\n/** Information about references to [GeometryPart]($core-backend) elements found during\n * a call to [IModelDb.exportGraphics]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\n * @public\n */\nexport interface ExportPartInstanceInfo {\n /** ID for the [GeometryPart]($core-backend) */\n partId: Id64String;\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\n partInstanceId: Id64String;\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\n displayProps: ExportPartDisplayInfo;\n /** A row-major storage 4x3 transform for this instance.\n * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.\n */\n transform?: Float64Array;\n}\n\n/** A callback function that receives generated graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\n\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsOptions {\n /** The source elements for the exported graphics */\n elementIdArray: Id64Array;\n /** A function to call for each unique element ID, color and texture combination */\n onGraphics: ExportGraphicsFunction;\n /** An optional function to call if line graphics are desired. */\n onLineGraphics?: ExportLinesFunction;\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\n * recorded in this array. In this case, graphics that would result from the GeometryPart\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\n */\n partInstanceArray?: ExportPartInstanceInfo[];\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\n */\n chordTol?: number;\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to PI/12 (15 degrees).\n */\n angleTol?: number;\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry).\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\n * that it's necessary, it's almost certainly not!)\n */\n maxEdgeLength?: number;\n /** The longest dimension of a line style's largest component must be at least this size in order for\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\n * line strings.\n */\n minLineStyleComponentSize?: number;\n /** Max distance between mesh vertices for them to be collapsed.\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\n * anomalies so it is important to choose an appropriate setting for your use case.\n */\n decimationTol?: number;\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\n * like screws and screw holes.\n */\n minBRepFeatureSize?: number;\n}\n\n/** Info provided to ExportPartFunction about graphics.\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartInfo {\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\n materialId?: Id64String;\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\n textureId?: Id64String;\n /** The mesh for these graphics */\n mesh: ExportGraphicsMesh;\n}\n\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\n\n/** Info provided to ExportPartFunction about line graphics.\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartLinesInfo {\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** The linework for these graphics */\n lines: ExportGraphicsLines;\n}\n\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\n\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartGraphicsOptions {\n /** The ID for the source [GeometryPart]($core-backend) */\n elementId: Id64String;\n /** The base display properties to use for generating the graphics. This should come from an\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\n */\n displayProps: ExportPartDisplayInfo;\n /** A function to call for each unique color and texture combination. */\n onPartGraphics: ExportPartFunction;\n /** An optional function to call if line graphics are desired. */\n onPartLineGraphics?: ExportPartLinesFunction;\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\n */\n chordTol?: number;\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to PI/12 (15 degrees).\n */\n angleTol?: number;\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry)\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\n * that it's necessary, it's almost certainly not!)\n */\n maxEdgeLength?: number;\n /** The longest dimension of a line style's largest component must be at least this size in order for\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\n * line strings.\n */\n minLineStyleComponentSize?: number;\n /** Max distance between mesh vertices for them to be collapsed.\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\n * anomalies so it is important to choose an appropriate setting for your use case.\n */\n decimationTol?: number;\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\n * like screws and screw holes.\n */\n minBRepFeatureSize?: number;\n}\n\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport namespace ExportGraphics {\n /** Test if ExportPartDisplayInfos have exactly the same values.\n * @public\n */\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\n if (lhs.categoryId !== rhs.categoryId)\n return false;\n if (lhs.subCategoryId !== rhs.subCategoryId)\n return false;\n if (lhs.materialId !== rhs.materialId)\n return false;\n if (lhs.elmTransparency !== rhs.elmTransparency)\n return false;\n if (lhs.lineColor !== rhs.lineColor)\n return false;\n return true;\n }\n\n /**\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\n * @public\n */\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\n\n const p: Float64Array = mesh.points;\n for (let i = 0; i < p.length; i += 3)\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\n\n const n: Float32Array = mesh.normals;\n assert(undefined !== polyface.data.normal);\n for (let i = 0; i < n.length; i += 3)\n polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);\n\n const uv: Float32Array = mesh.params;\n assert(undefined !== polyface.data.param);\n for (let i = 0; i < uv.length; i += 2)\n polyface.data.param.pushXY(uv[i], uv[i + 1]);\n\n const indices = mesh.indices;\n const addIndex = (idx: number) => {\n polyface.addPointIndex(idx, true);\n polyface.addNormalIndex(idx);\n polyface.addParamIndex(idx);\n };\n for (let i = 0; i < indices.length; i += 3) {\n addIndex(indices[i]);\n addIndex(indices[i + 1]);\n addIndex(indices[i + 2]);\n polyface.terminateFacet(false);\n }\n\n return polyface;\n }\n}\n/**\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\n * * Because the ExportGraphicsMesh has limited data:\n * * There is no auxData in this visitor.\n * * There is no color in this visitor.\n * * All edgeVisible are true.\n * @public\n */\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _polyface: ExportGraphicsMesh;\n // to be called from static factory method that validates the polyface ...\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\n this._polyface = facets;\n this._numWrap = numWrap;\n\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n this.twoSided = facets.isTwoSided;\n this.reset();\n }\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\n * Typical wrap counts are:\n * * 0 -- leave the point arrays with \"missing final edge\"\n * * 1 -- add point 0 as closure point\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\n */\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /** Select a facet by simple index. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this.point.length = 0;\n const points = this.point;\n points.length = 0;\n this.pointIndex.length = 0;\n this.point.length = 0;\n this.edgeVisible.length = 0;\n const sourcePoints = this._polyface.points;\n const indices = this._polyface.indices;\n const i0 = 3 * facetIndex;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 3 * indices[i];\n this.pointIndex.push(indices[i]);\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\n this.edgeVisible.push(true);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.point.pushFromGrowableXYZArray(this.point, i);\n }\n\n const sourceParams = this._polyface.params;\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\n this.paramIndex.length = 0;\n this.param.length = 0;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 2 * indices[i];\n this.paramIndex.push(indices[i]);\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.param.pushFromGrowableXYArray(this.param, i);\n }\n }\n\n const sourceNormals = this._polyface.normals;\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\n this.normalIndex.length = 0;\n this.normal.length = 0;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 3 * indices[i];\n this.normalIndex.push(indices[i]);\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.normal.pushFromGrowableXYZArray(this.normal, i);\n }\n }\n return true;\n }\n public moveToNextFacet(): boolean {\n return this.moveToReadIndex(this._nextFacetIndex);\n }\n /** Set the number of vertices to replicate in visitor arrays. */\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\n\n /** Return the index (in the client polyface) of the current facet */\n public currentReadIndex(): number { return this._currentFacetIndex; }\n /** Return the point index of vertex i within the currently loaded facet */\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\n /** Return the param index of vertex i within the currently loaded facet.\n * Use the artificial paramIndex, which matches pointIndex.\n */\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\n /** Return the normal index of vertex i within the currently loaded facet.\n * Use the artificial paramIndex, which matches pointIndex.\n */\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\n /** Return the color index of vertex i within the currently loaded facet */\n public clientColorIndex(_i: number): number { return 1; }\n /** Return the aux data index of vertex i within the currently loaded facet */\n public clientAuxIndex(_i: number): number { return -1; }\n\n /** return the client polyface */\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\n public clearArrays(): void {\n if (this.point !== undefined)\n this.point.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n // ignore color and aux -- they never exist.\n }\n /** transfer interpolated data from the other visitor.\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n }\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSource.js","sourceRoot":"","sources":["../../src/ExternalSource.ts"],"names":[],"mappings":";AACA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA+C;AAC/C,oDAG4B;AAC5B,uCAAiE;AAEjE,qEAAgH;AAEhH;;;GAGG;AACH,MAAa,cAAe,SAAQ,qCAA2B;IAO7D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAE3E,YAAsB,KAA0B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,UAAU;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,qDAA4B,CAAC,4BAAc,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACpG,CAAC;IAEe,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAyB,CAAC,CAAC,sDAAsD;IACtG,CAAC;IACD,wHAAwH;IACjH,MAAM,CAAC,cAAc,CAAC,QAAkB;QAC7C,IAAI;YACF,MAAM,QAAQ,GAAG,Q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,iBAAO;IAGpD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAEtF,YAAsB,KAAqC,EAAE,MAAgB;QAC3E,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAEe,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAoC,CAAC,CAAC,sDAAsD;IACjH,CAAC;CACF;AAbD,8DAaC","sourcesContent":["\n/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport {\n BisCodeSpec, Code, CodeScopeSpec, EntityReferenceSet, ExternalSourceAttachmentProps, ExternalSourceAttachmentRole, ExternalSourceProps, IModel, RelatedElement,\n SynchronizationConfigLinkProps,\n} from \"@itwin/core-common\";\nimport { InformationReferenceElement, UrlLink } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ExternalSourceAttachmentAttachesSource, ExternalSourceIsInRepository } from \"./NavigationRelationship\";\n\n/** An ExternalSource refers to an 'information container' found in a repository. In some cases, the container is the entire repository.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSource extends InformationReferenceElement {\n /** The repository that contains this ExternalSource. */\n public repository?: ExternalSourceIsInRepository;\n /** The name of the iModel Connecter that processed this ExternalSource. */\n public connectorName?: string;\n /** The version of the iModel Connecter that processed this ExternalSource. */\n public connectorVersion?: string;\n /** @internal */\n public static override get className(): string { return \"ExternalSource\"; }\n\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.repository)\n this.repository = new ExternalSourceIsInRepository(RelatedElement.idFromJson(props.repository));\n }\n\n public override toJSON(): ExternalSourceProps { // This override only specializes the return type\n return super.toJSON() as ExternalSourceProps; // Entity.toJSON takes care of auto-handled properties\n }\n /** The [[CodeSpec]] for ExternalSource elements is not automatically created, so this method ensures that it exists. */\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\n try {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\n return codeSpec.id;\n } catch (e) {\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSource, CodeScopeSpec.Type.Repository);\n }\n }\n /** Create a Code for an ExternalSource element given a name that is meant to be unique within the scope of the iModel.\n * @param iModelDb The IModelDb\n * @param codeValue The ExternalSource name\n * @see [[ensureCodeSpec]]\n */\n public static createCode(iModelDb: IModelDb, codeValue: string): Code {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\n return new Code({ spec: codeSpec.id, scope: IModel.rootSubjectId, value: codeValue });\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.repository)\n referenceIds.addElement(this.repository.id);\n }\n}\n\n/** Attachment of an ExternalSource\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceAttachment extends InformationReferenceElement {\n /** The [[ExternalSource]] that is attached by this ExternalSourceAttachment. */\n public attaches?: ExternalSourceAttachmentAttachesSource;\n /** Specifies whether the attached [[ExternalSource]] provides context or models a part of the whole. */\n public role?: ExternalSourceAttachmentRole;\n /** The translation or offset in global coordinates of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public translation?: Point3d;\n /** The Yaw angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public yaw?: number;\n /** The Pitch angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public pitch?: number;\n /** The Roll angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public roll?: number;\n /** The scale of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public scale?: Point3d;\n /** @internal */\n public static override get className(): string { return \"ExternalSourceAttachment\"; }\n\n protected constructor(props: ExternalSourceAttachmentProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.attaches)\n this.attaches = new ExternalSourceAttachmentAttachesSource(RelatedElement.idFromJson(props.attaches));\n\n if (props.translation)\n this.translation = Point3d.fromJSON(props.translation);\n\n if (props.scale)\n this.scale = Point3d.fromJSON(props.scale);\n }\n\n public override toJSON(): ExternalSourceAttachmentProps { // This override only specializes the return type\n return super.toJSON() as ExternalSourceAttachmentProps; // Entity.toJSON takes care of auto-handled properties\n }\n /** The [[CodeSpec]] for ExternalSourceAttachment elements is not automatically created, so this method ensures that it exists. */\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\n try {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\n return codeSpec.id;\n } catch (e) {\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSourceAttachment, CodeScopeSpec.Type.ParentElement);\n }\n }\n /** Create a Code for an ExternalSourceAttachment element given a name that is meant to be unique within the scope of its parent [[ExternalSource]].\n * @param iModelDb The IModelDb\n * @param scopeElementId The parent ExternalSource\n * @param codeValue The ExternalSourceAttachment name\n * @see [[ensureCodeSpec]]\n */\n public static createCode(iModelDb: IModelDb, scopeElementId: Id64String, codeValue: string): Code {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\n return new Code({ spec: codeSpec.id, scope: scopeElementId, value: codeValue });\n }\n}\n\n/** A group of ExternalSources that are collectively a source of information for one or more elements.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceGroup extends ExternalSource {\n /** @internal */\n public static override get className(): string { return \"ExternalSourceGroup\"; }\n\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Link to the Configuration for an iModel Synchronization Job\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigLink extends UrlLink {\n /** Date/Time of last successful run of this synchronization configuration */\n public lastSuccessfulRun?: string;\n /** @internal */\n public static override get className(): string { return \"SynchronizationConfigLink\"; }\n\n protected constructor(props: SynchronizationConfigLinkProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n public override toJSON(): SynchronizationConfigLinkProps { // This override only specializes the return type\n return super.toJSON() as SynchronizationConfigLinkProps; // Entity.toJSON takes care of auto-handled properties\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"ExternalSource.js","sourceRoot":"","sources":["../../src/ExternalSource.ts"],"names":[],"mappings":";AACA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA+C;AAC/C,oDAG4B;AAC5B,uCAAiE;AAEjE,qEAAgH;AAEhH;;;GAGG;AACH,MAAa,cAAe,SAAQ,qCAA2B;IAO7D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAE3E,YAAsB,KAA0B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,UAAU;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,qDAA4B,CAAC,4BAAc,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACpG,CAAC;IAEe,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAyB,CAAC,CAAC,sDAAsD;IACtG,CAAC;IACD,wHAAwH;IACjH,MAAM,CAAC,cAAc,CAAC,QAAkB;QAC7C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,yBAAW,CAAC,cAAc,CAAC,CAAC;YAC1E,OAAO,QAAQ,CAAC,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,yBAAW,CAAC,cAAc,EAAE,2BAAa,CAAC,IAAI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B,OAAO,KAAK,CAAC,MAAM,EAAoC,CAAC,CAAC,sDAAsD;IACjH,CAAC;CACF;AAbD,8DAaC","sourcesContent":["\n/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport {\n BisCodeSpec, Code, CodeScopeSpec, EntityReferenceSet, ExternalSourceAttachmentProps, ExternalSourceAttachmentRole, ExternalSourceProps, IModel, RelatedElement,\n SynchronizationConfigLinkProps,\n} from \"@itwin/core-common\";\nimport { InformationReferenceElement, UrlLink } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ExternalSourceAttachmentAttachesSource, ExternalSourceIsInRepository } from \"./NavigationRelationship\";\n\n/** An ExternalSource refers to an 'information container' found in a repository. In some cases, the container is the entire repository.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSource extends InformationReferenceElement {\n /** The repository that contains this ExternalSource. */\n public repository?: ExternalSourceIsInRepository;\n /** The name of the iModel Connecter that processed this ExternalSource. */\n public connectorName?: string;\n /** The version of the iModel Connecter that processed this ExternalSource. */\n public connectorVersion?: string;\n /** @internal */\n public static override get className(): string { return \"ExternalSource\"; }\n\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.repository)\n this.repository = new ExternalSourceIsInRepository(RelatedElement.idFromJson(props.repository));\n }\n\n public override toJSON(): ExternalSourceProps { // This override only specializes the return type\n return super.toJSON() as ExternalSourceProps; // Entity.toJSON takes care of auto-handled properties\n }\n /** The [[CodeSpec]] for ExternalSource elements is not automatically created, so this method ensures that it exists. */\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\n try {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\n return codeSpec.id;\n } catch (e) {\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSource, CodeScopeSpec.Type.Repository);\n }\n }\n /** Create a Code for an ExternalSource element given a name that is meant to be unique within the scope of the iModel.\n * @param iModelDb The IModelDb\n * @param codeValue The ExternalSource name\n * @see [[ensureCodeSpec]]\n */\n public static createCode(iModelDb: IModelDb, codeValue: string): Code {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\n return new Code({ spec: codeSpec.id, scope: IModel.rootSubjectId, value: codeValue });\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.repository)\n referenceIds.addElement(this.repository.id);\n }\n}\n\n/** Attachment of an ExternalSource\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceAttachment extends InformationReferenceElement {\n /** The [[ExternalSource]] that is attached by this ExternalSourceAttachment. */\n public attaches?: ExternalSourceAttachmentAttachesSource;\n /** Specifies whether the attached [[ExternalSource]] provides context or models a part of the whole. */\n public role?: ExternalSourceAttachmentRole;\n /** The translation or offset in global coordinates of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public translation?: Point3d;\n /** The Yaw angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public yaw?: number;\n /** The Pitch angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public pitch?: number;\n /** The Roll angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public roll?: number;\n /** The scale of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public scale?: Point3d;\n /** @internal */\n public static override get className(): string { return \"ExternalSourceAttachment\"; }\n\n protected constructor(props: ExternalSourceAttachmentProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.attaches)\n this.attaches = new ExternalSourceAttachmentAttachesSource(RelatedElement.idFromJson(props.attaches));\n\n if (props.translation)\n this.translation = Point3d.fromJSON(props.translation);\n\n if (props.scale)\n this.scale = Point3d.fromJSON(props.scale);\n }\n\n public override toJSON(): ExternalSourceAttachmentProps { // This override only specializes the return type\n return super.toJSON() as ExternalSourceAttachmentProps; // Entity.toJSON takes care of auto-handled properties\n }\n /** The [[CodeSpec]] for ExternalSourceAttachment elements is not automatically created, so this method ensures that it exists. */\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\n try {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\n return codeSpec.id;\n } catch (e) {\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSourceAttachment, CodeScopeSpec.Type.ParentElement);\n }\n }\n /** Create a Code for an ExternalSourceAttachment element given a name that is meant to be unique within the scope of its parent [[ExternalSource]].\n * @param iModelDb The IModelDb\n * @param scopeElementId The parent ExternalSource\n * @param codeValue The ExternalSourceAttachment name\n * @see [[ensureCodeSpec]]\n */\n public static createCode(iModelDb: IModelDb, scopeElementId: Id64String, codeValue: string): Code {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\n return new Code({ spec: codeSpec.id, scope: scopeElementId, value: codeValue });\n }\n}\n\n/** A group of ExternalSources that are collectively a source of information for one or more elements.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceGroup extends ExternalSource {\n /** @internal */\n public static override get className(): string { return \"ExternalSourceGroup\"; }\n\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Link to the Configuration for an iModel Synchronization Job\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigLink extends UrlLink {\n /** Date/Time of last successful run of this synchronization configuration */\n public lastSuccessfulRun?: string;\n /** @internal */\n public static override get className(): string { return \"SynchronizationConfigLink\"; }\n\n protected constructor(props: SynchronizationConfigLinkProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n public override toJSON(): SynchronizationConfigLinkProps { // This override only specializes the return type\n return super.toJSON() as SynchronizationConfigLinkProps; // Entity.toJSON takes care of auto-handled properties\n }\n}\n\n"]}
|
|
@@ -77,8 +77,8 @@ class GeoCoordConfig {
|
|
|
77
77
|
this.loadAll(settings, "gcs/databases");
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
exports.GeoCoordConfig = GeoCoordConfig;
|
|
80
81
|
/** array of cloud prefetch tasks that may be awaited to permit offline usage */
|
|
81
82
|
GeoCoordConfig.prefetches = [];
|
|
82
83
|
GeoCoordConfig._defaultDbsLoaded = false;
|
|
83
|
-
exports.GeoCoordConfig = GeoCoordConfig;
|
|
84
84
|
//# sourceMappingURL=GeoCoordConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoCoordConfig.js","sourceRoot":"","sources":["../../src/GeoCoordConfig.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,+CAA4C;AAC5C,6CAA0C;AAI1C,MAAM,SAAS,GAAG,UAAU,CAAC;AAO7B;;;GAGG;AACH,MAAa,cAAc;IAIjB,MAAM,CAAC,eAAe,CAAC,UAAkB;QAC/C,uDAAuD;QACvD,IAAI,uBAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,EAAE,KAAK,CAAC;YAC7E,OAAO;QAET,IAAI,cAAoD,CAAC;QACzD,IAAI;
|
|
1
|
+
{"version":3,"file":"GeoCoordConfig.js","sourceRoot":"","sources":["../../src/GeoCoordConfig.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,+CAA4C;AAC5C,6CAA0C;AAI1C,MAAM,SAAS,GAAG,UAAU,CAAC;AAO7B;;;GAGG;AACH,MAAa,cAAc;IAIjB,MAAM,CAAC,eAAe,CAAC,UAAkB;QAC/C,uDAAuD;QACvD,IAAI,uBAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU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B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,uBAAU,CAAC,YAAY,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,QAAkB;QAC5C,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC1C,CAAC;;AAzEH,wCA0EC;AAzEC,gFAAgF;AACzD,yBAAU,GAAgC,EAAE,CAAC;AAuDrD,gCAAiB,GAAG,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { IModelHost } from \"./IModelHost\";\nimport { Settings } from \"./workspace/Settings\";\nimport { WorkspaceContainer, WorkspaceDb } from \"./workspace/Workspace\";\n\nconst loggerCat = \"GeoCoord\";\n\ninterface GcsDbProps extends WorkspaceDb.Props, WorkspaceContainer.Alias {\n prefetch?: boolean;\n priority?: number;\n}\n\n/**\n * Internal class to configure and load the gcs workspaces for an iModel.\n * @internal\n */\nexport class GeoCoordConfig {\n /** array of cloud prefetch tasks that may be awaited to permit offline usage */\n public static readonly prefetches: CloudSqlite.CloudPrefetch[] = [];\n\n private static addGcsWorkspace(gcsDbAlias: string) {\n // override to disable loading GCS data from workspaces\n if (IModelHost.appWorkspace.settings.getBoolean(\"gcs/disableWorkspaces\", false))\n return;\n\n let containerProps: WorkspaceContainer.Props | undefined;\n try {\n const ws = IModelHost.appWorkspace;\n const dbProps = ws.resolveDatabase(gcsDbAlias) as GcsDbProps;\n containerProps = ws.resolveContainer(dbProps.containerName);\n const container = ws.getContainer(containerProps);\n const cloudContainer = container.cloudContainer;\n if (!cloudContainer?.isConnected) {\n Logger.logError(\"GeoCoord\", `could not load gcs database \"${gcsDbAlias}\"`);\n return;\n }\n\n const gcsDbName = container.resolveDbFileName(dbProps);\n const gcsDbProps = cloudContainer.queryDatabase(gcsDbName);\n if (undefined === gcsDbProps)\n throw new Error(`database \"${gcsDbName}\" not found in container \"${containerProps.containerId}\"`);\n\n if (!IModelHost.platform.addGcsWorkspaceDb(gcsDbName, cloudContainer, dbProps.priority))\n return; // already had this db\n\n if (IModelHost.appWorkspace.settings.getBoolean(\"gcs/noLocalData\", false))\n IModelHost.platform.enableLocalGcsFiles(false);\n\n Logger.logInfo(loggerCat, `loaded gcsDb \"${gcsDbName}\", from \"${containerProps.baseUri}/${containerProps.containerId}\" size=${gcsDbProps.totalBlocks}, local=${gcsDbProps.localBlocks}`);\n\n if (true === dbProps.prefetch)\n this.prefetches.push(CloudSqlite.startCloudPrefetch(cloudContainer, gcsDbName));\n\n } catch (e: any) {\n let msg = `Cannot load GCS workspace (${e.errorNumber}): ${BentleyError.getErrorMessage(e)}`;\n if (containerProps)\n msg += `,container=${containerProps.baseUri}/${containerProps.containerId}, storage=${containerProps.storageType}, public=${containerProps.isPublic}, cacheDir=${IModelHost.cacheDir}`;\n Logger.logError(loggerCat, msg);\n }\n }\n\n private static loadAll(settings: Settings, settingName: string) {\n settings.resolveSetting(settingName, (val) => {\n if (Array.isArray(val)) {\n for (const entry of val) {\n if (typeof entry === \"string\")\n this.addGcsWorkspace(entry);\n }\n }\n return undefined; // keep going through all dictionaries\n });\n }\n\n private static _defaultDbsLoaded = false;\n public static onStartup() {\n this._defaultDbsLoaded = false;\n this.prefetches.length = 0;\n }\n\n public static loadDefaultDatabases(): void {\n if (!this._defaultDbsLoaded) {\n this._defaultDbsLoaded = true;\n this.loadAll(IModelHost.appWorkspace.settings, \"gcs/default/databases\");\n }\n }\n\n public static loadForImodel(settings: Settings) {\n this.loadDefaultDatabases();\n this.loadAll(settings, \"gcs/databases\");\n }\n}\n"]}
|
|
@@ -257,13 +257,13 @@ class ResponseGenerator {
|
|
|
257
257
|
case "linearSweep":
|
|
258
258
|
const linearSweep = solid;
|
|
259
259
|
return `${summary}'
|
|
260
|
-
' vector: ${linearSweep.cloneSweepVector().toJSON()}'
|
|
260
|
+
' vector: ${JSON.stringify(linearSweep.cloneSweepVector().toJSON())}'
|
|
261
261
|
' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;
|
|
262
262
|
case "rotationalSweep":
|
|
263
263
|
const rotationalSweep = solid;
|
|
264
264
|
const axis = rotationalSweep.cloneAxisRay();
|
|
265
265
|
return `${summary}'
|
|
266
|
-
' center: ${axis.origin.toJSON()}'
|
|
266
|
+
' center: ${JSON.stringify(axis.origin.toJSON())}'
|
|
267
267
|
' axis: ${JSON.stringify(axis.direction.toJSON())}'
|
|
268
268
|
' sweepAngle: ${rotationalSweep.getSweep().degrees}`;
|
|
269
269
|
case "ruledSweep":
|
|
@@ -282,7 +282,7 @@ class ResponseGenerator {
|
|
|
282
282
|
sweep.setRadians(-sweep.radians);
|
|
283
283
|
}
|
|
284
284
|
return `${summary}'
|
|
285
|
-
' center: ${torusPipe.cloneCenter().toJSON()}'
|
|
285
|
+
' center: ${JSON.stringify(torusPipe.cloneCenter().toJSON())}'
|
|
286
286
|
' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'
|
|
287
287
|
' majorRadius: ${torusPipe.getMajorRadius()}'
|
|
288
288
|
' minorRadius: ${torusPipe.getMinorRadius()}'
|
|
@@ -299,8 +299,8 @@ class ResponseGenerator {
|
|
|
299
299
|
if (undefined !== arc.circularRadius)
|
|
300
300
|
summary = `${summary} radius: ${arc.circularRadius()}`;
|
|
301
301
|
summary = `${summary}'
|
|
302
|
-
' vectorX:${arc.vector0.toJSON()}'
|
|
303
|
-
' vectorY:${arc.vector90.toJSON()}'
|
|
302
|
+
' vectorX:${JSON.stringify(arc.vector0.toJSON())}'
|
|
303
|
+
' vectorY:${JSON.stringify(arc.vector90.toJSON())}'
|
|
304
304
|
' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`
|
|
305
305
|
+ ` curveLength: ${curve.curveLength()}`;
|
|
306
306
|
return summary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometrySummary.js","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAgG;AAChG,wDAK8B;AAC9B,oDAG4B;AAC5B,uCAAoE;AAQpE,uBAAuB;AAEvB,yDAAyD;AACzD,MAAM,iBAAiB;IAQrB,IAAW,UAAU,KAAK,OAAO,sCAAwB,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAEpF,YAAmB,OAAoC,EAAE,MAAgB;QATlE,cAAS,GAAG,sCAAwB,CAAC,KAAK,CAAC;QAC3C,qBAAgB,GAAG,KAAK,CAAC;QAEzB,qBAAgB,GAAG,KAAK,CAAC;QAO9B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;QAC7B,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,sCAAwB,CAAC,KAAK,CAAC;YAChH,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC,gBAAgB,CAAC;YACvD,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACxD,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC,gBAAgB,CAAC;SACxD;IACH,CAAC;IAEM,iBAAiB;QACtB,MAAM,SAAS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,MAAM,CAAC,mBAAmB,EAAE;YAClC,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,aAAa,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChD,MAAM;YACR,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClD,MAAM;SACT;QAED,OAAO,GAAG,OAAO;mBACF,MAAM,CAAC,sBAAsB,EAAE,CAAC,MAAM;kBACvC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC;IAC3C,CAAC;CACF;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAAoC,EAAE,MAAgB;IAC9F,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;AAHD,8DAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { assert, BentleyError, Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport {\n AkimaCurve3d, AnyGeometryQuery, Arc3d, BezierCurveBase, Box, BSplineCurve3d, Cone, CurveChainWithDistanceIndex, CurveCollection, CurvePrimitive, IModelJson,\n InterpolationCurve3d,\n LinearSweep, LineSegment3d, LineString3d, Loop, Path, Range3d, RotationalSweep, RuledSweep, SolidPrimitive, Sphere, TorusPipe, Transform,\n TransitionSpiral3d, UVSelect,\n} from \"@itwin/core-geometry\";\nimport {\n BRepEntity, GeometryParams, GeometryStreamIterator, GeometrySummaryRequestProps, GeometrySummaryVerbosity, ImagePrimitive,\n IModelError, TextStringPrimitive,\n} from \"@itwin/core-common\";\nimport { Element, GeometricElement, GeometryPart } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\n\ninterface ElementGeom {\n iterator: GeometryStreamIterator;\n geometricElement?: GeometricElement;\n}\n\n// cspell:ignore earlin\n\n/** Generates an array of GeometryStreamResponseProps. */\nclass ResponseGenerator {\n public verbosity = GeometrySummaryVerbosity.Basic;\n public includePlacement = false;\n public includePartReferences?: \"2d\" | \"3d\";\n public verboseSymbology = false;\n public elementIds: Id64Array;\n public iModel: IModelDb;\n\n public get wantSquish() { return GeometrySummaryVerbosity.Full !== this.verbosity; }\n\n public constructor(request: GeometrySummaryRequestProps, iModel: IModelDb) {\n this.elementIds = request.elementIds;\n this.iModel = iModel;\n const opts = request.options;\n if (undefined !== opts) {\n this.verbosity = undefined !== opts.geometryVerbosity ? opts.geometryVerbosity : GeometrySummaryVerbosity.Basic;\n this.includePlacement = true === opts.includePlacement;\n this.includePartReferences = opts.includePartReferences;\n this.verboseSymbology = true === opts.verboseSymbology;\n }\n }\n\n public generateSummaries(): string {\n const summaries: string[] = [];\n for (const elementId of this.elementIds)\n summaries.push(this.generateSummary(elementId));\n\n return summaries.join(\"\\n\");\n }\n\n public generateSummary(id: Id64String): string {\n let lines = [`[Geometry Summary for Element ${id}]`];\n try {\n const geom = this.getElementGeom(id);\n if (undefined === geom)\n throw new IModelError(IModelStatus.NoGeometry, \"Element is neither a geometric element nor a geometry part\");\n\n if (undefined !== geom.geometricElement)\n lines.push(this.summarizeElement(geom.geometricElement));\n else if (undefined !== this.includePartReferences)\n lines.push(this.summarizePartReferences(id, \"2d\" === this.includePartReferences)); // NB: Hideously inefficient if more than one element's summary was requested.\n\n let curGeomParams: GeometryParams | undefined;\n let curLocalRange: Range3d | undefined;\n for (const entry of geom.iterator) {\n if (this.verboseSymbology && (undefined === curGeomParams || !curGeomParams.isEquivalent(entry.geomParams))) {\n lines.push(`Symbology: ${this.stringify(entry.geomParams)}`);\n curGeomParams = entry.geomParams.clone();\n }\n\n if (undefined !== entry.localRange && (undefined === curLocalRange || !curLocalRange.isAlmostEqual(entry.localRange))) {\n lines.push(this.summarizeRange3d(entry.localRange));\n curLocalRange = entry.localRange;\n }\n\n const prim = entry.primitive;\n switch (prim.type) {\n case \"textString\":\n case \"image\":\n this.summarizePrimitive(lines, prim);\n break;\n case \"brep\":\n this.summarizeBRep(lines, prim.brep);\n break;\n case \"geometryQuery\":\n this.summarizeGeometryQuery(lines, prim.geometry);\n break;\n case \"partReference\":\n lines.push(this.summarizePartReference(prim.part.id, prim.part.toLocal));\n break;\n }\n }\n } catch (err) {\n lines = lines.slice(0, 1);\n lines.push(`ERROR: ${BentleyError.getErrorMessage(err)}`);\n }\n\n return lines.filter((line) => line !== \"\").join(\"\\n\");\n }\n\n public summarizeElement(elem: GeometricElement): string {\n const lines: string[] = [];\n lines.push(`(${elem.is2d() ? \"2D\" : \"3D\"}) Category: ${elem.category}`);\n lines.push(`Model: ${elem.model}`);\n if (this.includePlacement) {\n lines.push(`Range: ${this.stringify(elem.calculateRange3d())}`);\n lines.push(`Transform: ${this.stringify(elem.getPlacementTransform())}`);\n }\n\n return lines.join(\"\\n\");\n }\n\n public summarizePartReferences(id: Id64String, is2d: boolean): string {\n const refIds = this.iModel.nativeDb.findGeometryPartReferences([id], is2d);\n return `Part references (${refIds.length}): ${refIds.join()}`;\n }\n\n public getElementGeom(id: Id64String): ElementGeom | undefined {\n const elem = this.iModel.elements.getElement<Element>({ id, wantGeometry: true });\n let iterator: GeometryStreamIterator | undefined;\n let geometricElement: GeometricElement | undefined;\n if (elem instanceof GeometricElement) {\n geometricElement = elem;\n if (geometricElement.is2d()) {\n iterator = GeometryStreamIterator.fromGeometricElement2d(geometricElement);\n } else {\n assert(geometricElement.is3d());\n iterator = GeometryStreamIterator.fromGeometricElement3d(geometricElement);\n }\n } else if (elem instanceof GeometryPart) {\n iterator = GeometryStreamIterator.fromGeometryPart(elem);\n }\n\n return undefined !== iterator ? { iterator, geometricElement } : undefined;\n }\n\n public summarizeRange3d(range: Range3d): string {\n return `SubGraphicRange: ${this.stringify(range)}`;\n }\n\n public summarizePrimitive(lines: string[], primitive: TextStringPrimitive | ImagePrimitive): void {\n const summary = primitive.type;\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\n lines.push(summary);\n return;\n }\n\n const json = this.stringify(primitive.type === \"textString\" ? primitive.textString : primitive.image);\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\n lines.push(`${summary}: ${json}`);\n return;\n }\n\n lines.push(`${summary}:`);\n lines.push(json);\n }\n\n public summarizeBRep(lines: string[], brep: BRepEntity.DataProps): void {\n const summary = \"brep\";\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\n lines.push(summary);\n return;\n }\n\n const json = this.stringify({ type: brep.type, transform: brep.transform, faceSymbology: brep.faceSymbology });\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\n lines.push(`${summary}: ${json}`);\n return;\n }\n\n lines.push(`${summary}:`);\n lines.push(json);\n }\n\n public summarizePartReference(partId: string, partToLocal?: Transform): string {\n let line = `part id: ${partId}`;\n if (undefined !== partToLocal)\n line = `${line} transform: ${this.stringify(partToLocal)}`;\n\n return line;\n }\n\n public summarizeGeometryQuery(lines: string[], query: AnyGeometryQuery): void {\n switch (this.verbosity) {\n case GeometrySummaryVerbosity.Detailed:\n lines.push(this.summarizeGeometryQueryDetailed(query));\n break;\n case GeometrySummaryVerbosity.Full:\n lines.push(this.summarizeGeometryQueryFull(query));\n break;\n default:\n lines.push(this.summarizeGeometryQueryBasic(query));\n break;\n }\n }\n\n public summarizeGeometryQueryBasic(query: AnyGeometryQuery): string {\n switch (query.geometryCategory) {\n case \"solid\":\n return query.solidPrimitiveType;\n case \"curvePrimitive\":\n return query.curvePrimitiveType;\n case \"curveCollection\":\n return query.curveCollectionType;\n default:\n return query.geometryCategory;\n }\n }\n\n public summarizeGeometryQueryFull(query: AnyGeometryQuery): string {\n return this.geometryQueryToJson(query);\n }\n\n public geometryQueryToJson(query: AnyGeometryQuery): string {\n try {\n const json = IModelJson.Writer.toIModelJson(query);\n const str = JSON.stringify(json);\n return this.wantSquish ? this.squish(str) : str;\n } catch (err) {\n return BentleyError.getErrorMessage(err);\n }\n }\n\n // Earlin likes to put tons of whitespace + newlines into his JSON. Remove it.\n public squish(str: string): string {\n return str.replace(/\\s+/g, \"\");\n }\n\n public stringify(obj: object): string {\n const json = JSON.stringify(obj);\n return this.wantSquish ? this.squish(json) : json;\n }\n\n public summarizeGeometryQueryDetailed(query: AnyGeometryQuery): string {\n let summary = `${this.summarizeGeometryQueryBasic(query)}: `;\n switch (query.geometryCategory) {\n case \"solid\":\n return summary + this.summarizeSolidPrimitive(query);\n case \"curvePrimitive\":\n return summary + this.summarizeCurvePrimitive(query);\n case \"curveCollection\":\n return summary + this.summarizeCurveCollection(query);\n case \"pointCollection\":\n return `${summary} numPoints: ${query.points.length}`;\n case \"bsurf\":\n return `${summary}'\n ' poleDimension: ${query.poleDimension}'\n ' numPolesTotal: ${query.numPolesTotal()}'\n ' degree[U,V]: ${JSON.stringify([query.degreeUV(UVSelect.uDirection), query.degreeUV(UVSelect.vDirection)])}'\n ' order[U,V]: ${JSON.stringify([query.orderUV(UVSelect.uDirection), query.orderUV(UVSelect.vDirection)])}'\n ' numSpan[U,V]: ${JSON.stringify([query.numSpanUV(UVSelect.uDirection), query.numSpanUV(UVSelect.vDirection)])}'\n ' numPoles[U,V]: ${JSON.stringify([query.numPolesUV(UVSelect.uDirection), query.numPolesUV(UVSelect.vDirection)])}'\n ' poleStep[U,V]: ${JSON.stringify([query.poleStepUV(UVSelect.uDirection), query.poleStepUV(UVSelect.vDirection)])}`;\n case \"polyface\": {\n const data = query.data;\n summary = `${summary} pointCount: ${data.point.length}'\n ' pointIndexCount: ${data.pointIndex.length}`;\n if (query.twoSided)\n summary = `${summary} (two-sided)`;\n if (undefined !== data.normal)\n summary = `${summary} normalCount: ${data.normal.length}`;\n if (undefined !== data.param)\n summary = `${summary} paramCount: ${data.param.length}`;\n if (undefined !== data.color)\n summary = `${summary} colorCount: ${data.color.length}`;\n\n return summary;\n }\n case \"point\":\n return summary + this.geometryQueryToJson(query);\n }\n }\n\n public summarizeSolidPrimitive(solid: SolidPrimitive): string {\n const summary: string = solid.capped ? \" capped\" : \" uncapped\";\n switch (solid.solidPrimitiveType) {\n case \"box\":\n const box: Box = (solid as Box);\n return `${summary}'\n ' origin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'\n ' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'\n ' baseX: ${box.getBaseX()}'\n ' baseY: ${box.getBaseY()}`;\n case \"cone\":\n const cone: Cone = solid as Cone;\n return `${summary}'\n ' baseCenterPoint: ${JSON.stringify(cone.getCenterA())}'\n ' topCenterPoint: ${JSON.stringify(cone.getCenterB())}'\n ' baseCenterRadius: ${JSON.stringify(cone.getRadiusA())}'\n ' topCenterRadius: ${JSON.stringify(cone.getRadiusB())}`;\n case \"sphere\":\n const sphere: Sphere = solid as Sphere;\n return `${summary}'\n ' centerPoint: ${JSON.stringify(sphere.cloneCenter().toJSON())}'\n ' radius: ${JSON.stringify(sphere.trueSphereRadius())}`;\n case \"linearSweep\":\n const linearSweep: LinearSweep = solid as LinearSweep;\n return `${summary}'\n ' vector: ${linearSweep.cloneSweepVector().toJSON()}'\n ' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;\n case \"rotationalSweep\":\n const rotationalSweep: RotationalSweep = solid as RotationalSweep;\n const axis = rotationalSweep.cloneAxisRay();\n return `${summary}'\n ' center: ${axis.origin.toJSON()}'\n ' axis: ${JSON.stringify(axis.direction.toJSON())}'\n ' sweepAngle: ${rotationalSweep.getSweep().degrees}`;\n case \"ruledSweep\":\n const ruledSweep: RuledSweep = solid as RuledSweep;\n const summarizedCollection = ruledSweep.cloneContours().map((curveCollection) => this.summarizeCurveCollection(curveCollection));\n return `${summary}'\n ' isClosedVolume${ruledSweep.isClosedVolume}'\n ' contours: ${JSON.stringify(summarizedCollection)}`;\n case \"torusPipe\":\n const torusPipe: TorusPipe = solid as TorusPipe;\n const vectorX = torusPipe.cloneVectorX();\n const vectorY = torusPipe.cloneVectorY();\n const sweep = torusPipe.getSweepAngle();\n if (torusPipe.getIsReversed()) {\n vectorY.scaleInPlace(-1.0);\n sweep.setRadians(-sweep.radians);\n }\n return `${summary}'\n ' center: ${torusPipe.cloneCenter().toJSON()}'\n ' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'\n ' majorRadius: ${torusPipe.getMajorRadius()}'\n ' minorRadius: ${torusPipe.getMinorRadius()}'\n ' sweepAngle: ${sweep.degrees}`;\n }\n }\n\n public summarizeCurvePrimitive(curve: CurvePrimitive): string {\n let summary: string = \"\";\n const writer = new IModelJson.Writer();\n switch (curve.curvePrimitiveType) {\n case \"arc\":\n const arc: Arc3d = curve as Arc3d;\n summary = `${summary} center: ${JSON.stringify(arc.center.toJSON())}`;\n if (undefined !== arc.circularRadius)\n summary = `${summary} radius: ${arc.circularRadius()}`;\n summary = `${summary}'\n ' vectorX:${arc.vector0.toJSON()}'\n ' vectorY:${arc.vector90.toJSON()}'\n ' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`\n + ` curveLength: ${curve.curveLength()}`;\n return summary;\n case \"lineSegment\":\n const lineSegment: LineSegment3d = curve as LineSegment3d;\n summary = `${summary} points: ${JSON.stringify(lineSegment.toJSON())}`;\n summary = `${summary} curveLength: ${curve.curveLength()}`;\n return summary;\n case \"lineString\":\n const lineString: LineString3d = curve as LineString3d;\n summary = `${summary} pointCount: ${lineString.numPoints()}'\n ' curveLength: ${curve.curveLength()}`;\n return summary;\n case \"bsplineCurve\":\n const bsplineCurve: BSplineCurve3d = curve as BSplineCurve3d;\n summary = `${summary}'\n ' curveOrder: ${bsplineCurve.order}'\n ' controlPointsCount: ${bsplineCurve.numPoles}'\n ' curveLength: ${curve.curveLength()}`;\n return summary;\n case \"interpolationCurve\":\n const interpolationCurve: InterpolationCurve3d = curve as InterpolationCurve3d;\n const interpolationProps = interpolationCurve.cloneProps();\n summary = `${summary}'\n ' curveOrder: ${interpolationProps.order}'\n ' controlPointsCount: ${interpolationProps.fitPoints.length}`;\n return summary;\n case \"akimaCurve\":\n const akimaCurve: AkimaCurve3d = curve as AkimaCurve3d;\n const akimaProps = akimaCurve.cloneProps();\n summary = `${summary}'\n ' controlPointsCount: ${akimaProps.fitPoints.length}`;\n return summary;\n case \"bezierCurve\":\n const bezierCurve: BezierCurveBase = curve as BezierCurveBase;\n summary = `${summary}'\n ' curveOrder: ${bezierCurve.order}'\n ' controlPointsCount: ${bezierCurve.numPoles}'\n ' curveLength: ${curve.curveLength()}`;\n return summary;\n case \"transitionSpiral\":\n const transitionSpiral: TransitionSpiral3d = curve as TransitionSpiral3d;\n const json = writer.handleTransitionSpiral(transitionSpiral);\n summary = summary + JSON.stringify(json);\n return summary;\n case \"curveChainWithDistanceIndex\":\n const curveChainWithDistanceIndex: CurveChainWithDistanceIndex = curve as CurveChainWithDistanceIndex;\n const path = curveChainWithDistanceIndex.path;\n summary = `${summary}'\n ' curveLength: ${curve.curveLength()}'\n ' isOpen: ${path.isOpenPath}`;\n return summary;\n }\n }\n\n public summarizeCurveCollection(curves: CurveCollection): string {\n let summary: string = \"\";\n switch (curves.curveCollectionType) {\n case \"loop\":\n const loop: Loop = curves as Loop;\n summary = `${summary} isInner: ${loop.isInner}`;\n break;\n case \"path\":\n const path: Path = curves as Path;\n summary = `${summary} isOpen: ${path.isOpenPath}`;\n break;\n }\n\n return `${summary}'\n ' numCurves: ${curves.collectCurvePrimitives().length}'\n ' boundary: ${curves.dgnBoundaryType()}`;\n }\n}\n\n/** @internal */\nexport function generateGeometrySummaries(request: GeometrySummaryRequestProps, iModel: IModelDb): string {\n const generator = new ResponseGenerator(request, iModel);\n return generator.generateSummaries();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GeometrySummary.js","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAA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AAU,EAAE,CAAC;gBAC9B,OAAO,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;IAEM,wBAAwB,CAAC,MAAuB;QACrD,IAAI,OAAO,GAAW,EAAE,CAAC;QACzB,QAAQ,MAAM,CAAC,mBAAmB,EAAE,CAAC;YACnC,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,aAAa,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChD,MAAM;YACR,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClD,MAAM;QACV,CAAC;QAED,OAAO,GAAG,OAAO;mBACF,MAAM,CAAC,sBAAsB,EAAE,CAAC,MAAM;kBACvC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC;IAC3C,CAAC;CACF;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAAoC,EAAE,MAAgB;IAC9F,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;AAHD,8DAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { assert, BentleyError, Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport {\n AkimaCurve3d, AnyGeometryQuery, Arc3d, BezierCurveBase, Box, BSplineCurve3d, Cone, CurveChainWithDistanceIndex, CurveCollection, CurvePrimitive, IModelJson,\n InterpolationCurve3d,\n LinearSweep, LineSegment3d, LineString3d, Loop, Path, Range3d, RotationalSweep, RuledSweep, SolidPrimitive, Sphere, TorusPipe, Transform,\n TransitionSpiral3d, UVSelect,\n} from \"@itwin/core-geometry\";\nimport {\n BRepEntity, GeometryParams, GeometryStreamIterator, GeometrySummaryRequestProps, GeometrySummaryVerbosity, ImagePrimitive,\n IModelError, TextStringPrimitive,\n} from \"@itwin/core-common\";\nimport { Element, GeometricElement, GeometryPart } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\n\ninterface ElementGeom {\n iterator: GeometryStreamIterator;\n geometricElement?: GeometricElement;\n}\n\n// cspell:ignore earlin\n\n/** Generates an array of GeometryStreamResponseProps. */\nclass ResponseGenerator {\n public verbosity = GeometrySummaryVerbosity.Basic;\n public includePlacement = false;\n public includePartReferences?: \"2d\" | \"3d\";\n public verboseSymbology = false;\n public elementIds: Id64Array;\n public iModel: IModelDb;\n\n public get wantSquish() { return GeometrySummaryVerbosity.Full !== this.verbosity; }\n\n public constructor(request: GeometrySummaryRequestProps, iModel: IModelDb) {\n this.elementIds = request.elementIds;\n this.iModel = iModel;\n const opts = request.options;\n if (undefined !== opts) {\n this.verbosity = undefined !== opts.geometryVerbosity ? opts.geometryVerbosity : GeometrySummaryVerbosity.Basic;\n this.includePlacement = true === opts.includePlacement;\n this.includePartReferences = opts.includePartReferences;\n this.verboseSymbology = true === opts.verboseSymbology;\n }\n }\n\n public generateSummaries(): string {\n const summaries: string[] = [];\n for (const elementId of this.elementIds)\n summaries.push(this.generateSummary(elementId));\n\n return summaries.join(\"\\n\");\n }\n\n public generateSummary(id: Id64String): string {\n let lines = [`[Geometry Summary for Element ${id}]`];\n try {\n const geom = this.getElementGeom(id);\n if (undefined === geom)\n throw new IModelError(IModelStatus.NoGeometry, \"Element is neither a geometric element nor a geometry part\");\n\n if (undefined !== geom.geometricElement)\n lines.push(this.summarizeElement(geom.geometricElement));\n else if (undefined !== this.includePartReferences)\n lines.push(this.summarizePartReferences(id, \"2d\" === this.includePartReferences)); // NB: Hideously inefficient if more than one element's summary was requested.\n\n let curGeomParams: GeometryParams | undefined;\n let curLocalRange: Range3d | undefined;\n for (const entry of geom.iterator) {\n if (this.verboseSymbology && (undefined === curGeomParams || !curGeomParams.isEquivalent(entry.geomParams))) {\n lines.push(`Symbology: ${this.stringify(entry.geomParams)}`);\n curGeomParams = entry.geomParams.clone();\n }\n\n if (undefined !== entry.localRange && (undefined === curLocalRange || !curLocalRange.isAlmostEqual(entry.localRange))) {\n lines.push(this.summarizeRange3d(entry.localRange));\n curLocalRange = entry.localRange;\n }\n\n const prim = entry.primitive;\n switch (prim.type) {\n case \"textString\":\n case \"image\":\n this.summarizePrimitive(lines, prim);\n break;\n case \"brep\":\n this.summarizeBRep(lines, prim.brep);\n break;\n case \"geometryQuery\":\n this.summarizeGeometryQuery(lines, prim.geometry);\n break;\n case \"partReference\":\n lines.push(this.summarizePartReference(prim.part.id, prim.part.toLocal));\n break;\n }\n }\n } catch (err) {\n lines = lines.slice(0, 1);\n lines.push(`ERROR: ${BentleyError.getErrorMessage(err)}`);\n }\n\n return lines.filter((line) => line !== \"\").join(\"\\n\");\n }\n\n public summarizeElement(elem: GeometricElement): string {\n const lines: string[] = [];\n lines.push(`(${elem.is2d() ? \"2D\" : \"3D\"}) Category: ${elem.category}`);\n lines.push(`Model: ${elem.model}`);\n if (this.includePlacement) {\n lines.push(`Range: ${this.stringify(elem.calculateRange3d())}`);\n lines.push(`Transform: ${this.stringify(elem.getPlacementTransform())}`);\n }\n\n return lines.join(\"\\n\");\n }\n\n public summarizePartReferences(id: Id64String, is2d: boolean): string {\n const refIds = this.iModel.nativeDb.findGeometryPartReferences([id], is2d);\n return `Part references (${refIds.length}): ${refIds.join()}`;\n }\n\n public getElementGeom(id: Id64String): ElementGeom | undefined {\n const elem = this.iModel.elements.getElement<Element>({ id, wantGeometry: true });\n let iterator: GeometryStreamIterator | undefined;\n let geometricElement: GeometricElement | undefined;\n if (elem instanceof GeometricElement) {\n geometricElement = elem;\n if (geometricElement.is2d()) {\n iterator = GeometryStreamIterator.fromGeometricElement2d(geometricElement);\n } else {\n assert(geometricElement.is3d());\n iterator = GeometryStreamIterator.fromGeometricElement3d(geometricElement);\n }\n } else if (elem instanceof GeometryPart) {\n iterator = GeometryStreamIterator.fromGeometryPart(elem);\n }\n\n return undefined !== iterator ? { iterator, geometricElement } : undefined;\n }\n\n public summarizeRange3d(range: Range3d): string {\n return `SubGraphicRange: ${this.stringify(range)}`;\n }\n\n public summarizePrimitive(lines: string[], primitive: TextStringPrimitive | ImagePrimitive): void {\n const summary = primitive.type;\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\n lines.push(summary);\n return;\n }\n\n const json = this.stringify(primitive.type === \"textString\" ? primitive.textString : primitive.image);\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\n lines.push(`${summary}: ${json}`);\n return;\n }\n\n lines.push(`${summary}:`);\n lines.push(json);\n }\n\n public summarizeBRep(lines: string[], brep: BRepEntity.DataProps): void {\n const summary = \"brep\";\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\n lines.push(summary);\n return;\n }\n\n const json = this.stringify({ type: brep.type, transform: brep.transform, faceSymbology: brep.faceSymbology });\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\n lines.push(`${summary}: ${json}`);\n return;\n }\n\n lines.push(`${summary}:`);\n lines.push(json);\n }\n\n public summarizePartReference(partId: string, partToLocal?: Transform): string {\n let line = `part id: ${partId}`;\n if (undefined !== partToLocal)\n line = `${line} transform: ${this.stringify(partToLocal)}`;\n\n return line;\n }\n\n public summarizeGeometryQuery(lines: string[], query: AnyGeometryQuery): void {\n switch (this.verbosity) {\n case GeometrySummaryVerbosity.Detailed:\n lines.push(this.summarizeGeometryQueryDetailed(query));\n break;\n case GeometrySummaryVerbosity.Full:\n lines.push(this.summarizeGeometryQueryFull(query));\n break;\n default:\n lines.push(this.summarizeGeometryQueryBasic(query));\n break;\n }\n }\n\n public summarizeGeometryQueryBasic(query: AnyGeometryQuery): string {\n switch (query.geometryCategory) {\n case \"solid\":\n return query.solidPrimitiveType;\n case \"curvePrimitive\":\n return query.curvePrimitiveType;\n case \"curveCollection\":\n return query.curveCollectionType;\n default:\n return query.geometryCategory;\n }\n }\n\n public summarizeGeometryQueryFull(query: AnyGeometryQuery): string {\n return this.geometryQueryToJson(query);\n }\n\n public geometryQueryToJson(query: AnyGeometryQuery): string {\n try {\n const json = IModelJson.Writer.toIModelJson(query);\n const str = JSON.stringify(json);\n return this.wantSquish ? this.squish(str) : str;\n } catch (err) {\n return BentleyError.getErrorMessage(err);\n }\n }\n\n // Earlin likes to put tons of whitespace + newlines into his JSON. Remove it.\n public squish(str: string): string {\n return str.replace(/\\s+/g, \"\");\n }\n\n public stringify(obj: object): string {\n const json = JSON.stringify(obj);\n return this.wantSquish ? this.squish(json) : json;\n }\n\n public summarizeGeometryQueryDetailed(query: AnyGeometryQuery): string {\n let summary = `${this.summarizeGeometryQueryBasic(query)}: `;\n switch (query.geometryCategory) {\n case \"solid\":\n return summary + this.summarizeSolidPrimitive(query);\n case \"curvePrimitive\":\n return summary + this.summarizeCurvePrimitive(query);\n case \"curveCollection\":\n return summary + this.summarizeCurveCollection(query);\n case \"pointCollection\":\n return `${summary} numPoints: ${query.points.length}`;\n case \"bsurf\":\n return `${summary}'\n ' poleDimension: ${query.poleDimension}'\n ' numPolesTotal: ${query.numPolesTotal()}'\n ' degree[U,V]: ${JSON.stringify([query.degreeUV(UVSelect.uDirection), query.degreeUV(UVSelect.vDirection)])}'\n ' order[U,V]: ${JSON.stringify([query.orderUV(UVSelect.uDirection), query.orderUV(UVSelect.vDirection)])}'\n ' numSpan[U,V]: ${JSON.stringify([query.numSpanUV(UVSelect.uDirection), query.numSpanUV(UVSelect.vDirection)])}'\n ' numPoles[U,V]: ${JSON.stringify([query.numPolesUV(UVSelect.uDirection), query.numPolesUV(UVSelect.vDirection)])}'\n ' poleStep[U,V]: ${JSON.stringify([query.poleStepUV(UVSelect.uDirection), query.poleStepUV(UVSelect.vDirection)])}`;\n case \"polyface\": {\n const data = query.data;\n summary = `${summary} pointCount: ${data.point.length}'\n ' pointIndexCount: ${data.pointIndex.length}`;\n if (query.twoSided)\n summary = `${summary} (two-sided)`;\n if (undefined !== data.normal)\n summary = `${summary} normalCount: ${data.normal.length}`;\n if (undefined !== data.param)\n summary = `${summary} paramCount: ${data.param.length}`;\n if (undefined !== data.color)\n summary = `${summary} colorCount: ${data.color.length}`;\n\n return summary;\n }\n case \"point\":\n return summary + this.geometryQueryToJson(query);\n }\n }\n\n public summarizeSolidPrimitive(solid: SolidPrimitive): string {\n const summary: string = solid.capped ? \" capped\" : \" uncapped\";\n switch (solid.solidPrimitiveType) {\n case \"box\":\n const box: Box = (solid as Box);\n return `${summary}'\n ' origin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'\n ' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'\n ' baseX: ${box.getBaseX()}'\n ' baseY: ${box.getBaseY()}`;\n case \"cone\":\n const cone: Cone = solid as Cone;\n return `${summary}'\n ' baseCenterPoint: ${JSON.stringify(cone.getCenterA())}'\n ' topCenterPoint: ${JSON.stringify(cone.getCenterB())}'\n ' baseCenterRadius: ${JSON.stringify(cone.getRadiusA())}'\n ' topCenterRadius: ${JSON.stringify(cone.getRadiusB())}`;\n case \"sphere\":\n const sphere: Sphere = solid as Sphere;\n return `${summary}'\n ' centerPoint: ${JSON.stringify(sphere.cloneCenter().toJSON())}'\n ' radius: ${JSON.stringify(sphere.trueSphereRadius())}`;\n case \"linearSweep\":\n const linearSweep: LinearSweep = solid as LinearSweep;\n return `${summary}'\n ' vector: ${JSON.stringify(linearSweep.cloneSweepVector().toJSON())}'\n ' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;\n case \"rotationalSweep\":\n const rotationalSweep: RotationalSweep = solid as RotationalSweep;\n const axis = rotationalSweep.cloneAxisRay();\n return `${summary}'\n ' center: ${JSON.stringify(axis.origin.toJSON())}'\n ' axis: ${JSON.stringify(axis.direction.toJSON())}'\n ' sweepAngle: ${rotationalSweep.getSweep().degrees}`;\n case \"ruledSweep\":\n const ruledSweep: RuledSweep = solid as RuledSweep;\n const summarizedCollection = ruledSweep.cloneContours().map((curveCollection) => this.summarizeCurveCollection(curveCollection));\n return `${summary}'\n ' isClosedVolume${ruledSweep.isClosedVolume}'\n ' contours: ${JSON.stringify(summarizedCollection)}`;\n case \"torusPipe\":\n const torusPipe: TorusPipe = solid as TorusPipe;\n const vectorX = torusPipe.cloneVectorX();\n const vectorY = torusPipe.cloneVectorY();\n const sweep = torusPipe.getSweepAngle();\n if (torusPipe.getIsReversed()) {\n vectorY.scaleInPlace(-1.0);\n sweep.setRadians(-sweep.radians);\n }\n return `${summary}'\n ' center: ${JSON.stringify(torusPipe.cloneCenter().toJSON())}'\n ' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'\n ' majorRadius: ${torusPipe.getMajorRadius()}'\n ' minorRadius: ${torusPipe.getMinorRadius()}'\n ' sweepAngle: ${sweep.degrees}`;\n }\n }\n\n public summarizeCurvePrimitive(curve: CurvePrimitive): string {\n let summary: string = \"\";\n const writer = new IModelJson.Writer();\n switch (curve.curvePrimitiveType) {\n case \"arc\":\n const arc: Arc3d = curve as Arc3d;\n summary = `${summary} center: ${JSON.stringify(arc.center.toJSON())}`;\n if (undefined !== arc.circularRadius)\n summary = `${summary} radius: ${arc.circularRadius()}`;\n summary = `${summary}'\n ' vectorX:${JSON.stringify(arc.vector0.toJSON())}'\n ' vectorY:${JSON.stringify(arc.vector90.toJSON())}'\n ' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`\n + ` curveLength: ${curve.curveLength()}`;\n return summary;\n case \"lineSegment\":\n const lineSegment: LineSegment3d = curve as LineSegment3d;\n summary = `${summary} points: ${JSON.stringify(lineSegment.toJSON())}`;\n summary = `${summary} curveLength: ${curve.curveLength()}`;\n return summary;\n case \"lineString\":\n const lineString: LineString3d = curve as LineString3d;\n summary = `${summary} pointCount: ${lineString.numPoints()}'\n ' curveLength: ${curve.curveLength()}`;\n return summary;\n case \"bsplineCurve\":\n const bsplineCurve: BSplineCurve3d = curve as BSplineCurve3d;\n summary = `${summary}'\n ' curveOrder: ${bsplineCurve.order}'\n ' controlPointsCount: ${bsplineCurve.numPoles}'\n ' curveLength: ${curve.curveLength()}`;\n return summary;\n case \"interpolationCurve\":\n const interpolationCurve: InterpolationCurve3d = curve as InterpolationCurve3d;\n const interpolationProps = interpolationCurve.cloneProps();\n summary = `${summary}'\n ' curveOrder: ${interpolationProps.order}'\n ' controlPointsCount: ${interpolationProps.fitPoints.length}`;\n return summary;\n case \"akimaCurve\":\n const akimaCurve: AkimaCurve3d = curve as AkimaCurve3d;\n const akimaProps = akimaCurve.cloneProps();\n summary = `${summary}'\n ' controlPointsCount: ${akimaProps.fitPoints.length}`;\n return summary;\n case \"bezierCurve\":\n const bezierCurve: BezierCurveBase = curve as BezierCurveBase;\n summary = `${summary}'\n ' curveOrder: ${bezierCurve.order}'\n ' controlPointsCount: ${bezierCurve.numPoles}'\n ' curveLength: ${curve.curveLength()}`;\n return summary;\n case \"transitionSpiral\":\n const transitionSpiral: TransitionSpiral3d = curve as TransitionSpiral3d;\n const json = writer.handleTransitionSpiral(transitionSpiral);\n summary = summary + JSON.stringify(json);\n return summary;\n case \"curveChainWithDistanceIndex\":\n const curveChainWithDistanceIndex: CurveChainWithDistanceIndex = curve as CurveChainWithDistanceIndex;\n const path = curveChainWithDistanceIndex.path;\n summary = `${summary}'\n ' curveLength: ${curve.curveLength()}'\n ' isOpen: ${path.isOpenPath}`;\n return summary;\n }\n }\n\n public summarizeCurveCollection(curves: CurveCollection): string {\n let summary: string = \"\";\n switch (curves.curveCollectionType) {\n case \"loop\":\n const loop: Loop = curves as Loop;\n summary = `${summary} isInner: ${loop.isInner}`;\n break;\n case \"path\":\n const path: Path = curves as Path;\n summary = `${summary} isOpen: ${path.isOpenPath}`;\n break;\n }\n\n return `${summary}'\n ' numCurves: ${curves.collectCurvePrimitives().length}'\n ' boundary: ${curves.dgnBoundaryType()}`;\n }\n}\n\n/** @internal */\nexport function generateGeometrySummaries(request: GeometrySummaryRequestProps, iModel: IModelDb): string {\n const generator = new ResponseGenerator(request, iModel);\n return generator.generateSummaries();\n}\n"]}
|
package/lib/cjs/HubMock.js
CHANGED
package/lib/cjs/HubMock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HubMock.js","sourceRoot":"","sources":["../../src/HubMock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA4B;AAC5B,sDAAuD;AASvD,2DAAwF;AACxF,6CAA0C;AAC1C,6CAA0C;AAC1C,yCAAsC;AAGtC,SAAS,UAAU,CAAC,GAAuB;IACzC,IAAI,SAAS,KAAK,GAAG;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,OAAO;IAMlB,oEAAoE;IAC7D,MAAM,KAAK,OAAO,KAAK,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,OAAO;QACvB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,QAAsB,EAAE,SAAiB;QAC7D,IAAI,IAAI,CAAC,OAAO;YACd,MAAM,IAAI,KAAK,CAAC,0JAA0J,CAAC,CAAC;QAE9K,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACrD,uBAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,uBAAU,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,uBAAU,CAAC,YAAY,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AC;YACtC,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACvC,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,CAAC,CAAC,CAAC,CAAC;gBAChB,OAAO,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;;AAlNc,YAAI,GAAG,IAAI,GAAG,EAAoB,CAAC;AAFvC,0BAAO","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { join } from \"path\";\nimport { Guid, GuidString } from \"@itwin/core-bentley\";\nimport {\n ChangesetFileProps, ChangesetIndex, ChangesetIndexAndId, ChangesetProps, ChangesetRange, IModelVersion, LocalDirName,\n} from \"@itwin/core-common\";\nimport {\n AcquireNewBriefcaseIdArg,\n BackendHubAccess, BriefcaseDbArg, BriefcaseIdArg, ChangesetArg, CheckpointArg, CreateNewIModelProps, DownloadChangesetArg, DownloadChangesetRangeArg, IModelIdArg, IModelNameArg,\n LockMap, LockProps, V2CheckpointAccessProps,\n} from \"./BackendHubAccess\";\nimport { CheckpointProps, ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { IModelHost } from \"./IModelHost\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { LocalHub } from \"./LocalHub\";\nimport { TokenArg } from \"./IModelDb\";\n\nfunction wasStarted(val: string | undefined): asserts val is string {\n if (undefined === val)\n throw new Error(\"Call HubMock.startup first\");\n}\n\n/**\n * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.\n *\n * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:\n * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs\n * - waste network and data center resources (i.e. $$$s),\n * - interfere with other tests running on the same or other systems, and\n * - (far worse) are the source of test flakiness outside of the api being tested.\n *\n * This class can be used to create tests that do not require authentication, are synchronous,\n * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside\n * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.\n *\n * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests\n * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to\n * low level testing of the core apis only.\n *\n * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be\n * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean\n * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the\n * test against a \"real\" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your\n * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)\n *\n * Mocked tests must always start by creating a new iModel via [[IModelHost.hubAccess.createNewIModel]] with a `version0` iModel.\n * They use mock (aka \"bogus\") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current\n * computer.\n *\n * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests\n * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.\n *\n * @internal\n */\nexport class HubMock {\n private static mockRoot: LocalDirName | undefined;\n private static hubs = new Map<string, LocalHub>();\n private static _saveHubAccess: BackendHubAccess | undefined;\n private static _iTwinId: GuidString | undefined;\n\n /** Determine whether a test us currently being run under HubMock */\n public static get isValid() { return undefined !== this.mockRoot; }\n public static get iTwinId() {\n wasStarted(this._iTwinId);\n return this._iTwinId;\n }\n\n /**\n * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].\n * @param mockName a unique name (e.g. \"MyTest\") for this HubMock to disambiguate tests when more than one is simultaneously active.\n * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.\n */\n public static startup(mockName: LocalDirName, outputDir: string) {\n if (this.isValid)\n throw new Error(\"Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed\");\n\n this.hubs.clear();\n this.mockRoot = join(outputDir, \"HubMock\", mockName);\n IModelJsFs.recursiveMkDirSync(this.mockRoot);\n IModelJsFs.purgeDirSync(this.mockRoot);\n this._saveHubAccess = IModelHost.getHubAccess();\n\n IModelHost.setHubAccess(this);\n HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same \"iTwinId\"\n }\n\n /** Stop a HubMock that was previously started with [[startup]]\n * @note this function throws an exception if any of the iModels used during the tests are left open.\n */\n public static shutdown() {\n if (this.mockRoot === undefined)\n return;\n\n HubMock._iTwinId = undefined;\n for (const hub of this.hubs)\n hub[1].cleanup();\n\n this.hubs.clear();\n IModelJsFs.purgeDirSync(this.mockRoot);\n IModelJsFs.removeSync(this.mockRoot);\n IModelHost.setHubAccess(this._saveHubAccess);\n this.mockRoot = undefined;\n }\n\n public static findLocalHub(iModelId: GuidString): LocalHub {\n const hub = this.hubs.get(iModelId);\n if (!hub)\n throw new Error(`local hub for iModel ${iModelId} not created`);\n return hub;\n }\n\n /** create a [[LocalHub]] for an iModel. */\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\n wasStarted(this.mockRoot);\n const props = { ...arg, iModelId: Guid.createValue() };\n const mock = new LocalHub(join(this.mockRoot, props.iModelId), props);\n this.hubs.set(props.iModelId, mock);\n return props.iModelId;\n }\n\n /** remove the [[LocalHub]] for an iModel */\n public static destroy(iModelId: GuidString) {\n this.findLocalHub(iModelId).cleanup();\n this.hubs.delete(iModelId);\n }\n\n /** All methods below are mocks of the [[BackendHubAccess]] interface */\n\n public static async getChangesetFromNamedVersion(arg: IModelIdArg & { versionName: string }): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);\n }\n\n private static changesetIndexFromArg(arg: ChangesetArg) {\n return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);\n }\n\n public static async getChangesetFromVersion(arg: IModelIdArg & { version: IModelVersion }): Promise<ChangesetProps> {\n const hub = this.findLocalHub(arg.iModelId);\n const version = arg.version;\n if (version.isFirst)\n return hub.getChangesetByIndex(0);\n\n const asOf = version.getAsOfChangeSet();\n if (asOf)\n return hub.getChangesetById(asOf);\n\n const versionName = version.getName();\n if (versionName)\n return hub.findNamedVersion(versionName);\n\n return hub.getLatestChangeset();\n }\n\n public static async getLatestChangeset(arg: IModelIdArg): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).getLatestChangeset();\n }\n\n private static async getAccessToken(arg: TokenArg) {\n return arg.accessToken ?? await IModelHost.getAccessToken();\n }\n\n public static async getMyBriefcaseIds(arg: IModelIdArg): Promise<number[]> {\n const accessToken = await this.getAccessToken(arg);\n return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);\n }\n\n public static async acquireNewBriefcaseId(arg: AcquireNewBriefcaseIdArg): Promise<number> {\n const accessToken = await this.getAccessToken(arg);\n return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);\n }\n\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\n public static async releaseBriefcase(arg: BriefcaseIdArg): Promise<void> {\n return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);\n }\n\n public static async downloadChangeset(arg: DownloadChangesetArg): Promise<ChangesetFileProps> {\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });\n\n if (arg.progressCallback) {\n const totalSize = IModelJsFs.lstatSync(changesetProps.pathname)?.size;\n if (totalSize)\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\n }\n\n return changesetProps;\n }\n\n public static async downloadChangesets(arg: DownloadChangesetRangeArg): Promise<ChangesetFileProps[]> {\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });\n\n if (arg.progressCallback) {\n const totalSize = changesetProps.reduce((sum, props) => sum + (IModelJsFs.lstatSync(props.pathname)?.size ?? 0), 0);\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\n }\n\n return changesetProps;\n }\n\n public static async queryChangeset(arg: ChangesetArg): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));\n }\n\n public static async queryChangesets(arg: IModelIdArg & { range?: ChangesetRange }): Promise<ChangesetProps[]> {\n return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);\n }\n\n public static async pushChangeset(arg: IModelIdArg & { changesetProps: ChangesetFileProps }): Promise<ChangesetIndex> {\n return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);\n }\n\n public static async queryV2Checkpoint(_arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined> {\n return undefined;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public static async downloadV1Checkpoint(arg: CheckpointArg): Promise<ChangesetIndexAndId> {\n return this.findLocalHub(arg.checkpoint.iModelId).downloadCheckpoint({ changeset: arg.checkpoint.changeset, targetFile: arg.localFile });\n }\n\n public static async releaseAllLocks(arg: BriefcaseDbArg) {\n const hub = this.findLocalHub(arg.iModelId);\n hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });\n }\n\n public static async queryAllLocks(_arg: BriefcaseDbArg): Promise<LockProps[]> {\n return [];\n }\n\n public static async acquireLocks(arg: BriefcaseDbArg, locks: LockMap): Promise<void> {\n this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);\n }\n\n public static async queryIModelByName(arg: IModelNameArg): Promise<GuidString | undefined> {\n for (const hub of this.hubs) {\n const localHub = hub[1];\n if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)\n return localHub.iModelId;\n }\n return undefined;\n }\n\n public static async deleteIModel(arg: IModelIdArg & { iTwinId: GuidString }): Promise<void> {\n return this.destroy(arg.iModelId);\n }\n\n private static async mockProgressReporting(progressCallback: ProgressFunction, totalSize: number): Promise<void> {\n await new Promise((resolve, reject) => {\n let rejected = false;\n\n const mockProgress = (index: number) => {\n const bytesDownloaded = Math.floor(totalSize * (index / 4));\n if (!rejected && progressCallback(bytesDownloaded, totalSize) === ProgressStatus.Abort){\n rejected = true;\n reject(new Error(\"AbortError\"));\n }\n };\n\n mockProgress(1);\n setTimeout(() => mockProgress(2), 50);\n setTimeout(() => mockProgress(3), 100);\n setTimeout(() => {\n mockProgress(4);\n resolve(undefined);\n }, 150);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"HubMock.js","sourceRoot":"","sources":["../../src/HubMock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA4B;AAC5B,sDAAuD;AASvD,2DAAwF;AACxF,6CAA0C;AAC1C,6CAA0C;AAC1C,yCAAsC;AAGtC,SAAS,UAAU,CAAC,GAAuB;IACzC,IAAI,SAAS,KAAK,GAAG;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,OAAO;IAMlB,oEAAoE;IAC7D,MAAM,KAAK,OAAO,KAAK,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,OAAO;QACvB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,QAAsB,EAAE,SAAiB;QAC7D,IAAI,IAAI,CAAC,OAAO;YACd,MA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CAAC,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC5D,IAAI,CAAC,QAAQ,IAAI,gBAAgB,CAAC,eAAe,EAAE,SAAS,CAAC,KAAK,kCAAc,CAAC,KAAK,EAAC,CAAC;oBACtF,QAAQ,GAAG,IAAI,CAAC;oBAChB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC;YAEF,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACvC,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,CAAC,CAAC,CAAC,CAAC;gBAChB,OAAO,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;;AApNH,0BAqNC;AAnNgB,YAAI,GAAG,IAAI,GAAG,EAAoB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { join } from \"path\";\nimport { Guid, GuidString } from \"@itwin/core-bentley\";\nimport {\n ChangesetFileProps, ChangesetIndex, ChangesetIndexAndId, ChangesetProps, ChangesetRange, IModelVersion, LocalDirName,\n} from \"@itwin/core-common\";\nimport {\n AcquireNewBriefcaseIdArg,\n BackendHubAccess, BriefcaseDbArg, BriefcaseIdArg, ChangesetArg, CheckpointArg, CreateNewIModelProps, DownloadChangesetArg, DownloadChangesetRangeArg, IModelIdArg, IModelNameArg,\n LockMap, LockProps, V2CheckpointAccessProps,\n} from \"./BackendHubAccess\";\nimport { CheckpointProps, ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { IModelHost } from \"./IModelHost\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { LocalHub } from \"./LocalHub\";\nimport { TokenArg } from \"./IModelDb\";\n\nfunction wasStarted(val: string | undefined): asserts val is string {\n if (undefined === val)\n throw new Error(\"Call HubMock.startup first\");\n}\n\n/**\n * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.\n *\n * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:\n * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs\n * - waste network and data center resources (i.e. $$$s),\n * - interfere with other tests running on the same or other systems, and\n * - (far worse) are the source of test flakiness outside of the api being tested.\n *\n * This class can be used to create tests that do not require authentication, are synchronous,\n * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside\n * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.\n *\n * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests\n * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to\n * low level testing of the core apis only.\n *\n * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be\n * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean\n * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the\n * test against a \"real\" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your\n * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)\n *\n * Mocked tests must always start by creating a new iModel via [[IModelHost.hubAccess.createNewIModel]] with a `version0` iModel.\n * They use mock (aka \"bogus\") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current\n * computer.\n *\n * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests\n * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.\n *\n * @internal\n */\nexport class HubMock {\n private static mockRoot: LocalDirName | undefined;\n private static hubs = new Map<string, LocalHub>();\n private static _saveHubAccess: BackendHubAccess | undefined;\n private static _iTwinId: GuidString | undefined;\n\n /** Determine whether a test us currently being run under HubMock */\n public static get isValid() { return undefined !== this.mockRoot; }\n public static get iTwinId() {\n wasStarted(this._iTwinId);\n return this._iTwinId;\n }\n\n /**\n * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].\n * @param mockName a unique name (e.g. \"MyTest\") for this HubMock to disambiguate tests when more than one is simultaneously active.\n * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.\n */\n public static startup(mockName: LocalDirName, outputDir: string) {\n if (this.isValid)\n throw new Error(\"Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed\");\n\n this.hubs.clear();\n this.mockRoot = join(outputDir, \"HubMock\", mockName);\n IModelJsFs.recursiveMkDirSync(this.mockRoot);\n IModelJsFs.purgeDirSync(this.mockRoot);\n this._saveHubAccess = IModelHost.getHubAccess();\n\n IModelHost.setHubAccess(this);\n HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same \"iTwinId\"\n }\n\n /** Stop a HubMock that was previously started with [[startup]]\n * @note this function throws an exception if any of the iModels used during the tests are left open.\n */\n public static shutdown() {\n if (this.mockRoot === undefined)\n return;\n\n HubMock._iTwinId = undefined;\n for (const hub of this.hubs)\n hub[1].cleanup();\n\n this.hubs.clear();\n IModelJsFs.purgeDirSync(this.mockRoot);\n IModelJsFs.removeSync(this.mockRoot);\n IModelHost.setHubAccess(this._saveHubAccess);\n this.mockRoot = undefined;\n }\n\n public static findLocalHub(iModelId: GuidString): LocalHub {\n const hub = this.hubs.get(iModelId);\n if (!hub)\n throw new Error(`local hub for iModel ${iModelId} not created`);\n return hub;\n }\n\n /** create a [[LocalHub]] for an iModel. */\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\n wasStarted(this.mockRoot);\n const props = { ...arg, iModelId: Guid.createValue() };\n const mock = new LocalHub(join(this.mockRoot, props.iModelId), props);\n this.hubs.set(props.iModelId, mock);\n return props.iModelId;\n }\n\n /** remove the [[LocalHub]] for an iModel */\n public static destroy(iModelId: GuidString) {\n this.findLocalHub(iModelId).cleanup();\n this.hubs.delete(iModelId);\n }\n\n /** All methods below are mocks of the [[BackendHubAccess]] interface */\n\n public static async getChangesetFromNamedVersion(arg: IModelIdArg & { versionName: string }): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);\n }\n\n private static changesetIndexFromArg(arg: ChangesetArg) {\n return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);\n }\n\n public static async getChangesetFromVersion(arg: IModelIdArg & { version: IModelVersion }): Promise<ChangesetProps> {\n const hub = this.findLocalHub(arg.iModelId);\n const version = arg.version;\n if (version.isFirst)\n return hub.getChangesetByIndex(0);\n\n const asOf = version.getAsOfChangeSet();\n if (asOf)\n return hub.getChangesetById(asOf);\n\n const versionName = version.getName();\n if (versionName)\n return hub.findNamedVersion(versionName);\n\n return hub.getLatestChangeset();\n }\n\n public static async getLatestChangeset(arg: IModelIdArg): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).getLatestChangeset();\n }\n\n private static async getAccessToken(arg: TokenArg) {\n return arg.accessToken ?? await IModelHost.getAccessToken();\n }\n\n public static async getMyBriefcaseIds(arg: IModelIdArg): Promise<number[]> {\n const accessToken = await this.getAccessToken(arg);\n return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);\n }\n\n public static async acquireNewBriefcaseId(arg: AcquireNewBriefcaseIdArg): Promise<number> {\n const accessToken = await this.getAccessToken(arg);\n return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);\n }\n\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\n public static async releaseBriefcase(arg: BriefcaseIdArg): Promise<void> {\n return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);\n }\n\n public static async downloadChangeset(arg: DownloadChangesetArg): Promise<ChangesetFileProps> {\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });\n\n if (arg.progressCallback) {\n const totalSize = IModelJsFs.lstatSync(changesetProps.pathname)?.size;\n if (totalSize)\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\n }\n\n return changesetProps;\n }\n\n public static async downloadChangesets(arg: DownloadChangesetRangeArg): Promise<ChangesetFileProps[]> {\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });\n\n if (arg.progressCallback) {\n const totalSize = changesetProps.reduce((sum, props) => sum + (IModelJsFs.lstatSync(props.pathname)?.size ?? 0), 0);\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\n }\n\n return changesetProps;\n }\n\n public static async queryChangeset(arg: ChangesetArg): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));\n }\n\n public static async queryChangesets(arg: IModelIdArg & { range?: ChangesetRange }): Promise<ChangesetProps[]> {\n return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);\n }\n\n public static async pushChangeset(arg: IModelIdArg & { changesetProps: ChangesetFileProps }): Promise<ChangesetIndex> {\n return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);\n }\n\n public static async queryV2Checkpoint(_arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined> {\n return undefined;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public static async downloadV1Checkpoint(arg: CheckpointArg): Promise<ChangesetIndexAndId> {\n return this.findLocalHub(arg.checkpoint.iModelId).downloadCheckpoint({ changeset: arg.checkpoint.changeset, targetFile: arg.localFile });\n }\n\n public static async releaseAllLocks(arg: BriefcaseDbArg) {\n const hub = this.findLocalHub(arg.iModelId);\n hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });\n }\n\n public static async queryAllLocks(_arg: BriefcaseDbArg): Promise<LockProps[]> {\n return [];\n }\n\n public static async acquireLocks(arg: BriefcaseDbArg, locks: LockMap): Promise<void> {\n this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);\n }\n\n public static async queryIModelByName(arg: IModelNameArg): Promise<GuidString | undefined> {\n for (const hub of this.hubs) {\n const localHub = hub[1];\n if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)\n return localHub.iModelId;\n }\n return undefined;\n }\n\n public static async deleteIModel(arg: IModelIdArg & { iTwinId: GuidString }): Promise<void> {\n return this.destroy(arg.iModelId);\n }\n\n private static async mockProgressReporting(progressCallback: ProgressFunction, totalSize: number): Promise<void> {\n await new Promise((resolve, reject) => {\n let rejected = false;\n\n const mockProgress = (index: number) => {\n const bytesDownloaded = Math.floor(totalSize * (index / 4));\n if (!rejected && progressCallback(bytesDownloaded, totalSize) === ProgressStatus.Abort){\n rejected = true;\n reject(new Error(\"AbortError\"));\n }\n };\n\n mockProgress(1);\n setTimeout(() => mockProgress(2), 50);\n setTimeout(() => mockProgress(3), 100);\n setTimeout(() => {\n mockProgress(4);\n resolve(undefined);\n }, 150);\n });\n }\n}\n"]}
|
package/lib/cjs/IModelDb.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { ViewDefinition } from "./ViewDefinition";
|
|
|
26
26
|
import { ViewStore } from "./ViewStore";
|
|
27
27
|
import { SettingDictionary } from "./workspace/Settings";
|
|
28
28
|
import { Workspace } from "./workspace/Workspace";
|
|
29
|
+
import { ComputeRangesForTextLayoutArgs, TextLayoutRanges } from "./TextAnnotationLayout";
|
|
29
30
|
import type { BlobContainer } from "./BlobContainerService";
|
|
30
31
|
/** @internal */
|
|
31
32
|
export interface ChangesetConflictArgs {
|
|
@@ -544,6 +545,8 @@ export declare abstract class IModelDb extends IModel {
|
|
|
544
545
|
* @throws [[IModelError]] if the metadata cannot be found nor loaded.
|
|
545
546
|
*/
|
|
546
547
|
getMetaData(classFullName: string): EntityMetaData;
|
|
548
|
+
/** Identical to [[getMetaData]], except it returns `undefined` instead of throwing an error if the metadata cannot be found nor loaded. */
|
|
549
|
+
tryGetMetaData(classFullName: string): EntityMetaData | undefined;
|
|
547
550
|
/** Invoke a callback on each property of the specified class, optionally including superclass properties.
|
|
548
551
|
* @param iModel The IModel that contains the schema
|
|
549
552
|
* @param classFullName The full class name to load the metadata, if necessary
|
|
@@ -704,6 +707,8 @@ export declare abstract class IModelDb extends IModel {
|
|
|
704
707
|
*/
|
|
705
708
|
get codeValueBehavior(): "exact" | "trim-unicode-whitespace";
|
|
706
709
|
set codeValueBehavior(newBehavior: "exact" | "trim-unicode-whitespace");
|
|
710
|
+
/** @internal */
|
|
711
|
+
computeRangesForText(args: ComputeRangesForTextLayoutArgs): TextLayoutRanges;
|
|
707
712
|
}
|
|
708
713
|
/** @public */
|
|
709
714
|
export declare namespace IModelDb {
|
|
@@ -1063,8 +1068,8 @@ export declare namespace IModelDb {
|
|
|
1063
1068
|
* @internal
|
|
1064
1069
|
*/
|
|
1065
1070
|
enum TileContentState {
|
|
1066
|
-
New = 0
|
|
1067
|
-
Pending = 1
|
|
1071
|
+
New = 0,// Request was just created and enqueued.
|
|
1072
|
+
Pending = 1,// Request is enqueued but not yet being processed.
|
|
1068
1073
|
Loading = 2
|
|
1069
1074
|
}
|
|
1070
1075
|
/** @internal */
|
|
@@ -1155,6 +1160,7 @@ export declare class BriefcaseDb extends IModelDb {
|
|
|
1155
1160
|
* - the "no locking" flag is not present. This is a property of an iModel, established when the iModel is created in IModelHub.
|
|
1156
1161
|
*/
|
|
1157
1162
|
protected get useLockServer(): boolean;
|
|
1163
|
+
protected makeLockControl(): void;
|
|
1158
1164
|
protected constructor(args: {
|
|
1159
1165
|
nativeDb: IModelJsNative.DgnDb;
|
|
1160
1166
|
key: string;
|