@itwin/core-backend 5.1.0-dev.5 → 5.1.0-dev.51

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 (556) hide show
  1. package/CHANGELOG.md +122 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +1 -1
  3. package/lib/cjs/BackendHubAccess.js +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  6. package/lib/cjs/BisCoreSchema.js +1 -1
  7. package/lib/cjs/BisCoreSchema.js.map +1 -1
  8. package/lib/cjs/BlobContainerService.js.map +1 -1
  9. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  10. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  11. package/lib/cjs/BriefcaseManager.js +16 -0
  12. package/lib/cjs/BriefcaseManager.js.map +1 -1
  13. package/lib/cjs/CatalogDb.js.map +1 -1
  14. package/lib/cjs/Category.d.ts +4 -4
  15. package/lib/cjs/Category.js +4 -4
  16. package/lib/cjs/Category.js.map +1 -1
  17. package/lib/cjs/ChangeSummaryManager.js +2 -2
  18. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  19. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  20. package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
  21. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  22. package/lib/cjs/ChangesetECAdaptor.js +490 -275
  23. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  24. package/lib/cjs/ChannelControl.js.map +1 -1
  25. package/lib/cjs/CheckpointManager.js.map +1 -1
  26. package/lib/cjs/ClassRegistry.d.ts +1 -1
  27. package/lib/cjs/ClassRegistry.js +6 -6
  28. package/lib/cjs/ClassRegistry.js.map +1 -1
  29. package/lib/cjs/CloudSqlite.js +1 -1
  30. package/lib/cjs/CloudSqlite.js.map +1 -1
  31. package/lib/cjs/CodeService.js.map +1 -1
  32. package/lib/cjs/CodeSpecs.d.ts +1 -1
  33. package/lib/cjs/CodeSpecs.js +1 -1
  34. package/lib/cjs/CodeSpecs.js.map +1 -1
  35. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  36. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  37. package/lib/cjs/DevTools.js.map +1 -1
  38. package/lib/cjs/DisplayStyle.d.ts +4 -4
  39. package/lib/cjs/DisplayStyle.js +3 -3
  40. package/lib/cjs/DisplayStyle.js.map +1 -1
  41. package/lib/cjs/ECDb.d.ts +4 -4
  42. package/lib/cjs/ECDb.d.ts.map +1 -1
  43. package/lib/cjs/ECDb.js +4 -4
  44. package/lib/cjs/ECDb.js.map +1 -1
  45. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  46. package/lib/cjs/ECSqlStatement.d.ts +15 -6
  47. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  48. package/lib/cjs/ECSqlStatement.js +18 -4
  49. package/lib/cjs/ECSqlStatement.js.map +1 -1
  50. package/lib/cjs/Element.d.ts +51 -51
  51. package/lib/cjs/Element.js +52 -52
  52. package/lib/cjs/Element.js.map +1 -1
  53. package/lib/cjs/ElementAspect.d.ts +8 -8
  54. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  55. package/lib/cjs/ElementAspect.js +8 -8
  56. package/lib/cjs/ElementAspect.js.map +1 -1
  57. package/lib/cjs/ElementGraphics.js.map +1 -1
  58. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  59. package/lib/cjs/Entity.d.ts +3 -3
  60. package/lib/cjs/Entity.js +2 -2
  61. package/lib/cjs/Entity.js.map +1 -1
  62. package/lib/cjs/EntityReferences.js.map +1 -1
  63. package/lib/cjs/ExportGraphics.d.ts +54 -8
  64. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  65. package/lib/cjs/ExportGraphics.js +158 -59
  66. package/lib/cjs/ExportGraphics.js.map +1 -1
  67. package/lib/cjs/ExternalSource.js.map +1 -1
  68. package/lib/cjs/FontFile.js.map +1 -1
  69. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  70. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  71. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  72. package/lib/cjs/GeographicCRSServices.js +1 -1
  73. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  74. package/lib/cjs/GeometrySummary.js +47 -47
  75. package/lib/cjs/GeometrySummary.js.map +1 -1
  76. package/lib/cjs/IModelDb.d.ts +29 -23
  77. package/lib/cjs/IModelDb.d.ts.map +1 -1
  78. package/lib/cjs/IModelDb.js +102 -49
  79. package/lib/cjs/IModelDb.js.map +1 -1
  80. package/lib/cjs/IModelDbFonts.js.map +1 -1
  81. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  82. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  83. package/lib/cjs/IModelElementCloneContext.js +1 -1
  84. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  85. package/lib/cjs/IModelHost.d.ts +2 -3
  86. package/lib/cjs/IModelHost.d.ts.map +1 -1
  87. package/lib/cjs/IModelHost.js +2 -3
  88. package/lib/cjs/IModelHost.js.map +1 -1
  89. package/lib/cjs/IModelJsFs.js.map +1 -1
  90. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  91. package/lib/cjs/IpcHost.js.map +1 -1
  92. package/lib/cjs/LineStyle.js.map +1 -1
  93. package/lib/cjs/LocalHub.js +1 -1
  94. package/lib/cjs/LocalHub.js.map +1 -1
  95. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  96. package/lib/cjs/LockControl.js.map +1 -1
  97. package/lib/cjs/Material.d.ts +1 -1
  98. package/lib/cjs/Material.js +1 -1
  99. package/lib/cjs/Material.js.map +1 -1
  100. package/lib/cjs/Model.d.ts +22 -22
  101. package/lib/cjs/Model.js +22 -22
  102. package/lib/cjs/Model.js.map +1 -1
  103. package/lib/cjs/NativeAppStorage.js.map +1 -1
  104. package/lib/cjs/NativeHost.js.map +1 -1
  105. package/lib/cjs/NavigationRelationship.js.map +1 -1
  106. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  107. package/lib/cjs/PropertyStore.js.map +1 -1
  108. package/lib/cjs/Relationship.js.map +1 -1
  109. package/lib/cjs/RpcBackend.js.map +1 -1
  110. package/lib/cjs/SQLiteDb.d.ts +1 -1
  111. package/lib/cjs/SQLiteDb.js +1 -1
  112. package/lib/cjs/SQLiteDb.js.map +1 -1
  113. package/lib/cjs/Schema.js.map +1 -1
  114. package/lib/cjs/SchemaSync.js.map +1 -1
  115. package/lib/cjs/SchemaUtils.js.map +1 -1
  116. package/lib/cjs/SheetIndex.js.map +1 -1
  117. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  118. package/lib/cjs/SqliteStatement.d.ts +1 -1
  119. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  120. package/lib/cjs/SqliteStatement.js +1 -1
  121. package/lib/cjs/SqliteStatement.js.map +1 -1
  122. package/lib/cjs/Texture.d.ts +1 -1
  123. package/lib/cjs/Texture.js +1 -1
  124. package/lib/cjs/Texture.js.map +1 -1
  125. package/lib/cjs/TileStorage.js.map +1 -1
  126. package/lib/cjs/TxnManager.d.ts +4 -4
  127. package/lib/cjs/TxnManager.js +1 -1
  128. package/lib/cjs/TxnManager.js.map +1 -1
  129. package/lib/cjs/ViewDefinition.d.ts +40 -14
  130. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  131. package/lib/cjs/ViewDefinition.js +42 -14
  132. package/lib/cjs/ViewDefinition.js.map +1 -1
  133. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  134. package/lib/cjs/ViewStore.js.map +1 -1
  135. package/lib/cjs/annotations/FrameGeometry.d.ts +52 -0
  136. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  137. package/lib/cjs/annotations/FrameGeometry.js +250 -0
  138. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  139. package/lib/cjs/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  140. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  141. package/lib/cjs/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +20 -26
  142. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  143. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +31 -0
  144. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  145. package/lib/cjs/annotations/TextAnnotationGeometry.js +132 -0
  146. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  147. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  148. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  149. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +13 -69
  150. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  151. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +22 -8
  152. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  153. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +51 -9
  154. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  155. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  156. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  157. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  158. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  159. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  160. package/lib/cjs/core-backend.d.ts +5 -3
  161. package/lib/cjs/core-backend.d.ts.map +1 -1
  162. package/lib/cjs/core-backend.js +25 -6
  163. package/lib/cjs/core-backend.js.map +1 -1
  164. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  165. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  166. package/lib/cjs/domains/GenericElements.js.map +1 -1
  167. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  168. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  169. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  170. package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
  171. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  172. package/lib/cjs/internal/ElementLRUCache.js +167 -3
  173. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  174. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  175. package/lib/cjs/internal/HubMock.js.map +1 -1
  176. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  177. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  178. package/lib/cjs/internal/NoLocks.js.map +1 -1
  179. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  180. package/lib/cjs/internal/Symbols.d.ts +1 -0
  181. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  182. package/lib/cjs/internal/Symbols.js +2 -1
  183. package/lib/cjs/internal/Symbols.js.map +1 -1
  184. package/lib/cjs/internal/cross-package.js.map +1 -1
  185. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  186. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  187. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  188. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  189. package/lib/cjs/rpc/multipart.js.map +1 -1
  190. package/lib/cjs/rpc/tracing.js.map +1 -1
  191. package/lib/cjs/rpc/web/logging.js.map +1 -1
  192. package/lib/cjs/rpc/web/request.js.map +1 -1
  193. package/lib/cjs/rpc/web/response.js.map +1 -1
  194. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  195. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  196. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
  197. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  198. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  199. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  200. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  201. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  202. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  203. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  204. package/lib/cjs/workspace/Settings.js.map +1 -1
  205. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  206. package/lib/cjs/workspace/Workspace.js.map +1 -1
  207. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  208. package/lib/esm/BackendHubAccess.d.ts +1 -1
  209. package/lib/esm/BackendHubAccess.js +1 -1
  210. package/lib/esm/BackendHubAccess.js.map +1 -1
  211. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  212. package/lib/esm/BisCoreSchema.js +1 -1
  213. package/lib/esm/BisCoreSchema.js.map +1 -1
  214. package/lib/esm/BlobContainerService.js.map +1 -1
  215. package/lib/esm/BriefcaseManager.d.ts +10 -2
  216. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  217. package/lib/esm/BriefcaseManager.js +17 -1
  218. package/lib/esm/BriefcaseManager.js.map +1 -1
  219. package/lib/esm/CatalogDb.js.map +1 -1
  220. package/lib/esm/Category.d.ts +4 -4
  221. package/lib/esm/Category.js +4 -4
  222. package/lib/esm/Category.js.map +1 -1
  223. package/lib/esm/ChangeSummaryManager.js +2 -2
  224. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  225. package/lib/esm/ChangedElementsDb.js.map +1 -1
  226. package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
  227. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  228. package/lib/esm/ChangesetECAdaptor.js +490 -275
  229. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  230. package/lib/esm/ChannelControl.js.map +1 -1
  231. package/lib/esm/CheckpointManager.js.map +1 -1
  232. package/lib/esm/ClassRegistry.d.ts +1 -1
  233. package/lib/esm/ClassRegistry.js +6 -6
  234. package/lib/esm/ClassRegistry.js.map +1 -1
  235. package/lib/esm/CloudSqlite.js +1 -1
  236. package/lib/esm/CloudSqlite.js.map +1 -1
  237. package/lib/esm/CodeService.js.map +1 -1
  238. package/lib/esm/CodeSpecs.d.ts +1 -1
  239. package/lib/esm/CodeSpecs.js +1 -1
  240. package/lib/esm/CodeSpecs.js.map +1 -1
  241. package/lib/esm/ConcurrentQuery.js.map +1 -1
  242. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  243. package/lib/esm/DevTools.js.map +1 -1
  244. package/lib/esm/DisplayStyle.d.ts +4 -4
  245. package/lib/esm/DisplayStyle.js +3 -3
  246. package/lib/esm/DisplayStyle.js.map +1 -1
  247. package/lib/esm/ECDb.d.ts +4 -4
  248. package/lib/esm/ECDb.d.ts.map +1 -1
  249. package/lib/esm/ECDb.js +4 -4
  250. package/lib/esm/ECDb.js.map +1 -1
  251. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  252. package/lib/esm/ECSqlStatement.d.ts +15 -6
  253. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  254. package/lib/esm/ECSqlStatement.js +18 -4
  255. package/lib/esm/ECSqlStatement.js.map +1 -1
  256. package/lib/esm/Element.d.ts +51 -51
  257. package/lib/esm/Element.js +52 -52
  258. package/lib/esm/Element.js.map +1 -1
  259. package/lib/esm/ElementAspect.d.ts +8 -8
  260. package/lib/esm/ElementAspect.d.ts.map +1 -1
  261. package/lib/esm/ElementAspect.js +8 -8
  262. package/lib/esm/ElementAspect.js.map +1 -1
  263. package/lib/esm/ElementGraphics.js.map +1 -1
  264. package/lib/esm/ElementTreeWalker.js.map +1 -1
  265. package/lib/esm/Entity.d.ts +3 -3
  266. package/lib/esm/Entity.js +2 -2
  267. package/lib/esm/Entity.js.map +1 -1
  268. package/lib/esm/EntityReferences.js.map +1 -1
  269. package/lib/esm/ExportGraphics.d.ts +54 -8
  270. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  271. package/lib/esm/ExportGraphics.js +156 -58
  272. package/lib/esm/ExportGraphics.js.map +1 -1
  273. package/lib/esm/ExternalSource.js.map +1 -1
  274. package/lib/esm/FontFile.js.map +1 -1
  275. package/lib/esm/GeoCoordConfig.js.map +1 -1
  276. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  277. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  278. package/lib/esm/GeographicCRSServices.js +1 -1
  279. package/lib/esm/GeographicCRSServices.js.map +1 -1
  280. package/lib/esm/GeometrySummary.js +47 -47
  281. package/lib/esm/GeometrySummary.js.map +1 -1
  282. package/lib/esm/IModelDb.d.ts +29 -23
  283. package/lib/esm/IModelDb.d.ts.map +1 -1
  284. package/lib/esm/IModelDb.js +105 -52
  285. package/lib/esm/IModelDb.js.map +1 -1
  286. package/lib/esm/IModelDbFonts.js.map +1 -1
  287. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  288. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  289. package/lib/esm/IModelElementCloneContext.js +1 -1
  290. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  291. package/lib/esm/IModelHost.d.ts +2 -3
  292. package/lib/esm/IModelHost.d.ts.map +1 -1
  293. package/lib/esm/IModelHost.js +2 -3
  294. package/lib/esm/IModelHost.js.map +1 -1
  295. package/lib/esm/IModelJsFs.js.map +1 -1
  296. package/lib/esm/ImageSourceConversion.js.map +1 -1
  297. package/lib/esm/IpcHost.js.map +1 -1
  298. package/lib/esm/LineStyle.js.map +1 -1
  299. package/lib/esm/LocalHub.js +1 -1
  300. package/lib/esm/LocalHub.js.map +1 -1
  301. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  302. package/lib/esm/LockControl.js.map +1 -1
  303. package/lib/esm/Material.d.ts +1 -1
  304. package/lib/esm/Material.js +1 -1
  305. package/lib/esm/Material.js.map +1 -1
  306. package/lib/esm/Model.d.ts +22 -22
  307. package/lib/esm/Model.js +22 -22
  308. package/lib/esm/Model.js.map +1 -1
  309. package/lib/esm/NativeAppStorage.js.map +1 -1
  310. package/lib/esm/NativeHost.js.map +1 -1
  311. package/lib/esm/NavigationRelationship.js.map +1 -1
  312. package/lib/esm/PromiseMemoizer.js.map +1 -1
  313. package/lib/esm/PropertyStore.js.map +1 -1
  314. package/lib/esm/Relationship.js.map +1 -1
  315. package/lib/esm/RpcBackend.js.map +1 -1
  316. package/lib/esm/SQLiteDb.d.ts +1 -1
  317. package/lib/esm/SQLiteDb.js +1 -1
  318. package/lib/esm/SQLiteDb.js.map +1 -1
  319. package/lib/esm/Schema.js.map +1 -1
  320. package/lib/esm/SchemaSync.js.map +1 -1
  321. package/lib/esm/SchemaUtils.js.map +1 -1
  322. package/lib/esm/SheetIndex.js.map +1 -1
  323. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  324. package/lib/esm/SqliteStatement.d.ts +1 -1
  325. package/lib/esm/SqliteStatement.d.ts.map +1 -1
  326. package/lib/esm/SqliteStatement.js +1 -1
  327. package/lib/esm/SqliteStatement.js.map +1 -1
  328. package/lib/esm/Texture.d.ts +1 -1
  329. package/lib/esm/Texture.js +1 -1
  330. package/lib/esm/Texture.js.map +1 -1
  331. package/lib/esm/TileStorage.js.map +1 -1
  332. package/lib/esm/TxnManager.d.ts +4 -4
  333. package/lib/esm/TxnManager.js +1 -1
  334. package/lib/esm/TxnManager.js.map +1 -1
  335. package/lib/esm/ViewDefinition.d.ts +40 -14
  336. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  337. package/lib/esm/ViewDefinition.js +42 -14
  338. package/lib/esm/ViewDefinition.js.map +1 -1
  339. package/lib/esm/ViewStateHydrator.js.map +1 -1
  340. package/lib/esm/ViewStore.js.map +1 -1
  341. package/lib/esm/annotations/FrameGeometry.d.ts +52 -0
  342. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  343. package/lib/esm/annotations/FrameGeometry.js +245 -0
  344. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  345. package/lib/esm/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  346. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  347. package/lib/esm/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +22 -28
  348. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  349. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +31 -0
  350. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  351. package/lib/esm/annotations/TextAnnotationGeometry.js +129 -0
  352. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  353. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  354. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  355. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +13 -69
  356. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  357. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +22 -8
  358. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  359. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +51 -9
  360. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  361. package/lib/esm/core-backend.d.ts +5 -3
  362. package/lib/esm/core-backend.d.ts.map +1 -1
  363. package/lib/esm/core-backend.js +25 -3
  364. package/lib/esm/core-backend.js.map +1 -1
  365. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  366. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  367. package/lib/esm/domains/GenericElements.js.map +1 -1
  368. package/lib/esm/domains/GenericSchema.js.map +1 -1
  369. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  370. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  371. package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
  372. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  373. package/lib/esm/internal/ElementLRUCache.js +165 -2
  374. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  375. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  376. package/lib/esm/internal/HubMock.js.map +1 -1
  377. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  378. package/lib/esm/internal/NativePlatform.js.map +1 -1
  379. package/lib/esm/internal/NoLocks.js.map +1 -1
  380. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  381. package/lib/esm/internal/Symbols.d.ts +1 -0
  382. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  383. package/lib/esm/internal/Symbols.js +1 -0
  384. package/lib/esm/internal/Symbols.js.map +1 -1
  385. package/lib/esm/internal/cross-package.js.map +1 -1
  386. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  387. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  388. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  389. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  390. package/lib/esm/rpc/multipart.js.map +1 -1
  391. package/lib/esm/rpc/tracing.js.map +1 -1
  392. package/lib/esm/rpc/web/logging.js.map +1 -1
  393. package/lib/esm/rpc/web/request.js.map +1 -1
  394. package/lib/esm/rpc/web/response.js.map +1 -1
  395. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  396. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  397. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
  398. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  399. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  400. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  401. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  402. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  403. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  404. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  405. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  406. package/lib/esm/test/AttachDb.test.js +11 -11
  407. package/lib/esm/test/AttachDb.test.js.map +1 -1
  408. package/lib/esm/test/ElementLRUCache.test.js +224 -1
  409. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  410. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  411. package/lib/esm/test/IModelHost.test.js.map +1 -1
  412. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  413. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  414. package/lib/esm/test/IpcHost.test.js.map +1 -1
  415. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  416. package/lib/esm/test/PrintElementTree.js.map +1 -1
  417. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  418. package/lib/esm/test/RevisionUtility.js.map +1 -1
  419. package/lib/esm/test/SchemaUtils.test.js +25 -25
  420. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  421. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  422. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  423. package/lib/esm/test/TestUtils.d.ts +1 -1
  424. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  425. package/lib/esm/test/TestUtils.js +1 -1
  426. package/lib/esm/test/TestUtils.js.map +1 -1
  427. package/lib/esm/test/annotations/TextAnnotation.test.js +190 -1025
  428. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  429. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  430. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  431. package/lib/esm/test/annotations/TextBlock.test.js +1105 -0
  432. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  433. package/lib/esm/test/categories/Category.test.js.map +1 -1
  434. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  435. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  436. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  437. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
  438. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
  439. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
  440. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
  441. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +35 -45
  442. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  443. package/lib/esm/test/ecdb/ECDb.test.js +86 -65
  444. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  445. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  446. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  447. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  448. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  449. package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
  450. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  451. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  452. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  453. package/lib/esm/test/ecdb/ECSqlStatement.test.js +484 -292
  454. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  455. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  456. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  457. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  458. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  459. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  460. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  461. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  462. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  463. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  464. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  465. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  466. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  467. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  468. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  469. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  470. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  471. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  472. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  473. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  474. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  475. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  476. package/lib/esm/test/imageData.js.map +1 -1
  477. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  478. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  479. package/lib/esm/test/imodel/IModel.test.js +228 -5
  480. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  481. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  482. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  483. package/lib/esm/test/index.js.map +1 -1
  484. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  485. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  486. package/lib/esm/test/misc/GeoServices.test.js +23 -9
  487. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  488. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  489. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  490. package/lib/esm/test/rpc/response.test.js.map +1 -1
  491. package/lib/esm/test/schema/ClassRegistry.test.js +71 -71
  492. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  493. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  494. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  495. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  496. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  497. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  498. package/lib/esm/test/standalone/ChangesetReader.test.js +479 -164
  499. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  500. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  501. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  502. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  503. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  504. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  505. package/lib/esm/test/standalone/ExportGraphics.test.js +67 -15
  506. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  507. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  508. package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
  509. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  510. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  511. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  512. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  513. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  514. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  515. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  516. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  517. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  518. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  519. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  520. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  521. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  522. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  523. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  524. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  525. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  526. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  527. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  528. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  529. package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
  530. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  531. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  532. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  533. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  534. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  535. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  536. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  537. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  538. package/lib/esm/workspace/Settings.js.map +1 -1
  539. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  540. package/lib/esm/workspace/Workspace.js.map +1 -1
  541. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  542. package/package.json +12 -12
  543. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  544. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  545. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  546. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  547. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  548. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  549. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  550. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  551. package/lib/esm/TextAnnotationElement.js.map +0 -1
  552. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  553. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  554. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  555. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  556. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -0,0 +1,129 @@
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, FillDisplay, GeometryParams, TextAnnotation } from "@itwin/core-common";
9
+ import { LineString3d, PointString3d, Range2d, Transform } from "@itwin/core-geometry";
10
+ import { Id64 } from "@itwin/core-bentley";
11
+ import { produceTextBlockGeometry } from "./TextBlockGeometry";
12
+ import { appendFrameToBuilder, computeIntervalPoints } from "./FrameGeometry";
13
+ /** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.
14
+ * @returns true if the geometry was successfully appended.
15
+ * @beta
16
+ */
17
+ export function appendTextAnnotationGeometry(props) {
18
+ const annotation = TextAnnotation.fromJSON(props.annotationProps);
19
+ const range = Range2d.fromJSON(props.layout.range);
20
+ const transform = annotation.computeTransform(range);
21
+ let result = true;
22
+ // Construct the TextBlockGeometry
23
+ const params = new GeometryParams(props.categoryId, props.subCategoryId);
24
+ const entries = produceTextBlockGeometry(props.layout, annotation.computeTransform(props.layout.range));
25
+ result = result && props.builder.appendTextBlock(entries, params);
26
+ // Construct the frame geometry
27
+ if (annotation.frame && annotation.frame.shape !== "none") {
28
+ result = result && appendFrameToBuilder(props.builder, annotation.frame, range, transform, params);
29
+ }
30
+ // Construct the debug geometry
31
+ if (props.wantDebugGeometry) {
32
+ result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));
33
+ result = result && debugRunLayout(props.builder, props.layout, annotation.computeTransform(props.layout.range));
34
+ if (annotation.frame)
35
+ result = result && debugSnapPoints(props.builder, annotation.frame, props.layout.range, annotation.computeTransform(props.layout.range));
36
+ }
37
+ return result;
38
+ }
39
+ ;
40
+ /**
41
+ * Draws the anchor point and margins of the text annotation.
42
+ * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).
43
+ * The margins are drawn as a blue box.
44
+ * The text range is drawn as a red box.
45
+ */
46
+ function debugAnchorPoint(builder, annotation, layout, transform) {
47
+ const range = Range2d.fromJSON(layout.range);
48
+ const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));
49
+ // Make it blue
50
+ const blueLineParams = new GeometryParams(Id64.invalid);
51
+ blueLineParams.lineColor = ColorDef.blue;
52
+ let result = builder.appendGeometryParamsChange(blueLineParams);
53
+ // Draw a blue box to show the element's margin
54
+ const marginCorners = range.corners3d(true);
55
+ transform.multiplyPoint3dArrayInPlace(marginCorners);
56
+ result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));
57
+ // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.
58
+ result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));
59
+ result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));
60
+ // Draw a red box to show the text range
61
+ const redLineParams = new GeometryParams(Id64.invalid);
62
+ redLineParams.lineColor = ColorDef.red;
63
+ result = result && builder.appendGeometryParamsChange(redLineParams);
64
+ const rangeCorners = layout.textRange.corners3d(true);
65
+ transform.multiplyPoint3dArrayInPlace(rangeCorners);
66
+ result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));
67
+ return result;
68
+ }
69
+ /** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */
70
+ function debugSnapPoints(builder, frame, range, transform) {
71
+ if (undefined === frame.shape || frame.shape === "none")
72
+ return false;
73
+ const points = computeIntervalPoints({ frame: frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });
74
+ const params = new GeometryParams(Id64.invalid);
75
+ params.lineColor = ColorDef.black;
76
+ params.weight = (frame.borderWeight ?? 1) * 5; // We want the dots to be bigger than the frame so we can see them.
77
+ params.fillDisplay = FillDisplay.Always;
78
+ const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));
79
+ return result;
80
+ }
81
+ /**
82
+ * Draws debug geometry for each line and run in a TextBlockLayout.
83
+ *
84
+ * For each line and run, this function draws boxes to visualize their layout and boundaries.
85
+ * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.
86
+ * This is useful for debugging text layout and alignment issues.
87
+ *
88
+ * @param builder - The geometry builder to append debug geometry to.
89
+ * @param layout - The text block layout containing lines and runs to visualize.
90
+ * @param documentTransform - The transform to apply to the entire document.
91
+ * @returns True if all debug geometry was successfully appended.
92
+ */
93
+ function debugRunLayout(builder, layout, documentTransform) {
94
+ let result = true; // Tracks if all geometry was appended successfully
95
+ let color = ColorDef.black; // Current color for the run type
96
+ let lastColor = color; // Last color used, to minimize param changes
97
+ // Map run types to debug colors
98
+ const colors = {
99
+ "text": ColorDef.fromString("orange"),
100
+ "linebreak": ColorDef.fromString("yellow"),
101
+ "fraction": ColorDef.fromString("green"),
102
+ "tab": ColorDef.fromString("aquamarine"),
103
+ };
104
+ layout.lines.forEach(line => {
105
+ // Apply the line's offset transform
106
+ const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);
107
+ documentTransform.multiplyTransformTransform(lineTrans, lineTrans);
108
+ line.runs.forEach(run => {
109
+ // Determine color for this run type
110
+ color = colors[run.source.type] ?? ColorDef.black;
111
+ // Only change geometry params if the color changes
112
+ if (!lastColor.equals(color)) {
113
+ const colorParams = new GeometryParams(Id64.invalid);
114
+ colorParams.lineColor = color;
115
+ result = result && builder.appendGeometryParamsChange(colorParams);
116
+ lastColor = color;
117
+ }
118
+ // Apply the line's offset to the run's offset
119
+ const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);
120
+ lineTrans.multiplyTransformTransform(runTrans, runTrans);
121
+ // Draw the enclosing range for the run
122
+ const runCorners = run.range.corners3d(true);
123
+ runTrans.multiplyPoint3dArrayInPlace(runCorners);
124
+ result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));
125
+ });
126
+ });
127
+ return result;
128
+ }
129
+ //# sourceMappingURL=TextAnnotationGeometry.js.map
@@ -0,0 +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,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I,OAAO,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;gBACnE,SAAS,GAAG,KAAK,CAAC;YACpB,CAAC;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":["/*---------------------------------------------------------------------------------------------\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\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 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}"]}
@@ -0,0 +1,16 @@
1
+ /** @packageDocumentation
2
+ * @module ElementGeometry
3
+ */
4
+ import { TextBlockGeometryProps } from "@itwin/core-common";
5
+ import { TextBlockLayout } from "./TextBlockLayout";
6
+ import { Transform } from "@itwin/core-geometry";
7
+ /**
8
+ * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].
9
+ * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.
10
+ * @param layout of the text block as computed by [[layoutTextBlock]].
11
+ * @param documentTransform that positions the text block in world coordinates.
12
+ * @returns TextBlockGeometryProps.
13
+ * @beta
14
+ */
15
+ export declare function produceTextBlockGeometry(layout: TextBlockLayout, documentTransform: Transform): TextBlockGeometryProps;
16
+ //# sourceMappingURL=TextBlockGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextBlockGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextBlockGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAA2D,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAmC,SAAS,EAAY,MAAM,sBAAsB,CAAC;AAoH5F;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,GAAG,sBAAsB,CAsBtH"}
@@ -5,8 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module ElementGeometry
7
7
  */
