@itwin/core-backend 5.1.0-dev.55 → 5.1.0-dev.57

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.
Files changed (378) hide show
  1. package/lib/cjs/BackendHubAccess.js.map +1 -1
  2. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  3. package/lib/cjs/BisCoreSchema.js.map +1 -1
  4. package/lib/cjs/BlobContainerService.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/CatalogDb.js.map +1 -1
  7. package/lib/cjs/Category.js.map +1 -1
  8. package/lib/cjs/ChangeSummaryManager.js +2 -2
  9. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  10. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  11. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  12. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  13. package/lib/cjs/ChannelControl.js.map +1 -1
  14. package/lib/cjs/CheckpointManager.js.map +1 -1
  15. package/lib/cjs/ClassRegistry.js +5 -5
  16. package/lib/cjs/ClassRegistry.js.map +1 -1
  17. package/lib/cjs/CloudSqlite.js.map +1 -1
  18. package/lib/cjs/CodeService.js.map +1 -1
  19. package/lib/cjs/CodeSpecs.js.map +1 -1
  20. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  21. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  22. package/lib/cjs/DevTools.js.map +1 -1
  23. package/lib/cjs/DisplayStyle.js.map +1 -1
  24. package/lib/cjs/ECDb.js.map +1 -1
  25. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  26. package/lib/cjs/ECSqlStatement.js.map +1 -1
  27. package/lib/cjs/Element.js.map +1 -1
  28. package/lib/cjs/ElementAspect.js.map +1 -1
  29. package/lib/cjs/ElementGraphics.js.map +1 -1
  30. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  31. package/lib/cjs/Entity.js.map +1 -1
  32. package/lib/cjs/EntityReferences.js.map +1 -1
  33. package/lib/cjs/ExportGraphics.js.map +1 -1
  34. package/lib/cjs/ExternalSource.js.map +1 -1
  35. package/lib/cjs/FontFile.js.map +1 -1
  36. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  37. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  38. package/lib/cjs/GeometrySummary.js +47 -47
  39. package/lib/cjs/GeometrySummary.js.map +1 -1
  40. package/lib/cjs/IModelDb.js +8 -8
  41. package/lib/cjs/IModelDb.js.map +1 -1
  42. package/lib/cjs/IModelDbFonts.js.map +1 -1
  43. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  44. package/lib/cjs/IModelHost.js.map +1 -1
  45. package/lib/cjs/IModelJsFs.js.map +1 -1
  46. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  47. package/lib/cjs/IpcHost.js.map +1 -1
  48. package/lib/cjs/LineStyle.js.map +1 -1
  49. package/lib/cjs/LocalHub.js +1 -1
  50. package/lib/cjs/LocalHub.js.map +1 -1
  51. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  52. package/lib/cjs/LockControl.js.map +1 -1
  53. package/lib/cjs/Material.js.map +1 -1
  54. package/lib/cjs/Model.js.map +1 -1
  55. package/lib/cjs/NativeAppStorage.js.map +1 -1
  56. package/lib/cjs/NativeHost.js.map +1 -1
  57. package/lib/cjs/NavigationRelationship.js.map +1 -1
  58. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  59. package/lib/cjs/PropertyStore.js.map +1 -1
  60. package/lib/cjs/Relationship.js.map +1 -1
  61. package/lib/cjs/RpcBackend.js.map +1 -1
  62. package/lib/cjs/SQLiteDb.js.map +1 -1
  63. package/lib/cjs/Schema.js.map +1 -1
  64. package/lib/cjs/SchemaSync.js.map +1 -1
  65. package/lib/cjs/SchemaUtils.js.map +1 -1
  66. package/lib/cjs/SheetIndex.js.map +1 -1
  67. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  68. package/lib/cjs/SqliteStatement.js.map +1 -1
  69. package/lib/cjs/Texture.js.map +1 -1
  70. package/lib/cjs/TileStorage.js.map +1 -1
  71. package/lib/cjs/TxnManager.js.map +1 -1
  72. package/lib/cjs/ViewDefinition.js.map +1 -1
  73. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  74. package/lib/cjs/ViewStore.js.map +1 -1
  75. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  76. package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
  77. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
  78. package/lib/cjs/annotations/LeaderGeometry.js +175 -0
  79. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
  80. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  81. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  82. package/lib/cjs/annotations/TextAnnotationGeometry.js +5 -0
  83. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  84. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  85. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  86. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  87. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  88. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  89. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  90. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  91. package/lib/cjs/core-backend.d.ts +1 -0
  92. package/lib/cjs/core-backend.d.ts.map +1 -1
  93. package/lib/cjs/core-backend.js +1 -0
  94. package/lib/cjs/core-backend.js.map +1 -1
  95. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  96. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  97. package/lib/cjs/domains/GenericElements.js.map +1 -1
  98. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  99. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  100. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  101. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  102. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  103. package/lib/cjs/internal/HubMock.js.map +1 -1
  104. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  105. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  106. package/lib/cjs/internal/NoLocks.js.map +1 -1
  107. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  108. package/lib/cjs/internal/Symbols.js.map +1 -1
  109. package/lib/cjs/internal/cross-package.js.map +1 -1
  110. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  111. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  112. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  113. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  114. package/lib/cjs/rpc/multipart.js.map +1 -1
  115. package/lib/cjs/rpc/tracing.js.map +1 -1
  116. package/lib/cjs/rpc/web/logging.js.map +1 -1
  117. package/lib/cjs/rpc/web/request.js.map +1 -1
  118. package/lib/cjs/rpc/web/response.js.map +1 -1
  119. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  120. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  121. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  122. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  123. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  124. package/lib/cjs/workspace/Settings.js.map +1 -1
  125. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  126. package/lib/cjs/workspace/Workspace.js.map +1 -1
  127. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  128. package/lib/esm/BackendHubAccess.js.map +1 -1
  129. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  130. package/lib/esm/BisCoreSchema.js.map +1 -1
  131. package/lib/esm/BlobContainerService.js.map +1 -1
  132. package/lib/esm/BriefcaseManager.js.map +1 -1
  133. package/lib/esm/CatalogDb.js.map +1 -1
  134. package/lib/esm/Category.js.map +1 -1
  135. package/lib/esm/ChangeSummaryManager.js +2 -2
  136. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  137. package/lib/esm/ChangedElementsDb.js.map +1 -1
  138. package/lib/esm/ChangesetECAdaptor.js +248 -248
  139. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  140. package/lib/esm/ChannelControl.js.map +1 -1
  141. package/lib/esm/CheckpointManager.js.map +1 -1
  142. package/lib/esm/ClassRegistry.js +5 -5
  143. package/lib/esm/ClassRegistry.js.map +1 -1
  144. package/lib/esm/CloudSqlite.js.map +1 -1
  145. package/lib/esm/CodeService.js.map +1 -1
  146. package/lib/esm/CodeSpecs.js.map +1 -1
  147. package/lib/esm/ConcurrentQuery.js.map +1 -1
  148. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  149. package/lib/esm/DevTools.js.map +1 -1
  150. package/lib/esm/DisplayStyle.js.map +1 -1
  151. package/lib/esm/ECDb.js.map +1 -1
  152. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  153. package/lib/esm/ECSqlStatement.js.map +1 -1
  154. package/lib/esm/Element.js.map +1 -1
  155. package/lib/esm/ElementAspect.js.map +1 -1
  156. package/lib/esm/ElementGraphics.js.map +1 -1
  157. package/lib/esm/ElementTreeWalker.js.map +1 -1
  158. package/lib/esm/Entity.js.map +1 -1
  159. package/lib/esm/EntityReferences.js.map +1 -1
  160. package/lib/esm/ExportGraphics.js.map +1 -1
  161. package/lib/esm/ExternalSource.js.map +1 -1
  162. package/lib/esm/FontFile.js.map +1 -1
  163. package/lib/esm/GeoCoordConfig.js.map +1 -1
  164. package/lib/esm/GeographicCRSServices.js.map +1 -1
  165. package/lib/esm/GeometrySummary.js +47 -47
  166. package/lib/esm/GeometrySummary.js.map +1 -1
  167. package/lib/esm/IModelDb.js +8 -8
  168. package/lib/esm/IModelDb.js.map +1 -1
  169. package/lib/esm/IModelDbFonts.js.map +1 -1
  170. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  171. package/lib/esm/IModelHost.js.map +1 -1
  172. package/lib/esm/IModelJsFs.js.map +1 -1
  173. package/lib/esm/ImageSourceConversion.js.map +1 -1
  174. package/lib/esm/IpcHost.js.map +1 -1
  175. package/lib/esm/LineStyle.js.map +1 -1
  176. package/lib/esm/LocalHub.js +1 -1
  177. package/lib/esm/LocalHub.js.map +1 -1
  178. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  179. package/lib/esm/LockControl.js.map +1 -1
  180. package/lib/esm/Material.js.map +1 -1
  181. package/lib/esm/Model.js.map +1 -1
  182. package/lib/esm/NativeAppStorage.js.map +1 -1
  183. package/lib/esm/NativeHost.js.map +1 -1
  184. package/lib/esm/NavigationRelationship.js.map +1 -1
  185. package/lib/esm/PromiseMemoizer.js.map +1 -1
  186. package/lib/esm/PropertyStore.js.map +1 -1
  187. package/lib/esm/Relationship.js.map +1 -1
  188. package/lib/esm/RpcBackend.js.map +1 -1
  189. package/lib/esm/SQLiteDb.js.map +1 -1
  190. package/lib/esm/Schema.js.map +1 -1
  191. package/lib/esm/SchemaSync.js.map +1 -1
  192. package/lib/esm/SchemaUtils.js.map +1 -1
  193. package/lib/esm/SheetIndex.js.map +1 -1
  194. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  195. package/lib/esm/SqliteStatement.js.map +1 -1
  196. package/lib/esm/Texture.js.map +1 -1
  197. package/lib/esm/TileStorage.js.map +1 -1
  198. package/lib/esm/TxnManager.js.map +1 -1
  199. package/lib/esm/ViewDefinition.js.map +1 -1
  200. package/lib/esm/ViewStateHydrator.js.map +1 -1
  201. package/lib/esm/ViewStore.js.map +1 -1
  202. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  203. package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
  204. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
  205. package/lib/esm/annotations/LeaderGeometry.js +170 -0
  206. package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
  207. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  208. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  209. package/lib/esm/annotations/TextAnnotationGeometry.js +5 -0
  210. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  211. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  212. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  213. package/lib/esm/core-backend.d.ts +1 -0
  214. package/lib/esm/core-backend.d.ts.map +1 -1
  215. package/lib/esm/core-backend.js +1 -0
  216. package/lib/esm/core-backend.js.map +1 -1
  217. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  218. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  219. package/lib/esm/domains/GenericElements.js.map +1 -1
  220. package/lib/esm/domains/GenericSchema.js.map +1 -1
  221. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  222. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  223. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  224. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  225. package/lib/esm/internal/HubMock.js.map +1 -1
  226. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  227. package/lib/esm/internal/NativePlatform.js.map +1 -1
  228. package/lib/esm/internal/NoLocks.js.map +1 -1
  229. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  230. package/lib/esm/internal/Symbols.js.map +1 -1
  231. package/lib/esm/internal/cross-package.js.map +1 -1
  232. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  233. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  234. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  235. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  236. package/lib/esm/rpc/multipart.js.map +1 -1
  237. package/lib/esm/rpc/tracing.js.map +1 -1
  238. package/lib/esm/rpc/web/logging.js.map +1 -1
  239. package/lib/esm/rpc/web/request.js.map +1 -1
  240. package/lib/esm/rpc/web/response.js.map +1 -1
  241. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  242. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  243. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  244. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  245. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  246. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  247. package/lib/esm/test/AnnotationTestUtils.d.ts +15 -0
  248. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
  249. package/lib/esm/test/AnnotationTestUtils.js +35 -0
  250. package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
  251. package/lib/esm/test/AttachDb.test.js +11 -11
  252. package/lib/esm/test/AttachDb.test.js.map +1 -1
  253. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  254. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  255. package/lib/esm/test/IModelHost.test.js.map +1 -1
  256. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  257. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  258. package/lib/esm/test/IpcHost.test.js.map +1 -1
  259. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  260. package/lib/esm/test/PrintElementTree.js.map +1 -1
  261. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  262. package/lib/esm/test/RevisionUtility.js.map +1 -1
  263. package/lib/esm/test/SchemaUtils.test.js +25 -25
  264. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  265. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  266. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  267. package/lib/esm/test/TestUtils.js.map +1 -1
  268. package/lib/esm/test/annotations/FrameGeometry.test.js +2 -14
  269. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  270. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
  271. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
  272. package/lib/esm/test/annotations/LeaderGeometry.test.js +251 -0
  273. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
  274. package/lib/esm/test/annotations/TextAnnotation.test.js +2 -4
  275. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  276. package/lib/esm/test/annotations/TextBlock.test.js +2 -15
  277. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  278. package/lib/esm/test/categories/Category.test.js.map +1 -1
  279. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  280. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  281. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  282. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +15 -15
  283. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  284. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  285. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  286. package/lib/esm/test/ecdb/ECDb.test.js +57 -57
  287. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  288. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  289. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  290. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  291. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  292. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  293. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  294. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  295. package/lib/esm/test/ecdb/ECSqlStatement.test.js +326 -326
  296. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  297. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  298. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  299. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  300. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  301. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  302. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  303. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  304. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  305. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  306. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  307. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  308. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  309. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  310. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  311. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  312. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  313. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  314. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  315. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  316. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  317. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  318. package/lib/esm/test/imageData.js.map +1 -1
  319. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  320. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  321. package/lib/esm/test/imodel/IModel.test.js +44 -44
  322. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  323. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  324. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  325. package/lib/esm/test/index.js.map +1 -1
  326. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  327. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  328. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  329. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  330. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  331. package/lib/esm/test/rpc/response.test.js.map +1 -1
  332. package/lib/esm/test/schema/ClassRegistry.test.js +71 -71
  333. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  334. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  335. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  336. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  337. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  338. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  339. package/lib/esm/test/standalone/ChangesetReader.test.js +75 -75
  340. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  341. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  342. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  343. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  344. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  345. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  346. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  347. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  348. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  349. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  350. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  351. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  352. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  353. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  354. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  355. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  356. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  357. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  358. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  359. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  360. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  361. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  362. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  363. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  364. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  365. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  366. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  367. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  368. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  369. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  370. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  371. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  372. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  373. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  374. package/lib/esm/workspace/Settings.js.map +1 -1
  375. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  376. package/lib/esm/workspace/Workspace.js.map +1 -1
  377. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  378. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"FrameGeometry.js","sourceRoot":"","sources":["../../../src/annotations/FrameGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAmB,WAAW,EAAiE,MAAM,oBAAoB,CAAC;AAC3J,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE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AAE,CAAC;IAE/B,8BAA8B;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,cAAc,GAAG,WAAW,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACzD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,oBAAoB;IACpB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3B,4BAA4B;IAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\n\nimport { BackgroundFill, ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotationFrameShape, TextFrameStyleProps } from \"@itwin/core-common\";\nimport { Angle, AngleSweep, Arc3d, LineString3d, Loop, Path, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\n\n/**\n * Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.\n * @param builder that will be appended to in place\n * @param category to which the frame belongs, used for the [[GeometryParams]].\n * @param frame\n * @param range to enclose with the frame\n * @param transform that transform the range to world coordinates\n * @returns `true` if any geometry was appended to the builder\n* @beta\n */\nexport function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform, geomParams: GeometryParams): boolean {\n if (undefined === frame.shape || frame.shape === \"none\") {\n return false;\n }\n\n const params = geomParams.clone();\n\n if (frame.fill === undefined) {\n params.fillDisplay = FillDisplay.Never;\n } else if (frame.fill === \"background\") {\n params.backgroundFill = BackgroundFill.Solid;\n params.fillDisplay = FillDisplay.Blanking;\n } else if (frame.fill !== \"subcategory\") {\n params.fillColor = ColorDef.fromJSON(frame.fill);\n params.lineColor = params.fillColor;\n params.fillDisplay = FillDisplay.Blanking;\n }\n\n if (frame.border !== \"subcategory\") {\n params.lineColor = ColorDef.fromJSON(frame.border);\n params.weight = frame.borderWeight;\n }\n\n const frameGeometry = computeFrame({ frame: frame.shape, range, transform });\n if (!builder.appendGeometryParamsChange(params) || !builder.appendGeometryQuery(frameGeometry)) {\n return false;\n }\n\n // The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.\n if (params.fillDisplay === FillDisplay.Blanking) {\n const outlineParams = params.clone();\n outlineParams.fillDisplay = FillDisplay.Never;\n if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Arguments for the [[computeFrame]] method.\n * @beta\n */\nexport interface ComputeFrameArgs {\n /** Frame shape to be calculated */\n frame: Exclude<TextAnnotationFrameShape, \"none\">;\n /** Range to be enclosed */\n range: Range2d;\n /** Transform that translates and rotates the range to world coordinates */\n transform: Transform;\n}\n\n/**\n * Computes the frame geometry based on the provided frame shape and range.\n * @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry\n * @beta\n */\nexport function computeFrame(args: ComputeFrameArgs): Loop | Path {\n switch (args.frame) {\n case \"line\": return computeLine(args.range, args.transform);\n case \"rectangle\": return computeRectangle(args.range, args.transform);\n case \"circle\": return computeCircle(args.range, args.transform);\n case \"equilateralTriangle\": return computeTriangle(args.range, args.transform);\n case \"diamond\": return computeDiamond(args.range, args.transform);\n case \"square\": return computeSquare(args.range, args.transform);\n case \"pentagon\": return computePolygon(5, args.range, args.transform, 90);\n case \"hexagon\": return computePolygon(6, args.range, args.transform);\n case \"octagon\": return computePolygon(8, args.range, args.transform, 180 / 8); // or pi/8 in radians\n case \"capsule\": return computeCapsule(args.range, args.transform);\n case \"roundedRectangle\": return computeRoundedRectangle(args.range, args.transform);\n default: return computeRectangle(args.range, args.transform);\n }\n}\n\n/**\n * Arguments for the [[computeIntervalPoints]] method.\n * @beta\n */\nexport interface ComputeIntervalPointsArgs extends ComputeFrameArgs {\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\n lineIntervalFactor?: number;\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\n arcIntervalFactor?: number;\n}\n\n/**\n * Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.\n * These can be used for snapping or attaching leaders.\n * @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.\n * @beta\n */\nexport function computeIntervalPoints({ frame, range, transform, lineIntervalFactor = 0.5, arcIntervalFactor = 0.25 }: ComputeIntervalPointsArgs): Point3d[] | undefined {\n const points: Point3d[] = [];\n const curves = computeFrame({ frame, range, transform }).collectCurvePrimitives(undefined, false, true);\n\n curves.forEach((curve) => {\n const end = curve instanceof Arc3d ? arcIntervalFactor : lineIntervalFactor;\n for (let interval = 0; interval <= 1; interval += end) {\n points.push(curve.fractionToPoint(interval));\n }\n });\n return points;\n}\n\n/** Line - currently just adds an underline. Once we have leaders, this method may change. */\nconst computeLine = (range: Range2d, transform: Transform): Path => {\n const points = [Point3d.create(range.low.x, range.low.y), Point3d.create(range.high.x, range.low.y)];\n const frame = LineString3d.createPoints(points);\n\n return Path.create(frame.cloneTransformed(transform));\n}\n\n/** Rectangle - simplest frame */\nconst computeRectangle = (range: Range2d, transform: Transform): Loop => {\n const points = range.corners3d(true);\n const frame = LineString3d.createPoints(points);\n\n return Loop.create(frame.cloneTransformed(transform));\n}\n\n/** Rounded Rectangle: each corner will be turned into an arc with the radius of the arc being the @param radiusFactor * the height (yLength) of the range */\nconst computeRoundedRectangle = (range: Range2d, transform: Transform, radiusFactor: number = 0.25): Loop => {\n const radius = range.yLength() * radiusFactor * Math.sqrt(2);\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\n const radiusOffsetFactor = range.yLength() * radiusFactor;\n\n // These values are the origins of the circles\n const inLeft = range.low.x + radiusOffsetFactor;\n const inRight = range.high.x - radiusOffsetFactor;\n const inBottom = range.low.y + radiusOffsetFactor;\n const inTop = range.high.y - radiusOffsetFactor\n\n // These values exist on the circles\n const exLeft = inLeft - radius;\n const exRight = inRight + radius;\n const exBottom = inBottom - radius;\n const exTop = inTop + radius;\n\n const q1 = AngleSweep.createStartEndDegrees(0, 90);\n const q2 = AngleSweep.createStartEndDegrees(90, 180);\n const q3 = AngleSweep.createStartEndDegrees(180, 270);\n const q4 = AngleSweep.createStartEndDegrees(270, 360);\n\n\n const curves = [\n LineString3d.create([Point3d.create(inRight, exTop), Point3d.create(inLeft, exTop)]), // top\n Arc3d.createXY(Point3d.create(inLeft, inTop), radius, q2), // top left\n LineString3d.create([Point3d.create(exLeft, inTop), Point3d.create(exLeft, inBottom)]), // left\n Arc3d.createXY(Point3d.create(inLeft, inBottom), radius, q3), // bottom left\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\n Arc3d.createXY(Point3d.create(inRight, inBottom), radius, q4), // bottom right\n LineString3d.create([Point3d.create(exRight, inBottom), Point3d.create(exRight, inTop)]), // right\n Arc3d.createXY(Point3d.create(inRight, inTop), radius, q1), // top right\n ];\n\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)))\n}\n\n\n/** Circle */\nconst computeCircle = (range: Range2d, transform: Transform): Loop => {\n const radius = range.low.distance(range.high) / 2;\n const frame = Arc3d.createXY(Point3d.createFrom(range.center), radius);\n return Loop.create(frame.cloneTransformed(transform));\n}\n\n/** Equilateral Triangle */\nconst computeTriangle = (range: Range2d, transform: Transform): Loop => {\n\n const xLength = range.xLength();\n const yLength = range.yLength();\n const center = range.center;\n const points: Point3d[] = [];\n\n const magnitude = (xLength > yLength) ? (xLength * Math.sqrt(3) + yLength) / 2 : (yLength * Math.sqrt(3) + xLength) / 2;\n\n const v1 = Vector2d.create(0, magnitude);\n const vectors = [\n v1, // top\n v1.rotateXY(Angle.createDegrees(120)), // left\n v1.rotateXY(Angle.createDegrees(240)), // right\n v1 // top\n ];\n\n vectors.forEach((v) => {\n points.push(Point3d.create(center.x + v.x, center.y + v.y));\n });\n\n const frame = LineString3d.createPoints(points);\n\n return Loop.create(frame.cloneTransformed(transform));\n}\n\n/** Diamond (square rotated 45 degrees) */\nconst computeDiamond = (range: Range2d, transform: Transform): Loop => {\n const offset = (range.xLength() + range.yLength()) / 2;\n const center = range.center;\n\n const points = [\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\n Point3d.createFrom({ x: center.x + offset, y: center.y }), // right\n Point3d.createFrom({ x: center.x, y: center.y - offset }), // bottom\n Point3d.createFrom({ x: center.x - offset, y: center.y }), // left\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\n ];\n\n const frame = LineString3d.createPoints(points);\n\n return Loop.create(frame.cloneTransformed(transform));\n}\n\n/** Square */\nconst computeSquare = (range: Range2d, transform: Transform): Loop => {\n\n // Extend range\n const xLength = range.xLength() / 2;\n const yLength = range.yLength() / 2;\n const center = range.center;\n if (xLength > yLength) {\n range.extendPoint({ x: center.x, y: center.y + xLength });\n range.extendPoint({ x: center.x, y: center.y - xLength });\n } else {\n range.extendPoint({ x: center.x + yLength, y: center.y });\n range.extendPoint({ x: center.x - yLength, y: center.y });\n }\n\n const points = range.corners3d(true);\n const frame = LineString3d.createPoints(points);\n\n return Loop.create(frame.cloneTransformed(transform));\n}\n\n/** Capsule (or pill shape) */\nconst computeCapsule = (range: Range2d, transform: Transform): Loop => {\n const height = range.yLength();\n const radius = height * (Math.sqrt(2) / 2);\n\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\n const radiusOffsetFactor = height / 2;\n\n // These values are the origins of the circles\n const inLeft = range.low.x + radiusOffsetFactor;\n const inRight = range.high.x - radiusOffsetFactor;\n const inBottom = range.low.y + radiusOffsetFactor;\n const inTop = range.high.y - radiusOffsetFactor\n\n // These values exist on the circles\n const exBottom = inBottom - radius;\n const exTop = inTop + radius;\n\n const leftHalfCircle = AngleSweep.createStartEndDegrees(90, 270);\n const rightHalfCircle = AngleSweep.createStartEndDegrees(-90, 90);\n\n const curves = [\n LineString3d.create([Point3d.create(inRight, exTop), Point3d.create(inLeft, exTop)]), // top\n Arc3d.createXY(Point3d.create(inLeft, range.center.y), radius, leftHalfCircle), // left\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\n Arc3d.createXY(Point3d.create(inRight, range.center.y), radius, rightHalfCircle), // right\n ];\n\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));\n}\n\n/** Regular polygon with n sides: note, this a generic method that can be used to create any polygon, but the frame will not be as tightly encapsulating. */\nconst computePolygon = (n: number, range: Range2d, transform: Transform, angleOffset: number = 0): Loop => {\n // These are math terms: cspell:ignore inradius circumradius\n if (n < 3) throw new Error(\"A polygon must have at least 3 sides.\");\n\n // We're assuming the polygon is a regular polygon with `n` sides.\n // The center of the polygon is the center of the range.\n const center = range.center;\n // The inradius is the distance from the center to the midpoint of each side of the polygon. On our range, this coincides with the distance from the center to one of its corners.\n const inradius = range.low.distance(range.high) / 2;\n // The circumradius is the distance from the center to each vertex of the polygon.\n const circumradius = inradius / Math.cos(Math.PI / n);\n\n // The exterior angles add up to 360 degrees.\n const angleIncrement = 360 / n;\n const vertices: Point3d[] = [];\n\n // Add a point for each vertex\n for (let i = 0; i < n; i++) {\n const angle = Angle.createDegrees(i * angleIncrement + angleOffset);\n const vector = Vector2d.createPolar(circumradius, angle);\n vertices.push(Point3d.create(center.x + vector.x, center.y + vector.y));\n }\n\n // Close the polygon\n vertices.push(vertices[0]);\n\n // Finally compute the loop!\n const frame = LineString3d.createPoints(vertices);\n return Loop.create(frame.cloneTransformed(transform));\n};"]}
