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

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 (312) 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/BisCoreSchema.js +1 -1
  6. package/lib/cjs/BisCoreSchema.js.map +1 -1
  7. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  8. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  9. package/lib/cjs/BriefcaseManager.js +16 -0
  10. package/lib/cjs/BriefcaseManager.js.map +1 -1
  11. package/lib/cjs/Category.d.ts +4 -4
  12. package/lib/cjs/Category.js +4 -4
  13. package/lib/cjs/Category.js.map +1 -1
  14. package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
  15. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  16. package/lib/cjs/ChangesetECAdaptor.js +248 -33
  17. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  18. package/lib/cjs/ClassRegistry.d.ts +1 -1
  19. package/lib/cjs/ClassRegistry.js +1 -1
  20. package/lib/cjs/ClassRegistry.js.map +1 -1
  21. package/lib/cjs/CloudSqlite.js +1 -1
  22. package/lib/cjs/CloudSqlite.js.map +1 -1
  23. package/lib/cjs/CodeSpecs.d.ts +1 -1
  24. package/lib/cjs/CodeSpecs.js +1 -1
  25. package/lib/cjs/CodeSpecs.js.map +1 -1
  26. package/lib/cjs/DisplayStyle.d.ts +4 -4
  27. package/lib/cjs/DisplayStyle.js +3 -3
  28. package/lib/cjs/DisplayStyle.js.map +1 -1
  29. package/lib/cjs/ECDb.d.ts +4 -4
  30. package/lib/cjs/ECDb.d.ts.map +1 -1
  31. package/lib/cjs/ECDb.js +4 -4
  32. package/lib/cjs/ECDb.js.map +1 -1
  33. package/lib/cjs/ECSqlStatement.d.ts +15 -6
  34. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  35. package/lib/cjs/ECSqlStatement.js +18 -4
  36. package/lib/cjs/ECSqlStatement.js.map +1 -1
  37. package/lib/cjs/Element.d.ts +51 -51
  38. package/lib/cjs/Element.js +52 -52
  39. package/lib/cjs/Element.js.map +1 -1
  40. package/lib/cjs/ElementAspect.d.ts +8 -8
  41. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  42. package/lib/cjs/ElementAspect.js +8 -8
  43. package/lib/cjs/ElementAspect.js.map +1 -1
  44. package/lib/cjs/Entity.d.ts +3 -3
  45. package/lib/cjs/Entity.js +2 -2
  46. package/lib/cjs/Entity.js.map +1 -1
  47. package/lib/cjs/ExportGraphics.d.ts +54 -8
  48. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  49. package/lib/cjs/ExportGraphics.js +158 -59
  50. package/lib/cjs/ExportGraphics.js.map +1 -1
  51. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  52. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  53. package/lib/cjs/GeographicCRSServices.js +1 -1
  54. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  55. package/lib/cjs/IModelDb.d.ts +29 -23
  56. package/lib/cjs/IModelDb.d.ts.map +1 -1
  57. package/lib/cjs/IModelDb.js +106 -43
  58. package/lib/cjs/IModelDb.js.map +1 -1
  59. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  60. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  61. package/lib/cjs/IModelElementCloneContext.js +1 -1
  62. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  63. package/lib/cjs/IModelHost.d.ts +2 -3
  64. package/lib/cjs/IModelHost.d.ts.map +1 -1
  65. package/lib/cjs/IModelHost.js +2 -3
  66. package/lib/cjs/IModelHost.js.map +1 -1
  67. package/lib/cjs/Material.d.ts +1 -1
  68. package/lib/cjs/Material.js +1 -1
  69. package/lib/cjs/Material.js.map +1 -1
  70. package/lib/cjs/Model.d.ts +22 -22
  71. package/lib/cjs/Model.js +22 -22
  72. package/lib/cjs/Model.js.map +1 -1
  73. package/lib/cjs/SQLiteDb.d.ts +1 -1
  74. package/lib/cjs/SQLiteDb.js +1 -1
  75. package/lib/cjs/SQLiteDb.js.map +1 -1
  76. package/lib/cjs/SqliteStatement.d.ts +1 -1
  77. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  78. package/lib/cjs/SqliteStatement.js +1 -1
  79. package/lib/cjs/SqliteStatement.js.map +1 -1
  80. package/lib/cjs/Texture.d.ts +1 -1
  81. package/lib/cjs/Texture.js +1 -1
  82. package/lib/cjs/Texture.js.map +1 -1
  83. package/lib/cjs/TxnManager.d.ts +4 -4
  84. package/lib/cjs/TxnManager.js +1 -1
  85. package/lib/cjs/TxnManager.js.map +1 -1
  86. package/lib/cjs/ViewDefinition.d.ts +40 -14
  87. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  88. package/lib/cjs/ViewDefinition.js +42 -14
  89. package/lib/cjs/ViewDefinition.js.map +1 -1
  90. package/lib/cjs/annotations/FrameGeometry.d.ts +52 -0
  91. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  92. package/lib/cjs/annotations/FrameGeometry.js +250 -0
  93. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  94. package/lib/cjs/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  95. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  96. package/lib/cjs/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +20 -26
  97. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  98. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +31 -0
  99. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  100. package/lib/cjs/annotations/TextAnnotationGeometry.js +132 -0
  101. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  102. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  103. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  104. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +13 -69
  105. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  106. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +22 -8
  107. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  108. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +51 -9
  109. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  110. package/lib/cjs/core-backend.d.ts +5 -3
  111. package/lib/cjs/core-backend.d.ts.map +1 -1
  112. package/lib/cjs/core-backend.js +25 -6
  113. package/lib/cjs/core-backend.js.map +1 -1
  114. package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
  115. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  116. package/lib/cjs/internal/ElementLRUCache.js +167 -3
  117. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  118. package/lib/cjs/internal/Symbols.d.ts +1 -0
  119. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  120. package/lib/cjs/internal/Symbols.js +2 -1
  121. package/lib/cjs/internal/Symbols.js.map +1 -1
  122. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  123. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
  124. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  125. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  126. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  127. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  128. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  129. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  130. package/lib/esm/BackendHubAccess.d.ts +1 -1
  131. package/lib/esm/BackendHubAccess.js +1 -1
  132. package/lib/esm/BackendHubAccess.js.map +1 -1
  133. package/lib/esm/BisCoreSchema.js +1 -1
  134. package/lib/esm/BisCoreSchema.js.map +1 -1
  135. package/lib/esm/BriefcaseManager.d.ts +10 -2
  136. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  137. package/lib/esm/BriefcaseManager.js +17 -1
  138. package/lib/esm/BriefcaseManager.js.map +1 -1
  139. package/lib/esm/Category.d.ts +4 -4
  140. package/lib/esm/Category.js +4 -4
  141. package/lib/esm/Category.js.map +1 -1
  142. package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
  143. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  144. package/lib/esm/ChangesetECAdaptor.js +248 -33
  145. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  146. package/lib/esm/ClassRegistry.d.ts +1 -1
  147. package/lib/esm/ClassRegistry.js +1 -1
  148. package/lib/esm/ClassRegistry.js.map +1 -1
  149. package/lib/esm/CloudSqlite.js +1 -1
  150. package/lib/esm/CloudSqlite.js.map +1 -1
  151. package/lib/esm/CodeSpecs.d.ts +1 -1
  152. package/lib/esm/CodeSpecs.js +1 -1
  153. package/lib/esm/CodeSpecs.js.map +1 -1
  154. package/lib/esm/DisplayStyle.d.ts +4 -4
  155. package/lib/esm/DisplayStyle.js +3 -3
  156. package/lib/esm/DisplayStyle.js.map +1 -1
  157. package/lib/esm/ECDb.d.ts +4 -4
  158. package/lib/esm/ECDb.d.ts.map +1 -1
  159. package/lib/esm/ECDb.js +4 -4
  160. package/lib/esm/ECDb.js.map +1 -1
  161. package/lib/esm/ECSqlStatement.d.ts +15 -6
  162. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  163. package/lib/esm/ECSqlStatement.js +18 -4
  164. package/lib/esm/ECSqlStatement.js.map +1 -1
  165. package/lib/esm/Element.d.ts +51 -51
  166. package/lib/esm/Element.js +52 -52
  167. package/lib/esm/Element.js.map +1 -1
  168. package/lib/esm/ElementAspect.d.ts +8 -8
  169. package/lib/esm/ElementAspect.d.ts.map +1 -1
  170. package/lib/esm/ElementAspect.js +8 -8
  171. package/lib/esm/ElementAspect.js.map +1 -1
  172. package/lib/esm/Entity.d.ts +3 -3
  173. package/lib/esm/Entity.js +2 -2
  174. package/lib/esm/Entity.js.map +1 -1
  175. package/lib/esm/ExportGraphics.d.ts +54 -8
  176. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  177. package/lib/esm/ExportGraphics.js +156 -58
  178. package/lib/esm/ExportGraphics.js.map +1 -1
  179. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  180. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  181. package/lib/esm/GeographicCRSServices.js +1 -1
  182. package/lib/esm/GeographicCRSServices.js.map +1 -1
  183. package/lib/esm/IModelDb.d.ts +29 -23
  184. package/lib/esm/IModelDb.d.ts.map +1 -1
  185. package/lib/esm/IModelDb.js +109 -46
  186. package/lib/esm/IModelDb.js.map +1 -1
  187. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  188. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  189. package/lib/esm/IModelElementCloneContext.js +1 -1
  190. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  191. package/lib/esm/IModelHost.d.ts +2 -3
  192. package/lib/esm/IModelHost.d.ts.map +1 -1
  193. package/lib/esm/IModelHost.js +2 -3
  194. package/lib/esm/IModelHost.js.map +1 -1
  195. package/lib/esm/Material.d.ts +1 -1
  196. package/lib/esm/Material.js +1 -1
  197. package/lib/esm/Material.js.map +1 -1
  198. package/lib/esm/Model.d.ts +22 -22
  199. package/lib/esm/Model.js +22 -22
  200. package/lib/esm/Model.js.map +1 -1
  201. package/lib/esm/SQLiteDb.d.ts +1 -1
  202. package/lib/esm/SQLiteDb.js +1 -1
  203. package/lib/esm/SQLiteDb.js.map +1 -1
  204. package/lib/esm/SqliteStatement.d.ts +1 -1
  205. package/lib/esm/SqliteStatement.d.ts.map +1 -1
  206. package/lib/esm/SqliteStatement.js +1 -1
  207. package/lib/esm/SqliteStatement.js.map +1 -1
  208. package/lib/esm/Texture.d.ts +1 -1
  209. package/lib/esm/Texture.js +1 -1
  210. package/lib/esm/Texture.js.map +1 -1
  211. package/lib/esm/TxnManager.d.ts +4 -4
  212. package/lib/esm/TxnManager.js +1 -1
  213. package/lib/esm/TxnManager.js.map +1 -1
  214. package/lib/esm/ViewDefinition.d.ts +40 -14
  215. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  216. package/lib/esm/ViewDefinition.js +42 -14
  217. package/lib/esm/ViewDefinition.js.map +1 -1
  218. package/lib/esm/annotations/FrameGeometry.d.ts +52 -0
  219. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  220. package/lib/esm/annotations/FrameGeometry.js +245 -0
  221. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  222. package/lib/esm/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  223. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  224. package/lib/esm/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +22 -28
  225. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  226. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +31 -0
  227. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  228. package/lib/esm/annotations/TextAnnotationGeometry.js +129 -0
  229. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  230. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  231. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  232. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +13 -69
  233. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  234. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +22 -8
  235. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  236. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +51 -9
  237. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  238. package/lib/esm/core-backend.d.ts +5 -3
  239. package/lib/esm/core-backend.d.ts.map +1 -1
  240. package/lib/esm/core-backend.js +25 -3
  241. package/lib/esm/core-backend.js.map +1 -1
  242. package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
  243. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  244. package/lib/esm/internal/ElementLRUCache.js +165 -2
  245. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  246. package/lib/esm/internal/Symbols.d.ts +1 -0
  247. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  248. package/lib/esm/internal/Symbols.js +1 -0
  249. package/lib/esm/internal/Symbols.js.map +1 -1
  250. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  251. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
  252. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  253. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  254. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  255. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  256. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  257. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  258. package/lib/esm/test/ElementLRUCache.test.js +224 -1
  259. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  260. package/lib/esm/test/TestUtils.d.ts +1 -1
  261. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  262. package/lib/esm/test/TestUtils.js +1 -1
  263. package/lib/esm/test/TestUtils.js.map +1 -1
  264. package/lib/esm/test/annotations/TextAnnotation.test.js +190 -1025
  265. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  266. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  267. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  268. package/lib/esm/test/annotations/TextBlock.test.js +1105 -0
  269. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  270. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
  271. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
  272. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
  273. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
  274. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +22 -32
  275. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  276. package/lib/esm/test/ecdb/ECDb.test.js +29 -8
  277. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  278. package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
  279. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  280. package/lib/esm/test/ecdb/ECSqlStatement.test.js +192 -0
  281. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  282. package/lib/esm/test/imodel/IModel.test.js +255 -5
  283. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  284. package/lib/esm/test/misc/GeoServices.test.js +23 -9
  285. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  286. package/lib/esm/test/standalone/ChangesetReader.test.js +451 -136
  287. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  288. package/lib/esm/test/standalone/ExportGraphics.test.js +53 -1
  289. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  290. package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
  291. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  292. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  293. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  294. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  295. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  296. package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
  297. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  298. package/package.json +12 -12
  299. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  300. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  301. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  302. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  303. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  304. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  305. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  306. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  307. package/lib/esm/TextAnnotationElement.js.map +0 -1
  308. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  309. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  310. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  311. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  312. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module ElementGeometry
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.appendTextAnnotationGeometry = appendTextAnnotationGeometry;
11
+ const core_common_1 = require("@itwin/core-common");
12
+ const core_geometry_1 = require("@itwin/core-geometry");
13
+ const core_bentley_1 = require("@itwin/core-bentley");
14
+ const TextBlockGeometry_1 = require("./TextBlockGeometry");
15
+ const FrameGeometry_1 = require("./FrameGeometry");
16
+ /** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.
17
+ * @returns true if the geometry was successfully appended.
18
+ * @beta
19
+ */
20
+ function appendTextAnnotationGeometry(props) {
21
+ const annotation = core_common_1.TextAnnotation.fromJSON(props.annotationProps);
22
+ const range = core_geometry_1.Range2d.fromJSON(props.layout.range);
23
+ const transform = annotation.computeTransform(range);
24
+ let result = true;
25
+ // Construct the TextBlockGeometry
26
+ const params = new core_common_1.GeometryParams(props.categoryId, props.subCategoryId);
27
+ const entries = (0, TextBlockGeometry_1.produceTextBlockGeometry)(props.layout, annotation.computeTransform(props.layout.range));
28
+ result = result && props.builder.appendTextBlock(entries, params);
29
+ // Construct the frame geometry
30
+ if (annotation.frame && annotation.frame.shape !== "none") {
31
+ result = result && (0, FrameGeometry_1.appendFrameToBuilder)(props.builder, annotation.frame, range, transform, params);
32
+ }
33
+ // Construct the debug geometry
34
+ if (props.wantDebugGeometry) {
35
+ result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));
36
+ result = result && debugRunLayout(props.builder, props.layout, annotation.computeTransform(props.layout.range));
37
+ if (annotation.frame)
38
+ result = result && debugSnapPoints(props.builder, annotation.frame, props.layout.range, annotation.computeTransform(props.layout.range));
39
+ }
40
+ return result;
41
+ }
42
+ ;
43
+ /**
44
+ * Draws the anchor point and margins of the text annotation.
45
+ * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).
46
+ * The margins are drawn as a blue box.
47
+ * The text range is drawn as a red box.
48
+ */
49
+ function debugAnchorPoint(builder, annotation, layout, transform) {
50
+ const range = core_geometry_1.Range2d.fromJSON(layout.range);
51
+ const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));
52
+ // Make it blue
53
+ const blueLineParams = new core_common_1.GeometryParams(core_bentley_1.Id64.invalid);
54
+ blueLineParams.lineColor = core_common_1.ColorDef.blue;
55
+ let result = builder.appendGeometryParamsChange(blueLineParams);
56
+ // Draw a blue box to show the element's margin
57
+ const marginCorners = range.corners3d(true);
58
+ transform.multiplyPoint3dArrayInPlace(marginCorners);
59
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(marginCorners));
60
+ // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.
61
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));
62
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));
63
+ // Draw a red box to show the text range
64
+ const redLineParams = new core_common_1.GeometryParams(core_bentley_1.Id64.invalid);
65
+ redLineParams.lineColor = core_common_1.ColorDef.red;
66
+ result = result && builder.appendGeometryParamsChange(redLineParams);
67
+ const rangeCorners = layout.textRange.corners3d(true);
68
+ transform.multiplyPoint3dArrayInPlace(rangeCorners);
69
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(rangeCorners));
70
+ return result;
71
+ }
72
+ /** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */
73
+ function debugSnapPoints(builder, frame, range, transform) {
74
+ if (undefined === frame.shape || frame.shape === "none")
75
+ return false;
76
+ const points = (0, FrameGeometry_1.computeIntervalPoints)({ frame: frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });
77
+ const params = new core_common_1.GeometryParams(core_bentley_1.Id64.invalid);
78
+ params.lineColor = core_common_1.ColorDef.black;
79
+ params.weight = (frame.borderWeight ?? 1) * 5; // We want the dots to be bigger than the frame so we can see them.
80
+ params.fillDisplay = core_common_1.FillDisplay.Always;
81
+ const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(core_geometry_1.PointString3d.create(points));
82
+ return result;
83
+ }
84
+ /**
85
+ * Draws debug geometry for each line and run in a TextBlockLayout.
86
+ *
87
+ * For each line and run, this function draws boxes to visualize their layout and boundaries.
88
+ * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.
89
+ * This is useful for debugging text layout and alignment issues.
90
+ *
91
+ * @param builder - The geometry builder to append debug geometry to.
92
+ * @param layout - The text block layout containing lines and runs to visualize.
93
+ * @param documentTransform - The transform to apply to the entire document.
94
+ * @returns True if all debug geometry was successfully appended.
95
+ */
96
+ function debugRunLayout(builder, layout, documentTransform) {
97
+ let result = true; // Tracks if all geometry was appended successfully
98
+ let color = core_common_1.ColorDef.black; // Current color for the run type
99
+ let lastColor = color; // Last color used, to minimize param changes
100
+ // Map run types to debug colors
101
+ const colors = {
102
+ "text": core_common_1.ColorDef.fromString("orange"),
103
+ "linebreak": core_common_1.ColorDef.fromString("yellow"),
104
+ "fraction": core_common_1.ColorDef.fromString("green"),
105
+ "tab": core_common_1.ColorDef.fromString("aquamarine"),
106
+ };
107
+ layout.lines.forEach(line => {
108
+ // Apply the line's offset transform
109
+ const lineTrans = core_geometry_1.Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);
110
+ documentTransform.multiplyTransformTransform(lineTrans, lineTrans);
111
+ line.runs.forEach(run => {
112
+ // Determine color for this run type
113
+ color = colors[run.source.type] ?? core_common_1.ColorDef.black;
114
+ // Only change geometry params if the color changes
115
+ if (!lastColor.equals(color)) {
116
+ const colorParams = new core_common_1.GeometryParams(core_bentley_1.Id64.invalid);
117
+ colorParams.lineColor = color;
118
+ result = result && builder.appendGeometryParamsChange(colorParams);
119
+ lastColor = color;
120
+ }
121
+ // Apply the line's offset to the run's offset
122
+ const runTrans = core_geometry_1.Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);
123
+ lineTrans.multiplyTransformTransform(runTrans, runTrans);
124
+ // Draw the enclosing range for the run
125
+ const runCorners = run.range.corners3d(true);
126
+ runTrans.multiplyPoint3dArrayInPlace(runCorners);
127
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(runCorners));
128
+ });
129
+ });
130
+ return result;
131
+ }
132
+ //# sourceMappingURL=TextAnnotationGeometry.js.map
@@ -0,0 +1 @@
1
+ {"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AC,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}"]}
@@ -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"}
@@ -7,9 +7,8 @@
7
7
  * @module ElementGeometry
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.produceTextAnnotationGeometry = produceTextAnnotationGeometry;
10
+ exports.produceTextBlockGeometry = produceTextBlockGeometry;
11
11
  const core_common_1 = require("@itwin/core-common");