8
- import { ColorDef, TextString } from "@itwin/core-common";
9
- import { layoutTextBlock } from "./TextAnnotationLayout";
8
+ import { TextString } from "@itwin/core-common";
10
9
  import { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from "@itwin/core-geometry";
11
10
  import { assert } from "@itwin/core-bentley";
12
11
  function setColor(color, context) {
@@ -93,12 +92,21 @@ function processFractionRun(run, transform, context) {
93
92
  context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });
94
93
  }
95
94
  }
96
- function produceTextBlockGeometry(layout, documentTransform, debugAnchorPt) {
95
+ /**
96
+ * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].
97
+ * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.
98
+ * @param layout of the text block as computed by [[layoutTextBlock]].
99
+ * @param documentTransform that positions the text block in world coordinates.
100
+ * @returns TextBlockGeometryProps.
101
+ * @beta
102
+ */
103
+ export function produceTextBlockGeometry(layout, documentTransform) {
97
104
  const context = { entries: [] };
98
105
  for (const line of layout.lines) {
99
106
  const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);
100
107
  for (const run of line.runs) {
101
- if ("linebreak" === run.source.type) {
108
+ // Skip runs that are solely whitespace
109
+ if (run.source.isWhitespace) {
102
110
  continue;
103
111
  }
104
112
  const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);
@@ -112,70 +120,6 @@ function produceTextBlockGeometry(layout, documentTransform, debugAnchorPt) {
112
120
  }
113
121
  }
114
122
  }
115
- if (debugAnchorPt) {
116
- context.entries.push({
117
- color: ColorDef.blue.toJSON()
118
- });
119
- // Draw a blue box to show the element's margin
120
- const marginCorners = layout.range.corners3d(true);
121
- documentTransform.multiplyPoint3dArrayInPlace(marginCorners);
122
- marginCorners.forEach((corner, index) => {
123
- const next = marginCorners[index + 1];
124
- if (!next)
125
- return;
126
- context.entries.push({
127
- separator: {
128
- startPoint: [corner.x, corner.y, 0],
129
- endPoint: [next.x, next.y, 0],
130
- },
131
- });
132
- });
133
- // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.
134
- context.entries.push({
135
- separator: {
136
- startPoint: [debugAnchorPt.x - 1, debugAnchorPt.y - 1, 0],
137
- endPoint: [debugAnchorPt.x + 1, debugAnchorPt.y + 1, 0],
138
- },
139
- });
140
- context.entries.push({
141
- separator: {
142
- startPoint: [debugAnchorPt.x + 1, debugAnchorPt.y - 1, 0],
143
- endPoint: [debugAnchorPt.x - 1, debugAnchorPt.y + 1, 0],
144
- },
145
- });
146
- // Draw a red box to show the text range
147
- context.entries.push({
148
- color: ColorDef.red.toJSON(),
149
- });
150
- const rangeCorners = layout.textRange.corners3d(true);
151
- documentTransform.multiplyPoint3dArrayInPlace(rangeCorners);
152
- rangeCorners.forEach((corner, index) => {
153
- const next = rangeCorners[index + 1];
154
- if (!next)
155
- return;
156
- context.entries.push({
157
- separator: {
158
- startPoint: [corner.x, corner.y, 0],
159
- endPoint: [next.x, next.y, 0],
160
- },
161
- });
162
- });
163
- }
164
123
  return { entries: context.entries };
165
124
  }
