@itwin/core-backend 5.1.0-dev.3 → 5.1.0-dev.32

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 (521) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/BisCoreSchema.js +1 -1
  5. package/lib/cjs/BisCoreSchema.js.map +1 -1
  6. package/lib/cjs/BlobContainerService.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 +12 -0
  10. package/lib/cjs/BriefcaseManager.js.map +1 -1
  11. package/lib/cjs/CatalogDb.js.map +1 -1
  12. package/lib/cjs/Category.d.ts +41 -4
  13. package/lib/cjs/Category.d.ts.map +1 -1
  14. package/lib/cjs/Category.js +77 -4
  15. package/lib/cjs/Category.js.map +1 -1
  16. package/lib/cjs/ChangeSummaryManager.js +2 -2
  17. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  18. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  19. package/lib/cjs/ChangesetECAdaptor.js +242 -242
  20. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  21. package/lib/cjs/ChannelControl.js.map +1 -1
  22. package/lib/cjs/CheckpointManager.js.map +1 -1
  23. package/lib/cjs/ClassRegistry.js +5 -5
  24. package/lib/cjs/ClassRegistry.js.map +1 -1
  25. package/lib/cjs/CloudSqlite.js +1 -1
  26. package/lib/cjs/CloudSqlite.js.map +1 -1
  27. package/lib/cjs/CodeService.js.map +1 -1
  28. package/lib/cjs/CodeSpecs.d.ts +1 -1
  29. package/lib/cjs/CodeSpecs.js +1 -1
  30. package/lib/cjs/CodeSpecs.js.map +1 -1
  31. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  32. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  33. package/lib/cjs/DevTools.js.map +1 -1
  34. package/lib/cjs/DisplayStyle.d.ts +9 -4
  35. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  36. package/lib/cjs/DisplayStyle.js +30 -3
  37. package/lib/cjs/DisplayStyle.js.map +1 -1
  38. package/lib/cjs/ECDb.js.map +1 -1
  39. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  40. package/lib/cjs/ECSqlStatement.js.map +1 -1
  41. package/lib/cjs/Element.d.ts +216 -60
  42. package/lib/cjs/Element.d.ts.map +1 -1
  43. package/lib/cjs/Element.js +560 -59
  44. package/lib/cjs/Element.js.map +1 -1
  45. package/lib/cjs/ElementAspect.d.ts +7 -7
  46. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  47. package/lib/cjs/ElementAspect.js +7 -7
  48. package/lib/cjs/ElementAspect.js.map +1 -1
  49. package/lib/cjs/ElementGraphics.js.map +1 -1
  50. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  51. package/lib/cjs/Entity.d.ts +43 -3
  52. package/lib/cjs/Entity.d.ts.map +1 -1
  53. package/lib/cjs/Entity.js +59 -1
  54. package/lib/cjs/Entity.js.map +1 -1
  55. package/lib/cjs/EntityReferences.js.map +1 -1
  56. package/lib/cjs/ExportGraphics.d.ts +54 -8
  57. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  58. package/lib/cjs/ExportGraphics.js +158 -59
  59. package/lib/cjs/ExportGraphics.js.map +1 -1
  60. package/lib/cjs/ExternalSource.js.map +1 -1
  61. package/lib/cjs/FontFile.js.map +1 -1
  62. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  63. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  64. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  65. package/lib/cjs/GeographicCRSServices.js +1 -1
  66. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  67. package/lib/cjs/GeometrySummary.js +47 -47
  68. package/lib/cjs/GeometrySummary.js.map +1 -1
  69. package/lib/cjs/IModelDb.d.ts +28 -43
  70. package/lib/cjs/IModelDb.d.ts.map +1 -1
  71. package/lib/cjs/IModelDb.js +177 -92
  72. package/lib/cjs/IModelDb.js.map +1 -1
  73. package/lib/cjs/IModelDbFonts.js.map +1 -1
  74. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  75. package/lib/cjs/IModelHost.d.ts +13 -0
  76. package/lib/cjs/IModelHost.d.ts.map +1 -1
  77. package/lib/cjs/IModelHost.js +6 -0
  78. package/lib/cjs/IModelHost.js.map +1 -1
  79. package/lib/cjs/IModelJsFs.js.map +1 -1
  80. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  81. package/lib/cjs/IpcHost.js.map +1 -1
  82. package/lib/cjs/LineStyle.js.map +1 -1
  83. package/lib/cjs/LocalHub.js +1 -1
  84. package/lib/cjs/LocalHub.js.map +1 -1
  85. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  86. package/lib/cjs/LockControl.js.map +1 -1
  87. package/lib/cjs/Material.d.ts +19 -0
  88. package/lib/cjs/Material.d.ts.map +1 -1
  89. package/lib/cjs/Material.js +29 -0
  90. package/lib/cjs/Material.js.map +1 -1
  91. package/lib/cjs/Model.d.ts +64 -28
  92. package/lib/cjs/Model.d.ts.map +1 -1
  93. package/lib/cjs/Model.js +115 -27
  94. package/lib/cjs/Model.js.map +1 -1
  95. package/lib/cjs/NativeAppStorage.js.map +1 -1
  96. package/lib/cjs/NativeHost.js.map +1 -1
  97. package/lib/cjs/NavigationRelationship.js.map +1 -1
  98. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  99. package/lib/cjs/PropertyStore.js.map +1 -1
  100. package/lib/cjs/Relationship.js.map +1 -1
  101. package/lib/cjs/RpcBackend.js.map +1 -1
  102. package/lib/cjs/SQLiteDb.js.map +1 -1
  103. package/lib/cjs/Schema.js.map +1 -1
  104. package/lib/cjs/SchemaSync.js.map +1 -1
  105. package/lib/cjs/SchemaUtils.js.map +1 -1
  106. package/lib/cjs/SheetIndex.js.map +1 -1
  107. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  108. package/lib/cjs/SqliteStatement.js.map +1 -1
  109. package/lib/cjs/Texture.d.ts +1 -1
  110. package/lib/cjs/Texture.js +1 -1
  111. package/lib/cjs/Texture.js.map +1 -1
  112. package/lib/cjs/TileStorage.js.map +1 -1
  113. package/lib/cjs/TxnManager.d.ts +4 -4
  114. package/lib/cjs/TxnManager.d.ts.map +1 -1
  115. package/lib/cjs/TxnManager.js +2 -1
  116. package/lib/cjs/TxnManager.js.map +1 -1
  117. package/lib/cjs/ViewDefinition.d.ts +140 -14
  118. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  119. package/lib/cjs/ViewDefinition.js +250 -14
  120. package/lib/cjs/ViewDefinition.js.map +1 -1
  121. package/lib/cjs/ViewStateHydrator.js +3 -3
  122. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  123. package/lib/cjs/ViewStore.js.map +1 -1
  124. package/lib/cjs/annotations/FrameGeometry.d.ts +52 -0
  125. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  126. package/lib/cjs/annotations/FrameGeometry.js +250 -0
  127. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  128. package/lib/cjs/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  129. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  130. package/lib/cjs/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +20 -26
  131. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  132. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +31 -0
  133. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  134. package/lib/cjs/annotations/TextAnnotationGeometry.js +83 -0
  135. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  136. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  137. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  138. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +11 -68
  139. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  140. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
  141. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  142. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
  143. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  144. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  145. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  146. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  147. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  148. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  149. package/lib/cjs/core-backend.d.ts +5 -3
  150. package/lib/cjs/core-backend.d.ts.map +1 -1
  151. package/lib/cjs/core-backend.js +5 -6
  152. package/lib/cjs/core-backend.js.map +1 -1
  153. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  154. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  155. package/lib/cjs/domains/GenericElements.js.map +1 -1
  156. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  157. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  158. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  159. package/lib/cjs/internal/ElementLRUCache.d.ts +28 -0
  160. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
  161. package/lib/cjs/internal/ElementLRUCache.js +120 -0
  162. package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
  163. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  164. package/lib/cjs/internal/HubMock.js.map +1 -1
  165. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  166. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  167. package/lib/cjs/internal/NoLocks.js.map +1 -1
  168. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  169. package/lib/cjs/internal/Symbols.d.ts +1 -0
  170. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  171. package/lib/cjs/internal/Symbols.js +2 -1
  172. package/lib/cjs/internal/Symbols.js.map +1 -1
  173. package/lib/cjs/internal/cross-package.js.map +1 -1
  174. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  175. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  176. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  177. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  178. package/lib/cjs/rpc/multipart.js.map +1 -1
  179. package/lib/cjs/rpc/tracing.js.map +1 -1
  180. package/lib/cjs/rpc/web/logging.js.map +1 -1
  181. package/lib/cjs/rpc/web/request.js.map +1 -1
  182. package/lib/cjs/rpc/web/response.js.map +1 -1
  183. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  184. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +2 -2
  185. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  186. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  187. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  188. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  189. package/lib/cjs/workspace/Settings.js.map +1 -1
  190. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  191. package/lib/cjs/workspace/Workspace.js.map +1 -1
  192. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  193. package/lib/esm/BackendHubAccess.js.map +1 -1
  194. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  195. package/lib/esm/BisCoreSchema.js +1 -1
  196. package/lib/esm/BisCoreSchema.js.map +1 -1
  197. package/lib/esm/BlobContainerService.js.map +1 -1
  198. package/lib/esm/BriefcaseManager.d.ts +10 -2
  199. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  200. package/lib/esm/BriefcaseManager.js +12 -0
  201. package/lib/esm/BriefcaseManager.js.map +1 -1
  202. package/lib/esm/CatalogDb.js.map +1 -1
  203. package/lib/esm/Category.d.ts +41 -4
  204. package/lib/esm/Category.d.ts.map +1 -1
  205. package/lib/esm/Category.js +77 -4
  206. package/lib/esm/Category.js.map +1 -1
  207. package/lib/esm/ChangeSummaryManager.js +2 -2
  208. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  209. package/lib/esm/ChangedElementsDb.js.map +1 -1
  210. package/lib/esm/ChangesetECAdaptor.js +242 -242
  211. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  212. package/lib/esm/ChannelControl.js.map +1 -1
  213. package/lib/esm/CheckpointManager.js.map +1 -1
  214. package/lib/esm/ClassRegistry.js +5 -5
  215. package/lib/esm/ClassRegistry.js.map +1 -1
  216. package/lib/esm/CloudSqlite.js +1 -1
  217. package/lib/esm/CloudSqlite.js.map +1 -1
  218. package/lib/esm/CodeService.js.map +1 -1
  219. package/lib/esm/CodeSpecs.d.ts +1 -1
  220. package/lib/esm/CodeSpecs.js +1 -1
  221. package/lib/esm/CodeSpecs.js.map +1 -1
  222. package/lib/esm/ConcurrentQuery.js.map +1 -1
  223. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  224. package/lib/esm/DevTools.js.map +1 -1
  225. package/lib/esm/DisplayStyle.d.ts +9 -4
  226. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  227. package/lib/esm/DisplayStyle.js +30 -3
  228. package/lib/esm/DisplayStyle.js.map +1 -1
  229. package/lib/esm/ECDb.js.map +1 -1
  230. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  231. package/lib/esm/ECSqlStatement.js.map +1 -1
  232. package/lib/esm/Element.d.ts +216 -60
  233. package/lib/esm/Element.d.ts.map +1 -1
  234. package/lib/esm/Element.js +563 -62
  235. package/lib/esm/Element.js.map +1 -1
  236. package/lib/esm/ElementAspect.d.ts +7 -7
  237. package/lib/esm/ElementAspect.d.ts.map +1 -1
  238. package/lib/esm/ElementAspect.js +7 -7
  239. package/lib/esm/ElementAspect.js.map +1 -1
  240. package/lib/esm/ElementGraphics.js.map +1 -1
  241. package/lib/esm/ElementTreeWalker.js.map +1 -1
  242. package/lib/esm/Entity.d.ts +43 -3
  243. package/lib/esm/Entity.d.ts.map +1 -1
  244. package/lib/esm/Entity.js +59 -1
  245. package/lib/esm/Entity.js.map +1 -1
  246. package/lib/esm/EntityReferences.js.map +1 -1
  247. package/lib/esm/ExportGraphics.d.ts +54 -8
  248. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  249. package/lib/esm/ExportGraphics.js +156 -58
  250. package/lib/esm/ExportGraphics.js.map +1 -1
  251. package/lib/esm/ExternalSource.js.map +1 -1
  252. package/lib/esm/FontFile.js.map +1 -1
  253. package/lib/esm/GeoCoordConfig.js.map +1 -1
  254. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  255. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  256. package/lib/esm/GeographicCRSServices.js +1 -1
  257. package/lib/esm/GeographicCRSServices.js.map +1 -1
  258. package/lib/esm/GeometrySummary.js +47 -47
  259. package/lib/esm/GeometrySummary.js.map +1 -1
  260. package/lib/esm/IModelDb.d.ts +28 -43
  261. package/lib/esm/IModelDb.d.ts.map +1 -1
  262. package/lib/esm/IModelDb.js +180 -95
  263. package/lib/esm/IModelDb.js.map +1 -1
  264. package/lib/esm/IModelDbFonts.js.map +1 -1
  265. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  266. package/lib/esm/IModelHost.d.ts +13 -0
  267. package/lib/esm/IModelHost.d.ts.map +1 -1
  268. package/lib/esm/IModelHost.js +6 -0
  269. package/lib/esm/IModelHost.js.map +1 -1
  270. package/lib/esm/IModelJsFs.js.map +1 -1
  271. package/lib/esm/ImageSourceConversion.js.map +1 -1
  272. package/lib/esm/IpcHost.js.map +1 -1
  273. package/lib/esm/LineStyle.js.map +1 -1
  274. package/lib/esm/LocalHub.js +1 -1
  275. package/lib/esm/LocalHub.js.map +1 -1
  276. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  277. package/lib/esm/LockControl.js.map +1 -1
  278. package/lib/esm/Material.d.ts +19 -0
  279. package/lib/esm/Material.d.ts.map +1 -1
  280. package/lib/esm/Material.js +30 -1
  281. package/lib/esm/Material.js.map +1 -1
  282. package/lib/esm/Model.d.ts +64 -28
  283. package/lib/esm/Model.d.ts.map +1 -1
  284. package/lib/esm/Model.js +116 -28
  285. package/lib/esm/Model.js.map +1 -1
  286. package/lib/esm/NativeAppStorage.js.map +1 -1
  287. package/lib/esm/NativeHost.js.map +1 -1
  288. package/lib/esm/NavigationRelationship.js.map +1 -1
  289. package/lib/esm/PromiseMemoizer.js.map +1 -1
  290. package/lib/esm/PropertyStore.js.map +1 -1
  291. package/lib/esm/Relationship.js.map +1 -1
  292. package/lib/esm/RpcBackend.js.map +1 -1
  293. package/lib/esm/SQLiteDb.js.map +1 -1
  294. package/lib/esm/Schema.js.map +1 -1
  295. package/lib/esm/SchemaSync.js.map +1 -1
  296. package/lib/esm/SchemaUtils.js.map +1 -1
  297. package/lib/esm/SheetIndex.js.map +1 -1
  298. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  299. package/lib/esm/SqliteStatement.js.map +1 -1
  300. package/lib/esm/Texture.d.ts +1 -1
  301. package/lib/esm/Texture.js +1 -1
  302. package/lib/esm/Texture.js.map +1 -1
  303. package/lib/esm/TileStorage.js.map +1 -1
  304. package/lib/esm/TxnManager.d.ts +4 -4
  305. package/lib/esm/TxnManager.d.ts.map +1 -1
  306. package/lib/esm/TxnManager.js +2 -1
  307. package/lib/esm/TxnManager.js.map +1 -1
  308. package/lib/esm/ViewDefinition.d.ts +140 -14
  309. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  310. package/lib/esm/ViewDefinition.js +251 -15
  311. package/lib/esm/ViewDefinition.js.map +1 -1
  312. package/lib/esm/ViewStateHydrator.js +3 -3
  313. package/lib/esm/ViewStateHydrator.js.map +1 -1
  314. package/lib/esm/ViewStore.js.map +1 -1
  315. package/lib/esm/annotations/FrameGeometry.d.ts +52 -0
  316. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  317. package/lib/esm/annotations/FrameGeometry.js +245 -0
  318. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  319. package/lib/esm/{TextAnnotationElement.d.ts → annotations/TextAnnotationElement.d.ts} +6 -11
  320. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  321. package/lib/esm/{TextAnnotationElement.js → annotations/TextAnnotationElement.js} +22 -28
  322. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  323. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +31 -0
  324. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  325. package/lib/esm/annotations/TextAnnotationGeometry.js +80 -0
  326. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  327. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  328. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  329. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +11 -68
  330. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  331. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +19 -7
  332. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  333. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +19 -7
  334. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  335. package/lib/esm/core-backend.d.ts +5 -3
  336. package/lib/esm/core-backend.d.ts.map +1 -1
  337. package/lib/esm/core-backend.js +5 -3
  338. package/lib/esm/core-backend.js.map +1 -1
  339. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  340. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  341. package/lib/esm/domains/GenericElements.js.map +1 -1
  342. package/lib/esm/domains/GenericSchema.js.map +1 -1
  343. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  344. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  345. package/lib/esm/internal/ElementLRUCache.d.ts +28 -0
  346. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
  347. package/lib/esm/internal/ElementLRUCache.js +116 -0
  348. package/lib/esm/internal/ElementLRUCache.js.map +1 -0
  349. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  350. package/lib/esm/internal/HubMock.js.map +1 -1
  351. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  352. package/lib/esm/internal/NativePlatform.js.map +1 -1
  353. package/lib/esm/internal/NoLocks.js.map +1 -1
  354. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  355. package/lib/esm/internal/Symbols.d.ts +1 -0
  356. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  357. package/lib/esm/internal/Symbols.js +1 -0
  358. package/lib/esm/internal/Symbols.js.map +1 -1
  359. package/lib/esm/internal/cross-package.js.map +1 -1
  360. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  361. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  362. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  363. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  364. package/lib/esm/rpc/multipart.js.map +1 -1
  365. package/lib/esm/rpc/tracing.js.map +1 -1
  366. package/lib/esm/rpc/web/logging.js.map +1 -1
  367. package/lib/esm/rpc/web/request.js.map +1 -1
  368. package/lib/esm/rpc/web/response.js.map +1 -1
  369. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  370. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +2 -2
  371. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  372. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  373. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  374. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  375. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  376. package/lib/esm/test/AttachDb.test.js +11 -11
  377. package/lib/esm/test/AttachDb.test.js.map +1 -1
  378. package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
  379. package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
  380. package/lib/esm/test/ElementLRUCache.test.js +212 -0
  381. package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
  382. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  383. package/lib/esm/test/IModelHost.test.js.map +1 -1
  384. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  385. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  386. package/lib/esm/test/IpcHost.test.js.map +1 -1
  387. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  388. package/lib/esm/test/PrintElementTree.js.map +1 -1
  389. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  390. package/lib/esm/test/RevisionUtility.js.map +1 -1
  391. package/lib/esm/test/SchemaUtils.test.js +25 -25
  392. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  393. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  394. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  395. package/lib/esm/test/TestUtils.js.map +1 -1
  396. package/lib/esm/test/annotations/TextAnnotation.test.js +190 -1025
  397. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  398. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  399. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  400. package/lib/esm/test/annotations/TextBlock.test.js +969 -0
  401. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  402. package/lib/esm/test/categories/Category.test.js.map +1 -1
  403. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  404. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  405. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  406. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  407. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  408. package/lib/esm/test/ecdb/ECDb.test.js +86 -65
  409. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  410. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  411. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  412. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  413. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  414. package/lib/esm/test/ecdb/ECSqlQuery.test.js +7 -30
  415. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  416. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  417. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  418. package/lib/esm/test/ecdb/ECSqlStatement.test.js +292 -292
  419. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  420. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  421. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  422. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  423. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  424. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  425. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  426. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  427. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  428. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  429. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  430. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  431. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  432. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  433. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  434. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  435. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  436. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  437. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  438. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  439. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  440. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  441. package/lib/esm/test/imageData.js.map +1 -1
  442. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  443. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  444. package/lib/esm/test/imodel/IModel.test.js +68 -16
  445. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  446. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  447. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  448. package/lib/esm/test/index.js.map +1 -1
  449. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  450. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  451. package/lib/esm/test/misc/GeoServices.test.js +23 -9
  452. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  453. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  454. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  455. package/lib/esm/test/rpc/response.test.js.map +1 -1
  456. package/lib/esm/test/schema/ClassRegistry.test.js +71 -71
  457. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  458. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  459. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  460. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  461. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  462. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  463. package/lib/esm/test/standalone/ChangesetReader.test.js +28 -28
  464. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  465. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  466. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  467. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  468. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  469. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  470. package/lib/esm/test/standalone/ExportGraphics.test.js +67 -15
  471. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  472. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  473. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  474. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  475. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  476. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  477. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  478. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  479. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  480. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  481. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  482. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  483. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  484. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  485. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  486. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  487. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  488. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  489. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  490. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  491. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  492. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  493. package/lib/esm/test/standalone/SnapshotDb.test.js +20 -1
  494. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  495. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  496. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  497. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  498. package/lib/esm/test/standalone/TxnManager.test.js +1 -1
  499. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  500. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  501. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  502. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  503. package/lib/esm/workspace/Settings.js.map +1 -1
  504. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  505. package/lib/esm/workspace/Workspace.js.map +1 -1
  506. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  507. package/package.json +12 -12
  508. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  509. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  510. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  511. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  512. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  513. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  514. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  515. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  516. package/lib/esm/TextAnnotationElement.js.map +0 -1
  517. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  518. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  519. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  520. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  521. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ /** @packageDocumentation
2
+ * @module ElementGeometry
3
+ */
4
+ import { ElementGeometry, GeometryParams, TextAnnotationFrameShape, TextFrameStyleProps } from "@itwin/core-common";
5
+ import { Loop, Path, Point3d, Range2d, Transform } from "@itwin/core-geometry";
6
+ /**
7
+ * Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.
8
+ * @param builder that will be appended to in place
9
+ * @param category to which the frame belongs, used for the [[GeometryParams]].
10
+ * @param frame
11
+ * @param range to enclose with the frame
12
+ * @param transform that transform the range to world coordinates
13
+ * @returns `true` if any geometry was appended to the builder
14
+ * @beta
15
+ */
16
+ export declare function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform, geomParams: GeometryParams): boolean;
17
+ /**
18
+ * Arguments for the [[computeFrame]] method.
19
+ * @beta
20
+ */
21
+ export interface ComputeFrameArgs {
22
+ /** Frame shape to be calculated */
23
+ frame: Exclude<TextAnnotationFrameShape, "none">;
24
+ /** Range to be enclosed */
25
+ range: Range2d;
26
+ /** Transform that translates and rotates the range to world coordinates */
27
+ transform: Transform;
28
+ }
29
+ /**
30
+ * Computes the frame geometry based on the provided frame shape and range.
31
+ * @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry
32
+ * @beta
33
+ */
34
+ export declare function computeFrame(args: ComputeFrameArgs): Loop | Path;
35
+ /**
36
+ * Arguments for the [[computeIntervalPoints]] method.
37
+ * @beta
38
+ */
39
+ export interface ComputeIntervalPointsArgs extends ComputeFrameArgs {
40
+ /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */
41
+ lineIntervalFactor?: number;
42
+ /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */
43
+ arcIntervalFactor?: number;
44
+ }
45
+ /**
46
+ * Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.
47
+ * These can be used for snapping or attaching leaders.
48
+ * @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.
49
+ * @beta
50
+ */
51
+ export declare function computeIntervalPoints({ frame, range, transform, lineIntervalFactor, arcIntervalFactor }: ComputeIntervalPointsArgs): Point3d[] | undefined;
52
+ //# sourceMappingURL=FrameGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/FrameGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAA4B,eAAe,EAAe,cAAc,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC3J,OAAO,EAA0C,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AAEjI;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,GAAG,OAAO,CAsC5K;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACjD,2BAA2B;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAehE;AAED;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE,4GAA4G;IAC5G,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAwB,EAAE,iBAAwB,EAAE,EAAE,yBAAyB,GAAG,OAAO,EAAE,GAAG,SAAS,CAWvK"}
@@ -0,0 +1,250 @@
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.appendFrameToBuilder = appendFrameToBuilder;
11
+ exports.computeFrame = computeFrame;
12
+ exports.computeIntervalPoints = computeIntervalPoints;
13
+ const core_common_1 = require("@itwin/core-common");
14
+ const core_geometry_1 = require("@itwin/core-geometry");
15
+ /**
16
+ * Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.
17
+ * @param builder that will be appended to in place
18
+ * @param category to which the frame belongs, used for the [[GeometryParams]].
19
+ * @param frame
20
+ * @param range to enclose with the frame
21
+ * @param transform that transform the range to world coordinates
22
+ * @returns `true` if any geometry was appended to the builder
23
+ * @beta
24
+ */
25
+ function appendFrameToBuilder(builder, frame, range, transform, geomParams) {
26
+ if (undefined === frame.shape || frame.shape === "none") {
27
+ return false;
28
+ }
29
+ const params = geomParams.clone();
30
+ if (frame.fill === undefined) {
31
+ params.fillDisplay = core_common_1.FillDisplay.Never;
32
+ }
33
+ else if (frame.fill === "background") {
34
+ params.backgroundFill = core_common_1.BackgroundFill.Solid;
35
+ params.fillDisplay = core_common_1.FillDisplay.Blanking;
36
+ }
37
+ else if (frame.fill !== "subcategory") {
38
+ params.fillColor = core_common_1.ColorDef.fromJSON(frame.fill);
39
+ params.lineColor = params.fillColor;
40
+ params.fillDisplay = core_common_1.FillDisplay.Blanking;
41
+ }
42
+ if (frame.border !== "subcategory") {
43
+ params.lineColor = core_common_1.ColorDef.fromJSON(frame.border);
44
+ params.weight = frame.borderWeight;
45
+ }
46
+ const frameGeometry = computeFrame({ frame: frame.shape, range, transform });
47
+ if (!builder.appendGeometryParamsChange(params) || !builder.appendGeometryQuery(frameGeometry)) {
48
+ return false;
49
+ }
50
+ // The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.
51
+ if (params.fillDisplay === core_common_1.FillDisplay.Blanking) {
52
+ const outlineParams = params.clone();
53
+ outlineParams.fillDisplay = core_common_1.FillDisplay.Never;
54
+ if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {
55
+ return false;
56
+ }
57
+ }
58
+ return true;
59
+ }
60
+ /**
61
+ * Computes the frame geometry based on the provided frame shape and range.
62
+ * @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry
63
+ * @beta
64
+ */
65
+ function computeFrame(args) {
66
+ switch (args.frame) {
67
+ case "line": return computeLine(args.range, args.transform);
68
+ case "rectangle": return computeRectangle(args.range, args.transform);
69
+ case "circle": return computeCircle(args.range, args.transform);
70
+ case "equilateralTriangle": return computeTriangle(args.range, args.transform);
71
+ case "diamond": return computeDiamond(args.range, args.transform);
72
+ case "square": return computeSquare(args.range, args.transform);
73
+ case "pentagon": return computePolygon(5, args.range, args.transform, 90);
74
+ case "hexagon": return computePolygon(6, args.range, args.transform);
75
+ case "octagon": return computePolygon(8, args.range, args.transform, 180 / 8); // or pi/8 in radians
76
+ case "capsule": return computeCapsule(args.range, args.transform);
77
+ case "roundedRectangle": return computeRoundedRectangle(args.range, args.transform);
78
+ default: return computeRectangle(args.range, args.transform);
79
+ }
80
+ }
81
+ /**
82
+ * Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.
83
+ * These can be used for snapping or attaching leaders.
84
+ * @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.
85
+ * @beta
86
+ */
87
+ function computeIntervalPoints({ frame, range, transform, lineIntervalFactor = 0.5, arcIntervalFactor = 0.25 }) {
88
+ const points = [];
89
+ const curves = computeFrame({ frame, range, transform }).collectCurvePrimitives(undefined, false, true);
90
+ curves.forEach((curve) => {
91
+ const end = curve instanceof core_geometry_1.Arc3d ? arcIntervalFactor : lineIntervalFactor;
92
+ for (let interval = 0; interval <= 1; interval += end) {
93
+ points.push(curve.fractionToPoint(interval));
94
+ }
95
+ });
96
+ return points;
97
+ }
98
+ /** Line - currently just adds an underline. Once we have leaders, this method may change. */
99
+ const computeLine = (range, transform) => {
100
+ const points = [core_geometry_1.Point3d.create(range.low.x, range.low.y), core_geometry_1.Point3d.create(range.high.x, range.low.y)];
101
+ const frame = core_geometry_1.LineString3d.createPoints(points);
102
+ return core_geometry_1.Path.create(frame.cloneTransformed(transform));
103
+ };
104
+ /** Rectangle - simplest frame */
105
+ const computeRectangle = (range, transform) => {
106
+ const points = range.corners3d(true);
107
+ const frame = core_geometry_1.LineString3d.createPoints(points);
108
+ return core_geometry_1.Loop.create(frame.cloneTransformed(transform));
109
+ };
110
+ /** Rounded Rectangle: each corner will be turned into an arc with the radius of the arc being the @param radiusFactor * the height (yLength) of the range */
111
+ const computeRoundedRectangle = (range, transform, radiusFactor = 0.25) => {
112
+ const radius = range.yLength() * radiusFactor * Math.sqrt(2);
113
+ // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.
114
+ const radiusOffsetFactor = range.yLength() * radiusFactor;
115
+ // These values are the origins of the circles
116
+ const inLeft = range.low.x + radiusOffsetFactor;
117
+ const inRight = range.high.x - radiusOffsetFactor;
118
+ const inBottom = range.low.y + radiusOffsetFactor;
119
+ const inTop = range.high.y - radiusOffsetFactor;
120
+ // These values exist on the circles
121
+ const exLeft = inLeft - radius;
122
+ const exRight = inRight + radius;
123
+ const exBottom = inBottom - radius;
124
+ const exTop = inTop + radius;
125
+ const q1 = core_geometry_1.AngleSweep.createStartEndDegrees(0, 90);
126
+ const q2 = core_geometry_1.AngleSweep.createStartEndDegrees(90, 180);
127
+ const q3 = core_geometry_1.AngleSweep.createStartEndDegrees(180, 270);
128
+ const q4 = core_geometry_1.AngleSweep.createStartEndDegrees(270, 360);
129
+ const curves = [
130
+ core_geometry_1.LineString3d.create([core_geometry_1.Point3d.create(inLeft, exTop), core_geometry_1.Point3d.create(inRight, exTop)]), // top
131
+ core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.create(inLeft, inTop), radius, q2), // top left
132
+ core_geometry_1.LineString3d.create([core_geometry_1.Point3d.create(exLeft, inBottom), core_geometry_1.Point3d.create(exLeft, inTop)]), // left
133
+ core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.create(inLeft, inBottom), radius, q3), // bottom left
134
+ core_geometry_1.LineString3d.create([core_geometry_1.Point3d.create(inLeft, exBottom), core_geometry_1.Point3d.create(inRight, exBottom)]), // bottom
135
+ core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.create(inRight, inBottom), radius, q4), // bottom right
136
+ core_geometry_1.LineString3d.create([core_geometry_1.Point3d.create(exRight, inBottom), core_geometry_1.Point3d.create(exRight, inTop)]), // right
137
+ core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.create(inRight, inTop), radius, q1), // top right
138
+ ];
139
+ return core_geometry_1.Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));
140
+ };
141
+ /** Circle */
142
+ const computeCircle = (range, transform) => {
143
+ const radius = range.low.distance(range.high) / 2;
144
+ const frame = core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.createFrom(range.center), radius);
145
+ return core_geometry_1.Loop.create(frame.cloneTransformed(transform));
146
+ };
147
+ /** Equilateral Triangle */
148
+ const computeTriangle = (range, transform) => {
149
+ const xLength = range.xLength();
150
+ const yLength = range.yLength();
151
+ const center = range.center;
152
+ const points = [];
153
+ const magnitude = (xLength > yLength) ? (xLength * Math.sqrt(3) + yLength) / 2 : (yLength * Math.sqrt(3) + xLength) / 2;
154
+ const v1 = core_geometry_1.Vector2d.create(0, magnitude);
155
+ const vectors = [
156
+ v1, // top
157
+ v1.rotateXY(core_geometry_1.Angle.createDegrees(120)), // left
158
+ v1.rotateXY(core_geometry_1.Angle.createDegrees(240)), // right
159
+ v1 // top
160
+ ];
161
+ vectors.forEach((v) => {
162
+ points.push(core_geometry_1.Point3d.create(center.x + v.x, center.y + v.y));
163
+ });
164
+ const frame = core_geometry_1.LineString3d.createPoints(points);
165
+ return core_geometry_1.Loop.create(frame.cloneTransformed(transform));
166
+ };
167
+ /** Diamond (square rotated 45 degrees) */
168
+ const computeDiamond = (range, transform) => {
169
+ const offset = (range.xLength() + range.yLength()) / 2;
170
+ const center = range.center;
171
+ const points = [
172
+ core_geometry_1.Point3d.createFrom({ x: center.x, y: center.y + offset }), // top
173
+ core_geometry_1.Point3d.createFrom({ x: center.x + offset, y: center.y }), // right
174
+ core_geometry_1.Point3d.createFrom({ x: center.x, y: center.y - offset }), // bottom
175
+ core_geometry_1.Point3d.createFrom({ x: center.x - offset, y: center.y }), // left
176
+ core_geometry_1.Point3d.createFrom({ x: center.x, y: center.y + offset }), // top
177
+ ];
178
+ const frame = core_geometry_1.LineString3d.createPoints(points);
179
+ return core_geometry_1.Loop.create(frame.cloneTransformed(transform));
180
+ };
181
+ /** Square */
182
+ const computeSquare = (range, transform) => {
183
+ // Extend range
184
+ const xLength = range.xLength() / 2;
185
+ const yLength = range.yLength() / 2;
186
+ const center = range.center;
187
+ if (xLength > yLength) {
188
+ range.extendPoint({ x: center.x, y: center.y + xLength });
189
+ range.extendPoint({ x: center.x, y: center.y - xLength });
190
+ }
191
+ else {
192
+ range.extendPoint({ x: center.x + yLength, y: center.y });
193
+ range.extendPoint({ x: center.x - yLength, y: center.y });
194
+ }
195
+ const points = range.corners3d(true);
196
+ const frame = core_geometry_1.LineString3d.createPoints(points);
197
+ return core_geometry_1.Loop.create(frame.cloneTransformed(transform));
198
+ };
199
+ /** Capsule (or pill shape) */
200
+ const computeCapsule = (range, transform) => {
201
+ const height = range.yLength();
202
+ const radius = height * (Math.sqrt(2) / 2);
203
+ // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.
204
+ const radiusOffsetFactor = height / 2;
205
+ // These values are the origins of the circles
206
+ const inLeft = range.low.x + radiusOffsetFactor;
207
+ const inRight = range.high.x - radiusOffsetFactor;
208
+ const inBottom = range.low.y + radiusOffsetFactor;
209
+ const inTop = range.high.y - radiusOffsetFactor;
210
+ // These values exist on the circles
211
+ const exBottom = inBottom - radius;
212
+ const exTop = inTop + radius;
213
+ const leftHalfCircle = core_geometry_1.AngleSweep.createStartEndDegrees(90, 270);
214
+ const rightHalfCircle = core_geometry_1.AngleSweep.createStartEndDegrees(-90, 90);
215
+ const curves = [
216
+ core_geometry_1.LineString3d.create([core_geometry_1.Point3d.create(inLeft, exTop), core_geometry_1.Point3d.create(inRight, exTop)]), // top
217
+ core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.create(inLeft, range.center.y), radius, leftHalfCircle), // left
218
+ core_geometry_1.LineString3d.create([core_geometry_1.Point3d.create(inLeft, exBottom), core_geometry_1.Point3d.create(inRight, exBottom)]), // bottom
219
+ core_geometry_1.Arc3d.createXY(core_geometry_1.Point3d.create(inRight, range.center.y), radius, rightHalfCircle), // right
220
+ ];
221
+ return core_geometry_1.Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));
222
+ };
223
+ /** Regular polygon with n sides: note, this a generic method that can be used to create any polygon, but the frame will not be as tightly encapsulating. */
224
+ const computePolygon = (n, range, transform, angleOffset = 0) => {
225
+ // These are math terms: cspell:ignore inradius circumradius
226
+ if (n < 3)
227
+ throw new Error("A polygon must have at least 3 sides.");
228
+ // We're assuming the polygon is a regular polygon with `n` sides.
229
+ // The center of the polygon is the center of the range.
230
+ const center = range.center;
231
+ // The inradius is the distance from the center to the midpoint of each side of the polygon. On our range, this coincides with the distance from the center to one of its corners.
232
+ const inradius = range.low.distance(range.high) / 2;
233
+ // The circumradius is the distance from the center to each vertex of the polygon.
234
+ const circumradius = inradius / Math.cos(Math.PI / n);
235
+ // The exterior angles add up to 360 degrees.
236
+ const angleIncrement = 360 / n;
237
+ const vertices = [];
238
+ // Add a point for each vertex
239
+ for (let i = 0; i < n; i++) {
240
+ const angle = core_geometry_1.Angle.createDegrees(i * angleIncrement + angleOffset);
241
+ const vector = core_geometry_1.Vector2d.createPolar(circumradius, angle);
242
+ vertices.push(core_geometry_1.Point3d.create(center.x + vector.x, center.y + vector.y));
243
+ }
244
+ // Close the polygon
245
+ vertices.push(vertices[0]);
246
+ // Finally compute the loop!
247
+ const frame = core_geometry_1.LineString3d.createPoints(vertices);
248
+ return core_geometry_1.Loop.create(frame.cloneTransformed(transform));
249
+ };
250
+ //# sourceMappingURL=FrameGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameGeometry.js","sourceRoot":"","sources":["../../../src/annotations/FrameGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAgBH,oDAsCC;AAoBD,oCAeC;AAmBD,sDAWC;AApHD,oDAA2J;AAC3J,wDAAiI;AAEjI;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAAC,OAAgC,EAAE,KAA0B,EAAE,KAAc,EAAE,SAAoB,EAAE,UAA0B;IACjK,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAElC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,WAAW,GAAG,yBAAW,CAAC,KAAK,CAAC;IACzC,CAAC;SAAM,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACvC,MAAM,CAAC,cAAc,GAAG,4BAAc,CAAC,KAAK,CAAC;QAC7C,MAAM,CAAC,WAAW,GAAG,yBAAW,CAAC,QAAQ,CAAC;IAC5C,CAAC;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G,4BAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,oBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;AACxD,CAAC,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\n\r\nimport { BackgroundFill, ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotationFrameShape, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { Angle, AngleSweep, Arc3d, LineString3d, Loop, Path, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\r\n\r\n/**\r\n * Based on the frame style, this method will construct and append [[GeometryParams]] (for line style) and a [[Loop]] (for the frame shape) to the builder.\r\n * @param builder that will be appended to in place\r\n * @param category to which the frame belongs, used for the [[GeometryParams]].\r\n * @param frame\r\n * @param range to enclose with the frame\r\n * @param transform that transform the range to world coordinates\r\n * @returns `true` if any geometry was appended to the builder\r\n* @beta\r\n */\r\nexport function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform, geomParams: GeometryParams): boolean {\r\n if (undefined === frame.shape || frame.shape === \"none\") {\r\n return false;\r\n }\r\n\r\n const params = geomParams.clone();\r\n\r\n if (frame.fill === undefined) {\r\n params.fillDisplay = FillDisplay.Never;\r\n } else if (frame.fill === \"background\") {\r\n params.backgroundFill = BackgroundFill.Solid;\r\n params.fillDisplay = FillDisplay.Blanking;\r\n } else if (frame.fill !== \"subcategory\") {\r\n params.fillColor = ColorDef.fromJSON(frame.fill);\r\n params.lineColor = params.fillColor;\r\n params.fillDisplay = FillDisplay.Blanking;\r\n }\r\n\r\n if (frame.border !== \"subcategory\") {\r\n params.lineColor = ColorDef.fromJSON(frame.border);\r\n params.weight = frame.borderWeight;\r\n }\r\n\r\n const frameGeometry = computeFrame({ frame: frame.shape, range, transform });\r\n if (!builder.appendGeometryParamsChange(params) || !builder.appendGeometryQuery(frameGeometry)) {\r\n return false;\r\n }\r\n\r\n // The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.\r\n if (params.fillDisplay === FillDisplay.Blanking) {\r\n const outlineParams = params.clone();\r\n outlineParams.fillDisplay = FillDisplay.Never;\r\n if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Arguments for the [[computeFrame]] method.\r\n * @beta\r\n */\r\nexport interface ComputeFrameArgs {\r\n /** Frame shape to be calculated */\r\n frame: Exclude<TextAnnotationFrameShape, \"none\">;\r\n /** Range to be enclosed */\r\n range: Range2d;\r\n /** Transform that translates and rotates the range to world coordinates */\r\n transform: Transform;\r\n}\r\n\r\n/**\r\n * Computes the frame geometry based on the provided frame shape and range.\r\n * @returns a [Loop]($geometry) or [Path]($geometry) (if it's just a line) that represents the frame geometry\r\n * @beta\r\n */\r\nexport function computeFrame(args: ComputeFrameArgs): Loop | Path {\r\n switch (args.frame) {\r\n case \"line\": return computeLine(args.range, args.transform);\r\n case \"rectangle\": return computeRectangle(args.range, args.transform);\r\n case \"circle\": return computeCircle(args.range, args.transform);\r\n case \"equilateralTriangle\": return computeTriangle(args.range, args.transform);\r\n case \"diamond\": return computeDiamond(args.range, args.transform);\r\n case \"square\": return computeSquare(args.range, args.transform);\r\n case \"pentagon\": return computePolygon(5, args.range, args.transform, 90);\r\n case \"hexagon\": return computePolygon(6, args.range, args.transform);\r\n case \"octagon\": return computePolygon(8, args.range, args.transform, 180 / 8); // or pi/8 in radians\r\n case \"capsule\": return computeCapsule(args.range, args.transform);\r\n case \"roundedRectangle\": return computeRoundedRectangle(args.range, args.transform);\r\n default: return computeRectangle(args.range, args.transform);\r\n }\r\n}\r\n\r\n/**\r\n * Arguments for the [[computeIntervalPoints]] method.\r\n * @beta\r\n */\r\nexport interface ComputeIntervalPointsArgs extends ComputeFrameArgs {\r\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\r\n lineIntervalFactor?: number;\r\n /** A factor applied to divide each straight edge. A value of 1 will place a single point on each vertex. */\r\n arcIntervalFactor?: number;\r\n}\r\n\r\n/**\r\n * Computes points along the edges of the frame geometry based on the provided frame shape, range, and interval factors.\r\n * These can be used for snapping or attaching leaders.\r\n * @returns an array of [[Point3d]] that represent the points along the edges of the frame geometry. Returns `undefined` if the loop created by `computeFrame` is empty.\r\n * @beta\r\n */\r\nexport function computeIntervalPoints({ frame, range, transform, lineIntervalFactor = 0.5, arcIntervalFactor = 0.25 }: ComputeIntervalPointsArgs): Point3d[] | undefined {\r\n const points: Point3d[] = [];\r\n const curves = computeFrame({ frame, range, transform }).collectCurvePrimitives(undefined, false, true);\r\n\r\n curves.forEach((curve) => {\r\n const end = curve instanceof Arc3d ? arcIntervalFactor : lineIntervalFactor;\r\n for (let interval = 0; interval <= 1; interval += end) {\r\n points.push(curve.fractionToPoint(interval));\r\n }\r\n });\r\n return points;\r\n}\r\n\r\n/** Line - currently just adds an underline. Once we have leaders, this method may change. */\r\nconst computeLine = (range: Range2d, transform: Transform): Path => {\r\n const points = [Point3d.create(range.low.x, range.low.y), Point3d.create(range.high.x, range.low.y)];\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Path.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Rectangle - simplest frame */\r\nconst computeRectangle = (range: Range2d, transform: Transform): Loop => {\r\n const points = range.corners3d(true);\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Rounded Rectangle: each corner will be turned into an arc with the radius of the arc being the @param radiusFactor * the height (yLength) of the range */\r\nconst computeRoundedRectangle = (range: Range2d, transform: Transform, radiusFactor: number = 0.25): Loop => {\r\n const radius = range.yLength() * radiusFactor * Math.sqrt(2);\r\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\r\n const radiusOffsetFactor = range.yLength() * radiusFactor;\r\n\r\n // These values are the origins of the circles\r\n const inLeft = range.low.x + radiusOffsetFactor;\r\n const inRight = range.high.x - radiusOffsetFactor;\r\n const inBottom = range.low.y + radiusOffsetFactor;\r\n const inTop = range.high.y - radiusOffsetFactor\r\n\r\n // These values exist on the circles\r\n const exLeft = inLeft - radius;\r\n const exRight = inRight + radius;\r\n const exBottom = inBottom - radius;\r\n const exTop = inTop + radius;\r\n\r\n const q1 = AngleSweep.createStartEndDegrees(0, 90);\r\n const q2 = AngleSweep.createStartEndDegrees(90, 180);\r\n const q3 = AngleSweep.createStartEndDegrees(180, 270);\r\n const q4 = AngleSweep.createStartEndDegrees(270, 360);\r\n\r\n\r\n const curves = [\r\n LineString3d.create([Point3d.create(inLeft, exTop), Point3d.create(inRight, exTop)]), // top\r\n Arc3d.createXY(Point3d.create(inLeft, inTop), radius, q2), // top left\r\n LineString3d.create([Point3d.create(exLeft, inBottom), Point3d.create(exLeft, inTop)]), // left\r\n Arc3d.createXY(Point3d.create(inLeft, inBottom), radius, q3), // bottom left\r\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\r\n Arc3d.createXY(Point3d.create(inRight, inBottom), radius, q4), // bottom right\r\n LineString3d.create([Point3d.create(exRight, inBottom), Point3d.create(exRight, inTop)]), // right\r\n Arc3d.createXY(Point3d.create(inRight, inTop), radius, q1), // top right\r\n ];\r\n\r\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)))\r\n}\r\n\r\n\r\n/** Circle */\r\nconst computeCircle = (range: Range2d, transform: Transform): Loop => {\r\n const radius = range.low.distance(range.high) / 2;\r\n const frame = Arc3d.createXY(Point3d.createFrom(range.center), radius);\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Equilateral Triangle */\r\nconst computeTriangle = (range: Range2d, transform: Transform): Loop => {\r\n\r\n const xLength = range.xLength();\r\n const yLength = range.yLength();\r\n const center = range.center;\r\n const points: Point3d[] = [];\r\n\r\n const magnitude = (xLength > yLength) ? (xLength * Math.sqrt(3) + yLength) / 2 : (yLength * Math.sqrt(3) + xLength) / 2;\r\n\r\n const v1 = Vector2d.create(0, magnitude);\r\n const vectors = [\r\n v1, // top\r\n v1.rotateXY(Angle.createDegrees(120)), // left\r\n v1.rotateXY(Angle.createDegrees(240)), // right\r\n v1 // top\r\n ];\r\n\r\n vectors.forEach((v) => {\r\n points.push(Point3d.create(center.x + v.x, center.y + v.y));\r\n });\r\n\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Diamond (square rotated 45 degrees) */\r\nconst computeDiamond = (range: Range2d, transform: Transform): Loop => {\r\n const offset = (range.xLength() + range.yLength()) / 2;\r\n const center = range.center;\r\n\r\n const points = [\r\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\r\n Point3d.createFrom({ x: center.x + offset, y: center.y }), // right\r\n Point3d.createFrom({ x: center.x, y: center.y - offset }), // bottom\r\n Point3d.createFrom({ x: center.x - offset, y: center.y }), // left\r\n Point3d.createFrom({ x: center.x, y: center.y + offset }), // top\r\n ];\r\n\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Square */\r\nconst computeSquare = (range: Range2d, transform: Transform): Loop => {\r\n\r\n // Extend range\r\n const xLength = range.xLength() / 2;\r\n const yLength = range.yLength() / 2;\r\n const center = range.center;\r\n if (xLength > yLength) {\r\n range.extendPoint({ x: center.x, y: center.y + xLength });\r\n range.extendPoint({ x: center.x, y: center.y - xLength });\r\n } else {\r\n range.extendPoint({ x: center.x + yLength, y: center.y });\r\n range.extendPoint({ x: center.x - yLength, y: center.y });\r\n }\r\n\r\n const points = range.corners3d(true);\r\n const frame = LineString3d.createPoints(points);\r\n\r\n return Loop.create(frame.cloneTransformed(transform));\r\n}\r\n\r\n/** Capsule (or pill shape) */\r\nconst computeCapsule = (range: Range2d, transform: Transform): Loop => {\r\n const height = range.yLength();\r\n const radius = height * (Math.sqrt(2) / 2);\r\n\r\n // We're going to circumscribe the range with our rounded edges. The corners of the range will fall on 45 degree angles.\r\n const radiusOffsetFactor = height / 2;\r\n\r\n // These values are the origins of the circles\r\n const inLeft = range.low.x + radiusOffsetFactor;\r\n const inRight = range.high.x - radiusOffsetFactor;\r\n const inBottom = range.low.y + radiusOffsetFactor;\r\n const inTop = range.high.y - radiusOffsetFactor\r\n\r\n // These values exist on the circles\r\n const exBottom = inBottom - radius;\r\n const exTop = inTop + radius;\r\n\r\n const leftHalfCircle = AngleSweep.createStartEndDegrees(90, 270);\r\n const rightHalfCircle = AngleSweep.createStartEndDegrees(-90, 90);\r\n\r\n const curves = [\r\n LineString3d.create([Point3d.create(inLeft, exTop), Point3d.create(inRight, exTop)]), // top\r\n Arc3d.createXY(Point3d.create(inLeft, range.center.y), radius, leftHalfCircle), // left\r\n LineString3d.create([Point3d.create(inLeft, exBottom), Point3d.create(inRight, exBottom)]), // bottom\r\n Arc3d.createXY(Point3d.create(inRight, range.center.y), radius, rightHalfCircle), // right\r\n ];\r\n\r\n return Loop.createArray(curves.map((curve) => curve.cloneTransformed(transform)));\r\n}\r\n\r\n/** Regular polygon with n sides: note, this a generic method that can be used to create any polygon, but the frame will not be as tightly encapsulating. */\r\nconst computePolygon = (n: number, range: Range2d, transform: Transform, angleOffset: number = 0): Loop => {\r\n // These are math terms: cspell:ignore inradius circumradius\r\n if (n < 3) throw new Error(\"A polygon must have at least 3 sides.\");\r\n\r\n // We're assuming the polygon is a regular polygon with `n` sides.\r\n // The center of the polygon is the center of the range.\r\n const center = range.center;\r\n // The inradius is the distance from the center to the midpoint of each side of the polygon. On our range, this coincides with the distance from the center to one of its corners.\r\n const inradius = range.low.distance(range.high) / 2;\r\n // The circumradius is the distance from the center to each vertex of the polygon.\r\n const circumradius = inradius / Math.cos(Math.PI / n);\r\n\r\n // The exterior angles add up to 360 degrees.\r\n const angleIncrement = 360 / n;\r\n const vertices: Point3d[] = [];\r\n\r\n // Add a point for each vertex\r\n for (let i = 0; i < n; i++) {\r\n const angle = Angle.createDegrees(i * angleIncrement + angleOffset);\r\n const vector = Vector2d.createPolar(circumradius, angle);\r\n vertices.push(Point3d.create(center.x + vector.x, center.y + vector.y));\r\n }\r\n\r\n // Close the polygon\r\n vertices.push(vertices[0]);\r\n\r\n // Finally compute the loop!\r\n const frame = LineString3d.createPoints(vertices);\r\n return Loop.create(frame.cloneTransformed(transform));\r\n};"]}
@@ -2,13 +2,12 @@
2
2
  * @module Elements
