@itwin/core-backend 5.1.0-dev.9 → 5.1.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 +155 -1
- package/lib/cjs/BackendHubAccess.d.ts +1 -1
- package/lib/cjs/BackendHubAccess.js +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
- package/lib/cjs/BisCoreSchema.js +4 -2
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +10 -2
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +16 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CatalogDb.js.map +1 -1
- package/lib/cjs/Category.d.ts +4 -4
- package/lib/cjs/Category.js +4 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +2 -2
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +490 -275
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +9 -1
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +14 -6
- 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.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +1 -1
- package/lib/cjs/CodeSpecs.js +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +4 -4
- package/lib/cjs/DisplayStyle.js +3 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +4 -4
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +4 -4
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +15 -6
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +19 -4
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +54 -51
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +67 -52
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +8 -8
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +8 -8
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +10 -7
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +35 -13
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +54 -8
- package/lib/cjs/ExportGraphics.d.ts.map +1 -1
- package/lib/cjs/ExportGraphics.js +158 -59
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/FontFile.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.d.ts +6 -2
- package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +1 -1
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +47 -47
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +37 -26
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +132 -55
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelDbFonts.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +2 -3
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +2 -3
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js +69 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/ImageSourceConversion.js.map +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +6 -4
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.js.map +1 -1
- package/lib/cjs/Material.d.ts +4 -3
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +5 -5
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +22 -22
- package/lib/cjs/Model.js +22 -22
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +3 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +15 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +1 -1
- package/lib/cjs/SQLiteDb.js +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +25 -0
- package/lib/cjs/Schema.d.ts.map +1 -1
- package/lib/cjs/Schema.js +25 -0
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +1 -1
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/Texture.d.ts +1 -1
- package/lib/cjs/Texture.js +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +4 -4
- package/lib/cjs/TxnManager.js +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +40 -14
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +42 -14
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +110 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts +51 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.js +249 -0
- package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
- package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
- package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/LeaderGeometry.js +184 -0
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +204 -0
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationElement.js +411 -0
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +33 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js +137 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
- package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
- package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
- package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
- package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +174 -49
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
- package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
- package/lib/cjs/core-backend.d.ts +7 -3
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +27 -6
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.js +167 -3
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
- package/lib/cjs/internal/FontFileImpl.js.map +1 -1
- package/lib/cjs/internal/HubMock.js.map +1 -1
- package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
- package/lib/cjs/internal/NativePlatform.js.map +1 -1
- package/lib/cjs/internal/NoLocks.js.map +1 -1
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +1 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +22 -0
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -0
- package/lib/cjs/internal/annotations/fields.js +237 -0
- package/lib/cjs/internal/annotations/fields.js.map +1 -0
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- 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.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +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.d.ts +2 -2
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +0 -1
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/lib/esm/BackendHubAccess.d.ts +1 -1
- package/lib/esm/BackendHubAccess.js +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/BackendLoggerCategory.js.map +1 -1
- package/lib/esm/BisCoreSchema.d.ts.map +1 -1
- package/lib/esm/BisCoreSchema.js +4 -2
- package/lib/esm/BisCoreSchema.js.map +1 -1
- package/lib/esm/BlobContainerService.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +10 -2
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +17 -1
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CatalogDb.js.map +1 -1
- package/lib/esm/Category.d.ts +4 -4
- package/lib/esm/Category.js +4 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangeSummaryManager.js +2 -2
- package/lib/esm/ChangeSummaryManager.js.map +1 -1
- package/lib/esm/ChangedElementsDb.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +490 -275
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChannelControl.js.map +1 -1
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/ClassRegistry.d.ts +9 -1
- package/lib/esm/ClassRegistry.d.ts.map +1 -1
- package/lib/esm/ClassRegistry.js +14 -6
- package/lib/esm/ClassRegistry.js.map +1 -1
- package/lib/esm/CloudSqlite.js +1 -1
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/CodeService.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +1 -1
- package/lib/esm/CodeSpecs.js +1 -1
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/CustomViewState3dCreator.js.map +1 -1
- package/lib/esm/DevTools.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +4 -4
- package/lib/esm/DisplayStyle.js +3 -3
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.d.ts +4 -4
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +4 -4
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSchemaXmlContext.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts +15 -6
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +19 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.d.ts +54 -51
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +67 -52
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +8 -8
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +8 -8
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementGraphics.js.map +1 -1
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/Entity.d.ts +10 -7
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +36 -14
- package/lib/esm/Entity.js.map +1 -1
- package/lib/esm/EntityReferences.js.map +1 -1
- package/lib/esm/ExportGraphics.d.ts +54 -8
- package/lib/esm/ExportGraphics.d.ts.map +1 -1
- package/lib/esm/ExportGraphics.js +156 -58
- package/lib/esm/ExportGraphics.js.map +1 -1
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/FontFile.js.map +1 -1
- package/lib/esm/GeoCoordConfig.js.map +1 -1
- package/lib/esm/GeographicCRSServices.d.ts +6 -2
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
- package/lib/esm/GeographicCRSServices.js +1 -1
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/GeometrySummary.js +47 -47
- package/lib/esm/GeometrySummary.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +37 -26
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +136 -59
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelDbFonts.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/esm/IModelElementCloneContext.js +1 -1
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +2 -3
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +2 -3
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js +65 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/esm/IModelJsFs.js.map +1 -1
- package/lib/esm/ImageSourceConversion.js.map +1 -1
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/LocalHub.d.ts.map +1 -1
- package/lib/esm/LocalHub.js +6 -4
- package/lib/esm/LocalHub.js.map +1 -1
- package/lib/esm/LocalhostIpcHost.js.map +1 -1
- package/lib/esm/LockControl.js.map +1 -1
- package/lib/esm/Material.d.ts +4 -3
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +5 -5
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +22 -22
- package/lib/esm/Model.js +22 -22
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/NativeAppStorage.js.map +1 -1
- package/lib/esm/NativeHost.js.map +1 -1
- package/lib/esm/NavigationRelationship.js.map +1 -1
- package/lib/esm/PromiseMemoizer.js.map +1 -1
- package/lib/esm/PropertyStore.js.map +1 -1
- package/lib/esm/Relationship.d.ts +3 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +15 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/RpcBackend.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts +1 -1
- package/lib/esm/SQLiteDb.js +1 -1
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/Schema.d.ts +25 -0
- package/lib/esm/Schema.d.ts.map +1 -1
- package/lib/esm/Schema.js +25 -0
- package/lib/esm/Schema.js.map +1 -1
- package/lib/esm/SchemaSync.js.map +1 -1
- package/lib/esm/SchemaUtils.js.map +1 -1
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/SqliteStatement.d.ts +1 -1
- package/lib/esm/SqliteStatement.d.ts.map +1 -1
- package/lib/esm/SqliteStatement.js +1 -1
- package/lib/esm/SqliteStatement.js.map +1 -1
- package/lib/esm/Texture.d.ts +1 -1
- package/lib/esm/Texture.js +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TileStorage.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +4 -4
- package/lib/esm/TxnManager.js +1 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +40 -14
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +42 -14
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStateHydrator.js.map +1 -1
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +105 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -0
- package/lib/esm/annotations/FrameGeometry.d.ts +51 -0
- package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/FrameGeometry.js +244 -0
- package/lib/esm/annotations/FrameGeometry.js.map +1 -0
- package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
- package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/LeaderGeometry.js +179 -0
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationElement.d.ts +204 -0
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationElement.js +405 -0
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +33 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js +134 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
- package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
- package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
- package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
- package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +172 -48
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
- package/lib/esm/core-backend.d.ts +7 -3
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +27 -3
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/FunctionalSchema.js.map +1 -1
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/domains/GenericSchema.js.map +1 -1
- package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/esm/internal/ElementLRUCache.js +165 -2
- package/lib/esm/internal/ElementLRUCache.js.map +1 -1
- package/lib/esm/internal/FontFileImpl.js.map +1 -1
- package/lib/esm/internal/HubMock.js.map +1 -1
- package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
- package/lib/esm/internal/NativePlatform.js.map +1 -1
- package/lib/esm/internal/NoLocks.js.map +1 -1
- package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +1 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +22 -0
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -0
- package/lib/esm/internal/annotations/fields.js +231 -0
- package/lib/esm/internal/annotations/fields.js.map +1 -0
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/esm/rpc/multipart.js.map +1 -1
- package/lib/esm/rpc/tracing.js.map +1 -1
- package/lib/esm/rpc/web/logging.js.map +1 -1
- package/lib/esm/rpc/web/request.js.map +1 -1
- package/lib/esm/rpc/web/response.js.map +1 -1
- package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/esm/test/AdvancedEqual.js.map +1 -1
- package/lib/esm/test/AnnotationTestUtils.d.ts +15 -0
- package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
- package/lib/esm/test/AnnotationTestUtils.js +41 -0
- package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
- package/lib/esm/test/AttachDb.test.js +11 -11
- package/lib/esm/test/AttachDb.test.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.test.js +224 -1
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/GeometryTestUtil.js.map +1 -1
- package/lib/esm/test/IModelHost.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +1 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
- package/lib/esm/test/IpcHost.test.js.map +1 -1
- package/lib/esm/test/KnownTestLocations.js.map +1 -1
- package/lib/esm/test/PrintElementTree.js.map +1 -1
- package/lib/esm/test/PropertyDb.test.js.map +1 -1
- package/lib/esm/test/RevisionUtility.js.map +1 -1
- package/lib/esm/test/SchemaUtils.test.js +25 -25
- package/lib/esm/test/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
- package/lib/esm/test/TestUtils.d.ts +1 -1
- package/lib/esm/test/TestUtils.d.ts.map +1 -1
- package/lib/esm/test/TestUtils.js +1 -1
- package/lib/esm/test/TestUtils.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.d.ts +2 -0
- package/lib/esm/test/annotations/Fields.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/Fields.test.js +576 -0
- package/lib/esm/test/annotations/Fields.test.js.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.d.ts +2 -0
- package/lib/esm/test/annotations/FrameGeometry.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js +86 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.js +256 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
- package/lib/esm/test/annotations/TextAnnotation.test.js +269 -1047
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
- package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/TextBlock.test.js +1199 -0
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts +60 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js +69 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +1442 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +817 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -0
- package/lib/esm/test/categories/Category.test.js.map +1 -1
- package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
- package/lib/esm/test/ecdb/CTE.test.js +88 -88
- package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
- package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +35 -45
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +86 -65
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
- package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +484 -292
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/element/ElementAspect.test.js +22 -22
- package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
- package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
- package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
- package/lib/esm/test/element/NullStructArray.test.js +13 -13
- package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
- package/lib/esm/test/element/UrlLink.test.js.map +1 -1
- package/lib/esm/test/font/FontFile.test.js.map +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +86 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -0
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
- package/lib/esm/test/imageData.js.map +1 -1
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
- package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +313 -5
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +343 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +207 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +11 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +36 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +17 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +116 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +9 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +20 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -0
- package/lib/esm/test/index.js.map +1 -1
- package/lib/esm/test/misc/DevTools.test.js.map +1 -1
- package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
- package/lib/esm/test/misc/GeoServices.test.js +36 -10
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
- package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
- package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
- package/lib/esm/test/rpc/response.test.js.map +1 -1
- package/lib/esm/test/schema/ClassRegistry.test.js +175 -73
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
- package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +575 -164
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
- package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
- package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +67 -15
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
- package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
- package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
- package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
- package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +24 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
- package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
- package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
- package/lib/esm/test/standalone/Setting.test.js.map +1 -1
- package/lib/esm/test/standalone/Settings.test.js.map +1 -1
- package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/test/standalone/Texture.test.js.map +1 -1
- package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
- package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/lib/esm/workspace/Settings.js.map +1 -1
- package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
- package/lib/esm/workspace/Workspace.d.ts +0 -1
- package/lib/esm/workspace/Workspace.d.ts.map +1 -1
- package/lib/esm/workspace/Workspace.js.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +22 -16
- package/lib/cjs/TextAnnotationElement.d.ts +0 -54
- package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationElement.js +0 -94
- package/lib/cjs/TextAnnotationElement.js.map +0 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
- package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationLayout.js.map +0 -1
- package/lib/esm/TextAnnotationElement.d.ts +0 -54
- package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
- package/lib/esm/TextAnnotationElement.js +0 -89
- package/lib/esm/TextAnnotationElement.js.map +0 -1
- package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
- package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
- package/lib/esm/TextAnnotationGeometry.js.map +0 -1
- package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
- package/lib/esm/TextAnnotationLayout.js.map +0 -1
|
@@ -2,987 +2,85 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { TextAnnotation2d, TextAnnotation3d } from "../../TextAnnotationElement";
|
|
10
|
-
import { produceTextAnnotationGeometry } from "../../TextAnnotationGeometry";
|
|
5
|
+
import { expect } from "chai";
|
|
6
|
+
import { Angle, Point3d, Range2d, Range3d, YawPitchRollAngles } from "@itwin/core-geometry";
|
|
7
|
+
import { FractionRun, SubCategoryAppearance, TextAnnotation, TextBlock, TextRun, TextStyleSettings } from "@itwin/core-common";
|
|
8
|
+
import { StandaloneDb } from "../../IModelDb";
|
|
9
|
+
import { AnnotationTextStyle, TextAnnotation2d, TextAnnotation3d } from "../../annotations/TextAnnotationElement";
|
|
11
10
|
import { IModelTestUtils } from "../IModelTestUtils";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
iModel: {},
|
|
21
|
-
findTextStyle: args?.findTextStyle ?? (() => TextStyleSettings.defaults),
|
|
22
|
-
findFontId: args?.findFontId ?? (() => 0),
|
|
23
|
-
computeTextRange: args?.computeTextRange ?? computeTextRangeAsStringLength,
|
|
24
|
-
});
|
|
25
|
-
return layout;
|
|
26
|
-
}
|
|
27
|
-
function makeTextRun(content, styleName = "") {
|
|
28
|
-
return TextRun.create({ content, styleName });
|
|
29
|
-
}
|
|
30
|
-
function isIntlSupported() {
|
|
31
|
-
// Node in the mobile add-on does not include Intl, so this test fails. Right now, mobile
|
|
32
|
-
// users are not expected to do any editing, but long term we will attempt to find a better
|
|
33
|
-
// solution.
|
|
34
|
-
return !ProcessDetector.isMobileAppBackend;
|
|
35
|
-
}
|
|
36
|
-
describe("layoutTextBlock", () => {
|
|
37
|
-
it("resolves TextStyleSettings from combination of TextBlock and Run", () => {
|
|
38
|
-
const textBlock = TextBlock.create({ styleName: "block", styleOverrides: { widthFactor: 34, color: 0x00ff00 } });
|
|
39
|
-
const run0 = TextRun.create({ content: "run0", styleName: "run", styleOverrides: { lineHeight: 56, color: 0xff0000 } });
|
|
40
|
-
const run1 = TextRun.create({ content: "run1", styleName: "run", styleOverrides: { widthFactor: 78, fontName: "run1" } });
|
|
41
|
-
textBlock.appendRun(run0);
|
|
42
|
-
textBlock.appendRun(run1);
|
|
43
|
-
const tb = doLayout(textBlock, {
|
|
44
|
-
findTextStyle: (name) => TextStyleSettings.fromJSON(name === "block" ? { lineSpacingFactor: 12, fontName: "block" } : { lineSpacingFactor: 99, fontName: "run" }),
|
|
45
|
-
});
|
|
46
|
-
expect(tb.lines.length).to.equal(1);
|
|
47
|
-
expect(tb.lines[0].runs.length).to.equal(2);
|
|
48
|
-
const s0 = tb.lines[0].runs[0].style;
|
|
49
|
-
expect(s0.lineHeight).to.equal(1);
|
|
50
|
-
expect(s0.lineSpacingFactor).to.equal(12);
|
|
51
|
-
expect(s0.widthFactor).to.equal(34);
|
|
52
|
-
expect(s0.fontName).to.equal("run");
|
|
53
|
-
expect(s0.color).to.equal(0xff0000);
|
|
54
|
-
const s1 = tb.lines[0].runs[1].style;
|
|
55
|
-
expect(s1.widthFactor).to.equal(34);
|
|
56
|
-
expect(s1.lineSpacingFactor).to.equal(12);
|
|
57
|
-
expect(s1.lineHeight).to.equal(1);
|
|
58
|
-
expect(s1.fontName).to.equal("run1");
|
|
59
|
-
expect(s1.color).to.equal("subcategory");
|
|
60
|
-
});
|
|
61
|
-
it("aligns text to center based on height of stacked fraction", () => {
|
|
62
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
63
|
-
const fractionRun = FractionRun.create({ numerator: "1", denominator: "2", styleName: "fraction" });
|
|
64
|
-
const textRun = TextRun.create({ content: "text", styleName: "text" });
|
|
65
|
-
textBlock.appendRun(fractionRun);
|
|
66
|
-
textBlock.appendRun(textRun);
|
|
67
|
-
const layout = doLayout(textBlock);
|
|
68
|
-
const fractionLayout = layout.lines[0].runs[0];
|
|
69
|
-
const textLayout = layout.lines[0].runs[1];
|
|
70
|
-
const round = (num, numDecimalPlaces) => {
|
|
71
|
-
const mult = Math.pow(100, numDecimalPlaces);
|
|
72
|
-
return Math.round(num * mult) / mult;
|
|
73
|
-
};
|
|
74
|
-
expect(textLayout.range.yLength()).to.equal(1);
|
|
75
|
-
expect(round(fractionLayout.range.yLength(), 2)).to.equal(1.75);
|
|
76
|
-
expect(fractionLayout.offsetFromLine.y).to.equal(0);
|
|
77
|
-
expect(round(textLayout.offsetFromLine.y, 3)).to.equal(.375);
|
|
78
|
-
});
|
|
79
|
-
it("produces one line per paragraph if document width <= 0", () => {
|
|
80
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
81
|
-
for (let i = 0; i < 4; i++) {
|
|
82
|
-
const layout = doLayout(textBlock);
|
|
83
|
-
if (i === 0) {
|
|
84
|
-
expect(layout.range.isNull).to.be.true;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
expect(layout.lines.length).to.equal(i);
|
|
88
|
-
expect(layout.range.low.x).to.equal(0);
|
|
89
|
-
expect(layout.range.low.y).to.equal(-i - (0.5 * (i - 1))); // lineSpacingFactor=0.5
|
|
90
|
-
expect(layout.range.high.x).to.equal(i * 3);
|
|
91
|
-
expect(layout.range.high.y).to.equal(0);
|
|
92
|
-
}
|
|
93
|
-
for (let l = 0; l < layout.lines.length; l++) {
|
|
94
|
-
const line = layout.lines[l];
|
|
95
|
-
expect(line.runs.length).to.equal(l + 1);
|
|
96
|
-
expect(line.range.low.x).to.equal(0);
|
|
97
|
-
expect(line.range.low.y).to.equal(0);
|
|
98
|
-
expect(line.range.high.y).to.equal(1);
|
|
99
|
-
expect(line.range.high.x).to.equal(3 * (l + 1));
|
|
100
|
-
for (const run of line.runs) {
|
|
101
|
-
expect(run.charOffset).to.equal(0);
|
|
102
|
-
expect(run.numChars).to.equal(3);
|
|
103
|
-
expect(run.range.low.x).to.equal(0);
|
|
104
|
-
expect(run.range.low.y).to.equal(0);
|
|
105
|
-
expect(run.range.high.x).to.equal(3);
|
|
106
|
-
expect(run.range.high.y).to.equal(1);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const p = textBlock.appendParagraph();
|
|
110
|
-
for (let j = 0; j <= i; j++) {
|
|
111
|
-
p.runs.push(TextRun.create({ styleName: "", content: "Run" }));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
it("produces a new line for each LineBreakRun", () => {
|
|
116
|
-
const lineSpacingFactor = 0.5;
|
|
117
|
-
const lineHeight = 1;
|
|
118
|
-
const textBlock = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor, lineHeight } });
|
|
119
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "abc" }));
|
|
120
|
-
textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
|
|
121
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "def" }));
|
|
122
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "ghi" }));
|
|
123
|
-
textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
|
|
124
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "jkl" }));
|
|
125
|
-
const tb = doLayout(textBlock);
|
|
126
|
-
expect(tb.lines.length).to.equal(3);
|
|
127
|
-
expect(tb.lines[0].runs.length).to.equal(2);
|
|
128
|
-
expect(tb.lines[1].runs.length).to.equal(3);
|
|
129
|
-
expect(tb.lines[2].runs.length).to.equal(1);
|
|
130
|
-
expect(tb.range.low.x).to.equal(0);
|
|
131
|
-
expect(tb.range.high.x).to.equal(6);
|
|
132
|
-
expect(tb.range.high.y).to.equal(0);
|
|
133
|
-
expect(tb.range.low.y).to.equal(-(lineSpacingFactor * 2 + lineHeight * 3));
|
|
134
|
-
});
|
|
135
|
-
it("computes ranges based on custom line spacing and line height", () => {
|
|
136
|
-
const lineSpacingFactor = 2;
|
|
137
|
-
const lineHeight = 3;
|
|
138
|
-
const textBlock = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor, lineHeight } });
|
|
139
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "abc" }));
|
|
140
|
-
textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
|
|
141
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "def" }));
|
|
142
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "ghi" }));
|
|
143
|
-
textBlock.appendRun(LineBreakRun.create({ styleName: "" }));
|
|
144
|
-
textBlock.appendRun(TextRun.create({ styleName: "", content: "jkl" }));
|
|
145
|
-
const tb = doLayout(textBlock);
|
|
146
|
-
expect(tb.lines.length).to.equal(3);
|
|
147
|
-
expect(tb.lines[0].runs.length).to.equal(2);
|
|
148
|
-
expect(tb.lines[1].runs.length).to.equal(3);
|
|
149
|
-
expect(tb.lines[2].runs.length).to.equal(1);
|
|
150
|
-
// We have 3 lines each `lineHeight` high, plus 2 line breaks in between each `lineHeight*lineSpacingFactor` high.
|
|
151
|
-
expect(tb.range.low.x).to.equal(0);
|
|
152
|
-
expect(tb.range.high.x).to.equal(6);
|
|
153
|
-
expect(tb.range.high.y).to.equal(0);
|
|
154
|
-
expect(tb.range.low.y).to.equal(-(lineHeight * 3 + (lineHeight * lineSpacingFactor) * 2));
|
|
155
|
-
expect(tb.lines[0].offsetFromDocument.y).to.equal(-lineHeight);
|
|
156
|
-
expect(tb.lines[1].offsetFromDocument.y).to.equal(tb.lines[0].offsetFromDocument.y - (lineHeight + lineHeight * lineSpacingFactor));
|
|
157
|
-
expect(tb.lines[2].offsetFromDocument.y).to.equal(tb.lines[1].offsetFromDocument.y - (lineHeight + lineHeight * lineSpacingFactor));
|
|
158
|
-
expect(tb.lines.every((line) => line.offsetFromDocument.x === 0)).to.be.true;
|
|
159
|
-
});
|
|
160
|
-
it("splits paragraphs into multiple lines if runs exceed the document width", function () {
|
|
161
|
-
if (!isIntlSupported()) {
|
|
162
|
-
this.skip();
|
|
163
|
-
}
|
|
164
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
165
|
-
textBlock.width = 6;
|
|
166
|
-
textBlock.appendRun(makeTextRun("ab"));
|
|
167
|
-
expect(doLayout(textBlock).lines.length).to.equal(1);
|
|
168
|
-
textBlock.appendRun(makeTextRun("cd"));
|
|
169
|
-
expect(doLayout(textBlock).lines.length).to.equal(1);
|
|
170
|
-
textBlock.appendRun(makeTextRun("ef"));
|
|
171
|
-
expect(doLayout(textBlock).lines.length).to.equal(1);
|
|
172
|
-
textBlock.appendRun(makeTextRun("ghi"));
|
|
173
|
-
expect(doLayout(textBlock).lines.length).to.equal(2);
|
|
174
|
-
textBlock.appendRun(makeTextRun("jklmnop"));
|
|
175
|
-
expect(doLayout(textBlock).lines.length).to.equal(3);
|
|
176
|
-
textBlock.appendRun(makeTextRun("q"));
|
|
177
|
-
expect(doLayout(textBlock).lines.length).to.equal(4);
|
|
178
|
-
textBlock.appendRun(makeTextRun("r"));
|
|
179
|
-
expect(doLayout(textBlock).lines.length).to.equal(4);
|
|
180
|
-
textBlock.appendRun(makeTextRun("stu"));
|
|
181
|
-
expect(doLayout(textBlock).lines.length).to.equal(4);
|
|
182
|
-
textBlock.appendRun(makeTextRun("vwxyz"));
|
|
183
|
-
expect(doLayout(textBlock).lines.length).to.equal(5);
|
|
184
|
-
});
|
|
185
|
-
function expectRange(width, height, range) {
|
|
186
|
-
expect(range.xLength()).to.equal(width);
|
|
187
|
-
expect(range.yLength()).to.equal(height);
|
|
188
|
-
}
|
|
189
|
-
it("computes range for wrapped lines", function () {
|
|
190
|
-
if (!isIntlSupported()) {
|
|
191
|
-
this.skip();
|
|
192
|
-
}
|
|
193
|
-
const block = TextBlock.create({ styleName: "", width: 3, styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
|
|
194
|
-
function expectBlockRange(width, height) {
|
|
195
|
-
const layout = doLayout(block);
|
|
196
|
-
expectRange(width, height, layout.range);
|
|
197
|
-
}
|
|
198
|
-
block.appendRun(makeTextRun("abc"));
|
|
199
|
-
expectBlockRange(3, 1);
|
|
200
|
-
block.appendRun(makeTextRun("defg"));
|
|
201
|
-
expectBlockRange(4, 2);
|
|
202
|
-
block.width = 1;
|
|
203
|
-
expectBlockRange(4, 2);
|
|
204
|
-
block.width = 8;
|
|
205
|
-
expectBlockRange(8, 1);
|
|
206
|
-
block.width = 6;
|
|
207
|
-
expectBlockRange(6, 2);
|
|
208
|
-
block.width = 10;
|
|
209
|
-
expectBlockRange(10, 1);
|
|
210
|
-
block.appendRun(makeTextRun("hijk"));
|
|
211
|
-
expectBlockRange(10, 2);
|
|
212
|
-
});
|
|
213
|
-
it("computes range for split runs", function () {
|
|
214
|
-
if (!isIntlSupported()) {
|
|
215
|
-
this.skip();
|
|
216
|
-
}
|
|
217
|
-
const block = TextBlock.create({ styleName: "", styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
|
|
218
|
-
function expectBlockRange(width, height) {
|
|
219
|
-
const layout = doLayout(block);
|
|
220
|
-
expectRange(width, height, layout.range);
|
|
221
|
-
}
|
|
222
|
-
const sentence = "a bc def ghij klmno";
|
|
223
|
-
expect(sentence.length).to.equal(19);
|
|
224
|
-
block.appendRun(makeTextRun(sentence));
|
|
225
|
-
block.width = 19;
|
|
226
|
-
expectBlockRange(19, 1);
|
|
227
|
-
block.width = 10;
|
|
228
|
-
expectBlockRange(10, 2);
|
|
229
|
-
});
|
|
230
|
-
it("justifies lines", function () {
|
|
231
|
-
if (!isIntlSupported()) {
|
|
232
|
-
this.skip();
|
|
233
|
-
}
|
|
234
|
-
const block = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor: 0 } });
|
|
235
|
-
function expectBlockRange(width, height) {
|
|
236
|
-
const layout = doLayout(block);
|
|
237
|
-
expectRange(width, height, layout.range);
|
|
238
|
-
}
|
|
239
|
-
function expectLineOffset(offset, lineIndex) {
|
|
240
|
-
const layout = doLayout(block);
|
|
241
|
-
expect(layout.lines.length).least(lineIndex + 1);
|
|
242
|
-
const line = layout.lines[lineIndex];
|
|
243
|
-
expect(line.offsetFromDocument.y).to.equal(-(lineIndex + 1));
|
|
244
|
-
expect(line.offsetFromDocument.x).to.equal(offset);
|
|
245
|
-
}
|
|
246
|
-
// Two text runs with 7 characters total.
|
|
247
|
-
block.appendRun(makeTextRun("abc"));
|
|
248
|
-
block.appendRun(makeTextRun("defg"));
|
|
249
|
-
// 1 line of text with width 0: left, right, center justification.
|
|
250
|
-
block.justification = "left";
|
|
251
|
-
expectBlockRange(7, 1);
|
|
252
|
-
expectLineOffset(0, 0);
|
|
253
|
-
block.justification = "right";
|
|
254
|
-
expectBlockRange(7, 1);
|
|
255
|
-
expectLineOffset(0, 0);
|
|
256
|
-
block.justification = "center";
|
|
257
|
-
expectBlockRange(7, 1);
|
|
258
|
-
expectLineOffset(0, 0);
|
|
259
|
-
// 1 line of text from a width greater than number of characters: left, right, center justification.
|
|
260
|
-
block.width = 10;
|
|
261
|
-
block.justification = "left";
|
|
262
|
-
expectBlockRange(10, 1);
|
|
263
|
-
expectLineOffset(0, 0);
|
|
264
|
-
block.justification = "right";
|
|
265
|
-
expectBlockRange(10, 1);
|
|
266
|
-
expectLineOffset(3, 0); // 3 = 10 - 7
|
|
267
|
-
block.justification = "center";
|
|
268
|
-
expectBlockRange(10, 1);
|
|
269
|
-
expectLineOffset(1.5, 0); // 1.5 = (10 - 7) / 2
|
|
270
|
-
// 2 line of text from a width less than number of characters: left, right, center justification.
|
|
271
|
-
block.justification = "left";
|
|
272
|
-
block.width = 4;
|
|
273
|
-
expectBlockRange(4, 2);
|
|
274
|
-
expectLineOffset(0, 0);
|
|
275
|
-
expectLineOffset(0, 1);
|
|
276
|
-
block.justification = "right";
|
|
277
|
-
expectBlockRange(4, 2);
|
|
278
|
-
expectLineOffset(1, 0);
|
|
279
|
-
expectLineOffset(0, 1);
|
|
280
|
-
block.justification = "center";
|
|
281
|
-
expectBlockRange(4, 2);
|
|
282
|
-
expectLineOffset(0.5, 0);
|
|
283
|
-
expectLineOffset(0, 1);
|
|
284
|
-
// Testing text longer the the width of the text block.
|
|
285
|
-
block.width = 2;
|
|
286
|
-
block.justification = "left";
|
|
287
|
-
expectBlockRange(4, 2);
|
|
288
|
-
expectLineOffset(0, 0);
|
|
289
|
-
expectLineOffset(0, 1);
|
|
290
|
-
block.justification = "right";
|
|
291
|
-
expectBlockRange(4, 2);
|
|
292
|
-
expectLineOffset(-1, 0);
|
|
293
|
-
expectLineOffset(-2, 1);
|
|
294
|
-
block.appendRun(makeTextRun("123456789"));
|
|
295
|
-
expectBlockRange(9, 3);
|
|
296
|
-
expectLineOffset(-1, 0);
|
|
297
|
-
expectLineOffset(-2, 1);
|
|
298
|
-
expectLineOffset(-7, 2);
|
|
299
|
-
block.justification = "center";
|
|
300
|
-
expectBlockRange(9, 3);
|
|
301
|
-
expectLineOffset(-0.5, 0);
|
|
302
|
-
expectLineOffset(-1, 1);
|
|
303
|
-
expectLineOffset(-3.5, 2);
|
|
304
|
-
});
|
|
305
|
-
function expectLines(input, width, expectedLines) {
|
|
306
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
307
|
-
textBlock.width = width;
|
|
308
|
-
const run = makeTextRun(input);
|
|
309
|
-
textBlock.appendRun(run);
|
|
310
|
-
const layout = doLayout(textBlock);
|
|
311
|
-
expect(layout.lines.every((line) => line.runs.every((r) => r.source === run))).to.be.true;
|
|
312
|
-
const actual = layout.lines.map((line) => line.runs.map((runLayout) => runLayout.source.content.substring(runLayout.charOffset, runLayout.charOffset + runLayout.numChars)).join(""));
|
|
313
|
-
expect(actual).to.deep.equal(expectedLines);
|
|
314
|
-
return layout;
|
|
315
|
-
}
|
|
316
|
-
it("splits a single TextRun at word boundaries if it exceeds the document width", function () {
|
|
317
|
-
if (!isIntlSupported()) {
|
|
318
|
-
this.skip();
|
|
319
|
-
}
|
|
320
|
-
expectLines("a bc def ghij klmno pqrstu vwxyz", 5, [
|
|
321
|
-
"a bc ",
|
|
322
|
-
"def ",
|
|
323
|
-
"ghij ",
|
|
324
|
-
"klmno ",
|
|
325
|
-
"pqrstu ",
|
|
326
|
-
"vwxyz",
|
|
327
|
-
]);
|
|
328
|
-
const fox = "The quick brown fox jumped over the lazy dog";
|
|
329
|
-
expectLines(fox, 50, [fox]);
|
|
330
|
-
expectLines(fox, 40, [
|
|
331
|
-
// 1 2 3 4
|
|
332
|
-
// 34567890123456789012345678901234567890
|
|
333
|
-
"The quick brown fox jumped over the ",
|
|
334
|
-
"lazy dog",
|
|
335
|
-
]);
|
|
336
|
-
expectLines(fox, 30, [
|
|
337
|
-
// 1 2 3
|
|
338
|
-
// 3456789012345678901234567890
|
|
339
|
-
"The quick brown fox jumped ",
|
|
340
|
-
"over the lazy dog",
|
|
341
|
-
]);
|
|
342
|
-
expectLines(fox, 20, [
|
|
343
|
-
// 1 2
|
|
344
|
-
// 345678901234567890
|
|
345
|
-
"The quick brown fox ",
|
|
346
|
-
"jumped over the ",
|
|
347
|
-
"lazy dog",
|
|
348
|
-
]);
|
|
349
|
-
expectLines(fox, 10, [
|
|
350
|
-
// 1
|
|
351
|
-
// 234567890
|
|
352
|
-
"The quick ",
|
|
353
|
-
"brown fox ",
|
|
354
|
-
"jumped ",
|
|
355
|
-
"over the ",
|
|
356
|
-
"lazy dog",
|
|
357
|
-
]);
|
|
358
|
-
});
|
|
359
|
-
it("considers consecutive whitespace part of a single 'word'", function () {
|
|
360
|
-
if (!isIntlSupported()) {
|
|
361
|
-
this.skip();
|
|
362
|
-
}
|
|
363
|
-
expectLines("a b c d e f ", 3, [
|
|
364
|
-
"a ",
|
|
365
|
-
"b ",
|
|
366
|
-
"c ",
|
|
367
|
-
"d ",
|
|
368
|
-
"e ",
|
|
369
|
-
"f ",
|
|
370
|
-
]);
|
|
371
|
-
});
|
|
372
|
-
it("wraps Japanese text", function () {
|
|
373
|
-
if (!isIntlSupported()) {
|
|
374
|
-
this.skip();
|
|
375
|
-
}
|
|
376
|
-
// "I am a cat. The name is Tanuki."
|
|
377
|
-
expectLines("吾輩は猫である。名前はたぬき。", 1, ["吾", "輩", "は", "猫", "で", "あ", "る。", "名", "前", "は", "た", "ぬ", "き。"]);
|
|
378
|
-
});
|
|
379
|
-
it("performs word-wrapping with punctuation", function () {
|
|
380
|
-
if (!isIntlSupported()) {
|
|
381
|
-
this.skip();
|
|
382
|
-
}
|
|
383
|
-
expectLines("1.24 56.7 8,910", 1, ["1.24 ", "56.7 ", "8,910"]);
|
|
384
|
-
expectLines("a.bc de.f g,hij", 1, ["a.bc ", "de.f ", "g,hij"]);
|
|
385
|
-
expectLines("Let's see... can you (or anyone) predict?!", 1, [
|
|
386
|
-
"Let's ",
|
|
387
|
-
"see... ",
|
|
388
|
-
"can ",
|
|
389
|
-
"you ",
|
|
390
|
-
"(or ",
|
|
391
|
-
"anyone) ",
|
|
392
|
-
"predict?!",
|
|
393
|
-
]);
|
|
394
|
-
});
|
|
395
|
-
it("performs word-wrapping and line-splitting with multiple runs", function () {
|
|
396
|
-
if (!isIntlSupported()) {
|
|
397
|
-
this.skip();
|
|
398
|
-
}
|
|
399
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
400
|
-
for (const str of ["The ", "quick brown", " fox jumped over ", "the lazy ", "dog"]) {
|
|
401
|
-
textBlock.appendRun(makeTextRun(str));
|
|
402
|
-
}
|
|
403
|
-
function test(width, expected) {
|
|
404
|
-
textBlock.width = width;
|
|
405
|
-
const layout = doLayout(textBlock);
|
|
406
|
-
const actual = layout.lines.map((line) => line.runs.map((runLayout) => runLayout.source.content.substring(runLayout.charOffset, runLayout.charOffset + runLayout.numChars)).join(""));
|
|
407
|
-
expect(actual).to.deep.equal(expected);
|
|
408
|
-
}
|
|
409
|
-
test(50, ["The quick brown fox jumped over the lazy dog"]);
|
|
410
|
-
test(40, [
|
|
411
|
-
// 1 2 3 4
|
|
412
|
-
// 34567890123456789012345678901234567890
|
|
413
|
-
"The quick brown fox jumped over the ",
|
|
414
|
-
"lazy dog",
|
|
415
|
-
]);
|
|
416
|
-
test(30, [
|
|
417
|
-
// 1 2 3
|
|
418
|
-
// 3456789012345678901234567890
|
|
419
|
-
"The quick brown fox jumped ",
|
|
420
|
-
"over the lazy dog",
|
|
421
|
-
]);
|
|
422
|
-
test(20, [
|
|
423
|
-
// 1 2
|
|
424
|
-
// 345678901234567890
|
|
425
|
-
"The quick brown fox ",
|
|
426
|
-
"jumped over the ",
|
|
427
|
-
"lazy dog",
|
|
428
|
-
]);
|
|
429
|
-
test(10, [
|
|
430
|
-
// 1
|
|
431
|
-
// 34567890
|
|
432
|
-
"The quick ",
|
|
433
|
-
"brown fox ",
|
|
434
|
-
"jumped ",
|
|
435
|
-
"over the ",
|
|
436
|
-
"lazy dog",
|
|
437
|
-
]);
|
|
438
|
-
});
|
|
439
|
-
it("wraps multiple runs", function () {
|
|
440
|
-
if (!isIntlSupported()) {
|
|
441
|
-
this.skip();
|
|
442
|
-
}
|
|
443
|
-
const block = TextBlock.create({ styleName: "" });
|
|
444
|
-
block.appendRun(makeTextRun("aa")); // 2 chars wide
|
|
445
|
-
block.appendRun(makeTextRun("bb ccc d ee")); // 11 chars wide
|
|
446
|
-
block.appendRun(makeTextRun("ff ggg h")); // 8 chars wide
|
|
447
|
-
function expectLayout(width, expected) {
|
|
448
|
-
block.width = width;
|
|
449
|
-
const layout = doLayout(block);
|
|
450
|
-
expect(layout.stringify()).to.equal(expected);
|
|
451
|
-
}
|
|
452
|
-
expectLayout(23, "aabb ccc d eeff ggg h");
|
|
453
|
-
expectLayout(22, "aabb ccc d eeff ggg h");
|
|
454
|
-
expectLayout(21, "aabb ccc d eeff ggg h");
|
|
455
|
-
expectLayout(20, "aabb ccc d eeff ggg \nh");
|
|
456
|
-
expectLayout(19, "aabb ccc d eeff \nggg h");
|
|
457
|
-
expectLayout(18, "aabb ccc d eeff \nggg h");
|
|
458
|
-
expectLayout(17, "aabb ccc d eeff \nggg h");
|
|
459
|
-
expectLayout(16, "aabb ccc d eeff \nggg h");
|
|
460
|
-
expectLayout(15, "aabb ccc d ee\nff ggg h");
|
|
461
|
-
expectLayout(14, "aabb ccc d ee\nff ggg h");
|
|
462
|
-
expectLayout(13, "aabb ccc d ee\nff ggg h");
|
|
463
|
-
expectLayout(12, "aabb ccc d \neeff ggg h");
|
|
464
|
-
expectLayout(11, "aabb ccc d \neeff ggg h");
|
|
465
|
-
expectLayout(10, "aabb ccc \nd eeff \nggg h");
|
|
466
|
-
expectLayout(9, "aabb ccc \nd eeff \nggg h");
|
|
467
|
-
expectLayout(8, "aabb \nccc d ee\nff ggg h");
|
|
468
|
-
expectLayout(7, "aabb \nccc d \neeff \nggg h");
|
|
469
|
-
expectLayout(6, "aabb \nccc d \neeff \nggg h");
|
|
470
|
-
expectLayout(5, "aabb \nccc \nd ee\nff \nggg h");
|
|
471
|
-
expectLayout(4, "aa\nbb \nccc \nd ee\nff \nggg \nh");
|
|
472
|
-
expectLayout(3, "aa\nbb \nccc \nd \nee\nff \nggg \nh");
|
|
473
|
-
expectLayout(2, "aa\nbb \nccc \nd \nee\nff \nggg \nh");
|
|
474
|
-
expectLayout(1, "aa\nbb \nccc \nd \nee\nff \nggg \nh");
|
|
475
|
-
expectLayout(0, "aabb ccc d eeff ggg h");
|
|
476
|
-
expectLayout(-1, "aabb ccc d eeff ggg h");
|
|
477
|
-
expectLayout(-2, "aabb ccc d eeff ggg h");
|
|
478
|
-
});
|
|
479
|
-
it("does not word wrap due to floating point rounding error", function () {
|
|
480
|
-
if (!isIntlSupported()) {
|
|
481
|
-
this.skip();
|
|
482
|
-
}
|
|
483
|
-
const block = TextBlock.create({ styleName: "", styleOverrides: { lineHeight: 1, lineSpacingFactor: 0 } });
|
|
484
|
-
block.appendRun(makeTextRun("abc defg"));
|
|
485
|
-
const layout1 = doLayout(block);
|
|
486
|
-
let width = layout1.range.xLength();
|
|
487
|
-
// Simulate a floating point rounding error by slightly reducing the width
|
|
488
|
-
width -= Geometry.smallFloatingPoint;
|
|
489
|
-
block.width = width;
|
|
490
|
-
const layout2 = doLayout(block);
|
|
491
|
-
expect(layout2.range.yLength()).to.equal(1);
|
|
492
|
-
});
|
|
493
|
-
it("has consistent data when converted to a layout result", function () {
|
|
494
|
-
if (!isIntlSupported()) {
|
|
495
|
-
this.skip();
|
|
496
|
-
}
|
|
497
|
-
// Initialize a new TextBlockLayout object
|
|
498
|
-
const textBlock = TextBlock.create({ width: 50, styleName: "", styleOverrides: { widthFactor: 34, color: 0x00ff00, fontName: "arial" } });
|
|
499
|
-
const run0 = TextRun.create({
|
|
500
|
-
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium mi sit amet magna malesuada, at venenatis ante eleifend.",
|
|
501
|
-
styleName: "",
|
|
502
|
-
styleOverrides: { lineHeight: 56, color: 0xff0000 },
|
|
503
|
-
});
|
|
504
|
-
const run1 = TextRun.create({
|
|
505
|
-
content: "Donec sit amet semper sapien. Nullam commodo, libero a accumsan lacinia, metus enim pharetra lacus, eu facilisis sem nisi eu dui.",
|
|
506
|
-
styleName: "",
|
|
507
|
-
styleOverrides: { widthFactor: 78, fontName: "run1" },
|
|
508
|
-
});
|
|
509
|
-
const run2 = TextRun.create({
|
|
510
|
-
content: "Duis dui quam, suscipit quis feugiat id, fermentum ut augue. Mauris iaculis odio rhoncus lorem eleifend, posuere viverra turpis elementum.",
|
|
511
|
-
styleName: "",
|
|
512
|
-
styleOverrides: {},
|
|
513
|
-
});
|
|
514
|
-
const fractionRun = FractionRun.create({ numerator: "num", denominator: "denom", styleName: "", styleOverrides: {} });
|
|
515
|
-
textBlock.appendRun(run0);
|
|
516
|
-
textBlock.appendRun(fractionRun);
|
|
517
|
-
textBlock.appendParagraph();
|
|
518
|
-
textBlock.appendRun(run1);
|
|
519
|
-
textBlock.appendRun(run2);
|
|
520
|
-
// Call the toResult() method
|
|
521
|
-
const textBlockLayout = doLayout(textBlock, {
|
|
522
|
-
findFontId: (fontName) => {
|
|
523
|
-
if (fontName === "arial") {
|
|
524
|
-
return 1;
|
|
525
|
-
}
|
|
526
|
-
else if (fontName === "run1") {
|
|
527
|
-
return 2;
|
|
528
|
-
}
|
|
529
|
-
return 0;
|
|
530
|
-
},
|
|
531
|
-
});
|
|
532
|
-
const result = textBlockLayout.toResult();
|
|
533
|
-
// Assert that the result object has the same data as the original TextBlockLayout object
|
|
534
|
-
expect(result.range).to.deep.equal(textBlockLayout.range.toJSON());
|
|
535
|
-
expect(result.lines.length).to.equal(textBlockLayout.lines.length);
|
|
536
|
-
// Loop through each line in the result and the original object
|
|
537
|
-
for (let i = 0; i < result.lines.length; i++) {
|
|
538
|
-
const resultLine = result.lines[i];
|
|
539
|
-
const originalLine = textBlockLayout.lines[i];
|
|
540
|
-
// Source paragraph index matches
|
|
541
|
-
expect(resultLine.sourceParagraphIndex).to.equal(textBlock.paragraphs.indexOf(originalLine.source));
|
|
542
|
-
// Ranges match
|
|
543
|
-
expect(resultLine.range).to.deep.equal(originalLine.range.toJSON());
|
|
544
|
-
expect(resultLine.justificationRange).to.deep.equal(originalLine.justificationRange.toJSON());
|
|
545
|
-
// Offset matches
|
|
546
|
-
expect(resultLine.offsetFromDocument).to.deep.equal(originalLine.offsetFromDocument);
|
|
547
|
-
for (let j = 0; j < resultLine.runs.length; j++) {
|
|
548
|
-
const resultRun = resultLine.runs[j];
|
|
549
|
-
const originalRun = originalLine.runs[j];
|
|
550
|
-
// Source run index matches
|
|
551
|
-
expect(resultRun.sourceRunIndex).to.equal(textBlock.paragraphs[resultLine.sourceParagraphIndex].runs.indexOf(originalRun.source));
|
|
552
|
-
// FontId matches
|
|
553
|
-
expect(resultRun.fontId).to.equal(originalRun.fontId);
|
|
554
|
-
// Offsets match
|
|
555
|
-
expect(resultRun.characterOffset).to.equal(originalRun.charOffset);
|
|
556
|
-
expect(resultRun.characterCount).to.equal(originalRun.numChars);
|
|
557
|
-
expect(resultRun.offsetFromLine).to.deep.equal(originalRun.offsetFromLine);
|
|
558
|
-
// Range matches
|
|
559
|
-
expect(resultRun.range).to.deep.equal(originalRun.range.toJSON());
|
|
560
|
-
// Text style matches
|
|
561
|
-
expect(resultRun.textStyle).to.deep.equal(originalRun.style.toJSON());
|
|
562
|
-
// Optional values match existence and values
|
|
563
|
-
if (resultRun.justificationRange) {
|
|
564
|
-
expect(originalRun.justificationRange);
|
|
565
|
-
}
|
|
566
|
-
if (originalRun.justificationRange) {
|
|
567
|
-
expect(resultRun.justificationRange);
|
|
568
|
-
}
|
|
569
|
-
if (resultRun.justificationRange && originalRun.justificationRange) {
|
|
570
|
-
expect(resultRun.justificationRange).to.deep.equal(originalRun.justificationRange.toJSON());
|
|
571
|
-
}
|
|
572
|
-
if (resultRun.numeratorRange) {
|
|
573
|
-
expect(originalRun.numeratorRange);
|
|
574
|
-
}
|
|
575
|
-
if (originalRun.numeratorRange) {
|
|
576
|
-
expect(resultRun.numeratorRange);
|
|
577
|
-
}
|
|
578
|
-
if (resultRun.numeratorRange && originalRun.numeratorRange) {
|
|
579
|
-
expect(resultRun.numeratorRange).to.deep.equal(originalRun.numeratorRange.toJSON());
|
|
580
|
-
}
|
|
581
|
-
if (resultRun.denominatorRange) {
|
|
582
|
-
expect(originalRun.denominatorRange);
|
|
583
|
-
}
|
|
584
|
-
if (originalRun.denominatorRange) {
|
|
585
|
-
expect(resultRun.denominatorRange);
|
|
586
|
-
}
|
|
587
|
-
if (resultRun.denominatorRange && originalRun.denominatorRange) {
|
|
588
|
-
expect(resultRun.denominatorRange).to.deep.equal(originalRun.denominatorRange.toJSON());
|
|
589
|
-
}
|
|
590
|
-
// Check that the result string matches what we expect
|
|
591
|
-
const inputRun = textBlock.paragraphs[resultLine.sourceParagraphIndex].runs[resultRun.sourceRunIndex].clone();
|
|
592
|
-
if (inputRun.type === "text") {
|
|
593
|
-
const resultText = inputRun.content.substring(resultRun.characterOffset, resultRun.characterOffset + resultRun.characterCount);
|
|
594
|
-
const originalText = inputRun.content.substring(originalRun.charOffset, originalRun.charOffset + originalRun.numChars);
|
|
595
|
-
expect(resultText).to.equal(originalText);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
it("adds margins", function () {
|
|
601
|
-
const expectMargins = (layoutRange, marginRange, margins) => {
|
|
602
|
-
expect(marginRange.low.x).to.equal(layoutRange.low.x - (margins.left ?? 0));
|
|
603
|
-
expect(marginRange.high.x).to.equal(layoutRange.high.x + (margins.right ?? 0));
|
|
604
|
-
expect(marginRange.low.y).to.equal(layoutRange.low.y - (margins.bottom ?? 0));
|
|
605
|
-
expect(marginRange.high.y).to.equal(layoutRange.high.y + (margins.top ?? 0));
|
|
606
|
-
};
|
|
607
|
-
const makeTextBlock = (margins) => {
|
|
608
|
-
const textblock = TextBlock.create({ styleName: "", styleOverrides: { lineSpacingFactor: 0 }, margins });
|
|
609
|
-
textblock.appendRun(makeTextRun("abc"));
|
|
610
|
-
textblock.appendRun(makeTextRun("defg"));
|
|
611
|
-
return textblock;
|
|
612
|
-
};
|
|
613
|
-
let block = makeTextBlock({});
|
|
614
|
-
let layout = doLayout(block);
|
|
615
|
-
// Margins should be 0 by default
|
|
616
|
-
expect(layout.range.isAlmostEqual(layout.textRange)).to.be.true;
|
|
617
|
-
expectMargins(layout.textRange, layout.range, {});
|
|
618
|
-
// All margins should be applied to the range
|
|
619
|
-
block = makeTextBlock({ left: 1, right: 2, top: 3, bottom: 4 });
|
|
620
|
-
layout = doLayout(block);
|
|
621
|
-
expectMargins(layout.textRange, layout.range, { left: 1, right: 2, top: 3, bottom: 4 });
|
|
622
|
-
// Just horisontal margins should be applied
|
|
623
|
-
block = makeTextBlock({ left: 1, right: 2 });
|
|
624
|
-
layout = doLayout(block);
|
|
625
|
-
expectMargins(layout.textRange, layout.range, { left: 1, right: 2 });
|
|
626
|
-
// Just vertical margins should be applied
|
|
627
|
-
block = makeTextBlock({ top: 1, bottom: 2 });
|
|
628
|
-
layout = doLayout(block);
|
|
629
|
-
expectMargins(layout.textRange, layout.range, { top: 1, bottom: 2 });
|
|
630
|
-
});
|
|
631
|
-
describe("grapheme offsets", () => {
|
|
632
|
-
it("should return an empty array if source type is not text", function () {
|
|
633
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
634
|
-
const fractionRun = FractionRun.create({ numerator: "1", denominator: "2", styleName: "fraction" });
|
|
635
|
-
textBlock.appendRun(fractionRun);
|
|
636
|
-
const layout = doLayout(textBlock);
|
|
637
|
-
const result = layout.toResult();
|
|
638
|
-
const args = {
|
|
639
|
-
textBlock,
|
|
640
|
-
iModel: {},
|
|
641
|
-
findTextStyle: () => TextStyleSettings.defaults,
|
|
642
|
-
findFontId: () => 0,
|
|
643
|
-
computeTextRange: computeTextRangeAsStringLength,
|
|
644
|
-
paragraphIndex: result.lines[0].sourceParagraphIndex,
|
|
645
|
-
runLayoutResult: result.lines[0].runs[0],
|
|
646
|
-
graphemeCharIndexes: [0],
|
|
647
|
-
};
|
|
648
|
-
const graphemeRanges = computeGraphemeOffsets(args);
|
|
649
|
-
expect(graphemeRanges).to.be.an("array").that.is.empty;
|
|
650
|
-
});
|
|
651
|
-
it("should handle empty text content", function () {
|
|
652
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
653
|
-
const textRun = TextRun.create({ content: "", styleName: "text" });
|
|
654
|
-
textBlock.appendRun(textRun);
|
|
655
|
-
const layout = doLayout(textBlock);
|
|
656
|
-
const result = layout.toResult();
|
|
657
|
-
const args = {
|
|
658
|
-
textBlock,
|
|
659
|
-
iModel: {},
|
|
660
|
-
findTextStyle: () => TextStyleSettings.defaults,
|
|
661
|
-
findFontId: () => 0,
|
|
662
|
-
computeTextRange: computeTextRangeAsStringLength,
|
|
663
|
-
paragraphIndex: result.lines[0].sourceParagraphIndex,
|
|
664
|
-
runLayoutResult: result.lines[0].runs[0],
|
|
665
|
-
graphemeCharIndexes: [0], // Supply a grapheme index even though there is no text
|
|
666
|
-
};
|
|
667
|
-
const graphemeRanges = computeGraphemeOffsets(args);
|
|
668
|
-
expect(graphemeRanges).to.be.an("array").that.is.empty;
|
|
669
|
-
});
|
|
670
|
-
it("should compute grapheme offsets correctly for a given text", function () {
|
|
671
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
672
|
-
const textRun = TextRun.create({ content: "hello", styleName: "text" });
|
|
673
|
-
textBlock.appendRun(textRun);
|
|
674
|
-
const layout = doLayout(textBlock);
|
|
675
|
-
const result = layout.toResult();
|
|
676
|
-
const args = {
|
|
677
|
-
textBlock,
|
|
678
|
-
iModel: {},
|
|
679
|
-
findTextStyle: () => TextStyleSettings.defaults,
|
|
680
|
-
findFontId: () => 0,
|
|
681
|
-
computeTextRange: computeTextRangeAsStringLength,
|
|
682
|
-
paragraphIndex: result.lines[0].sourceParagraphIndex,
|
|
683
|
-
runLayoutResult: result.lines[0].runs[0],
|
|
684
|
-
graphemeCharIndexes: [0, 1, 2, 3, 4],
|
|
685
|
-
};
|
|
686
|
-
const graphemeRanges = computeGraphemeOffsets(args);
|
|
687
|
-
expect(graphemeRanges).to.be.an("array").that.has.lengthOf(5);
|
|
688
|
-
expect(graphemeRanges[0].high.x).to.equal(1);
|
|
689
|
-
expect(graphemeRanges[4].high.x).to.equal(5);
|
|
690
|
-
});
|
|
691
|
-
it("should compute grapheme offsets correctly for non-English text", function () {
|
|
692
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
693
|
-
// Hindi - "Paragraph"
|
|
694
|
-
const textRun = TextRun.create({ content: "अनुच्छेद", styleName: "text" });
|
|
695
|
-
textBlock.appendRun(textRun);
|
|
696
|
-
const layout = doLayout(textBlock);
|
|
697
|
-
const result = layout.toResult();
|
|
698
|
-
const args = {
|
|
699
|
-
textBlock,
|
|
700
|
-
iModel: {},
|
|
701
|
-
findTextStyle: () => TextStyleSettings.defaults,
|
|
702
|
-
findFontId: () => 0,
|
|
703
|
-
computeTextRange: computeTextRangeAsStringLength,
|
|
704
|
-
paragraphIndex: result.lines[0].sourceParagraphIndex,
|
|
705
|
-
runLayoutResult: result.lines[0].runs[0],
|
|
706
|
-
graphemeCharIndexes: [0, 1, 3, 7],
|
|
707
|
-
};
|
|
708
|
-
const graphemeRanges = computeGraphemeOffsets(args);
|
|
709
|
-
expect(graphemeRanges).to.be.an("array").that.has.lengthOf(4); // Length based on actual grapheme segmentation
|
|
710
|
-
expect(graphemeRanges[0].high.x).to.equal(1);
|
|
711
|
-
expect(graphemeRanges[1].high.x).to.equal(3);
|
|
712
|
-
expect(graphemeRanges[2].high.x).to.equal(7);
|
|
713
|
-
expect(graphemeRanges[3].high.x).to.equal(8);
|
|
714
|
-
});
|
|
715
|
-
it("should compute grapheme offsets correctly for emoji content", function () {
|
|
716
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
717
|
-
const textRun = TextRun.create({ content: "👨👦", styleName: "text" });
|
|
718
|
-
textBlock.appendRun(textRun);
|
|
719
|
-
const layout = doLayout(textBlock);
|
|
720
|
-
const result = layout.toResult();
|
|
721
|
-
const args = {
|
|
722
|
-
textBlock,
|
|
723
|
-
iModel: {},
|
|
724
|
-
findTextStyle: () => TextStyleSettings.defaults,
|
|
725
|
-
findFontId: () => 0,
|
|
726
|
-
computeTextRange: computeTextRangeAsStringLength,
|
|
727
|
-
paragraphIndex: result.lines[0].sourceParagraphIndex,
|
|
728
|
-
runLayoutResult: result.lines[0].runs[0],
|
|
729
|
-
graphemeCharIndexes: [0],
|
|
730
|
-
};
|
|
731
|
-
const graphemeRanges = computeGraphemeOffsets(args);
|
|
732
|
-
expect(graphemeRanges).to.be.an("array").that.has.lengthOf(1); // Length based on actual grapheme segmentation
|
|
733
|
-
expect(graphemeRanges[0].high.x).to.equal(5);
|
|
734
|
-
});
|
|
735
|
-
});
|
|
736
|
-
describe("using native font library", () => {
|
|
737
|
-
let iModel;
|
|
738
|
-
before(() => {
|
|
739
|
-
const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
|
|
740
|
-
const testFileName = IModelTestUtils.prepareOutputFile("NativeFonts", "NativeFonts.bim");
|
|
741
|
-
iModel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
|
|
742
|
-
});
|
|
743
|
-
after(() => iModel.close());
|
|
744
|
-
it("maps font names to Id", async () => {
|
|
745
|
-
const vera = iModel.fonts.findId({ name: "Vera" });
|
|
746
|
-
expect(vera).to.equal(1);
|
|
747
|
-
const arial = await iModel.fonts.acquireId({ name: "Arial", type: FontType.TrueType });
|
|
748
|
-
const comic = await iModel.fonts.acquireId({ name: "Comic Sans", type: FontType.TrueType });
|
|
749
|
-
iModel.saveChanges();
|
|
750
|
-
expect(arial).to.equal(2);
|
|
751
|
-
expect(comic).to.equal(3);
|
|
752
|
-
expect(iModel.fonts.findId({ name: "Consolas" })).to.be.undefined;
|
|
753
|
-
function test(fontName, expectedFontId) {
|
|
754
|
-
const textBlock = TextBlock.create({ styleName: "" });
|
|
755
|
-
textBlock.appendRun(TextRun.create({ styleName: "", styleOverrides: { fontName } }));
|
|
756
|
-
const layout = layoutTextBlock({ textBlock, iModel });
|
|
757
|
-
const run = layout.lines[0].runs[0];
|
|
758
|
-
expect(run).not.to.be.undefined;
|
|
759
|
-
expect(run.fontId).to.equal(expectedFontId);
|
|
760
|
-
}
|
|
761
|
-
test("Arial", arial);
|
|
762
|
-
test("Comic Sans", comic);
|
|
763
|
-
test("Consolas", 0);
|
|
764
|
-
test("arial", arial);
|
|
765
|
-
test("aRIaL", arial);
|
|
766
|
-
});
|
|
767
|
-
function computeDimensions(args) {
|
|
768
|
-
const textBlock = TextBlock.create({
|
|
769
|
-
styleName: "",
|
|
770
|
-
styleOverrides: {
|
|
771
|
-
lineHeight: args.height,
|
|
772
|
-
widthFactor: args.width,
|
|
773
|
-
},
|
|
774
|
-
});
|
|
775
|
-
textBlock.appendRun(TextRun.create({
|
|
776
|
-
styleName: "",
|
|
777
|
-
content: args.content ?? "This is a string of text.",
|
|
778
|
-
styleOverrides: {
|
|
779
|
-
isBold: args.bold,
|
|
780
|
-
isItalic: args.italic,
|
|
781
|
-
fontName: args.font ?? "Vera",
|
|
782
|
-
},
|
|
783
|
-
}));
|
|
784
|
-
const range = layoutTextBlock({ textBlock, iModel }).range;
|
|
785
|
-
return { x: range.high.x - range.low.x, y: range.high.y - range.low.y };
|
|
786
|
-
}
|
|
787
|
-
it("computes different ranges for different strings", () => {
|
|
788
|
-
expect(computeDimensions({ content: "text" })).to.deep.equal(computeDimensions({ content: "text" }));
|
|
789
|
-
expect(computeDimensions({ content: "text" })).not.to.deep.equal(computeDimensions({ content: "texttexttext" }));
|
|
790
|
-
expect(computeDimensions({ content: "text" })).not.to.deep.equal(computeDimensions({ content: "TEXT" }));
|
|
791
|
-
});
|
|
792
|
-
it("computes different ranges for different fonts", () => {
|
|
793
|
-
// These two are embedded in the iModel.
|
|
794
|
-
expect(computeDimensions({ font: "Vera" })).not.to.deep.equal(computeDimensions({ font: "Karla" }));
|
|
795
|
-
// These two are not embedded in the iModel, but do exist in its font table - they should both fall back to the default font.
|
|
796
|
-
expect(computeDimensions({ font: "Arial" })).to.deep.equal(computeDimensions({ font: "Comic Sans" }));
|
|
797
|
-
});
|
|
798
|
-
it("computes different ranges for different height and width", () => {
|
|
799
|
-
expect(computeDimensions({ height: 2 })).to.deep.equal(computeDimensions({ height: 2 }));
|
|
800
|
-
expect(computeDimensions({ height: 2 })).not.to.deep.equal(computeDimensions({ height: 3 }));
|
|
801
|
-
expect(computeDimensions({ width: 2 })).to.deep.equal(computeDimensions({ width: 2 }));
|
|
802
|
-
expect(computeDimensions({ width: 2 })).not.to.deep.equal(computeDimensions({ width: 3 }));
|
|
803
|
-
});
|
|
804
|
-
it("excludes trailing blank glyphs from justification ranges", () => {
|
|
805
|
-
function computeRanges(chars) {
|
|
806
|
-
return iModel.computeRangesForText({
|
|
807
|
-
chars,
|
|
808
|
-
bold: false,
|
|
809
|
-
italic: false,
|
|
810
|
-
fontId: 1,
|
|
811
|
-
widthFactor: 1,
|
|
812
|
-
lineHeight: 1,
|
|
813
|
-
baselineShift: "none",
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
function test(chars, expectEqualRanges) {
|
|
817
|
-
const { justification, layout } = computeRanges(chars);
|
|
818
|
-
expect(layout.low.x).to.equal(justification.low.x);
|
|
819
|
-
expect(layout.high.y).to.equal(justification.high.y);
|
|
820
|
-
expect(layout.low.y).to.equal(justification.low.y);
|
|
821
|
-
if (expectEqualRanges) {
|
|
822
|
-
expect(layout.high.x).to.equal(justification.high.x);
|
|
823
|
-
}
|
|
824
|
-
else {
|
|
825
|
-
expect(layout.high.x).greaterThan(justification.high.x);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
test("abcdef", true);
|
|
829
|
-
test("abcdef ", false);
|
|
830
|
-
test("abcdef ", false);
|
|
831
|
-
test("abc def", true);
|
|
832
|
-
// new line has no width ever.
|
|
833
|
-
test("abcdef\n", true);
|
|
834
|
-
// apparently native code doesn't consider tab characters to be "blank".
|
|
835
|
-
test("abcdef\t", true);
|
|
836
|
-
// apparently native code doesn't consider "thin space" to be "blank".
|
|
837
|
-
test("abcdef\u2009", true);
|
|
838
|
-
const r1 = computeRanges("abcdef ");
|
|
839
|
-
const r2 = computeRanges("abcdef ");
|
|
840
|
-
expect(r1.layout.xLength()).lessThan(r2.layout.xLength());
|
|
841
|
-
expect(r1.justification.xLength()).to.equal(r2.justification.xLength());
|
|
842
|
-
});
|
|
843
|
-
});
|
|
844
|
-
});
|
|
11
|
+
import { Subject } from "../../Element";
|
|
12
|
+
import { Guid, Id64 } from "@itwin/core-bentley";
|
|
13
|
+
import { DefinitionModel } from "../../Model";
|
|
14
|
+
import { DrawingCategory, SpatialCategory } from "../../Category";
|
|
15
|
+
import { DisplayStyle2d, DisplayStyle3d } from "../../DisplayStyle";
|
|
16
|
+
import { CategorySelector, DrawingViewDefinition, ModelSelector, SpatialViewDefinition } from "../../ViewDefinition";
|
|
17
|
+
import { FontFile } from "../../FontFile";
|
|
18
|
+
import { computeTextRangeAsStringLength } from "../AnnotationTestUtils";
|
|
845
19
|
function mockIModel() {
|
|
846
20
|
const iModel = {
|
|
847
21
|
fonts: {
|
|
848
22
|
findId: () => 0,
|
|
849
23
|
},
|
|
850
|
-
computeRangesForText:
|
|
24
|
+
computeRangesForText: computeTextRangeAsStringLength,
|
|
851
25
|
forEachMetaData: () => undefined,
|
|
852
26
|
};
|
|
853
27
|
return iModel;
|
|
854
28
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
});
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
expect(geom[6].separator).not.to.be.undefined;
|
|
902
|
-
expect(geom[7].text).not.to.be.undefined;
|
|
903
|
-
expect(geom[8].text).not.to.be.undefined;
|
|
904
|
-
});
|
|
905
|
-
it("produces an appearance change for each non-break run that is a different color from the previous run", () => {
|
|
906
|
-
const geom = makeGeometry([
|
|
907
|
-
makeText(ColorDef.blue),
|
|
908
|
-
makeText(), // subcategory by default
|
|
909
|
-
makeText(),
|
|
910
|
-
makeText(ColorDef.red),
|
|
911
|
-
makeText(ColorDef.white),
|
|
912
|
-
makeText(ColorDef.white),
|
|
913
|
-
makeBreak("subcategory"),
|
|
914
|
-
makeFraction(ColorDef.green),
|
|
915
|
-
makeText(ColorDef.green),
|
|
916
|
-
makeBreak(ColorDef.black),
|
|
917
|
-
makeText(ColorDef.green),
|
|
918
|
-
]).map((entry) => entry.text ? "text" : (entry.separator ? "sep" : (typeof entry.color === "number" ? ColorDef.fromJSON(entry.color) : entry.color)));
|
|
919
|
-
expect(geom).to.deep.equal([
|
|
920
|
-
ColorDef.blue,
|
|
921
|
-
"text",
|
|
922
|
-
"subcategory",
|
|
923
|
-
"text",
|
|
924
|
-
"text",
|
|
925
|
-
ColorDef.red,
|
|
926
|
-
"text",
|
|
927
|
-
ColorDef.white,
|
|
928
|
-
"text",
|
|
929
|
-
"text",
|
|
930
|
-
ColorDef.green,
|
|
931
|
-
"text", "sep", "text",
|
|
932
|
-
"text",
|
|
933
|
-
"text",
|
|
934
|
-
]);
|
|
29
|
+
function createAnnotation(styleId) {
|
|
30
|
+
const styleOverrides = { fontName: "Karla" };
|
|
31
|
+
const block = TextBlock.create({ styleId: styleId ?? "0x42", styleOverrides });
|
|
32
|
+
block.appendRun(TextRun.create({ content: "Run, Barry,", styleOverrides }));
|
|
33
|
+
block.appendRun(TextRun.create({ content: " RUN!!! ", styleOverrides }));
|
|
34
|
+
block.appendRun(FractionRun.create({ numerator: "Harrison", denominator: "Wells", styleOverrides }));
|
|
35
|
+
block.margins = { left: 0, right: 1, top: 2, bottom: 3 };
|
|
36
|
+
const annotation = TextAnnotation.fromJSON({ textBlock: block.toJSON() });
|
|
37
|
+
annotation.anchor = { vertical: "middle", horizontal: "right" };
|
|
38
|
+
annotation.orientation = YawPitchRollAngles.createDegrees(1, 0, -1);
|
|
39
|
+
annotation.offset = Point3d.create(10, -5, 0);
|
|
40
|
+
annotation.leaders = [{ startPoint: Point3d.createZero(), attachment: { mode: "Nearest" } }];
|
|
41
|
+
return annotation;
|
|
42
|
+
}
|
|
43
|
+
const createJobSubjectElement = (iModel, name) => {
|
|
44
|
+
const subj = Subject.create(iModel, iModel.elements.getRootSubject().id, name);
|
|
45
|
+
subj.setJsonProperty("Subject", { Job: name }); // eslint-disable-line @typescript-eslint/naming-convention
|
|
46
|
+
return subj;
|
|
47
|
+
};
|
|
48
|
+
const insertDrawingModel = (standaloneModel, parentId, definitionModel) => {
|
|
49
|
+
const category = DrawingCategory.insert(standaloneModel, definitionModel, "DrawingCategory", new SubCategoryAppearance());
|
|
50
|
+
const [_, model] = IModelTestUtils.createAndInsertDrawingPartitionAndModel(standaloneModel, { spec: '0x1', scope: '0x1', value: 'Drawing' }, undefined, parentId);
|
|
51
|
+
const displayStyle = DisplayStyle2d.insert(standaloneModel, definitionModel, "DisplayStyle2d");
|
|
52
|
+
const categorySelector = CategorySelector.insert(standaloneModel, definitionModel, "DrawingCategories", [category]);
|
|
53
|
+
const viewRange = new Range2d(0, 0, 500, 500);
|
|
54
|
+
DrawingViewDefinition.insert(standaloneModel, definitionModel, "Drawing View", model, categorySelector, displayStyle, viewRange);
|
|
55
|
+
return { category, model };
|
|
56
|
+
};
|
|
57
|
+
const insertSpatialModel = (standaloneModel, parentId, definitionModel) => {
|
|
58
|
+
const category = SpatialCategory.insert(standaloneModel, definitionModel, "spatialCategory", new SubCategoryAppearance());
|
|
59
|
+
const [_, model] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(standaloneModel, { spec: '0x1', scope: '0x1', value: 'Spatial' }, undefined, parentId);
|
|
60
|
+
const modelSelector = ModelSelector.insert(standaloneModel, definitionModel, "SpatialModelSelector", [model]);
|
|
61
|
+
const displayStyle = DisplayStyle3d.insert(standaloneModel, definitionModel, "DisplayStyle3d");
|
|
62
|
+
const categorySelector = CategorySelector.insert(standaloneModel, definitionModel, "spatialCategories", [category]);
|
|
63
|
+
const viewRange = new Range3d(0, 0, 0, 500, 500, 500);
|
|
64
|
+
SpatialViewDefinition.insertWithCamera(standaloneModel, definitionModel, "spatial View", modelSelector, categorySelector, displayStyle, viewRange);
|
|
65
|
+
return { category, model };
|
|
66
|
+
};
|
|
67
|
+
const createIModel = async (name) => {
|
|
68
|
+
const filePath = IModelTestUtils.prepareOutputFile("annotationTests", `${name}.bim`);
|
|
69
|
+
const iModel = StandaloneDb.createEmpty(filePath, {
|
|
70
|
+
rootSubject: { name: `${name} tests`, description: `${name} tests` },
|
|
71
|
+
client: "integration tests",
|
|
72
|
+
globalOrigin: { x: 0, y: 0 },
|
|
73
|
+
projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },
|
|
74
|
+
guid: Guid.createValue(),
|
|
935
75
|
});
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const runs = [makeText()];
|
|
939
|
-
const block = makeTextBlock(runs);
|
|
940
|
-
block.margins = margins;
|
|
941
|
-
const annotation = TextAnnotation.fromJSON({ textBlock: block.toJSON() });
|
|
942
|
-
annotation.anchor = anchor;
|
|
943
|
-
const geom = produceTextAnnotationGeometry({ iModel: mockIModel(), annotation }).entries;
|
|
944
|
-
return geom[1].text;
|
|
945
|
-
}
|
|
946
|
-
function testMargins(margins, height, width) {
|
|
947
|
-
// We want to disregard negative margins. Note, I'm not changing the margins object itself. It gets passed into makeGeometryWithMargins as it is.
|
|
948
|
-
const left = margins.left >= 0 ? margins.left : 0;
|
|
949
|
-
const right = margins.right >= 0 ? margins.right : 0;
|
|
950
|
-
const top = margins.top >= 0 ? margins.top : 0;
|
|
951
|
-
const bottom = margins.bottom >= 0 ? margins.bottom : 0;
|
|
952
|
-
// Test case: bottom, left
|
|
953
|
-
let props = makeGeometryWithMargins({ horizontal: "left", vertical: "bottom" }, margins);
|
|
954
|
-
expect(props).not.to.be.undefined;
|
|
955
|
-
expect(props?.origin, "Expected geometry to be offset by left and bottom margins").to.deep.equal({ x: left, y: bottom, z: 0 });
|
|
956
|
-
// Test case: top, right
|
|
957
|
-
props = makeGeometryWithMargins({ vertical: "top", horizontal: "right" }, margins);
|
|
958
|
-
let x = (right + width) * -1;
|
|
959
|
-
let y = (top + height) * -1;
|
|
960
|
-
expect(props).not.to.be.undefined;
|
|
961
|
-
expect(props?.origin, "Expected geometry to be offset by top and right margins").to.deep.equal({ x, y, z: 0 });
|
|
962
|
-
// Test case: middle, center
|
|
963
|
-
props = makeGeometryWithMargins({ vertical: "middle", horizontal: "center" }, margins);
|
|
964
|
-
x = (left - right - width) / 2;
|
|
965
|
-
y = (bottom - top - height) / 2;
|
|
966
|
-
expect(props).not.to.be.undefined;
|
|
967
|
-
expect(props?.origin, "Expected geometry to be centered in the margins").to.deep.equal({ x, y, z: 0 });
|
|
968
|
-
}
|
|
969
|
-
// Getting the range from the same mock the native code uses to compute the range of a text block.
|
|
970
|
-
const textRange = mockIModel().computeRangesForText({
|
|
971
|
-
chars: "text",
|
|
972
|
-
bold: false,
|
|
973
|
-
italic: false,
|
|
974
|
-
fontId: 1,
|
|
975
|
-
widthFactor: 1,
|
|
976
|
-
lineHeight: 1,
|
|
977
|
-
baselineShift: "none",
|
|
978
|
-
});
|
|
979
|
-
const xLength = textRange.layout.xLength(); // Will be 1 because of the mock implementation.
|
|
980
|
-
const yLength = textRange.layout.yLength(); // Will be 1 because of the mock implementation.
|
|
981
|
-
testMargins({ top: 0, right: 0, bottom: 0, left: 0 }, yLength, xLength);
|
|
982
|
-
testMargins({ top: 1, right: 2, bottom: 3, left: 4 }, yLength, xLength);
|
|
983
|
-
testMargins({ top: -1, right: -2, bottom: -3, left: -4 }, yLength, xLength);
|
|
76
|
+
await iModel.fonts.embedFontFile({
|
|
77
|
+
file: FontFile.createFromTrueTypeFileName(IModelTestUtils.resolveFontFile("Karla-Regular.ttf"))
|
|
984
78
|
});
|
|
985
|
-
|
|
79
|
+
return iModel;
|
|
80
|
+
};
|
|
81
|
+
const createAnnotationTextStyle = (iModel, definitionModel, name, settings = TextStyleSettings.defaultProps) => {
|
|
82
|
+
return AnnotationTextStyle.create(iModel, definitionModel, name, settings, "description");
|
|
83
|
+
};
|
|
986
84
|
describe("TextAnnotation element", () => {
|
|
987
85
|
function makeElement(props) {
|
|
988
86
|
return TextAnnotation2d.fromJSON({
|
|
@@ -993,33 +91,29 @@ describe("TextAnnotation element", () => {
|
|
|
993
91
|
scope: "0x78",
|
|
994
92
|
},
|
|
995
93
|
classFullName: TextAnnotation2d.classFullName,
|
|
94
|
+
placement: {
|
|
95
|
+
origin: { x: 0, y: 0 },
|
|
96
|
+
angle: 0,
|
|
97
|
+
},
|
|
996
98
|
...props,
|
|
997
99
|
}, mockIModel());
|
|
998
100
|
}
|
|
999
101
|
describe("getAnnotation", () => {
|
|
1000
|
-
it("returns undefined if not
|
|
102
|
+
it("returns undefined if not provided", () => {
|
|
1001
103
|
expect(makeElement().getAnnotation()).to.be.undefined;
|
|
1002
104
|
});
|
|
1003
|
-
it("
|
|
105
|
+
it("converts JSON string to class instance", () => {
|
|
1004
106
|
const elem = makeElement({
|
|
1005
|
-
|
|
1006
|
-
annotation: {
|
|
1007
|
-
textBlock: TextBlock.create({ styleName: "block" }).toJSON(),
|
|
1008
|
-
},
|
|
1009
|
-
},
|
|
107
|
+
textAnnotationData: JSON.stringify({ textBlock: TextBlock.create({ styleId: "0x42" }).toJSON() })
|
|
1010
108
|
});
|
|
1011
109
|
const anno = elem.getAnnotation();
|
|
1012
110
|
expect(anno).not.to.be.undefined;
|
|
1013
111
|
expect(anno.textBlock.isEmpty).to.be.true;
|
|
1014
|
-
expect(anno.textBlock.
|
|
112
|
+
expect(anno.textBlock.styleId).to.equal("0x42");
|
|
1015
113
|
});
|
|
1016
114
|
it("produces a new object each time it is called", () => {
|
|
1017
115
|
const elem = makeElement({
|
|
1018
|
-
|
|
1019
|
-
annotation: {
|
|
1020
|
-
textBlock: TextBlock.create({ styleName: "block" }).toJSON(),
|
|
1021
|
-
},
|
|
1022
|
-
},
|
|
116
|
+
textAnnotationData: JSON.stringify({ textBlock: TextBlock.create({ styleId: "0x42" }).toJSON() })
|
|
1023
117
|
});
|
|
1024
118
|
const anno1 = elem.getAnnotation();
|
|
1025
119
|
const anno2 = elem.getAnnotation();
|
|
@@ -1028,74 +122,49 @@ describe("TextAnnotation element", () => {
|
|
|
1028
122
|
});
|
|
1029
123
|
});
|
|
1030
124
|
describe("setAnnotation", () => {
|
|
1031
|
-
it("updates
|
|
125
|
+
it("updates properties", () => {
|
|
1032
126
|
const elem = makeElement();
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
expect(elem.
|
|
1038
|
-
expect(elem.
|
|
1039
|
-
});
|
|
1040
|
-
it("uses default subcategory by default", () => {
|
|
1041
|
-
const elem = makeElement();
|
|
1042
|
-
elem.setAnnotation(TextAnnotation.fromJSON({ textBlock: { styleName: "block" } }));
|
|
1043
|
-
expect(elem.geom.length).to.equal(1);
|
|
1044
|
-
expect(elem.geom[0].appearance.subCategory).to.equal("0x13");
|
|
1045
|
-
});
|
|
1046
|
-
it("uses specific subcategory if provided", () => {
|
|
1047
|
-
const elem = makeElement();
|
|
1048
|
-
elem.setAnnotation(TextAnnotation.fromJSON({ textBlock: { styleName: "block" } }), "0x1234");
|
|
1049
|
-
expect(elem.geom.length).to.equal(1);
|
|
1050
|
-
expect(elem.geom[0].appearance.subCategory).to.equal("0x1234");
|
|
127
|
+
const textBlock = TextBlock.create({ styleId: "0x42" });
|
|
128
|
+
textBlock.appendRun(TextRun.create({ content: "text" }));
|
|
129
|
+
const annotation = TextAnnotation.fromJSON({ textBlock: textBlock.toJSON() });
|
|
130
|
+
elem.setAnnotation(annotation);
|
|
131
|
+
expect(elem.getAnnotation().toJSON()).to.deep.equal(annotation.toJSON());
|
|
132
|
+
expect(elem.getAnnotation().toJSON()).not.to.equal(annotation.toJSON());
|
|
1051
133
|
});
|
|
1052
134
|
});
|
|
1053
|
-
describe("
|
|
135
|
+
describe("TextAnnotation3d Persistence", () => {
|
|
1054
136
|
let imodel;
|
|
1055
|
-
let
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
imodel =
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
137
|
+
let seedCategoryId;
|
|
138
|
+
let seedModelId;
|
|
139
|
+
let seedStyleId;
|
|
140
|
+
before(async () => {
|
|
141
|
+
imodel = await createIModel("TextAnnotation3d");
|
|
142
|
+
const jobSubjectId = createJobSubjectElement(imodel, "Job").insert();
|
|
143
|
+
const definitionModel = DefinitionModel.insert(imodel, jobSubjectId, "Definition");
|
|
144
|
+
const { category, model } = insertSpatialModel(imodel, jobSubjectId, definitionModel);
|
|
145
|
+
const styleId = createAnnotationTextStyle(imodel, definitionModel, "test", { fontName: "Totally Real Font", lineHeight: 0.25, isItalic: true }).insert();
|
|
146
|
+
expect(jobSubjectId).not.to.be.undefined;
|
|
147
|
+
expect(category).not.to.be.undefined;
|
|
148
|
+
expect(model).not.to.be.undefined;
|
|
149
|
+
expect(styleId).not.to.be.undefined;
|
|
150
|
+
seedCategoryId = category;
|
|
151
|
+
seedModelId = model;
|
|
152
|
+
seedStyleId = styleId;
|
|
1063
153
|
});
|
|
1064
154
|
after(() => imodel.close());
|
|
1065
|
-
function
|
|
1066
|
-
return TextAnnotation3d.
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
spec: seed.code.spec,
|
|
1071
|
-
scope: seed.code.scope,
|
|
1072
|
-
},
|
|
1073
|
-
...props,
|
|
1074
|
-
classFullName: TextAnnotation3d.classFullName,
|
|
1075
|
-
}, imodel);
|
|
1076
|
-
}
|
|
1077
|
-
function createAnnotation() {
|
|
1078
|
-
const block = TextBlock.createEmpty();
|
|
1079
|
-
block.styleName = "block";
|
|
1080
|
-
block.appendRun(makeTextRun("run", "run1"));
|
|
1081
|
-
block.appendRun(makeTextRun("RUN!!!!!", "run2"));
|
|
1082
|
-
return TextAnnotation.fromJSON({
|
|
1083
|
-
textBlock: block.toJSON(),
|
|
1084
|
-
anchor: {
|
|
1085
|
-
vertical: "middle",
|
|
1086
|
-
horizontal: "right",
|
|
1087
|
-
},
|
|
1088
|
-
orientation: { yaw: 1, pitch: 0, roll: -1 },
|
|
1089
|
-
offset: [0, -5, 100],
|
|
1090
|
-
});
|
|
155
|
+
function createElement3d(createArgs) {
|
|
156
|
+
return TextAnnotation3d.create(imodel, seedCategoryId, seedModelId, {
|
|
157
|
+
origin: { x: 0, y: 0, z: 0 },
|
|
158
|
+
angles: YawPitchRollAngles.createDegrees(0, 0, 0).toJSON(),
|
|
159
|
+
}, createArgs?.textAnnotationData);
|
|
1091
160
|
}
|
|
1092
|
-
it("
|
|
161
|
+
it("creating element does not automatically compute the geometry", () => {
|
|
1093
162
|
const annotation = createAnnotation();
|
|
1094
|
-
const el =
|
|
163
|
+
const el = createElement3d({ textAnnotationData: annotation.toJSON() });
|
|
1095
164
|
expect(el.getAnnotation().equals(annotation)).to.be.true;
|
|
1096
165
|
expect(el.geom).to.be.undefined;
|
|
1097
166
|
});
|
|
1098
|
-
function
|
|
167
|
+
function expectPlacement3d(el, expectValidBBox, expectedOrigin = [0, 0, 0], expectedYPR = [0, 0, 0]) {
|
|
1099
168
|
expect(el.placement.origin.x).to.equal(expectedOrigin[0]);
|
|
1100
169
|
expect(el.placement.origin.y).to.equal(expectedOrigin[1]);
|
|
1101
170
|
expect(el.placement.origin.z).to.equal(expectedOrigin[2]);
|
|
@@ -1104,32 +173,185 @@ describe("TextAnnotation element", () => {
|
|
|
1104
173
|
expect(el.placement.angles.roll.radians).to.equal(expectedYPR[2]);
|
|
1105
174
|
expect(el.placement.bbox.isNull).to.equal(!expectValidBBox);
|
|
1106
175
|
}
|
|
1107
|
-
|
|
1108
|
-
function test(annotation) {
|
|
1109
|
-
const el0 =
|
|
176
|
+
describe("inserts 3d element and round-trips through JSON", async () => {
|
|
177
|
+
async function test(annotation) {
|
|
178
|
+
const el0 = createElement3d();
|
|
1110
179
|
if (annotation) {
|
|
1111
180
|
el0.setAnnotation(annotation);
|
|
1112
181
|
}
|
|
1113
|
-
|
|
182
|
+
expectPlacement3d(el0, false);
|
|
1114
183
|
const elId = el0.insert();
|
|
1115
184
|
expect(Id64.isValidId64(elId)).to.be.true;
|
|
1116
185
|
const el1 = imodel.elements.getElement(elId);
|
|
1117
186
|
expect(el1).not.to.be.undefined;
|
|
1118
187
|
expect(el1 instanceof TextAnnotation3d).to.be.true;
|
|
1119
|
-
|
|
188
|
+
expectPlacement3d(el1, undefined !== annotation && !annotation.textBlock.isEmpty);
|
|
1120
189
|
const anno = el1.getAnnotation();
|
|
1121
190
|
if (!annotation) {
|
|
1122
191
|
expect(anno).to.be.undefined;
|
|
192
|
+
expect(el0.toJSON().elementGeometryBuilderParams).to.be.undefined;
|
|
1123
193
|
}
|
|
1124
194
|
else {
|
|
1125
195
|
expect(anno).not.to.be.undefined;
|
|
1126
196
|
expect(anno.equals(annotation)).to.be.true;
|
|
197
|
+
expect(el0.toJSON().elementGeometryBuilderParams).not.to.be.undefined;
|
|
1127
198
|
}
|
|
1128
199
|
}
|
|
1129
|
-
test();
|
|
1130
|
-
test(TextAnnotation.fromJSON({ textBlock: {
|
|
1131
|
-
test(createAnnotation());
|
|
200
|
+
it("roundtrips an empty annotation", async () => { await test(); });
|
|
201
|
+
it("roundtrips an annotation with a style", async () => { await test(TextAnnotation.fromJSON({ textBlock: { styleId: seedStyleId } })); });
|
|
202
|
+
it("roundtrips an annotation with a textBlock", async () => { await test(createAnnotation()); });
|
|
1132
203
|
});
|
|
1133
204
|
});
|
|
205
|
+
describe("TextAnnotation2d Persistence", () => {
|
|
206
|
+
let imodel;
|
|
207
|
+
let seedCategoryId;
|
|
208
|
+
let seedModelId;
|
|
209
|
+
let seedStyleId;
|
|
210
|
+
before(async () => {
|
|
211
|
+
imodel = await createIModel("TextAnnotation2d");
|
|
212
|
+
const jobSubjectId = createJobSubjectElement(imodel, "Job").insert();
|
|
213
|
+
const definitionModel = DefinitionModel.insert(imodel, jobSubjectId, "Definition");
|
|
214
|
+
const { category, model } = insertDrawingModel(imodel, jobSubjectId, definitionModel);
|
|
215
|
+
const styleId = createAnnotationTextStyle(imodel, definitionModel, "test", { fontName: "Totally Real Font", lineHeight: 0.25, isItalic: true }).insert();
|
|
216
|
+
expect(jobSubjectId).not.to.be.undefined;
|
|
217
|
+
expect(category).not.to.be.undefined;
|
|
218
|
+
expect(model).not.to.be.undefined;
|
|
219
|
+
expect(styleId).not.to.be.undefined;
|
|
220
|
+
seedCategoryId = category;
|
|
221
|
+
seedModelId = model;
|
|
222
|
+
seedStyleId = styleId;
|
|
223
|
+
});
|
|
224
|
+
after(() => {
|
|
225
|
+
imodel.saveChanges("tests");
|
|
226
|
+
imodel.close();
|
|
227
|
+
});
|
|
228
|
+
function createElement2d(createArgs) {
|
|
229
|
+
return TextAnnotation2d.create(imodel, seedCategoryId, seedModelId, {
|
|
230
|
+
origin: { x: 0, y: 0 },
|
|
231
|
+
angle: Angle.createDegrees(0).toJSON(),
|
|
232
|
+
}, createArgs?.textAnnotationData);
|
|
233
|
+
}
|
|
234
|
+
it("creating element does not automatically compute the geometry", () => {
|
|
235
|
+
const annotation = createAnnotation();
|
|
236
|
+
const el = createElement2d({ textAnnotationData: annotation.toJSON() });
|
|
237
|
+
expect(el.getAnnotation().equals(annotation)).to.be.true;
|
|
238
|
+
expect(el.geom).to.be.undefined;
|
|
239
|
+
});
|
|
240
|
+
function expectPlacement2d(el, expectValidBBox, expectedOrigin = [0, 0, 0], expectedYPR = [0, 0, 0]) {
|
|
241
|
+
expect(el.placement.origin.x).to.equal(expectedOrigin[0]);
|
|
242
|
+
expect(el.placement.origin.y).to.equal(expectedOrigin[1]);
|
|
243
|
+
expect(el.placement.angle.degrees).to.equal(expectedYPR[0]);
|
|
244
|
+
expect(el.placement.bbox.isNull).to.equal(!expectValidBBox);
|
|
245
|
+
}
|
|
246
|
+
describe("inserts 2d element and round-trips through JSON", async () => {
|
|
247
|
+
async function test(annotation) {
|
|
248
|
+
const el0 = createElement2d();
|
|
249
|
+
if (annotation) {
|
|
250
|
+
el0.setAnnotation(annotation);
|
|
251
|
+
}
|
|
252
|
+
expectPlacement2d(el0, false);
|
|
253
|
+
const elId = el0.insert();
|
|
254
|
+
expect(Id64.isValidId64(elId)).to.be.true;
|
|
255
|
+
const el1 = imodel.elements.getElement(elId);
|
|
256
|
+
expect(el1).not.to.be.undefined;
|
|
257
|
+
expect(el1 instanceof TextAnnotation2d).to.be.true;
|
|
258
|
+
expectPlacement2d(el1, undefined !== annotation && !annotation.textBlock.isEmpty);
|
|
259
|
+
const anno = el1.getAnnotation();
|
|
260
|
+
if (!annotation) {
|
|
261
|
+
expect(anno).to.be.undefined;
|
|
262
|
+
expect(el0.toJSON().elementGeometryBuilderParams).to.be.undefined;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
expect(anno).not.to.be.undefined;
|
|
266
|
+
expect(anno.equals(annotation)).to.be.true;
|
|
267
|
+
expect(el0.toJSON().elementGeometryBuilderParams).not.to.be.undefined;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
it("roundtrips an empty annotation", async () => { await test(); });
|
|
271
|
+
it("roundtrips an annotation with a style", async () => { await test(TextAnnotation.fromJSON({ textBlock: { styleId: seedStyleId } })); });
|
|
272
|
+
it("roundtrips an annotation with a textBlock", async () => { await test(createAnnotation()); });
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
describe("AnnotationTextStyle", () => {
|
|
277
|
+
let imodel;
|
|
278
|
+
let seedSubjectId;
|
|
279
|
+
let seedDefinitionModel;
|
|
280
|
+
before(async () => {
|
|
281
|
+
imodel = await createIModel("AnnotationTextStyle");
|
|
282
|
+
const jobSubjectId = createJobSubjectElement(imodel, "Job").insert();
|
|
283
|
+
const definitionModel = DefinitionModel.insert(imodel, jobSubjectId, "Definition");
|
|
284
|
+
expect(jobSubjectId).not.to.be.undefined;
|
|
285
|
+
expect(definitionModel).not.to.be.undefined;
|
|
286
|
+
seedSubjectId = jobSubjectId;
|
|
287
|
+
seedDefinitionModel = definitionModel;
|
|
288
|
+
});
|
|
289
|
+
after(() => {
|
|
290
|
+
imodel.close();
|
|
291
|
+
});
|
|
292
|
+
it("inserts a style and round-trips through JSON", async () => {
|
|
293
|
+
const textStyle = TextStyleSettings.fromJSON({
|
|
294
|
+
fontName: "Totally Real Font",
|
|
295
|
+
isUnderlined: true,
|
|
296
|
+
lineHeight: 0.5
|
|
297
|
+
});
|
|
298
|
+
const el0 = createAnnotationTextStyle(imodel, seedDefinitionModel, "round-trip", textStyle.toJSON());
|
|
299
|
+
const elId = el0.insert();
|
|
300
|
+
expect(Id64.isValidId64(elId)).to.be.true;
|
|
301
|
+
const el1 = imodel.elements.getElement(elId);
|
|
302
|
+
expect(el1).not.to.be.undefined;
|
|
303
|
+
expect(el1 instanceof AnnotationTextStyle).to.be.true;
|
|
304
|
+
const style = el1.settings;
|
|
305
|
+
expect(style).not.to.be.undefined;
|
|
306
|
+
expect(style.toJSON()).to.deep.equal(textStyle.toJSON());
|
|
307
|
+
});
|
|
308
|
+
it("does not allow elements with invalid styles to be inserted", async () => {
|
|
309
|
+
// Default style should fail since it has no font
|
|
310
|
+
let annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "default");
|
|
311
|
+
expect(() => annotationTextStyle.insert()).to.throw();
|
|
312
|
+
// font is required
|
|
313
|
+
annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "no font", { fontName: "" });
|
|
314
|
+
expect(() => annotationTextStyle.insert()).to.throw();
|
|
315
|
+
// lineHeight should be positive
|
|
316
|
+
annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "invalid lineHeight", { fontName: "Totally Real Font", lineHeight: 0 });
|
|
317
|
+
expect(() => annotationTextStyle.insert()).to.throw();
|
|
318
|
+
// stackedFractionScale should be positive
|
|
319
|
+
annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "invalid stackedFractionScale", { fontName: "Totally Real Font", stackedFractionScale: 0 });
|
|
320
|
+
expect(() => annotationTextStyle.insert()).to.throw();
|
|
321
|
+
});
|
|
322
|
+
it("does not allow updating of elements to invalid styles", async () => {
|
|
323
|
+
const annotationTextStyle = createAnnotationTextStyle(imodel, seedDefinitionModel, "valid style", { fontName: "Totally Real Font" });
|
|
324
|
+
const elId = annotationTextStyle.insert();
|
|
325
|
+
expect(Id64.isValidId64(elId)).to.be.true;
|
|
326
|
+
const el1 = imodel.elements.getElement(elId);
|
|
327
|
+
expect(el1).not.to.be.undefined;
|
|
328
|
+
expect(el1 instanceof AnnotationTextStyle).to.be.true;
|
|
329
|
+
el1.settings = el1.settings.clone({ fontName: "" });
|
|
330
|
+
expect(() => el1.update()).to.throw();
|
|
331
|
+
el1.settings = el1.settings.clone({ fontName: "Totally Real Font", lineHeight: 0 });
|
|
332
|
+
expect(() => el1.update()).to.throw();
|
|
333
|
+
el1.settings = el1.settings.clone({ lineHeight: 2, stackedFractionScale: 0 });
|
|
334
|
+
expect(() => el1.update()).to.throw();
|
|
335
|
+
el1.settings = el1.settings.clone({ stackedFractionScale: 0.45 });
|
|
336
|
+
el1.update();
|
|
337
|
+
const updatedElement = imodel.elements.getElement(elId);
|
|
338
|
+
expect(updatedElement.settings.toJSON()).to.deep.equal(el1.settings.toJSON());
|
|
339
|
+
});
|
|
340
|
+
it("uses default style if none specified", async () => {
|
|
341
|
+
const el0 = AnnotationTextStyle.fromJSON({
|
|
342
|
+
classFullName: AnnotationTextStyle.classFullName,
|
|
343
|
+
model: seedSubjectId,
|
|
344
|
+
code: AnnotationTextStyle.createCode(imodel, seedSubjectId, "style1"),
|
|
345
|
+
}, imodel);
|
|
346
|
+
expect(el0.settings).not.to.be.undefined;
|
|
347
|
+
expect(el0.settings.toJSON()).to.deep.equal(TextStyleSettings.defaultProps);
|
|
348
|
+
});
|
|
349
|
+
it("can update style via cloning", async () => {
|
|
350
|
+
const el0 = createAnnotationTextStyle(imodel, seedDefinitionModel, "cloning", { fontName: "Totally Real Font" });
|
|
351
|
+
const newStyle = el0.settings.clone({ isBold: true, lineSpacingFactor: 3 });
|
|
352
|
+
expect(el0.settings.toJSON()).to.not.deep.equal(newStyle.toJSON());
|
|
353
|
+
el0.settings = newStyle;
|
|
354
|
+
expect(el0.settings.toJSON()).to.deep.equal(newStyle.toJSON());
|
|
355
|
+
});
|
|
1134
356
|
});
|
|
1135
357
|
//# sourceMappingURL=TextAnnotation.test.js.map
|