@itwin/core-backend 5.1.0-dev.3 → 5.1.0-dev.32
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 +38 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js +1 -1
- 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 +12 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CatalogDb.js.map +1 -1
- package/lib/cjs/Category.d.ts +41 -4
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +77 -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.js +242 -242
- 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.js +5 -5
- 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 +9 -4
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +30 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +216 -60
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +560 -59
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +7 -7
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +7 -7
- 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 +43 -3
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +59 -1
- 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 +28 -43
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +177 -92
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelDbFonts.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +13 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +6 -0
- package/lib/cjs/IModelHost.js.map +1 -1
- 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.js +1 -1
- 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 +19 -0
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +29 -0
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +64 -28
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +115 -27
- 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.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- 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.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.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +2 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +140 -14
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +250 -14
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js +3 -3
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/annotations/FrameGeometry.d.ts +52 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.js +250 -0
- package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
- package/lib/cjs/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +20 -26
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +31 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js +83 -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} +11 -68
- package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
- package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
- 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 +5 -3
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +5 -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 +28 -0
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
- package/lib/cjs/internal/ElementLRUCache.js +120 -0
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
- 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/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.js +2 -2
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +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.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/BackendLoggerCategory.js.map +1 -1
- package/lib/esm/BisCoreSchema.js +1 -1
- 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 +12 -0
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CatalogDb.js.map +1 -1
- package/lib/esm/Category.d.ts +41 -4
- package/lib/esm/Category.d.ts.map +1 -1
- package/lib/esm/Category.js +77 -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.js +242 -242
- 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.js +5 -5
- 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 +9 -4
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +30 -3
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSchemaXmlContext.js.map +1 -1
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.d.ts +216 -60
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +563 -62
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +7 -7
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +7 -7
- 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 +43 -3
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +59 -1
- 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 +28 -43
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +180 -95
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelDbFonts.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +13 -0
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +6 -0
- package/lib/esm/IModelHost.js.map +1 -1
- 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.js +1 -1
- 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 +19 -0
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +30 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +64 -28
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +116 -28
- 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.js.map +1 -1
- package/lib/esm/RpcBackend.js.map +1 -1
- package/lib/esm/SQLiteDb.js.map +1 -1
- 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.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.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +2 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +140 -14
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +251 -15
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStateHydrator.js +3 -3
- package/lib/esm/ViewStateHydrator.js.map +1 -1
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/annotations/FrameGeometry.d.ts +52 -0
- package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/FrameGeometry.js +245 -0
- package/lib/esm/annotations/FrameGeometry.js.map +1 -0
- package/lib/esm/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +22 -28
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +31 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js +80 -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} +11 -68
- package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
- package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
- package/lib/esm/core-backend.d.ts +5 -3
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +5 -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 +28 -0
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
- package/lib/esm/internal/ElementLRUCache.js +116 -0
- package/lib/esm/internal/ElementLRUCache.js.map +1 -0
- 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/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.js +2 -2
- 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.js.map +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/AttachDb.test.js +11 -11
- package/lib/esm/test/AttachDb.test.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
- package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +212 -0
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
- package/lib/esm/test/GeometryTestUtil.js.map +1 -1
- package/lib/esm/test/IModelHost.test.js.map +1 -1
- 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.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +190 -1025
- 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 +969 -0
- package/lib/esm/test/annotations/TextBlock.test.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/ConcurrentQueryLoad.test.js +15 -15
- 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 +7 -30
- 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 +292 -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/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 +68 -16
- 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/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 +23 -9
- 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 +71 -71
- 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 +28 -28
- 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.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.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 +20 -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 +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.js.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +12 -12
- package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
- 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.map +0 -1
- 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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module ElementGeometry
|
|
3
|
+
*/
|
|
4
|
+
import { ElementGeometry, GeometryParams, TextAnnotationFrameShape, TextFrameStyleProps } from "@itwin/core-common";
|
|
5
|
+
import { Loop, Path, Point3d, Range2d, Transform } from "@itwin/core-geometry";
|
|
6
|
+
/**
|
|
7
|
+
* Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.
|
|
8
|
+
* @param builder that will be appended to in place
|
|
9
|
+
* @param category to which the frame belongs, used for the [[GeometryParams]].
|
|
10
|
+
* @param frame
|
|
11
|
+
* @param range to enclose with the frame
|
|
12
|
+
* @param transform that transform the range to world coordinates
|
|
13
|
+
* @returns `true` if any geometry was appended to the builder
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export declare function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform, geomParams: GeometryParams): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Arguments for the [[computeFrame]] method.
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export interface ComputeFrameArgs {
|
|
22
|
+
/** Frame shape to be calculated */
|
|
23
|
+
frame: Exclude<TextAnnotationFrameShape, "none">;
|
|
24
|
+
/** Range to be enclosed */
|
|
25
|
+
range: Range2d;
|
|
26
|
+
/** Transform that translates and rotates the range to world coordinates */
|
|
27
|
+
transform: Transform;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Computes the frame geometry based on the provided frame shape and range.
|
|
31
|
+
* @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export declare function computeFrame(args: ComputeFrameArgs): Loop | Path;
|
|
35
|
+
/**
|
|
36
|
+
* Arguments for the [[computeIntervalPoints]] method.
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export interface ComputeIntervalPointsArgs extends ComputeFrameArgs {
|
|
40
|
+
/** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */
|
|
41
|
+
lineIntervalFactor?: number;
|
|
42
|
+
/** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */
|
|
43
|
+
arcIntervalFactor?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.
|
|
47
|
+
* These can be used for snapping or attaching leaders.
|
|
48
|
+
* @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.
|
|
49
|
+
* @beta
|
|
50
|
+
*/
|
|
51
|
+
export declare function computeIntervalPoints({ frame, range, transform, lineIntervalFactor, arcIntervalFactor }: ComputeIntervalPointsArgs): Point3d[] | undefined;
|
|
52
|
+
//# sourceMappingURL=FrameGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/FrameGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAA4B,eAAe,EAAe,cAAc,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC3J,OAAO,EAA0C,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AAEjI;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,GAAG,OAAO,CAsC5K;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACjD,2BAA2B;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAehE;AAED;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE,4GAA4G;IAC5G,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAwB,EAAE,iBAAwB,EAAE,EAAE,yBAAyB,GAAG,OAAO,EAAE,GAAG,SAAS,CAWvK"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module ElementGeometry
|
|
7
|
+
*/
|
|
8
|
+
import { BackgroundFill, ColorDef, FillDisplay } from "@itwin/core-common";
|
|
9
|
+
import { Angle, AngleSweep, Arc3d, LineString3d, Loop, Path, Point3d, Vector2d } from "@itwin/core-geometry";
|
|
10
|
+
/**
|
|
11
|
+
* Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.
|
|
12
|
+
* @param builder that will be appended to in place
|
|
13
|
+
* @param category to which the frame belongs, used for the [[GeometryParams]].
|
|
14
|
+
* @param frame
|
|
15
|
+
* @param range to enclose with the frame
|
|
16
|
+
* @param transform that transform the range to world coordinates
|
|
17
|
+
* @returns `true` if any geometry was appended to the builder
|
|
18
|
+
* @beta
|
|
19
|
+
*/
|
|
20
|
+
export function appendFrameToBuilder(builder, frame, range, transform, geomParams) {
|
|
21
|
+
if (undefined === frame.shape || frame.shape === "none") {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
const params = geomParams.clone();
|
|
25
|
+
if (frame.fill === undefined) {
|
|
26
|
+
params.fillDisplay = FillDisplay.Never;
|
|
27
|
+
}
|
|
28
|
+
else if (frame.fill === "background") {
|
|
29
|
+
params.backgroundFill = BackgroundFill.Solid;
|
|
30
|
+
params.fillDisplay = FillDisplay.Blanking;
|
|
31
|
+
}
|
|
32
|
+
else if (frame.fill !== "subcategory") {
|
|
33
|
+
params.fillColor = ColorDef.fromJSON(frame.fill);
|
|
34
|
+
params.lineColor = params.fillColor;
|
|
35
|
+
params.fillDisplay = FillDisplay.Blanking;
|
|
36
|
+
}
|
|
37
|
+
if (frame.border !== "subcategory") {
|
|
38
|
+
params.lineColor = ColorDef.fromJSON(frame.border);
|
|
39
|
+
params.weight = frame.borderWeight;
|
|
40
|
+
}
|
|
41
|
+
const frameGeometry = computeFrame({ frame: frame.shape, range, transform });
|
|
42
|
+
if (!builder.appendGeometryParamsChange(params) || !builder.appendGeometryQuery(frameGeometry)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
// The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.
|
|
46
|
+
if (params.fillDisplay === FillDisplay.Blanking) {
|
|
47
|
+
const outlineParams = params.clone();
|
|
48
|
+
outlineParams.fillDisplay = FillDisplay.Never;
|
|
49
|
+
if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Computes the frame geometry based on the provided frame shape and range.
|
|
57
|
+
* @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
export function computeFrame(args) {
|
|
61
|
+
switch (args.frame) {
|
|
62
|
+
case "line": return computeLine(args.range, args.transform);
|
|
63
|
+
case "rectangle": return computeRectangle(args.range, args.transform);
|
|
64
|
+
case "circle": return computeCircle(args.range, args.transform);
|
|
65
|
+
case "equilateralTriangle": return computeTriangle(args.range, args.transform);
|
|
66
|
+
case "diamond": return computeDiamond(args.range, args.transform);
|
|
67
|
+
case "square": return computeSquare(args.range, args.transform);
|
|
68
|
+
case "pentagon": return computePolygon(5, args.range, args.transform, 90);
|
|
69
|
+
case "hexagon": return computePolygon(6, args.range, args.transform);
|
|
70
|
+
case "octagon": return computePolygon(8, args.range, args.transform, 180 / 8); // or pi/8 in radians
|
|
71
|
+
case "capsule": return computeCapsule(args.range, args.transform);
|
|
72
|
+
case "roundedRectangle": return computeRoundedRectangle(args.range, args.transform);
|
|
73
|
+
default: return computeRectangle(args.range, args.transform);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.
|
|
78
|
+
* These can be used for snapping or attaching leaders.
|
|
79
|
+
* @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.
|
|
80
|
+
* @beta
|
|
81
|
+
*/
|
|
82
|
+
export function computeIntervalPoints({ frame, range, transform, lineIntervalFactor = 0.5, arcIntervalFactor = 0.25 }) {
|
|
83
|
+
const points = [];
|
|
84
|
+
const curves = computeFrame({ frame, range, transform }).collectCurvePrimitives(undefined, false, true);
|
|
85
|
+
curves.forEach((curve) => {
|
|
86
|
+
const end = curve instanceof Arc3d ? arcIntervalFactor : lineIntervalFactor;
|
|
87
|
+
for (let interval = 0; interval <= 1; interval += end) {
|
|
88
|
+
points.push(curve.fractionToPoint(interval));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return points;
|
|
92
|
+
}
|
|
93
|
+
/** Line - currently just adds an underline. Once we have leaders, this method may change. */
|
|
94
|
+
const computeLine = (range, transform) => {
|
|
95
|
+
const points = [Point3d.create(range.low.x, range.low.y), Point3d.create(range.high.x, range.low.y)];
|
|
96
|
+
const frame = LineString3d.createPoints(points);
|
|
97
|
+
return Path.create(frame.cloneTransformed(transform));
|
|
98
|
+
};
|
|
99
|
+
/** Rectangle - simplest frame */
|
|
100
|
+
const computeRectangle = (range, transform) => {
|
|
101
|
+
const points = range.corners3d(true);
|
|
102
|
+
const frame = LineString3d.createPoints(points);
|
|
103
|
+
return Loop.create(frame.cloneTransformed(transform));
|
|
104
|
+
};
|
|
105
|
+
/** Rounded Rectangle: each corner will be turned into an arc with the radius of the arc being the @param radiusFactor * the height (yLength) of the range */
|
|
106
|
+
const computeRoundedRectangle = (range, transform, radiusFactor = 0.25) => {
|
|
107
|
+
const radius = range.yLength() * radiusFactor * Math.sqrt(2);
|
|
108
|
+
// We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.
|
|
109
|
+
const radiusOffsetFactor = range.yLength() * radiusFactor;
|
|
110
|
+
// These values are the origins of the circles
|
|
111
|
+
const inLeft = range.low.x + radiusOffsetFactor;
|
|
112
|
+
const inRight = range.high.x - radiusOffsetFactor;
|
|
113
|
+
const inBottom = range.low.y + radiusOffsetFactor;
|
|
114
|
+
const inTop = range.high.y - radiusOffsetFactor;
|
|
115
|
+
// These values exist on the circles
|
|
116
|
+
const exLeft = inLeft - radius;
|
|
117
|
+
const exRight = inRight + radius;
|
|
118
|
+
const exBottom = inBottom - radius;
|
|
119
|
+
const exTop = inTop + radius;
|
|
120
|
+
const q1 = AngleSweep.createStartEndDegrees(0, 90);
|
|
121
|
+
const q2 = AngleSweep.createStartEndDegrees(90, 180);
|
|
122
|
+
const q3 = AngleSweep.createStartEndDegrees(180, 270);
|
|
123
|
+
const q4 = AngleSweep.createStartEndDegrees(270, 360);
|
|
124
|
+
const curves = [
|
|
125
|
+
LineString3d.create([Point3d.create(inLeft, exTop), Point3d.create(inRight, exTop)]), // top
|
|
126
|
+
Arc3d.createXY(Point3d.create(inLeft, inTop), radius, q2), // top left
|
|
127
|
+
LineString3d.create([Point3d.create(exLeft, inBottom), Point3d.create(exLeft, inTop)]), // left
|
|
128
|
+
Arc3d.createXY(Point3d.create(inLeft, inBottom), radius, q3), // bottom left
|
|
129
|
+
LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom
|
|
130
|
+
Arc3d.createXY(Point3d.create(inRight, inBottom), radius, q4), // bottom right
|
|
131
|
+
LineString3d.create([Point3d.create(exRight, inBottom), Point3d.create(exRight, inTop)]), // right
|
|
132
|
+
Arc3d.createXY(Point3d.create(inRight, inTop), radius, q1), // top right
|
|
133
|
+
];
|
|
134
|
+
return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));
|
|
135
|
+
};
|
|
136
|
+
/** Circle */
|
|
137
|
+
const computeCircle = (range, transform) => {
|
|
138
|
+
const radius = range.low.distance(range.high) / 2;
|
|
139
|
+
const frame = Arc3d.createXY(Point3d.createFrom(range.center), radius);
|
|
140
|
+
return Loop.create(frame.cloneTransformed(transform));
|
|
141
|
+
};
|
|
142
|
+
/** Equilateral Triangle */
|
|
143
|
+
const computeTriangle = (range, transform) => {
|
|
144
|
+
const xLength = range.xLength();
|
|
145
|
+
const yLength = range.yLength();
|
|
146
|
+
const center = range.center;
|
|
147
|
+
const points = [];
|
|
148
|
+
const magnitude = (xLength > yLength) ? (xLength * Math.sqrt(3) + yLength) / 2 : (yLength * Math.sqrt(3) + xLength) / 2;
|
|
149
|
+
const v1 = Vector2d.create(0, magnitude);
|
|
150
|
+
const vectors = [
|
|
151
|
+
v1, // top
|
|
152
|
+
v1.rotateXY(Angle.createDegrees(120)), // left
|
|
153
|
+
v1.rotateXY(Angle.createDegrees(240)), // right
|
|
154
|
+
v1 // top
|
|
155
|
+
];
|
|
156
|
+
vectors.forEach((v) => {
|
|
157
|
+
points.push(Point3d.create(center.x + v.x, center.y + v.y));
|
|
158
|
+
});
|
|
159
|
+
const frame = LineString3d.createPoints(points);
|
|
160
|
+
return Loop.create(frame.cloneTransformed(transform));
|
|
161
|
+
};
|
|
162
|
+
/** Diamond (square rotated 45 degrees) */
|
|
163
|
+
const computeDiamond = (range, transform) => {
|
|
164
|
+
const offset = (range.xLength() + range.yLength()) / 2;
|
|
165
|
+
const center = range.center;
|
|
166
|
+
const points = [
|
|
167
|
+
Point3d.createFrom({ x: center.x, y: center.y + offset }), // top
|
|
168
|
+
Point3d.createFrom({ x: center.x + offset, y: center.y }), // right
|
|
169
|
+
Point3d.createFrom({ x: center.x, y: center.y - offset }), // bottom
|
|
170
|
+
Point3d.createFrom({ x: center.x - offset, y: center.y }), // left
|
|
171
|
+
Point3d.createFrom({ x: center.x, y: center.y + offset }), // top
|
|
172
|
+
];
|
|
173
|
+
const frame = LineString3d.createPoints(points);
|
|
174
|
+
return Loop.create(frame.cloneTransformed(transform));
|
|
175
|
+
};
|
|
176
|
+
/** Square */
|
|
177
|
+
const computeSquare = (range, transform) => {
|
|
178
|
+
// Extend range
|
|
179
|
+
const xLength = range.xLength() / 2;
|
|
180
|
+
const yLength = range.yLength() / 2;
|
|
181
|
+
const center = range.center;
|
|
182
|
+
if (xLength > yLength) {
|
|
183
|
+
range.extendPoint({ x: center.x, y: center.y + xLength });
|
|
184
|
+
range.extendPoint({ x: center.x, y: center.y - xLength });
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
range.extendPoint({ x: center.x + yLength, y: center.y });
|
|
188
|
+
range.extendPoint({ x: center.x - yLength, y: center.y });
|
|
189
|
+
}
|
|
190
|
+
const points = range.corners3d(true);
|
|
191
|
+
const frame = LineString3d.createPoints(points);
|
|
192
|
+
return Loop.create(frame.cloneTransformed(transform));
|
|
193
|
+
};
|
|
194
|
+
/** Capsule (or pill shape) */
|
|
195
|
+
const computeCapsule = (range, transform) => {
|
|
196
|
+
const height = range.yLength();
|
|
197
|
+
const radius = height * (Math.sqrt(2) / 2);
|
|
198
|
+
// We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.
|
|
199
|
+
const radiusOffsetFactor = height / 2;
|
|
200
|
+
// These values are the origins of the circles
|
|
201
|
+
const inLeft = range.low.x + radiusOffsetFactor;
|
|
202
|
+
const inRight = range.high.x - radiusOffsetFactor;
|
|
203
|
+
const inBottom = range.low.y + radiusOffsetFactor;
|
|
204
|
+
const inTop = range.high.y - radiusOffsetFactor;
|
|
205
|
+
// These values exist on the circles
|
|
206
|
+
const exBottom = inBottom - radius;
|
|
207
|
+
const exTop = inTop + radius;
|
|
208
|
+
const leftHalfCircle = AngleSweep.createStartEndDegrees(90, 270);
|
|
209
|
+
const rightHalfCircle = AngleSweep.createStartEndDegrees(-90, 90);
|
|
210
|
+
const curves = [
|
|
211
|
+
LineString3d.create([Point3d.create(inLeft, exTop), Point3d.create(inRight, exTop)]), // top
|
|
212
|
+
Arc3d.createXY(Point3d.create(inLeft, range.center.y), radius, leftHalfCircle), // left
|
|
213
|
+
LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom
|
|
214
|
+
Arc3d.createXY(Point3d.create(inRight, range.center.y), radius, rightHalfCircle), // right
|
|
215
|
+
];
|
|
216
|
+
return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));
|
|
217
|
+
};
|
|
218
|
+
/** Regular polygon with n sides: note, this a generic method that can be used to create any polygon, but the frame will not be as tightly encapsulating. */
|
|
219
|
+
const computePolygon = (n, range, transform, angleOffset = 0) => {
|
|
220
|
+
// These are math terms: cspell:ignore inradius circumradius
|
|
221
|
+
if (n < 3)
|
|
222
|
+
throw new Error("A polygon must have at least 3 sides.");
|
|
223
|
+
// We're assuming the polygon is a regular polygon with `n` sides.
|
|
224
|
+
// The center of the polygon is the center of the range.
|
|
225
|
+
const center = range.center;
|
|
226
|
+
// The inradius is the distance from the center to the midpoint of each side of the polygon. On our range, this coincides with the distance from the center to one of its corners.
|
|
227
|
+
const inradius = range.low.distance(range.high) / 2;
|
|
228
|
+
// The circumradius is the distance from the center to each vertex of the polygon.
|
|
229
|
+
const circumradius = inradius / Math.cos(Math.PI / n);
|
|
230
|
+
// The exterior angles add up to 360 degrees.
|
|
231
|
+
const angleIncrement = 360 / n;
|
|
232
|
+
const vertices = [];
|
|
233
|
+
// Add a point for each vertex
|
|
234
|
+
for (let i = 0; i < n; i++) {
|
|
235
|
+
const angle = Angle.createDegrees(i * angleIncrement + angleOffset);
|
|
236
|
+
const vector = Vector2d.createPolar(circumradius, angle);
|
|
237
|
+
vertices.push(Point3d.create(center.x + vector.x, center.y + vector.y));
|
|
238
|
+
}
|
|
239
|
+
// Close the polygon
|
|
240
|
+
vertices.push(vertices[0]);
|
|
241
|
+
// Finally compute the loop!
|
|
242
|
+
const frame = LineString3d.createPoints(vertices);
|
|
243
|
+
return Loop.create(frame.cloneTransformed(transform));
|
|
244
|
+
};
|
|
245
|
+
//# sourceMappingURL=FrameGeometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameGeometry.js","sourceRoot":"","sources":["../../../src/annotations/FrameGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAmB,WAAW,EAAiE,MAAM,oBAAoB,CAAC;AAC3J,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAsB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjI;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgC,EAAE,KAA0B,EAAE,KAAc,EAAE,SAAoB,EAAE,UAA0B;IACjK,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAElC,IAAI,KAAK,CAAC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,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,oBAAoB;IACpB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3B,4BAA4B;IAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\n\r\nimport { BackgroundFill, ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotationFrameShape, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { Angle, AngleSweep, Arc3d, LineString3d, Loop, Path, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\r\n\r\n/**\r\n * Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.\r\n * @param builder that will be appended to in place\r\n * @param category to which the frame belongs, used for the [[GeometryParams]].\r\n * @param frame\r\n * @param range to enclose with the frame\r\n * @param transform that transform the range to world coordinates\r\n * @returns `true` if any geometry was appended to the builder\r\n* @beta\r\n */\r\nexport function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform, geomParams: GeometryParams): boolean {\r\n if (undefined === frame.shape || frame.shape === \"none\") {\r\n return false;\r\n }\r\n\r\n const params = geomParams.clone();\r\n\r\n if (frame.fill === undefined) {\r\n params.fillDisplay = FillDisplay.Never;\r\n } else if (frame.fill === \"background\") {\r\n params.backgroundFill = BackgroundFill.Solid;\r\n params.fillDisplay = FillDisplay.Blanking;\r\n } else if (frame.fill !== \"subcategory\") {\r\n params.fillColor = ColorDef.fromJSON(frame.fill);\r\n params.lineColor = params.fillColor;\r\n params.fillDisplay = FillDisplay.Blanking;\r\n }\r\n\r\n if (frame.border !== \"subcategory\") {\r\n params.lineColor = ColorDef.fromJSON(frame.border);\r\n params.weight = frame.borderWeight;\r\n }\r\n\r\n const frameGeometry = computeFrame({ frame: frame.shape, range, transform });\r\n if (!builder.appendGeometryParamsChange(params) || !builder.appendGeometryQuery(frameGeometry)) {\r\n return false;\r\n }\r\n\r\n // The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.\r\n if (params.fillDisplay === FillDisplay.Blanking) {\r\n const outlineParams = params.clone();\r\n outlineParams.fillDisplay = FillDisplay.Never;\r\n if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Arguments for the [[computeFrame]] method.\r\n * @beta\r\n */\r\nexport interface ComputeFrameArgs {\r\n /** Frame shape to be calculated */\r\n frame: Exclude<TextAnnotationFrameShape, \"none\">;\r\n /** Range to be enclosed */\r\n range: Range2d;\r\n /** Transform that translates and rotates the range to world coordinates */\r\n transform: Transform;\r\n}\r\n\r\n/**\r\n * Computes the frame geometry based on the provided frame shape and range.\r\n * @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry\r\n * @beta\r\n */\r\nexport function computeFrame(args: ComputeFrameArgs): Loop | Path {\r\n switch (args.frame) {\r\n case \"line\": return computeLine(args.range, args.transform);\r\n case \"rectangle\": return computeRectangle(args.range, args.transform);\r\n case \"circle\": return computeCircle(args.range, args.transform);\r\n case \"equilateralTriangle\": return computeTriangle(args.range, args.transform);\r\n case \"diamond\": return computeDiamond(args.range, args.transform);\r\n case \"square\": return computeSquare(args.range, args.transform);\r\n case \"pentagon\": return computePolygon(5, args.range, args.transform, 90);\r\n case \"hexagon\": return computePolygon(6, args.range, args.transform);\r\n case \"octagon\": return computePolygon(8, args.range, args.transform, 180 / 8); // or pi/8 in radians\r\n case \"capsule\": return computeCapsule(args.range, args.transform);\r\n case \"roundedRectangle\": return computeRoundedRectangle(args.range, args.transform);\r\n default: return computeRectangle(args.range, args.transform);\r\n }\r\n}\r\n\r\n/**\r\n * Arguments for the [[computeIntervalPoints]] method.\r\n * @beta\r\n */\r\nexport interface ComputeIntervalPointsArgs extends ComputeFrameArgs {\r\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\r\n lineIntervalFactor?: number;\r\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\r\n arcIntervalFactor?: number;\r\n}\r\n\r\n/**\r\n * Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.\r\n * These can be used for snapping or attaching leaders.\r\n * @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.\r\n * @beta\r\n */\r\nexport function computeIntervalPoints({ frame, range, transform, lineIntervalFactor = 0.5, arcIntervalFactor = 0.25 }: ComputeIntervalPointsArgs): Point3d[] | undefined {\r\n const points: Point3d[] = [];\r\n const curves = computeFrame({ frame, range, transform }).collectCurvePrimitives(undefined, false, true);\r\n\r\n curves.forEach((curve) => {\r\n const end = curve instanceof Arc3d ? arcIntervalFactor : lineIntervalFactor;\r\n for (let interval = 0; interval <= 1; interval += end) {\r\n points.push(curve.fractionToPoint(interval));\r\n }\r\n });\r\n return points;\r\n}\r\n\r\n/** Line - currently just adds an underline. Once we have leaders, this method may change. */\r\nconst computeLine = (range: Range2d, transform: Transform): Path => {\r\n const points = [Point3d.create(range.low.x, range.low.y), Point3d.create(range.high.x, range.low.y)];\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Path.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Rectangle - simplest frame */\r\nconst computeRectangle = (range: Range2d, transform: Transform): Loop => {\r\n const points = range.corners3d(true);\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Rounded Rectangle: each corner will be turned into an arc with the radius of the arc being the @param radiusFactor * the height (yLength) of the range */\r\nconst computeRoundedRectangle = (range: Range2d, transform: Transform, radiusFactor: number = 0.25): Loop => {\r\n const radius = range.yLength() * radiusFactor * Math.sqrt(2);\r\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\r\n const radiusOffsetFactor = range.yLength() * radiusFactor;\r\n\r\n // These values are the origins of the circles\r\n const inLeft = range.low.x + radiusOffsetFactor;\r\n const inRight = range.high.x - radiusOffsetFactor;\r\n const inBottom = range.low.y + radiusOffsetFactor;\r\n const inTop = range.high.y - radiusOffsetFactor\r\n\r\n // These values exist on the circles\r\n const exLeft = inLeft - radius;\r\n const exRight = inRight + radius;\r\n const exBottom = inBottom - radius;\r\n const exTop = inTop + radius;\r\n\r\n const q1 = AngleSweep.createStartEndDegrees(0, 90);\r\n const q2 = AngleSweep.createStartEndDegrees(90, 180);\r\n const q3 = AngleSweep.createStartEndDegrees(180, 270);\r\n const q4 = AngleSweep.createStartEndDegrees(270, 360);\r\n\r\n\r\n const curves = [\r\n LineString3d.create([Point3d.create(inLeft, exTop), Point3d.create(inRight, exTop)]), // top\r\n Arc3d.createXY(Point3d.create(inLeft, inTop), radius, q2), // top left\r\n LineString3d.create([Point3d.create(exLeft, inBottom), Point3d.create(exLeft, inTop)]), // left\r\n Arc3d.createXY(Point3d.create(inLeft, inBottom), radius, q3), // bottom left\r\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\r\n Arc3d.createXY(Point3d.create(inRight, inBottom), radius, q4), // bottom right\r\n LineString3d.create([Point3d.create(exRight, inBottom), Point3d.create(exRight, inTop)]), // right\r\n Arc3d.createXY(Point3d.create(inRight, inTop), radius, q1), // top right\r\n ];\r\n\r\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)))\r\n}\r\n\r\n\r\n/** Circle */\r\nconst computeCircle = (range: Range2d, transform: Transform): Loop => {\r\n const radius = range.low.distance(range.high) / 2;\r\n const frame = Arc3d.createXY(Point3d.createFrom(range.center), radius);\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Equilateral Triangle */\r\nconst computeTriangle = (range: Range2d, transform: Transform): Loop => {\r\n\r\n const xLength = range.xLength();\r\n const yLength = range.yLength();\r\n const center = range.center;\r\n const points: Point3d[] = [];\r\n\r\n const magnitude = (xLength > yLength) ? (xLength * Math.sqrt(3) + yLength) / 2 : (yLength * Math.sqrt(3) + xLength) / 2;\r\n\r\n const v1 = Vector2d.create(0, magnitude);\r\n const vectors = [\r\n v1, // top\r\n v1.rotateXY(Angle.createDegrees(120)), // left\r\n v1.rotateXY(Angle.createDegrees(240)), // right\r\n v1 // top\r\n ];\r\n\r\n vectors.forEach((v) => {\r\n points.push(Point3d.create(center.x + v.x, center.y + v.y));\r\n });\r\n\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Diamond (square rotated 45 degrees) */\r\nconst computeDiamond = (range: Range2d, transform: Transform): Loop => {\r\n const offset = (range.xLength() + range.yLength()) / 2;\r\n const center = range.center;\r\n\r\n const points = [\r\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\r\n Point3d.createFrom({ x: center.x + offset, y: center.y }), // right\r\n Point3d.createFrom({ x: center.x, y: center.y - offset }), // bottom\r\n Point3d.createFrom({ x: center.x - offset, y: center.y }), // left\r\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\r\n ];\r\n\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Square */\r\nconst computeSquare = (range: Range2d, transform: Transform): Loop => {\r\n\r\n // Extend range\r\n const xLength = range.xLength() / 2;\r\n const yLength = range.yLength() / 2;\r\n const center = range.center;\r\n if (xLength > yLength) {\r\n range.extendPoint({ x: center.x, y: center.y + xLength });\r\n range.extendPoint({ x: center.x, y: center.y - xLength });\r\n } else {\r\n range.extendPoint({ x: center.x + yLength, y: center.y });\r\n range.extendPoint({ x: center.x - yLength, y: center.y });\r\n }\r\n\r\n const points = range.corners3d(true);\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Capsule (or pill shape) */\r\nconst computeCapsule = (range: Range2d, transform: Transform): Loop => {\r\n const height = range.yLength();\r\n const radius = height * (Math.sqrt(2) / 2);\r\n\r\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\r\n const radiusOffsetFactor = height / 2;\r\n\r\n // These values are the origins of the circles\r\n const inLeft = range.low.x + radiusOffsetFactor;\r\n const inRight = range.high.x - radiusOffsetFactor;\r\n const inBottom = range.low.y + radiusOffsetFactor;\r\n const inTop = range.high.y - radiusOffsetFactor\r\n\r\n // These values exist on the circles\r\n const exBottom = inBottom - radius;\r\n const exTop = inTop + radius;\r\n\r\n const leftHalfCircle = AngleSweep.createStartEndDegrees(90, 270);\r\n const rightHalfCircle = AngleSweep.createStartEndDegrees(-90, 90);\r\n\r\n const curves = [\r\n LineString3d.create([Point3d.create(inLeft, exTop), Point3d.create(inRight, exTop)]), // top\r\n Arc3d.createXY(Point3d.create(inLeft, range.center.y), radius, leftHalfCircle), // left\r\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\r\n Arc3d.createXY(Point3d.create(inRight, range.center.y), radius, rightHalfCircle), // right\r\n ];\r\n\r\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));\r\n}\r\n\r\n/** Regular polygon with n sides: note, this a generic method that can be used to create any polygon, but the frame will not be as tightly encapsulating. */\r\nconst computePolygon = (n: number, range: Range2d, transform: Transform, angleOffset: number = 0): Loop => {\r\n // These are math terms: cspell:ignore inradius circumradius\r\n if (n < 3) throw new Error(\"A polygon must have at least 3 sides.\");\r\n\r\n // We're assuming the polygon is a regular polygon with `n` sides.\r\n // The center of the polygon is the center of the range.\r\n const center = range.center;\r\n // The inradius is the distance from the center to the midpoint of each side of the polygon. On our range, this coincides with the distance from the center to one of its corners.\r\n const inradius = range.low.distance(range.high) / 2;\r\n // The circumradius is the distance from the center to each vertex of the polygon.\r\n const circumradius = inradius / Math.cos(Math.PI / n);\r\n\r\n // The exterior angles add up to 360 degrees.\r\n const angleIncrement = 360 / n;\r\n const vertices: Point3d[] = [];\r\n\r\n // Add a point for each vertex\r\n for (let i = 0; i < n; i++) {\r\n const angle = Angle.createDegrees(i * angleIncrement + angleOffset);\r\n const vector = Vector2d.createPolar(circumradius, angle);\r\n vertices.push(Point3d.create(center.x + vector.x, center.y + vector.y));\r\n }\r\n\r\n // Close the polygon\r\n vertices.push(vertices[0]);\r\n\r\n // Finally compute the loop!\r\n const frame = LineString3d.createPoints(vertices);\r\n return Loop.create(frame.cloneTransformed(transform));\r\n};"]}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* @module Elements
|
|
3
3
|
*/
|
|
4
4
|
import { TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps } from "@itwin/core-common";
|
|
5
|
-
import { IModelDb } from "
|
|
6
|
-
import { AnnotationElement2d, GraphicalElement3d } from "
|
|
7
|
-
import { Id64String } from "@itwin/core-bentley";
|
|
5
|
+
import { IModelDb } from "../IModelDb";
|
|
6
|
+
import { AnnotationElement2d, GraphicalElement3d } from "../Element";
|
|
8
7
|
/** An element that displays textual content within a 2d model.
|
|
9
8
|
* The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
|
|
10
9
|
* @see [[setAnnotation]] to change the textual content.
|
|
11
|
-
* @public
|
|
10
|
+
* @public @preview
|
|
12
11
|
*/
|
|
13
12
|
export declare class TextAnnotation2d extends AnnotationElement2d {
|
|
14
13
|
/** @internal */
|
|
@@ -23,15 +22,13 @@ export declare class TextAnnotation2d extends AnnotationElement2d {
|
|
|
23
22
|
/** Change the textual content, updating the element's geometry and placement accordingly.
|
|
24
23
|
* @see [[getAnnotation]] to extract the current annotation.
|
|
25
24
|
* @param annotation The new annotation
|
|
26
|
-
* @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
|
|
27
|
-
* @returns true if the annotation was successfully updated.
|
|
28
25
|
*/
|
|
29
|
-
setAnnotation(annotation: TextAnnotation
|
|
26
|
+
setAnnotation(annotation: TextAnnotation): void;
|
|
30
27
|
}
|
|
31
28
|
/** An element that displays textual content within a 3d model.
|
|
32
29
|
* The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
|
|
33
30
|
* @see [[setAnnotation]] to change the textual content.
|
|
34
|
-
* @public
|
|
31
|
+
* @public @preview
|
|
35
32
|
*/
|
|
36
33
|
export declare class TextAnnotation3d extends GraphicalElement3d {
|
|
37
34
|
/** @internal */
|
|
@@ -46,9 +43,7 @@ export declare class TextAnnotation3d extends GraphicalElement3d {
|
|
|
46
43
|
/** Change the textual content, updating the element's geometry and placement accordingly.
|
|
47
44
|
* @see [[getAnnotation]] to extract the current annotation.
|
|
48
45
|
* @param annotation The new annotation
|
|
49
|
-
* @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
|
|
50
|
-
* @returns true if the annotation was successfully updated.
|
|
51
46
|
*/
|
|
52
|
-
setAnnotation(annotation: TextAnnotation
|
|
47
|
+
setAnnotation(annotation: TextAnnotation): void;
|
|
53
48
|
}
|
|
54
49
|
//# sourceMappingURL=TextAnnotationElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAnnotationElement.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAiE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAuB,MAAM,oBAAoB,CAAC;AACtL,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAcrE;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,mBAAmB;IACvD,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAA+B;IAC7E,SAAS,aAAa,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ;WAEtD,QAAQ,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ,GAAG,gBAAgB;IAIxE,MAAM,IAAI,qBAAqB;IAO/C;;OAEG;IACI,aAAa,IAAI,cAAc,GAAG,SAAS;IAKlD;;;OAGG;IACI,aAAa,CAAC,UAAU,EAAE,cAAc;CAGhD;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAA+B;IAC7E,SAAS,aAAa,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ;WAEtD,QAAQ,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ,GAAG,gBAAgB;IAIxE,MAAM,IAAI,qBAAqB;IAO/C;;OAEG;IACI,aAAa,IAAI,cAAc,GAAG,SAAS;IAKlD;;;OAGG;IACI,aAAa,CAAC,UAAU,EAAE,cAAc;CAGhD"}
|
|
@@ -5,27 +5,21 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Elements
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import { AnnotationElement2d, GraphicalElement3d } from "
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!builder.appendTextBlock(props)) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
element.geom = builder.geometryStream;
|
|
22
|
-
element.jsonProperties.annotation = annotation.toJSON();
|
|
23
|
-
return true;
|
|
8
|
+
import { ElementGeometry, TextAnnotation } from "@itwin/core-common";
|
|
9
|
+
import { AnnotationElement2d, GraphicalElement3d } from "../Element";
|
|
10
|
+
import { layoutTextBlock } from "./TextBlockLayout";
|
|
11
|
+
import { appendTextAnnotationGeometry } from "./TextAnnotationGeometry";
|
|
12
|
+
function getElementGeometryBuilderParams(iModel, _placementProps, annotationProps, categoryId, _subCategory) {
|
|
13
|
+
const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;
|
|
14
|
+
const layout = layoutTextBlock({ iModel, textBlock });
|
|
15
|
+
const builder = new ElementGeometry.Builder();
|
|
16
|
+
appendTextAnnotationGeometry({ layout, annotationProps, builder, categoryId });
|
|
17
|
+
return { entryArray: builder.entries };
|
|
24
18
|
}
|
|
25
19
|
/** An element that displays textual content within a 2d model.
|
|
26
20
|
* The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
|
|
27
21
|
* @see [[setAnnotation]] to change the textual content.
|
|
28
|
-
* @public
|
|
22
|
+
* @public @preview
|
|
29
23
|
*/
|
|
30
24
|
export class TextAnnotation2d extends AnnotationElement2d {
|
|
31
25
|
/** @internal */
|
|
@@ -35,7 +29,9 @@ export class TextAnnotation2d extends AnnotationElement2d {
|
|
|
35
29
|
return new TextAnnotation2d(props, iModel);
|
|
36
30
|
}
|
|
37
31
|
toJSON() {
|
|
38
|
-
|
|
32
|
+
const props = super.toJSON();
|
|
33
|
+
props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);
|
|
34
|
+
return props;
|
|
39
35
|
}
|
|
40
36
|
/** Extract the textual content, if present.
|
|
41
37
|
* @see [[setAnnotation]] to change it.
|
|
@@ -47,17 +43,15 @@ export class TextAnnotation2d extends AnnotationElement2d {
|
|
|
47
43
|
/** Change the textual content, updating the element's geometry and placement accordingly.
|
|
48
44
|
* @see [[getAnnotation]] to extract the current annotation.
|
|
49
45
|
* @param annotation The new annotation
|
|
50
|
-
* @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
|
|
51
|
-
* @returns true if the annotation was successfully updated.
|
|
52
46
|
*/
|
|
53
|
-
setAnnotation(annotation
|
|
54
|
-
|
|
47
|
+
setAnnotation(annotation) {
|
|
48
|
+
this.jsonProperties.annotation = annotation.toJSON();
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
/** An element that displays textual content within a 3d model.
|
|
58
52
|
* The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
|
|
59
53
|
* @see [[setAnnotation]] to change the textual content.
|
|
60
|
-
* @public
|
|
54
|
+
* @public @preview
|
|
61
55
|
*/
|
|
62
56
|
export class TextAnnotation3d extends GraphicalElement3d {
|
|
63
57
|
/** @internal */
|
|
@@ -67,7 +61,9 @@ export class TextAnnotation3d extends GraphicalElement3d {
|
|
|
67
61
|
return new TextAnnotation3d(props, iModel);
|
|
68
62
|
}
|
|
69
63
|
toJSON() {
|
|
70
|
-
|
|
64
|
+
const props = super.toJSON();
|
|
65
|
+
props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);
|
|
66
|
+
return props;
|
|
71
67
|
}
|
|
72
68
|
/** Extract the textual content, if present.
|
|
73
69
|
* @see [[setAnnotation]] to change it.
|
|
@@ -79,11 +75,9 @@ export class TextAnnotation3d extends GraphicalElement3d {
|
|
|
79
75
|
/** Change the textual content, updating the element's geometry and placement accordingly.
|
|
80
76
|
* @see [[getAnnotation]] to extract the current annotation.
|
|
81
77
|
* @param annotation The new annotation
|
|
82
|
-
* @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
|
|
83
|
-
* @returns true if the annotation was successfully updated.
|
|
84
78
|
*/
|
|
85
|
-
setAnnotation(annotation
|
|
86
|
-
|
|
79
|
+
setAnnotation(annotation) {
|
|
80
|
+
this.jsonProperties.annotation = annotation.toJSON();
|
|
87
81
|
}
|
|
88
82
|
}
|
|
89
83
|
//# sourceMappingURL=TextAnnotationElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAgD,cAAc,EAAqE,MAAM,oBAAoB,CAAC;AAEtL,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,SAAS,+BAA+B,CAAC,MAAgB,EAAE,eAA+B,EAAE,eAAoC,EAAE,UAAsB,EAAE,YAAyB;IACjL,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC;IACrE,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;IAC9C,4BAA4B,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;IAE9E,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,mBAAmB;IACvD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E,YAAsB,KAA4B,EAAE,MAAgB,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC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E,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjJ,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;QAC5C,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,UAA0B;QAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { ElementGeometry, ElementGeometryBuilderParams, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { AnnotationElement2d, GraphicalElement3d } from \"../Element\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { layoutTextBlock } from \"./TextBlockLayout\";\r\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\r\n\r\nfunction getElementGeometryBuilderParams(iModel: IModelDb, _placementProps: PlacementProps, annotationProps: TextAnnotationProps, categoryId: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\r\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\r\n const layout = layoutTextBlock({ iModel, textBlock });\r\n const builder = new ElementGeometry.Builder();\r\n appendTextAnnotationGeometry({ layout, annotationProps, builder, categoryId })\r\n\r\n return { entryArray: builder.entries };\r\n}\r\n\r\n/** An element that displays textual content within a 2d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation2d extends AnnotationElement2d {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation2d\"; }\r\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\r\n return new TextAnnotation2d(props, iModel);\r\n }\r\n\r\n public override toJSON(): TextAnnotation2dProps {\r\n const props = super.toJSON();\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\r\n\r\n return props;\r\n }\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n const json = this.jsonProperties.annotation;\r\n return json ? TextAnnotation.fromJSON(json) : undefined;\r\n }\r\n\r\n /** Change the textual content, updating the element's geometry and placement accordingly.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this.jsonProperties.annotation = annotation.toJSON();\r\n }\r\n}\r\n\r\n/** An element that displays textual content within a 3d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation3d extends GraphicalElement3d {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation3d\"; }\r\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\r\n return new TextAnnotation3d(props, iModel);\r\n }\r\n\r\n public override toJSON(): TextAnnotation3dProps {\r\n const props = super.toJSON();\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\r\n\r\n return props;\r\n }\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n const json = this.jsonProperties.annotation;\r\n return json ? TextAnnotation.fromJSON(json) : undefined;\r\n }\r\n\r\n /** Change the textual content, updating the element's geometry and placement accordingly.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this.jsonProperties.annotation = annotation.toJSON();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module ElementGeometry
|
|
3
|
+
*/
|
|
4
|
+
import { ElementGeometry, TextAnnotationProps } from "@itwin/core-common";
|
|
5
|
+
import { TextBlockLayout } from "./TextBlockLayout";
|
|
6
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
7
|
+
/**
|
|
8
|
+
* Properties required to compute the geometry of a text annotation.
|
|
9
|
+
* @beta
|
|
10
|
+
* @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].
|
|
11
|
+
*/
|
|
12
|
+
export interface AppendTextAnnotationGeometryArgs {
|
|
13
|
+
/** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */
|
|
14
|
+
annotationProps: TextAnnotationProps;
|
|
15
|
+
/** Layout provided by calling [[layoutTextBlock]] */
|
|
16
|
+
layout: TextBlockLayout;
|
|
17
|
+
/** Builder that will be added to in place */
|
|
18
|
+
builder: ElementGeometry.Builder;
|
|
19
|
+
/** The category the element will belong to. This will passed into the [[GeometryParams]] */
|
|
20
|
+
categoryId: Id64String;
|
|
21
|
+
/** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */
|
|
22
|
+
subCategoryId?: Id64String;
|
|
23
|
+
/** Whether or not to draw geometry for things like the snap points, range, and anchor point */
|
|
24
|
+
wantDebugGeometry?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.
|
|
27
|
+
* @returns true if the geometry was successfully appended.
|
|
28
|
+
* @beta
|
|
29
|
+
*/
|
|
30
|
+
export declare function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean;
|
|
31
|
+
//# sourceMappingURL=TextAnnotationGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAuB,MAAM,oBAAoB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC;IACjC,4FAA4F;IAC5F,UAAU,EAAE,UAAU,CAAA;IACtB,yGAAyG;IACzG,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAuB7F"}
|