3
3
  */
4
4
  import { TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps } from "@itwin/core-common";
5
- import { IModelDb } from "./IModelDb";
6
- import { AnnotationElement2d, GraphicalElement3d } from "./Element";
7
- import { Id64String } from "@itwin/core-bentley";
5
+ import { IModelDb } from "../IModelDb";
6
+ import { AnnotationElement2d, GraphicalElement3d } from "../Element";
8
7
  /** An element that displays textual content within a 2d model.
9
8
  * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
10
9
  * @see [[setAnnotation]] to change the textual content.
11
- * @public
10
+ * @public @preview
12
11
  */
13
12
  export declare class TextAnnotation2d extends AnnotationElement2d {
14
13
  /** @internal */
@@ -23,15 +22,13 @@ export declare class TextAnnotation2d extends AnnotationElement2d {
23
22
  /** Change the textual content, updating the element's geometry and placement accordingly.
24
23
  * @see [[getAnnotation]] to extract the current annotation.
25
24
  * @param annotation The new annotation
26
- * @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
27
- * @returns true if the annotation was successfully updated.
28
25
  */
29
- setAnnotation(annotation: TextAnnotation, subCategory?: Id64String): boolean;
26
+ setAnnotation(annotation: TextAnnotation): void;
30
27
  }
31
28
  /** An element that displays textual content within a 3d model.
32
29
  * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
33
30
  * @see [[setAnnotation]] to change the textual content.
34
- * @public
31
+ * @public @preview
35
32
  */
36
33
  export declare class TextAnnotation3d extends GraphicalElement3d {
37
34
  /** @internal */
@@ -46,9 +43,7 @@ export declare class TextAnnotation3d extends GraphicalElement3d {
46
43
  /** Change the textual content, updating the element's geometry and placement accordingly.
47
44
  * @see [[getAnnotation]] to extract the current annotation.
48
45
  * @param annotation The new annotation
49
- * @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
50
- * @returns true if the annotation was successfully updated.
51
46
  */
52
- setAnnotation(annotation: TextAnnotation, subCategory?: Id64String): boolean;
47
+ setAnnotation(annotation: TextAnnotation): void;
53
48
  }
54
49
  //# sourceMappingURL=TextAnnotationElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAnnotationElement.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAiE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAuB,MAAM,oBAAoB,CAAC;AACtL,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAcrE;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,mBAAmB;IACvD,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAA+B;IAC7E,SAAS,aAAa,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ;WAEtD,QAAQ,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ,GAAG,gBAAgB;IAIxE,MAAM,IAAI,qBAAqB;IAO/C;;OAEG;IACI,aAAa,IAAI,cAAc,GAAG,SAAS;IAKlD;;;OAGG;IACI,aAAa,CAAC,UAAU,EAAE,cAAc;CAGhD;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAA+B;IAC7E,SAAS,aAAa,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ;WAEtD,QAAQ,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ,GAAG,gBAAgB;IAIxE,MAAM,IAAI,qBAAqB;IAO/C;;OAEG;IACI,aAAa,IAAI,cAAc,GAAG,SAAS;IAKlD;;;OAGG;IACI,aAAa,CAAC,UAAU,EAAE,cAAc;CAGhD"}
@@ -9,26 +9,20 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.TextAnnotation3d = exports.TextAnnotation2d = void 0;
11
11
  const core_common_1 = require("@itwin/core-common");
12
- const Element_1 = require("./Element");
12
+ const Element_1 = require("../Element");
13
+ const TextBlockLayout_1 = require("./TextBlockLayout");
13
14
  const TextAnnotationGeometry_1 = require("./TextAnnotationGeometry");
14
- function updateAnnotation(element, annotation, subCategory) {
15
- const builder = new core_common_1.GeometryStreamBuilder();
16
- const params = new core_common_1.GeometryParams(element.category, subCategory);
17
- if (!builder.appendGeometryParamsChange(params)) {
18
- return false;
19
- }
20
- const props = (0, TextAnnotationGeometry_1.produceTextAnnotationGeometry)({ iModel: element.iModel, annotation });
21
- if (!builder.appendTextBlock(props)) {
22
- return false;
23
- }
24
- element.geom = builder.geometryStream;
25
- element.jsonProperties.annotation = annotation.toJSON();
26
- return true;
15
+ function getElementGeometryBuilderParams(iModel, _placementProps, annotationProps, categoryId, _subCategory) {
16
+ const textBlock = core_common_1.TextAnnotation.fromJSON(annotationProps).textBlock;
17
+ const layout = (0, TextBlockLayout_1.layoutTextBlock)({ iModel, textBlock });
18
+ const builder = new core_common_1.ElementGeometry.Builder();
19
+ (0, TextAnnotationGeometry_1.appendTextAnnotationGeometry)({ layout, annotationProps, builder, categoryId });
20
+ return { entryArray: builder.entries };
27
21
  }
28
22
  /** An element that displays textual content within a 2d model.
29
23
  * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
30
24
  * @see [[setAnnotation]] to change the textual content.
31
- * @public
25
+ * @public @preview
32
26
  */
33
27
  class TextAnnotation2d extends Element_1.AnnotationElement2d {
34
28
  /** @internal */
@@ -38,7 +32,9 @@ class TextAnnotation2d extends Element_1.AnnotationElement2d {
38
32
  return new TextAnnotation2d(props, iModel);
39
33
  }
40
34
  toJSON() {
41
- return super.toJSON();
35
+ const props = super.toJSON();
36
+ props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);
37
+ return props;
42
38
  }
43
39
  /** Extract the textual content, if present.
44
40
  * @see [[setAnnotation]] to change it.
@@ -50,18 +46,16 @@ class TextAnnotation2d extends Element_1.AnnotationElement2d {
50
46
  /** Change the textual content, updating the element's geometry and placement accordingly.
51
47
  * @see [[getAnnotation]] to extract the current annotation.
52
48
  * @param annotation The new annotation
53
- * @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
54
- * @returns true if the annotation was successfully updated.
55
49
  */
56
- setAnnotation(annotation, subCategory) {
57
- return updateAnnotation(this, annotation, subCategory);
50
+ setAnnotation(annotation) {
51
+ this.jsonProperties.annotation = annotation.toJSON();
58
52
  }
59
53
  }
60
54
  exports.TextAnnotation2d = TextAnnotation2d;
61
55
  /** An element that displays textual content within a 3d model.
62
56
  * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
63
57
  * @see [[setAnnotation]] to change the textual content.
64
- * @public
58
+ * @public @preview
65
59
  */
66
60
  class TextAnnotation3d extends Element_1.GraphicalElement3d {
67
61
  /** @internal */
@@ -71,7 +65,9 @@ class TextAnnotation3d extends Element_1.GraphicalElement3d {
71
65
  return new TextAnnotation3d(props, iModel);
72
66
  }
73
67
  toJSON() {
74
- return super.toJSON();
68
+ const props = super.toJSON();
69
+ props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);
70
+ return props;
75
71
  }
76
72
  /** Extract the textual content, if present.
77
73
  * @see [[setAnnotation]] to change it.
@@ -83,11 +79,9 @@ class TextAnnotation3d extends Element_1.GraphicalElement3d {
83
79
  /** Change the textual content, updating the element's geometry and placement accordingly.
84
80
  * @see [[getAnnotation]] to extract the current annotation.
85
81
  * @param annotation The new annotation
86
- * @param subCategory If specified, the subcategory on which to define the geometry; otherwise, the default subcategory of the element's category is used.
87
- * @returns true if the annotation was successfully updated.
88
82
  */
89
- setAnnotation(annotation, subCategory) {
90
- return updateAnnotation(this, annotation, subCategory);
83
+ setAnnotation(annotation) {
84
+ this.jsonProperties.annotation = annotation.toJSON();
91
85
  }
92
86
  }
93
87
  exports.TextAnnotation3d = TextAnnotation3d;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAsL;AAEtL,wCAAqE;AAErE,uDAAoD;AACpD,qEAAwE;AAExE,SAAS,+BAA+B,CAAC,MAAgB,EAAE,eAA+B,EAAE,eAAoC,EAAE,UAAsB,EAAE,YAAyB;IACjL,MAAM,SAAS,GAAG,4BAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC;IACrE,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,6BAAe,CAAC,OAAO,EAAE,CAAC;IAC9C,IAAA,qDAA4B,EAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;IAE9E,OAAO,EAA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AAC;IAExF,MAAM,CAAC,QAAQ,CAAC,KAA4B,EAAE,MAAgB;QACnE,OAAO,IAAI,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAEe,MAAM;QACpB,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,CAAC,4BAA4B,GAAG,+BAA+B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjJ,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;QAC5C,OAAO,IAAI,CAAC,CAAC,CAAC,4BAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,UAA0B;QAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;CACF;AA/BD,4CA+BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { ElementGeometry, ElementGeometryBuilderParams, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { AnnotationElement2d, GraphicalElement3d } from \"../Element\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { layoutTextBlock } from \"./TextBlockLayout\";\r\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\r\n\r\nfunction getElementGeometryBuilderParams(iModel: IModelDb, _placementProps: PlacementProps, annotationProps: TextAnnotationProps, categoryId: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\r\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\r\n const layout = layoutTextBlock({ iModel, textBlock });\r\n const builder = new ElementGeometry.Builder();\r\n appendTextAnnotationGeometry({ layout, annotationProps, builder, categoryId })\r\n\r\n return { entryArray: builder.entries };\r\n}\r\n\r\n/** An element that displays textual content within a 2d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation2d extends AnnotationElement2d {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation2d\"; }\r\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\r\n return new TextAnnotation2d(props, iModel);\r\n }\r\n\r\n public override toJSON(): TextAnnotation2dProps {\r\n const props = super.toJSON();\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\r\n\r\n return props;\r\n }\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n const json = this.jsonProperties.annotation;\r\n return json ? TextAnnotation.fromJSON(json) : undefined;\r\n }\r\n\r\n /** Change the textual content, updating the element's geometry and placement accordingly.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this.jsonProperties.annotation = annotation.toJSON();\r\n }\r\n}\r\n\r\n/** An element that displays textual content within a 3d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation3d extends GraphicalElement3d {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation3d\"; }\r\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\r\n return new TextAnnotation3d(props, iModel);\r\n }\r\n\r\n public override toJSON(): TextAnnotation3dProps {\r\n const props = super.toJSON();\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.placement, this.jsonProperties.annotation, this.category);\r\n\r\n return props;\r\n }\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n const json = this.jsonProperties.annotation;\r\n return json ? TextAnnotation.fromJSON(json) : undefined;\r\n }\r\n\r\n /** Change the textual content, updating the element's geometry and placement accordingly.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this.jsonProperties.annotation = annotation.toJSON();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,31 @@
1
+ /** @packageDocumentation
2
+ * @module ElementGeometry
3
+ */
4
+ import { ElementGeometry, TextAnnotationProps } from "@itwin/core-common";
5
+ import { TextBlockLayout } from "./TextBlockLayout";
6
+ import { Id64String } from "@itwin/core-bentley";
7
+ /**
8
+ * Properties required to compute the geometry of a text annotation.
9
+ * @beta
10
+ * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].
11
+ */
12
+ export interface AppendTextAnnotationGeometryArgs {
13
+ /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */
14
+ annotationProps: TextAnnotationProps;
15
+ /** Layout provided by calling [[layoutTextBlock]] */
16
+ layout: TextBlockLayout;
17
+ /** Builder that will be added to in place */
18
+ builder: ElementGeometry.Builder;
19
+ /** The category the element will belong to. This will passed into the [[GeometryParams]] */
20
+ categoryId: Id64String;
21
+ /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */
22
+ subCategoryId?: Id64String;
23
+ /** Whether or not to draw geometry for things like the snap points, range, and anchor point */
24
+ wantDebugGeometry?: boolean;
25
+ }
26
+ /** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.
27
+ * @returns true if the geometry was successfully appended.
28
+ * @beta
29
+ */
30
+ export declare function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean;
31
+ //# sourceMappingURL=TextAnnotationGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAuB,MAAM,oBAAoB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC;IACjC,4FAA4F;IAC5F,UAAU,EAAE,UAAU,CAAA;IACtB,yGAAyG;IACzG,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAuB7F"}