12
- const TextAnnotationLayout_1 = require("./TextAnnotationLayout");
13
12
  const core_geometry_1 = require("@itwin/core-geometry");
14
13
  const core_bentley_1 = require("@itwin/core-bentley");
15
14
  function setColor(color, context) {
@@ -96,12 +95,21 @@ function processFractionRun(run, transform, context) {
96
95
  context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });
97
96
  }
98
97
  }
99
- function produceTextBlockGeometry(layout, documentTransform, debugAnchorPt) {
98
+ /**
99
+ * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].
100
+ * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.
101
+ * @param layout of the text block as computed by [[layoutTextBlock]].
102
+ * @param documentTransform that positions the text block in world coordinates.
103
+ * @returns TextBlockGeometryProps.
104
+ * @beta
105
+ */
106
+ function produceTextBlockGeometry(layout, documentTransform) {
100
107
  const context = { entries: [] };
101
108
  for (const line of layout.lines) {
102
109
  const lineTrans = core_geometry_1.Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);
103
110
  for (const run of line.runs) {
104
- if ("linebreak" === run.source.type) {
111
+ // Skip runs that are solely whitespace
112
+ if (run.source.isWhitespace) {
105
113
  continue;
106
114
  }
107
115
  const runTrans = core_geometry_1.Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);
@@ -115,70 +123,6 @@ function produceTextBlockGeometry(layout, documentTransform, debugAnchorPt) {
115
123
  }
116
124
  }
117
125
  }
118
- if (debugAnchorPt) {
119
- context.entries.push({
120
- color: core_common_1.ColorDef.blue.toJSON()
121
- });
122
- // Draw a blue box to show the element's margin
123
- const marginCorners = layout.range.corners3d(true);
124
- documentTransform.multiplyPoint3dArrayInPlace(marginCorners);
125
- marginCorners.forEach((corner, index) => {
126
- const next = marginCorners[index + 1];
127
- if (!next)
128
- return;
129
- context.entries.push({
130
- separator: {
131
- startPoint: [corner.x, corner.y, 0],
132
- endPoint: [next.x, next.y, 0],
133
- },
134
- });
135
- });
136
- // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.
137
- context.entries.push({
138
- separator: {
139
- startPoint: [debugAnchorPt.x - 1, debugAnchorPt.y - 1, 0],
140
- endPoint: [debugAnchorPt.x + 1, debugAnchorPt.y + 1, 0],
141
- },
142
- });
143
- context.entries.push({
144
- separator: {
145
- startPoint: [debugAnchorPt.x + 1, debugAnchorPt.y - 1, 0],
146
- endPoint: [debugAnchorPt.x - 1, debugAnchorPt.y + 1, 0],
147
- },
148
- });
149
- // Draw a red box to show the text range
150
- context.entries.push({
151
- color: core_common_1.ColorDef.red.toJSON(),
152
- });
153
- const rangeCorners = layout.textRange.corners3d(true);
154
- documentTransform.multiplyPoint3dArrayInPlace(rangeCorners);
155
- rangeCorners.forEach((corner, index) => {
156
- const next = rangeCorners[index + 1];
157
- if (!next)
158
- return;
159
- context.entries.push({
160
- separator: {
161
- startPoint: [corner.x, corner.y, 0],
162
- endPoint: [next.x, next.y, 0],
163
- },
164
- });
165
- });
166
- }
167
126
  return { entries: context.entries };
168
127
  }