166
- /** Produce a geometric representation of a text annotation, with the annotation's anchor point at the origin.
167
- * The result can be supplied to [GeometryStreamBuilder.appendTextBlock]($common).
168
- * @see [[TextAnnotation2d.setAnnotation]] and [[TextAnnotation3d.setAnnotation]] to update the annotation, geometry, and placement of an annotation element.
169
- * @beta
170
- */
171
- export function produceTextAnnotationGeometry(args) {
172
- const layout = layoutTextBlock({
173
- ...args,
174
- textBlock: args.annotation.textBlock,
175
- });
176
- const dimensions = layout.range;
177
- const transform = args.annotation.computeTransform(dimensions);
178
- const anchorPoint = args.debugAnchorPointAndRange ? transform.multiplyPoint3d(args.annotation.computeAnchorPoint(dimensions)) : undefined;
179
- return produceTextBlockGeometry(layout, transform, anchorPoint);
180
- }
181
- //# sourceMappingURL=TextAnnotationGeometry.js.map
125
+ //# sourceMappingURL=TextBlockGeometry.js.map
@@ -0,0 +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,SAAoB,EAAE,OAAwB;IACpF,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,GAAG,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,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":["/*---------------------------------------------------------------------------------------------\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"]}
@@ -1,9 +1,9 @@
1
1
  /** @packageDocumentation
2
2
  * @module ElementGeometry
3
3
  */
