@itwin/core-backend 5.0.0-dev.90 → 5.0.0-dev.92
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/esm/BackendHubAccess.d.ts +215 -0
- package/lib/esm/BackendHubAccess.d.ts.map +1 -0
- package/lib/esm/BackendHubAccess.js +41 -0
- package/lib/esm/BackendHubAccess.js.map +1 -0
- package/lib/esm/BackendLoggerCategory.d.ts +88 -0
- package/lib/esm/BackendLoggerCategory.d.ts.map +1 -0
- package/lib/esm/BackendLoggerCategory.js +93 -0
- package/lib/esm/BackendLoggerCategory.js.map +1 -0
- package/lib/esm/BisCoreSchema.d.ts +22 -0
- package/lib/esm/BisCoreSchema.d.ts.map +1 -0
- package/lib/esm/BisCoreSchema.js +61 -0
- package/lib/esm/BisCoreSchema.js.map +1 -0
- package/lib/esm/BlobContainerService.d.ts +159 -0
- package/lib/esm/BlobContainerService.d.ts.map +1 -0
- package/lib/esm/BlobContainerService.js +15 -0
- package/lib/esm/BlobContainerService.js.map +1 -0
- package/lib/esm/BriefcaseManager.d.ts +213 -0
- package/lib/esm/BriefcaseManager.d.ts.map +1 -0
- package/lib/esm/BriefcaseManager.js +520 -0
- package/lib/esm/BriefcaseManager.js.map +1 -0
- package/lib/esm/Category.d.ts +136 -0
- package/lib/esm/Category.d.ts.map +1 -0
- package/lib/esm/Category.js +224 -0
- package/lib/esm/Category.js.map +1 -0
- package/lib/esm/ChangeSummaryManager.d.ts +161 -0
- package/lib/esm/ChangeSummaryManager.d.ts.map +1 -0
- package/lib/esm/ChangeSummaryManager.js +414 -0
- package/lib/esm/ChangeSummaryManager.js.map +1 -0
- package/lib/esm/ChangedElementsDb.d.ts +101 -0
- package/lib/esm/ChangedElementsDb.d.ts.map +1 -0
- package/lib/esm/ChangedElementsDb.js +165 -0
- package/lib/esm/ChangedElementsDb.js.map +1 -0
- package/lib/esm/ChangesetECAdaptor.d.ts +203 -0
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -0
- package/lib/esm/ChangesetECAdaptor.js +814 -0
- package/lib/esm/ChangesetECAdaptor.js.map +1 -0
- package/lib/esm/ChannelControl.d.ts +68 -0
- package/lib/esm/ChannelControl.d.ts.map +1 -0
- package/lib/esm/ChannelControl.js +15 -0
- package/lib/esm/ChannelControl.js.map +1 -0
- package/lib/esm/CheckpointManager.d.ts +123 -0
- package/lib/esm/CheckpointManager.d.ts.map +1 -0
- package/lib/esm/CheckpointManager.js +375 -0
- package/lib/esm/CheckpointManager.js.map +1 -0
- package/lib/esm/ClassRegistry.d.ts +134 -0
- package/lib/esm/ClassRegistry.d.ts.map +1 -0
- package/lib/esm/ClassRegistry.js +324 -0
- package/lib/esm/ClassRegistry.js.map +1 -0
- package/lib/esm/CloudSqlite.d.ts +682 -0
- package/lib/esm/CloudSqlite.d.ts.map +1 -0
- package/lib/esm/CloudSqlite.js +511 -0
- package/lib/esm/CloudSqlite.js.map +1 -0
- package/lib/esm/CodeService.d.ts +402 -0
- package/lib/esm/CodeService.d.ts.map +1 -0
- package/lib/esm/CodeService.js +65 -0
- package/lib/esm/CodeService.js.map +1 -0
- package/lib/esm/CodeSpecs.d.ts +59 -0
- package/lib/esm/CodeSpecs.d.ts.map +1 -0
- package/lib/esm/CodeSpecs.js +152 -0
- package/lib/esm/CodeSpecs.js.map +1 -0
- package/lib/esm/ConcurrentQuery.d.ts +14 -0
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -0
- package/lib/esm/ConcurrentQuery.js +33 -0
- package/lib/esm/ConcurrentQuery.js.map +1 -0
- package/lib/esm/CustomViewState3dCreator.d.ts +22 -0
- package/lib/esm/CustomViewState3dCreator.d.ts.map +1 -0
- package/lib/esm/CustomViewState3dCreator.js +78 -0
- package/lib/esm/CustomViewState3dCreator.js.map +1 -0
- package/lib/esm/DevTools.d.ts +73 -0
- package/lib/esm/DevTools.d.ts.map +1 -0
- package/lib/esm/DevTools.js +153 -0
- package/lib/esm/DevTools.js.map +1 -0
- package/lib/esm/DisplayStyle.d.ts +99 -0
- package/lib/esm/DisplayStyle.d.ts.map +1 -0
- package/lib/esm/DisplayStyle.js +264 -0
- package/lib/esm/DisplayStyle.js.map +1 -0
- package/lib/esm/ECDb.d.ts +170 -0
- package/lib/esm/ECDb.d.ts.map +1 -0
- package/lib/esm/ECDb.js +329 -0
- package/lib/esm/ECDb.js.map +1 -0
- package/lib/esm/ECSchemaXmlContext.d.ts +46 -0
- package/lib/esm/ECSchemaXmlContext.d.ts.map +1 -0
- package/lib/esm/ECSchemaXmlContext.js +66 -0
- package/lib/esm/ECSchemaXmlContext.js.map +1 -0
- package/lib/esm/ECSqlStatement.d.ts +492 -0
- package/lib/esm/ECSqlStatement.d.ts.map +1 -0
- package/lib/esm/ECSqlStatement.js +810 -0
- package/lib/esm/ECSqlStatement.js.map +1 -0
- package/lib/esm/Element.d.ts +987 -0
- package/lib/esm/Element.d.ts.map +1 -0
- package/lib/esm/Element.js +1337 -0
- package/lib/esm/Element.js.map +1 -0
- package/lib/esm/ElementAspect.d.ts +164 -0
- package/lib/esm/ElementAspect.d.ts.map +1 -0
- package/lib/esm/ElementAspect.js +204 -0
- package/lib/esm/ElementAspect.js.map +1 -0
- package/lib/esm/ElementGraphics.d.ts +7 -0
- package/lib/esm/ElementGraphics.d.ts.map +1 -0
- package/lib/esm/ElementGraphics.js +36 -0
- package/lib/esm/ElementGraphics.js.map +1 -0
- package/lib/esm/ElementTreeWalker.d.ts +182 -0
- package/lib/esm/ElementTreeWalker.d.ts.map +1 -0
- package/lib/esm/ElementTreeWalker.js +421 -0
- package/lib/esm/ElementTreeWalker.js.map +1 -0
- package/lib/esm/Entity.d.ts +142 -0
- package/lib/esm/Entity.d.ts.map +1 -0
- package/lib/esm/Entity.js +186 -0
- package/lib/esm/Entity.js.map +1 -0
- package/lib/esm/EntityReferences.d.ts +50 -0
- package/lib/esm/EntityReferences.d.ts.map +1 -0
- package/lib/esm/EntityReferences.js +92 -0
- package/lib/esm/EntityReferences.js.map +1 -0
- package/lib/esm/ExportGraphics.d.ts +318 -0
- package/lib/esm/ExportGraphics.d.ts.map +1 -0
- package/lib/esm/ExportGraphics.js +209 -0
- package/lib/esm/ExportGraphics.js.map +1 -0
- package/lib/esm/ExternalSource.d.ts +89 -0
- package/lib/esm/ExternalSource.d.ts.map +1 -0
- package/lib/esm/ExternalSource.js +139 -0
- package/lib/esm/ExternalSource.js.map +1 -0
- package/lib/esm/FontFile.d.ts +68 -0
- package/lib/esm/FontFile.d.ts.map +1 -0
- package/lib/esm/FontFile.js +33 -0
- package/lib/esm/FontFile.js.map +1 -0
- package/lib/esm/GeoCoordConfig.d.ts +30 -0
- package/lib/esm/GeoCoordConfig.d.ts.map +1 -0
- package/lib/esm/GeoCoordConfig.js +78 -0
- package/lib/esm/GeoCoordConfig.js.map +1 -0
- package/lib/esm/GeographicCRSServices.d.ts +40 -0
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -0
- package/lib/esm/GeographicCRSServices.js +17 -0
- package/lib/esm/GeographicCRSServices.js.map +1 -0
- package/lib/esm/GeometrySummary.d.ts +5 -0
- package/lib/esm/GeometrySummary.d.ts.map +1 -0
- package/lib/esm/GeometrySummary.js +381 -0
- package/lib/esm/GeometrySummary.js.map +1 -0
- package/lib/esm/HubMock.d.ts +95 -0
- package/lib/esm/HubMock.d.ts.map +1 -0
- package/lib/esm/HubMock.js +220 -0
- package/lib/esm/HubMock.js.map +1 -0
- package/lib/esm/IModelDb.d.ts +1398 -0
- package/lib/esm/IModelDb.d.ts.map +1 -0
- package/lib/esm/IModelDb.js +3230 -0
- package/lib/esm/IModelDb.js.map +1 -0
- package/lib/esm/IModelDbFonts.d.ts +54 -0
- package/lib/esm/IModelDbFonts.d.ts.map +1 -0
- package/lib/esm/IModelDbFonts.js +9 -0
- package/lib/esm/IModelDbFonts.js.map +1 -0
- package/lib/esm/IModelElementCloneContext.d.ts +92 -0
- package/lib/esm/IModelElementCloneContext.d.ts.map +1 -0
- package/lib/esm/IModelElementCloneContext.js +168 -0
- package/lib/esm/IModelElementCloneContext.js.map +1 -0
- package/lib/esm/IModelHost.d.ts +387 -0
- package/lib/esm/IModelHost.d.ts.map +1 -0
- package/lib/esm/IModelHost.js +502 -0
- package/lib/esm/IModelHost.js.map +1 -0
- package/lib/esm/IModelJsFs.d.ts +62 -0
- package/lib/esm/IModelJsFs.d.ts.map +1 -0
- package/lib/esm/IModelJsFs.js +151 -0
- package/lib/esm/IModelJsFs.js.map +1 -0
- package/lib/esm/ImageSourceConversion.d.ts +49 -0
- package/lib/esm/ImageSourceConversion.d.ts.map +1 -0
- package/lib/esm/ImageSourceConversion.js +33 -0
- package/lib/esm/ImageSourceConversion.js.map +1 -0
- package/lib/esm/IpcHost.d.ts +111 -0
- package/lib/esm/IpcHost.d.ts.map +1 -0
- package/lib/esm/IpcHost.js +311 -0
- package/lib/esm/IpcHost.js.map +1 -0
- package/lib/esm/LineStyle.d.ts +312 -0
- package/lib/esm/LineStyle.d.ts.map +1 -0
- package/lib/esm/LineStyle.js +293 -0
- package/lib/esm/LineStyle.js.map +1 -0
- package/lib/esm/LocalHub.d.ts +163 -0
- package/lib/esm/LocalHub.d.ts.map +1 -0
- package/lib/esm/LocalHub.js +583 -0
- package/lib/esm/LocalHub.js.map +1 -0
- package/lib/esm/LocalhostIpcHost.d.ts +22 -0
- package/lib/esm/LocalhostIpcHost.d.ts.map +1 -0
- package/lib/esm/LocalhostIpcHost.js +74 -0
- package/lib/esm/LocalhostIpcHost.js.map +1 -0
- package/lib/esm/LockControl.d.ts +73 -0
- package/lib/esm/LockControl.d.ts.map +1 -0
- package/lib/esm/LockControl.js +9 -0
- package/lib/esm/LockControl.js.map +1 -0
- package/lib/esm/Material.d.ts +131 -0
- package/lib/esm/Material.d.ts.map +1 -0
- package/lib/esm/Material.js +235 -0
- package/lib/esm/Material.js.map +1 -0
- package/lib/esm/Model.d.ts +375 -0
- package/lib/esm/Model.d.ts.map +1 -0
- package/lib/esm/Model.js +484 -0
- package/lib/esm/Model.js.map +1 -0
- package/lib/esm/NativeAppStorage.d.ts +52 -0
- package/lib/esm/NativeAppStorage.d.ts.map +1 -0
- package/lib/esm/NativeAppStorage.js +205 -0
- package/lib/esm/NativeAppStorage.js.map +1 -0
- package/lib/esm/NativeHost.d.ts +53 -0
- package/lib/esm/NativeHost.d.ts.map +1 -0
- package/lib/esm/NativeHost.js +158 -0
- package/lib/esm/NativeHost.js.map +1 -0
- package/lib/esm/NavigationRelationship.d.ts +185 -0
- package/lib/esm/NavigationRelationship.d.ts.map +1 -0
- package/lib/esm/NavigationRelationship.js +238 -0
- package/lib/esm/NavigationRelationship.js.map +1 -0
- package/lib/esm/PromiseMemoizer.d.ts +48 -0
- package/lib/esm/PromiseMemoizer.d.ts.map +1 -0
- package/lib/esm/PromiseMemoizer.js +101 -0
- package/lib/esm/PromiseMemoizer.js.map +1 -0
- package/lib/esm/PropertyStore.d.ts +134 -0
- package/lib/esm/PropertyStore.d.ts.map +1 -0
- package/lib/esm/PropertyStore.js +177 -0
- package/lib/esm/PropertyStore.js.map +1 -0
- package/lib/esm/Relationship.d.ts +399 -0
- package/lib/esm/Relationship.d.ts.map +1 -0
- package/lib/esm/Relationship.js +474 -0
- package/lib/esm/Relationship.js.map +1 -0
- package/lib/esm/RpcBackend.d.ts +6 -0
- package/lib/esm/RpcBackend.d.ts.map +1 -0
- package/lib/esm/RpcBackend.js +28 -0
- package/lib/esm/RpcBackend.js.map +1 -0
- package/lib/esm/SQLiteDb.d.ts +324 -0
- package/lib/esm/SQLiteDb.d.ts.map +1 -0
- package/lib/esm/SQLiteDb.js +379 -0
- package/lib/esm/SQLiteDb.js.map +1 -0
- package/lib/esm/Schema.d.ts +79 -0
- package/lib/esm/Schema.d.ts.map +1 -0
- package/lib/esm/Schema.js +113 -0
- package/lib/esm/Schema.js.map +1 -0
- package/lib/esm/SchemaSync.d.ts +47 -0
- package/lib/esm/SchemaSync.d.ts.map +1 -0
- package/lib/esm/SchemaSync.js +148 -0
- package/lib/esm/SchemaSync.js.map +1 -0
- package/lib/esm/SchemaUtils.d.ts +19 -0
- package/lib/esm/SchemaUtils.d.ts.map +1 -0
- package/lib/esm/SchemaUtils.js +37 -0
- package/lib/esm/SchemaUtils.js.map +1 -0
- package/lib/esm/SheetIndex.d.ts +148 -0
- package/lib/esm/SheetIndex.d.ts.map +1 -0
- package/lib/esm/SheetIndex.js +228 -0
- package/lib/esm/SheetIndex.js.map +1 -0
- package/lib/esm/SqliteChangesetReader.d.ts +278 -0
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -0
- package/lib/esm/SqliteChangesetReader.js +337 -0
- package/lib/esm/SqliteChangesetReader.js.map +1 -0
- package/lib/esm/SqliteStatement.d.ts +375 -0
- package/lib/esm/SqliteStatement.d.ts.map +1 -0
- package/lib/esm/SqliteStatement.js +615 -0
- package/lib/esm/SqliteStatement.js.map +1 -0
- package/lib/esm/TextAnnotationElement.d.ts +54 -0
- package/lib/esm/TextAnnotationElement.d.ts.map +1 -0
- package/lib/esm/TextAnnotationElement.js +89 -0
- package/lib/esm/TextAnnotationElement.js.map +1 -0
- package/lib/esm/TextAnnotationGeometry.d.ts +32 -0
- package/lib/esm/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/esm/TextAnnotationGeometry.js +181 -0
- package/lib/esm/TextAnnotationGeometry.js.map +1 -0
- package/lib/esm/TextAnnotationLayout.d.ts +177 -0
- package/lib/esm/TextAnnotationLayout.d.ts.map +1 -0
- package/lib/esm/TextAnnotationLayout.js +513 -0
- package/lib/esm/TextAnnotationLayout.js.map +1 -0
- package/lib/esm/Texture.d.ts +58 -0
- package/lib/esm/Texture.d.ts.map +1 -0
- package/lib/esm/Texture.js +81 -0
- package/lib/esm/Texture.js.map +1 -0
- package/lib/esm/TileStorage.d.ts +59 -0
- package/lib/esm/TileStorage.d.ts.map +1 -0
- package/lib/esm/TileStorage.js +158 -0
- package/lib/esm/TileStorage.js.map +1 -0
- package/lib/esm/TxnManager.d.ts +296 -0
- package/lib/esm/TxnManager.d.ts.map +1 -0
- package/lib/esm/TxnManager.js +619 -0
- package/lib/esm/TxnManager.js.map +1 -0
- package/lib/esm/ViewDefinition.d.ts +392 -0
- package/lib/esm/ViewDefinition.d.ts.map +1 -0
- package/lib/esm/ViewDefinition.js +638 -0
- package/lib/esm/ViewDefinition.js.map +1 -0
- package/lib/esm/ViewStateHydrator.d.ts +14 -0
- package/lib/esm/ViewStateHydrator.d.ts.map +1 -0
- package/lib/esm/ViewStateHydrator.js +89 -0
- package/lib/esm/ViewStateHydrator.js.map +1 -0
- package/lib/esm/ViewStore.d.ts +502 -0
- package/lib/esm/ViewStore.d.ts.map +1 -0
- package/lib/esm/ViewStore.js +1259 -0
- package/lib/esm/ViewStore.js.map +1 -0
- package/lib/esm/core-backend.d.ts +183 -0
- package/lib/esm/core-backend.d.ts.map +1 -0
- package/lib/esm/core-backend.js +187 -0
- package/lib/esm/core-backend.js.map +1 -0
- package/lib/esm/domains/FunctionalElements.d.ts +86 -0
- package/lib/esm/domains/FunctionalElements.d.ts.map +1 -0
- package/lib/esm/domains/FunctionalElements.js +117 -0
- package/lib/esm/domains/FunctionalElements.js.map +1 -0
- package/lib/esm/domains/FunctionalSchema.d.ts +14 -0
- package/lib/esm/domains/FunctionalSchema.d.ts.map +1 -0
- package/lib/esm/domains/FunctionalSchema.js +37 -0
- package/lib/esm/domains/FunctionalSchema.js.map +1 -0
- package/lib/esm/domains/GenericElements.d.ts +160 -0
- package/lib/esm/domains/GenericElements.d.ts.map +1 -0
- package/lib/esm/domains/GenericElements.js +225 -0
- package/lib/esm/domains/GenericElements.js.map +1 -0
- package/lib/esm/domains/GenericSchema.d.ts +11 -0
- package/lib/esm/domains/GenericSchema.d.ts.map +1 -0
- package/lib/esm/domains/GenericSchema.js +25 -0
- package/lib/esm/domains/GenericSchema.js.map +1 -0
- package/lib/esm/internal/ChangesetConflictArgs.d.ts +62 -0
- package/lib/esm/internal/ChangesetConflictArgs.d.ts.map +1 -0
- package/lib/esm/internal/ChangesetConflictArgs.js +104 -0
- package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -0
- package/lib/esm/internal/ChannelAdmin.d.ts +34 -0
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -0
- package/lib/esm/internal/ChannelAdmin.js +122 -0
- package/lib/esm/internal/ChannelAdmin.js.map +1 -0
- package/lib/esm/internal/FontFileImpl.d.ts +34 -0
- package/lib/esm/internal/FontFileImpl.d.ts.map +1 -0
- package/lib/esm/internal/FontFileImpl.js +135 -0
- package/lib/esm/internal/FontFileImpl.js.map +1 -0
- package/lib/esm/internal/IModelDbFontsImpl.d.ts +7 -0
- package/lib/esm/internal/IModelDbFontsImpl.d.ts.map +1 -0
- package/lib/esm/internal/IModelDbFontsImpl.js +183 -0
- package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -0
- package/lib/esm/internal/NativePlatform.d.ts +15 -0
- package/lib/esm/internal/NativePlatform.d.ts.map +1 -0
- package/lib/esm/internal/NativePlatform.js +43 -0
- package/lib/esm/internal/NativePlatform.js.map +1 -0
- package/lib/esm/internal/NoLocks.d.ts +6 -0
- package/lib/esm/internal/NoLocks.d.ts.map +1 -0
- package/lib/esm/internal/NoLocks.js +24 -0
- package/lib/esm/internal/NoLocks.js.map +1 -0
- package/lib/esm/internal/ServerBasedLocks.d.ts +52 -0
- package/lib/esm/internal/ServerBasedLocks.d.ts.map +1 -0
- package/lib/esm/internal/ServerBasedLocks.js +175 -0
- package/lib/esm/internal/ServerBasedLocks.js.map +1 -0
- package/lib/esm/internal/Symbols.d.ts +18 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -0
- package/lib/esm/internal/Symbols.js +25 -0
- package/lib/esm/internal/Symbols.js.map +1 -0
- package/lib/esm/internal/cross-package.d.ts +4 -0
- package/lib/esm/internal/cross-package.d.ts.map +1 -0
- package/lib/esm/internal/cross-package.js +8 -0
- package/lib/esm/internal/cross-package.js.map +1 -0
- package/lib/esm/internal/workspace/SettingsImpl.d.ts +43 -0
- package/lib/esm/internal/workspace/SettingsImpl.d.ts.map +1 -0
- package/lib/esm/internal/workspace/SettingsImpl.js +154 -0
- package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -0
- package/lib/esm/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
- package/lib/esm/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
- package/lib/esm/internal/workspace/SettingsSchemasImpl.js +268 -0
- package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -0
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts +41 -0
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
- package/lib/esm/internal/workspace/WorkspaceImpl.js +691 -0
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -0
- package/lib/esm/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
- package/lib/esm/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
- package/lib/esm/internal/workspace/WorkspaceSqliteDb.js +35 -0
- package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
- package/lib/esm/rpc/multipart.d.ts +12 -0
- package/lib/esm/rpc/multipart.d.ts.map +1 -0
- package/lib/esm/rpc/multipart.js +67 -0
- package/lib/esm/rpc/multipart.js.map +1 -0
- package/lib/esm/rpc/tracing.d.ts +29 -0
- package/lib/esm/rpc/tracing.d.ts.map +1 -0
- package/lib/esm/rpc/tracing.js +71 -0
- package/lib/esm/rpc/tracing.js.map +1 -0
- package/lib/esm/rpc/web/logging.d.ts +10 -0
- package/lib/esm/rpc/web/logging.d.ts.map +1 -0
- package/lib/esm/rpc/web/logging.js +41 -0
- package/lib/esm/rpc/web/logging.js.map +1 -0
- package/lib/esm/rpc/web/request.d.ts +7 -0
- package/lib/esm/rpc/web/request.d.ts.map +1 -0
- package/lib/esm/rpc/web/request.js +71 -0
- package/lib/esm/rpc/web/request.js.map +1 -0
- package/lib/esm/rpc/web/response.d.ts +7 -0
- package/lib/esm/rpc/web/response.d.ts.map +1 -0
- package/lib/esm/rpc/web/response.js +136 -0
- package/lib/esm/rpc/web/response.js.map +1 -0
- package/lib/esm/rpc-impl/DevToolsRpcImpl.d.ts +16 -0
- package/lib/esm/rpc-impl/DevToolsRpcImpl.d.ts.map +1 -0
- package/lib/esm/rpc-impl/DevToolsRpcImpl.js +29 -0
- package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +51 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +313 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -0
- package/lib/esm/rpc-impl/IModelTileRpcImpl.d.ts +21 -0
- package/lib/esm/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -0
- package/lib/esm/rpc-impl/IModelTileRpcImpl.js +193 -0
- package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -0
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +45 -0
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -0
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js +166 -0
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -0
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +18 -0
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts.map +1 -0
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +41 -0
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -0
- package/lib/esm/test/AdvancedEqual.d.ts +38 -0
- package/lib/esm/test/AdvancedEqual.d.ts.map +1 -0
- package/lib/esm/test/AdvancedEqual.js +67 -0
- package/lib/esm/test/AdvancedEqual.js.map +1 -0
- package/lib/esm/test/AttachDb.test.d.ts +2 -0
- package/lib/esm/test/AttachDb.test.d.ts.map +1 -0
- package/lib/esm/test/AttachDb.test.js +157 -0
- package/lib/esm/test/AttachDb.test.js.map +1 -0
- package/lib/esm/test/GeometryTestUtil.d.ts +7 -0
- package/lib/esm/test/GeometryTestUtil.d.ts.map +1 -0
- package/lib/esm/test/GeometryTestUtil.js +25 -0
- package/lib/esm/test/GeometryTestUtil.js.map +1 -0
- package/lib/esm/test/IModelHost.test.d.ts +2 -0
- package/lib/esm/test/IModelHost.test.d.ts.map +1 -0
- package/lib/esm/test/IModelHost.test.js +187 -0
- package/lib/esm/test/IModelHost.test.js.map +1 -0
- package/lib/esm/test/IModelTestUtils.d.ts +173 -0
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -0
- package/lib/esm/test/IModelTestUtils.js +1113 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -0
- package/lib/esm/test/ImageSourceConversion.test.d.ts +2 -0
- package/lib/esm/test/ImageSourceConversion.test.d.ts.map +1 -0
- package/lib/esm/test/ImageSourceConversion.test.js +171 -0
- package/lib/esm/test/ImageSourceConversion.test.js.map +1 -0
- package/lib/esm/test/IpcHost.test.d.ts +2 -0
- package/lib/esm/test/IpcHost.test.d.ts.map +1 -0
- package/lib/esm/test/IpcHost.test.js +55 -0
- package/lib/esm/test/IpcHost.test.js.map +1 -0
- package/lib/esm/test/KnownTestLocations.d.ts +7 -0
- package/lib/esm/test/KnownTestLocations.d.ts.map +1 -0
- package/lib/esm/test/KnownTestLocations.js +27 -0
- package/lib/esm/test/KnownTestLocations.js.map +1 -0
- package/lib/esm/test/PrintElementTree.d.ts +7 -0
- package/lib/esm/test/PrintElementTree.d.ts.map +1 -0
- package/lib/esm/test/PrintElementTree.js +35 -0
- package/lib/esm/test/PrintElementTree.js.map +1 -0
- package/lib/esm/test/PropertyDb.test.d.ts +2 -0
- package/lib/esm/test/PropertyDb.test.d.ts.map +1 -0
- package/lib/esm/test/PropertyDb.test.js +71 -0
- package/lib/esm/test/PropertyDb.test.js.map +1 -0
- package/lib/esm/test/RevisionUtility.d.ts +33 -0
- package/lib/esm/test/RevisionUtility.d.ts.map +1 -0
- package/lib/esm/test/RevisionUtility.js +52 -0
- package/lib/esm/test/RevisionUtility.js.map +1 -0
- package/lib/esm/test/SchemaUtils.test.d.ts +2 -0
- package/lib/esm/test/SchemaUtils.test.d.ts.map +1 -0
- package/lib/esm/test/SchemaUtils.test.js +97 -0
- package/lib/esm/test/SchemaUtils.test.js.map +1 -0
- package/lib/esm/test/SequentialLogMatcher.d.ts +35 -0
- package/lib/esm/test/SequentialLogMatcher.d.ts.map +1 -0
- package/lib/esm/test/SequentialLogMatcher.js +130 -0
- package/lib/esm/test/SequentialLogMatcher.js.map +1 -0
- package/lib/esm/test/TestChangeSetUtility.d.ts +23 -0
- package/lib/esm/test/TestChangeSetUtility.d.ts.map +1 -0
- package/lib/esm/test/TestChangeSetUtility.js +65 -0
- package/lib/esm/test/TestChangeSetUtility.js.map +1 -0
- package/lib/esm/test/TestUtils.d.ts +38 -0
- package/lib/esm/test/TestUtils.d.ts.map +1 -0
- package/lib/esm/test/TestUtils.js +99 -0
- package/lib/esm/test/TestUtils.js.map +1 -0
- package/lib/esm/test/annotations/TextAnnotation.test.d.ts +2 -0
- package/lib/esm/test/annotations/TextAnnotation.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/TextAnnotation.test.js +1135 -0
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -0
- package/lib/esm/test/categories/Category.test.d.ts +2 -0
- package/lib/esm/test/categories/Category.test.d.ts.map +1 -0
- package/lib/esm/test/categories/Category.test.js +51 -0
- package/lib/esm/test/categories/Category.test.js.map +1 -0
- package/lib/esm/test/codespec/CodeSpec.test.d.ts +2 -0
- package/lib/esm/test/codespec/CodeSpec.test.d.ts.map +1 -0
- package/lib/esm/test/codespec/CodeSpec.test.js +51 -0
- package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -0
- package/lib/esm/test/ecdb/CTE.test.d.ts +2 -0
- package/lib/esm/test/ecdb/CTE.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/CTE.test.js +177 -0
- package/lib/esm/test/ecdb/CTE.test.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +167 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECDb.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ECDb.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECDb.test.js +642 -0
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECDbTestHelper.d.ts +5 -0
- package/lib/esm/test/ecdb/ECDbTestHelper.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECDbTestHelper.js +28 -0
- package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -0
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js +63 -0
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECSqlAst.test.d.ts +5 -0
- package/lib/esm/test/ecdb/ECSqlAst.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECSqlAst.test.js +971 -0
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +770 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECSqlReader.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ECSqlReader.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECSqlReader.test.js +669 -0
- package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECSqlStatement.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ECSqlStatement.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +3239 -0
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.d.ts +2 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.js +508 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -0
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts +4 -0
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -0
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +127 -0
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.d.ts +2 -0
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.d.ts.map +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +196 -0
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestParser.d.ts +66 -0
- package/lib/esm/test/ecsql/src/ECSqlTestParser.d.ts.map +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestParser.js +420 -0
- package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.d.ts +2 -0
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.d.ts.map +1 -0
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +365 -0
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -0
- package/lib/esm/test/element/DeleteDefinitionElements.test.d.ts +2 -0
- package/lib/esm/test/element/DeleteDefinitionElements.test.d.ts.map +1 -0
- package/lib/esm/test/element/DeleteDefinitionElements.test.js +208 -0
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -0
- package/lib/esm/test/element/ElementAspect.test.d.ts +2 -0
- package/lib/esm/test/element/ElementAspect.test.d.ts.map +1 -0
- package/lib/esm/test/element/ElementAspect.test.js +363 -0
- package/lib/esm/test/element/ElementAspect.test.js.map +1 -0
- package/lib/esm/test/element/ElementDependencyGraph.test.d.ts +2 -0
- package/lib/esm/test/element/ElementDependencyGraph.test.d.ts.map +1 -0
- package/lib/esm/test/element/ElementDependencyGraph.test.js +383 -0
- package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -0
- package/lib/esm/test/element/ElementRoundTrip.test.d.ts +2 -0
- package/lib/esm/test/element/ElementRoundTrip.test.d.ts.map +1 -0
- package/lib/esm/test/element/ElementRoundTrip.test.js +916 -0
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -0
- package/lib/esm/test/element/ExcludedElements.test.d.ts +2 -0
- package/lib/esm/test/element/ExcludedElements.test.d.ts.map +1 -0
- package/lib/esm/test/element/ExcludedElements.test.js +57 -0
- package/lib/esm/test/element/ExcludedElements.test.js.map +1 -0
- package/lib/esm/test/element/ExternalSource.test.d.ts +2 -0
- package/lib/esm/test/element/ExternalSource.test.d.ts.map +1 -0
- package/lib/esm/test/element/ExternalSource.test.js +107 -0
- package/lib/esm/test/element/ExternalSource.test.js.map +1 -0
- package/lib/esm/test/element/NullStructArray.test.d.ts +2 -0
- package/lib/esm/test/element/NullStructArray.test.d.ts.map +1 -0
- package/lib/esm/test/element/NullStructArray.test.js +77 -0
- package/lib/esm/test/element/NullStructArray.test.js.map +1 -0
- package/lib/esm/test/element/UrlLink.test.d.ts +2 -0
- package/lib/esm/test/element/UrlLink.test.d.ts.map +1 -0
- package/lib/esm/test/element/UrlLink.test.js +36 -0
- package/lib/esm/test/element/UrlLink.test.js.map +1 -0
- package/lib/esm/test/font/FontFile.test.d.ts +2 -0
- package/lib/esm/test/font/FontFile.test.d.ts.map +1 -0
- package/lib/esm/test/font/FontFile.test.js +139 -0
- package/lib/esm/test/font/FontFile.test.js.map +1 -0
- package/lib/esm/test/font/IModelDbFonts.test.d.ts +2 -0
- package/lib/esm/test/font/IModelDbFonts.test.d.ts.map +1 -0
- package/lib/esm/test/font/IModelDbFonts.test.js +264 -0
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -0
- package/lib/esm/test/hubaccess/BriefcaseManager.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/BriefcaseManager.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +165 -0
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -0
- package/lib/esm/test/hubaccess/CheckpointManager.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/CheckpointManager.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/CheckpointManager.test.js +137 -0
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -0
- package/lib/esm/test/imageData.d.ts +9 -0
- package/lib/esm/test/imageData.d.ts.map +1 -0
- package/lib/esm/test/imageData.js +16 -0
- package/lib/esm/test/imageData.js.map +1 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.d.ts +2 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.js +382 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -0
- package/lib/esm/test/imodel/GetTextureImage.test.d.ts +2 -0
- package/lib/esm/test/imodel/GetTextureImage.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/GetTextureImage.test.js +29 -0
- package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -0
- package/lib/esm/test/imodel/IModel.test.d.ts +2 -0
- package/lib/esm/test/imodel/IModel.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/IModel.test.js +2601 -0
- package/lib/esm/test/imodel/IModel.test.js.map +1 -0
- package/lib/esm/test/imodel/ProjectExtents.test.d.ts +2 -0
- package/lib/esm/test/imodel/ProjectExtents.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/ProjectExtents.test.js +66 -0
- package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.d.ts +2 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.js +74 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -0
- package/lib/esm/test/index.d.ts +7 -0
- package/lib/esm/test/index.d.ts.map +1 -0
- package/lib/esm/test/index.js +11 -0
- package/lib/esm/test/index.js.map +1 -0
- package/lib/esm/test/misc/DevTools.test.d.ts +2 -0
- package/lib/esm/test/misc/DevTools.test.d.ts.map +1 -0
- package/lib/esm/test/misc/DevTools.test.js +72 -0
- package/lib/esm/test/misc/DevTools.test.js.map +1 -0
- package/lib/esm/test/misc/EntitySubClasses.test.d.ts +2 -0
- package/lib/esm/test/misc/EntitySubClasses.test.d.ts.map +1 -0
- package/lib/esm/test/misc/EntitySubClasses.test.js +106 -0
- package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -0
- package/lib/esm/test/misc/GeoServices.test.d.ts +2 -0
- package/lib/esm/test/misc/GeoServices.test.d.ts.map +1 -0
- package/lib/esm/test/misc/GeoServices.test.js +850 -0
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -0
- package/lib/esm/test/misc/PromiseMemoizer.test.d.ts +2 -0
- package/lib/esm/test/misc/PromiseMemoizer.test.d.ts.map +1 -0
- package/lib/esm/test/misc/PromiseMemoizer.test.js +111 -0
- package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -0
- package/lib/esm/test/native/DgnDbWorker.test.d.ts +2 -0
- package/lib/esm/test/native/DgnDbWorker.test.d.ts.map +1 -0
- package/lib/esm/test/native/DgnDbWorker.test.js +159 -0
- package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -0
- package/lib/esm/test/rpc/response.test.d.ts +2 -0
- package/lib/esm/test/rpc/response.test.d.ts.map +1 -0
- package/lib/esm/test/rpc/response.test.js +112 -0
- package/lib/esm/test/rpc/response.test.js.map +1 -0
- package/lib/esm/test/schema/ClassRegistry.test.d.ts +2 -0
- package/lib/esm/test/schema/ClassRegistry.test.d.ts.map +1 -0
- package/lib/esm/test/schema/ClassRegistry.test.js +679 -0
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -0
- package/lib/esm/test/schema/FunctionalDomain.test.d.ts +2 -0
- package/lib/esm/test/schema/FunctionalDomain.test.d.ts.map +1 -0
- package/lib/esm/test/schema/FunctionalDomain.test.js +490 -0
- package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -0
- package/lib/esm/test/schema/GenericDomain.test.d.ts +2 -0
- package/lib/esm/test/schema/GenericDomain.test.d.ts.map +1 -0
- package/lib/esm/test/schema/GenericDomain.test.js +132 -0
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -0
- package/lib/esm/test/schema/IModelSchemaContext.test.d.ts +2 -0
- package/lib/esm/test/schema/IModelSchemaContext.test.d.ts.map +1 -0
- package/lib/esm/test/schema/IModelSchemaContext.test.js +95 -0
- package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -0
- package/lib/esm/test/sheetindex/SheetIndex.test.d.ts +4 -0
- package/lib/esm/test/sheetindex/SheetIndex.test.d.ts.map +1 -0
- package/lib/esm/test/sheetindex/SheetIndex.test.js +312 -0
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -0
- package/lib/esm/test/standalone/ChangeMerge.test.d.ts +2 -0
- package/lib/esm/test/standalone/ChangeMerge.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ChangeMerge.test.js +413 -0
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -0
- package/lib/esm/test/standalone/ChangesetReader.test.d.ts +2 -0
- package/lib/esm/test/standalone/ChangesetReader.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ChangesetReader.test.js +890 -0
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -0
- package/lib/esm/test/standalone/CustomViewState3dCreator.test.d.ts +2 -0
- package/lib/esm/test/standalone/CustomViewState3dCreator.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/CustomViewState3dCreator.test.js +49 -0
- package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -0
- package/lib/esm/test/standalone/DisplayStyle.test.d.ts +2 -0
- package/lib/esm/test/standalone/DisplayStyle.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/DisplayStyle.test.js +136 -0
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -0
- package/lib/esm/test/standalone/ElementGraphics.test.d.ts +2 -0
- package/lib/esm/test/standalone/ElementGraphics.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ElementGraphics.test.js +127 -0
- package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -0
- package/lib/esm/test/standalone/ElementMesh.test.d.ts +2 -0
- package/lib/esm/test/standalone/ElementMesh.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ElementMesh.test.js +142 -0
- package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -0
- package/lib/esm/test/standalone/ExportGraphics.test.d.ts +2 -0
- package/lib/esm/test/standalone/ExportGraphics.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ExportGraphics.test.js +1040 -0
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -0
- package/lib/esm/test/standalone/GeometryChangeEvents.test.d.ts +2 -0
- package/lib/esm/test/standalone/GeometryChangeEvents.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js +139 -0
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -0
- package/lib/esm/test/standalone/GeometryStream.test.d.ts +2 -0
- package/lib/esm/test/standalone/GeometryStream.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/GeometryStream.test.js +2869 -0
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -0
- package/lib/esm/test/standalone/HubMock.test.d.ts +2 -0
- package/lib/esm/test/standalone/HubMock.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/HubMock.test.js +343 -0
- package/lib/esm/test/standalone/HubMock.test.js.map +1 -0
- package/lib/esm/test/standalone/IModelWrite.test.d.ts +7 -0
- package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/IModelWrite.test.js +859 -0
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -0
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.d.ts +2 -0
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js +417 -0
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -0
- package/lib/esm/test/standalone/MergeConflict.test.d.ts +7 -0
- package/lib/esm/test/standalone/MergeConflict.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/MergeConflict.test.js +345 -0
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -0
- package/lib/esm/test/standalone/NativeAppStorage.test.d.ts +2 -0
- package/lib/esm/test/standalone/NativeAppStorage.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/NativeAppStorage.test.js +121 -0
- package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.d.ts +2 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +398 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -0
- package/lib/esm/test/standalone/RenderTimeline.test.d.ts +2 -0
- package/lib/esm/test/standalone/RenderTimeline.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/RenderTimeline.test.js +71 -0
- package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -0
- package/lib/esm/test/standalone/SQLiteDb.test.d.ts +2 -0
- package/lib/esm/test/standalone/SQLiteDb.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SQLiteDb.test.js +63 -0
- package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -0
- package/lib/esm/test/standalone/SchemaUtils.test.d.ts +2 -0
- package/lib/esm/test/standalone/SchemaUtils.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SchemaUtils.test.js +25 -0
- package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -0
- package/lib/esm/test/standalone/SectionDrawing.test.d.ts +2 -0
- package/lib/esm/test/standalone/SectionDrawing.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SectionDrawing.test.js +83 -0
- package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -0
- package/lib/esm/test/standalone/ServerBasedLocks.test.d.ts +2 -0
- package/lib/esm/test/standalone/ServerBasedLocks.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ServerBasedLocks.test.js +279 -0
- package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -0
- package/lib/esm/test/standalone/Setting.test.d.ts +2 -0
- package/lib/esm/test/standalone/Setting.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/Setting.test.js +76 -0
- package/lib/esm/test/standalone/Setting.test.js.map +1 -0
- package/lib/esm/test/standalone/Settings.test.d.ts +2 -0
- package/lib/esm/test/standalone/Settings.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/Settings.test.js +349 -0
- package/lib/esm/test/standalone/Settings.test.js.map +1 -0
- package/lib/esm/test/standalone/SettingsSchemas.test.d.ts +2 -0
- package/lib/esm/test/standalone/SettingsSchemas.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SettingsSchemas.test.js +31 -0
- package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -0
- package/lib/esm/test/standalone/SnapshotDb.test.d.ts +2 -0
- package/lib/esm/test/standalone/SnapshotDb.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SnapshotDb.test.js +153 -0
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -0
- package/lib/esm/test/standalone/Texture.test.d.ts +2 -0
- package/lib/esm/test/standalone/Texture.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/Texture.test.js +90 -0
- package/lib/esm/test/standalone/Texture.test.js.map +1 -0
- package/lib/esm/test/standalone/TileCache.test.d.ts +9 -0
- package/lib/esm/test/standalone/TileCache.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/TileCache.test.js +127 -0
- package/lib/esm/test/standalone/TileCache.test.js.map +1 -0
- package/lib/esm/test/standalone/TileTree.test.d.ts +2 -0
- package/lib/esm/test/standalone/TileTree.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/TileTree.test.js +241 -0
- package/lib/esm/test/standalone/TileTree.test.js.map +1 -0
- package/lib/esm/test/standalone/TxnManager.test.d.ts +2 -0
- package/lib/esm/test/standalone/TxnManager.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/TxnManager.test.js +878 -0
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -0
- package/lib/esm/test/standalone/ViewDefinition.test.d.ts +2 -0
- package/lib/esm/test/standalone/ViewDefinition.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ViewDefinition.test.js +279 -0
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -0
- package/lib/esm/test/standalone/ViewStoreDb.test.d.ts +2 -0
- package/lib/esm/test/standalone/ViewStoreDb.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ViewStoreDb.test.js +288 -0
- package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -0
- package/lib/esm/test/standalone/Workspace.test.d.ts +2 -0
- package/lib/esm/test/standalone/Workspace.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/Workspace.test.js +161 -0
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -0
- package/lib/esm/workspace/Settings.d.ts +216 -0
- package/lib/esm/workspace/Settings.d.ts.map +1 -0
- package/lib/esm/workspace/Settings.js +83 -0
- package/lib/esm/workspace/Settings.js.map +1 -0
- package/lib/esm/workspace/SettingsSchemas.d.ts +135 -0
- package/lib/esm/workspace/SettingsSchemas.d.ts.map +1 -0
- package/lib/esm/workspace/SettingsSchemas.js +9 -0
- package/lib/esm/workspace/SettingsSchemas.js.map +1 -0
- package/lib/esm/workspace/Workspace.d.ts +507 -0
- package/lib/esm/workspace/Workspace.d.ts.map +1 -0
- package/lib/esm/workspace/Workspace.js +97 -0
- package/lib/esm/workspace/Workspace.js.map +1 -0
- package/lib/esm/workspace/WorkspaceEditor.d.ts +245 -0
- package/lib/esm/workspace/WorkspaceEditor.d.ts.map +1 -0
- package/lib/esm/workspace/WorkspaceEditor.js +31 -0
- package/lib/esm/workspace/WorkspaceEditor.js.map +1 -0
- package/package.json +18 -14
|
@@ -0,0 +1,2869 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { assert, expect } from "chai";
|
|
6
|
+
import { BentleyStatus, Id64, IModelStatus } from "@itwin/core-bentley";
|
|
7
|
+
import { Angle, AngleSweep, Arc3d, Box, ClipMaskXYZRangePlanes, ClipPlane, ClipPlaneContainment, ClipPrimitive, ClipShape, ClipVector, ConvexClipPlaneSet, CurveCollection, CurvePrimitive, Geometry, IndexedPolyface, InterpolationCurve3d, InterpolationCurve3dOptions, LineSegment3d, LineString3d, Loop, Matrix3d, Plane3dByOriginAndUnitNormal, Point2d, Point3d, Point3dArray, PointString3d, PolyfaceBuilder, Range2d, Range3d, SolidPrimitive, Sphere, StrokeOptions, Transform, Vector3d, YawPitchRollAngles, } from "@itwin/core-geometry";
|
|
8
|
+
import { AreaPattern, BackgroundFill, BRepGeometryOperation, Code, ColorByName, ColorDef, ElementGeometry, ElementGeometryOpcode, FillDisplay, GeometryClass, GeometryParams, GeometryStreamBuilder, GeometryStreamFlags, GeometryStreamIterator, Gradient, ImageGraphicCorners, IModel, LinePixels, LineStyle, MassPropertiesOperation, Placement3d, TextString, ThematicGradientMode, ThematicGradientSettings, ViewFlags, } from "@itwin/core-common";
|
|
9
|
+
import { _nativeDb, DefinitionModel, deleteElementTree, GeometryPart, LineStyleDefinition, PhysicalObject, Subject } from "../../core-backend";
|
|
10
|
+
import { createBRepDataProps } from "../GeometryTestUtil";
|
|
11
|
+
import { IModelTestUtils } from "../IModelTestUtils";
|
|
12
|
+
import { Timer } from "../TestUtils";
|
|
13
|
+
function assertTrue(expr) {
|
|
14
|
+
assert.isTrue(expr);
|
|
15
|
+
}
|
|
16
|
+
function createGeometryPartProps(geom, modelId) {
|
|
17
|
+
const partProps = {
|
|
18
|
+
classFullName: GeometryPart.classFullName,
|
|
19
|
+
model: modelId ?? IModel.dictionaryId,
|
|
20
|
+
code: Code.createEmpty(),
|
|
21
|
+
geom,
|
|
22
|
+
};
|
|
23
|
+
return partProps;
|
|
24
|
+
}
|
|
25
|
+
function createPhysicalElementProps(seedElement, placement, geom, modelId) {
|
|
26
|
+
const elementProps = {
|
|
27
|
+
classFullName: PhysicalObject.classFullName,
|
|
28
|
+
model: modelId ?? seedElement.model,
|
|
29
|
+
category: seedElement.category,
|
|
30
|
+
code: Code.createEmpty(),
|
|
31
|
+
geom,
|
|
32
|
+
placement,
|
|
33
|
+
};
|
|
34
|
+
return elementProps;
|
|
35
|
+
}
|
|
36
|
+
function createGeometryPart(geom, imodel) {
|
|
37
|
+
const partProps = createGeometryPartProps(geom);
|
|
38
|
+
return imodel.elements.insertElement(partProps);
|
|
39
|
+
}
|
|
40
|
+
function createGeometricElem(geom, placement, imodel, seedElement) {
|
|
41
|
+
const elementProps = createPhysicalElementProps(seedElement, placement, geom);
|
|
42
|
+
const el = imodel.elements.createElement(elementProps);
|
|
43
|
+
return imodel.elements.insertElement(el.toJSON());
|
|
44
|
+
}
|
|
45
|
+
function createPartElem(partId, origin, angles, imodel, seedElement, isRelative = false) {
|
|
46
|
+
const builder = new GeometryStreamBuilder();
|
|
47
|
+
builder.appendGeometryPart3d(partId, isRelative ? origin : undefined, isRelative ? angles : undefined);
|
|
48
|
+
return createGeometricElem(builder.geometryStream, isRelative ? { origin: Point3d.createZero(), angles: YawPitchRollAngles.createDegrees(0, 0, 0) } : { origin, angles }, imodel, seedElement);
|
|
49
|
+
}
|
|
50
|
+
function createCirclePart(radius, imodel) {
|
|
51
|
+
const builder = new GeometryStreamBuilder();
|
|
52
|
+
builder.appendGeometry(Arc3d.createXY(Point3d.createZero(), radius));
|
|
53
|
+
return createGeometryPart(builder.geometryStream, imodel);
|
|
54
|
+
}
|
|
55
|
+
function createCircleElem(radius, origin, angles, imodel, seedElement) {
|
|
56
|
+
const builder = new GeometryStreamBuilder();
|
|
57
|
+
builder.appendGeometry(Arc3d.createXY(Point3d.createZero(), radius));
|
|
58
|
+
return createGeometricElem(builder.geometryStream, { origin, angles }, imodel, seedElement);
|
|
59
|
+
}
|
|
60
|
+
function createSphereElem(radius, origin, angles, imodel, seedElement) {
|
|
61
|
+
const builder = new GeometryStreamBuilder();
|
|
62
|
+
builder.appendGeometry(Sphere.createCenterRadius(Point3d.createZero(), radius));
|
|
63
|
+
return createGeometricElem(builder.geometryStream, { origin, angles }, imodel, seedElement);
|
|
64
|
+
}
|
|
65
|
+
function createDisjointCirclesElem(radius, origin, angles, imodel, seedElement) {
|
|
66
|
+
const builder = new GeometryStreamBuilder();
|
|
67
|
+
const xOffset = radius * 1.5;
|
|
68
|
+
builder.appendGeometry(Arc3d.createXY(Point3d.create(-xOffset), radius));
|
|
69
|
+
const geomParams = new GeometryParams(seedElement.category);
|
|
70
|
+
geomParams.geometryClass = GeometryClass.Construction;
|
|
71
|
+
builder.appendGeometryParamsChange(geomParams);
|
|
72
|
+
builder.appendGeometry(Arc3d.createXY(Point3d.create(xOffset), radius));
|
|
73
|
+
return createGeometricElem(builder.geometryStream, { origin, angles }, imodel, seedElement);
|
|
74
|
+
}
|
|
75
|
+
function createIndexedPolyface(radius, origin, angleTol) {
|
|
76
|
+
const options = StrokeOptions.createForFacets();
|
|
77
|
+
options.needParams = true;
|
|
78
|
+
options.needNormals = true;
|
|
79
|
+
if (angleTol)
|
|
80
|
+
options.angleTol = angleTol;
|
|
81
|
+
// Create indexed polyface for testing by facetting a sphere...
|
|
82
|
+
const sphere = Sphere.createCenterRadius(undefined !== origin ? origin : Point3d.createZero(), radius);
|
|
83
|
+
const polyBuilder = PolyfaceBuilder.create(options);
|
|
84
|
+
polyBuilder.handleSphere(sphere);
|
|
85
|
+
return polyBuilder.claimPolyface();
|
|
86
|
+
}
|
|
87
|
+
function createStyledLineElem(imodel, seedElement, x, y, length, styleInfo, color) {
|
|
88
|
+
const builder = new GeometryStreamBuilder();
|
|
89
|
+
const params = new GeometryParams(seedElement.category);
|
|
90
|
+
if (styleInfo)
|
|
91
|
+
params.styleInfo = styleInfo;
|
|
92
|
+
if (color)
|
|
93
|
+
params.lineColor = color;
|
|
94
|
+
builder.appendGeometryParamsChange(params);
|
|
95
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.create(x, y, 0), Point3d.create(x + length, y, 0)));
|
|
96
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
97
|
+
return imodel.elements.insertElement(elementProps);
|
|
98
|
+
}
|
|
99
|
+
function validateElementInfo(info, expected, isWorld) {
|
|
100
|
+
assert.isTrue(undefined !== info.entryArray && expected.length === info.entryArray.length);
|
|
101
|
+
const geomParams = (undefined !== info.categoryId ? new GeometryParams(info.categoryId) : undefined);
|
|
102
|
+
info.entryArray.forEach((entry, i) => {
|
|
103
|
+
assert.isTrue(expected[i].opcode === entry.opcode);
|
|
104
|
+
if (ElementGeometry.isGeometryQueryEntry(entry)) {
|
|
105
|
+
const geom = ElementGeometry.toGeometryQuery(entry);
|
|
106
|
+
assert.exists(geom);
|
|
107
|
+
if (undefined !== expected[i].geometryCategory) {
|
|
108
|
+
assert.isTrue(expected[i].geometryCategory === geom?.geometryCategory);
|
|
109
|
+
}
|
|
110
|
+
if (undefined !== expected[i].geometrySubCategory) {
|
|
111
|
+
switch (expected[i].geometryCategory) {
|
|
112
|
+
case "curvePrimitive": {
|
|
113
|
+
assert.isTrue(geom instanceof CurvePrimitive);
|
|
114
|
+
assert.isTrue(expected[i].geometrySubCategory === geom.curvePrimitiveType);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case "curveCollection": {
|
|
118
|
+
assert.isTrue(geom instanceof CurveCollection);
|
|
119
|
+
assert.isTrue(expected[i].geometrySubCategory === geom.curveCollectionType);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
case "solid": {
|
|
123
|
+
assert.isTrue(geom instanceof SolidPrimitive);
|
|
124
|
+
assert.isTrue(expected[i].geometrySubCategory === geom.solidPrimitiveType);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (ElementGeometry.isGeometricEntry(entry)) {
|
|
131
|
+
switch (entry.opcode) {
|
|
132
|
+
case ElementGeometryOpcode.BRep:
|
|
133
|
+
const brep = ElementGeometry.toBRep(entry);
|
|
134
|
+
assert.exists(brep);
|
|
135
|
+
if (!isWorld && undefined !== expected[i].originalEntry) {
|
|
136
|
+
const other = ElementGeometry.toBRep(expected[i].originalEntry);
|
|
137
|
+
assert.exists(other);
|
|
138
|
+
// NOTE: Don't compare brep type; set from entity data by backend, ignored if supplied to update...
|
|
139
|
+
const transform = Transform.fromJSON(brep?.transform);
|
|
140
|
+
const otherTrans = Transform.fromJSON(other?.transform);
|
|
141
|
+
assert.isTrue(transform.isAlmostEqual(otherTrans));
|
|
142
|
+
const faceSymbLen = (undefined !== brep?.faceSymbology ? brep?.faceSymbology.length : 0);
|
|
143
|
+
const otherSymbLen = (undefined !== other?.faceSymbology ? other?.faceSymbology.length : 0);
|
|
144
|
+
assert.isTrue(faceSymbLen === otherSymbLen);
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case ElementGeometryOpcode.TextString:
|
|
148
|
+
const text = ElementGeometry.toTextString(entry);
|
|
149
|
+
assert.exists(text);
|
|
150
|
+
if (!isWorld && undefined !== expected[i].originalEntry) {
|
|
151
|
+
const other = ElementGeometry.toTextString(expected[i].originalEntry);
|
|
152
|
+
assert.exists(other);
|
|
153
|
+
assert.isTrue(text?.font === other?.font);
|
|
154
|
+
assert.isTrue(text?.text === other?.text);
|
|
155
|
+
assert.isTrue(text?.bold === other?.bold);
|
|
156
|
+
assert.isTrue(text?.italic === other?.italic);
|
|
157
|
+
assert.isTrue(text?.underline === other?.underline);
|
|
158
|
+
assert.isTrue(text?.height === other?.height);
|
|
159
|
+
assert.isTrue(text?.widthFactor === other?.widthFactor);
|
|
160
|
+
const origin = Point3d.fromJSON(text?.origin);
|
|
161
|
+
const otherOrigin = Point3d.fromJSON(other?.origin);
|
|
162
|
+
assert.isTrue(origin.isAlmostEqual(otherOrigin));
|
|
163
|
+
const angles = YawPitchRollAngles.fromJSON(text?.rotation);
|
|
164
|
+
const otherAngles = YawPitchRollAngles.fromJSON(other?.rotation);
|
|
165
|
+
assert.isTrue(angles.isAlmostEqual(otherAngles));
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
case ElementGeometryOpcode.Image:
|
|
169
|
+
const image = ElementGeometry.toImageGraphic(entry);
|
|
170
|
+
assert.exists(image);
|
|
171
|
+
if (!isWorld && undefined !== expected[i].originalEntry) {
|
|
172
|
+
const other = ElementGeometry.toImageGraphic(expected[i].originalEntry);
|
|
173
|
+
assert.exists(other);
|
|
174
|
+
assert.isTrue(image?.textureId === other?.textureId);
|
|
175
|
+
assert.isTrue(image?.hasBorder === other?.hasBorder);
|
|
176
|
+
const corners = ImageGraphicCorners.fromJSON(image.corners);
|
|
177
|
+
const otherCorners = ImageGraphicCorners.fromJSON(other.corners);
|
|
178
|
+
assert.isTrue(corners[0].isAlmostEqual(otherCorners[0]));
|
|
179
|
+
assert.isTrue(corners[1].isAlmostEqual(otherCorners[1]));
|
|
180
|
+
assert.isTrue(corners[2].isAlmostEqual(otherCorners[2]));
|
|
181
|
+
assert.isTrue(corners[3].isAlmostEqual(otherCorners[3]));
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
assert.isTrue(false);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (ElementGeometryOpcode.SubGraphicRange === entry.opcode) {
|
|
190
|
+
const subRange = ElementGeometry.toSubGraphicRange(entry);
|
|
191
|
+
assert.exists(subRange);
|
|
192
|
+
assert.isFalse(subRange?.isNull);
|
|
193
|
+
}
|
|
194
|
+
else if (ElementGeometryOpcode.PartReference === entry.opcode) {
|
|
195
|
+
const partToElement = Transform.createIdentity();
|
|
196
|
+
const part = ElementGeometry.toGeometryPart(entry, partToElement);
|
|
197
|
+
assert.exists(part);
|
|
198
|
+
if (!isWorld && undefined !== expected[i].originalEntry) {
|
|
199
|
+
const otherToElement = Transform.createIdentity();
|
|
200
|
+
const other = ElementGeometry.toGeometryPart(expected[i].originalEntry, otherToElement);
|
|
201
|
+
assert.exists(other);
|
|
202
|
+
assert.isTrue(partToElement.isAlmostEqual(otherToElement));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else if (ElementGeometry.isAppearanceEntry(entry)) {
|
|
206
|
+
if (undefined !== geomParams) {
|
|
207
|
+
const updated = ElementGeometry.updateGeometryParams(entry, geomParams);
|
|
208
|
+
assert.isTrue(updated);
|
|
209
|
+
if (!isWorld && undefined !== expected[i].geomParams)
|
|
210
|
+
assert.isTrue(geomParams.isEquivalent(expected[i].geomParams));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function validateGeometricElementProps(info, expected) {
|
|
216
|
+
assert.isFalse(undefined === info.categoryId || undefined === info.sourceToWorld || undefined === info.bbox);
|
|
217
|
+
assert.isTrue(expected.category === info.categoryId);
|
|
218
|
+
const placement = Placement3d.fromJSON(expected.placement);
|
|
219
|
+
const sourceToWorld = ElementGeometry.toTransform(info.sourceToWorld);
|
|
220
|
+
assert.exists(sourceToWorld);
|
|
221
|
+
assert.isTrue(sourceToWorld?.isAlmostEqual(placement.transform));
|
|
222
|
+
const bbox = ElementGeometry.toElementAlignedBox3d(info.bbox);
|
|
223
|
+
assert.isFalse(bbox?.isNull);
|
|
224
|
+
}
|
|
225
|
+
function doElementGeometryValidate(imodel, elementId, expected, isWorld, elementProps, brepOpt) {
|
|
226
|
+
const onGeometry = (info) => {
|
|
227
|
+
if (undefined !== elementProps)
|
|
228
|
+
validateGeometricElementProps(info, elementProps);
|
|
229
|
+
if (1 === brepOpt || 2 === brepOpt)
|
|
230
|
+
assert.isTrue(info.brepsPresent);
|
|
231
|
+
validateElementInfo(info, expected, isWorld);
|
|
232
|
+
};
|
|
233
|
+
const requestProps = {
|
|
234
|
+
onGeometry,
|
|
235
|
+
elementId,
|
|
236
|
+
};
|
|
237
|
+
if (1 === brepOpt)
|
|
238
|
+
requestProps.replaceBReps = true;
|
|
239
|
+
else if (2 === brepOpt)
|
|
240
|
+
requestProps.skipBReps = true;
|
|
241
|
+
return imodel.elementGeometryRequest(requestProps);
|
|
242
|
+
}
|
|
243
|
+
function createGeometricElemFromSeed(imodel, seedId, entryArray, placement) {
|
|
244
|
+
const seedElement = imodel.elements.getElement(seedId);
|
|
245
|
+
assert.exists(seedElement);
|
|
246
|
+
const elementProps = createPhysicalElementProps(seedElement, placement);
|
|
247
|
+
elementProps.elementGeometryBuilderParams = { entryArray };
|
|
248
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
249
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
250
|
+
imodel.saveChanges();
|
|
251
|
+
return newId;
|
|
252
|
+
}
|
|
253
|
+
describe("GeometryStream", () => {
|
|
254
|
+
let imodel;
|
|
255
|
+
before(() => {
|
|
256
|
+
const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
|
|
257
|
+
const testFileName = IModelTestUtils.prepareOutputFile("GeometryStream", "GeometryStreamTest.bim");
|
|
258
|
+
imodel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
|
|
259
|
+
});
|
|
260
|
+
after(() => {
|
|
261
|
+
imodel.close();
|
|
262
|
+
});
|
|
263
|
+
it("create GeometricElement3d using line codes 1-7", async () => {
|
|
264
|
+
// Set up element to be placed in iModel
|
|
265
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
266
|
+
assert.exists(seedElement);
|
|
267
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
268
|
+
// init line code to line pixels array
|
|
269
|
+
const lsCodes = [LinePixels.Solid, LinePixels.Code1, LinePixels.Code2, LinePixels.Code3, LinePixels.Code4, LinePixels.Code5, LinePixels.Code6, LinePixels.Code7];
|
|
270
|
+
// create new line style definitions for line codes 1-7
|
|
271
|
+
const lsStyles = [];
|
|
272
|
+
lsCodes.forEach((linePixels) => {
|
|
273
|
+
lsStyles.push(LinePixels.Solid === linePixels ? Id64.invalid : LineStyleDefinition.Utils.getOrCreateLinePixelsStyle(imodel, IModel.dictionaryId, linePixels));
|
|
274
|
+
});
|
|
275
|
+
// get existing line style definitions for line codes 1-7
|
|
276
|
+
const lsStylesExist = [];
|
|
277
|
+
lsCodes.forEach((linePixels) => {
|
|
278
|
+
lsStylesExist.push(LinePixels.Solid === linePixels ? Id64.invalid : LineStyleDefinition.Utils.getOrCreateLinePixelsStyle(imodel, IModel.dictionaryId, linePixels));
|
|
279
|
+
});
|
|
280
|
+
// make sure we found existing styles and didn't create a second set
|
|
281
|
+
assert.isTrue(8 === lsStyles.length && lsStyles.length === lsStylesExist.length);
|
|
282
|
+
for (let iStyle = 0; iStyle < lsStyles.length; ++iStyle) {
|
|
283
|
+
assert.isTrue(0 === iStyle || Id64.isValidId64(lsStyles[iStyle]));
|
|
284
|
+
assert.isTrue(lsStylesExist[iStyle] === (lsStyles[iStyle]));
|
|
285
|
+
}
|
|
286
|
+
const builder = new GeometryStreamBuilder();
|
|
287
|
+
const params = new GeometryParams(seedElement.category);
|
|
288
|
+
const pointS = Point3d.createZero();
|
|
289
|
+
const pointE = Point3d.create(5, 0, 0);
|
|
290
|
+
lsStyles.forEach((styleId) => {
|
|
291
|
+
params.styleInfo = Id64.isValidId64(styleId) ? new LineStyle.Info(styleId) : undefined;
|
|
292
|
+
builder.appendGeometryParamsChange(params);
|
|
293
|
+
builder.appendGeometry(LineSegment3d.create(pointS, pointE));
|
|
294
|
+
pointS.y += 0.5;
|
|
295
|
+
pointE.y += 0.5;
|
|
296
|
+
});
|
|
297
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
298
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
299
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
300
|
+
imodel.saveChanges();
|
|
301
|
+
// Extract and test value returned...
|
|
302
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
303
|
+
assert.isDefined(value.geom);
|
|
304
|
+
const itNextCheck = new GeometryStreamIterator(value.geom, value.category);
|
|
305
|
+
assert.isFalse(itNextCheck.next().done);
|
|
306
|
+
assert.isFalse(itNextCheck.next().done);
|
|
307
|
+
assert.isFalse(itNextCheck.next().done);
|
|
308
|
+
assert.isFalse(itNextCheck.next().done);
|
|
309
|
+
assert.isFalse(itNextCheck.next().done);
|
|
310
|
+
assert.isFalse(itNextCheck.next().done);
|
|
311
|
+
assert.isFalse(itNextCheck.next().done);
|
|
312
|
+
assert.isFalse(itNextCheck.next().done);
|
|
313
|
+
assert.isTrue(itNextCheck.next().done);
|
|
314
|
+
const lsStylesUsed = [];
|
|
315
|
+
const it = new GeometryStreamIterator(value.geom, value.category);
|
|
316
|
+
for (const entry of it) {
|
|
317
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
318
|
+
lsStylesUsed.push(entry.geomParams.styleInfo ? entry.geomParams.styleInfo.styleId : Id64.invalid);
|
|
319
|
+
}
|
|
320
|
+
// Make sure we extracted same style information after round trip...
|
|
321
|
+
assert.isTrue(lsStyles.length === lsStylesUsed.length);
|
|
322
|
+
for (let iStyle = 0; iStyle < lsStyles.length; ++iStyle) {
|
|
323
|
+
assert.isTrue(lsStylesUsed[iStyle] === (lsStyles[iStyle]));
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
it("create GeometricElement3d using continuous style", async () => {
|
|
327
|
+
// Set up element to be placed in iModel
|
|
328
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
329
|
+
assert.exists(seedElement);
|
|
330
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
331
|
+
// create special "internal default" continuous style for drawing curves using width overrides
|
|
332
|
+
const styleId = LineStyleDefinition.Utils.getOrCreateContinuousStyle(imodel, IModel.dictionaryId);
|
|
333
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
334
|
+
// make sure we found existing style and didn't create a new one
|
|
335
|
+
const styleIdExists = LineStyleDefinition.Utils.getOrCreateContinuousStyle(imodel, IModel.dictionaryId);
|
|
336
|
+
assert.isTrue(Id64.isValidId64(styleIdExists) && styleIdExists === (styleId));
|
|
337
|
+
// create continuous style with pre-defined constant width
|
|
338
|
+
const styleIdWidth = LineStyleDefinition.Utils.getOrCreateContinuousStyle(imodel, IModel.dictionaryId, 0.05);
|
|
339
|
+
assert.isTrue(Id64.isValidId64(styleIdWidth));
|
|
340
|
+
// make sure we found existing style and didn't create a new one
|
|
341
|
+
const styleIdWidthExists = LineStyleDefinition.Utils.getOrCreateContinuousStyle(imodel, IModel.dictionaryId, 0.05);
|
|
342
|
+
assert.isTrue(Id64.isValidId64(styleIdWidthExists) && styleIdWidthExists === (styleIdWidth));
|
|
343
|
+
const builder = new GeometryStreamBuilder();
|
|
344
|
+
const params = new GeometryParams(seedElement.category);
|
|
345
|
+
const styles = [styleId, styleId, styleIdWidth, styleIdWidth];
|
|
346
|
+
const widths = [0.0, 0.025, 0.0, 0.075];
|
|
347
|
+
// add line using 0 width continuous style
|
|
348
|
+
params.styleInfo = new LineStyle.Info(styles[0]);
|
|
349
|
+
builder.appendGeometryParamsChange(params);
|
|
350
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(0, 5, 0)));
|
|
351
|
+
// add line with width override, undefined endWidth = startWidth, needed solely for taper
|
|
352
|
+
params.styleInfo.styleMod = new LineStyle.Modifier({ startWidth: widths[1], physicalWidth: true });
|
|
353
|
+
builder.appendGeometryParamsChange(params);
|
|
354
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.create(0.5, 0, 0), Point3d.create(0.5, 5, 0)));
|
|
355
|
+
// add line using pre-defined width continuous style
|
|
356
|
+
params.styleInfo = new LineStyle.Info(styles[2]);
|
|
357
|
+
builder.appendGeometryParamsChange(params);
|
|
358
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.create(1.0, 0, 0), Point3d.create(1.0, 5, 0)));
|
|
359
|
+
// add line with width override, undefined endWidth = startWidth, needed solely for taper
|
|
360
|
+
params.styleInfo.styleMod = new LineStyle.Modifier({ startWidth: widths[3], physicalWidth: true });
|
|
361
|
+
builder.appendGeometryParamsChange(params);
|
|
362
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.create(1.5, 0, 0), Point3d.create(1.5, 5, 0)));
|
|
363
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
364
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
365
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
366
|
+
imodel.saveChanges();
|
|
367
|
+
// Extract and test value returned...
|
|
368
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
369
|
+
assert.isDefined(value.geom);
|
|
370
|
+
const stylesUsed = [];
|
|
371
|
+
const widthsUsed = [];
|
|
372
|
+
const it = new GeometryStreamIterator(value.geom, value.category);
|
|
373
|
+
for (const entry of it) {
|
|
374
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
375
|
+
assert.isDefined(entry.geomParams.styleInfo);
|
|
376
|
+
stylesUsed.push(entry.geomParams.styleInfo.styleId);
|
|
377
|
+
widthsUsed.push(entry.geomParams.styleInfo.styleMod !== undefined ? entry.geomParams.styleInfo.styleMod.startWidth : 0.0);
|
|
378
|
+
}
|
|
379
|
+
// Make sure we extracted same style information after round trip...
|
|
380
|
+
assert.isTrue(styles.length === stylesUsed.length);
|
|
381
|
+
for (let iStyle = 0; iStyle < styles.length; ++iStyle) {
|
|
382
|
+
assert.isTrue(stylesUsed[iStyle] === (styles[iStyle]));
|
|
383
|
+
assert.isTrue(Geometry.isSameCoordinate(widthsUsed[iStyle], widths[iStyle]));
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
function createGeometricElem3dUsingArrowHeadNoStrokePattern(definitionModelId, physicalModelId) {
|
|
387
|
+
// Set up element to be placed in iModel
|
|
388
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
389
|
+
assert.exists(seedElement);
|
|
390
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
391
|
+
if (definitionModelId === undefined)
|
|
392
|
+
definitionModelId = IModel.dictionaryId;
|
|
393
|
+
if (physicalModelId === undefined)
|
|
394
|
+
physicalModelId = seedElement.model;
|
|
395
|
+
const partBuilder = new GeometryStreamBuilder();
|
|
396
|
+
const partParams = new GeometryParams(Id64.invalid); // category won't be used
|
|
397
|
+
partParams.fillDisplay = FillDisplay.Always;
|
|
398
|
+
partBuilder.appendGeometryParamsChange(partParams);
|
|
399
|
+
partBuilder.appendGeometry(Loop.create(LineString3d.create(Point3d.create(0.1, 0, 0), Point3d.create(0, -0.05, 0), Point3d.create(0, 0.05, 0), Point3d.create(0.1, 0, 0))));
|
|
400
|
+
const partProps = createGeometryPartProps(partBuilder.geometryStream, definitionModelId);
|
|
401
|
+
const partId = imodel.elements.insertElement(partProps);
|
|
402
|
+
assert.isTrue(Id64.isValidId64(partId));
|
|
403
|
+
const pointSymbolData = LineStyleDefinition.Utils.createPointSymbolComponent(imodel, { geomPartId: partId }); // base and size will be set automatically...
|
|
404
|
+
assert.isTrue(undefined !== pointSymbolData);
|
|
405
|
+
// Use internal default instead of creating a stroke component for a solid line
|
|
406
|
+
const strokePointData = LineStyleDefinition.Utils.createStrokePointComponent(imodel, { descr: "TestArrowHead", lcId: 0, lcType: LineStyleDefinition.ComponentType.Internal, symbols: [{ symId: pointSymbolData.compId, strokeNum: -1, mod1: LineStyleDefinition.SymbolOptions.CurveEnd }] });
|
|
407
|
+
assert.isTrue(undefined !== strokePointData);
|
|
408
|
+
const compoundData = LineStyleDefinition.Utils.createCompoundComponent(imodel, { comps: [{ id: strokePointData.compId, type: strokePointData.compType }, { id: 0, type: LineStyleDefinition.ComponentType.Internal }] });
|
|
409
|
+
assert.isTrue(undefined !== compoundData);
|
|
410
|
+
const styleId = LineStyleDefinition.Utils.createStyle(imodel, definitionModelId, "TestArrowStyle", compoundData);
|
|
411
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
412
|
+
const builder = new GeometryStreamBuilder();
|
|
413
|
+
const params = new GeometryParams(seedElement.category);
|
|
414
|
+
params.styleInfo = new LineStyle.Info(styleId);
|
|
415
|
+
builder.appendGeometryParamsChange(params);
|
|
416
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.createZero(), Point3d.create(-1, -1, 0)));
|
|
417
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream, physicalModelId);
|
|
418
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
419
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
420
|
+
imodel.saveChanges();
|
|
421
|
+
const usageInfo = imodel[_nativeDb].queryDefinitionElementUsage([partId, styleId]);
|
|
422
|
+
assert.isTrue(usageInfo.geometryPartIds.includes(partId));
|
|
423
|
+
assert.isTrue(usageInfo.lineStyleIds.includes(styleId));
|
|
424
|
+
assert.isTrue(usageInfo.usedIds.includes(partId));
|
|
425
|
+
assert.isTrue(usageInfo.usedIds.includes(styleId));
|
|
426
|
+
}
|
|
427
|
+
it("create GeometricElement3d using arrow head style w/o using stroke pattern", async () => {
|
|
428
|
+
createGeometricElem3dUsingArrowHeadNoStrokePattern();
|
|
429
|
+
});
|
|
430
|
+
it("create GeometricElement3d using arrow head style w/o using stroke pattern - deleteElementTree fails", async () => {
|
|
431
|
+
const mySubject = Subject.insert(imodel, IModel.rootSubjectId, "My Subject - fails");
|
|
432
|
+
const myDefModel = DefinitionModel.insert(imodel, mySubject, "My Definitions - fails");
|
|
433
|
+
const myPhysicalModel = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(imodel, Code.createEmpty(), false, mySubject)[0];
|
|
434
|
+
createGeometricElem3dUsingArrowHeadNoStrokePattern(myDefModel, myPhysicalModel);
|
|
435
|
+
deleteElementTree({ iModel: imodel, topElement: mySubject, maxPasses: 1 });
|
|
436
|
+
expect(imodel.elements.tryGetElement(mySubject)).not.undefined;
|
|
437
|
+
});
|
|
438
|
+
it("create GeometricElement3d using arrow head style w/o using stroke pattern - deleteElementTree succeeds with 2 passes", async () => {
|
|
439
|
+
const mySubject = Subject.insert(imodel, IModel.rootSubjectId, "My Subject - success");
|
|
440
|
+
const myDefModel = DefinitionModel.insert(imodel, mySubject, "My Definitions - success");
|
|
441
|
+
const myPhysicalModel = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(imodel, Code.createEmpty(), false, mySubject)[0];
|
|
442
|
+
createGeometricElem3dUsingArrowHeadNoStrokePattern(myDefModel, myPhysicalModel);
|
|
443
|
+
deleteElementTree({ iModel: imodel, topElement: mySubject, maxPasses: 2 });
|
|
444
|
+
expect(imodel.elements.tryGetElement(mySubject)).undefined;
|
|
445
|
+
});
|
|
446
|
+
it("create GeometricElement3d using compound style with dash widths and symbol", async () => {
|
|
447
|
+
// Set up element to be placed in iModel
|
|
448
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
449
|
+
assert.exists(seedElement);
|
|
450
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
451
|
+
const lsStrokes = [];
|
|
452
|
+
lsStrokes.push({ length: 0.25, orgWidth: 0.0, endWidth: 0.025, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Left });
|
|
453
|
+
lsStrokes.push({ length: 0.1 });
|
|
454
|
+
lsStrokes.push({ length: 0.1, orgWidth: 0.025, endWidth: 0.025, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Full });
|
|
455
|
+
lsStrokes.push({ length: 0.1 });
|
|
456
|
+
lsStrokes.push({ length: 0.25, orgWidth: 0.025, endWidth: 0.0, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Right });
|
|
457
|
+
lsStrokes.push({ length: 0.1 });
|
|
458
|
+
const strokePatternData = LineStyleDefinition.Utils.createStrokePatternComponent(imodel, { descr: "TestDashDotDashLineCode", strokes: lsStrokes });
|
|
459
|
+
assert.isTrue(undefined !== strokePatternData);
|
|
460
|
+
const partBuilder = new GeometryStreamBuilder();
|
|
461
|
+
partBuilder.appendGeometry(Arc3d.createXY(Point3d.createZero(), 0.05));
|
|
462
|
+
const partProps = createGeometryPartProps(partBuilder.geometryStream);
|
|
463
|
+
const partId = imodel.elements.insertElement(partProps);
|
|
464
|
+
assert.isTrue(Id64.isValidId64(partId));
|
|
465
|
+
const pointSymbolData = LineStyleDefinition.Utils.createPointSymbolComponent(imodel, { geomPartId: partId }); // base and size will be set automatically...
|
|
466
|
+
assert.isTrue(undefined !== pointSymbolData);
|
|
467
|
+
const lsSymbols = [];
|
|
468
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 1, mod1: LineStyleDefinition.SymbolOptions.Center });
|
|
469
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 3, mod1: LineStyleDefinition.SymbolOptions.Center });
|
|
470
|
+
const strokePointData = LineStyleDefinition.Utils.createStrokePointComponent(imodel, { descr: "TestGapSymbolsLinePoint", lcId: strokePatternData.compId, symbols: lsSymbols });
|
|
471
|
+
assert.isTrue(undefined !== strokePointData);
|
|
472
|
+
const lsComponents = [];
|
|
473
|
+
lsComponents.push({ id: strokePointData.compId, type: strokePointData.compType });
|
|
474
|
+
lsComponents.push({ id: strokePatternData.compId, type: strokePatternData.compType });
|
|
475
|
+
const compoundData = LineStyleDefinition.Utils.createCompoundComponent(imodel, { comps: lsComponents });
|
|
476
|
+
assert.isTrue(undefined !== compoundData);
|
|
477
|
+
const styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, "TestDashCircleDotCircleDashStyle", compoundData);
|
|
478
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
479
|
+
const builder = new GeometryStreamBuilder();
|
|
480
|
+
const params = new GeometryParams(seedElement.category);
|
|
481
|
+
params.styleInfo = new LineStyle.Info(styleId);
|
|
482
|
+
builder.appendGeometryParamsChange(params);
|
|
483
|
+
builder.appendGeometry(LineSegment3d.create(Point3d.createZero(), Point3d.create(5, 5, 0)));
|
|
484
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
485
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
486
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
487
|
+
imodel.saveChanges();
|
|
488
|
+
const usageInfo = imodel[_nativeDb].queryDefinitionElementUsage([partId, styleId, seedElement.category]);
|
|
489
|
+
assert.isTrue(usageInfo.geometryPartIds.includes(partId));
|
|
490
|
+
assert.isTrue(usageInfo.lineStyleIds.includes(styleId));
|
|
491
|
+
assert.isTrue(usageInfo.spatialCategoryIds.includes(seedElement.category));
|
|
492
|
+
assert.isTrue(usageInfo.usedIds.includes(partId));
|
|
493
|
+
assert.isTrue(usageInfo.usedIds.includes(styleId));
|
|
494
|
+
assert.isTrue(usageInfo.usedIds.includes(seedElement.category));
|
|
495
|
+
});
|
|
496
|
+
it("create GeometricElement3d with line styles to check bounding box padding", async () => {
|
|
497
|
+
// Set up element to be placed in iModel
|
|
498
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
499
|
+
assert.exists(seedElement);
|
|
500
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
501
|
+
// LineStyleDefinition: create special "internal default" continuous style for drawing curves using width overrides
|
|
502
|
+
let x = 0.0;
|
|
503
|
+
let y = 0.0;
|
|
504
|
+
let unitDef = 1.0;
|
|
505
|
+
let widthDef = 0.0;
|
|
506
|
+
let name = `Continuous-${unitDef}-${widthDef}`;
|
|
507
|
+
let styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, { compId: 0, compType: LineStyleDefinition.ComponentType.Internal, flags: LineStyleDefinition.StyleFlags.Continuous | LineStyleDefinition.StyleFlags.NoSnap });
|
|
508
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
509
|
+
// Expect no range padding...
|
|
510
|
+
let newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
511
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
512
|
+
imodel.saveChanges();
|
|
513
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.0));
|
|
514
|
+
// Expect range padded by 0.25...
|
|
515
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.25, physicalWidth: true })), ColorDef.red);
|
|
516
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
517
|
+
imodel.saveChanges();
|
|
518
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.25));
|
|
519
|
+
// LineStyleDefinition: create continuous style with both width and unit scale specified in definition...
|
|
520
|
+
x = 0.0;
|
|
521
|
+
y++;
|
|
522
|
+
unitDef = 2.0;
|
|
523
|
+
widthDef = 0.5;
|
|
524
|
+
name = `Continuous-${unitDef}-${widthDef}`;
|
|
525
|
+
let strokePatternData = LineStyleDefinition.Utils.createStrokePatternComponent(imodel, { descr: name, strokes: [{ length: 1e37, orgWidth: widthDef, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Full }] });
|
|
526
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: LineStyleDefinition.StyleFlags.Continuous | LineStyleDefinition.StyleFlags.NoSnap, unitDef });
|
|
527
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
528
|
+
// Expect no range padding...
|
|
529
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.0, physicalWidth: true })));
|
|
530
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
531
|
+
imodel.saveChanges();
|
|
532
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.0));
|
|
533
|
+
// Expect range padded by 1.0...
|
|
534
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId), ColorDef.red);
|
|
535
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
536
|
+
imodel.saveChanges();
|
|
537
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), widthDef * unitDef));
|
|
538
|
+
// Expect range padded by 0.25...
|
|
539
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.25, physicalWidth: true })), ColorDef.green);
|
|
540
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
541
|
+
imodel.saveChanges();
|
|
542
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.25));
|
|
543
|
+
// LineStyleDefinition: create stroke pattern with dash widths in definition...
|
|
544
|
+
x = 0.0;
|
|
545
|
+
y++;
|
|
546
|
+
unitDef = 1.0;
|
|
547
|
+
widthDef = 0.025;
|
|
548
|
+
name = `StrokePattern-${unitDef}-${widthDef}`;
|
|
549
|
+
const lsStrokes = [];
|
|
550
|
+
lsStrokes.push({ length: 0.25, orgWidth: widthDef, endWidth: widthDef, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Left });
|
|
551
|
+
lsStrokes.push({ length: 0.1 });
|
|
552
|
+
lsStrokes.push({ length: 0.2, orgWidth: widthDef, endWidth: widthDef, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Full });
|
|
553
|
+
lsStrokes.push({ length: 0.1 });
|
|
554
|
+
lsStrokes.push({ length: 0.25, orgWidth: widthDef, endWidth: widthDef, strokeMode: LineStyleDefinition.StrokeMode.Dash, widthMode: LineStyleDefinition.StrokeWidth.Right });
|
|
555
|
+
lsStrokes.push({ length: 0.1 });
|
|
556
|
+
strokePatternData = LineStyleDefinition.Utils.createStrokePatternComponent(imodel, { descr: name, strokes: lsStrokes });
|
|
557
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: LineStyleDefinition.StyleFlags.NoSnap });
|
|
558
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
559
|
+
// Expect range padded by 0.025...
|
|
560
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
561
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
562
|
+
imodel.saveChanges();
|
|
563
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), widthDef * unitDef));
|
|
564
|
+
// Expect range padded by 0.25...
|
|
565
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.25, physicalWidth: true })), ColorDef.red);
|
|
566
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
567
|
+
imodel.saveChanges();
|
|
568
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.25));
|
|
569
|
+
// LineStyleDefinition: create stroke pattern with dash widths and unit scale specified in definition...
|
|
570
|
+
x = 0.0;
|
|
571
|
+
y++;
|
|
572
|
+
unitDef = 2.0;
|
|
573
|
+
widthDef = 0.025;
|
|
574
|
+
name = `StrokePattern-${unitDef}-${widthDef}`;
|
|
575
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: LineStyleDefinition.StyleFlags.NoSnap, unitDef });
|
|
576
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
577
|
+
// Expect range padded by 0.05...
|
|
578
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
579
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
580
|
+
imodel.saveChanges();
|
|
581
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), widthDef * unitDef));
|
|
582
|
+
// Expect range padded by 0.25...
|
|
583
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.25, physicalWidth: true })), ColorDef.red);
|
|
584
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
585
|
+
imodel.saveChanges();
|
|
586
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.25));
|
|
587
|
+
// Expect range padded by 0.25...
|
|
588
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.25, scale: 0.5, physicalWidth: true })), ColorDef.green);
|
|
589
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
590
|
+
imodel.saveChanges();
|
|
591
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.25));
|
|
592
|
+
// Expect range padded by 0.025...
|
|
593
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ scale: 0.5 })), ColorDef.blue);
|
|
594
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
595
|
+
imodel.saveChanges();
|
|
596
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), widthDef * unitDef * 0.5));
|
|
597
|
+
// LineStyleDefinition: create point symbol with internal default instead of a stroke pattern...
|
|
598
|
+
x = 0.0;
|
|
599
|
+
y++;
|
|
600
|
+
unitDef = 1.0;
|
|
601
|
+
widthDef = 1.0;
|
|
602
|
+
name = `PointSymbol-${unitDef}-${widthDef}`;
|
|
603
|
+
const partId = createCirclePart(0.25, imodel);
|
|
604
|
+
let pointSymbolData = LineStyleDefinition.Utils.createPointSymbolComponent(imodel, { geomPartId: partId });
|
|
605
|
+
let strokePointData = LineStyleDefinition.Utils.createStrokePointComponent(imodel, { descr: name, lcId: 0, lcType: LineStyleDefinition.ComponentType.Internal, symbols: [{ symId: pointSymbolData.compId, strokeNum: -1, mod1: LineStyleDefinition.SymbolOptions.CurveOrigin }] });
|
|
606
|
+
let compoundData = LineStyleDefinition.Utils.createCompoundComponent(imodel, { comps: [{ id: strokePointData.compId, type: strokePointData.compType }, { id: 0, type: LineStyleDefinition.ComponentType.Internal }] });
|
|
607
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, compoundData);
|
|
608
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
609
|
+
// Expect range padded by 0.5 (circle radius)...
|
|
610
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
611
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
612
|
+
imodel.saveChanges();
|
|
613
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.5));
|
|
614
|
+
// Expect range padded by 0.25 (scaled circle radius)...
|
|
615
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ scale: 0.5 })), ColorDef.red);
|
|
616
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
617
|
+
imodel.saveChanges();
|
|
618
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.25));
|
|
619
|
+
// Expect range padded by 1.0 (width override > symbol size)...
|
|
620
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 1.0, scale: 0.5, physicalWidth: true })), ColorDef.green);
|
|
621
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
622
|
+
imodel.saveChanges();
|
|
623
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 1.0));
|
|
624
|
+
// LineStyleDefinition: create scaling point symbol with stroke pattern with width and unit scale specified in definition...
|
|
625
|
+
x = 0.0;
|
|
626
|
+
y++;
|
|
627
|
+
unitDef = 0.5;
|
|
628
|
+
widthDef = 0.025; // value used for lsStrokes...
|
|
629
|
+
name = `PointSymbol-${unitDef}-${widthDef}}`;
|
|
630
|
+
strokePatternData = LineStyleDefinition.Utils.createStrokePatternComponent(imodel, { descr: name, strokes: lsStrokes });
|
|
631
|
+
pointSymbolData = LineStyleDefinition.Utils.createPointSymbolComponent(imodel, { geomPartId: partId, scale: 2.0 });
|
|
632
|
+
const lsSymbols = [];
|
|
633
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 1, mod1: LineStyleDefinition.SymbolOptions.Center });
|
|
634
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 3, mod1: LineStyleDefinition.SymbolOptions.Center });
|
|
635
|
+
strokePointData = LineStyleDefinition.Utils.createStrokePointComponent(imodel, { descr: name, lcId: strokePatternData.compId, symbols: lsSymbols });
|
|
636
|
+
const lsComponents = [];
|
|
637
|
+
lsComponents.push({ id: strokePointData.compId, type: strokePointData.compType });
|
|
638
|
+
lsComponents.push({ id: strokePatternData.compId, type: strokePatternData.compType });
|
|
639
|
+
compoundData = LineStyleDefinition.Utils.createCompoundComponent(imodel, { comps: lsComponents });
|
|
640
|
+
compoundData.unitDef = unitDef;
|
|
641
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, compoundData);
|
|
642
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
643
|
+
// Expect range padded by 0.125 (symbol and unit scaled circle radius)......
|
|
644
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
645
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
646
|
+
imodel.saveChanges();
|
|
647
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.125));
|
|
648
|
+
// Expect range padded by 0.0625 (symbol and modifier scaled circle radius)...
|
|
649
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ scale: 0.5 })), ColorDef.red);
|
|
650
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
651
|
+
imodel.saveChanges();
|
|
652
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.0625));
|
|
653
|
+
// Expect range padded by 0.75 (width override > symbol and modifier scaled symbol size)...
|
|
654
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.75, scale: 0.5, physicalWidth: true })), ColorDef.green);
|
|
655
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
656
|
+
imodel.saveChanges();
|
|
657
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.75));
|
|
658
|
+
// LineStyleDefinition: create non-scaling point symbol with stroke pattern with width and unit scale specified in definition...
|
|
659
|
+
x = 0.0;
|
|
660
|
+
y++;
|
|
661
|
+
unitDef = 0.5;
|
|
662
|
+
widthDef = 0.025; // value used for lsStrokes...
|
|
663
|
+
name = `NonScalingPointSymbol-${unitDef}-${widthDef}}`;
|
|
664
|
+
strokePatternData = LineStyleDefinition.Utils.createStrokePatternComponent(imodel, { descr: name, strokes: lsStrokes });
|
|
665
|
+
pointSymbolData = LineStyleDefinition.Utils.createPointSymbolComponent(imodel, { geomPartId: partId, scale: 2.0, symFlags: LineStyleDefinition.PointSymbolFlags.NoScale });
|
|
666
|
+
lsSymbols.length = 0;
|
|
667
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 1, mod1: LineStyleDefinition.SymbolOptions.Center });
|
|
668
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 3, mod1: LineStyleDefinition.SymbolOptions.Center });
|
|
669
|
+
strokePointData = LineStyleDefinition.Utils.createStrokePointComponent(imodel, { descr: name, lcId: strokePatternData.compId, symbols: lsSymbols });
|
|
670
|
+
lsComponents.length = 0;
|
|
671
|
+
lsComponents.push({ id: strokePointData.compId, type: strokePointData.compType });
|
|
672
|
+
lsComponents.push({ id: strokePatternData.compId, type: strokePatternData.compType });
|
|
673
|
+
compoundData = LineStyleDefinition.Utils.createCompoundComponent(imodel, { comps: lsComponents });
|
|
674
|
+
compoundData.unitDef = unitDef;
|
|
675
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, compoundData);
|
|
676
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
677
|
+
// Expect range padded by 0.5 (circle radius)......
|
|
678
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
679
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
680
|
+
imodel.saveChanges();
|
|
681
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.5));
|
|
682
|
+
// Expect range padded by 0.5 (unscaled circle radius)...
|
|
683
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ scale: 0.5 })), ColorDef.red);
|
|
684
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
685
|
+
imodel.saveChanges();
|
|
686
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.5));
|
|
687
|
+
// Expect range padded by 0.75 (width override > unscaled symbol size)...
|
|
688
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.75, scale: 0.5, physicalWidth: true })), ColorDef.green);
|
|
689
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
690
|
+
imodel.saveChanges();
|
|
691
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.75));
|
|
692
|
+
// LineStyleDefinition: create scaling point symbol with offsets with stroke pattern with width and unit scale specified in definition...
|
|
693
|
+
x = 0.0;
|
|
694
|
+
y++;
|
|
695
|
+
unitDef = 0.5;
|
|
696
|
+
widthDef = 0.025; // value used for lsStrokes...
|
|
697
|
+
name = `OffsetPointSymbol-${unitDef}-${widthDef}}`;
|
|
698
|
+
strokePatternData = LineStyleDefinition.Utils.createStrokePatternComponent(imodel, { descr: name, strokes: lsStrokes });
|
|
699
|
+
pointSymbolData = LineStyleDefinition.Utils.createPointSymbolComponent(imodel, { geomPartId: partId, scale: 2.0 });
|
|
700
|
+
lsSymbols.length = 0;
|
|
701
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 1, mod1: LineStyleDefinition.SymbolOptions.Center, yOffset: -0.1 });
|
|
702
|
+
lsSymbols.push({ symId: pointSymbolData.compId, strokeNum: 3, mod1: LineStyleDefinition.SymbolOptions.Center, yOffset: 0.1 });
|
|
703
|
+
strokePointData = LineStyleDefinition.Utils.createStrokePointComponent(imodel, { descr: name, lcId: strokePatternData.compId, symbols: lsSymbols });
|
|
704
|
+
lsComponents.length = 0;
|
|
705
|
+
lsComponents.push({ id: strokePointData.compId, type: strokePointData.compType });
|
|
706
|
+
lsComponents.push({ id: strokePatternData.compId, type: strokePatternData.compType });
|
|
707
|
+
compoundData = LineStyleDefinition.Utils.createCompoundComponent(imodel, { comps: lsComponents });
|
|
708
|
+
compoundData.unitDef = unitDef;
|
|
709
|
+
styleId = LineStyleDefinition.Utils.createStyle(imodel, IModel.dictionaryId, name, compoundData);
|
|
710
|
+
assert.isTrue(Id64.isValidId64(styleId));
|
|
711
|
+
// Expect range padded by 0.225 (offset symbol and unit scaled circle radius)......
|
|
712
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId));
|
|
713
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
714
|
+
imodel.saveChanges();
|
|
715
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.225));
|
|
716
|
+
// Expect range padded by 0.1125 (offset symbol and modifier scaled circle radius)...
|
|
717
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ scale: 0.5 })), ColorDef.red);
|
|
718
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
719
|
+
imodel.saveChanges();
|
|
720
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.1125));
|
|
721
|
+
// Expect range padded by 0.75 (width override > symbol and modifier scaled symbol size)...
|
|
722
|
+
newId = createStyledLineElem(imodel, seedElement, x++, y, 1.0, new LineStyle.Info(styleId, new LineStyle.Modifier({ startWidth: 0.75, scale: 0.5, physicalWidth: true })), ColorDef.green);
|
|
723
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
724
|
+
imodel.saveChanges();
|
|
725
|
+
assert.isTrue(Geometry.isSameCoordinate(Placement3d.fromJSON(imodel.elements.getElementProps({ id: newId, wantGeometry: true }).placement).bbox.yLength(), 0.75));
|
|
726
|
+
});
|
|
727
|
+
it("create GeometricElement3d using shapes with fill/gradient", async () => {
|
|
728
|
+
// Set up element to be placed in iModel
|
|
729
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
730
|
+
assert.exists(seedElement);
|
|
731
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
732
|
+
const builder = new GeometryStreamBuilder();
|
|
733
|
+
const params = new GeometryParams(seedElement.category);
|
|
734
|
+
builder.appendGeometryRanges(); // Test inclusion of local ranges...
|
|
735
|
+
const xOffset = Transform.createTranslation(Point3d.create(1.5));
|
|
736
|
+
const shape = Loop.create(LineString3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 0, 0), Point3d.create(1, 1, 0), Point3d.create(0, 1, 0), Point3d.create(0, 0, 0)));
|
|
737
|
+
// No fill...
|
|
738
|
+
params.lineColor = ColorDef.green;
|
|
739
|
+
params.weight = 5;
|
|
740
|
+
builder.appendGeometryParamsChange(params);
|
|
741
|
+
builder.appendGeometry(shape);
|
|
742
|
+
// Opaque fill by view...
|
|
743
|
+
params.fillDisplay = FillDisplay.ByView;
|
|
744
|
+
params.fillColor = params.lineColor;
|
|
745
|
+
builder.appendGeometryParamsChange(params);
|
|
746
|
+
shape.tryTransformInPlace(xOffset);
|
|
747
|
+
builder.appendGeometry(shape);
|
|
748
|
+
// Outline fill by view...
|
|
749
|
+
params.fillColor = ColorDef.red;
|
|
750
|
+
builder.appendGeometryParamsChange(params);
|
|
751
|
+
shape.tryTransformInPlace(xOffset);
|
|
752
|
+
builder.appendGeometry(shape);
|
|
753
|
+
// Outline transparency fill always...
|
|
754
|
+
params.fillDisplay = FillDisplay.Always;
|
|
755
|
+
params.fillTransparency = 0.75;
|
|
756
|
+
builder.appendGeometryParamsChange(params);
|
|
757
|
+
shape.tryTransformInPlace(xOffset);
|
|
758
|
+
builder.appendGeometry(shape);
|
|
759
|
+
// Opaque background fill always...
|
|
760
|
+
params.backgroundFill = BackgroundFill.Solid;
|
|
761
|
+
params.fillTransparency = 0.0;
|
|
762
|
+
builder.appendGeometryParamsChange(params);
|
|
763
|
+
shape.tryTransformInPlace(xOffset);
|
|
764
|
+
builder.appendGeometry(shape);
|
|
765
|
+
// Outline background fill always...
|
|
766
|
+
params.backgroundFill = BackgroundFill.Outline;
|
|
767
|
+
builder.appendGeometryParamsChange(params);
|
|
768
|
+
shape.tryTransformInPlace(xOffset);
|
|
769
|
+
builder.appendGeometry(shape);
|
|
770
|
+
// Opaque gradient by view...
|
|
771
|
+
params.fillDisplay = FillDisplay.ByView;
|
|
772
|
+
params.gradient = new Gradient.Symb();
|
|
773
|
+
params.gradient.mode = Gradient.Mode.Linear;
|
|
774
|
+
params.gradient.flags = Gradient.Flags.Invert;
|
|
775
|
+
params.gradient.keys.push(new Gradient.KeyColor({ value: 0.0, color: ColorDef.blue.toJSON() }));
|
|
776
|
+
params.gradient.keys.push(new Gradient.KeyColor({ value: 0.5, color: ColorDef.red.toJSON() }));
|
|
777
|
+
builder.appendGeometryParamsChange(params);
|
|
778
|
+
shape.tryTransformInPlace(xOffset);
|
|
779
|
+
builder.appendGeometry(shape);
|
|
780
|
+
// Outline gradient by view...Display issue, changes to gradient being ignored???
|
|
781
|
+
params.gradient.flags = Gradient.Flags.Outline;
|
|
782
|
+
builder.appendGeometryParamsChange(params);
|
|
783
|
+
shape.tryTransformInPlace(xOffset);
|
|
784
|
+
builder.appendGeometry(shape);
|
|
785
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
786
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
787
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
788
|
+
imodel.saveChanges();
|
|
789
|
+
// Extract and test value returned...
|
|
790
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
791
|
+
assert.isDefined(value.geom);
|
|
792
|
+
let iShape = 0;
|
|
793
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
794
|
+
for (const entry of itLocal) {
|
|
795
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
796
|
+
switch (iShape++) {
|
|
797
|
+
case 0:
|
|
798
|
+
assert.isTrue(undefined === entry.geomParams.fillDisplay || FillDisplay.Never === entry.geomParams.fillDisplay);
|
|
799
|
+
break;
|
|
800
|
+
case 1:
|
|
801
|
+
assert.isTrue(FillDisplay.ByView === entry.geomParams.fillDisplay);
|
|
802
|
+
assert.isTrue(entry.geomParams.lineColor.equals(entry.geomParams.fillColor));
|
|
803
|
+
break;
|
|
804
|
+
case 2:
|
|
805
|
+
assert.isTrue(FillDisplay.ByView === entry.geomParams.fillDisplay);
|
|
806
|
+
assert.isFalse(entry.geomParams.lineColor.equals(entry.geomParams.fillColor));
|
|
807
|
+
break;
|
|
808
|
+
case 3:
|
|
809
|
+
assert.isTrue(FillDisplay.Always === entry.geomParams.fillDisplay);
|
|
810
|
+
assert.isFalse(0.0 === entry.geomParams.fillTransparency);
|
|
811
|
+
break;
|
|
812
|
+
case 4:
|
|
813
|
+
assert.isTrue(FillDisplay.Always === entry.geomParams.fillDisplay);
|
|
814
|
+
assert.isTrue(BackgroundFill.Solid === entry.geomParams.backgroundFill);
|
|
815
|
+
break;
|
|
816
|
+
case 5:
|
|
817
|
+
assert.isTrue(FillDisplay.Always === entry.geomParams.fillDisplay);
|
|
818
|
+
assert.isTrue(BackgroundFill.Outline === entry.geomParams.backgroundFill);
|
|
819
|
+
break;
|
|
820
|
+
case 6:
|
|
821
|
+
assert.isTrue(FillDisplay.ByView === entry.geomParams.fillDisplay);
|
|
822
|
+
assert.isDefined(entry.geomParams.gradient);
|
|
823
|
+
assert.isTrue(0 === (Gradient.Flags.Outline & entry.geomParams.gradient.flags));
|
|
824
|
+
break;
|
|
825
|
+
case 7:
|
|
826
|
+
assert.isTrue(FillDisplay.ByView === entry.geomParams.fillDisplay);
|
|
827
|
+
assert.isDefined(entry.geomParams.gradient);
|
|
828
|
+
assert.isFalse(0 === (Gradient.Flags.Outline & entry.geomParams.gradient.flags));
|
|
829
|
+
break;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
assert.isTrue(8 === iShape);
|
|
833
|
+
});
|
|
834
|
+
it("create GeometricElement3d using shapes with patterns", async () => {
|
|
835
|
+
// Set up element to be placed in iModel
|
|
836
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
837
|
+
assert.exists(seedElement);
|
|
838
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
839
|
+
const builder = new GeometryStreamBuilder();
|
|
840
|
+
const params = new GeometryParams(seedElement.category);
|
|
841
|
+
builder.appendGeometryRanges(); // Test inclusion of local ranges...
|
|
842
|
+
const xOffset = Transform.createTranslation(Point3d.create(1.5));
|
|
843
|
+
const shape = Loop.create(LineString3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 0, 0), Point3d.create(1, 1, 0), Point3d.create(0, 1, 0), Point3d.create(0, 0, 0)));
|
|
844
|
+
// Hatch w/o overrides
|
|
845
|
+
params.lineColor = ColorDef.create(ColorByName.yellow);
|
|
846
|
+
params.weight = 5;
|
|
847
|
+
params.pattern = new AreaPattern.Params();
|
|
848
|
+
params.pattern.space1 = 0.05;
|
|
849
|
+
params.pattern.angle1 = Angle.createDegrees(45.0);
|
|
850
|
+
builder.appendGeometryParamsChange(params);
|
|
851
|
+
builder.appendGeometry(shape);
|
|
852
|
+
// Cross hatch with color/weight override
|
|
853
|
+
params.pattern.space2 = 0.1;
|
|
854
|
+
params.pattern.angle2 = Angle.createDegrees(-30.0);
|
|
855
|
+
params.pattern.color = ColorDef.red;
|
|
856
|
+
params.pattern.weight = 0;
|
|
857
|
+
builder.appendGeometryParamsChange(params);
|
|
858
|
+
shape.tryTransformInPlace(xOffset);
|
|
859
|
+
builder.appendGeometry(shape);
|
|
860
|
+
const partBuilder = new GeometryStreamBuilder();
|
|
861
|
+
partBuilder.appendGeometry(Arc3d.createXY(Point3d.createZero(), 0.05));
|
|
862
|
+
const partProps = createGeometryPartProps(partBuilder.geometryStream);
|
|
863
|
+
const partId = imodel.elements.insertElement(partProps);
|
|
864
|
+
assert.isTrue(Id64.isValidId64(partId));
|
|
865
|
+
// Area pattern w/o overrides
|
|
866
|
+
params.pattern = new AreaPattern.Params();
|
|
867
|
+
params.pattern.symbolId = partId;
|
|
868
|
+
params.pattern.space1 = params.pattern.space2 = 0.05;
|
|
869
|
+
params.pattern.angle1 = Angle.createDegrees(45.0);
|
|
870
|
+
builder.appendGeometryParamsChange(params);
|
|
871
|
+
shape.tryTransformInPlace(xOffset);
|
|
872
|
+
builder.appendGeometry(shape);
|
|
873
|
+
// Area pattern with color/weight overrides, snappable geometry, and invisible boundary
|
|
874
|
+
params.pattern.origin = Point3d.create(0.05, 0.05, 0.0);
|
|
875
|
+
params.pattern.space1 = params.pattern.space2 = params.pattern.angle1 = undefined;
|
|
876
|
+
params.pattern.color = ColorDef.red;
|
|
877
|
+
params.pattern.weight = 1;
|
|
878
|
+
params.pattern.snappable = params.pattern.invisibleBoundary = true;
|
|
879
|
+
builder.appendGeometryParamsChange(params);
|
|
880
|
+
shape.tryTransformInPlace(xOffset);
|
|
881
|
+
builder.appendGeometry(shape);
|
|
882
|
+
// Hatch definition w/o overrides (zig-zag)
|
|
883
|
+
const defLines = [
|
|
884
|
+
{ offset: Point2d.create(0.1, 0.1), dashes: [0.1, -0.1] },
|
|
885
|
+
{ angle: Angle.createDegrees(90.0), through: Point2d.create(0.1, 0.0), offset: Point2d.create(0.1, 0.1), dashes: [0.1, -0.1] },
|
|
886
|
+
];
|
|
887
|
+
params.pattern = new AreaPattern.Params();
|
|
888
|
+
params.pattern.defLines = defLines;
|
|
889
|
+
builder.appendGeometryParamsChange(params);
|
|
890
|
+
shape.tryTransformInPlace(xOffset);
|
|
891
|
+
builder.appendGeometry(shape);
|
|
892
|
+
// Hatch definition with color/weight overrides
|
|
893
|
+
params.pattern.color = ColorDef.red;
|
|
894
|
+
params.pattern.weight = 1;
|
|
895
|
+
builder.appendGeometryParamsChange(params);
|
|
896
|
+
shape.tryTransformInPlace(xOffset);
|
|
897
|
+
builder.appendGeometry(shape);
|
|
898
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
899
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
900
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
901
|
+
imodel.saveChanges();
|
|
902
|
+
// Extract and test value returned...
|
|
903
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
904
|
+
assert.isDefined(value.geom);
|
|
905
|
+
let iShape = 0;
|
|
906
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
907
|
+
for (const entry of itLocal) {
|
|
908
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
909
|
+
assert.isDefined(entry.geomParams.pattern);
|
|
910
|
+
switch (iShape++) {
|
|
911
|
+
case 0:
|
|
912
|
+
assert.isTrue(undefined !== entry.geomParams.pattern.space1 && undefined !== entry.geomParams.pattern.angle1 && undefined === entry.geomParams.pattern.space2 && undefined === entry.geomParams.pattern.angle2);
|
|
913
|
+
break;
|
|
914
|
+
case 1:
|
|
915
|
+
assert.isTrue(undefined !== entry.geomParams.pattern.space1 && undefined !== entry.geomParams.pattern.angle1 && undefined !== entry.geomParams.pattern.space2 && undefined !== entry.geomParams.pattern.angle2);
|
|
916
|
+
break;
|
|
917
|
+
case 2:
|
|
918
|
+
assert.isTrue(undefined !== entry.geomParams.pattern.symbolId && undefined === entry.geomParams.pattern.color);
|
|
919
|
+
break;
|
|
920
|
+
case 3:
|
|
921
|
+
assert.isTrue(undefined !== entry.geomParams.pattern.symbolId && undefined !== entry.geomParams.pattern.color);
|
|
922
|
+
break;
|
|
923
|
+
case 4:
|
|
924
|
+
assert.isTrue(undefined !== entry.geomParams.pattern.defLines && undefined === entry.geomParams.pattern.color);
|
|
925
|
+
break;
|
|
926
|
+
case 5:
|
|
927
|
+
assert.isTrue(undefined !== entry.geomParams.pattern.defLines && undefined !== entry.geomParams.pattern.color);
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
assert.isTrue(6 === iShape);
|
|
932
|
+
const usageInfo = imodel[_nativeDb].queryDefinitionElementUsage([partId]);
|
|
933
|
+
assert.isTrue(usageInfo.geometryPartIds.includes(partId));
|
|
934
|
+
assert.isTrue(usageInfo.usedIds.includes(partId));
|
|
935
|
+
});
|
|
936
|
+
it("create GeometricElement3d from world coordinate text using a newly added font", async () => {
|
|
937
|
+
// Set up element to be placed in iModel
|
|
938
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
939
|
+
assert.exists(seedElement);
|
|
940
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
941
|
+
const foundFont = imodel.fonts.findId({ name: "Vera" });
|
|
942
|
+
assert.exists(foundFont);
|
|
943
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
944
|
+
const testAngles = YawPitchRollAngles.createDegrees(45, 0, 0);
|
|
945
|
+
const builder = new GeometryStreamBuilder();
|
|
946
|
+
builder.setLocalToWorld3d(testOrigin, testAngles); // Establish world to local transform...
|
|
947
|
+
const textProps = {
|
|
948
|
+
text: "ABC",
|
|
949
|
+
font: foundFont,
|
|
950
|
+
height: 2,
|
|
951
|
+
bold: true,
|
|
952
|
+
origin: testOrigin,
|
|
953
|
+
rotation: testAngles,
|
|
954
|
+
};
|
|
955
|
+
const textString = new TextString(textProps);
|
|
956
|
+
const status = builder.appendTextString(textString);
|
|
957
|
+
assert.isTrue(status);
|
|
958
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles }, builder.geometryStream);
|
|
959
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
960
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
961
|
+
imodel.saveChanges();
|
|
962
|
+
// Extract and test value returned, text transform should now be identity as it is accounted for by element's placement...
|
|
963
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
964
|
+
assert.isDefined(value.geom);
|
|
965
|
+
let gotHeader = false;
|
|
966
|
+
for (const entry of value.geom) {
|
|
967
|
+
expect(undefined === entry.header).to.equal(gotHeader);
|
|
968
|
+
if (undefined !== entry.header) {
|
|
969
|
+
gotHeader = true;
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
assert.isDefined(entry.textString);
|
|
973
|
+
const origin = Point3d.fromJSON(entry.textString.origin);
|
|
974
|
+
const rotation = YawPitchRollAngles.fromJSON(entry.textString.rotation);
|
|
975
|
+
assert.isTrue(origin.isAlmostZero);
|
|
976
|
+
assert.isTrue(rotation.isIdentity());
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
expect(gotHeader).to.be.true;
|
|
980
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
981
|
+
for (const entry of itLocal) {
|
|
982
|
+
assertTrue(entry.primitive.type === "textString");
|
|
983
|
+
assert.isTrue(entry.primitive.textString.origin.isAlmostZero);
|
|
984
|
+
assert.isTrue(entry.primitive.textString.rotation.isIdentity());
|
|
985
|
+
}
|
|
986
|
+
const itWorld = GeometryStreamIterator.fromGeometricElement3d(value);
|
|
987
|
+
for (const entry of itWorld) {
|
|
988
|
+
assertTrue(entry.primitive.type === "textString");
|
|
989
|
+
assert.isTrue(entry.primitive.textString.origin.isAlmostEqual(testOrigin));
|
|
990
|
+
assert.isTrue(entry.primitive.textString.rotation.isAlmostEqual(testAngles));
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
it("create GeometryPart from arcs", async () => {
|
|
994
|
+
// Set up element to be placed in iModel
|
|
995
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
996
|
+
assert.exists(seedElement);
|
|
997
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
998
|
+
const geomArray = [
|
|
999
|
+
Arc3d.createXY(Point3d.create(0, 0), 5),
|
|
1000
|
+
Arc3d.createXY(Point3d.create(5, 5), 2),
|
|
1001
|
+
Arc3d.createXY(Point3d.create(-5, -5), 20),
|
|
1002
|
+
];
|
|
1003
|
+
const partBuilder = new GeometryStreamBuilder();
|
|
1004
|
+
for (const geom of geomArray) {
|
|
1005
|
+
partBuilder.appendGeometry(geom);
|
|
1006
|
+
}
|
|
1007
|
+
const partProps = createGeometryPartProps(partBuilder.geometryStream);
|
|
1008
|
+
const testPart = imodel.elements.createElement(partProps);
|
|
1009
|
+
const partId = imodel.elements.insertElement(testPart.toJSON());
|
|
1010
|
+
imodel.saveChanges();
|
|
1011
|
+
// Extract and test value returned
|
|
1012
|
+
const value = imodel.elements.getElementProps({ id: partId, wantGeometry: true });
|
|
1013
|
+
assert.isDefined(value.geom);
|
|
1014
|
+
const geomArrayOut = [];
|
|
1015
|
+
const itLocal = GeometryStreamIterator.fromGeometryPart(value);
|
|
1016
|
+
for (const entry of itLocal) {
|
|
1017
|
+
assertTrue(entry.primitive.type === "geometryQuery");
|
|
1018
|
+
assertTrue(entry.primitive.geometry instanceof Arc3d);
|
|
1019
|
+
geomArrayOut.push(entry.primitive.geometry);
|
|
1020
|
+
}
|
|
1021
|
+
assert.isTrue(geomArrayOut.length === geomArray.length);
|
|
1022
|
+
for (let i = 0; i < geomArrayOut.length; i++) {
|
|
1023
|
+
assert.isTrue(geomArrayOut[i].isAlmostEqual(geomArray[i]));
|
|
1024
|
+
}
|
|
1025
|
+
const usageInfo = imodel[_nativeDb].queryDefinitionElementUsage([partId]);
|
|
1026
|
+
assert.isTrue(usageInfo.geometryPartIds.includes(partId));
|
|
1027
|
+
assert.isUndefined(usageInfo.usedIds, "GeometryPart should not to be used by any GeometricElement");
|
|
1028
|
+
});
|
|
1029
|
+
it("create GeometricElement3d from arcs", async () => {
|
|
1030
|
+
// Set up element to be placed in iModel
|
|
1031
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1032
|
+
assert.exists(seedElement);
|
|
1033
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1034
|
+
const geomArray = [
|
|
1035
|
+
Arc3d.createXY(Point3d.create(0, 0), 5),
|
|
1036
|
+
Arc3d.createXY(Point3d.create(5, 5), 2),
|
|
1037
|
+
Arc3d.createXY(Point3d.create(-5, -5), 20),
|
|
1038
|
+
];
|
|
1039
|
+
const builder = new GeometryStreamBuilder();
|
|
1040
|
+
for (const geom of geomArray) {
|
|
1041
|
+
builder.appendGeometry(geom);
|
|
1042
|
+
}
|
|
1043
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
1044
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
1045
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
1046
|
+
imodel.saveChanges();
|
|
1047
|
+
// Extract and test value returned
|
|
1048
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
1049
|
+
assert.isDefined(value.geom);
|
|
1050
|
+
const geomArrayOut = [];
|
|
1051
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
1052
|
+
for (const entry of itLocal) {
|
|
1053
|
+
assertTrue(entry.primitive.type === "geometryQuery");
|
|
1054
|
+
assertTrue(entry.primitive.geometry instanceof Arc3d);
|
|
1055
|
+
geomArrayOut.push(entry.primitive.geometry);
|
|
1056
|
+
}
|
|
1057
|
+
assert.isTrue(geomArrayOut.length === geomArray.length);
|
|
1058
|
+
for (let i = 0; i < geomArrayOut.length; i++) {
|
|
1059
|
+
assert.isTrue(geomArrayOut[i].isAlmostEqual(geomArray[i]));
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
it("create GeometricElement3d partToWorld test", async () => {
|
|
1063
|
+
// Set up element to be placed in iModel
|
|
1064
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1065
|
+
assert.exists(seedElement);
|
|
1066
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1067
|
+
const arc = Arc3d.createXY(Point3d.create(0, 0), 1);
|
|
1068
|
+
const partBuilder = new GeometryStreamBuilder();
|
|
1069
|
+
partBuilder.appendGeometry(arc);
|
|
1070
|
+
const partProps = createGeometryPartProps(partBuilder.geometryStream);
|
|
1071
|
+
const testPart = imodel.elements.createElement(partProps);
|
|
1072
|
+
const partId = imodel.elements.insertElement(testPart.toJSON());
|
|
1073
|
+
imodel.saveChanges();
|
|
1074
|
+
const builder = new GeometryStreamBuilder();
|
|
1075
|
+
const shapePts = [Point3d.create(1, 1, 0), Point3d.create(2, 1, 0), Point3d.create(2, 2, 0), Point3d.create(1, 2, 0)];
|
|
1076
|
+
const testOrigin = Point3d.create(0.5, 0.5, 0);
|
|
1077
|
+
const testAngles = YawPitchRollAngles.createDegrees(45, 0, 0);
|
|
1078
|
+
builder.setLocalToWorld3d(testOrigin, testAngles);
|
|
1079
|
+
builder.appendGeometry(Loop.create(LineString3d.create(shapePts)));
|
|
1080
|
+
shapePts.forEach((pt) => builder.appendGeometryPart3d(partId, pt, undefined, 0.25)); // Position part (arc center) at each vertex...
|
|
1081
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles }, builder.geometryStream);
|
|
1082
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
1083
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
1084
|
+
imodel.saveChanges();
|
|
1085
|
+
// Extract and test value returned
|
|
1086
|
+
const valueElem = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
1087
|
+
assert.isDefined(valueElem.geom);
|
|
1088
|
+
const outPts = [];
|
|
1089
|
+
const itWorld = GeometryStreamIterator.fromGeometricElement3d(valueElem);
|
|
1090
|
+
for (const entry of itWorld) {
|
|
1091
|
+
if ("partReference" !== entry.primitive.type)
|
|
1092
|
+
continue;
|
|
1093
|
+
assertTrue(partId === entry.primitive.part.id);
|
|
1094
|
+
const valuePart = imodel.elements.getElementProps({ id: entry.primitive.part.id, wantGeometry: true });
|
|
1095
|
+
assert.isDefined(valuePart.geom);
|
|
1096
|
+
const itWorldPart = GeometryStreamIterator.fromGeometryPart(valuePart, undefined, itWorld.partToWorld());
|
|
1097
|
+
for (const partEntry of itWorldPart) {
|
|
1098
|
+
assertTrue(partEntry.primitive.type === "geometryQuery");
|
|
1099
|
+
assertTrue(partEntry.primitive.geometry instanceof Arc3d);
|
|
1100
|
+
outPts.push(partEntry.primitive.geometry.center);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
assert.isTrue(outPts.length === shapePts.length);
|
|
1104
|
+
for (let i = 0; i < outPts.length; i++) {
|
|
1105
|
+
assert.isTrue(outPts[i].isAlmostEqual(shapePts[i]));
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
it("create GeometricElement3d wire format appearance check", async () => {
|
|
1109
|
+
// Set up element to be placed in iModel
|
|
1110
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1111
|
+
assert.exists(seedElement);
|
|
1112
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1113
|
+
const builder = new GeometryStreamBuilder();
|
|
1114
|
+
const params = new GeometryParams(seedElement.category);
|
|
1115
|
+
const shape = Loop.create(LineString3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 0, 0), Point3d.create(1, 1, 0), Point3d.create(0, 1, 0), Point3d.create(0, 0, 0)));
|
|
1116
|
+
params.fillDisplay = FillDisplay.ByView;
|
|
1117
|
+
builder.appendGeometryParamsChange(params);
|
|
1118
|
+
builder.appendGeometry(shape);
|
|
1119
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
1120
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1121
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1122
|
+
imodel.saveChanges();
|
|
1123
|
+
// Extract and test value returned...
|
|
1124
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
1125
|
+
assert.isDefined(value.geom);
|
|
1126
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
1127
|
+
for (const entry of itLocal) {
|
|
1128
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
1129
|
+
assert.isTrue(FillDisplay.ByView === entry.geomParams.fillDisplay);
|
|
1130
|
+
}
|
|
1131
|
+
const geometryStream = [];
|
|
1132
|
+
geometryStream.push({ header: { flags: 0 } });
|
|
1133
|
+
geometryStream.push({ appearance: {} }); // Native ToJson should add appearance entry with no defined values for this case...
|
|
1134
|
+
geometryStream.push({ fill: { display: FillDisplay.ByView } });
|
|
1135
|
+
geometryStream.push({ loop: [{ lineString: [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]] }] });
|
|
1136
|
+
const fromBuilder = JSON.stringify(builder.geometryStream);
|
|
1137
|
+
const fromElProps = JSON.stringify(value.geom);
|
|
1138
|
+
const fromScratch = JSON.stringify(geometryStream);
|
|
1139
|
+
assert.isTrue(undefined !== builder.geometryStream[0].appearance && builder.geometryStream[0].appearance.subCategory === IModel.getDefaultSubCategoryId(value.category)); // Ensure default sub-category is specified...
|
|
1140
|
+
assert.isTrue(fromElProps !== fromBuilder); // Should not match, default sub-category should not be persisted...
|
|
1141
|
+
assert.isTrue(fromElProps === fromScratch);
|
|
1142
|
+
});
|
|
1143
|
+
it("create GeometricElement3d from world coordinate brep data", async () => {
|
|
1144
|
+
// Set up element to be placed in iModel
|
|
1145
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1146
|
+
assert.exists(seedElement);
|
|
1147
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1148
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1149
|
+
const testAngles = YawPitchRollAngles.createDegrees(45, 0, 0);
|
|
1150
|
+
const builder = new GeometryStreamBuilder();
|
|
1151
|
+
const params = new GeometryParams(seedElement.category);
|
|
1152
|
+
builder.setLocalToWorld3d(testOrigin, testAngles); // Establish world to local transform...
|
|
1153
|
+
params.lineColor = ColorDef.red;
|
|
1154
|
+
params.weight = 2;
|
|
1155
|
+
builder.appendGeometryParamsChange(params);
|
|
1156
|
+
const brepProps = createBRepDataProps(testOrigin, testAngles);
|
|
1157
|
+
builder.appendBRepData(brepProps);
|
|
1158
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles }, builder.geometryStream);
|
|
1159
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
1160
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
1161
|
+
imodel.saveChanges();
|
|
1162
|
+
// Extract and test value returned
|
|
1163
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true, wantBRepData: true });
|
|
1164
|
+
assert.isDefined(value.geom);
|
|
1165
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
1166
|
+
for (const entry of itLocal) {
|
|
1167
|
+
assert.equal(entry.primitive.type, "brep");
|
|
1168
|
+
}
|
|
1169
|
+
const itWorld = GeometryStreamIterator.fromGeometricElement3d(value);
|
|
1170
|
+
for (const entry of itWorld) {
|
|
1171
|
+
assert.equal(entry.primitive.type, "brep");
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
it("create GeometricElement3d with local coordinate indexed polyface json data", async () => {
|
|
1175
|
+
// Set up element to be placed in iModel
|
|
1176
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1177
|
+
assert.exists(seedElement);
|
|
1178
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1179
|
+
const xOffset = Transform.createTranslation(Point3d.create(2.5));
|
|
1180
|
+
const builder = new GeometryStreamBuilder();
|
|
1181
|
+
// NOTE: It's a good idea to request sub-graphic ranges when adding multiple "large" polyfaces to a geometry stream...
|
|
1182
|
+
builder.appendGeometryRanges();
|
|
1183
|
+
const polyface = createIndexedPolyface(5.0);
|
|
1184
|
+
builder.appendGeometry(polyface);
|
|
1185
|
+
polyface.tryTransformInPlace(xOffset); // translate in x...
|
|
1186
|
+
builder.appendGeometry(polyface);
|
|
1187
|
+
polyface.tryTransformInPlace(xOffset); // translate in x again...
|
|
1188
|
+
builder.appendGeometry(polyface);
|
|
1189
|
+
// NOTE: For time comparison with ElementGeometry: create GeometricElement3d with local coordinate indexed polyface flatbuffer data
|
|
1190
|
+
let timer = new Timer("createGeometricElem");
|
|
1191
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1192
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1193
|
+
const newId = createGeometricElem(builder.geometryStream, { origin: testOrigin, angles: testAngles }, imodel, seedElement);
|
|
1194
|
+
timer.end();
|
|
1195
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1196
|
+
imodel.saveChanges();
|
|
1197
|
+
timer = new Timer("queryGeometricElem");
|
|
1198
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
1199
|
+
assert.isDefined(value.geom);
|
|
1200
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
1201
|
+
for (const entry of itLocal) {
|
|
1202
|
+
assert.isTrue(entry.geomParams.categoryId === seedElement.category); // Current appearance information (default sub-category appearance in this case)...
|
|
1203
|
+
assert.isTrue(undefined !== entry.localRange && !entry.localRange.isNull); // Make sure sub-graphic ranges were added...
|
|
1204
|
+
assertTrue(entry.primitive.type === "geometryQuery");
|
|
1205
|
+
assertTrue(entry.primitive.geometry instanceof IndexedPolyface);
|
|
1206
|
+
const polyOut = entry.primitive.geometry;
|
|
1207
|
+
assert.isTrue(polyOut.pointCount === polyface.pointCount);
|
|
1208
|
+
assert.isTrue(polyOut.paramCount === polyface.paramCount);
|
|
1209
|
+
assert.isTrue(polyOut.normalCount === polyface.normalCount);
|
|
1210
|
+
}
|
|
1211
|
+
timer.end();
|
|
1212
|
+
});
|
|
1213
|
+
it("should preserve header with flags", () => {
|
|
1214
|
+
const builder = new GeometryStreamBuilder();
|
|
1215
|
+
builder.appendGeometry(Arc3d.createXY(Point3d.create(0, 0), 5));
|
|
1216
|
+
const roundTrip = () => {
|
|
1217
|
+
const iter = new GeometryStreamIterator(builder.geometryStream);
|
|
1218
|
+
expect((iter.flags === GeometryStreamFlags.ViewIndependent)).to.equal(builder.isViewIndependent);
|
|
1219
|
+
const partProps = createGeometryPartProps(builder.geometryStream);
|
|
1220
|
+
const part = imodel.elements.createElement(partProps);
|
|
1221
|
+
const partId = imodel.elements.insertElement(part.toJSON());
|
|
1222
|
+
imodel.saveChanges();
|
|
1223
|
+
const json = imodel.elements.getElementProps({ id: partId, wantGeometry: true });
|
|
1224
|
+
expect(json.geom).not.to.be.undefined;
|
|
1225
|
+
expect(json.geom.length).to.equal(2);
|
|
1226
|
+
expect(json.geom[0].header).not.to.be.undefined;
|
|
1227
|
+
const flags = json.geom[0].header.flags;
|
|
1228
|
+
expect(flags).to.equal(builder.isViewIndependent ? GeometryStreamFlags.ViewIndependent : GeometryStreamFlags.None);
|
|
1229
|
+
if (undefined !== builder.getHeader())
|
|
1230
|
+
expect(JSON.stringify(builder.geometryStream[0])).to.equal(JSON.stringify(json.geom[0]));
|
|
1231
|
+
};
|
|
1232
|
+
expect(builder.getHeader()).to.be.undefined;
|
|
1233
|
+
expect(builder.isViewIndependent).to.be.false;
|
|
1234
|
+
roundTrip();
|
|
1235
|
+
builder.isViewIndependent = false;
|
|
1236
|
+
expect(builder.getHeader()).to.be.undefined;
|
|
1237
|
+
expect(builder.isViewIndependent).to.be.false;
|
|
1238
|
+
roundTrip();
|
|
1239
|
+
builder.isViewIndependent = true;
|
|
1240
|
+
expect(builder.getHeader()).not.to.be.undefined;
|
|
1241
|
+
expect(builder.isViewIndependent).to.be.true;
|
|
1242
|
+
roundTrip();
|
|
1243
|
+
builder.isViewIndependent = false;
|
|
1244
|
+
expect(builder.getHeader()).not.to.be.undefined;
|
|
1245
|
+
expect(builder.isViewIndependent).to.be.false;
|
|
1246
|
+
});
|
|
1247
|
+
});
|
|
1248
|
+
describe("ElementGeometry", () => {
|
|
1249
|
+
let imodel;
|
|
1250
|
+
before(() => {
|
|
1251
|
+
const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
|
|
1252
|
+
const testFileName = IModelTestUtils.prepareOutputFile("GeometryStream", "GeometryStreamTest.bim");
|
|
1253
|
+
imodel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
|
|
1254
|
+
});
|
|
1255
|
+
after(() => {
|
|
1256
|
+
imodel.close();
|
|
1257
|
+
});
|
|
1258
|
+
it("Exercise using builder/iterator in world coordinates with flatbuffer data", async () => {
|
|
1259
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1260
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1261
|
+
const pts = [];
|
|
1262
|
+
pts.push(Point3d.create(5, 10, 0));
|
|
1263
|
+
pts.push(Point3d.create(10, 10, 0));
|
|
1264
|
+
pts.push(Point3d.create(10, 15, 0));
|
|
1265
|
+
pts.push(Point3d.create(5, 15, 0));
|
|
1266
|
+
pts.push(pts[0].clone());
|
|
1267
|
+
const builder = new ElementGeometry.Builder();
|
|
1268
|
+
const primitive = LineString3d.create(pts);
|
|
1269
|
+
builder.setLocalToWorld3d(testOrigin, testAngles); // Establish world to local transform for append...
|
|
1270
|
+
const status = builder.appendGeometryQuery(primitive);
|
|
1271
|
+
assert.isTrue(status);
|
|
1272
|
+
const it = new ElementGeometry.Iterator({ entryArray: builder.entries }, undefined, builder.localToWorld);
|
|
1273
|
+
it.requestWorldCoordinates(); // Apply local to world to entries...
|
|
1274
|
+
for (const entry of it) {
|
|
1275
|
+
const geom = entry.toGeometryQuery();
|
|
1276
|
+
assert.exists(geom);
|
|
1277
|
+
assertTrue(geom instanceof LineString3d);
|
|
1278
|
+
assert.isTrue(Point3dArray.isAlmostEqual(pts, geom.points));
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
it("request geometry stream flatbuffer data from existing element", async () => {
|
|
1282
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1283
|
+
assert.exists(seedElement);
|
|
1284
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1285
|
+
const expected = [{ opcode: ElementGeometryOpcode.SolidPrimitive, geometryCategory: "solid", geometrySubCategory: "sphere" }];
|
|
1286
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, "0x1d", expected, false));
|
|
1287
|
+
});
|
|
1288
|
+
it("create GeometricElement3d from local coordinate point and arc primitive flatbuffer data", async () => {
|
|
1289
|
+
// Set up element to be placed in iModel
|
|
1290
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1291
|
+
assert.exists(seedElement);
|
|
1292
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1293
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1294
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1295
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1296
|
+
const pts = [];
|
|
1297
|
+
pts.push(Point3d.create(5, 10, 0));
|
|
1298
|
+
pts.push(Point3d.create(10, 10, 0));
|
|
1299
|
+
pts.push(Point3d.create(10, 15, 0));
|
|
1300
|
+
pts.push(Point3d.create(5, 15, 0));
|
|
1301
|
+
pts.push(pts[0].clone());
|
|
1302
|
+
const expected = [];
|
|
1303
|
+
const newEntries = [];
|
|
1304
|
+
const entryLN = ElementGeometry.fromGeometryQuery(LineSegment3d.create(pts[0], pts[1]));
|
|
1305
|
+
assert.exists(entryLN);
|
|
1306
|
+
newEntries.push(entryLN);
|
|
1307
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "lineString" });
|
|
1308
|
+
const entryLS = ElementGeometry.fromGeometryQuery(LineString3d.create(pts));
|
|
1309
|
+
assert.exists(entryLS);
|
|
1310
|
+
newEntries.push(entryLS);
|
|
1311
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "lineString" });
|
|
1312
|
+
const entrySH = ElementGeometry.fromGeometryQuery(Loop.createPolygon(pts));
|
|
1313
|
+
assert.exists(entrySH);
|
|
1314
|
+
newEntries.push(entrySH);
|
|
1315
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1316
|
+
const entryPS = ElementGeometry.fromGeometryQuery(PointString3d.create(pts));
|
|
1317
|
+
assert.exists(entryPS);
|
|
1318
|
+
newEntries.push(entryPS);
|
|
1319
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "pointCollection" });
|
|
1320
|
+
const entryAR = ElementGeometry.fromGeometryQuery(Arc3d.createXY(pts[0], pts[0].distance(pts[1])));
|
|
1321
|
+
assert.exists(entryAR);
|
|
1322
|
+
newEntries.push(entryAR);
|
|
1323
|
+
expected.push({ opcode: ElementGeometryOpcode.ArcPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "arc" });
|
|
1324
|
+
const entryEL = ElementGeometry.fromGeometryQuery(Loop.create(Arc3d.createXY(pts[0], pts[0].distance(pts[1]))));
|
|
1325
|
+
assert.exists(entryEL);
|
|
1326
|
+
newEntries.push(entryEL);
|
|
1327
|
+
expected.push({ opcode: ElementGeometryOpcode.ArcPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1328
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1329
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1330
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1331
|
+
imodel.saveChanges();
|
|
1332
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1333
|
+
});
|
|
1334
|
+
it("create GeometricElement3d from local coordinate interpolation curve flatbuffer data", async () => {
|
|
1335
|
+
// Set up element to be placed in iModel
|
|
1336
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1337
|
+
assert.exists(seedElement);
|
|
1338
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1339
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1340
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1341
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1342
|
+
const pts = [];
|
|
1343
|
+
pts.push(Point3d.create(5, 10, 0));
|
|
1344
|
+
pts.push(Point3d.create(10, 10, 0));
|
|
1345
|
+
pts.push(Point3d.create(10, 15, 0));
|
|
1346
|
+
pts.push(Point3d.create(5, 15, 0));
|
|
1347
|
+
const expected = [];
|
|
1348
|
+
const newEntries = [];
|
|
1349
|
+
const interpolationProps = { fitPoints: pts, closed: false, isChordLenKnots: 1, isColinearTangents: 1 };
|
|
1350
|
+
const interpolationOpts = InterpolationCurve3dOptions.create(interpolationProps);
|
|
1351
|
+
const interpolationCurve = InterpolationCurve3d.createCapture(interpolationOpts);
|
|
1352
|
+
assert.isDefined(interpolationCurve);
|
|
1353
|
+
const entry1 = ElementGeometry.fromGeometryQuery(interpolationCurve);
|
|
1354
|
+
assert.exists(entry1);
|
|
1355
|
+
newEntries.push(entry1);
|
|
1356
|
+
expected.push({ opcode: ElementGeometryOpcode.CurvePrimitive, geometryCategory: "curvePrimitive" });
|
|
1357
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1358
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1359
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1360
|
+
imodel.saveChanges();
|
|
1361
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1362
|
+
});
|
|
1363
|
+
it("create GeometricElement3d with local coordinate indexed polyface flatbuffer data", async () => {
|
|
1364
|
+
// Set up element to be placed in iModel
|
|
1365
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1366
|
+
assert.exists(seedElement);
|
|
1367
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1368
|
+
const xOffset = Transform.createTranslation(Point3d.create(2.5));
|
|
1369
|
+
const builder = new ElementGeometry.Builder();
|
|
1370
|
+
// NOTE: It's a good idea to request sub-graphic ranges when adding multiple "large" polyfaces to a geometry stream...
|
|
1371
|
+
builder.appendGeometryRanges();
|
|
1372
|
+
const polyface = createIndexedPolyface(5.0);
|
|
1373
|
+
builder.appendGeometryQuery(polyface);
|
|
1374
|
+
polyface.tryTransformInPlace(xOffset); // translate in x...
|
|
1375
|
+
builder.appendGeometryQuery(polyface);
|
|
1376
|
+
polyface.tryTransformInPlace(xOffset); // translate in x again...
|
|
1377
|
+
builder.appendGeometryQuery(polyface);
|
|
1378
|
+
// NOTE: For time comparison with GeometryStream: create GeometricElement3d with local coordinate indexed polyface json data
|
|
1379
|
+
let timer = new Timer("elementGeometryInsert");
|
|
1380
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1381
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1382
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1383
|
+
elementProps.elementGeometryBuilderParams = { entryArray: builder.entries };
|
|
1384
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1385
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1386
|
+
imodel.saveChanges();
|
|
1387
|
+
timer.end();
|
|
1388
|
+
const onGeometry = (info) => {
|
|
1389
|
+
assert.isTrue(6 === info.entryArray.length); // 3 pairs of sub-range + polyface...
|
|
1390
|
+
const it = new ElementGeometry.Iterator(info);
|
|
1391
|
+
for (const entry of it) {
|
|
1392
|
+
assert.isTrue(entry.geomParams.categoryId === info.categoryId); // Current appearance information (default sub-category appearance in this case)...
|
|
1393
|
+
assert.isTrue(undefined !== entry.localRange && !entry.localRange.isNull); // Make sure sub-graphic ranges were added...
|
|
1394
|
+
const geom = entry.toGeometryQuery();
|
|
1395
|
+
assert.exists(geom);
|
|
1396
|
+
assert.isTrue(geom instanceof IndexedPolyface);
|
|
1397
|
+
const polyOut = geom;
|
|
1398
|
+
assert.isTrue(polyOut.pointCount === polyface.pointCount);
|
|
1399
|
+
assert.isTrue(polyOut.paramCount === polyface.paramCount);
|
|
1400
|
+
assert.isTrue(polyOut.normalCount === polyface.normalCount);
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
timer = new Timer("elementGeometryRequest");
|
|
1404
|
+
const status = imodel.elementGeometryRequest({ onGeometry, elementId: newId });
|
|
1405
|
+
timer.end();
|
|
1406
|
+
assert.isTrue(IModelStatus.Success === status);
|
|
1407
|
+
});
|
|
1408
|
+
it("create GeometricElement3d from local coordinate brep flatbuffer data", async () => {
|
|
1409
|
+
// Set up element to be placed in iModel
|
|
1410
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1411
|
+
assert.exists(seedElement);
|
|
1412
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1413
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1414
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1415
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1416
|
+
const expected = [];
|
|
1417
|
+
const expectedFacet = [];
|
|
1418
|
+
const expectedSkip = [];
|
|
1419
|
+
const newEntries = [];
|
|
1420
|
+
const brepProps = createBRepDataProps(testOrigin, testAngles);
|
|
1421
|
+
const entry = ElementGeometry.fromBRep(brepProps);
|
|
1422
|
+
assert.exists(entry);
|
|
1423
|
+
newEntries.push(entry);
|
|
1424
|
+
expected.push({ opcode: ElementGeometryOpcode.BRep, originalEntry: entry });
|
|
1425
|
+
// Why 6 and not 4?
|
|
1426
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1427
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.Polyface, geometryCategory: "polyface" });
|
|
1428
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1429
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.Polyface, geometryCategory: "polyface" });
|
|
1430
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1431
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.Polyface, geometryCategory: "polyface" });
|
|
1432
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1433
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1434
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1435
|
+
imodel.saveChanges();
|
|
1436
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1437
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expectedFacet, false, undefined, 1));
|
|
1438
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expectedSkip, false, undefined, 2));
|
|
1439
|
+
});
|
|
1440
|
+
it("apply world coordinate transform directly to brep flatbuffer data", async () => {
|
|
1441
|
+
// Set up element to be placed in iModel
|
|
1442
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1443
|
+
assert.exists(seedElement);
|
|
1444
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1445
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1446
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1447
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1448
|
+
const brepProps = createBRepDataProps();
|
|
1449
|
+
const entry = ElementGeometry.fromBRep(brepProps);
|
|
1450
|
+
assert.exists(entry);
|
|
1451
|
+
const entityTransform = Transform.createOriginAndMatrix(testOrigin, testAngles.toMatrix3d());
|
|
1452
|
+
const status = ElementGeometry.transformBRep(entry, entityTransform);
|
|
1453
|
+
assert.isTrue(status);
|
|
1454
|
+
const worldBRep = ElementGeometry.toBRep(entry);
|
|
1455
|
+
assert.exists(worldBRep);
|
|
1456
|
+
const worldTransform = Transform.fromJSON(worldBRep?.transform);
|
|
1457
|
+
assert.isTrue(worldTransform.isAlmostEqual(entityTransform));
|
|
1458
|
+
const newEntries = [];
|
|
1459
|
+
newEntries.push(entry);
|
|
1460
|
+
// Facet to make sure brep and face attachments are intact after transformBRep...
|
|
1461
|
+
const expectedFacet = [];
|
|
1462
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1463
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.Polyface, geometryCategory: "polyface" });
|
|
1464
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1465
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.Polyface, geometryCategory: "polyface" });
|
|
1466
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1467
|
+
expectedFacet.push({ opcode: ElementGeometryOpcode.Polyface, geometryCategory: "polyface" });
|
|
1468
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1469
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1470
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1471
|
+
imodel.saveChanges();
|
|
1472
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expectedFacet, false, undefined, 1));
|
|
1473
|
+
});
|
|
1474
|
+
it("test BRep entity transform", async () => {
|
|
1475
|
+
const localToWorld = Transform.createOriginAndMatrix(Point3d.create(5, 10, 0), YawPitchRollAngles.createDegrees(0, 0, 0).toMatrix3d());
|
|
1476
|
+
const worldToLocal = localToWorld.inverse();
|
|
1477
|
+
// Specify an entity transform that won't have translation/rotation fully cancelled out by placement...
|
|
1478
|
+
const brepProps = createBRepDataProps(Point3d.create(15, 25, 5), YawPitchRollAngles.createDegrees(90, 0, 0));
|
|
1479
|
+
const brepEntry = ElementGeometry.fromBRep(brepProps, worldToLocal);
|
|
1480
|
+
assert.exists(brepEntry);
|
|
1481
|
+
const brepToWorldExpected = Transform.fromJSON(brepProps.transform);
|
|
1482
|
+
const brepToLocalExpected = worldToLocal.multiplyTransformTransform(brepToWorldExpected);
|
|
1483
|
+
// Check for expected brep to local transform...
|
|
1484
|
+
const brepPropsLocal = ElementGeometry.toBRep(brepEntry, false);
|
|
1485
|
+
assert.exists(brepPropsLocal);
|
|
1486
|
+
const brepToLocal = Transform.fromJSON(brepPropsLocal.transform);
|
|
1487
|
+
assert.isTrue(brepToLocalExpected.isAlmostEqual(brepToLocal));
|
|
1488
|
+
// Check for expected brep to world transform...
|
|
1489
|
+
const brepPropsWorld = ElementGeometry.toBRep(brepEntry, false, localToWorld);
|
|
1490
|
+
assert.exists(brepPropsWorld);
|
|
1491
|
+
const brepToWorld = Transform.fromJSON(brepPropsWorld.transform);
|
|
1492
|
+
assert.isTrue(brepToWorldExpected.isAlmostEqual(brepToWorld));
|
|
1493
|
+
// Ensure that applying transform directly to flat buffer data produces same result...
|
|
1494
|
+
ElementGeometry.transformBRep(brepEntry, localToWorld);
|
|
1495
|
+
const brepPropsWorld2 = ElementGeometry.toBRep(brepEntry, false);
|
|
1496
|
+
assert.exists(brepPropsWorld2);
|
|
1497
|
+
const brepToWorld2 = Transform.fromJSON(brepPropsWorld2.transform);
|
|
1498
|
+
assert.isTrue(brepToWorldExpected.isAlmostEqual(brepToWorld2));
|
|
1499
|
+
// Check json format geometry stream...
|
|
1500
|
+
const builder = new GeometryStreamBuilder();
|
|
1501
|
+
builder.setLocalToWorld(localToWorld);
|
|
1502
|
+
builder.appendBRepData(brepProps);
|
|
1503
|
+
const itLocal = new GeometryStreamIterator(builder.geometryStream);
|
|
1504
|
+
for (const entry of itLocal) {
|
|
1505
|
+
assertTrue(entry.primitive.type === "brep");
|
|
1506
|
+
const brepToLocalGSB = Transform.fromJSON(entry.primitive.brep.transform);
|
|
1507
|
+
assert.isTrue(brepToLocalExpected.isAlmostEqual(brepToLocalGSB));
|
|
1508
|
+
}
|
|
1509
|
+
const itWorld = new GeometryStreamIterator(builder.geometryStream, undefined, localToWorld);
|
|
1510
|
+
for (const entry of itWorld) {
|
|
1511
|
+
assertTrue(entry.primitive.type === "brep");
|
|
1512
|
+
const brepToWorldGSB = Transform.fromJSON(entry.primitive.brep.transform);
|
|
1513
|
+
assert.isTrue(brepToWorldExpected.isAlmostEqual(brepToWorldGSB));
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
it("create GeometricElement3d from local coordinate text string flatbuffer data", async () => {
|
|
1517
|
+
// Set up element to be placed in iModel
|
|
1518
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1519
|
+
assert.exists(seedElement);
|
|
1520
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1521
|
+
const foundFont = imodel.fonts.findId({ name: "Vera" });
|
|
1522
|
+
assert.exists(foundFont);
|
|
1523
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1524
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1525
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1526
|
+
const expected = [];
|
|
1527
|
+
const newEntries = [];
|
|
1528
|
+
const textProps = {
|
|
1529
|
+
text: "ABC",
|
|
1530
|
+
font: foundFont,
|
|
1531
|
+
height: 2,
|
|
1532
|
+
bold: true,
|
|
1533
|
+
origin: testOrigin,
|
|
1534
|
+
rotation: testAngles,
|
|
1535
|
+
};
|
|
1536
|
+
const glyphData = {
|
|
1537
|
+
glyphIds: [1, 2, 3],
|
|
1538
|
+
glyphOrigins: [new Point2d(0.0, 0.0), new Point2d(1000.0, 0.0), new Point2d(2000.0, 0.0)],
|
|
1539
|
+
range: new Range2d(0, 0, 10, 30),
|
|
1540
|
+
};
|
|
1541
|
+
const entry = ElementGeometry.fromTextString(textProps, undefined, glyphData);
|
|
1542
|
+
assert.exists(entry);
|
|
1543
|
+
newEntries.push(entry);
|
|
1544
|
+
// We can't validate glyph data later from the TextString in the DB because the native TextString will re-compute them if the font isn't embedded.
|
|
1545
|
+
// So, just verify that we are passing the correct flatbuffer here.
|
|
1546
|
+
assert.deepEqual(entry ? ElementGeometry.toTextStringGlyphData(entry) : undefined, glyphData);
|
|
1547
|
+
expected.push({ opcode: ElementGeometryOpcode.TextString, originalEntry: entry });
|
|
1548
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1549
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1550
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1551
|
+
imodel.saveChanges();
|
|
1552
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1553
|
+
});
|
|
1554
|
+
it("create GeometricElement3d from local coordinate image flatbuffer data", async () => {
|
|
1555
|
+
// Set up element to be placed in iModel
|
|
1556
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1557
|
+
assert.exists(seedElement);
|
|
1558
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1559
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1560
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1561
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1562
|
+
const expected = [];
|
|
1563
|
+
const newEntries = [];
|
|
1564
|
+
const imageProps = {
|
|
1565
|
+
corners: [Point3d.create(), Point3d.create(1, 0), Point3d.create(1, 1), Point3d.create(0, 1)],
|
|
1566
|
+
textureId: "0x1",
|
|
1567
|
+
hasBorder: true,
|
|
1568
|
+
};
|
|
1569
|
+
const entry = ElementGeometry.fromImageGraphic(imageProps);
|
|
1570
|
+
assert.exists(entry);
|
|
1571
|
+
newEntries.push(entry);
|
|
1572
|
+
expected.push({ opcode: ElementGeometryOpcode.Image, originalEntry: entry });
|
|
1573
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1574
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1575
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1576
|
+
imodel.saveChanges();
|
|
1577
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1578
|
+
});
|
|
1579
|
+
it("create GeometricElement3d with sub-graphic ranges flatbuffer data", async () => {
|
|
1580
|
+
// Set up element to be placed in iModel
|
|
1581
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1582
|
+
assert.exists(seedElement);
|
|
1583
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1584
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1585
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1586
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1587
|
+
const expected = [];
|
|
1588
|
+
const newEntries = [];
|
|
1589
|
+
const entrySG = ElementGeometry.fromSubGraphicRange(Range3d.create()); // Computed on backend, just need opcode...
|
|
1590
|
+
assert.exists(entrySG);
|
|
1591
|
+
newEntries.push(entrySG);
|
|
1592
|
+
expected.push({ opcode: ElementGeometryOpcode.SubGraphicRange });
|
|
1593
|
+
const pts = [];
|
|
1594
|
+
pts.push(Point3d.create(0, 0, 0));
|
|
1595
|
+
pts.push(Point3d.create(5, 5, 0));
|
|
1596
|
+
pts.push(Point3d.create(-5, -5, 0));
|
|
1597
|
+
const entryL1 = ElementGeometry.fromGeometryQuery(LineSegment3d.create(pts[0], pts[1]));
|
|
1598
|
+
assert.exists(entryL1);
|
|
1599
|
+
newEntries.push(entryL1);
|
|
1600
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "lineString" });
|
|
1601
|
+
expected.push({ opcode: ElementGeometryOpcode.SubGraphicRange }); // Added on backend...
|
|
1602
|
+
const entryL2 = ElementGeometry.fromGeometryQuery(LineSegment3d.create(pts[0], pts[2]));
|
|
1603
|
+
assert.exists(entryL2);
|
|
1604
|
+
newEntries.push(entryL2);
|
|
1605
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "lineString" });
|
|
1606
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1607
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1608
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1609
|
+
imodel.saveChanges();
|
|
1610
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1611
|
+
});
|
|
1612
|
+
it("create GeometricElement3d with part reference flatbuffer data", async () => {
|
|
1613
|
+
// Set up element to be placed in iModel
|
|
1614
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1615
|
+
assert.exists(seedElement);
|
|
1616
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1617
|
+
const partProps = createGeometryPartProps();
|
|
1618
|
+
const expectedPart = [];
|
|
1619
|
+
const newPartEntries = [];
|
|
1620
|
+
const entryAR = ElementGeometry.fromGeometryQuery(Arc3d.createXY(Point3d.createZero(), 2.5));
|
|
1621
|
+
assert.exists(entryAR);
|
|
1622
|
+
newPartEntries.push(entryAR);
|
|
1623
|
+
expectedPart.push({ opcode: ElementGeometryOpcode.ArcPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "arc" });
|
|
1624
|
+
partProps.elementGeometryBuilderParams = { entryArray: newPartEntries };
|
|
1625
|
+
const partId = imodel.elements.insertElement(partProps);
|
|
1626
|
+
assert.isTrue(Id64.isValidId64(partId));
|
|
1627
|
+
imodel.saveChanges();
|
|
1628
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, partId, expectedPart, false));
|
|
1629
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1630
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1631
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1632
|
+
const expected = [];
|
|
1633
|
+
const newEntries = [];
|
|
1634
|
+
const partToElement = Transform.createIdentity();
|
|
1635
|
+
const entryPI = ElementGeometry.fromGeometryPart(partId);
|
|
1636
|
+
assert.exists(entryPI);
|
|
1637
|
+
ElementGeometry.toGeometryPart(entryPI, partToElement);
|
|
1638
|
+
assert.isTrue(partToElement.isIdentity);
|
|
1639
|
+
newEntries.push(entryPI);
|
|
1640
|
+
expected.push({ opcode: ElementGeometryOpcode.PartReference, originalEntry: entryPI });
|
|
1641
|
+
const transPT = Transform.createTranslation(Point3d.create(5, 5, 0));
|
|
1642
|
+
const entryPT = ElementGeometry.fromGeometryPart(partId, transPT);
|
|
1643
|
+
assert.exists(entryPT);
|
|
1644
|
+
ElementGeometry.toGeometryPart(entryPT, partToElement);
|
|
1645
|
+
assert.isTrue(partToElement.isAlmostEqual(transPT));
|
|
1646
|
+
newEntries.push(entryPT);
|
|
1647
|
+
expected.push({ opcode: ElementGeometryOpcode.PartReference, originalEntry: entryPT });
|
|
1648
|
+
const transPR = Transform.createOriginAndMatrix(testOrigin, testAngles.toMatrix3d());
|
|
1649
|
+
const entryPR = ElementGeometry.fromGeometryPart(partId, transPR);
|
|
1650
|
+
assert.exists(entryPR);
|
|
1651
|
+
ElementGeometry.toGeometryPart(entryPR, partToElement);
|
|
1652
|
+
assert.isTrue(partToElement.isAlmostEqual(transPR));
|
|
1653
|
+
newEntries.push(entryPR);
|
|
1654
|
+
expected.push({ opcode: ElementGeometryOpcode.PartReference, originalEntry: entryPR });
|
|
1655
|
+
const transPS = Transform.createScaleAboutPoint(testOrigin, 2);
|
|
1656
|
+
const entryPS = ElementGeometry.fromGeometryPart(partId, transPS);
|
|
1657
|
+
assert.exists(entryPS);
|
|
1658
|
+
ElementGeometry.toGeometryPart(entryPS, partToElement);
|
|
1659
|
+
assert.isTrue(partToElement.isAlmostEqual(transPS));
|
|
1660
|
+
newEntries.push(entryPS);
|
|
1661
|
+
expected.push({ opcode: ElementGeometryOpcode.PartReference, originalEntry: entryPS });
|
|
1662
|
+
const transPA = transPR.multiplyTransformTransform(transPS);
|
|
1663
|
+
const entryPA = ElementGeometry.fromGeometryPart(partId, transPA);
|
|
1664
|
+
assert.exists(entryPA);
|
|
1665
|
+
ElementGeometry.toGeometryPart(entryPA, partToElement);
|
|
1666
|
+
assert.isTrue(partToElement.isAlmostEqual(transPA));
|
|
1667
|
+
newEntries.push(entryPA);
|
|
1668
|
+
expected.push({ opcode: ElementGeometryOpcode.PartReference, originalEntry: entryPA });
|
|
1669
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1670
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1671
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1672
|
+
imodel.saveChanges();
|
|
1673
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1674
|
+
});
|
|
1675
|
+
it("create GeometricElement3d with appearance flatbuffer data", async () => {
|
|
1676
|
+
// Set up element to be placed in iModel
|
|
1677
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1678
|
+
assert.exists(seedElement);
|
|
1679
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1680
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1681
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1682
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1683
|
+
const pts = [];
|
|
1684
|
+
pts.push(Point3d.create(5, 10, 0));
|
|
1685
|
+
pts.push(Point3d.create(10, 10, 0));
|
|
1686
|
+
pts.push(Point3d.create(10, 15, 0));
|
|
1687
|
+
pts.push(Point3d.create(5, 15, 0));
|
|
1688
|
+
pts.push(pts[0].clone());
|
|
1689
|
+
const entrySH = ElementGeometry.fromGeometryQuery(Loop.createPolygon(pts));
|
|
1690
|
+
assert.exists(entrySH);
|
|
1691
|
+
const expected = [];
|
|
1692
|
+
const newEntries = [];
|
|
1693
|
+
const geomParams = new GeometryParams(seedElement.category);
|
|
1694
|
+
// Shape with red outline...
|
|
1695
|
+
geomParams.lineColor = ColorDef.red;
|
|
1696
|
+
let added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1697
|
+
assert.isTrue(added);
|
|
1698
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology, geomParams: geomParams.clone() });
|
|
1699
|
+
newEntries.push(entrySH);
|
|
1700
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1701
|
+
// Shape with gradient fill...
|
|
1702
|
+
geomParams.fillDisplay = FillDisplay.ByView;
|
|
1703
|
+
geomParams.gradient = new Gradient.Symb();
|
|
1704
|
+
geomParams.gradient.mode = Gradient.Mode.Linear;
|
|
1705
|
+
geomParams.gradient.flags = Gradient.Flags.Outline;
|
|
1706
|
+
geomParams.gradient.keys.push(new Gradient.KeyColor({ value: 0.0, color: ColorDef.blue.toJSON() }));
|
|
1707
|
+
geomParams.gradient.keys.push(new Gradient.KeyColor({ value: 0.5, color: ColorDef.red.toJSON() }));
|
|
1708
|
+
geomParams.gradient.angle = Angle.createDegrees(45);
|
|
1709
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1710
|
+
assert.isTrue(added);
|
|
1711
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1712
|
+
expected.push({ opcode: ElementGeometryOpcode.Fill, geomParams: geomParams.clone() });
|
|
1713
|
+
newEntries.push(entrySH);
|
|
1714
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1715
|
+
// Shape with thematic gradient fill...
|
|
1716
|
+
geomParams.gradient.mode = Gradient.Mode.Thematic;
|
|
1717
|
+
geomParams.gradient.thematicSettings = ThematicGradientSettings.fromJSON({ mode: ThematicGradientMode.Stepped, stepCount: 5 });
|
|
1718
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1719
|
+
assert.isTrue(added);
|
|
1720
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1721
|
+
expected.push({ opcode: ElementGeometryOpcode.Fill, geomParams: geomParams.clone() });
|
|
1722
|
+
newEntries.push(entrySH);
|
|
1723
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1724
|
+
// Shape with bg fill...
|
|
1725
|
+
geomParams.gradient = undefined;
|
|
1726
|
+
geomParams.backgroundFill = BackgroundFill.Outline;
|
|
1727
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1728
|
+
assert.isTrue(added);
|
|
1729
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1730
|
+
expected.push({ opcode: ElementGeometryOpcode.Fill, geomParams: geomParams.clone() });
|
|
1731
|
+
newEntries.push(entrySH);
|
|
1732
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1733
|
+
// Shape with solid fill...
|
|
1734
|
+
geomParams.backgroundFill = undefined;
|
|
1735
|
+
geomParams.fillColor = ColorDef.blue;
|
|
1736
|
+
geomParams.fillTransparency = 0.75;
|
|
1737
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1738
|
+
assert.isTrue(added);
|
|
1739
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1740
|
+
expected.push({ opcode: ElementGeometryOpcode.Fill, geomParams: geomParams.clone() });
|
|
1741
|
+
newEntries.push(entrySH);
|
|
1742
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1743
|
+
// Shape with solid fill and render material
|
|
1744
|
+
geomParams.materialId = "0x5";
|
|
1745
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1746
|
+
assert.isTrue(added);
|
|
1747
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1748
|
+
expected.push({ opcode: ElementGeometryOpcode.Fill });
|
|
1749
|
+
expected.push({ opcode: ElementGeometryOpcode.Material, geomParams: geomParams.clone() });
|
|
1750
|
+
newEntries.push(entrySH);
|
|
1751
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1752
|
+
// Green construction line to test ignoring region specific appearance like fill...
|
|
1753
|
+
geomParams.materialId = undefined;
|
|
1754
|
+
geomParams.lineColor = ColorDef.green;
|
|
1755
|
+
geomParams.weight = 2;
|
|
1756
|
+
const modifiers = new LineStyle.Modifier({
|
|
1757
|
+
scale: 2, dashScale: 0.5, gapScale: 0.2,
|
|
1758
|
+
startWidth: 0.1, endWidth: 0.3,
|
|
1759
|
+
distPhase: 0.25, fractPhase: 0.1, centerPhase: true,
|
|
1760
|
+
segmentMode: false, physicalWidth: true,
|
|
1761
|
+
normal: Vector3d.unitZ().toJSON(),
|
|
1762
|
+
rotation: YawPitchRollAngles.createDegrees(45, 0, 0).toJSON(),
|
|
1763
|
+
});
|
|
1764
|
+
geomParams.styleInfo = new LineStyle.Info(Id64.invalid, modifiers);
|
|
1765
|
+
geomParams.elmTransparency = 0.5;
|
|
1766
|
+
geomParams.geometryClass = GeometryClass.Construction;
|
|
1767
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1768
|
+
assert.isTrue(added);
|
|
1769
|
+
geomParams.fillDisplay = geomParams.fillColor = geomParams.fillTransparency = undefined; // Region specific appearance ignored for open elements...
|
|
1770
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1771
|
+
expected.push({ opcode: ElementGeometryOpcode.LineStyleModifiers, geomParams: geomParams.clone() });
|
|
1772
|
+
const entryLN = ElementGeometry.fromGeometryQuery(LineSegment3d.create(pts[0], pts[2]));
|
|
1773
|
+
assert.exists(entryLN);
|
|
1774
|
+
newEntries.push(entryLN);
|
|
1775
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curvePrimitive", geometrySubCategory: "lineString" });
|
|
1776
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1777
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1778
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1779
|
+
imodel.saveChanges();
|
|
1780
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1781
|
+
});
|
|
1782
|
+
it("create GeometricElement3d with pattern flatbuffer data", async () => {
|
|
1783
|
+
// Set up element to be placed in iModel
|
|
1784
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1785
|
+
assert.exists(seedElement);
|
|
1786
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1787
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
1788
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
1789
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
1790
|
+
const pts = [];
|
|
1791
|
+
pts.push(Point3d.create(5, 10, 0));
|
|
1792
|
+
pts.push(Point3d.create(10, 10, 0));
|
|
1793
|
+
pts.push(Point3d.create(10, 15, 0));
|
|
1794
|
+
pts.push(Point3d.create(5, 15, 0));
|
|
1795
|
+
pts.push(pts[0].clone());
|
|
1796
|
+
const entrySH = ElementGeometry.fromGeometryQuery(Loop.createPolygon(pts));
|
|
1797
|
+
assert.exists(entrySH);
|
|
1798
|
+
const expected = [];
|
|
1799
|
+
const newEntries = [];
|
|
1800
|
+
const geomParams = new GeometryParams(seedElement.category);
|
|
1801
|
+
// Shape with hatch w/o overrides...
|
|
1802
|
+
geomParams.pattern = new AreaPattern.Params();
|
|
1803
|
+
geomParams.pattern.space1 = 0.05;
|
|
1804
|
+
geomParams.pattern.angle1 = Angle.createDegrees(45.0);
|
|
1805
|
+
let added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1806
|
+
assert.isTrue(added);
|
|
1807
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1808
|
+
expected.push({ opcode: ElementGeometryOpcode.Pattern, geomParams: geomParams.clone() });
|
|
1809
|
+
newEntries.push(entrySH);
|
|
1810
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1811
|
+
// Shape with cross hatch with color/weight override...
|
|
1812
|
+
geomParams.pattern.space2 = 0.1;
|
|
1813
|
+
geomParams.pattern.angle2 = Angle.createDegrees(-30.0);
|
|
1814
|
+
geomParams.pattern.color = ColorDef.red;
|
|
1815
|
+
geomParams.pattern.weight = 0;
|
|
1816
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1817
|
+
assert.isTrue(added);
|
|
1818
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1819
|
+
expected.push({ opcode: ElementGeometryOpcode.Pattern, geomParams: geomParams.clone() });
|
|
1820
|
+
newEntries.push(entrySH);
|
|
1821
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1822
|
+
// Shape with area pattern w/o overrides...
|
|
1823
|
+
const partId = createCirclePart(1.0, imodel);
|
|
1824
|
+
assert.isTrue(Id64.isValidId64(partId));
|
|
1825
|
+
geomParams.pattern = new AreaPattern.Params();
|
|
1826
|
+
geomParams.pattern.symbolId = partId;
|
|
1827
|
+
geomParams.pattern.space1 = geomParams.pattern.space2 = 0.05;
|
|
1828
|
+
geomParams.pattern.angle1 = Angle.createDegrees(45.0);
|
|
1829
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1830
|
+
assert.isTrue(added);
|
|
1831
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1832
|
+
expected.push({ opcode: ElementGeometryOpcode.Pattern, geomParams: geomParams.clone() });
|
|
1833
|
+
newEntries.push(entrySH);
|
|
1834
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1835
|
+
// Shape with area pattern with color/weight and other overrides...
|
|
1836
|
+
geomParams.pattern.origin = Point3d.create(0.05, 0.05, 0.0);
|
|
1837
|
+
geomParams.pattern.rotation = YawPitchRollAngles.createDegrees(45, 0, 0);
|
|
1838
|
+
geomParams.pattern.space1 = geomParams.pattern.space2 = geomParams.pattern.angle1 = undefined;
|
|
1839
|
+
geomParams.pattern.color = ColorDef.red;
|
|
1840
|
+
geomParams.pattern.weight = 1;
|
|
1841
|
+
geomParams.pattern.snappable = geomParams.pattern.invisibleBoundary = true;
|
|
1842
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1843
|
+
assert.isTrue(added);
|
|
1844
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1845
|
+
expected.push({ opcode: ElementGeometryOpcode.Pattern, geomParams: geomParams.clone() });
|
|
1846
|
+
newEntries.push(entrySH);
|
|
1847
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1848
|
+
// Shape with hatch definition w/o overrides (zig-zag)...
|
|
1849
|
+
const defLines = [
|
|
1850
|
+
{ offset: Point2d.create(0.1, 0.1), dashes: [0.1, -0.1] },
|
|
1851
|
+
{ angle: Angle.createDegrees(90.0), through: Point2d.create(0.1, 0.0), offset: Point2d.create(0.1, 0.1), dashes: [0.1, -0.1] },
|
|
1852
|
+
];
|
|
1853
|
+
geomParams.pattern = new AreaPattern.Params();
|
|
1854
|
+
geomParams.pattern.defLines = defLines;
|
|
1855
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1856
|
+
assert.isTrue(added);
|
|
1857
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1858
|
+
expected.push({ opcode: ElementGeometryOpcode.Pattern, geomParams: geomParams.clone() });
|
|
1859
|
+
newEntries.push(entrySH);
|
|
1860
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1861
|
+
// Shape with hatch definition with color/weight overrides...
|
|
1862
|
+
geomParams.pattern.color = ColorDef.red;
|
|
1863
|
+
geomParams.pattern.weight = 1;
|
|
1864
|
+
added = ElementGeometry.appendGeometryParams(geomParams, newEntries);
|
|
1865
|
+
assert.isTrue(added);
|
|
1866
|
+
expected.push({ opcode: ElementGeometryOpcode.BasicSymbology });
|
|
1867
|
+
expected.push({ opcode: ElementGeometryOpcode.Pattern, geomParams: geomParams.clone() });
|
|
1868
|
+
newEntries.push(entrySH);
|
|
1869
|
+
expected.push({ opcode: ElementGeometryOpcode.PointPrimitive, geometryCategory: "curveCollection", geometrySubCategory: "loop" });
|
|
1870
|
+
elementProps.elementGeometryBuilderParams = { entryArray: newEntries };
|
|
1871
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
1872
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
1873
|
+
imodel.saveChanges();
|
|
1874
|
+
assert(IModelStatus.Success === doElementGeometryValidate(imodel, newId, expected, false, elementProps));
|
|
1875
|
+
});
|
|
1876
|
+
it("should transform PatternParams", () => {
|
|
1877
|
+
const offset = Point3d.create(1, 1, 1);
|
|
1878
|
+
const rotation = YawPitchRollAngles.createDegrees(45, 45, 45);
|
|
1879
|
+
const t = Transform.createOriginAndMatrix(offset, rotation.toMatrix3d());
|
|
1880
|
+
const pattern = new AreaPattern.Params();
|
|
1881
|
+
pattern.origin = Point3d.createZero();
|
|
1882
|
+
pattern.rotation = YawPitchRollAngles.createDegrees(0, 0, 0);
|
|
1883
|
+
pattern.applyTransform(t);
|
|
1884
|
+
expect(pattern.origin.isAlmostEqual(offset)).true;
|
|
1885
|
+
expect(pattern.rotation.isAlmostEqual(rotation)).true;
|
|
1886
|
+
});
|
|
1887
|
+
it("should insert elements and parts with binary geometry stream", () => {
|
|
1888
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1889
|
+
const pts = [];
|
|
1890
|
+
pts.push(Point3d.create(5, 10, 0));
|
|
1891
|
+
pts.push(Point3d.create(10, 10, 0));
|
|
1892
|
+
const entryLN = ElementGeometry.fromGeometryQuery(LineSegment3d.create(pts[0], pts[1]));
|
|
1893
|
+
assert.isTrue(entryLN !== undefined);
|
|
1894
|
+
const entryAR = ElementGeometry.fromGeometryQuery(Arc3d.createXY(pts[0], pts[0].distance(pts[1])));
|
|
1895
|
+
assert.exists(entryAR);
|
|
1896
|
+
// ------------------
|
|
1897
|
+
// GeometricElement3d
|
|
1898
|
+
// ------------------
|
|
1899
|
+
// Insert
|
|
1900
|
+
const elemProps = {
|
|
1901
|
+
classFullName: PhysicalObject.classFullName,
|
|
1902
|
+
model: seedElement.model,
|
|
1903
|
+
category: seedElement.category,
|
|
1904
|
+
code: Code.createEmpty(),
|
|
1905
|
+
// geom: geomBuilder.geometryStream,
|
|
1906
|
+
elementGeometryBuilderParams: { entryArray: [entryLN], viewIndependent: false },
|
|
1907
|
+
};
|
|
1908
|
+
const spatialElementId = imodel.elements.insertElement(elemProps);
|
|
1909
|
+
let persistentProps = imodel.elements.getElementProps({ id: spatialElementId, wantGeometry: true });
|
|
1910
|
+
assert.isDefined(persistentProps.geom);
|
|
1911
|
+
assert.isTrue(persistentProps.placement !== undefined);
|
|
1912
|
+
assert.deepEqual(Point3d.fromJSON(persistentProps.placement.origin), Point3d.create(0, 0, 0));
|
|
1913
|
+
assert.deepEqual(Point3d.fromJSON(persistentProps.placement.bbox.low), Point3d.create(5, 10, 0));
|
|
1914
|
+
assert.deepEqual(Point3d.fromJSON(persistentProps.placement.bbox.high), Point3d.create(10, 10, 0));
|
|
1915
|
+
for (const entry of new GeometryStreamIterator(persistentProps.geom, persistentProps.category)) {
|
|
1916
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
1917
|
+
const geometry = entry.primitive.geometry;
|
|
1918
|
+
assert.isTrue(geometry instanceof LineString3d);
|
|
1919
|
+
const ls = geometry;
|
|
1920
|
+
assert.deepEqual(ls.points, pts);
|
|
1921
|
+
}
|
|
1922
|
+
// Insert - various failure cases
|
|
1923
|
+
elemProps.elementGeometryBuilderParams = { entryArray: [{ opcode: 9999 }] };
|
|
1924
|
+
expect(() => imodel.elements.insertElement(elemProps)).to.throw(); // TODO: check error message
|
|
1925
|
+
elemProps.elementGeometryBuilderParams = { entryArray: [{ opcode: ElementGeometryOpcode.ArcPrimitive, data: undefined }] };
|
|
1926
|
+
expect(() => imodel.elements.insertElement(elemProps)).to.throw(); // TODO: check error message
|
|
1927
|
+
// Update
|
|
1928
|
+
persistentProps.elementGeometryBuilderParams = { entryArray: [entryAR] };
|
|
1929
|
+
imodel.elements.updateElement(persistentProps);
|
|
1930
|
+
persistentProps = imodel.elements.getElementProps({ id: spatialElementId, wantGeometry: true });
|
|
1931
|
+
assert.isDefined(persistentProps.geom);
|
|
1932
|
+
assert.isTrue(persistentProps.placement !== undefined);
|
|
1933
|
+
assert.deepEqual(Point3d.fromJSON(persistentProps.placement.origin), Point3d.create(0, 0, 0));
|
|
1934
|
+
assert.deepEqual(Point3d.fromJSON(persistentProps.placement.bbox.low), Point3d.create(0, 5, 0));
|
|
1935
|
+
assert.deepEqual(Point3d.fromJSON(persistentProps.placement.bbox.high), Point3d.create(10, 15, 0));
|
|
1936
|
+
for (const entry of new GeometryStreamIterator(persistentProps.geom, persistentProps.category)) {
|
|
1937
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
1938
|
+
const geometry = entry.primitive.geometry;
|
|
1939
|
+
assert.isTrue(geometry instanceof Arc3d);
|
|
1940
|
+
const ar = geometry;
|
|
1941
|
+
assert.deepEqual(ar.center, pts[0]);
|
|
1942
|
+
}
|
|
1943
|
+
// ---------------
|
|
1944
|
+
// Geometry part
|
|
1945
|
+
// ---------------
|
|
1946
|
+
// Insert
|
|
1947
|
+
const partProps = {
|
|
1948
|
+
classFullName: GeometryPart.classFullName,
|
|
1949
|
+
model: IModel.dictionaryId,
|
|
1950
|
+
code: Code.createEmpty(),
|
|
1951
|
+
elementGeometryBuilderParams: { entryArray: [entryLN], is2dPart: false },
|
|
1952
|
+
};
|
|
1953
|
+
const partId = imodel.elements.insertElement(partProps);
|
|
1954
|
+
let persistentPartProps = imodel.elements.getElementProps({ id: partId, wantGeometry: true });
|
|
1955
|
+
assert.isDefined(persistentPartProps.geom);
|
|
1956
|
+
for (const entry of new GeometryStreamIterator(persistentPartProps.geom)) {
|
|
1957
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
1958
|
+
const geometry = entry.primitive.geometry;
|
|
1959
|
+
assert.isTrue(geometry instanceof LineString3d);
|
|
1960
|
+
const ls = geometry;
|
|
1961
|
+
assert.deepEqual(ls.points, pts);
|
|
1962
|
+
}
|
|
1963
|
+
// Update
|
|
1964
|
+
persistentPartProps.elementGeometryBuilderParams = { entryArray: [entryAR] };
|
|
1965
|
+
imodel.elements.updateElement(persistentPartProps);
|
|
1966
|
+
persistentPartProps = imodel.elements.getElementProps({ id: partId, wantGeometry: true });
|
|
1967
|
+
assert.isDefined(persistentPartProps.geom);
|
|
1968
|
+
for (const entry of new GeometryStreamIterator(persistentPartProps.geom)) {
|
|
1969
|
+
assert.equal(entry.primitive.type, "geometryQuery");
|
|
1970
|
+
const geometry = entry.primitive.geometry;
|
|
1971
|
+
assert.isTrue(geometry instanceof Arc3d);
|
|
1972
|
+
const ar = geometry;
|
|
1973
|
+
assert.deepEqual(ar.center, pts[0]);
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
it("create and update a GeometricElement3d to test clearing its geometry stream", async () => {
|
|
1977
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
1978
|
+
assert.exists(seedElement);
|
|
1979
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
1980
|
+
const newId = createCircleElem(1.0, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(90, 0, 0), imodel, seedElement);
|
|
1981
|
+
imodel.saveChanges();
|
|
1982
|
+
const newElemProps = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
1983
|
+
assert.isDefined(newElemProps.geom);
|
|
1984
|
+
assert.isTrue(newElemProps.placement !== undefined);
|
|
1985
|
+
newElemProps.elementGeometryBuilderParams = { entryArray: [] };
|
|
1986
|
+
imodel.elements.updateElement(newElemProps);
|
|
1987
|
+
imodel.saveChanges();
|
|
1988
|
+
const updateElemProps = imodel.elements.getElementProps({ id: newId, wantGeometry: true });
|
|
1989
|
+
assert.isUndefined(updateElemProps.geom);
|
|
1990
|
+
assert.isTrue(updateElemProps.placement !== undefined);
|
|
1991
|
+
const updatedPlacement = Placement3d.fromJSON(updateElemProps.placement);
|
|
1992
|
+
assert.isTrue(updatedPlacement.bbox.isNull);
|
|
1993
|
+
});
|
|
1994
|
+
});
|
|
1995
|
+
describe("BRepGeometry", () => {
|
|
1996
|
+
let imodel;
|
|
1997
|
+
before(() => {
|
|
1998
|
+
const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
|
|
1999
|
+
const testFileName = IModelTestUtils.prepareOutputFile("GeometryStream", "GeometryStreamTest.bim");
|
|
2000
|
+
imodel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
|
|
2001
|
+
});
|
|
2002
|
+
after(() => {
|
|
2003
|
+
imodel.close();
|
|
2004
|
+
});
|
|
2005
|
+
it("create GeometricElement3d from a sequence of BRep operations test", async () => {
|
|
2006
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2007
|
+
assert.exists(seedElement);
|
|
2008
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2009
|
+
const builder = new ElementGeometry.Builder();
|
|
2010
|
+
const onResult = (info) => {
|
|
2011
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2012
|
+
builder.entries.length = 0; // Always replace builder.entries with result for subsequent operations/creating element
|
|
2013
|
+
builder.entries.push(info.entryArray[0]);
|
|
2014
|
+
};
|
|
2015
|
+
// Step 1: Create solid by subtracting the 2 small spheres from the large sphere
|
|
2016
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(0, 0, 0), Matrix3d.createUniformScale(5)), AngleSweep.createFullLatitude(), true));
|
|
2017
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(0, 0, 5), Matrix3d.createUniformScale(3)), AngleSweep.createFullLatitude(), true));
|
|
2018
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(0, 0, -5), Matrix3d.createUniformScale(3)), AngleSweep.createFullLatitude(), true));
|
|
2019
|
+
const createProps = {
|
|
2020
|
+
operation: BRepGeometryOperation.Subtract,
|
|
2021
|
+
entryArray: builder.entries,
|
|
2022
|
+
onResult,
|
|
2023
|
+
};
|
|
2024
|
+
try {
|
|
2025
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2026
|
+
}
|
|
2027
|
+
catch (error) {
|
|
2028
|
+
assert(false, error.message);
|
|
2029
|
+
}
|
|
2030
|
+
// Step 2: Create flat spots on sides by intersecting with a cube (i.e. something more complex that a simple revolved solid)
|
|
2031
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(-4, -4, -5), Point3d.create(4, 4, 5)), true));
|
|
2032
|
+
createProps.operation = BRepGeometryOperation.Intersect;
|
|
2033
|
+
try {
|
|
2034
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2035
|
+
}
|
|
2036
|
+
catch (error) {
|
|
2037
|
+
assert(false, error.message);
|
|
2038
|
+
}
|
|
2039
|
+
// Step 3: Create a hollow shell
|
|
2040
|
+
createProps.operation = BRepGeometryOperation.Hollow;
|
|
2041
|
+
createProps.parameters = { distance: -0.5 };
|
|
2042
|
+
try {
|
|
2043
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2044
|
+
}
|
|
2045
|
+
catch (error) {
|
|
2046
|
+
assert(false, error.message);
|
|
2047
|
+
}
|
|
2048
|
+
// Step 4: Cut a small hole through the middle of the solid
|
|
2049
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.createZero(), 1)));
|
|
2050
|
+
createProps.operation = BRepGeometryOperation.Cut;
|
|
2051
|
+
createProps.parameters = { bothDirections: true };
|
|
2052
|
+
try {
|
|
2053
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2054
|
+
}
|
|
2055
|
+
catch (error) {
|
|
2056
|
+
assert(false, error.message);
|
|
2057
|
+
}
|
|
2058
|
+
// Step 5: Create a geometric element from the result solid
|
|
2059
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
2060
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
2061
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
2062
|
+
elementProps.elementGeometryBuilderParams = { entryArray: builder.entries };
|
|
2063
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
2064
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
2065
|
+
imodel.saveChanges();
|
|
2066
|
+
});
|
|
2067
|
+
it("create GeometricElement3d using half-space boolean test", async () => {
|
|
2068
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2069
|
+
assert.exists(seedElement);
|
|
2070
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2071
|
+
const builder = new ElementGeometry.Builder();
|
|
2072
|
+
const onResult = (info) => {
|
|
2073
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2074
|
+
builder.entries.length = 0; // Always replace builder.entries with result for subsequent operations/creating element
|
|
2075
|
+
builder.entries.push(info.entryArray[0]);
|
|
2076
|
+
};
|
|
2077
|
+
// Step 1: Create solid cube with all edges rounded
|
|
2078
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(-5, -5, -5), Point3d.create(5, 5, 5)), true));
|
|
2079
|
+
const createProps = {
|
|
2080
|
+
operation: BRepGeometryOperation.Round,
|
|
2081
|
+
entryArray: builder.entries,
|
|
2082
|
+
onResult,
|
|
2083
|
+
parameters: { radius: 2.0 },
|
|
2084
|
+
};
|
|
2085
|
+
try {
|
|
2086
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2087
|
+
}
|
|
2088
|
+
catch (error) {
|
|
2089
|
+
assert(false, error.message);
|
|
2090
|
+
}
|
|
2091
|
+
// Step 2: Create a hollow shell
|
|
2092
|
+
createProps.operation = BRepGeometryOperation.Hollow;
|
|
2093
|
+
createProps.parameters = { distance: -0.5 };
|
|
2094
|
+
try {
|
|
2095
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2096
|
+
}
|
|
2097
|
+
catch (error) {
|
|
2098
|
+
assert(false, error.message);
|
|
2099
|
+
}
|
|
2100
|
+
// Step 3: Use solid/sheet subtract to remove bottom half of solid (keep material in direction of surface normal)
|
|
2101
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.createZero(), 10)));
|
|
2102
|
+
createProps.operation = BRepGeometryOperation.Subtract;
|
|
2103
|
+
createProps.parameters = undefined;
|
|
2104
|
+
try {
|
|
2105
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2106
|
+
}
|
|
2107
|
+
catch (error) {
|
|
2108
|
+
assert(false, error.message);
|
|
2109
|
+
}
|
|
2110
|
+
// Step 4: Create a geometric element from the result solid
|
|
2111
|
+
const testOrigin = Point3d.create(5, 10, 0);
|
|
2112
|
+
const testAngles = YawPitchRollAngles.createDegrees(90, 0, 0);
|
|
2113
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: testOrigin, angles: testAngles });
|
|
2114
|
+
elementProps.elementGeometryBuilderParams = { entryArray: builder.entries };
|
|
2115
|
+
const newId = imodel.elements.insertElement(elementProps);
|
|
2116
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
2117
|
+
imodel.saveChanges();
|
|
2118
|
+
});
|
|
2119
|
+
it("create multiple GeometricElement3d from local coordinate disjoint body result test", async () => {
|
|
2120
|
+
const builder = new ElementGeometry.Builder();
|
|
2121
|
+
let results;
|
|
2122
|
+
const onResult = (info) => {
|
|
2123
|
+
assert.isTrue(undefined !== info.entryArray && 2 === info.entryArray.length);
|
|
2124
|
+
results = info.entryArray;
|
|
2125
|
+
};
|
|
2126
|
+
// Step 1: Create two solids by intersecting the 2 small spheres with the large sphere
|
|
2127
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(2, 2, 0), Matrix3d.createUniformScale(5)), AngleSweep.createFullLatitude(), true));
|
|
2128
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(2, 2, 5), Matrix3d.createUniformScale(3)), AngleSweep.createFullLatitude(), true));
|
|
2129
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(2, 2, -5), Matrix3d.createUniformScale(3)), AngleSweep.createFullLatitude(), true));
|
|
2130
|
+
const createProps = {
|
|
2131
|
+
operation: BRepGeometryOperation.Intersect,
|
|
2132
|
+
entryArray: builder.entries,
|
|
2133
|
+
onResult,
|
|
2134
|
+
separateDisjoint: true, // Request result as 2 solids instead of a single solid with disjoint regions...
|
|
2135
|
+
};
|
|
2136
|
+
try {
|
|
2137
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2138
|
+
}
|
|
2139
|
+
catch (error) {
|
|
2140
|
+
assert(false, error.message);
|
|
2141
|
+
}
|
|
2142
|
+
// Step 2: Create a geometric element from each result solid
|
|
2143
|
+
results.forEach((entry) => {
|
|
2144
|
+
// NOTE: Since entity transform reflects local to world of target (the large sphere) it's a reasonable placement...
|
|
2145
|
+
const brepData = ElementGeometry.toBRep(entry);
|
|
2146
|
+
assert.isDefined(brepData);
|
|
2147
|
+
const placement = YawPitchRollAngles.tryFromTransform(Transform.fromJSON(brepData.transform));
|
|
2148
|
+
assert.isDefined(placement.angles);
|
|
2149
|
+
const newId = createGeometricElemFromSeed(imodel, "0x1d", [entry], { origin: placement.origin, angles: placement.angles });
|
|
2150
|
+
assert.isTrue(Id64.isValidId64(newId));
|
|
2151
|
+
});
|
|
2152
|
+
});
|
|
2153
|
+
it("unite/subtract/intersect solids test", async () => {
|
|
2154
|
+
const builder = new ElementGeometry.Builder();
|
|
2155
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(0, 0, 0), Matrix3d.createUniformScale(5)), AngleSweep.createFullLatitude(), true));
|
|
2156
|
+
builder.appendGeometryQuery(Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(5, 0, 0), Matrix3d.createUniformScale(3)), AngleSweep.createFullLatitude(), true));
|
|
2157
|
+
const onResult = (info) => {
|
|
2158
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2159
|
+
};
|
|
2160
|
+
const createProps = {
|
|
2161
|
+
operation: BRepGeometryOperation.Unite,
|
|
2162
|
+
entryArray: builder.entries,
|
|
2163
|
+
onResult,
|
|
2164
|
+
};
|
|
2165
|
+
try {
|
|
2166
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2167
|
+
}
|
|
2168
|
+
catch (error) {
|
|
2169
|
+
assert(false, error.message);
|
|
2170
|
+
}
|
|
2171
|
+
createProps.operation = BRepGeometryOperation.Subtract;
|
|
2172
|
+
try {
|
|
2173
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2174
|
+
}
|
|
2175
|
+
catch (error) {
|
|
2176
|
+
assert(false, error.message);
|
|
2177
|
+
}
|
|
2178
|
+
createProps.operation = BRepGeometryOperation.Intersect;
|
|
2179
|
+
try {
|
|
2180
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2181
|
+
}
|
|
2182
|
+
catch (error) {
|
|
2183
|
+
assert(false, error.message);
|
|
2184
|
+
}
|
|
2185
|
+
});
|
|
2186
|
+
it("subtract consumes target test", async () => {
|
|
2187
|
+
const builder = new ElementGeometry.Builder();
|
|
2188
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(1, 1, 1), Point3d.create(4, 4, 4)), true));
|
|
2189
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(0, 0, 0), Point3d.create(5, 5, 5)), true));
|
|
2190
|
+
const onResult = (info) => {
|
|
2191
|
+
// Successful operation w/empty result...
|
|
2192
|
+
assert.isTrue(undefined !== info.entryArray && 0 === info.entryArray.length);
|
|
2193
|
+
};
|
|
2194
|
+
const createProps = {
|
|
2195
|
+
operation: BRepGeometryOperation.Subtract,
|
|
2196
|
+
entryArray: builder.entries,
|
|
2197
|
+
onResult,
|
|
2198
|
+
};
|
|
2199
|
+
try {
|
|
2200
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2201
|
+
}
|
|
2202
|
+
catch (error) {
|
|
2203
|
+
assert(false, error.message);
|
|
2204
|
+
}
|
|
2205
|
+
});
|
|
2206
|
+
it("sew sheets test", async () => {
|
|
2207
|
+
const builder = new ElementGeometry.Builder();
|
|
2208
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 0, 0), Point3d.create(0, 2, 0), Point3d.create(1, 2, 0), Point3d.create(1, 0, 0), Point3d.create(0, 0, 0)]));
|
|
2209
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 0, 3), Point3d.create(1, 0, 3), Point3d.create(1, 2, 3), Point3d.create(0, 2, 3), Point3d.create(0, 0, 3)]));
|
|
2210
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 0, 0), Point3d.create(1, 0, 0), Point3d.create(1, 0, 3), Point3d.create(0, 0, 3), Point3d.create(0, 0, 0)]));
|
|
2211
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(1, 2, 0), Point3d.create(0, 2, 0), Point3d.create(0, 2, 3), Point3d.create(1, 2, 3), Point3d.create(1, 2, 0)]));
|
|
2212
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 2, 0), Point3d.create(0, 0, 0), Point3d.create(0, 0, 3), Point3d.create(0, 2, 3), Point3d.create(0, 2, 0)]));
|
|
2213
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(1, 0, 0), Point3d.create(1, 2, 0), Point3d.create(1, 2, 3), Point3d.create(1, 0, 3), Point3d.create(1, 0, 0)]));
|
|
2214
|
+
const onResult = (info) => {
|
|
2215
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2216
|
+
};
|
|
2217
|
+
const createProps = {
|
|
2218
|
+
operation: BRepGeometryOperation.Sew,
|
|
2219
|
+
entryArray: builder.entries,
|
|
2220
|
+
onResult,
|
|
2221
|
+
};
|
|
2222
|
+
try {
|
|
2223
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2224
|
+
}
|
|
2225
|
+
catch (error) {
|
|
2226
|
+
assert(false, error.message);
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
it("cut solids test", async () => {
|
|
2230
|
+
const builder = new ElementGeometry.Builder();
|
|
2231
|
+
const onResult = (info) => {
|
|
2232
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2233
|
+
};
|
|
2234
|
+
// Test creating cut through solid in forward direction (default)
|
|
2235
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(0, 0, 0), Point3d.create(5, 5, 5)), true));
|
|
2236
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(2.5, 2.5, 2.5), 2)));
|
|
2237
|
+
const createProps = {
|
|
2238
|
+
operation: BRepGeometryOperation.Cut,
|
|
2239
|
+
entryArray: builder.entries,
|
|
2240
|
+
onResult,
|
|
2241
|
+
};
|
|
2242
|
+
try {
|
|
2243
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2244
|
+
}
|
|
2245
|
+
catch (error) {
|
|
2246
|
+
assert(false, error.message);
|
|
2247
|
+
}
|
|
2248
|
+
// Test creating cut through solid in both directions
|
|
2249
|
+
createProps.parameters = { bothDirections: true };
|
|
2250
|
+
try {
|
|
2251
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2252
|
+
}
|
|
2253
|
+
catch (error) {
|
|
2254
|
+
assert(false, error.message);
|
|
2255
|
+
}
|
|
2256
|
+
// Test creating depth cut in solid in forward direction
|
|
2257
|
+
createProps.parameters = { distance: 1 };
|
|
2258
|
+
try {
|
|
2259
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2260
|
+
}
|
|
2261
|
+
catch (error) {
|
|
2262
|
+
assert(false, error.message);
|
|
2263
|
+
}
|
|
2264
|
+
// Test creating depth cut in solid in both directions
|
|
2265
|
+
createProps.parameters = { distance: 1, bothDirections: true };
|
|
2266
|
+
try {
|
|
2267
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2268
|
+
}
|
|
2269
|
+
catch (error) {
|
|
2270
|
+
assert(false, error.message);
|
|
2271
|
+
}
|
|
2272
|
+
});
|
|
2273
|
+
it("emboss profile test", async () => {
|
|
2274
|
+
const builder = new ElementGeometry.Builder();
|
|
2275
|
+
const onResult = (info) => {
|
|
2276
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2277
|
+
};
|
|
2278
|
+
// Test creating a pocket in a solid
|
|
2279
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(0, 0, 1), Point3d.create(5, 5, 2)), true));
|
|
2280
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(2.5, 2.5, 1.5), 2)));
|
|
2281
|
+
const createProps = {
|
|
2282
|
+
operation: BRepGeometryOperation.Emboss,
|
|
2283
|
+
entryArray: builder.entries,
|
|
2284
|
+
onResult,
|
|
2285
|
+
};
|
|
2286
|
+
try {
|
|
2287
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2288
|
+
}
|
|
2289
|
+
catch (error) {
|
|
2290
|
+
assert(false, error.message);
|
|
2291
|
+
}
|
|
2292
|
+
// Test creating a pad on a solid
|
|
2293
|
+
builder.entries.length = 0;
|
|
2294
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.create(0, 0, -3), Point3d.create(5, 5, -2)), true));
|
|
2295
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(2.5, 2.5, -1.5), 2)));
|
|
2296
|
+
try {
|
|
2297
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2298
|
+
}
|
|
2299
|
+
catch (error) {
|
|
2300
|
+
assert(false, error.message);
|
|
2301
|
+
}
|
|
2302
|
+
// Test embossing a surface
|
|
2303
|
+
builder.entries.length = 0;
|
|
2304
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 0, 0), Point3d.create(0, 5, 0), Point3d.create(5, 5, 0), Point3d.create(5, 0, 0), Point3d.create(0, 0, 0)]));
|
|
2305
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(2.5, 2.5, -0.5), 2, AngleSweep.createStartSweepDegrees(0, -360))));
|
|
2306
|
+
try {
|
|
2307
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2308
|
+
}
|
|
2309
|
+
catch (error) {
|
|
2310
|
+
assert(false, error.message);
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
it("thicken surfaces test", async () => {
|
|
2314
|
+
const builder = new ElementGeometry.Builder();
|
|
2315
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 0, 0), Point3d.create(0, 5, 0), Point3d.create(5, 5, 0), Point3d.create(5, 0, 0), Point3d.create(0, 0, 0)]));
|
|
2316
|
+
const onResult = (info) => {
|
|
2317
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2318
|
+
};
|
|
2319
|
+
const createProps = {
|
|
2320
|
+
operation: BRepGeometryOperation.Thicken,
|
|
2321
|
+
entryArray: builder.entries,
|
|
2322
|
+
onResult,
|
|
2323
|
+
parameters: { frontDistance: 0.25 },
|
|
2324
|
+
};
|
|
2325
|
+
try {
|
|
2326
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2327
|
+
}
|
|
2328
|
+
catch (error) {
|
|
2329
|
+
assert(false, error.message);
|
|
2330
|
+
}
|
|
2331
|
+
createProps.parameters = { backDistance: 0.25 };
|
|
2332
|
+
try {
|
|
2333
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2334
|
+
}
|
|
2335
|
+
catch (error) {
|
|
2336
|
+
assert(false, error.message);
|
|
2337
|
+
}
|
|
2338
|
+
createProps.parameters = { frontDistance: 0.1, backDistance: 0.1 };
|
|
2339
|
+
try {
|
|
2340
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2341
|
+
}
|
|
2342
|
+
catch (error) {
|
|
2343
|
+
assert(false, error.message);
|
|
2344
|
+
}
|
|
2345
|
+
});
|
|
2346
|
+
it("offset surfaces test", async () => {
|
|
2347
|
+
const builder = new ElementGeometry.Builder();
|
|
2348
|
+
builder.appendGeometryQuery(Loop.createPolygon([Point3d.create(0, 0, 0), Point3d.create(0, 5, 0), Point3d.create(5, 5, 0), Point3d.create(5, 0, 0), Point3d.create(0, 0, 0)]));
|
|
2349
|
+
const onResult = (info) => {
|
|
2350
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2351
|
+
};
|
|
2352
|
+
const createProps = {
|
|
2353
|
+
operation: BRepGeometryOperation.Offset,
|
|
2354
|
+
entryArray: builder.entries,
|
|
2355
|
+
onResult,
|
|
2356
|
+
parameters: { distance: 0.25 },
|
|
2357
|
+
};
|
|
2358
|
+
try {
|
|
2359
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2360
|
+
}
|
|
2361
|
+
catch (error) {
|
|
2362
|
+
assert(false, error.message);
|
|
2363
|
+
}
|
|
2364
|
+
});
|
|
2365
|
+
it("hollow solids test", async () => {
|
|
2366
|
+
const builder = new ElementGeometry.Builder();
|
|
2367
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.createZero(), Point3d.create(5, 5, 2)), true));
|
|
2368
|
+
const onResult = (info) => {
|
|
2369
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2370
|
+
};
|
|
2371
|
+
const createProps = {
|
|
2372
|
+
operation: BRepGeometryOperation.Hollow,
|
|
2373
|
+
entryArray: builder.entries,
|
|
2374
|
+
onResult,
|
|
2375
|
+
parameters: { distance: 0.25 },
|
|
2376
|
+
};
|
|
2377
|
+
try {
|
|
2378
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2379
|
+
}
|
|
2380
|
+
catch (error) {
|
|
2381
|
+
assert(false, error.message);
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
it("offset solids test", async () => {
|
|
2385
|
+
const builder = new ElementGeometry.Builder();
|
|
2386
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.createZero(), Point3d.create(5, 5, 2)), true));
|
|
2387
|
+
const onResult = (info) => {
|
|
2388
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2389
|
+
};
|
|
2390
|
+
const createProps = {
|
|
2391
|
+
operation: BRepGeometryOperation.Offset,
|
|
2392
|
+
entryArray: builder.entries,
|
|
2393
|
+
onResult,
|
|
2394
|
+
parameters: { distance: 0.25 },
|
|
2395
|
+
};
|
|
2396
|
+
try {
|
|
2397
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2398
|
+
}
|
|
2399
|
+
catch (error) {
|
|
2400
|
+
assert(false, error.message);
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2403
|
+
it("sweep profile along path test", async () => {
|
|
2404
|
+
const builder = new ElementGeometry.Builder();
|
|
2405
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(0, 0, 0), 1)));
|
|
2406
|
+
builder.appendGeometryQuery(LineString3d.create(Point3d.create(0, 0, 0), Point3d.create(0, 0, 3), Point3d.create(5, 0, 3), Point3d.create(8, 10, 10)));
|
|
2407
|
+
const onResult = (info) => {
|
|
2408
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2409
|
+
};
|
|
2410
|
+
const createProps = {
|
|
2411
|
+
operation: BRepGeometryOperation.Sweep,
|
|
2412
|
+
entryArray: builder.entries,
|
|
2413
|
+
onResult,
|
|
2414
|
+
};
|
|
2415
|
+
try {
|
|
2416
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2417
|
+
}
|
|
2418
|
+
catch (error) {
|
|
2419
|
+
assert(false, error.message);
|
|
2420
|
+
}
|
|
2421
|
+
});
|
|
2422
|
+
it("loft profiles test", async () => {
|
|
2423
|
+
const builder = new ElementGeometry.Builder();
|
|
2424
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(0.5, 0, 5), 1.25)));
|
|
2425
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(0, 0, 3), 1)));
|
|
2426
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(0, 0, 2), 2)));
|
|
2427
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(0, 0, 0), 1.5)));
|
|
2428
|
+
builder.appendGeometryQuery(Loop.create(Arc3d.createXY(Point3d.create(-0.5, 0, -2), 3)));
|
|
2429
|
+
const onResult = (info) => {
|
|
2430
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2431
|
+
};
|
|
2432
|
+
const createProps = {
|
|
2433
|
+
operation: BRepGeometryOperation.Loft,
|
|
2434
|
+
entryArray: builder.entries,
|
|
2435
|
+
onResult,
|
|
2436
|
+
};
|
|
2437
|
+
try {
|
|
2438
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2439
|
+
}
|
|
2440
|
+
catch (error) {
|
|
2441
|
+
assert(false, error.message);
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
it("round edges test", async () => {
|
|
2445
|
+
const builder = new ElementGeometry.Builder();
|
|
2446
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.createZero(), Point3d.create(5, 5, 2)), true));
|
|
2447
|
+
const onResult = (info) => {
|
|
2448
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2449
|
+
};
|
|
2450
|
+
const createProps = {
|
|
2451
|
+
operation: BRepGeometryOperation.Round,
|
|
2452
|
+
entryArray: builder.entries,
|
|
2453
|
+
onResult,
|
|
2454
|
+
parameters: { radius: 1 },
|
|
2455
|
+
};
|
|
2456
|
+
try {
|
|
2457
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2458
|
+
}
|
|
2459
|
+
catch (error) {
|
|
2460
|
+
assert(false, error.message);
|
|
2461
|
+
}
|
|
2462
|
+
});
|
|
2463
|
+
it("create element using base 64 encoded brep from flatbuffer test", async () => {
|
|
2464
|
+
// Set up element to be placed in iModel
|
|
2465
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2466
|
+
assert.exists(seedElement);
|
|
2467
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2468
|
+
const builder = new ElementGeometry.Builder();
|
|
2469
|
+
builder.appendGeometryQuery(Box.createRange(Range3d.create(Point3d.createZero(), Point3d.create(5, 5, 2)), true));
|
|
2470
|
+
const onResult = (info) => {
|
|
2471
|
+
assert.isTrue(undefined !== info.entryArray && 1 === info.entryArray.length && ElementGeometryOpcode.BRep === info.entryArray[0].opcode);
|
|
2472
|
+
// Create new element to test flatbuffer conversion to brep wire format
|
|
2473
|
+
// NOTE: It is preferable to use ElementGeometry.Builder over GeometryStreamBuilder this is just for testing,
|
|
2474
|
+
const gsBuilder = new GeometryStreamBuilder();
|
|
2475
|
+
const brep = ElementGeometry.toBRep(info.entryArray[0], true);
|
|
2476
|
+
assert.exists(brep);
|
|
2477
|
+
gsBuilder.appendBRepData(brep);
|
|
2478
|
+
const elementProps = createPhysicalElementProps(seedElement, { origin: Point3d.create(5, 10, 0), angles: YawPitchRollAngles.createDegrees(45, 0, 0) }, gsBuilder.geometryStream);
|
|
2479
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
2480
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
2481
|
+
imodel.saveChanges();
|
|
2482
|
+
// Extract and test value returned
|
|
2483
|
+
const value = imodel.elements.getElementProps({ id: newId, wantGeometry: true, wantBRepData: true });
|
|
2484
|
+
assert.isDefined(value.geom);
|
|
2485
|
+
const itLocal = new GeometryStreamIterator(value.geom, value.category);
|
|
2486
|
+
for (const entry of itLocal) {
|
|
2487
|
+
assertTrue(entry.primitive.type === "brep");
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
const createProps = {
|
|
2491
|
+
operation: BRepGeometryOperation.Hollow,
|
|
2492
|
+
entryArray: builder.entries,
|
|
2493
|
+
onResult,
|
|
2494
|
+
parameters: { distance: 0.25 },
|
|
2495
|
+
};
|
|
2496
|
+
try {
|
|
2497
|
+
assert(IModelStatus.Success === imodel.createBRepGeometry(createProps));
|
|
2498
|
+
}
|
|
2499
|
+
catch (error) {
|
|
2500
|
+
assert(false, error.message);
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
});
|
|
2504
|
+
describe("Mass Properties", () => {
|
|
2505
|
+
let imodel;
|
|
2506
|
+
before(() => {
|
|
2507
|
+
const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
|
|
2508
|
+
const testFileName = IModelTestUtils.prepareOutputFile("GeometryStream", "GeometryStreamTest.bim");
|
|
2509
|
+
imodel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
|
|
2510
|
+
});
|
|
2511
|
+
after(() => {
|
|
2512
|
+
imodel.close();
|
|
2513
|
+
});
|
|
2514
|
+
it("volume", async () => {
|
|
2515
|
+
// Set up element to be placed in iModel
|
|
2516
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2517
|
+
assert.exists(seedElement);
|
|
2518
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2519
|
+
const box = Box.createRange(Range3d.create(Point3d.createZero(), Point3d.create(1.0, 1.0, 1.0)), true);
|
|
2520
|
+
assert.isFalse(undefined === box);
|
|
2521
|
+
const builder = new GeometryStreamBuilder();
|
|
2522
|
+
builder.appendGeometry(box);
|
|
2523
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
2524
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
2525
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
2526
|
+
imodel.saveChanges();
|
|
2527
|
+
const requestProps = {
|
|
2528
|
+
operation: MassPropertiesOperation.AccumulateVolumes,
|
|
2529
|
+
candidates: [newId],
|
|
2530
|
+
};
|
|
2531
|
+
const result = await imodel.getMassProperties(requestProps);
|
|
2532
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status);
|
|
2533
|
+
assert.isTrue(1.0 === result.volume);
|
|
2534
|
+
assert.isTrue(6.0 === result.area);
|
|
2535
|
+
assert.isTrue(Point3d.fromJSON(result.centroid).isAlmostEqual(Point3d.create(0.5, 0.5, 0.5)));
|
|
2536
|
+
});
|
|
2537
|
+
it("area", async () => {
|
|
2538
|
+
// Set up element to be placed in iModel
|
|
2539
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2540
|
+
assert.exists(seedElement);
|
|
2541
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2542
|
+
const shape = Loop.create(LineString3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 0, 0), Point3d.create(1, 1, 0), Point3d.create(0, 1, 0), Point3d.create(0, 0, 0)));
|
|
2543
|
+
const builder = new GeometryStreamBuilder();
|
|
2544
|
+
builder.appendGeometry(shape);
|
|
2545
|
+
const elementProps = createPhysicalElementProps(seedElement, undefined, builder.geometryStream);
|
|
2546
|
+
const testElem = imodel.elements.createElement(elementProps);
|
|
2547
|
+
const newId = imodel.elements.insertElement(testElem.toJSON());
|
|
2548
|
+
imodel.saveChanges();
|
|
2549
|
+
const requestProps = {
|
|
2550
|
+
operation: MassPropertiesOperation.AccumulateAreas,
|
|
2551
|
+
candidates: [newId],
|
|
2552
|
+
};
|
|
2553
|
+
const result = await imodel.getMassProperties(requestProps);
|
|
2554
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status);
|
|
2555
|
+
assert.isTrue(1.0 === result.area);
|
|
2556
|
+
assert.isTrue(4.0 === result.perimeter);
|
|
2557
|
+
assert.isTrue(Point3d.fromJSON(result.centroid).isAlmostEqual(Point3d.create(0.5, 0.5, 0.0)));
|
|
2558
|
+
});
|
|
2559
|
+
});
|
|
2560
|
+
describe("Geometry Containment", () => {
|
|
2561
|
+
let imodel;
|
|
2562
|
+
before(() => {
|
|
2563
|
+
const seedFileName = IModelTestUtils.resolveAssetFile("CompatibilityTestSeed.bim");
|
|
2564
|
+
const testFileName = IModelTestUtils.prepareOutputFile("GeometryStream", "GeometryStreamTest.bim");
|
|
2565
|
+
imodel = IModelTestUtils.createSnapshotFromSeed(testFileName, seedFileName);
|
|
2566
|
+
});
|
|
2567
|
+
after(() => {
|
|
2568
|
+
imodel.close();
|
|
2569
|
+
});
|
|
2570
|
+
it("clip volume curve containment", async () => {
|
|
2571
|
+
// Set up element to be placed in iModel
|
|
2572
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2573
|
+
assert.exists(seedElement);
|
|
2574
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2575
|
+
const rangeInsideId = createCircleElem(1.0, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2576
|
+
const rangeOutsideId = createCircleElem(1.0, Point3d.create(12, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2577
|
+
const edgeOverlapId = createCircleElem(1.0, Point3d.create(0, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2578
|
+
const cornerOverlapId = createCircleElem(1.0, Point3d.create(10, 10, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2579
|
+
const rangeOvrGeomOutId = createCircleElem(1.25, Point3d.create(11, -1, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2580
|
+
const rangeOvrGeomInId = createCircleElem(0.85, Point3d.create(5, 9, 0), YawPitchRollAngles.createDegrees(45, 0, 0), imodel, seedElement);
|
|
2581
|
+
imodel.saveChanges();
|
|
2582
|
+
const range = Range3d.create(Point3d.create(0, 0, -5), Point3d.create(10, 10, 5));
|
|
2583
|
+
const clip = ClipVector.createEmpty();
|
|
2584
|
+
const block = ClipShape.createBlock(range, ClipMaskXYZRangePlanes.All, false, false);
|
|
2585
|
+
clip.appendReference(block);
|
|
2586
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyInside];
|
|
2587
|
+
const requestProps = {
|
|
2588
|
+
candidates: [rangeInsideId, rangeOutsideId, edgeOverlapId, cornerOverlapId, rangeOvrGeomOutId, rangeOvrGeomInId],
|
|
2589
|
+
clip: clip.toJSON(),
|
|
2590
|
+
allowOverlaps: true,
|
|
2591
|
+
};
|
|
2592
|
+
let result = await imodel.getGeometryContainment(requestProps);
|
|
2593
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2594
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2595
|
+
assert.isTrue(2 === result.numInside);
|
|
2596
|
+
assert.isTrue(2 === result.numOutside);
|
|
2597
|
+
assert.isTrue(2 === result.numOverlap);
|
|
2598
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2599
|
+
requestProps.allowOverlaps = false; // test inside mode...
|
|
2600
|
+
result = await imodel.getGeometryContainment(requestProps);
|
|
2601
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2602
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2603
|
+
assert.isTrue(2 === result.numInside);
|
|
2604
|
+
assert.isTrue(4 === result.numOutside);
|
|
2605
|
+
assert.isTrue(0 === result.numOverlap);
|
|
2606
|
+
});
|
|
2607
|
+
it("clip volume mesh containment", async () => {
|
|
2608
|
+
// Set up element to be placed in iModel
|
|
2609
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2610
|
+
assert.exists(seedElement);
|
|
2611
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2612
|
+
const rangeInsideId = createSphereElem(1.0, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2613
|
+
const rangeOutsideId = createSphereElem(1.0, Point3d.create(12, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2614
|
+
const edgeOverlapId = createSphereElem(1.0, Point3d.create(0, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2615
|
+
const cornerOverlapId = createSphereElem(1.0, Point3d.create(10, 10, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2616
|
+
const rangeOvrGeomOutId = createSphereElem(1.25, Point3d.create(11, -1, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2617
|
+
const rangeOvrGeomInId = createSphereElem(0.85, Point3d.create(5, 9, 0), YawPitchRollAngles.createDegrees(45, 0, 0), imodel, seedElement);
|
|
2618
|
+
imodel.saveChanges();
|
|
2619
|
+
const range = Range3d.create(Point3d.create(0, 0, -5), Point3d.create(10, 10, 5));
|
|
2620
|
+
const clip = ClipVector.createEmpty();
|
|
2621
|
+
const block = ClipShape.createBlock(range, ClipMaskXYZRangePlanes.All, false, false);
|
|
2622
|
+
clip.appendReference(block);
|
|
2623
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyInside];
|
|
2624
|
+
const requestProps = {
|
|
2625
|
+
candidates: [rangeInsideId, rangeOutsideId, edgeOverlapId, cornerOverlapId, rangeOvrGeomOutId, rangeOvrGeomInId],
|
|
2626
|
+
clip: clip.toJSON(),
|
|
2627
|
+
allowOverlaps: true,
|
|
2628
|
+
};
|
|
2629
|
+
let result = await imodel.getGeometryContainment(requestProps);
|
|
2630
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2631
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2632
|
+
assert.isTrue(2 === result.numInside);
|
|
2633
|
+
assert.isTrue(2 === result.numOutside);
|
|
2634
|
+
assert.isTrue(2 === result.numOverlap);
|
|
2635
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2636
|
+
requestProps.allowOverlaps = false; // test inside mode...
|
|
2637
|
+
result = await imodel.getGeometryContainment(requestProps);
|
|
2638
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2639
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2640
|
+
assert.isTrue(2 === result.numInside);
|
|
2641
|
+
assert.isTrue(4 === result.numOutside);
|
|
2642
|
+
assert.isTrue(0 === result.numOverlap);
|
|
2643
|
+
});
|
|
2644
|
+
it("clip volume part containment", async () => {
|
|
2645
|
+
// Set up element to be placed in iModel
|
|
2646
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2647
|
+
assert.exists(seedElement);
|
|
2648
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2649
|
+
const partAId = createCirclePart(1.0, imodel);
|
|
2650
|
+
const partBId = createCirclePart(1.25, imodel);
|
|
2651
|
+
const partCId = createCirclePart(0.85, imodel);
|
|
2652
|
+
// create part entries without instance transform...
|
|
2653
|
+
const rangeInsideId = createPartElem(partAId, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2654
|
+
const rangeOutsideId = createPartElem(partAId, Point3d.create(12, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2655
|
+
const edgeOverlapId = createPartElem(partAId, Point3d.create(0, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2656
|
+
const cornerOverlapId = createPartElem(partAId, Point3d.create(10, 10, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2657
|
+
const rangeOvrGeomOutId = createPartElem(partBId, Point3d.create(11, -1, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2658
|
+
const rangeOvrGeomInId = createPartElem(partCId, Point3d.create(5, 9, 0), YawPitchRollAngles.createDegrees(45, 0, 0), imodel, seedElement);
|
|
2659
|
+
// create part entries with instance transform...
|
|
2660
|
+
const rangeInsideRId = createPartElem(partAId, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement, true);
|
|
2661
|
+
const rangeOutsideRId = createPartElem(partAId, Point3d.create(12, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement, true);
|
|
2662
|
+
const edgeOverlapRId = createPartElem(partAId, Point3d.create(0, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement, true);
|
|
2663
|
+
const cornerOverlapRId = createPartElem(partAId, Point3d.create(10, 10, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement, true);
|
|
2664
|
+
const rangeOvrGeomOutRId = createPartElem(partBId, Point3d.create(11, -1, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement, true);
|
|
2665
|
+
const rangeOvrGeomInRId = createPartElem(partCId, Point3d.create(5, 9, 0), YawPitchRollAngles.createDegrees(45, 0, 0), imodel, seedElement, true);
|
|
2666
|
+
imodel.saveChanges();
|
|
2667
|
+
const range = Range3d.create(Point3d.create(0, 0, -5), Point3d.create(10, 10, 5));
|
|
2668
|
+
const clip = ClipVector.createEmpty();
|
|
2669
|
+
const block = ClipShape.createBlock(range, ClipMaskXYZRangePlanes.All, false, false);
|
|
2670
|
+
clip.appendReference(block);
|
|
2671
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyInside];
|
|
2672
|
+
const requestProps = {
|
|
2673
|
+
candidates: [rangeInsideId, rangeOutsideId, edgeOverlapId, cornerOverlapId, rangeOvrGeomOutId, rangeOvrGeomInId, rangeInsideRId, rangeOutsideRId, edgeOverlapRId, cornerOverlapRId, rangeOvrGeomOutRId, rangeOvrGeomInRId],
|
|
2674
|
+
clip: clip.toJSON(),
|
|
2675
|
+
allowOverlaps: true,
|
|
2676
|
+
};
|
|
2677
|
+
let result = await imodel.getGeometryContainment(requestProps);
|
|
2678
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2679
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2680
|
+
assert.isTrue(4 === result.numInside);
|
|
2681
|
+
assert.isTrue(4 === result.numOutside);
|
|
2682
|
+
assert.isTrue(4 === result.numOverlap);
|
|
2683
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2684
|
+
requestProps.allowOverlaps = false; // test inside mode...
|
|
2685
|
+
result = await imodel.getGeometryContainment(requestProps);
|
|
2686
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2687
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2688
|
+
assert.isTrue(4 === result.numInside);
|
|
2689
|
+
assert.isTrue(8 === result.numOutside);
|
|
2690
|
+
assert.isTrue(0 === result.numOverlap);
|
|
2691
|
+
});
|
|
2692
|
+
it("clip volume displayed containment", async () => {
|
|
2693
|
+
// Set up element to be placed in iModel
|
|
2694
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2695
|
+
assert.exists(seedElement);
|
|
2696
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2697
|
+
const primInConsOutId = createDisjointCirclesElem(1.0, Point3d.create(10, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2698
|
+
const primOutConsInId = createDisjointCirclesElem(1.0, Point3d.create(0, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2699
|
+
const primInConsInId = createDisjointCirclesElem(1.0, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2700
|
+
const primOvrConsOvrId = createDisjointCirclesElem(1.0, Point3d.create(5, 10, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2701
|
+
imodel.saveChanges();
|
|
2702
|
+
const range = Range3d.create(Point3d.create(0, 0, -5), Point3d.create(10, 10, 5));
|
|
2703
|
+
const clip = ClipVector.createEmpty();
|
|
2704
|
+
const block = ClipShape.createBlock(range, ClipMaskXYZRangePlanes.All, false, false);
|
|
2705
|
+
clip.appendReference(block);
|
|
2706
|
+
const expectedContainmentDef = [ClipPlaneContainment.Ambiguous, ClipPlaneContainment.Ambiguous, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.Ambiguous];
|
|
2707
|
+
const requestProps = {
|
|
2708
|
+
candidates: [primInConsOutId, primOutConsInId, primInConsInId, primOvrConsOvrId],
|
|
2709
|
+
clip: clip.toJSON(),
|
|
2710
|
+
allowOverlaps: true,
|
|
2711
|
+
};
|
|
2712
|
+
let result = await imodel.getGeometryContainment(requestProps);
|
|
2713
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2714
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainmentDef.length);
|
|
2715
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainmentDef[index]));
|
|
2716
|
+
assert.isTrue(1 === result.numInside);
|
|
2717
|
+
assert.isTrue(0 === result.numOutside);
|
|
2718
|
+
assert.isTrue(3 === result.numOverlap);
|
|
2719
|
+
const expectedContainmentSubCat = [ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyOutside];
|
|
2720
|
+
requestProps.offSubCategories = [IModel.getDefaultSubCategoryId(seedElement.category)];
|
|
2721
|
+
result = await imodel.getGeometryContainment(requestProps);
|
|
2722
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2723
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainmentSubCat.length);
|
|
2724
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainmentSubCat[index]));
|
|
2725
|
+
assert.isTrue(0 === result.numInside);
|
|
2726
|
+
assert.isTrue(4 === result.numOutside);
|
|
2727
|
+
assert.isTrue(0 === result.numOverlap);
|
|
2728
|
+
const expectedContainmentViewFlags = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.Ambiguous];
|
|
2729
|
+
const flags = new ViewFlags(); // constructions are off by default...
|
|
2730
|
+
requestProps.viewFlags = flags;
|
|
2731
|
+
requestProps.offSubCategories = undefined;
|
|
2732
|
+
result = await imodel.getGeometryContainment(requestProps);
|
|
2733
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2734
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainmentViewFlags.length);
|
|
2735
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainmentViewFlags[index]));
|
|
2736
|
+
assert.isTrue(2 === result.numInside);
|
|
2737
|
+
assert.isTrue(1 === result.numOutside);
|
|
2738
|
+
assert.isTrue(1 === result.numOverlap);
|
|
2739
|
+
});
|
|
2740
|
+
it("clip L shape volume curve containment", async () => {
|
|
2741
|
+
// Set up element to be placed in iModel
|
|
2742
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2743
|
+
assert.exists(seedElement);
|
|
2744
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2745
|
+
const rangeInsideXYId = createCircleElem(1.0, Point3d.create(2.5, 2.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2746
|
+
const rangeInsideYId = createCircleElem(1.0, Point3d.create(2.5, 7.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2747
|
+
const rangeInsideXId = createCircleElem(1.0, Point3d.create(7.5, 2.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2748
|
+
const rangeOutsideId = createCircleElem(1.0, Point3d.create(7.5, 7.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2749
|
+
const rangeOvrGeomOvrId = createCircleElem(1.0, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2750
|
+
imodel.saveChanges();
|
|
2751
|
+
const clipShapePts = [];
|
|
2752
|
+
clipShapePts.push(Point3d.create(0, 0, 0));
|
|
2753
|
+
clipShapePts.push(Point3d.create(10, 0, 0));
|
|
2754
|
+
clipShapePts.push(Point3d.create(10, 5, 0));
|
|
2755
|
+
clipShapePts.push(Point3d.create(5, 5, 0));
|
|
2756
|
+
clipShapePts.push(Point3d.create(5, 10, 0));
|
|
2757
|
+
clipShapePts.push(Point3d.create(0, 10, 0));
|
|
2758
|
+
clipShapePts.push(Point3d.create(0, 0, 0));
|
|
2759
|
+
const clip = ClipVector.createEmpty();
|
|
2760
|
+
clip.appendShape(clipShapePts, -5, 5);
|
|
2761
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous];
|
|
2762
|
+
const requestProps = {
|
|
2763
|
+
candidates: [rangeInsideXYId, rangeInsideXId, rangeInsideYId, rangeOutsideId, rangeOvrGeomOvrId],
|
|
2764
|
+
clip: clip.toJSON(),
|
|
2765
|
+
allowOverlaps: true,
|
|
2766
|
+
};
|
|
2767
|
+
const result = await imodel.getGeometryContainment(requestProps);
|
|
2768
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2769
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2770
|
+
assert.isTrue(3 === result.numInside);
|
|
2771
|
+
assert.isTrue(1 === result.numOutside);
|
|
2772
|
+
assert.isTrue(1 === result.numOverlap);
|
|
2773
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2774
|
+
});
|
|
2775
|
+
it("clip L shape volume mesh containment", async () => {
|
|
2776
|
+
// Set up element to be placed in iModel
|
|
2777
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2778
|
+
assert.exists(seedElement);
|
|
2779
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2780
|
+
const rangeInsideXYId = createSphereElem(1.0, Point3d.create(2.5, 2.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2781
|
+
const rangeInsideYId = createSphereElem(1.0, Point3d.create(2.5, 7.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2782
|
+
const rangeInsideXId = createSphereElem(1.0, Point3d.create(7.5, 2.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2783
|
+
const rangeOutsideId = createSphereElem(1.0, Point3d.create(7.5, 7.5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2784
|
+
const rangeOvrGeomOvrId = createSphereElem(1.0, Point3d.create(5, 5, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2785
|
+
imodel.saveChanges();
|
|
2786
|
+
const clipShapePts = [];
|
|
2787
|
+
clipShapePts.push(Point3d.create(0, 0, 0));
|
|
2788
|
+
clipShapePts.push(Point3d.create(10, 0, 0));
|
|
2789
|
+
clipShapePts.push(Point3d.create(10, 5, 0));
|
|
2790
|
+
clipShapePts.push(Point3d.create(5, 5, 0));
|
|
2791
|
+
clipShapePts.push(Point3d.create(5, 10, 0));
|
|
2792
|
+
clipShapePts.push(Point3d.create(0, 10, 0));
|
|
2793
|
+
clipShapePts.push(Point3d.create(0, 0, 0));
|
|
2794
|
+
const clip = ClipVector.createEmpty();
|
|
2795
|
+
clip.appendShape(clipShapePts, -5, 5);
|
|
2796
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous];
|
|
2797
|
+
const requestProps = {
|
|
2798
|
+
candidates: [rangeInsideXYId, rangeInsideXId, rangeInsideYId, rangeOutsideId, rangeOvrGeomOvrId],
|
|
2799
|
+
clip: clip.toJSON(),
|
|
2800
|
+
allowOverlaps: true,
|
|
2801
|
+
};
|
|
2802
|
+
const result = await imodel.getGeometryContainment(requestProps);
|
|
2803
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2804
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2805
|
+
assert.isTrue(3 === result.numInside);
|
|
2806
|
+
assert.isTrue(1 === result.numOutside);
|
|
2807
|
+
assert.isTrue(1 === result.numOverlap);
|
|
2808
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2809
|
+
});
|
|
2810
|
+
it("clip plane curve containment", async () => {
|
|
2811
|
+
// Set up element to be placed in iModel
|
|
2812
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2813
|
+
assert.exists(seedElement);
|
|
2814
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2815
|
+
const rangeInsideId = createCircleElem(1.0, Point3d.create(0, 0, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2816
|
+
const rangeOutsideId = createCircleElem(1.0, Point3d.create(10, 0, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2817
|
+
const rangeOverlapId = createCircleElem(1.0, Point3d.create(5, 0, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2818
|
+
imodel.saveChanges();
|
|
2819
|
+
const plane = Plane3dByOriginAndUnitNormal.create(Point3d.create(5, 0, 0), Vector3d.create(-1, 0, 0)); // inward normal...
|
|
2820
|
+
const planeSet = ConvexClipPlaneSet.createEmpty();
|
|
2821
|
+
planeSet.addPlaneToConvexSet(ClipPlane.createPlane(plane));
|
|
2822
|
+
const prim = ClipPrimitive.createCapture(planeSet);
|
|
2823
|
+
const clip = ClipVector.createEmpty();
|
|
2824
|
+
clip.appendReference(prim);
|
|
2825
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous];
|
|
2826
|
+
const requestProps = {
|
|
2827
|
+
candidates: [rangeInsideId, rangeOutsideId, rangeOverlapId],
|
|
2828
|
+
clip: clip.toJSON(),
|
|
2829
|
+
allowOverlaps: true,
|
|
2830
|
+
};
|
|
2831
|
+
const result = await imodel.getGeometryContainment(requestProps);
|
|
2832
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2833
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2834
|
+
assert.isTrue(1 === result.numInside);
|
|
2835
|
+
assert.isTrue(1 === result.numOutside);
|
|
2836
|
+
assert.isTrue(1 === result.numOverlap);
|
|
2837
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2838
|
+
});
|
|
2839
|
+
it("clip plane mesh containment", async () => {
|
|
2840
|
+
// Set up element to be placed in iModel
|
|
2841
|
+
const seedElement = imodel.elements.getElement("0x1d");
|
|
2842
|
+
assert.exists(seedElement);
|
|
2843
|
+
assert.isTrue(seedElement.federationGuid === "18eb4650-b074-414f-b961-d9cfaa6c8746");
|
|
2844
|
+
const rangeInsideId = createSphereElem(1.0, Point3d.create(0, 0, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2845
|
+
const rangeOutsideId = createSphereElem(1.0, Point3d.create(10, 0, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2846
|
+
const rangeOverlapId = createSphereElem(1.0, Point3d.create(5, 0, 0), YawPitchRollAngles.createDegrees(0, 0, 0), imodel, seedElement);
|
|
2847
|
+
imodel.saveChanges();
|
|
2848
|
+
const plane = Plane3dByOriginAndUnitNormal.create(Point3d.create(5, 0, 0), Vector3d.create(-1, 0, 0)); // inward normal...
|
|
2849
|
+
const planeSet = ConvexClipPlaneSet.createEmpty();
|
|
2850
|
+
planeSet.addPlaneToConvexSet(ClipPlane.createPlane(plane));
|
|
2851
|
+
const prim = ClipPrimitive.createCapture(planeSet);
|
|
2852
|
+
const clip = ClipVector.createEmpty();
|
|
2853
|
+
clip.appendReference(prim);
|
|
2854
|
+
const expectedContainment = [ClipPlaneContainment.StronglyInside, ClipPlaneContainment.StronglyOutside, ClipPlaneContainment.Ambiguous];
|
|
2855
|
+
const requestProps = {
|
|
2856
|
+
candidates: [rangeInsideId, rangeOutsideId, rangeOverlapId],
|
|
2857
|
+
clip: clip.toJSON(),
|
|
2858
|
+
allowOverlaps: true,
|
|
2859
|
+
};
|
|
2860
|
+
const result = await imodel.getGeometryContainment(requestProps);
|
|
2861
|
+
assert.isTrue(BentleyStatus.SUCCESS === result.status && undefined !== result.candidatesContainment);
|
|
2862
|
+
assert.isTrue(result.candidatesContainment?.length === expectedContainment.length);
|
|
2863
|
+
assert.isTrue(1 === result.numInside);
|
|
2864
|
+
assert.isTrue(1 === result.numOutside);
|
|
2865
|
+
assert.isTrue(1 === result.numOverlap);
|
|
2866
|
+
result.candidatesContainment.forEach((val, index) => assert.isTrue(val === expectedContainment[index]));
|
|
2867
|
+
});
|
|
2868
|
+
});
|
|
2869
|
+
//# sourceMappingURL=GeometryStream.test.js.map
|