@itwin/core-backend 5.9.0-dev.3 → 5.9.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BriefcaseManager.js +3 -3
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +37 -7
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +33 -42
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +5 -2
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.d.ts +29 -0
- package/lib/cjs/ChannelControl.d.ts.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +32 -3
- package/lib/cjs/CodeSpecs.d.ts.map +1 -1
- package/lib/cjs/CodeSpecs.js +48 -20
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +18 -3
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +10 -21
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/EditTxn.d.ts +262 -0
- package/lib/cjs/EditTxn.d.ts.map +1 -0
- package/lib/cjs/EditTxn.js +548 -0
- package/lib/cjs/EditTxn.js.map +1 -0
- package/lib/cjs/Element.d.ts +74 -5
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +63 -75
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +10 -0
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +21 -12
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +56 -3
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +53 -40
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +11 -2
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js +10 -8
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +66 -22
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +174 -288
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +22 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +9 -0
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IpcHost.js +2 -2
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +47 -7
- package/lib/cjs/LineStyle.d.ts.map +1 -1
- package/lib/cjs/LineStyle.js +38 -33
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/Material.d.ts +8 -1
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +6 -12
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +59 -20
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +38 -80
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +72 -7
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +39 -21
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SchemaSync.js +4 -4
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SheetIndex.d.ts +9 -0
- package/lib/cjs/SheetIndex.d.ts.map +1 -1
- package/lib/cjs/SheetIndex.js +38 -35
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/StashManager.js +1 -1
- package/lib/cjs/StashManager.js.map +1 -1
- package/lib/cjs/Texture.d.ts +6 -0
- package/lib/cjs/Texture.d.ts.map +1 -1
- package/lib/cjs/Texture.js +6 -14
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +5 -5
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +23 -7
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +21 -1
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +27 -66
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +14 -6
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +33 -27
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +6 -5
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +1 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +6 -2
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +8 -13
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +11 -4
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js +13 -24
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts +15 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +5 -3
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +4 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +5 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +3 -2
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
- package/lib/cjs/internal/annotations/fields.js +7 -6
- package/lib/cjs/internal/annotations/fields.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/BriefcaseManager.js +3 -3
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/Category.d.ts +37 -7
- package/lib/esm/Category.d.ts.map +1 -1
- package/lib/esm/Category.js +33 -42
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +5 -2
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChannelControl.d.ts +29 -0
- package/lib/esm/ChannelControl.d.ts.map +1 -1
- package/lib/esm/ChannelControl.js.map +1 -1
- package/lib/esm/CheckpointManager.js +1 -1
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +32 -3
- package/lib/esm/CodeSpecs.d.ts.map +1 -1
- package/lib/esm/CodeSpecs.js +49 -21
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +18 -3
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +10 -21
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/EditTxn.d.ts +262 -0
- package/lib/esm/EditTxn.d.ts.map +1 -0
- package/lib/esm/EditTxn.js +543 -0
- package/lib/esm/EditTxn.js.map +1 -0
- package/lib/esm/Element.d.ts +74 -5
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +64 -76
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +10 -0
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +22 -13
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts +56 -3
- package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
- package/lib/esm/ElementTreeWalker.js +53 -40
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/ExternalSource.d.ts +11 -2
- package/lib/esm/ExternalSource.d.ts.map +1 -1
- package/lib/esm/ExternalSource.js +10 -8
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +66 -22
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +176 -290
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +22 -0
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +9 -0
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IpcHost.js +3 -3
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/LineStyle.d.ts +47 -7
- package/lib/esm/LineStyle.d.ts.map +1 -1
- package/lib/esm/LineStyle.js +38 -33
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/Material.d.ts +8 -1
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +6 -12
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +59 -20
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +39 -81
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/Relationship.d.ts +72 -7
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +40 -22
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SchemaSync.js +5 -5
- package/lib/esm/SchemaSync.js.map +1 -1
- package/lib/esm/SheetIndex.d.ts +9 -0
- package/lib/esm/SheetIndex.d.ts.map +1 -1
- package/lib/esm/SheetIndex.js +38 -35
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/StashManager.js +1 -1
- package/lib/esm/StashManager.js.map +1 -1
- package/lib/esm/Texture.d.ts +6 -0
- package/lib/esm/Texture.d.ts.map +1 -1
- package/lib/esm/Texture.js +6 -14
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +5 -5
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +23 -7
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +21 -1
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +27 -66
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +14 -6
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +33 -27
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +6 -5
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/core-backend.d.ts +1 -0
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +1 -0
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts +6 -2
- package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/esm/domains/FunctionalElements.js +8 -13
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/GenericElements.d.ts +11 -4
- package/lib/esm/domains/GenericElements.d.ts.map +1 -1
- package/lib/esm/domains/GenericElements.js +13 -24
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts +15 -0
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +6 -4
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +4 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +4 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +3 -2
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
- package/lib/esm/internal/annotations/fields.js +7 -6
- package/lib/esm/internal/annotations/fields.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.d.ts +20 -19
- package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.js +111 -96
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/IModelHost.test.js +56 -2
- package/lib/esm/test/IModelHost.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +23 -23
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +466 -449
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/PropertyDb.test.js +2 -2
- package/lib/esm/test/PropertyDb.test.js.map +1 -1
- package/lib/esm/test/SquashSchemaAndDataChanges.test.js +27 -18
- package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.d.ts.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.js +11 -7
- package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
- package/lib/esm/test/TestEditTxn.d.ts +8 -0
- package/lib/esm/test/TestEditTxn.d.ts.map +1 -0
- package/lib/esm/test/TestEditTxn.js +34 -0
- package/lib/esm/test/TestEditTxn.js.map +1 -0
- package/lib/esm/test/TestUtils.d.ts +1 -0
- package/lib/esm/test/TestUtils.d.ts.map +1 -1
- package/lib/esm/test/TestUtils.js +8 -1
- package/lib/esm/test/TestUtils.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.js +82 -90
- package/lib/esm/test/annotations/Fields.test.js.map +1 -1
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +156 -99
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.js +5 -3
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
- package/lib/esm/test/categories/Category.test.js +63 -3
- package/lib/esm/test/categories/Category.test.js.map +1 -1
- package/lib/esm/test/codespec/CodeSpec.test.js +88 -5
- package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +3 -2
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +2 -2
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +0 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/QueryReaders.test.js +17 -14
- package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
- package/lib/esm/test/ecdb/SqliteStatement.test.js +2 -2
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +30 -28
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- 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 +159 -143
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/element/ElementAspect.test.js +68 -60
- package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
- package/lib/esm/test/element/ElementDependencyGraph.test.d.ts.map +1 -1
- package/lib/esm/test/element/ElementDependencyGraph.test.js +51 -43
- package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +37 -38
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/element/ExcludedElements.test.js +2 -2
- package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
- package/lib/esm/test/element/ExternalSource.test.js +40 -38
- package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
- package/lib/esm/test/element/NullStructArray.test.js +10 -9
- package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
- package/lib/esm/test/element/ProjectInformationRecord.test.js +5 -2
- package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
- package/lib/esm/test/element/SheetInformationAspect.test.js +43 -11
- package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
- package/lib/esm/test/element/UrlLink.test.js +2 -2
- package/lib/esm/test/element/UrlLink.test.js.map +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js +87 -73
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +164 -125
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +2 -4
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +313 -247
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebase.test.js +322 -247
- package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
- package/lib/esm/test/imodel/Code.test.js +31 -31
- package/lib/esm/test/imodel/Code.test.js.map +1 -1
- package/lib/esm/test/imodel/ElementTreeWalker.test.js +57 -48
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +419 -344
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/imodel/ProjectExtents.test.js +2 -2
- package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/TestContext.js +2 -2
- package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -1
- package/lib/esm/test/index.d.ts +1 -0
- package/lib/esm/test/index.d.ts.map +1 -1
- package/lib/esm/test/index.js +1 -0
- package/lib/esm/test/index.js.map +1 -1
- package/lib/esm/test/schema/ClassRegistry.test.js +23 -22
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
- package/lib/esm/test/schema/FunctionalDomain.test.js +36 -34
- package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
- package/lib/esm/test/schema/GenericDomain.test.js +114 -94
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js +2 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js +207 -192
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.d.ts +1 -3
- package/lib/esm/test/sheetindex/SheetIndex.test.d.ts.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js +312 -247
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +101 -82
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +114 -85
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DisplayStyle.test.js +43 -40
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
- package/lib/esm/test/standalone/Drawing.test.js +4 -3
- package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
- package/lib/esm/test/standalone/EditTxn.test.d.ts +2 -0
- package/lib/esm/test/standalone/EditTxn.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/EditTxn.test.js +219 -0
- package/lib/esm/test/standalone/EditTxn.test.js.map +1 -0
- package/lib/esm/test/standalone/ElementMesh.test.js +16 -13
- package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +26 -20
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js +11 -15
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryStream.test.js +212 -165
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/HubMock.test.js +31 -25
- package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelLimits.test.js +11 -8
- package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.d.ts +2 -2
- package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.js +184 -142
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js +25 -22
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
- package/lib/esm/test/standalone/IntegrityCheck.test.js +20 -18
- package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.d.ts +2 -2
- package/lib/esm/test/standalone/MergeConflict.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js +49 -33
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +5 -5
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderTimeline.test.js +3 -2
- package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
- package/lib/esm/test/standalone/SectionDrawing.test.js +7 -7
- package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js +21 -19
- package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
- package/lib/esm/test/standalone/Settings.test.js +7 -4
- package/lib/esm/test/standalone/Settings.test.js.map +1 -1
- package/lib/esm/test/standalone/SettingsSchemas.test.js +2 -1
- package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +3 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/test/standalone/StandaloneDb.test.js +7 -6
- package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -1
- package/lib/esm/test/standalone/Texture.test.js +5 -4
- package/lib/esm/test/standalone/Texture.test.js.map +1 -1
- package/lib/esm/test/standalone/TileCache.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/TileCache.test.js +5 -3
- package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
- package/lib/esm/test/standalone/TileTree.test.js +35 -31
- package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +700 -653
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewDefinition.test.js +295 -229
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js +25 -23
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/package.json +12 -12
package/lib/esm/LineStyle.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { LinePixels } from "@itwin/core-common";
|
|
6
|
+
import { EditTxn } from "./EditTxn";
|
|
6
7
|
import { IModelDb } from "./IModelDb";
|
|
7
8
|
/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.
|
|
8
9
|
* There are three varieties of line styles:
|
|
@@ -273,22 +274,58 @@ export declare namespace LineStyleDefinition {
|
|
|
273
274
|
}
|
|
274
275
|
/** Helper methods for creating and querying line styles */
|
|
275
276
|
class Utils {
|
|
276
|
-
/** Create a file property for a new stroke pattern component.
|
|
277
|
+
/** Create a file property for a new stroke pattern component using an explicit EditTxn.
|
|
278
|
+
* @beta
|
|
279
|
+
*/
|
|
280
|
+
static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;
|
|
281
|
+
/** Create a file property for a new stroke pattern component.
|
|
282
|
+
* @deprecated Use createStrokePatternComponent(txn, ...) instead.
|
|
283
|
+
*/
|
|
277
284
|
static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;
|
|
285
|
+
/** Create a file property for a new point symbol component using an explicit EditTxn.
|
|
286
|
+
* If base and size parameters are not supplied, queries GeometryPart by id to set them.
|
|
287
|
+
* @beta
|
|
288
|
+
*/
|
|
289
|
+
static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;
|
|
278
290
|
/** Create a file property for a new point symbol component.
|
|
279
291
|
* If base and size parameters are not supplied, queries GeometryPart by id to set them.
|
|
292
|
+
* @deprecated Use createPointSymbolComponent(txn, ...) instead.
|
|
280
293
|
*/
|
|
281
294
|
static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;
|
|
282
|
-
/** Create a file property for a new stroke point component.
|
|
295
|
+
/** Create a file property for a new stroke point component using an explicit EditTxn.
|
|
296
|
+
* @beta
|
|
297
|
+
*/
|
|
298
|
+
static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;
|
|
299
|
+
/** Create a file property for a new stroke point component.
|
|
300
|
+
* @deprecated Use createStrokePointComponent(txn, ...) instead.
|
|
301
|
+
*/
|
|
283
302
|
static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;
|
|
284
|
-
/** Create a file property for a new compound component.
|
|
303
|
+
/** Create a file property for a new compound component using an explicit EditTxn.
|
|
304
|
+
* @beta
|
|
305
|
+
*/
|
|
306
|
+
static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;
|
|
307
|
+
/** Create a file property for a new compound component.
|
|
308
|
+
* @deprecated Use createCompoundComponent(txn, ...) instead.
|
|
309
|
+
*/
|
|
285
310
|
static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;
|
|
286
|
-
/** Create a file property for a new raster image component.
|
|
311
|
+
/** Create a file property for a new raster image component using an explicit EditTxn.
|
|
312
|
+
* @beta
|
|
313
|
+
*/
|
|
314
|
+
static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;
|
|
315
|
+
/** Create a file property for a new raster image component.
|
|
316
|
+
* @deprecated Use createRasterComponent(txn, ...) instead.
|
|
317
|
+
*/
|
|
287
318
|
static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;
|
|
288
319
|
/** Query for an existing line style with the supplied name. */
|
|
289
320
|
static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined;
|
|
321
|
+
/** Insert a new line style with the supplied name using an explicit EditTxn.
|
|
322
|
+
* @throws [[IModelError]] if unable to insert the line style definition element.
|
|
323
|
+
* @beta
|
|
324
|
+
*/
|
|
325
|
+
static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;
|
|
290
326
|
/** Insert a new line style with the supplied name.
|
|
291
327
|
* @throws [[IModelError]] if unable to insert the line style definition element.
|
|
328
|
+
* @deprecated Use createStyle(txn, ...) instead.
|
|
292
329
|
*/
|
|
293
330
|
static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;
|
|
294
331
|
/** Get the name that can be use to query for an existing continuous line style. */
|
|
@@ -299,10 +336,11 @@ export declare namespace LineStyleDefinition {
|
|
|
299
336
|
* - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.
|
|
300
337
|
* - Width is specified in the style.
|
|
301
338
|
* - Defined using a single stroke component that is a long dash.
|
|
302
|
-
*
|
|
339
|
+
* @param txn Optional explicit EditTxn to use if the style must be created.
|
|
303
340
|
* @throws [[IModelError]] if unable to insert the line style definition element.
|
|
341
|
+
* @beta
|
|
304
342
|
*/
|
|
305
|
-
static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number): Id64String;
|
|
343
|
+
static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String;
|
|
306
344
|
/** Get the name that can be use to query for an existing [[LinePixels]] line style.
|
|
307
345
|
* @note Returns undefined for line pixels value that is not Code1 to Code7.
|
|
308
346
|
*/
|
|
@@ -310,9 +348,11 @@ export declare namespace LineStyleDefinition {
|
|
|
310
348
|
/** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.
|
|
311
349
|
* Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.
|
|
312
350
|
* Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.
|
|
351
|
+
* @param txn Optional explicit EditTxn to use if the style must be created.
|
|
313
352
|
* @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.
|
|
353
|
+
* @beta
|
|
314
354
|
*/
|
|
315
|
-
static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels): Id64String;
|
|
355
|
+
static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String;
|
|
316
356
|
}
|
|
317
357
|
}
|
|
318
358
|
//# sourceMappingURL=LineStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineStyle.d.ts","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAkC,UAAU,EAAkB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"LineStyle.d.ts","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAkC,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAwBtC;;;;;;;;;GASG;AACH,yBAAiB,mBAAmB,CAAC;IAEnC,4CAA4C;IAC5C,KAAY,aAAa;QACvB,kEAAkE;QAClE,WAAW,IAAI;QACf,+DAA+D;QAC/D,QAAQ,IAAI;QACZ,oEAAoE;QACpE,aAAa,IAAI;QACjB,kEAAkE;QAClE,WAAW,IAAI;QACf,wEAAwE;QACxE,QAAQ,IAAI;QACZ,kEAAkE;QAClE,WAAW,I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AAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,UAAU;KASxI;CACF"}
|
package/lib/esm/LineStyle.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { IModelStatus } from "@itwin/core-bentley";
|
|
9
9
|
import { IModelError, LinePixels } from "@itwin/core-common";
|
|
10
|
+
import { EditTxn } from "./EditTxn";
|
|
10
11
|
import { LineStyle } from "./Element";
|
|
12
|
+
import { _implicitTxn } from "./internal/Symbols";
|
|
11
13
|
function getLinePixelsLineCode(linePixels) {
|
|
12
14
|
switch (linePixels) {
|
|
13
15
|
case LinePixels.Code1:
|
|
@@ -176,17 +178,16 @@ export var LineStyleDefinition;
|
|
|
176
178
|
})(StyleFlags = LineStyleDefinition.StyleFlags || (LineStyleDefinition.StyleFlags = {}));
|
|
177
179
|
/** Helper methods for creating and querying line styles */
|
|
178
180
|
class Utils {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
static createStrokePatternComponent(txnOrIModel, props) {
|
|
182
|
+
const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];
|
|
181
183
|
const fileProps = { name: "LineCodeV1", namespace: "dgn_LStyle" };
|
|
182
|
-
fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);
|
|
183
|
-
|
|
184
|
+
fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);
|
|
185
|
+
txn.saveFileProperty(fileProps, JSON.stringify(props));
|
|
184
186
|
return { compId: fileProps.id, compType: ComponentType.StrokePattern };
|
|
185
187
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
static createPointSymbolComponent(iModel, props) {
|
|
188
|
+
static createPointSymbolComponent(txnOrIModel, props) {
|
|
189
|
+
const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];
|
|
190
|
+
const iModel = txn.iModel;
|
|
190
191
|
// if part extents weren't supplied, set them up now.
|
|
191
192
|
if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {
|
|
192
193
|
const geomPart = iModel.elements.getElement(props.geomPartId);
|
|
@@ -201,42 +202,42 @@ export var LineStyleDefinition;
|
|
|
201
202
|
}
|
|
202
203
|
const fileProps = { name: "PointSymV1", namespace: "dgn_LStyle" };
|
|
203
204
|
fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);
|
|
204
|
-
|
|
205
|
+
txn.saveFileProperty(fileProps, JSON.stringify(props));
|
|
205
206
|
return { compId: fileProps.id, compType: ComponentType.PointSymbol };
|
|
206
207
|
}
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
static createStrokePointComponent(txnOrIModel, props) {
|
|
209
|
+
const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];
|
|
209
210
|
const fileProps = { name: "LinePointV1", namespace: "dgn_LStyle" };
|
|
210
|
-
fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);
|
|
211
|
-
|
|
211
|
+
fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);
|
|
212
|
+
txn.saveFileProperty(fileProps, JSON.stringify(props));
|
|
212
213
|
return { compId: fileProps.id, compType: ComponentType.StrokePoint };
|
|
213
214
|
}
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
static createCompoundComponent(txnOrIModel, props) {
|
|
216
|
+
const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];
|
|
216
217
|
const fileProps = { name: "CompoundV1", namespace: "dgn_LStyle" };
|
|
217
|
-
fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);
|
|
218
|
-
|
|
218
|
+
fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);
|
|
219
|
+
txn.saveFileProperty(fileProps, JSON.stringify(props));
|
|
219
220
|
return { compId: fileProps.id, compType: ComponentType.Compound };
|
|
220
221
|
}
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
static createRasterComponent(txnOrIModel, props, image) {
|
|
223
|
+
const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];
|
|
224
|
+
const iModel = txn.iModel;
|
|
223
225
|
const rasterFileProps = { name: "RasterImageV1", namespace: "dgn_LStyle" };
|
|
224
226
|
rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);
|
|
225
|
-
|
|
227
|
+
txn.saveFileProperty(rasterFileProps, undefined, image);
|
|
226
228
|
props.imageId = rasterFileProps.id;
|
|
227
229
|
const fileProps = { name: "RasterComponentV1", namespace: "dgn_LStyle" };
|
|
228
230
|
fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);
|
|
229
|
-
|
|
231
|
+
txn.saveFileProperty(fileProps, JSON.stringify(props));
|
|
230
232
|
return { compId: fileProps.id, compType: ComponentType.RasterImage };
|
|
231
233
|
}
|
|
232
234
|
/** Query for an existing line style with the supplied name. */
|
|
233
235
|
static queryStyle(imodel, scopeModelId, name) {
|
|
234
236
|
return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));
|
|
235
237
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
static createStyle(imodel, scopeModelId, name, props) {
|
|
238
|
+
static createStyle(txnOrIModel, scopeModelId, name, props) {
|
|
239
|
+
const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];
|
|
240
|
+
const imodel = txn.iModel;
|
|
240
241
|
if (undefined === props.flags)
|
|
241
242
|
props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.
|
|
242
243
|
const lsProps = {
|
|
@@ -245,7 +246,7 @@ export var LineStyleDefinition;
|
|
|
245
246
|
code: LineStyle.createCode(imodel, scopeModelId, name),
|
|
246
247
|
data: JSON.stringify(props),
|
|
247
248
|
};
|
|
248
|
-
return
|
|
249
|
+
return txn.insertElement(lsProps);
|
|
249
250
|
}
|
|
250
251
|
/** Get the name that can be use to query for an existing continuous line style. */
|
|
251
252
|
static getContinuousStyleName(width) {
|
|
@@ -259,20 +260,22 @@ export var LineStyleDefinition;
|
|
|
259
260
|
* - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.
|
|
260
261
|
* - Width is specified in the style.
|
|
261
262
|
* - Defined using a single stroke component that is a long dash.
|
|
262
|
-
*
|
|
263
|
+
* @param txn Optional explicit EditTxn to use if the style must be created.
|
|
263
264
|
* @throws [[IModelError]] if unable to insert the line style definition element.
|
|
265
|
+
* @beta
|
|
264
266
|
*/
|
|
265
|
-
static getOrCreateContinuousStyle(imodel, scopeModelId, width) {
|
|
267
|
+
static getOrCreateContinuousStyle(imodel, scopeModelId, width, txn) {
|
|
268
|
+
const writeTxn = txn ?? imodel[_implicitTxn];
|
|
266
269
|
const name = this.getContinuousStyleName(width);
|
|
267
270
|
const lsId = this.queryStyle(imodel, scopeModelId, name);
|
|
268
271
|
if (undefined !== lsId)
|
|
269
272
|
return lsId;
|
|
270
273
|
if (width === undefined)
|
|
271
|
-
return this.createStyle(
|
|
272
|
-
const strokePatternData = this.createStrokePatternComponent(
|
|
274
|
+
return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });
|
|
275
|
+
const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });
|
|
273
276
|
if (undefined === strokePatternData)
|
|
274
277
|
throw new IModelError(IModelStatus.BadArg, "Unable to insert stroke component");
|
|
275
|
-
return this.createStyle(
|
|
278
|
+
return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });
|
|
276
279
|
}
|
|
277
280
|
/** Get the name that can be use to query for an existing [[LinePixels]] line style.
|
|
278
281
|
* @note Returns undefined for line pixels value that is not Code1 to Code7.
|
|
@@ -286,15 +289,17 @@ export var LineStyleDefinition;
|
|
|
286
289
|
/** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.
|
|
287
290
|
* Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.
|
|
288
291
|
* Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.
|
|
292
|
+
* @param txn Optional explicit EditTxn to use if the style must be created.
|
|
289
293
|
* @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.
|
|
294
|
+
* @beta
|
|
290
295
|
*/
|
|
291
|
-
static getOrCreateLinePixelsStyle(imodel, scopeModelId, linePixels) {
|
|
296
|
+
static getOrCreateLinePixelsStyle(imodel, scopeModelId, linePixels, txn) {
|
|
292
297
|
const lineCode = getLinePixelsLineCode(linePixels);
|
|
293
298
|
if (-1 === lineCode)
|
|
294
299
|
throw new IModelError(IModelStatus.BadArg, "Invalid LinePixels");
|
|
295
300
|
const name = `LinePixelsCodeNumber-${lineCode}`;
|
|
296
301
|
const lsId = this.queryStyle(imodel, scopeModelId, name);
|
|
297
|
-
return (undefined === lsId ? this.createStyle(imodel, scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);
|
|
302
|
+
return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);
|
|
298
303
|
}
|
|
299
304
|
}
|
|
300
305
|
LineStyleDefinition.Utils = Utils;
|
package/lib/esm/LineStyle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,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AE,CAAC,CAAC;QACpL,CAAC;QAED;;UAEE;QACK,MAAM,CAAC,sBAAsB,CAAC,UAAsB;YACzD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,OAAO,SAAS,CAAC;YAEnB,OAAO,wBAAwB,QAAQ,EAAE,CAAC;QAC5C,CAAC;QAED;;;;WAIG;QACI,MAAM,CAAC,0BAA0B,CAAC,MAAgB,EAAE,YAAwB,EAAE,UAAsB;YACzG,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;YAEnE,MAAM,IAAI,GAAG,wBAAwB,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5I,CAAC;KACF;IA/IY,yBAAK,QA+IjB,CAAA;AACH,CAAC,EAvagB,mBAAmB,KAAnB,mBAAmB,QAuanC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\nimport { GeometryPart, LineStyle } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\n\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\n switch (linePixels) {\n case LinePixels.Code1:\n return 1;\n case LinePixels.Code2:\n return 2;\n case LinePixels.Code3:\n return 3;\n case LinePixels.Code4:\n return 4;\n case LinePixels.Code5:\n return 5;\n case LinePixels.Code6:\n return 6;\n case LinePixels.Code7:\n return 7;\n default:\n return -1; // Invalid value...\n }\n}\n\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\n * There are three varieties of line styles:\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\n * - A style that uses a texture.\n *\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\n * by file property id and type and is saved as a dictionary element.\n * @public\n */\nexport namespace LineStyleDefinition {\n\n /** Line style component type identifiers */\n export enum ComponentType {\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\n PointSymbol = 1,\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\n Compound = 2,\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\n StrokePattern = 3,\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\n StrokePoint = 4,\n /** Component type for [[LinePixels]], never saved as a file property */\n Internal = 6,\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\n RasterImage = 7,\n }\n\n /** Mask of values for StrokeMode */\n export enum StrokeMode {\n /** Stroke represents a blank space */\n Gap = 0x00,\n /** Stroke represents a solid dash */\n Dash = 0x01,\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\n Ray = 0x02,\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\n Scale = 0x04,\n /** Invert stroke in first stroke pattern */\n FirstInvert = 0x08,\n /** Invert stroke in last stroke pattern */\n LastInvert = 0x10,\n }\n\n /** Define constant width or tapered strokes with distance specified in meters */\n export enum StrokeWidth {\n /** Stroke draws as one pixel wide line */\n None = 0,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\n Left = 1,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\n Right = 2,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\n Full = 3,\n }\n\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\n * StrokeCap indicates the number of vectors in the arc.\n */\n export enum StrokeCap {\n /** Stroke displays as a closed polygon */\n Closed = 0,\n /** Stroke displays lines at specified width instead of a polygon */\n Open = 1,\n /** Stroke length extended by half the stroke width */\n Extended = 2,\n /** Stroke end cap is a hexagon */\n Hexagon = 3,\n /** Stroke end cap is an octagon */\n Octagon = 4,\n /** Stroke end cap is a decagon */\n Decagon = 5,\n /** Stroke end cap is an arc */\n Arc = 30,\n }\n\n /** A stroke representing either a dash or gap in a stroke pattern */\n export interface StrokeProps {\n /** Length of stroke in meters */\n length: number;\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n orgWidth?: number;\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n endWidth?: number;\n /** Type and behavior of stroke */\n strokeMode?: StrokeMode;\n /** How to apply orgWidth and endWidth to stroke */\n widthMode?: StrokeWidth;\n /** Appearance of stroke end cap */\n capMode?: StrokeCap;\n }\n\n export type Strokes = StrokeProps[];\n\n /** Options to control how stroke pattern is applied to underlying curve */\n export enum StrokePatternOptions {\n /** Use default stroke behavior */\n None = 0x00,\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\n AutoPhase = 0x01,\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\n Iteration = 0x08,\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\n Segment = 0x10,\n /** Center the line style and stretch the ends */\n CenterStretch = 0x20,\n }\n\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\n */\n export interface StrokePatternProps {\n /** Name for this stroke pattern */\n descr: string;\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\n phase?: number;\n /** Options mask for this stroke pattern */\n options?: StrokePatternOptions;\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\n maxIter?: number;\n /** Array of strokes, maximum number that will be used is 32 */\n strokes: Strokes;\n }\n\n /** Flags to identify point symbol behavior */\n export enum PointSymbolFlags {\n /** Default symbol behavior */\n None = 0x0,\n /** Symbol includes 3d geometry */\n Is3d = 0x01,\n /** Symbol does not allow scaling */\n NoScale = 0x02,\n }\n\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\n */\n export interface PointSymbolProps {\n /** GeometryPart Id to use as a pattern symbol */\n geomPartId: Id64String;\n /** GeometryPart.bbox.low.x */\n baseX?: number;\n /** GeometryPart.bbox.low.y */\n baseY?: number;\n /** GeometryPart.bbox.low.z */\n baseZ?: number;\n /** GeometryPart.bbox.high.x */\n sizeX?: number;\n /** GeometryPart.bbox.high.y */\n sizeY?: number;\n /** GeometryPart.bbox.high.z */\n sizeZ?: number;\n /** Symbol behavior flags */\n symFlags?: PointSymbolFlags;\n /** Symbol scale, defaults to 1 */\n scale?: number;\n }\n\n /** Symbol options for location, orientation, and behavior */\n export enum SymbolOptions {\n /** No point symbol */\n None = 0x00,\n /** Symbol at origin of stroke */\n Origin = 0x01,\n /** Symbol at end of stroke */\n End = 0x02,\n /** symbol at center of stroke */\n Center = 0x03,\n /** Symbol at curve start point */\n CurveOrigin = 0x0004,\n /** Symbol at curve end point */\n CurveEnd = 0x0008,\n /** Symbol at each vertex */\n CurveVertex = 0x0010,\n /** Adjust symbol rotation left->right */\n AdjustRotation = 0x0020,\n /** Angle of symbol not relative to stroke direction */\n AbsoluteRotation = 0x0040,\n /** No scale on variable strokes */\n NoScale = 0x0100,\n /** No clip on partial strokes */\n NoClip = 0x0200,\n /** No partial strokes */\n NoPartial = 0x0400,\n /** Project partial origin */\n ProjectOrigin = 0x0800,\n /** Use color from symbol instead of inheriting curve color */\n UseColor = 0x4000,\n /** Use weight from symbol instead of inheriting curve weight */\n UseWeight = 0x8000,\n }\n\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\n export interface SymbolProps {\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\n symId: number;\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\n symType?: ComponentType;\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\n strokeNum?: number;\n /** Symbol x offset distance in meters */\n xOffset?: number;\n /** Symbol y offset distance in meters */\n yOffset?: number;\n /** Symbol rotation in radians */\n angle?: number;\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\n mod1?: SymbolOptions;\n }\n\n export type Symbols = SymbolProps[];\n\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\n */\n export interface StrokePointProps {\n /** Name for this stroke point component */\n descr: string;\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\n lcId: number;\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\n lcType?: ComponentType;\n /** Array of symbols */\n symbols: Symbols;\n }\n\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\n * A raster component identifies a texture for a line style.\n */\n export interface RasterImageProps {\n /** Name for this raster image component */\n descr: string;\n /** Raster width */\n x: number;\n /** Raster height */\n y: number;\n /** True width flag */\n trueWidth?: number;\n /** Raster flags */\n flags?: number;\n /** The file property id of raster image */\n imageId?: number;\n }\n\n /** Identifies a component by file property id and type */\n export interface ComponentProps {\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\n id: number;\n /** The type of component for specified file property id */\n type: ComponentType;\n /** Offset distance for this component, default is 0 */\n offset?: number;\n }\n\n export type Components = ComponentProps[];\n\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\n */\n export interface CompoundProps {\n comps: Components;\n }\n\n /** Flags to describe a style or control style behavior */\n export enum StyleFlags {\n /** Use defaults */\n None = 0x00,\n /** Only snap to center line and not individual strokes and symbols of line style */\n NoSnap = 0x04,\n /** Style represents a continuous line with width (determined by looking at components if not set) */\n Continuous = 0x08,\n /** Style represents physical geometry and should be scaled as such */\n Physical = 0x80,\n }\n\n /** The line style definition element data */\n export interface StyleProps {\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\n compId: number;\n /** The type of component for specified file property id */\n compType: ComponentType;\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\n flags?: StyleFlags;\n /** Style scale, defaults to 1 */\n unitDef?: number;\n }\n\n /** Helper methods for creating and querying line styles */\n export class Utils {\n\n /** Create a file property for a new stroke pattern component. */\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps {\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\n }\n\n /** Create a file property for a new point symbol component.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n */\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined {\n // if part extents weren't supplied, set them up now.\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\n if (!geomPart)\n return undefined;\n\n props.baseX = geomPart.bbox.low.x;\n props.baseY = geomPart.bbox.low.y;\n props.baseZ = geomPart.bbox.low.z;\n\n props.sizeX = geomPart.bbox.high.x;\n props.sizeY = geomPart.bbox.high.y;\n props.sizeZ = geomPart.bbox.high.z;\n }\n\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\n }\n\n /** Create a file property for a new stroke point component. */\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps {\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\n }\n\n /** Create a file property for a new compound component. */\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps {\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.Compound };\n }\n\n /** Create a file property for a new raster image component. */\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\n iModel.saveFileProperty(rasterFileProps, undefined, image);\n props.imageId = rasterFileProps.id;\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\n }\n\n /** Query for an existing line style with the supplied name. */\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\n }\n\n /** Insert a new line style with the supplied name.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n */\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\n if (undefined === props.flags)\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\n\n const lsProps: LineStyleProps = {\n classFullName: \"BisCore:LineStyle\",\n model: scopeModelId,\n code: LineStyle.createCode(imodel, scopeModelId, name),\n data: JSON.stringify(props),\n };\n\n return imodel.elements.insertElement(lsProps);\n }\n\n /** Get the name that can be use to query for an existing continuous line style. */\n public static getContinuousStyleName(width?: number): string {\n if (width === undefined)\n return \"Continuous\";\n\n return `Continuous-${width}`;\n }\n\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\n * There are 2 ways to define a continuous line style:\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\n * - Width is specified in the style.\n * - Defined using a single stroke component that is a long dash.\n *\n * @throws [[IModelError]] if unable to insert the line style definition element.\n */\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number): Id64String {\n const name = this.getContinuousStyleName(width);\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n if (undefined !== lsId)\n return lsId;\n\n if (width === undefined)\n return this.createStyle(imodel, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n\n const strokePatternData = this.createStrokePatternComponent(imodel, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\n if (undefined === strokePatternData)\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\n\n return this.createStyle(imodel, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n }\n\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\n */\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n return undefined;\n\n return `LinePixelsCodeNumber-${lineCode}`;\n }\n\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\n */\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels): Id64String {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\n\n const name = `LinePixelsCodeNumber-${lineCode}`;\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n return (undefined === lsId ? this.createStyle(imodel, scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAqB,WAAW,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAgB,SAAS,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAAS,qBAAqB,CAAC,UAAsB;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,KAAW,mBAAmB,CA6dnC;AA7dD,WAAiB,mBAAmB;IAElC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AY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACtL,CAAC;QAED;;UAEE;QACK,MAAM,CAAC,sBAAsB,CAAC,UAAsB;YACzD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,OAAO,SAAS,CAAC;YAEnB,OAAO,wBAAwB,QAAQ,EAAE,CAAC;QAC5C,CAAC;QAED;;;;;;WAMG;QACI,MAAM,CAAC,0BAA0B,CAAC,MAAgB,EAAE,YAAwB,EAAE,UAAsB,EAAE,GAAa;YACxH,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;YAEnE,MAAM,IAAI,GAAG,wBAAwB,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjK,CAAC;KACF;IArMY,yBAAK,QAqMjB,CAAA;AACH,CAAC,EA7dgB,mBAAmB,KAAnB,mBAAmB,QA6dnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\nimport { EditTxn } from \"./EditTxn\";\nimport { GeometryPart, LineStyle } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _implicitTxn } from \"./internal/Symbols\";\n\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\n switch (linePixels) {\n case LinePixels.Code1:\n return 1;\n case LinePixels.Code2:\n return 2;\n case LinePixels.Code3:\n return 3;\n case LinePixels.Code4:\n return 4;\n case LinePixels.Code5:\n return 5;\n case LinePixels.Code6:\n return 6;\n case LinePixels.Code7:\n return 7;\n default:\n return -1; // Invalid value...\n }\n}\n\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\n * There are three varieties of line styles:\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\n * - A style that uses a texture.\n *\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\n * by file property id and type and is saved as a dictionary element.\n * @public\n */\nexport namespace LineStyleDefinition {\n\n /** Line style component type identifiers */\n export enum ComponentType {\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\n PointSymbol = 1,\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\n Compound = 2,\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\n StrokePattern = 3,\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\n StrokePoint = 4,\n /** Component type for [[LinePixels]], never saved as a file property */\n Internal = 6,\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\n RasterImage = 7,\n }\n\n /** Mask of values for StrokeMode */\n export enum StrokeMode {\n /** Stroke represents a blank space */\n Gap = 0x00,\n /** Stroke represents a solid dash */\n Dash = 0x01,\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\n Ray = 0x02,\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\n Scale = 0x04,\n /** Invert stroke in first stroke pattern */\n FirstInvert = 0x08,\n /** Invert stroke in last stroke pattern */\n LastInvert = 0x10,\n }\n\n /** Define constant width or tapered strokes with distance specified in meters */\n export enum StrokeWidth {\n /** Stroke draws as one pixel wide line */\n None = 0,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\n Left = 1,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\n Right = 2,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\n Full = 3,\n }\n\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\n * StrokeCap indicates the number of vectors in the arc.\n */\n export enum StrokeCap {\n /** Stroke displays as a closed polygon */\n Closed = 0,\n /** Stroke displays lines at specified width instead of a polygon */\n Open = 1,\n /** Stroke length extended by half the stroke width */\n Extended = 2,\n /** Stroke end cap is a hexagon */\n Hexagon = 3,\n /** Stroke end cap is an octagon */\n Octagon = 4,\n /** Stroke end cap is a decagon */\n Decagon = 5,\n /** Stroke end cap is an arc */\n Arc = 30,\n }\n\n /** A stroke representing either a dash or gap in a stroke pattern */\n export interface StrokeProps {\n /** Length of stroke in meters */\n length: number;\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n orgWidth?: number;\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n endWidth?: number;\n /** Type and behavior of stroke */\n strokeMode?: StrokeMode;\n /** How to apply orgWidth and endWidth to stroke */\n widthMode?: StrokeWidth;\n /** Appearance of stroke end cap */\n capMode?: StrokeCap;\n }\n\n export type Strokes = StrokeProps[];\n\n /** Options to control how stroke pattern is applied to underlying curve */\n export enum StrokePatternOptions {\n /** Use default stroke behavior */\n None = 0x00,\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\n AutoPhase = 0x01,\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\n Iteration = 0x08,\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\n Segment = 0x10,\n /** Center the line style and stretch the ends */\n CenterStretch = 0x20,\n }\n\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\n */\n export interface StrokePatternProps {\n /** Name for this stroke pattern */\n descr: string;\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\n phase?: number;\n /** Options mask for this stroke pattern */\n options?: StrokePatternOptions;\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\n maxIter?: number;\n /** Array of strokes, maximum number that will be used is 32 */\n strokes: Strokes;\n }\n\n /** Flags to identify point symbol behavior */\n export enum PointSymbolFlags {\n /** Default symbol behavior */\n None = 0x0,\n /** Symbol includes 3d geometry */\n Is3d = 0x01,\n /** Symbol does not allow scaling */\n NoScale = 0x02,\n }\n\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\n */\n export interface PointSymbolProps {\n /** GeometryPart Id to use as a pattern symbol */\n geomPartId: Id64String;\n /** GeometryPart.bbox.low.x */\n baseX?: number;\n /** GeometryPart.bbox.low.y */\n baseY?: number;\n /** GeometryPart.bbox.low.z */\n baseZ?: number;\n /** GeometryPart.bbox.high.x */\n sizeX?: number;\n /** GeometryPart.bbox.high.y */\n sizeY?: number;\n /** GeometryPart.bbox.high.z */\n sizeZ?: number;\n /** Symbol behavior flags */\n symFlags?: PointSymbolFlags;\n /** Symbol scale, defaults to 1 */\n scale?: number;\n }\n\n /** Symbol options for location, orientation, and behavior */\n export enum SymbolOptions {\n /** No point symbol */\n None = 0x00,\n /** Symbol at origin of stroke */\n Origin = 0x01,\n /** Symbol at end of stroke */\n End = 0x02,\n /** symbol at center of stroke */\n Center = 0x03,\n /** Symbol at curve start point */\n CurveOrigin = 0x0004,\n /** Symbol at curve end point */\n CurveEnd = 0x0008,\n /** Symbol at each vertex */\n CurveVertex = 0x0010,\n /** Adjust symbol rotation left->right */\n AdjustRotation = 0x0020,\n /** Angle of symbol not relative to stroke direction */\n AbsoluteRotation = 0x0040,\n /** No scale on variable strokes */\n NoScale = 0x0100,\n /** No clip on partial strokes */\n NoClip = 0x0200,\n /** No partial strokes */\n NoPartial = 0x0400,\n /** Project partial origin */\n ProjectOrigin = 0x0800,\n /** Use color from symbol instead of inheriting curve color */\n UseColor = 0x4000,\n /** Use weight from symbol instead of inheriting curve weight */\n UseWeight = 0x8000,\n }\n\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\n export interface SymbolProps {\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\n symId: number;\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\n symType?: ComponentType;\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\n strokeNum?: number;\n /** Symbol x offset distance in meters */\n xOffset?: number;\n /** Symbol y offset distance in meters */\n yOffset?: number;\n /** Symbol rotation in radians */\n angle?: number;\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\n mod1?: SymbolOptions;\n }\n\n export type Symbols = SymbolProps[];\n\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\n */\n export interface StrokePointProps {\n /** Name for this stroke point component */\n descr: string;\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\n lcId: number;\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\n lcType?: ComponentType;\n /** Array of symbols */\n symbols: Symbols;\n }\n\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\n * A raster component identifies a texture for a line style.\n */\n export interface RasterImageProps {\n /** Name for this raster image component */\n descr: string;\n /** Raster width */\n x: number;\n /** Raster height */\n y: number;\n /** True width flag */\n trueWidth?: number;\n /** Raster flags */\n flags?: number;\n /** The file property id of raster image */\n imageId?: number;\n }\n\n /** Identifies a component by file property id and type */\n export interface ComponentProps {\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\n id: number;\n /** The type of component for specified file property id */\n type: ComponentType;\n /** Offset distance for this component, default is 0 */\n offset?: number;\n }\n\n export type Components = ComponentProps[];\n\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\n */\n export interface CompoundProps {\n comps: Components;\n }\n\n /** Flags to describe a style or control style behavior */\n export enum StyleFlags {\n /** Use defaults */\n None = 0x00,\n /** Only snap to center line and not individual strokes and symbols of line style */\n NoSnap = 0x04,\n /** Style represents a continuous line with width (determined by looking at components if not set) */\n Continuous = 0x08,\n /** Style represents physical geometry and should be scaled as such */\n Physical = 0x80,\n }\n\n /** The line style definition element data */\n export interface StyleProps {\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\n compId: number;\n /** The type of component for specified file property id */\n compType: ComponentType;\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\n flags?: StyleFlags;\n /** Style scale, defaults to 1 */\n unitDef?: number;\n }\n\n /** Helper methods for creating and querying line styles */\n export class Utils {\n /** Create a file property for a new stroke pattern component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;\n /** Create a file property for a new stroke pattern component.\n * @deprecated Use createStrokePatternComponent(txn, ...) instead.\n */\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;\n public static createStrokePatternComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePatternProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\n }\n\n /** Create a file property for a new point symbol component using an explicit EditTxn.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @beta\n */\n public static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;\n /** Create a file property for a new point symbol component.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @deprecated Use createPointSymbolComponent(txn, ...) instead.\n */\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;\n public static createPointSymbolComponent(txnOrIModel: EditTxn | IModelDb, props: PointSymbolProps): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n // if part extents weren't supplied, set them up now.\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\n if (!geomPart)\n return undefined;\n\n props.baseX = geomPart.bbox.low.x;\n props.baseY = geomPart.bbox.low.y;\n props.baseZ = geomPart.bbox.low.z;\n\n props.sizeX = geomPart.bbox.high.x;\n props.sizeY = geomPart.bbox.high.y;\n props.sizeZ = geomPart.bbox.high.z;\n }\n\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\n }\n\n /** Create a file property for a new stroke point component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;\n /** Create a file property for a new stroke point component.\n * @deprecated Use createStrokePointComponent(txn, ...) instead.\n */\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;\n public static createStrokePointComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePointProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\n }\n\n /** Create a file property for a new compound component using an explicit EditTxn.\n * @beta\n */\n public static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;\n /** Create a file property for a new compound component.\n * @deprecated Use createCompoundComponent(txn, ...) instead.\n */\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;\n public static createCompoundComponent(txnOrIModel: EditTxn | IModelDb, props: CompoundProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.Compound };\n }\n\n /** Create a file property for a new raster image component using an explicit EditTxn.\n * @beta\n */\n public static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n /** Create a file property for a new raster image component.\n * @deprecated Use createRasterComponent(txn, ...) instead.\n */\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n public static createRasterComponent(txnOrIModel: EditTxn | IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\n txn.saveFileProperty(rasterFileProps, undefined, image);\n props.imageId = rasterFileProps.id;\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\n }\n\n /** Query for an existing line style with the supplied name. */\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\n }\n\n /** Insert a new line style with the supplied name using an explicit EditTxn.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n /** Insert a new line style with the supplied name.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @deprecated Use createStyle(txn, ...) instead.\n */\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n public static createStyle(txnOrIModel: EditTxn | IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const imodel = txn.iModel;\n if (undefined === props.flags)\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\n\n const lsProps: LineStyleProps = {\n classFullName: \"BisCore:LineStyle\",\n model: scopeModelId,\n code: LineStyle.createCode(imodel, scopeModelId, name),\n data: JSON.stringify(props),\n };\n\n return txn.insertElement(lsProps);\n }\n\n /** Get the name that can be use to query for an existing continuous line style. */\n public static getContinuousStyleName(width?: number): string {\n if (width === undefined)\n return \"Continuous\";\n\n return `Continuous-${width}`;\n }\n\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\n * There are 2 ways to define a continuous line style:\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\n * - Width is specified in the style.\n * - Defined using a single stroke component that is a long dash.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String {\n const writeTxn = txn ?? imodel[_implicitTxn];\n const name = this.getContinuousStyleName(width);\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n if (undefined !== lsId)\n return lsId;\n\n if (width === undefined)\n return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n\n const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\n if (undefined === strokePatternData)\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\n\n return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n }\n\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\n */\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n return undefined;\n\n return `LinePixelsCodeNumber-${lineCode}`;\n }\n\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\n\n const name = `LinePixelsCodeNumber-${lineCode}`;\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\n }\n }\n}\n"]}
|
package/lib/esm/Material.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { Code, CodeScopeProps, ElementProps, NormalMapProps, RenderMaterialProps, RgbFactorProps, TextureMapProps } from "@itwin/core-common";
|
|
6
6
|
import { DefinitionElement } from "./Element";
|
|
7
|
+
import { EditTxn } from "./EditTxn";
|
|
7
8
|
import { IModelDb } from "./IModelDb";
|
|
8
9
|
import { IModelElementCloneContext } from "./IModelElementCloneContext";
|
|
9
10
|
import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "./Entity";
|
|
@@ -76,12 +77,18 @@ export declare class RenderMaterialElement extends DefinitionElement {
|
|
|
76
77
|
static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement;
|
|
77
78
|
/**
|
|
78
79
|
* Insert a new RenderMaterial into a model.
|
|
79
|
-
* @param
|
|
80
|
+
* @param txn The EditTxn to use
|
|
80
81
|
* @param definitionModelId Insert the new Texture into this DefinitionModel
|
|
81
82
|
* @param materialName The name/CodeValue of the RenderMaterial
|
|
82
83
|
* @param params Parameters object which describes how to construct the RenderMaterial
|
|
83
84
|
* @returns The Id of the newly inserted RenderMaterial element.
|
|
84
85
|
* @throws [[IModelError]] if unable to insert the element.
|
|
86
|
+
* @beta
|
|
87
|
+
*/
|
|
88
|
+
static insert(txn: EditTxn, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
|
|
89
|
+
/**
|
|
90
|
+
* Insert a new RenderMaterial into a model.
|
|
91
|
+
* @deprecated Use RenderMaterialElement.insert(txn, ...) instead.
|
|
85
92
|
*/
|
|
86
93
|
static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
|
|
87
94
|
/** @beta */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Material.d.ts","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACQ,IAAI,EAAE,cAAc,EAAoC,YAAY,EAAE,cA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;QAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;QAC5B,iHAAiH;QAC1G,KAAK,CAAC,EAAE,cAAc,CAAC;QAC9B,kEAAkE;QAC3D,aAAa,CAAC,EAAE,cAAc,CAAC;QACtC;;WAEG;QACI,MAAM,CAAC,EAAE,MAAM,CAAC;QACvB;;;;WAIG;QACI,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wEAAwE;QACjE,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,yEAAyE;QAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wBAAwB;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,wBAAwB;QACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B;;;WAGG;QACI,UAAU,CAAC,EAAE,eAAe,CAAC;QACpC;;;;WAIG;QACI,SAAS,CAAC,EAAE,cAAc,GAAG;YAClC;;eAEG;YACH,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QAEF,gJAAgJ;oBAC7H,WAAW,EAAE,MAAM;KAGvC;CACF;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB,CAAC,MAAM;CAChF"}
|
package/lib/esm/Material.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import { Id64, JsonUtils } from "@itwin/core-bentley";
|
|
9
9
|
import { BisCodeSpec, Code, } from "@itwin/core-common";
|
|
10
10
|
import { DefinitionElement } from "./Element";
|
|
11
|
+
import { EditTxn } from "./EditTxn";
|
|
12
|
+
import { _implicitTxn } from "./internal/Symbols";
|
|
11
13
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
12
14
|
/** A PhysicalMaterial defines the matter that makes up physical elements.
|
|
13
15
|
* @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.
|
|
@@ -178,18 +180,10 @@ export class RenderMaterialElement extends DefinitionElement {
|
|
|
178
180
|
};
|
|
179
181
|
return new RenderMaterialElement(renderMaterialProps, iModelDb);
|
|
180
182
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
* @param materialName The name/CodeValue of the RenderMaterial
|
|
186
|
-
* @param params Parameters object which describes how to construct the RenderMaterial
|
|
187
|
-
* @returns The Id of the newly inserted RenderMaterial element.
|
|
188
|
-
* @throws [[IModelError]] if unable to insert the element.
|
|
189
|
-
*/
|
|
190
|
-
static insert(iModelDb, definitionModelId, materialName, params) {
|
|
191
|
-
const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);
|
|
192
|
-
return iModelDb.elements.insertElement(renderMaterial.toJSON());
|
|
183
|
+
static insert(txnOrDb, definitionModelId, materialName, params) {
|
|
184
|
+
const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];
|
|
185
|
+
const renderMaterial = this.create(txn.iModel, definitionModelId, materialName, params);
|
|
186
|
+
return renderMaterial.insert(txn);
|
|
193
187
|
}
|
|
194
188
|
/** @beta */
|
|
195
189
|
static async onCloned(context, sourceProps, targetProps) {
|