169
- /** Produce a geometric representation of a text annotation, with the annotation's anchor point at the origin.
170
- * The result can be supplied to [GeometryStreamBuilder.appendTextBlock]($common).
171
- * @see [[TextAnnotation2d.setAnnotation]] and [[TextAnnotation3d.setAnnotation]] to update the annotation, geometry, and placement of an annotation element.
172
- * @beta
173
- */
174
- function produceTextAnnotationGeometry(args) {
175
- const layout = (0, TextAnnotationLayout_1.layoutTextBlock)({
176
- ...args,
177
- textBlock: args.annotation.textBlock,
178
- });
179
- const dimensions = layout.range;
180
- const transform = args.annotation.computeTransform(dimensions);
181
- const anchorPoint = args.debugAnchorPointAndRange ? transform.multiplyPoint3d(args.annotation.computeAnchorPoint(dimensions)) : undefined;
182
- return produceTextBlockGeometry(layout, transform, anchorPoint);
183
- }
184
- //# sourceMappingURL=TextAnnotationGeometry.js.map
128
+ //# 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;;AAgIH,4DAsBC;AApJD,oDAAqH;AAErH,wDAA4F;AAC5F,sDAA6C;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,IAAA,qBAAM,EAAC,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,wBAAU,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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AAM,QAAQ,GAAG,yBAAS,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;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,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,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAoB,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AACrP,OAAO,EAA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AAE,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"}
@@ -22,7 +22,7 @@ const LineBreaker = require("linebreak");
22
22
  * If the document specifies a width > 0, individual lines are split to try to avoid exceeding that width.