4
- import { BaselineShift, FontId, FontType, FractionRun, LineLayoutResult, Paragraph, Run, RunLayoutResult, TextBlock, TextBlockLayoutResult, TextRun, TextStyleSettings } from "@itwin/core-common";
4
+ import { BaselineShift, FontId, FontType, FractionRun, LineLayoutResult, Paragraph, Run, RunLayoutResult, TabRun, TextBlock, TextBlockLayoutResult, TextRun, TextStyleSettings } from "@itwin/core-common";
5
5
  import { Range2d } from "@itwin/core-geometry";
6
- import { IModelDb } from "./IModelDb";
6
+ import { IModelDb } from "../IModelDb";
7
7
  /** @internal */
8
8
  export interface TextLayoutRanges {
9
9
  layout: Range2d;
@@ -55,13 +55,13 @@ export interface LayoutTextBlockArgs {
55
55
  * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.
56
56
  * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.
57
57
  * @see [[computeLayoutTextBlockResult]]
58
- * @internal
58
+ * @beta
59
59
  */
60
60
  export declare function layoutTextBlock(args: LayoutTextBlockArgs): TextBlockLayout;
61
61
  /**
62
62
  * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.
63
63
  * The visual layout accounts for the [TextStyle]($common)s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.
64
- * The layout returned matches the visual layout of the geometry produced by [[produceTextAnnotationGeometry]].
64
+ * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].
65
65
  * @beta
66
66
  */
67
67
  export declare function computeLayoutTextBlockResult(args: LayoutTextBlockArgs): TextBlockLayoutResult;
@@ -103,8 +103,14 @@ declare class LayoutContext {
103
103
  numerator: Range2d;
104
104
  denominator: Range2d;
105
105
  };
106
+ computeRangeForTabRun(style: TextStyleSettings, source: TabRun, length: number): Range2d;
106
107
  }
107
- /** @internal */
108
+ /**
109
+ * Represents the layout of a single run (text, fraction, or line break) within a line of text.
110
+ * Stores information about the run's position, style, and font within the line.
111
+ * Provides utilities for splitting text runs for word wrapping and converting to result objects.
112
+ * @beta
113
+ */
108
114
  export declare class RunLayout {
109
115
  source: Run;
110
116
  charOffset: number;
@@ -130,7 +136,12 @@ export declare class RunLayout {
130
136
  split(context: LayoutContext): RunLayout[];
131
137
  toResult(paragraph: Paragraph): RunLayoutResult;
132
138
  }
133
- /** @internal */
139
+ /**
140
+ * Represents the layout of a single line within a paragraph of a text block.
141
+ * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.
142
+ * Provides utilities for appending runs, computing ranges, and converting to result objects.
143
+ * @beta
144
+ */
134
145
  export declare class LineLayout {
135
146
  source: Paragraph;
136
147
  range: Range2d;
@@ -139,6 +150,7 @@ export declare class LineLayout {
139
150
  x: number;
140
151
  y: number;
141
152
  };
153
+ lengthFromLastTab: number;
142
154
  private _runs;
143
155
  constructor(source: Paragraph);
144
156
  /** Compute a string representation, primarily for debugging purposes. */
@@ -153,7 +165,9 @@ export declare class LineLayout {
153
165
  }
154
166
  /**
155
167
  * Describes the layout of a text block as a collection of lines containing runs.
156
- * @internal
168
+ * Computes the visual layout of the text block, including word wrapping, justification, and margins.
169
+ * Provides access to the computed lines, ranges, and utilities for converting to result objects.
170
+ * @beta
157
171
  */
158
172
  export declare class TextBlockLayout {
159
173
  source: TextBlock;
@@ -174,4 +188,4 @@ export declare class TextBlockLayout {
174
188
  private applyMargins;
175
189
  }
176
190
  export {};
177
- //# sourceMappingURL=TextAnnotationLayout.d.ts.map
191
+ //# sourceMappingURL=TextBlockLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextBlockLayout.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextBlockLayout.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAA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K1B,IAAW,IAAI,IAAI,aAAa,CAAC,SAAS,CAAC,CAAuB;IAClE,IAAW,OAAO,YAAsC;IACxD,IAAW,IAAI,IAAI,SAAS,CAG3B;IAEM,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAKnC,6CAA6C;IAC7C,OAAO,CAAC,aAAa;IAgCd,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB;CASxD;AAED;;;;;GAKG;AACH,qBAAa,eAAe;IACnB,MAAM,EAAE,SAAS,CAAC;IAEzB,8FAA8F;IACvF,SAAS,UAAiB;IAEjC,wDAAwD;IACjD,KAAK,UAAiB;IACtB,KAAK,EAAE,UAAU,EAAE,CAAM;IAChC,OAAO,CAAC,QAAQ,CAAgB;gBAEb,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa;IAcrD,QAAQ,IAAI,qBAAqB;IAOxC,yEAAyE;IAClE,SAAS,IAAI,MAAM;IAI1B,OAAO,KAAK,KAAK,GAGhB;IAED,OAAO,CAAC,aAAa;IAoErB,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,SAAS;IAqCjB,OAAO,CAAC,YAAY;CAoBrB"}
@@ -16,7 +16,7 @@ import * as LineBreaker from "linebreak";
16
16
  * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.
17
17
  * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.
18
18
  * @see [[computeLayoutTextBlockResult]]
19
- * @internal
19
+ * @beta
20
20
  */
21
21
  export function layoutTextBlock(args) {
22
22
  const findFontId = args.findFontId ?? ((name, type) => args.iModel.fonts.findId({ name, type }) ?? 0);
@@ -28,7 +28,7 @@ export function layoutTextBlock(args) {
28
28
  /**
29
29
  * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.
30
30
  * The visual layout accounts for the [TextStyle]($common)s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.
31
- * The layout returned matches the visual layout of the geometry produced by [[produceTextAnnotationGeometry]].
31
+ * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].
32
32
  * @beta
33
33
  */
34
34
  export function computeLayoutTextBlockResult(args) {
@@ -172,6 +172,13 @@ class LayoutContext {
172
172
  layout.extendRange(denominator);
173
173
  return { layout, numerator, denominator };
174
174
  }
175
+ computeRangeForTabRun(style, source, length) {
176
+ const interval = source.styleOverrides.tabInterval ?? style.tabInterval;
177
+ const tabEndX = interval - length % interval;
178
+ const range = new Range2d(0, 0, 0, style.lineHeight);
179
+ range.extendXY(tabEndX, range.low.y);
180
+ return range;
181
+ }
175
182
  }
176
183
  function split(source) {
177
184
  if (source.length === 0) {
@@ -189,7 +196,17 @@ function split(source) {
189
196
  }
190
197
  return segments;
191
198
  }
192
- /** @internal */
199
+ function applyTabShift(run, parent, context) {
200
+ if (run.source.type === "tab") {
201
+ run.range.setFrom(context.computeRangeForTabRun(run.style, run.source, parent.lengthFromLastTab));
202
+ }
203
+ }
204
+ /**
205
+ * Represents the layout of a single run (text, fraction, or line break) within a line of text.
206
+ * Stores information about the run's position, style, and font within the line.
207
+ * Provides utilities for splitting text runs for word wrapping and converting to result objects.
208
+ * @beta
209
+ */
193
210
  export class RunLayout {
194
211
  source;
195
212
  charOffset;
@@ -236,8 +253,9 @@ export class RunLayout {
236
253
  denominatorRange = ranges.denominator;
237
254
  break;
238
255
  }
239
- default: {
240
- // We do this so that blank lines space correctly without special casing later.
256
+ default: { // "linebreak" or "tab"
257
+ // "tab": Tabs rely on the context they are in, so we compute its range later.
258
+ // lineBreak: We do this so that blank lines space correctly without special casing later.
241
259
  range = new Range2d(0, 0, 0, style.lineHeight);
242
260
  break;
243
261
  }
@@ -302,12 +320,18 @@ export class RunLayout {
302
320
  return result;
303
321
  }
304
322
  }
305
- /** @internal */
323
+ /**
324
+ * Represents the layout of a single line within a paragraph of a text block.
325
+ * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.
326
+ * Provides utilities for appending runs, computing ranges, and converting to result objects.
327
+ * @beta
328
+ */
306
329
  export class LineLayout {
307
330
  source;
308
331
  range = new Range2d(0, 0, 0, 0);
309
332
  justificationRange = new Range2d(0, 0, 0, 0);
310
333
  offsetFromDocument = { x: 0, y: 0 };
334
+ lengthFromLastTab = 0; // Used to track the length from the last tab for tab runs.
311
335
  _runs = [];
312
336
  constructor(source) {
313
337
  this.source = source;
@@ -347,6 +371,12 @@ export class LineLayout {
347
371
  const runJustificationRange = run.justificationRange?.cloneTranslated(runOffset);
348
372
  this.justificationRange.extendRange(runJustificationRange ?? runLayoutRange);
349
373
  }
374
+ if (run.source.type === "tab") {
375
+ this.lengthFromLastTab = 0;
376
+ }
377
+ else {
378
+ this.lengthFromLastTab += run.range.xLength();
379
+ }
350
380
  }
351
381
  }
352
382
  toResult(textBlock) {
@@ -361,7 +391,9 @@ export class LineLayout {
361
391
  }
362
392
  /**
363
393
  * Describes the layout of a text block as a collection of lines containing runs.
364
- * @internal
394
+ * Computes the visual layout of the text block, including word wrapping, justification, and margins.
395
+ * Provides access to the computed lines, ranges, and utilities for converting to result objects.
396
+ * @beta
365
397
  */
366
398
  export class TextBlockLayout {
367
399
  source;
@@ -385,7 +417,7 @@ export class TextBlockLayout {
385
417
  toResult() {
386
418
  return {
387
419
  lines: this.lines.map((x) => x.toResult(this.source)),
388
- range: this.textRange.toJSON(),
420
+ range: this.range.toJSON(),
389
421
  };
390
422
  }
391
423
  /** Compute a string representation, primarily for debugging purposes. */
@@ -418,22 +450,32 @@ export class TextBlockLayout {
418
450
  curLine = this.flushLine(context, curLine);
419
451
  continue;
420
452
  }
453
+ // If this is a tab, we need to apply the tab shift first, and then we can treat it like a text run.
454
+ applyTabShift(run, curLine, context);
455
+ // If our width is not set (doWrap is false), then we don't have to compute word wrapping, so just append the run, and continue.
421
456
  if (!doWrap) {
422
457
  curLine.append(run);
423
458
  continue;
424
459
  }
460
+ // Next, determine if we can append this run to the current line without exceeding the document width
425
461
  const runWidth = run.range.xLength();
426
462
  const lineWidth = curLine.range.xLength();
463
+ // If true, then no word wrapping is required, so we can append to the current line.
427
464
  if (runWidth + lineWidth < doc.width || Geometry.isAlmostEqualNumber(runWidth + lineWidth, doc.width, Geometry.smallMetricDistance)) {
428
465
  curLine.append(run);
429
466
  continue;
430
467
  }
468
+ // Do word wrapping
431
469
  if (curLine.runs.length === 0) {
432
470
  curLine.append(run);
471
+ // Lastly, flush line
433
472
  curLine = this.flushLine(context, curLine);
434
473
  }
435
474
  else {
475
+ // First, flush line
436
476
  curLine = this.flushLine(context, curLine);
477
+ // Recompute tab shift if applicable
478
+ applyTabShift(run, curLine, context);
437
479
  curLine.append(run);
438
480
  }
439
481
  }
@@ -510,4 +552,4 @@ export class TextBlockLayout {
510
552
  this.range.extendXY(xLow, yLow);
511
553
  }
512
554
  }
513
- //# sourceMappingURL=TextAnnotationLayout.js.map
555
+ //# sourceMappingURL=TextBlockLayout.js.map