1
+ {"version":3,"file":"FrameGeometry.js","sourceRoot":"","sources":["../../../src/annotations/FrameGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAmB,WAAW,EAAiE,MAAM,oBAAoB,CAAC;AAC3J,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAsB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjI;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgC,EAAE,KAA0B,EAAE,KAAc,EAAE,SAAoB,EAAE,UAA0B;IACjK,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAElC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC;IACzC,CAAC;SAAM,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACvC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC;QAC7C,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC;IAC5C,CAAC;SAAM,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QACxC,MAAM,CAAC,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C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\n\r\nimport { BackgroundFill, ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotationFrameShape, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { Angle, AngleSweep, Arc3d, LineString3d, Loop, Path, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\r\n\r\n/**\r\n * Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.\r\n * @param builder that will be appended to in place\r\n * @param category to which the frame belongs, used for the [[GeometryParams]].\r\n * @param frame\r\n * @param range to enclose with the frame\r\n * @param transform that transform the range to world coordinates\r\n * @returns `true` if any geometry was appended to the builder\r\n* @beta\r\n */\r\nexport function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform, geomParams: GeometryParams): boolean {\r\n if (undefined === frame.shape || frame.shape === \"none\") {\r\n return false;\r\n }\r\n\r\n const params = geomParams.clone();\r\n\r\n if (frame.fill === undefined) {\r\n params.fillDisplay = FillDisplay.Never;\r\n } else if (frame.fill === \"background\") {\r\n params.backgroundFill = BackgroundFill.Solid;\r\n params.fillDisplay = FillDisplay.Blanking;\r\n } else if (frame.fill !== \"subcategory\") {\r\n params.fillColor = ColorDef.fromJSON(frame.fill);\r\n params.lineColor = params.fillColor;\r\n params.fillDisplay = FillDisplay.Blanking;\r\n }\r\n\r\n if (frame.border !== \"subcategory\") {\r\n params.lineColor = ColorDef.fromJSON(frame.border);\r\n params.weight = frame.borderWeight;\r\n }\r\n\r\n const frameGeometry = computeFrame({ frame: frame.shape, range, transform });\r\n if (!builder.appendGeometryParamsChange(params) || !builder.appendGeometryQuery(frameGeometry)) {\r\n return false;\r\n }\r\n\r\n // The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.\r\n if (params.fillDisplay === FillDisplay.Blanking) {\r\n const outlineParams = params.clone();\r\n outlineParams.fillDisplay = FillDisplay.Never;\r\n if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Arguments for the [[computeFrame]] method.\r\n * @beta\r\n */\r\nexport interface ComputeFrameArgs {\r\n /** Frame shape to be calculated */\r\n frame: Exclude<TextAnnotationFrameShape, \"none\">;\r\n /** Range to be enclosed */\r\n range: Range2d;\r\n /** Transform that translates and rotates the range to world coordinates */\r\n transform: Transform;\r\n}\r\n\r\n/**\r\n * Computes the frame geometry based on the provided frame shape and range.\r\n * @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry\r\n * @beta\r\n */\r\nexport function computeFrame(args: ComputeFrameArgs): Loop | Path {\r\n switch (args.frame) {\r\n case \"line\": return computeLine(args.range, args.transform);\r\n case \"rectangle\": return computeRectangle(args.range, args.transform);\r\n case \"circle\": return computeCircle(args.range, args.transform);\r\n case \"equilateralTriangle\": return computeTriangle(args.range, args.transform);\r\n case \"diamond\": return computeDiamond(args.range, args.transform);\r\n case \"square\": return computeSquare(args.range, args.transform);\r\n case \"pentagon\": return computePolygon(5, args.range, args.transform, 90);\r\n case \"hexagon\": return computePolygon(6, args.range, args.transform);\r\n case \"octagon\": return computePolygon(8, args.range, args.transform, 180 / 8); // or pi/8 in radians\r\n case \"capsule\": return computeCapsule(args.range, args.transform);\r\n case \"roundedRectangle\": return computeRoundedRectangle(args.range, args.transform);\r\n default: return computeRectangle(args.range, args.transform);\r\n }\r\n}\r\n\r\n/**\r\n * Arguments for the [[computeIntervalPoints]] method.\r\n * @beta\r\n */\r\nexport interface ComputeIntervalPointsArgs extends ComputeFrameArgs {\r\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\r\n lineIntervalFactor?: number;\r\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\r\n arcIntervalFactor?: number;\r\n}\r\n\r\n/**\r\n * Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.\r\n * These can be used for snapping or attaching leaders.\r\n * @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.\r\n * @beta\r\n */\r\nexport function computeIntervalPoints({ frame, range, transform, lineIntervalFactor = 0.5, arcIntervalFactor = 0.25 }: ComputeIntervalPointsArgs): Point3d[] | undefined {\r\n const points: Point3d[] = [];\r\n const curves = computeFrame({ frame, range, transform }).collectCurvePrimitives(undefined, false, true);\r\n\r\n curves.forEach((curve) => {\r\n const end = curve instanceof Arc3d ? arcIntervalFactor : lineIntervalFactor;\r\n for (let interval = 0; interval <= 1; interval += end) {\r\n points.push(curve.fractionToPoint(interval));\r\n }\r\n });\r\n return points;\r\n}\r\n\r\n/** Line - currently just adds an underline. Once we have leaders, this method may change. */\r\nconst computeLine = (range: Range2d, transform: Transform): Path => {\r\n const points = [Point3d.create(range.low.x, range.low.y), Point3d.create(range.high.x, range.low.y)];\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Path.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Rectangle - simplest frame */\r\nconst computeRectangle = (range: Range2d, transform: Transform): Loop => {\r\n const points = range.corners3d(true);\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Rounded Rectangle: each corner will be turned into an arc with the radius of the arc being the @param radiusFactor * the height (yLength) of the range */\r\nconst computeRoundedRectangle = (range: Range2d, transform: Transform, radiusFactor: number = 0.25): Loop => {\r\n const radius = range.yLength() * radiusFactor * Math.sqrt(2);\r\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\r\n const radiusOffsetFactor = range.yLength() * radiusFactor;\r\n\r\n // These values are the origins of the circles\r\n const inLeft = range.low.x + radiusOffsetFactor;\r\n const inRight = range.high.x - radiusOffsetFactor;\r\n const inBottom = range.low.y + radiusOffsetFactor;\r\n const inTop = range.high.y - radiusOffsetFactor\r\n\r\n // These values exist on the circles\r\n const exLeft = inLeft - radius;\r\n const exRight = inRight + radius;\r\n const exBottom = inBottom - radius;\r\n const exTop = inTop + radius;\r\n\r\n const q1 = AngleSweep.createStartEndDegrees(0, 90);\r\n const q2 = AngleSweep.createStartEndDegrees(90, 180);\r\n const q3 = AngleSweep.createStartEndDegrees(180, 270);\r\n const q4 = AngleSweep.createStartEndDegrees(270, 360);\r\n\r\n\r\n const curves = [\r\n LineString3d.create([Point3d.create(inRight, exTop), Point3d.create(inLeft, exTop)]), // top\r\n Arc3d.createXY(Point3d.create(inLeft, inTop), radius, q2), // top left\r\n LineString3d.create([Point3d.create(exLeft, inTop), Point3d.create(exLeft, inBottom)]), // left\r\n Arc3d.createXY(Point3d.create(inLeft, inBottom), radius, q3), // bottom left\r\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\r\n Arc3d.createXY(Point3d.create(inRight, inBottom), radius, q4), // bottom right\r\n LineString3d.create([Point3d.create(exRight, inBottom), Point3d.create(exRight, inTop)]), // right\r\n Arc3d.createXY(Point3d.create(inRight, inTop), radius, q1), // top right\r\n ];\r\n\r\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)))\r\n}\r\n\r\n\r\n/** Circle */\r\nconst computeCircle = (range: Range2d, transform: Transform): Loop => {\r\n const radius = range.low.distance(range.high) / 2;\r\n const frame = Arc3d.createXY(Point3d.createFrom(range.center), radius);\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Equilateral Triangle */\r\nconst computeTriangle = (range: Range2d, transform: Transform): Loop => {\r\n\r\n const xLength = range.xLength();\r\n const yLength = range.yLength();\r\n const center = range.center;\r\n const points: Point3d[] = [];\r\n\r\n const magnitude = (xLength > yLength) ? (xLength * Math.sqrt(3) + yLength) / 2 : (yLength * Math.sqrt(3) + xLength) / 2;\r\n\r\n const v1 = Vector2d.create(0, magnitude);\r\n const vectors = [\r\n v1, // top\r\n v1.rotateXY(Angle.createDegrees(120)), // left\r\n v1.rotateXY(Angle.createDegrees(240)), // right\r\n v1 // top\r\n ];\r\n\r\n vectors.forEach((v) => {\r\n points.push(Point3d.create(center.x + v.x, center.y + v.y));\r\n });\r\n\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Diamond (square rotated 45 degrees) */\r\nconst computeDiamond = (range: Range2d, transform: Transform): Loop => {\r\n const offset = (range.xLength() + range.yLength()) / 2;\r\n const center = range.center;\r\n\r\n const points = [\r\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\r\n Point3d.createFrom({ x: center.x + offset, y: center.y }), // right\r\n Point3d.createFrom({ x: center.x, y: center.y - offset }), // bottom\r\n Point3d.createFrom({ x: center.x - offset, y: center.y }), // left\r\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\r\n ];\r\n\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Square */\r\nconst computeSquare = (range: Range2d, transform: Transform): Loop => {\r\n\r\n // Extend range\r\n const xLength = range.xLength() / 2;\r\n const yLength = range.yLength() / 2;\r\n const center = range.center;\r\n if (xLength > yLength) {\r\n range.extendPoint({ x: center.x, y: center.y + xLength });\r\n range.extendPoint({ x: center.x, y: center.y - xLength });\r\n } else {\r\n range.extendPoint({ x: center.x + yLength, y: center.y });\r\n range.extendPoint({ x: center.x - yLength, y: center.y });\r\n }\r\n\r\n const points = range.corners3d(true);\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Capsule (or pill shape) */\r\nconst computeCapsule = (range: Range2d, transform: Transform): Loop => {\r\n const height = range.yLength();\r\n const radius = height * (Math.sqrt(2) / 2);\r\n\r\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\r\n const radiusOffsetFactor = height / 2;\r\n\r\n // These values are the origins of the circles\r\n const inLeft = range.low.x + radiusOffsetFactor;\r\n const inRight = range.high.x - radiusOffsetFactor;\r\n const inBottom = range.low.y + radiusOffsetFactor;\r\n const inTop = range.high.y - radiusOffsetFactor\r\n\r\n // These values exist on the circles\r\n const exBottom = inBottom - radius;\r\n const exTop = inTop + radius;\r\n\r\n const leftHalfCircle = AngleSweep.createStartEndDegrees(90, 270);\r\n const rightHalfCircle = AngleSweep.createStartEndDegrees(-90, 90);\r\n\r\n const curves = [\r\n LineString3d.create([Point3d.create(inRight, exTop), Point3d.create(inLeft, exTop)]), // top\r\n Arc3d.createXY(Point3d.create(inLeft, range.center.y), radius, leftHalfCircle), // left\r\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\r\n Arc3d.createXY(Point3d.create(inRight, range.center.y), radius, rightHalfCircle), // right\r\n ];\r\n\r\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));\r\n}\r\n\r\n/** Regular polygon with n sides: note, this a generic method that can be used to create any polygon, but the frame will not be as tightly encapsulating. */\r\nconst computePolygon = (n: number, range: Range2d, transform: Transform, angleOffset: number = 0): Loop => {\r\n // These are math terms: cspell:ignore inradius circumradius\r\n if (n < 3) throw new Error(\"A polygon must have at least 3 sides.\");\r\n\r\n // We're assuming the polygon is a regular polygon with `n` sides.\r\n // The center of the polygon is the center of the range.\r\n const center = range.center;\r\n // The inradius is the distance from the center to the midpoint of each side of the polygon. On our range, this coincides with the distance from the center to one of its corners.\r\n const inradius = range.low.distance(range.high) / 2;\r\n // The circumradius is the distance from the center to each vertex of the polygon.\r\n const circumradius = inradius / Math.cos(Math.PI / n);\r\n\r\n // The exterior angles add up to 360 degrees.\r\n const angleIncrement = 360 / n;\r\n const vertices: Point3d[] = [];\r\n\r\n // Add a point for each vertex\r\n for (let i = 0; i < n; i++) {\r\n const angle = Angle.createDegrees(i * angleIncrement + angleOffset);\r\n const vector = Vector2d.createPolar(circumradius, angle);\r\n vertices.push(Point3d.create(center.x + vector.x, center.y + vector.y));\r\n }\r\n\r\n // Close the polygon\r\n vertices.push(vertices[0]);\r\n\r\n // Finally compute the loop!\r\n const frame = LineString3d.createPoints(vertices);\r\n return Loop.create(frame.cloneTransformed(transform));\r\n};"]}
@@ -0,0 +1,53 @@
1
+ /** @packageDocumentation
2
+ * @module ElementGeometry
3
+ */
4
+ import { ElementGeometry, GeometryParams, TextAnnotationLeader, TextFrameStyleProps } from "@itwin/core-common";
5
+ import { Loop, Path, Point3d, Transform, Vector3d } from "@itwin/core-geometry";
6
+ import { TextBlockLayout } from "./TextBlockLayout";
7
+ /**
8
+ * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.
9
+ *
10
+ * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points
11
+ * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader
12
+ * line and terminator geometry to the builder. It also applies color overrides if specified
13
+ * in the leader's style overrides.
14
+ *
15
+ * @param builder - The geometry builder to which the leader geometries will be appended.
16
+ * @param leaders - An array of leader properties.
17
+ * @param layout - The layout information for the text block, including its range.
18
+ * @param transform - The transform to apply to the frame and leader geometry.
19
+ * @param params - The geometry parameters, such as color, to use for the leader lines.
20
+ * @param frame - (Optional) The style properties for the text frame. If not provided or set to "none", a default rectangle is used.
21
+ * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.
22
+ * @beta
23
+ */
24
+ export declare function appendLeadersToBuilder(builder: ElementGeometry.Builder, leaders: TextAnnotationLeader[], layout: TextBlockLayout, transform: Transform, params: GeometryParams, frame?: TextFrameStyleProps): boolean;
25
+ /**
26
+ * Computes the direction vector for an "elbow" for leader based on the attachment point and a frame curve.
27
+ * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.
28
+ * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.
29
+ *
30
+ * @param attachmentPoint - The point where the leader attaches.
31
+ * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.
32
+ * @param elbowLength - The length of the elbow segment to be created.
33
+ * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.
34
+ * @beta
35
+ */
36
+ export declare function computeElbowDirection(attachmentPoint: Point3d, frameCurve: Loop | Path, elbowLength: number): Vector3d | undefined;
37
+ /**
38
+ * Computes the attachment point for a leader line on a text annotation frame.
39
+ *
40
+ * The attachment point is determined based on the leader's attachment mode:
41
+ * - `"Nearest"`: Finds the closest point on the frame curve to the leader's start point.
42
+ * - `"KeyPoint"`: Uses a specific curve segment and fraction along that segment to determine the point.
43
+ * - `"TextPoint"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.
44
+ *
45
+ * @param leader - The leader props.
46
+ * @param frameCurve - The curve (Loop or Path) representing the annotation frame.
47
+ * @param textLayout - The layout information for the text block.
48
+ * @param transform - The transform applied to the text layout.
49
+ * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.
50
+ * @beta
51
+ */
52
+ export declare function computeLeaderAttachmentPoint(leader: TextAnnotationLeader, frameCurve: Loop | Path, textLayout: TextBlockLayout, transform: Transform): Point3d | undefined;
53
+ //# sourceMappingURL=LeaderGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeaderGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/LeaderGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAA2C,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAwDrN;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA4BlI;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,EAC5B,UAAU,EAAE,IAAI,GAAG,IAAI,EACvB,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,SAAS,GACnB,OAAO,GAAG,SAAS,CAyCrB"}
@@ -0,0 +1,170 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module ElementGeometry
7
+ */
8
+ import { ColorDef } from "@itwin/core-common";
9
+ import { CurveCurve, LineSegment3d, LineString3d, Point3d, Vector3d } from "@itwin/core-geometry";
10
+ import { computeFrame } from "./FrameGeometry";
11
+ /**
12
+ * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.
13
+ *
14
+ * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points
15
+ * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader
16
+ * line and terminator geometry to the builder. It also applies color overrides if specified
17
+ * in the leader's style overrides.
18
+ *
19
+ * @param builder - The geometry builder to which the leader geometries will be appended.
20
+ * @param leaders - An array of leader properties.
21
+ * @param layout - The layout information for the text block, including its range.
22
+ * @param transform - The transform to apply to the frame and leader geometry.
23
+ * @param params - The geometry parameters, such as color, to use for the leader lines.
24
+ * @param frame - (Optional) The style properties for the text frame. If not provided or set to "none", a default rectangle is used.
25
+ * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.
26
+ * @beta
27
+ */
28
+ export function appendLeadersToBuilder(builder, leaders, layout, transform, params, frame) {
29
+ let result = true;
30
+ // If there is no frame, use a rectangular frame to compute the attachmentPoints for leaders.
31
+ if (frame === undefined || frame.shape === "none") {
32
+ frame = { shape: "rectangle" };
33
+ }
34
+ if (frame.shape === undefined || frame.shape === "none")
35
+ return false;
36
+ const frameCurve = computeFrame({ frame: frame.shape, range: layout.range, transform });
37
+ for (const leader of leaders) {
38
+ if (leader.styleOverrides?.leader?.color !== "subcategory" && leader.styleOverrides?.color !== "subcategory") {
39
+ const color = leader.styleOverrides?.leader?.color ?? leader.styleOverrides?.color;
40
+ params.lineColor = color ? ColorDef.fromJSON(color) : ColorDef.black;
41
+ result = result && builder.appendGeometryParamsChange(params);
42
+ }
43
+ const attachmentPoint = computeLeaderAttachmentPoint(leader, frameCurve, layout, transform);
44
+ if (!attachmentPoint)
45
+ return false;
46
+ // Leader line geometry
47
+ const leaderLinePoints = [];
48
+ leaderLinePoints.push(leader.startPoint);
49
+ leader.intermediatePoints?.forEach((point) => {
50
+ leaderLinePoints.push(point);
51
+ });
52
+ if (leader.styleOverrides?.leader?.wantElbow) {
53
+ const elbowLength = (leader.styleOverrides.leader.elbowLength ?? 1) * (leader.styleOverrides.lineHeight ?? 1);
54
+ const elbowDirection = computeElbowDirection(attachmentPoint, frameCurve, elbowLength);
55
+ if (elbowDirection)
56
+ leaderLinePoints.push(attachmentPoint.plusScaled(elbowDirection, elbowLength));
57
+ }
58
+ leaderLinePoints.push(attachmentPoint);
59
+ result = result && builder.appendGeometryQuery(LineString3d.create(leaderLinePoints));
60
+ // Terminator geometry
61
+ const terminatorDirection = Vector3d.createStartEnd(leaderLinePoints[0], leaderLinePoints[1]).normalize();
62
+ const termY = terminatorDirection?.unitCrossProduct(Vector3d.unitZ());
63
+ if (!termY || !terminatorDirection)
64
+ continue; // Assuming leaders without terminators is a valid case.
65
+ const terminatorHeight = (leader.styleOverrides?.leader?.terminatorHeightFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);
66
+ const terminatorWidth = (leader.styleOverrides?.leader?.terminatorWidthFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);
67
+ const basePoint = leader.startPoint.plusScaled(terminatorDirection, terminatorWidth);
68
+ const termPointA = basePoint.plusScaled(termY, terminatorHeight);
69
+ const termPointB = basePoint.plusScaled(termY.negate(), terminatorHeight);
70
+ result = result && builder.appendGeometryQuery(LineString3d.create([termPointA, leader.startPoint, termPointB]));
71
+ }
72
+ return result;
73
+ }
74
+ /**
75
+ * Computes the direction vector for an "elbow" for leader based on the attachment point and a frame curve.
76
+ * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.
77
+ * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.
78
+ *
79
+ * @param attachmentPoint - The point where the leader attaches.
80
+ * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.
81
+ * @param elbowLength - The length of the elbow segment to be created.
82
+ * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.
83
+ * @beta
84
+ */
85
+ export function computeElbowDirection(attachmentPoint, frameCurve, elbowLength) {
86
+ let elbowDirection;
87
+ // Determine the direction based on the closest point's position relative to the frame
88
+ const isCloserToLeft = Math.abs(attachmentPoint.x - frameCurve.range().low.x) < Math.abs(attachmentPoint.x - frameCurve.range().high.x);
89
+ // Decide the direction: left (-X) or right (+X)
90
+ elbowDirection = isCloserToLeft ? Vector3d.unitX().negate() : Vector3d.unitX();
91
+ // Verify if the elbow is a tangent to the frame, if yes, do not create an elbow
92
+ const elbowPoint = attachmentPoint.plusScaled(elbowDirection, elbowLength);
93
+ const elbowLine = LineSegment3d.create(attachmentPoint, elbowPoint);
94
+ // Find intersection points between the elbow and the frame
95
+ const intersections = CurveCurve.intersectionXYZPairs(elbowLine, false, frameCurve, false);
96
+ // As the elbow will intersect the frame only at one point, we can safely use the first intersection
97
+ const intersection = intersections[0];
98
+ const curveFraction = intersection.detailB.fraction;
99
+ const derivative = intersection.detailB.curve?.fractionToPointAndDerivative(curveFraction);
100
+ const tangent = derivative?.direction.normalize();
101
+ const lineDirection = Vector3d.createStartEnd(elbowLine.point0Ref, elbowLine.point1Ref).normalize();
102
+ if (tangent && lineDirection) {
103
+ const dot = tangent.dotProduct(lineDirection);
104
+ // If the tangent and line direction are aligned (dot product close to 1 or -1), it's tangent
105
+ if (Math.abs(dot) > 0.999) {
106
+ elbowDirection = undefined;
107
+ }
108
+ }
109
+ return elbowDirection;
110
+ }
111
+ /**
112
+ * Computes the attachment point for a leader line on a text annotation frame.
113
+ *
114
+ * The attachment point is determined based on the leader's attachment mode:
115
+ * - `"Nearest"`: Finds the closest point on the frame curve to the leader's start point.
116
+ * - `"KeyPoint"`: Uses a specific curve segment and fraction along that segment to determine the point.
117
+ * - `"TextPoint"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.
118
+ *
119
+ * @param leader - The leader props.
120
+ * @param frameCurve - The curve (Loop or Path) representing the annotation frame.
121
+ * @param textLayout - The layout information for the text block.
122
+ * @param transform - The transform applied to the text layout.
123
+ * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.
124
+ * @beta
125
+ */
126
+ export function computeLeaderAttachmentPoint(leader, frameCurve, textLayout, transform) {
127
+ let attachmentPoint;
128
+ if (leader.attachment.mode === "Nearest") {
129
+ attachmentPoint = frameCurve.closestPoint(leader.startPoint)?.point;
130
+ }
131
+ else if (leader.attachment.mode === "KeyPoint") {
132
+ const curves = frameCurve.collectCurvePrimitives(undefined, false, true);
133
+ const curveIndex = leader.attachment.curveIndex;
134
+ const fraction = leader.attachment.fraction;
135
+ if (curveIndex >= curves.length) {
136
+ // If the curveIndex is invalid, use the last curve
137
+ // This is a fallback to avoid out-of-bounds access
138
+ attachmentPoint = curves[curves.length - 1].fractionToPoint(fraction);
139
+ }
140
+ else {
141
+ attachmentPoint = curves[curveIndex].fractionToPoint(fraction);
142
+ }
143
+ }
144
+ else { // attachment.mode="TextPoint"
145
+ let scaleDirection = transform.matrix.getColumn(0).negate(); // direction to draw a scaled line from text attachment point to find intersection point on frame
146
+ let lineIndex;
147
+ if (leader.attachment.position.includes("Top")) {
148
+ lineIndex = 0;
149
+ }
150
+ else {
151
+ lineIndex = textLayout.lines.length - 1;
152
+ }
153
+ const lineRange = textLayout.lines[lineIndex].range;
154
+ const lineOffset = textLayout.lines[lineIndex].offsetFromDocument;
155
+ const origin = transform.multiplyPoint3d(Point3d.fromJSON(lineOffset));
156
+ let attachmentPointOnText = origin.plusScaled(transform.matrix.getColumn(1), ((lineRange.yLength()) / 2));
157
+ if (leader.attachment.position.includes("Right")) {
158
+ attachmentPointOnText = attachmentPointOnText.plusScaled(transform.matrix.getColumn(0), lineRange.xLength());
159
+ scaleDirection = scaleDirection.negate();
160
+ }
161
+ // Find the nearest intersection point on the frame to get the correct attachment point
162
+ // Extend the direction vector to create a target point far along the direction
163
+ const targetPoint = attachmentPointOnText.plusScaled(scaleDirection, 1e6); // Scale the direction vector to a large value
164
+ const intersectionLine = LineSegment3d.create(attachmentPointOnText, targetPoint);
165
+ const closestPointDetail = CurveCurve.intersectionXYZPairs(intersectionLine, false, frameCurve, false);
166
+ attachmentPoint = closestPointDetail[0]?.detailA.point;
167
+ }
168
+ return attachmentPoint;
169
+ }
170
+ //# sourceMappingURL=LeaderGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeaderGeometry.js","sourceRoot":"","sources":["../../../src/annotations/LeaderGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAA8E,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAc,OAAO,EAAa,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzH,OA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BAAkB,CAAC;QAClE,MAAM,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QACvE,IAAI,qBAAqB,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAE1G,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACjD,qBAAqB,GAAG,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7G,cAAc,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3C,CAAC;QACD,uFAAuF;QACvF,+EAA+E;QAC/E,MAAM,WAAW,GAAG,qBAAqB,CAAC,UAAU,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,8CAA8C;QACzH,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;QAClF,MAAM,kBAAkB,GAAG,UAAU,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QACvG,eAAe,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC;IACzD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { ColorDef, ElementGeometry, GeometryParams, TextAnnotationLeader, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { CurveCurve, LineSegment3d, LineString3d, Loop, Path, Point3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { computeFrame } from \"./FrameGeometry\";\r\nimport { TextBlockLayout } from \"./TextBlockLayout\";\r\n\r\n/**\r\n * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.\r\n *\r\n * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points\r\n * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader\r\n * line and terminator geometry to the builder. It also applies color overrides if specified\r\n * in the leader's style overrides.\r\n *\r\n * @param builder - The geometry builder to which the leader geometries will be appended.\r\n * @param leaders - An array of leader properties.\r\n * @param layout - The layout information for the text block, including its range.\r\n * @param transform - The transform to apply to the frame and leader geometry.\r\n * @param params - The geometry parameters, such as color, to use for the leader lines.\r\n * @param frame - (Optional) The style properties for the text frame. If not provided or set to \"none\", a default rectangle is used.\r\n * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.\r\n * @beta\r\n */\r\nexport function appendLeadersToBuilder(builder: ElementGeometry.Builder, leaders: TextAnnotationLeader[], layout: TextBlockLayout, transform: Transform, params: GeometryParams, frame?: TextFrameStyleProps): boolean {\r\n let result = true;\r\n\r\n // If there is no frame, use a rectangular frame to compute the attachmentPoints for leaders.\r\n if (frame === undefined || frame.shape === \"none\") {\r\n frame = { shape: \"rectangle\" }\r\n }\r\n if (frame.shape === undefined || frame.shape === \"none\") return false;\r\n const frameCurve = computeFrame({ frame: frame.shape, range: layout.range, transform });\r\n\r\n for (const leader of leaders) {\r\n if (leader.styleOverrides?.leader?.color !== \"subcategory\" && leader.styleOverrides?.color !== \"subcategory\") {\r\n const color = leader.styleOverrides?.leader?.color ?? leader.styleOverrides?.color;\r\n params.lineColor = color ? ColorDef.fromJSON(color) : ColorDef.black;\r\n result = result && builder.appendGeometryParamsChange(params);\r\n }\r\n\r\n const attachmentPoint = computeLeaderAttachmentPoint(leader, frameCurve, layout, transform);\r\n if (!attachmentPoint) return false;\r\n\r\n // Leader line geometry\r\n const leaderLinePoints: Point3d[] = [];\r\n\r\n leaderLinePoints.push(leader.startPoint)\r\n\r\n leader.intermediatePoints?.forEach((point) => {\r\n leaderLinePoints.push(point);\r\n });\r\n\r\n if (leader.styleOverrides?.leader?.wantElbow) {\r\n const elbowLength = (leader.styleOverrides.leader.elbowLength ?? 1) * (leader.styleOverrides.lineHeight ?? 1)\r\n const elbowDirection = computeElbowDirection(attachmentPoint, frameCurve, elbowLength);\r\n if (elbowDirection)\r\n leaderLinePoints.push(attachmentPoint.plusScaled(elbowDirection, elbowLength))\r\n }\r\n\r\n leaderLinePoints.push(attachmentPoint)\r\n\r\n result = result && builder.appendGeometryQuery(LineString3d.create(leaderLinePoints));\r\n\r\n // Terminator geometry\r\n const terminatorDirection = Vector3d.createStartEnd(\r\n leaderLinePoints[0], leaderLinePoints[1]\r\n ).normalize();\r\n\r\n const termY = terminatorDirection?.unitCrossProduct(Vector3d.unitZ());\r\n if (!termY || !terminatorDirection) continue; // Assuming leaders without terminators is a valid case.\r\n const terminatorHeight = (leader.styleOverrides?.leader?.terminatorHeightFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);\r\n const terminatorWidth = (leader.styleOverrides?.leader?.terminatorWidthFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);\r\n const basePoint = leader.startPoint.plusScaled(terminatorDirection, terminatorWidth);\r\n const termPointA = basePoint.plusScaled(termY, terminatorHeight);\r\n const termPointB = basePoint.plusScaled(termY.negate(), terminatorHeight);\r\n result = result && builder.appendGeometryQuery(LineString3d.create([termPointA, leader.startPoint, termPointB]));\r\n\r\n }\r\n return result;\r\n}\r\n\r\n\r\n/**\r\n * Computes the direction vector for an \"elbow\" for leader based on the attachment point and a frame curve.\r\n * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.\r\n * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.\r\n *\r\n * @param attachmentPoint - The point where the leader attaches.\r\n * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.\r\n * @param elbowLength - The length of the elbow segment to be created.\r\n * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.\r\n * @beta\r\n */\r\nexport function computeElbowDirection(attachmentPoint: Point3d, frameCurve: Loop | Path, elbowLength: number): Vector3d | undefined {\r\n\r\n let elbowDirection: Vector3d | undefined;\r\n // Determine the direction based on the closest point's position relative to the frame\r\n const isCloserToLeft = Math.abs(attachmentPoint.x - frameCurve.range().low.x) < Math.abs(attachmentPoint.x - frameCurve.range().high.x);\r\n\r\n // Decide the direction: left (-X) or right (+X)\r\n elbowDirection = isCloserToLeft ? Vector3d.unitX().negate() : Vector3d.unitX();\r\n\r\n // Verify if the elbow is a tangent to the frame, if yes, do not create an elbow\r\n const elbowPoint = attachmentPoint.plusScaled(elbowDirection, elbowLength);\r\n const elbowLine = LineSegment3d.create(attachmentPoint, elbowPoint);\r\n // Find intersection points between the elbow and the frame\r\n const intersections = CurveCurve.intersectionXYZPairs(elbowLine, false, frameCurve, false);\r\n // As the elbow will intersect the frame only at one point, we can safely use the first intersection\r\n const intersection = intersections[0];\r\n const curveFraction = intersection.detailB.fraction;\r\n const derivative = intersection.detailB.curve?.fractionToPointAndDerivative(curveFraction);\r\n const tangent = derivative?.direction.normalize();\r\n const lineDirection = Vector3d.createStartEnd(elbowLine.point0Ref, elbowLine.point1Ref).normalize();\r\n if (tangent && lineDirection) {\r\n const dot = tangent.dotProduct(lineDirection);\r\n // If the tangent and line direction are aligned (dot product close to 1 or -1), it's tangent\r\n if (Math.abs(dot) > 0.999) {\r\n elbowDirection = undefined;\r\n }\r\n }\r\n return elbowDirection;\r\n}\r\n\r\n/**\r\n * Computes the attachment point for a leader line on a text annotation frame.\r\n *\r\n * The attachment point is determined based on the leader's attachment mode:\r\n * - `\"Nearest\"`: Finds the closest point on the frame curve to the leader's start point.\r\n * - `\"KeyPoint\"`: Uses a specific curve segment and fraction along that segment to determine the point.\r\n * - `\"TextPoint\"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.\r\n *\r\n * @param leader - The leader props.\r\n * @param frameCurve - The curve (Loop or Path) representing the annotation frame.\r\n * @param textLayout - The layout information for the text block.\r\n * @param transform - The transform applied to the text layout.\r\n * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.\r\n * @beta\r\n */\r\nexport function computeLeaderAttachmentPoint(\r\n leader: TextAnnotationLeader,\r\n frameCurve: Loop | Path,\r\n textLayout: TextBlockLayout,\r\n transform: Transform\r\n): Point3d | undefined {\r\n let attachmentPoint: Point3d | undefined;\r\n\r\n if (leader.attachment.mode === \"Nearest\") {\r\n attachmentPoint = frameCurve.closestPoint(leader.startPoint)?.point;\r\n } else if (leader.attachment.mode === \"KeyPoint\") {\r\n const curves = frameCurve.collectCurvePrimitives(undefined, false, true);\r\n const curveIndex = leader.attachment.curveIndex;\r\n const fraction = leader.attachment.fraction;\r\n if (curveIndex >= curves.length) {\r\n // If the curveIndex is invalid, use the last curve\r\n // This is a fallback to avoid out-of-bounds access\r\n attachmentPoint = curves[curves.length - 1].fractionToPoint(fraction);\r\n } else {\r\n attachmentPoint = curves[curveIndex].fractionToPoint(fraction);\r\n }\r\n } else { // attachment.mode=\"TextPoint\"\r\n let scaleDirection = transform.matrix.getColumn(0).negate(); // direction to draw a scaled line from text attachment point to find intersection point on frame\r\n let lineIndex: number;\r\n if (leader.attachment.position.includes(\"Top\")) {\r\n lineIndex = 0\r\n } else {\r\n lineIndex = textLayout.lines.length - 1\r\n }\r\n const lineRange = textLayout.lines[lineIndex].range;\r\n const lineOffset = textLayout.lines[lineIndex].offsetFromDocument;\r\n const origin = transform.multiplyPoint3d(Point3d.fromJSON(lineOffset));\r\n let attachmentPointOnText = origin.plusScaled(transform.matrix.getColumn(1), ((lineRange.yLength()) / 2));\r\n\r\n if (leader.attachment.position.includes(\"Right\")) {\r\n attachmentPointOnText = attachmentPointOnText.plusScaled(transform.matrix.getColumn(0), lineRange.xLength());\r\n scaleDirection = scaleDirection.negate();\r\n }\r\n // Find the nearest intersection point on the frame to get the correct attachment point\r\n // Extend the direction vector to create a target point far along the direction\r\n const targetPoint = attachmentPointOnText.plusScaled(scaleDirection, 1e6); // Scale the direction vector to a large value\r\n const intersectionLine = LineSegment3d.create(attachmentPointOnText, targetPoint);\r\n const closestPointDetail = CurveCurve.intersectionXYZPairs(intersectionLine, false, frameCurve, false);\r\n attachmentPoint = closestPointDetail[0]?.detailA.point;\r\n }\r\n return attachmentPoint;\r\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAgD,cAAc,EAAqE,MAAM,oBAAoB,CAAC;AAEtL,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,SAAS,+BAA+B,CAAC,MAAgB,EAAE,eAA+B,EAAE,eAAoC,EAAE,UAAsB,EAAE,YAAyB;IACjL,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC;IACrE,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;IAC9C,4BAA4B,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;IAE9E,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,mBAA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CAAC;IAC7C,CAAC;IAEe,MAAM;QACpB,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,CAAC,4BAA4B,GAAG,+BAA+B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjJ,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;QAC5C,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,UAA0B;QAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { ElementGeometry, ElementGeometryBuilderParams, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\nimport { AnnotationElement2d, GraphicalElement3d } from \"../Element\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { layoutTextBlock } from \"./TextBlockLayout\";\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\n\nfunction getElementGeometryBuilderParams(iModel: IModelDb, _placementProps: PlacementProps, annotationProps: TextAnnotationProps, categoryId: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\n const layout = layoutTextBlock({ iModel, textBlock });\n const builder = new ElementGeometry.Builder();\n appendTextAnnotationGeometry({ layout, annotationProps, builder, categoryId })\n\n return { entryArray: builder.entries };\n}\n\n/** An element that displays textual content within a 2d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation2d extends AnnotationElement2d {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation2d\"; }\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) { super(props, iModel); }\n\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\n return new TextAnnotation2d(props, iModel);\n }\n\n public override toJSON(): TextAnnotation2dProps {\n const props = super.toJSON();\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\n\n return props;\n }\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const json = this.jsonProperties.annotation;\n return json ? TextAnnotation.fromJSON(json) : undefined;\n }\n\n /** Change the textual content, updating the element's geometry and placement accordingly.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this.jsonProperties.annotation = annotation.toJSON();\n }\n}\n\n/** An element that displays textual content within a 3d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation3d extends GraphicalElement3d {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation3d\"; }\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) { super(props, iModel); }\n\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\n return new TextAnnotation3d(props, iModel);\n }\n\n public override toJSON(): TextAnnotation3dProps {\n const props = super.toJSON();\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\n\n return props;\n }\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const json = this.jsonProperties.annotation;\n return json ? TextAnnotation.fromJSON(json) : undefined;\n }\n\n /** Change the textual content, updating the element's geometry and placement accordingly.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this.jsonProperties.annotation = annotation.toJSON();\n }\n}\n"]}
1
+ {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAgD,cAAc,EAAqE,MAAM,oBAAoB,CAAC;AAEtL,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,SAAS,+BAA+B,CAAC,MAAgB,EAAE,eAA+B,EAAE,eAAoC,EAAE,UAAsB,EAAE,YAAyB;IACjL,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC;IACrE,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;IAC9C,4BAA4B,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;IAE9E,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAiB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,MAAM,CAAC,CAAC;IAC7C,CAAC;IAEe,MAAM;QACpB,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,CAAC,4BAA4B,GAAG,+BAA+B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjJ,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;QAC5C,OAAO,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,UAA0B;QAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { ElementGeometry, ElementGeometryBuilderParams, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { AnnotationElement2d, GraphicalElement3d } from \"../Element\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { layoutTextBlock } from \"./TextBlockLayout\";\r\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\r\n\r\nfunction getElementGeometryBuilderParams(iModel: IModelDb, _placementProps: PlacementProps, annotationProps: TextAnnotationProps, categoryId: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\r\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\r\n const layout = layoutTextBlock({ iModel, textBlock });\r\n const builder = new ElementGeometry.Builder();\r\n appendTextAnnotationGeometry({ layout, annotationProps, builder, categoryId })\r\n\r\n return { entryArray: builder.entries };\r\n}\r\n\r\n/** An element that displays textual content within a 2d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation2d extends AnnotationElement2d {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation2d\"; }\r\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\r\n return new TextAnnotation2d(props, iModel);\r\n }\r\n\r\n public override toJSON(): TextAnnotation2dProps {\r\n const props = super.toJSON();\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\r\n\r\n return props;\r\n }\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n const json = this.jsonProperties.annotation;\r\n return json ? TextAnnotation.fromJSON(json) : undefined;\r\n }\r\n\r\n /** Change the textual content, updating the element's geometry and placement accordingly.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this.jsonProperties.annotation = annotation.toJSON();\r\n }\r\n}\r\n\r\n/** An element that displays textual content within a 3d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation3d extends GraphicalElement3d {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation3d\"; }\r\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\r\n return new TextAnnotation3d(props, iModel);\r\n }\r\n\r\n public override toJSON(): TextAnnotation3dProps {\r\n const props = super.toJSON();\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\r\n\r\n return props;\r\n }\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n const json = this.jsonProperties.annotation;\r\n return json ? TextAnnotation.fromJSON(json) : undefined;\r\n }\r\n\r\n /** Change the textual content, updating the element's geometry and placement accordingly.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this.jsonProperties.annotation = annotation.toJSON();\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAuB,MAAM,oBAAoB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC;IACjC,4FAA4F;IAC5F,UAAU,EAAE,UAAU,CAAA;IACtB,yGAAyG;IACzG,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAwB7F"}
1
+ {"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAuB,MAAM,oBAAoB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC;IACjC,4FAA4F;IAC5F,UAAU,EAAE,UAAU,CAAA;IACtB,yGAAyG;IACzG,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CA6B7F"}
@@ -10,6 +10,7 @@ import { LineString3d, PointString3d, Range2d, Transform } from "@itwin/core-geo
10
10
  import { Id64 } from "@itwin/core-bentley";
11
11
  import { produceTextBlockGeometry } from "./TextBlockGeometry";
12
12
  import { appendFrameToBuilder, computeIntervalPoints } from "./FrameGeometry";
13
+ import { appendLeadersToBuilder } from "./LeaderGeometry";
13
14
  /** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.
14
15
  * @returns true if the geometry was successfully appended.
15
16
  * @beta
@@ -27,6 +28,10 @@ export function appendTextAnnotationGeometry(props) {
27
28
  if (annotation.frame && annotation.frame.shape !== "none") {
28
29
  result = result && appendFrameToBuilder(props.builder, annotation.frame, range, transform, params);
29
30
  }
31
+ // Construct the leader geometry
32
+ if (annotation.leaders && annotation.leaders.length > 0) {
33
+ result = result && appendLeadersToBuilder(props.builder, annotation.leaders, props.layout, transform, params, annotation.frame);
34
+ }
30
35
  // Construct the debug geometry
31
36
  if (props.wantDebugGeometry) {
32
37
  result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAmB,WAAW,EAAE,cAAc,EAAE,cAAc,EAA4C,MAAM,oBAAoB,CAAC;AAEtJ,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAsB9E;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAuC;IAClF,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClE,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,kCAAkC;IAClC,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,OAAO,G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AAC;YAED,8CAA8C;YAC9C,MAAM,QAAQ,GAAG,SAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/F,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAEzD,uCAAuC;YACvC,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7C,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;YACjD,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotation, TextAnnotationProps, TextFrameStyleProps } from \"@itwin/core-common\";\nimport { TextBlockLayout } from \"./TextBlockLayout\";\nimport { LineString3d, PointString3d, Range2d, Transform } from \"@itwin/core-geometry\";\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { produceTextBlockGeometry } from \"./TextBlockGeometry\";\nimport { appendFrameToBuilder, computeIntervalPoints } from \"./FrameGeometry\";\n\n/**\n * Properties required to compute the geometry of a text annotation.\n * @beta\n * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].\n */\nexport interface AppendTextAnnotationGeometryArgs {\n /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */\n annotationProps: TextAnnotationProps;\n /** Layout provided by calling [[layoutTextBlock]] */\n layout: TextBlockLayout;\n /** Builder that will be added to in place */\n builder: ElementGeometry.Builder;\n /** The category the element will belong to. This will passed into the [[GeometryParams]] */\n categoryId: Id64String\n /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */\n subCategoryId?: Id64String\n /** Whether or not to draw geometry for things like the snap points, range, and anchor point */\n wantDebugGeometry?: boolean;\n}\n\n/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.\n * @returns true if the geometry was successfully appended.\n * @beta\n */\nexport function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean {\n const annotation = TextAnnotation.fromJSON(props.annotationProps);\n const range = Range2d.fromJSON(props.layout.range);\n const transform = annotation.computeTransform(range);\n let result = true;\n\n // Construct the TextBlockGeometry\n const params = new GeometryParams(props.categoryId, props.subCategoryId);\n const entries = produceTextBlockGeometry(props.layout, annotation.computeTransform(props.layout.range));\n result = result && props.builder.appendTextBlock(entries, params);\n\n // Construct the frame geometry\n if (annotation.frame && annotation.frame.shape !== \"none\") {\n result = result && appendFrameToBuilder(props.builder, annotation.frame, range, transform, params);\n }\n\n // Construct the debug geometry\n if (props.wantDebugGeometry) {\n result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));\n result = result && debugRunLayout(props.builder, props.layout, annotation.computeTransform(props.layout.range));\n if (annotation.frame) result = result && debugSnapPoints(props.builder, annotation.frame, props.layout.range, annotation.computeTransform(props.layout.range));\n }\n\n return result;\n};\n\n/**\n * Draws the anchor point and margins of the text annotation.\n * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).\n * The margins are drawn as a blue box.\n * The text range is drawn as a red box.\n */\nfunction debugAnchorPoint(builder: ElementGeometry.Builder, annotation: TextAnnotation, layout: TextBlockLayout, transform: Transform): boolean {\n const range = Range2d.fromJSON(layout.range);\n const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));\n\n // Make it blue\n const blueLineParams = new GeometryParams(Id64.invalid);\n blueLineParams.lineColor = ColorDef.blue;\n let result = builder.appendGeometryParamsChange(blueLineParams);\n\n // Draw a blue box to show the element's margin\n const marginCorners = range.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(marginCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));\n\n // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));\n\n // Draw a red box to show the text range\n const redLineParams = new GeometryParams(Id64.invalid);\n redLineParams.lineColor = ColorDef.red;\n result = result && builder.appendGeometryParamsChange(redLineParams);\n\n const rangeCorners = layout.textRange.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(rangeCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));\n\n return result;\n}\n\n/** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */\nfunction debugSnapPoints(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform): boolean {\n if (undefined === frame.shape || frame.shape === \"none\")\n return false;\n const points = computeIntervalPoints({ frame: frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });\n\n const params = new GeometryParams(Id64.invalid);\n params.lineColor = ColorDef.black;\n params.weight = (frame.borderWeight ?? 1) * 5; // We want the dots to be bigger than the frame so we can see them.\n params.fillDisplay = FillDisplay.Always;\n\n const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));\n return result;\n}\n\n/**\n * Draws debug geometry for each line and run in a TextBlockLayout.\n *\n * For each line and run, this function draws boxes to visualize their layout and boundaries.\n * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.\n * This is useful for debugging text layout and alignment issues.\n *\n * @param builder - The geometry builder to append debug geometry to.\n * @param layout - The text block layout containing lines and runs to visualize.\n * @param documentTransform - The transform to apply to the entire document.\n * @returns True if all debug geometry was successfully appended.\n */\nfunction debugRunLayout(builder: ElementGeometry.Builder, layout: TextBlockLayout, documentTransform: Transform): boolean {\n let result = true; // Tracks if all geometry was appended successfully\n let color = ColorDef.black; // Current color for the run type\n let lastColor = color; // Last color used, to minimize param changes\n\n // Map run types to debug colors\n const colors = {\n \"text\": ColorDef.fromString(\"orange\"),\n \"linebreak\": ColorDef.fromString(\"yellow\"),\n \"fraction\": ColorDef.fromString(\"green\"),\n \"tab\": ColorDef.fromString(\"aquamarine\"),\n }\n\n layout.lines.forEach(line => {\n // Apply the line's offset transform\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n documentTransform.multiplyTransformTransform(lineTrans, lineTrans);\n\n line.runs.forEach(run => {\n // Determine color for this run type\n color = colors[run.source.type] ?? ColorDef.black;\n\n // Only change geometry params if the color changes\n if (!lastColor.equals(color)) {\n const colorParams = new GeometryParams(Id64.invalid);\n colorParams.lineColor = color;\n result = result && builder.appendGeometryParamsChange(colorParams);\n lastColor = color;\n }\n\n // Apply the line's offset to the run's offset\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\n\n // Draw the enclosing range for the run\n const runCorners = run.range.corners3d(true);\n runTrans.multiplyPoint3dArrayInPlace(runCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));\n });\n });\n\n return result;\n}"]}
1
+ {"version":3,"file":"TextAnnotationGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAmB,WAAW,EAAE,cAAc,EAAE,cAAc,EAA4C,MAAM,oBAAoB,CAAC;AAEtJ,OAAO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AA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAEzD,uCAAuC;YACvC,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7C,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;YACjD,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotation, TextAnnotationProps, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { TextBlockLayout } from \"./TextBlockLayout\";\r\nimport { LineString3d, PointString3d, Range2d, Transform } from \"@itwin/core-geometry\";\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { produceTextBlockGeometry } from \"./TextBlockGeometry\";\r\nimport { appendFrameToBuilder, computeIntervalPoints } from \"./FrameGeometry\";\r\nimport { appendLeadersToBuilder } from \"./LeaderGeometry\";\r\n\r\n/**\r\n * Properties required to compute the geometry of a text annotation.\r\n * @beta\r\n * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].\r\n */\r\nexport interface AppendTextAnnotationGeometryArgs {\r\n /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */\r\n annotationProps: TextAnnotationProps;\r\n /** Layout provided by calling [[layoutTextBlock]] */\r\n layout: TextBlockLayout;\r\n /** Builder that will be added to in place */\r\n builder: ElementGeometry.Builder;\r\n /** The category the element will belong to. This will passed into the [[GeometryParams]] */\r\n categoryId: Id64String\r\n /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */\r\n subCategoryId?: Id64String\r\n /** Whether or not to draw geometry for things like the snap points, range, and anchor point */\r\n wantDebugGeometry?: boolean;\r\n}\r\n\r\n/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.\r\n * @returns true if the geometry was successfully appended.\r\n * @beta\r\n */\r\nexport function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean {\r\n const annotation = TextAnnotation.fromJSON(props.annotationProps);\r\n const range = Range2d.fromJSON(props.layout.range);\r\n const transform = annotation.computeTransform(range);\r\n let result = true;\r\n\r\n // Construct the TextBlockGeometry\r\n const params = new GeometryParams(props.categoryId, props.subCategoryId);\r\n const entries = produceTextBlockGeometry(props.layout, annotation.computeTransform(props.layout.range));\r\n result = result && props.builder.appendTextBlock(entries, params);\r\n\r\n // Construct the frame geometry\r\n if (annotation.frame && annotation.frame.shape !== \"none\") {\r\n result = result && appendFrameToBuilder(props.builder, annotation.frame, range, transform, params);\r\n }\r\n\r\n // Construct the leader geometry\r\n if (annotation.leaders && annotation.leaders.length > 0) {\r\n result = result && appendLeadersToBuilder(props.builder, annotation.leaders, props.layout, transform, params, annotation.frame);\r\n }\r\n\r\n // Construct the debug geometry\r\n if (props.wantDebugGeometry) {\r\n result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));\r\n result = result && debugRunLayout(props.builder, props.layout, annotation.computeTransform(props.layout.range));\r\n if (annotation.frame) result = result && debugSnapPoints(props.builder, annotation.frame, props.layout.range, annotation.computeTransform(props.layout.range));\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/**\r\n * Draws the anchor point and margins of the text annotation.\r\n * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).\r\n * The margins are drawn as a blue box.\r\n * The text range is drawn as a red box.\r\n */\r\nfunction debugAnchorPoint(builder: ElementGeometry.Builder, annotation: TextAnnotation, layout: TextBlockLayout, transform: Transform): boolean {\r\n const range = Range2d.fromJSON(layout.range);\r\n const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));\r\n\r\n // Make it blue\r\n const blueLineParams = new GeometryParams(Id64.invalid);\r\n blueLineParams.lineColor = ColorDef.blue;\r\n let result = builder.appendGeometryParamsChange(blueLineParams);\r\n\r\n // Draw a blue box to show the element's margin\r\n const marginCorners = range.corners3d(true);\r\n transform.multiplyPoint3dArrayInPlace(marginCorners);\r\n result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));\r\n\r\n // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.\r\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));\r\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));\r\n\r\n // Draw a red box to show the text range\r\n const redLineParams = new GeometryParams(Id64.invalid);\r\n redLineParams.lineColor = ColorDef.red;\r\n result = result && builder.appendGeometryParamsChange(redLineParams);\r\n\r\n const rangeCorners = layout.textRange.corners3d(true);\r\n transform.multiplyPoint3dArrayInPlace(rangeCorners);\r\n result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));\r\n\r\n return result;\r\n}\r\n\r\n/** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */\r\nfunction debugSnapPoints(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform): boolean {\r\n if (undefined === frame.shape || frame.shape === \"none\")\r\n return false;\r\n const points = computeIntervalPoints({ frame: frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });\r\n\r\n const params = new GeometryParams(Id64.invalid);\r\n params.lineColor = ColorDef.black;\r\n params.weight = (frame.borderWeight ?? 1) * 5; // We want the dots to be bigger than the frame so we can see them.\r\n params.fillDisplay = FillDisplay.Always;\r\n\r\n const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));\r\n return result;\r\n}\r\n\r\n/**\r\n * Draws debug geometry for each line and run in a TextBlockLayout.\r\n *\r\n * For each line and run, this function draws boxes to visualize their layout and boundaries.\r\n * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.\r\n * This is useful for debugging text layout and alignment issues.\r\n *\r\n * @param builder - The geometry builder to append debug geometry to.\r\n * @param layout - The text block layout containing lines and runs to visualize.\r\n * @param documentTransform - The transform to apply to the entire document.\r\n * @returns True if all debug geometry was successfully appended.\r\n */\r\nfunction debugRunLayout(builder: ElementGeometry.Builder, layout: TextBlockLayout, documentTransform: Transform): boolean {\r\n let result = true; // Tracks if all geometry was appended successfully\r\n let color = ColorDef.black; // Current color for the run type\r\n let lastColor = color; // Last color used, to minimize param changes\r\n\r\n // Map run types to debug colors\r\n const colors = {\r\n \"text\": ColorDef.fromString(\"orange\"),\r\n \"linebreak\": ColorDef.fromString(\"yellow\"),\r\n \"fraction\": ColorDef.fromString(\"green\"),\r\n \"tab\": ColorDef.fromString(\"aquamarine\"),\r\n }\r\n\r\n layout.lines.forEach(line => {\r\n // Apply the line's offset transform\r\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\r\n documentTransform.multiplyTransformTransform(lineTrans, lineTrans);\r\n\r\n line.runs.forEach(run => {\r\n // Determine color for this run type\r\n color = colors[run.source.type] ?? ColorDef.black;\r\n\r\n // Only change geometry params if the color changes\r\n if (!lastColor.equals(color)) {\r\n const colorParams = new GeometryParams(Id64.invalid);\r\n colorParams.lineColor = color;\r\n result = result && builder.appendGeometryParamsChange(colorParams);\r\n lastColor = color;\r\n }\r\n\r\n // Apply the line's offset to the run's offset\r\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\r\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\r\n\r\n // Draw the enclosing range for the run\r\n const runCorners = run.range.corners3d(true);\r\n runTrans.multiplyPoint3dArrayInPlace(runCorners);\r\n result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));\r\n });\r\n });\r\n\r\n return result;\r\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextBlockGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAuD,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAErH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO7C,SAAS,QAAQ,CAAC,KAAqB,EAAE,OAAwB;IAC/D,IAAI,KAAK,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;QACzB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,GAAc,EAAE,MAAgB;IACtE,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;IAE9E,OAAO,IAAI,UAAU,CAAC;QACpB,IAAI;QACJ,IAAI,EAAE,GAAG,CAAC,MAAM;QAChB,MAAM,EAAE,UAAU;QAClB,WAAW;QACX,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,YAAY;QACvB,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,GAAc,EAAE,SAA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,CAAC,CAAC,CAAC;YAC/F,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACzD,iBAAiB,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC/B,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { TextBlockGeometryProps, TextBlockGeometryPropsEntry, TextString, TextStyleColor } from \"@itwin/core-common\";\nimport { RunLayout, TextBlockLayout } from \"./TextBlockLayout\";\nimport { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\nimport { assert } from \"@itwin/core-bentley\";\n\ninterface GeometryContext {\n curColor?: TextStyleColor;\n entries: TextBlockGeometryPropsEntry[];\n}\n\nfunction setColor(color: TextStyleColor, context: GeometryContext): void {\n if (color !== context.curColor) {\n context.curColor = color;\n context.entries.push({ color });\n }\n}\n\nfunction createTextString(text: string, run: RunLayout, origin?: Point3d): TextString {\n assert(text.length > 0);\n\n const { lineHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;\n\n return new TextString({\n text,\n font: run.fontId,\n height: lineHeight,\n widthFactor,\n bold: isBold,\n italic: isItalic,\n underline: isUnderlined,\n origin,\n });\n}\n\nfunction processTextRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n assert(run.source.type === \"text\");\n const text = run.source.content.substring(run.charOffset, run.charOffset + run.numChars);\n if (text.length === 0) {\n return;\n }\n\n const ts = createTextString(text, run);\n if (\"none\" !== run.source.baselineShift) {\n const isSub = \"subscript\" === run.source.baselineShift;\n const offsetFactor = run.style[isSub ? \"subScriptOffsetFactor\" : \"superScriptOffsetFactor\"];\n const scale = run.style[isSub ? \"subScriptScale\" : \"superScriptScale\"];\n\n ts.origin.y += offsetFactor * ts.height;\n ts.height *= scale;\n }\n\n ts.transformInPlace(transform);\n\n setColor(run.style.color, context);\n context.entries.push({ text: ts });\n}\n\nfunction createFractionTextString(text: string, run: RunLayout, origin: Point3d, transform: Transform): TextString {\n const ts = createTextString(text, run, origin);\n assert(undefined !== ts.widthFactor);\n\n ts.height *= run.style.stackedFractionScale;\n\n ts.transformInPlace(transform);\n\n return ts;\n}\n\nfunction processFractionRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n const source = run.source;\n assert(source.type === \"fraction\");\n\n if (source.numerator.length === 0 && source.denominator.length === 0) {\n return;\n }\n\n assert(undefined !== run.numeratorRange && undefined !== run.denominatorRange);\n\n const fontSize = new Vector2d(run.style.lineHeight * run.style.widthFactor, run.style.lineHeight);\n fontSize.scale(run.style.stackedFractionScale, fontSize);\n\n const numeratorOffset = new Point3d(run.numeratorRange.low.x, run.numeratorRange.low.y, 0);\n const denominatorOffset = new Point3d(run.denominatorRange.low.x, run.denominatorRange.low.y, 0);\n\n setColor(run.style.color, context);\n\n if (source.numerator.length > 0) {\n context.entries.push({ text: createFractionTextString(source.numerator, run, numeratorOffset, transform) });\n }\n\n const numeratorRange = Range2d.fromJSON(run.numeratorRange);\n const denominatorRange = Range2d.fromJSON(run.denominatorRange);\n\n let separator: LineSegment3d;\n if (run.style.stackedFractionType === \"horizontal\") {\n const fractionWidth = Math.max(numeratorRange.xLength(), denominatorRange.xLength());\n const y = 1.25 * denominatorRange.yLength();\n separator = LineSegment3d.createXYXY(0, y, fractionWidth, y);\n } else {\n const p0 = new Point3d(denominatorRange.low.x - fontSize.x / 2, denominatorRange.low.y + fontSize.y * (1 / 3), 0);\n const p1 = new Point3d(p0.x + fontSize.x, p0.y + fontSize.y * 1.5, 0);\n separator = LineSegment3d.createCapture(p0, p1);\n }\n\n separator.tryTransformInPlace(transform);\n\n context.entries.push({\n separator: {\n startPoint: separator.point0Ref.toJSON(),\n endPoint: separator.point1Ref.toJSON(),\n },\n });\n\n if (source.denominator.length > 0) {\n context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });\n }\n}\n\n/**\n * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].\n * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.\n * @param layout of the text block as computed by [[layoutTextBlock]].\n * @param documentTransform that positions the text block in world coordinates.\n * @returns TextBlockGeometryProps.\n * @beta\n */\nexport function produceTextBlockGeometry(layout: TextBlockLayout, documentTransform: Transform): TextBlockGeometryProps {\n const context: GeometryContext = { entries: [] };\n for (const line of layout.lines) {\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n for (const run of line.runs) {\n // Skip runs that are solely whitespace\n if (run.source.isWhitespace) {\n continue;\n }\n\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\n documentTransform.multiplyTransformTransform(runTrans, runTrans);\n if (\"text\" === run.source.type) {\n processTextRun(run, runTrans, context);\n } else {\n processFractionRun(run, runTrans, context);\n }\n }\n }\n\n return { entries: context.entries };\n}\n"]}
1
+ {"version":3,"file":"TextBlockGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockGeometry.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAuD,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAErH,OAAO,E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,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { TextBlockGeometryProps, TextBlockGeometryPropsEntry, TextString, TextStyleColor } from \"@itwin/core-common\";\r\nimport { RunLayout, TextBlockLayout } from \"./TextBlockLayout\";\r\nimport { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\n\r\ninterface GeometryContext {\r\n curColor?: TextStyleColor;\r\n entries: TextBlockGeometryPropsEntry[];\r\n}\r\n\r\nfunction setColor(color: TextStyleColor, context: GeometryContext): void {\r\n if (color !== context.curColor) {\r\n context.curColor = color;\r\n context.entries.push({ color });\r\n }\r\n}\r\n\r\nfunction createTextString(text: string, run: RunLayout, origin?: Point3d): TextString {\r\n assert(text.length > 0);\r\n\r\n const { lineHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;\r\n\r\n return new TextString({\r\n text,\r\n font: run.fontId,\r\n height: lineHeight,\r\n widthFactor,\r\n bold: isBold,\r\n italic: isItalic,\r\n underline: isUnderlined,\r\n origin,\r\n });\r\n}\r\n\r\nfunction processTextRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\r\n assert(run.source.type === \"text\");\r\n const text = run.source.content.substring(run.charOffset, run.charOffset + run.numChars);\r\n if (text.length === 0) {\r\n return;\r\n }\r\n\r\n const ts = createTextString(text, run);\r\n if (\"none\" !== run.source.baselineShift) {\r\n const isSub = \"subscript\" === run.source.baselineShift;\r\n const offsetFactor = run.style[isSub ? \"subScriptOffsetFactor\" : \"superScriptOffsetFactor\"];\r\n const scale = run.style[isSub ? \"subScriptScale\" : \"superScriptScale\"];\r\n\r\n ts.origin.y += offsetFactor * ts.height;\r\n ts.height *= scale;\r\n }\r\n\r\n ts.transformInPlace(transform);\r\n\r\n setColor(run.style.color, context);\r\n context.entries.push({ text: ts });\r\n}\r\n\r\nfunction createFractionTextString(text: string, run: RunLayout, origin: Point3d, transform: Transform): TextString {\r\n const ts = createTextString(text, run, origin);\r\n assert(undefined !== ts.widthFactor);\r\n\r\n ts.height *= run.style.stackedFractionScale;\r\n\r\n ts.transformInPlace(transform);\r\n\r\n return ts;\r\n}\r\n\r\nfunction processFractionRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\r\n const source = run.source;\r\n assert(source.type === \"fraction\");\r\n\r\n if (source.numerator.length === 0 && source.denominator.length === 0) {\r\n return;\r\n }\r\n\r\n assert(undefined !== run.numeratorRange && undefined !== run.denominatorRange);\r\n\r\n const fontSize = new Vector2d(run.style.lineHeight * run.style.widthFactor, run.style.lineHeight);\r\n fontSize.scale(run.style.stackedFractionScale, fontSize);\r\n\r\n const numeratorOffset = new Point3d(run.numeratorRange.low.x, run.numeratorRange.low.y, 0);\r\n const denominatorOffset = new Point3d(run.denominatorRange.low.x, run.denominatorRange.low.y, 0);\r\n\r\n setColor(run.style.color, context);\r\n\r\n if (source.numerator.length > 0) {\r\n context.entries.push({ text: createFractionTextString(source.numerator, run, numeratorOffset, transform) });\r\n }\r\n\r\n const numeratorRange = Range2d.fromJSON(run.numeratorRange);\r\n const denominatorRange = Range2d.fromJSON(run.denominatorRange);\r\n\r\n let separator: LineSegment3d;\r\n if (run.style.stackedFractionType === \"horizontal\") {\r\n const fractionWidth = Math.max(numeratorRange.xLength(), denominatorRange.xLength());\r\n const y = 1.25 * denominatorRange.yLength();\r\n separator = LineSegment3d.createXYXY(0, y, fractionWidth, y);\r\n } else {\r\n const p0 = new Point3d(denominatorRange.low.x - fontSize.x / 2, denominatorRange.low.y + fontSize.y * (1 / 3), 0);\r\n const p1 = new Point3d(p0.x + fontSize.x, p0.y + fontSize.y * 1.5, 0);\r\n separator = LineSegment3d.createCapture(p0, p1);\r\n }\r\n\r\n separator.tryTransformInPlace(transform);\r\n\r\n context.entries.push({\r\n separator: {\r\n startPoint: separator.point0Ref.toJSON(),\r\n endPoint: separator.point1Ref.toJSON(),\r\n },\r\n });\r\n\r\n if (source.denominator.length > 0) {\r\n context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });\r\n }\r\n}\r\n\r\n/**\r\n * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].\r\n * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.\r\n * @param layout of the text block as computed by [[layoutTextBlock]].\r\n * @param documentTransform that positions the text block in world coordinates.\r\n * @returns TextBlockGeometryProps.\r\n * @beta\r\n */\r\nexport function produceTextBlockGeometry(layout: TextBlockLayout, documentTransform: Transform): TextBlockGeometryProps {\r\n const context: GeometryContext = { entries: [] };\r\n for (const line of layout.lines) {\r\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\r\n for (const run of line.runs) {\r\n // Skip runs that are solely whitespace\r\n if (run.source.isWhitespace) {\r\n continue;\r\n }\r\n\r\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\r\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\r\n documentTransform.multiplyTransformTransform(runTrans, runTrans);\r\n if (\"text\" === run.source.type) {\r\n processTextRun(run, runTrans, context);\r\n } else {\r\n processFractionRun(run, runTrans, context);\r\n }\r\n }\r\n }\r\n\r\n return { entries: context.entries };\r\n}\r\n"]}