23
23
  * Individual TextRuns can be split onto multiple lines at word boundaries if necessary. Individual FractionRuns are never split.
24
24
  * @see [[computeLayoutTextBlockResult]]
25
- * @internal
25
+ * @beta
26
26
  */
27
27
  function layoutTextBlock(args) {
28
28
  const findFontId = args.findFontId ?? ((name, type) => args.iModel.fonts.findId({ name, type }) ?? 0);
@@ -34,7 +34,7 @@ function layoutTextBlock(args) {
34
34
  /**
35
35
  * Gets the result of laying out the the contents of a TextBlock into a series of lines containing runs.
36
36
  * The visual layout accounts for the [TextStyle]($common)s, fonts, and [TextBlock.width]($common). It applies word-wrapping if needed.
37
- * The layout returned matches the visual layout of the geometry produced by [[produceTextAnnotationGeometry]].
37
+ * The layout returned matches the visual layout of the geometry produced by [[appendTextAnnotationGeometry]].
38
38
  * @beta
39
39
  */
40
40
  function computeLayoutTextBlockResult(args) {
@@ -178,6 +178,13 @@ class LayoutContext {
178
178
  layout.extendRange(denominator);
179
179
  return { layout, numerator, denominator };
180
180
  }
181
+ computeRangeForTabRun(style, source, length) {
182
+ const interval = source.styleOverrides.tabInterval ?? style.tabInterval;
183
+ const tabEndX = interval - length % interval;
184
+ const range = new core_geometry_1.Range2d(0, 0, 0, style.lineHeight);
185
+ range.extendXY(tabEndX, range.low.y);
186
+ return range;
187
+ }
181
188
  }
182
189
  function split(source) {
183
190
  if (source.length === 0) {
@@ -195,7 +202,17 @@ function split(source) {
195
202
  }
196
203
  return segments;
197
204
  }
198
- /** @internal */
205
+ function applyTabShift(run, parent, context) {
206
+ if (run.source.type === "tab") {
207
+ run.range.setFrom(context.computeRangeForTabRun(run.style, run.source, parent.lengthFromLastTab));
208
+ }
209
+ }
210
+ /**
211
+ * Represents the layout of a single run (text, fraction, or line break) within a line of text.
212
+ * Stores information about the run's position, style, and font within the line.
213
+ * Provides utilities for splitting text runs for word wrapping and converting to result objects.
214
+ * @beta
215
+ */
199
216
  class RunLayout {
200
217
  source;
201
218
  charOffset;
@@ -242,8 +259,9 @@ class RunLayout {
242
259
  denominatorRange = ranges.denominator;
243
260
  break;
244
261
  }
245
- default: {
246
- // We do this so that blank lines space correctly without special casing later.
262
+ default: { // "linebreak" or "tab"
263
+ // "tab": Tabs rely on the context they are in, so we compute its range later.
264
+ // lineBreak: We do this so that blank lines space correctly without special casing later.
247
265
  range = new core_geometry_1.Range2d(0, 0, 0, style.lineHeight);
248
266
  break;
249
267
  }
@@ -309,12 +327,18 @@ class RunLayout {
309
327
  }
310
328
  }
311
329
  exports.RunLayout = RunLayout;
312
- /** @internal */
330
+ /**
331
+ * Represents the layout of a single line within a paragraph of a text block.
332
+ * Contains a sequence of RunLayout objects, the computed range of the line, and its offset from the document origin.
333
+ * Provides utilities for appending runs, computing ranges, and converting to result objects.
334
+ * @beta
335
+ */
313
336
  class LineLayout {
314
337
  source;
315
338
  range = new core_geometry_1.Range2d(0, 0, 0, 0);
316
339
  justificationRange = new core_geometry_1.Range2d(0, 0, 0, 0);
317
340
  offsetFromDocument = { x: 0, y: 0 };
341
+ lengthFromLastTab = 0; // Used to track the length from the last tab for tab runs.
318
342
  _runs = [];
319
343
  constructor(source) {
320
344
  this.source = source;
@@ -354,6 +378,12 @@ class LineLayout {
354
378
  const runJustificationRange = run.justificationRange?.cloneTranslated(runOffset);
355
379
  this.justificationRange.extendRange(runJustificationRange ?? runLayoutRange);
356
380
  }
381
+ if (run.source.type === "tab") {
382
+ this.lengthFromLastTab = 0;
383
+ }
384
+ else {
385
+ this.lengthFromLastTab += run.range.xLength();
386
+ }
357
387
  }
358
388
  }
359
389
  toResult(textBlock) {
@@ -369,7 +399,9 @@ class LineLayout {
369
399
  exports.LineLayout = LineLayout;
370
400
  /**
371
401
  * Describes the layout of a text block as a collection of lines containing runs.
372
- * @internal
402
+ * Computes the visual layout of the text block, including word wrapping, justification, and margins.
403
+ * Provides access to the computed lines, ranges, and utilities for converting to result objects.
404
+ * @beta
373
405
  */
374
406
  class TextBlockLayout {
375
407
  source;
@@ -393,7 +425,7 @@ class TextBlockLayout {
393
425
  toResult() {
394
426
  return {
395
427
  lines: this.lines.map((x) => x.toResult(this.source)),
396
- range: this.textRange.toJSON(),
428
+ range: this.range.toJSON(),
397
429
  };
398
430
  }
399
431
  /** Compute a string representation, primarily for debugging purposes. */
@@ -426,22 +458,32 @@ class TextBlockLayout {
426
458
  curLine = this.flushLine(context, curLine);
427
459
  continue;
428
460
  }
461
+ // If this is a tab, we need to apply the tab shift first, and then we can treat it like a text run.
462
+ applyTabShift(run, curLine, context);
463
+ // 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.
429
464
  if (!doWrap) {
430
465
  curLine.append(run);
431
466
  continue;
432
467
  }
468
+ // Next, determine if we can append this run to the current line without exceeding the document width
433
469
  const runWidth = run.range.xLength();
434
470
  const lineWidth = curLine.range.xLength();
471
+ // If true, then no word wrapping is required, so we can append to the current line.
435
472
  if (runWidth + lineWidth < doc.width || core_geometry_1.Geometry.isAlmostEqualNumber(runWidth + lineWidth, doc.width, core_geometry_1.Geometry.smallMetricDistance)) {
436
473
  curLine.append(run);
437
474
  continue;
438
475
  }
476
+ // Do word wrapping
439
477
  if (curLine.runs.length === 0) {
440
478
  curLine.append(run);
479
+ // Lastly, flush line
441
480
  curLine = this.flushLine(context, curLine);
442
481
  }
443
482
  else {
483
+ // First, flush line
444
484
  curLine = this.flushLine(context, curLine);
485
+ // Recompute tab shift if applicable
486
+ applyTabShift(run, curLine, context);
445
487
  curLine.append(run);
446
488
  }
447
489
  }
@@ -519,4 +561,4 @@ class TextBlockLayout {
519
561
  }
520
562
  }
521
563
  exports.TextBlockLayout = TextBlockLayout;
522
- //# sourceMappingURL=TextAnnotationLayout.js.map
564
+ //# sourceMappingURL=TextBlockLayout.js.map