@itwin/core-backend 5.9.0-dev.1 → 5.9.0-dev.10

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 (551) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +38 -0
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.js +3 -3
  6. package/lib/cjs/BriefcaseManager.js.map +1 -1
  7. package/lib/cjs/Category.d.ts +37 -7
  8. package/lib/cjs/Category.d.ts.map +1 -1
  9. package/lib/cjs/Category.js +33 -42
  10. package/lib/cjs/Category.js.map +1 -1
  11. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  12. package/lib/cjs/ChangesetECAdaptor.js +5 -2
  13. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  14. package/lib/cjs/ChannelControl.d.ts +29 -0
  15. package/lib/cjs/ChannelControl.d.ts.map +1 -1
  16. package/lib/cjs/ChannelControl.js.map +1 -1
  17. package/lib/cjs/CheckpointManager.js +1 -1
  18. package/lib/cjs/CheckpointManager.js.map +1 -1
  19. package/lib/cjs/CloudSqlite.d.ts +1 -1
  20. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  21. package/lib/cjs/CloudSqlite.js +68 -13
  22. package/lib/cjs/CloudSqlite.js.map +1 -1
  23. package/lib/cjs/CodeSpecs.d.ts +32 -3
  24. package/lib/cjs/CodeSpecs.d.ts.map +1 -1
  25. package/lib/cjs/CodeSpecs.js +48 -20
  26. package/lib/cjs/CodeSpecs.js.map +1 -1
  27. package/lib/cjs/DisplayStyle.d.ts +18 -3
  28. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  29. package/lib/cjs/DisplayStyle.js +10 -21
  30. package/lib/cjs/DisplayStyle.js.map +1 -1
  31. package/lib/cjs/EditTxn.d.ts +262 -0
  32. package/lib/cjs/EditTxn.d.ts.map +1 -0
  33. package/lib/cjs/EditTxn.js +548 -0
  34. package/lib/cjs/EditTxn.js.map +1 -0
  35. package/lib/cjs/Element.d.ts +74 -5
  36. package/lib/cjs/Element.d.ts.map +1 -1
  37. package/lib/cjs/Element.js +63 -75
  38. package/lib/cjs/Element.js.map +1 -1
  39. package/lib/cjs/ElementAspect.d.ts +10 -0
  40. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  41. package/lib/cjs/ElementAspect.js +21 -12
  42. package/lib/cjs/ElementAspect.js.map +1 -1
  43. package/lib/cjs/ElementTreeWalker.d.ts +56 -3
  44. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  45. package/lib/cjs/ElementTreeWalker.js +53 -40
  46. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  47. package/lib/cjs/ExternalSource.d.ts +11 -2
  48. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  49. package/lib/cjs/ExternalSource.js +10 -8
  50. package/lib/cjs/ExternalSource.js.map +1 -1
  51. package/lib/cjs/IModelDb.d.ts +66 -22
  52. package/lib/cjs/IModelDb.d.ts.map +1 -1
  53. package/lib/cjs/IModelDb.js +175 -289
  54. package/lib/cjs/IModelDb.js.map +1 -1
  55. package/lib/cjs/IModelHost.d.ts +58 -1
  56. package/lib/cjs/IModelHost.d.ts.map +1 -1
  57. package/lib/cjs/IModelHost.js +89 -0
  58. package/lib/cjs/IModelHost.js.map +1 -1
  59. package/lib/cjs/IpcHost.d.ts.map +1 -1
  60. package/lib/cjs/IpcHost.js +35 -15
  61. package/lib/cjs/IpcHost.js.map +1 -1
  62. package/lib/cjs/LineStyle.d.ts +47 -7
  63. package/lib/cjs/LineStyle.d.ts.map +1 -1
  64. package/lib/cjs/LineStyle.js +38 -33
  65. package/lib/cjs/LineStyle.js.map +1 -1
  66. package/lib/cjs/LockControl.d.ts +85 -1
  67. package/lib/cjs/LockControl.d.ts.map +1 -1
  68. package/lib/cjs/LockControl.js.map +1 -1
  69. package/lib/cjs/Material.d.ts +8 -1
  70. package/lib/cjs/Material.d.ts.map +1 -1
  71. package/lib/cjs/Material.js +6 -12
  72. package/lib/cjs/Material.js.map +1 -1
  73. package/lib/cjs/Model.d.ts +59 -20
  74. package/lib/cjs/Model.d.ts.map +1 -1
  75. package/lib/cjs/Model.js +38 -80
  76. package/lib/cjs/Model.js.map +1 -1
  77. package/lib/cjs/Relationship.d.ts +72 -7
  78. package/lib/cjs/Relationship.d.ts.map +1 -1
  79. package/lib/cjs/Relationship.js +39 -21
  80. package/lib/cjs/Relationship.js.map +1 -1
  81. package/lib/cjs/SchemaSync.js +4 -4
  82. package/lib/cjs/SchemaSync.js.map +1 -1
  83. package/lib/cjs/SheetIndex.d.ts +9 -0
  84. package/lib/cjs/SheetIndex.d.ts.map +1 -1
  85. package/lib/cjs/SheetIndex.js +38 -35
  86. package/lib/cjs/SheetIndex.js.map +1 -1
  87. package/lib/cjs/StashManager.js +1 -1
  88. package/lib/cjs/StashManager.js.map +1 -1
  89. package/lib/cjs/Texture.d.ts +6 -0
  90. package/lib/cjs/Texture.d.ts.map +1 -1
  91. package/lib/cjs/Texture.js +6 -14
  92. package/lib/cjs/Texture.js.map +1 -1
  93. package/lib/cjs/TxnManager.d.ts +105 -9
  94. package/lib/cjs/TxnManager.d.ts.map +1 -1
  95. package/lib/cjs/TxnManager.js +194 -15
  96. package/lib/cjs/TxnManager.js.map +1 -1
  97. package/lib/cjs/ViewDefinition.d.ts +21 -1
  98. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  99. package/lib/cjs/ViewDefinition.js +27 -66
  100. package/lib/cjs/ViewDefinition.js.map +1 -1
  101. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +14 -6
  102. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  103. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +33 -27
  104. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  105. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  106. package/lib/cjs/annotations/TextAnnotationElement.js +6 -5
  107. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  108. package/lib/cjs/core-backend.d.ts +1 -0
  109. package/lib/cjs/core-backend.d.ts.map +1 -1
  110. package/lib/cjs/core-backend.js +1 -0
  111. package/lib/cjs/core-backend.js.map +1 -1
  112. package/lib/cjs/domains/FunctionalElements.d.ts +6 -2
  113. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
  114. package/lib/cjs/domains/FunctionalElements.js +8 -13
  115. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  116. package/lib/cjs/domains/GenericElements.d.ts +11 -4
  117. package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
  118. package/lib/cjs/domains/GenericElements.js +13 -24
  119. package/lib/cjs/domains/GenericElements.js.map +1 -1
  120. package/lib/cjs/internal/ChannelAdmin.d.ts +15 -0
  121. package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
  122. package/lib/cjs/internal/ChannelAdmin.js +5 -3
  123. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  124. package/lib/cjs/internal/HubMock.d.ts +2 -0
  125. package/lib/cjs/internal/HubMock.d.ts.map +1 -1
  126. package/lib/cjs/internal/HubMock.js +7 -0
  127. package/lib/cjs/internal/HubMock.js.map +1 -1
  128. package/lib/cjs/internal/NoLocks.d.ts.map +1 -1
  129. package/lib/cjs/internal/NoLocks.js +6 -0
  130. package/lib/cjs/internal/NoLocks.js.map +1 -1
  131. package/lib/cjs/internal/ServerBasedLocks.d.ts +12 -0
  132. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -1
  133. package/lib/cjs/internal/ServerBasedLocks.js +285 -4
  134. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  135. package/lib/cjs/internal/Symbols.d.ts +4 -0
  136. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  137. package/lib/cjs/internal/Symbols.js +5 -1
  138. package/lib/cjs/internal/Symbols.js.map +1 -1
  139. package/lib/cjs/internal/annotations/fields.d.ts +3 -2
  140. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  141. package/lib/cjs/internal/annotations/fields.js +7 -6
  142. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  143. package/lib/cjs/internal/workspace/SettingsEditorImpl.d.ts +18 -3
  144. package/lib/cjs/internal/workspace/SettingsEditorImpl.d.ts.map +1 -1
  145. package/lib/cjs/internal/workspace/SettingsEditorImpl.js +49 -242
  146. package/lib/cjs/internal/workspace/SettingsEditorImpl.js.map +1 -1
  147. package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -1
  148. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  149. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +0 -1
  150. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  151. package/lib/cjs/internal/workspace/WorkspaceImpl.js +70 -41
  152. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  153. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  154. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  155. package/lib/cjs/workspace/Settings.d.ts +11 -5
  156. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  157. package/lib/cjs/workspace/Settings.js.map +1 -1
  158. package/lib/cjs/workspace/SettingsDb.d.ts +20 -99
  159. package/lib/cjs/workspace/SettingsDb.d.ts.map +1 -1
  160. package/lib/cjs/workspace/SettingsDb.js +23 -7
  161. package/lib/cjs/workspace/SettingsDb.js.map +1 -1
  162. package/lib/cjs/workspace/SettingsEditor.d.ts +40 -226
  163. package/lib/cjs/workspace/SettingsEditor.d.ts.map +1 -1
  164. package/lib/cjs/workspace/SettingsEditor.js +86 -25
  165. package/lib/cjs/workspace/SettingsEditor.js.map +1 -1
  166. package/lib/cjs/workspace/Workspace.d.ts +7 -11
  167. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  168. package/lib/cjs/workspace/Workspace.js.map +1 -1
  169. package/lib/cjs/workspace/WorkspaceEditor.d.ts +14 -0
  170. package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -1
  171. package/lib/cjs/workspace/WorkspaceEditor.js +1 -1
  172. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  173. package/lib/esm/BackendHubAccess.d.ts +38 -0
  174. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  175. package/lib/esm/BackendHubAccess.js.map +1 -1
  176. package/lib/esm/BriefcaseManager.js +3 -3
  177. package/lib/esm/BriefcaseManager.js.map +1 -1
  178. package/lib/esm/Category.d.ts +37 -7
  179. package/lib/esm/Category.d.ts.map +1 -1
  180. package/lib/esm/Category.js +33 -42
  181. package/lib/esm/Category.js.map +1 -1
  182. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  183. package/lib/esm/ChangesetECAdaptor.js +5 -2
  184. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  185. package/lib/esm/ChannelControl.d.ts +29 -0
  186. package/lib/esm/ChannelControl.d.ts.map +1 -1
  187. package/lib/esm/ChannelControl.js.map +1 -1
  188. package/lib/esm/CheckpointManager.js +1 -1
  189. package/lib/esm/CheckpointManager.js.map +1 -1
  190. package/lib/esm/CloudSqlite.d.ts +1 -1
  191. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  192. package/lib/esm/CloudSqlite.js +69 -14
  193. package/lib/esm/CloudSqlite.js.map +1 -1
  194. package/lib/esm/CodeSpecs.d.ts +32 -3
  195. package/lib/esm/CodeSpecs.d.ts.map +1 -1
  196. package/lib/esm/CodeSpecs.js +49 -21
  197. package/lib/esm/CodeSpecs.js.map +1 -1
  198. package/lib/esm/DisplayStyle.d.ts +18 -3
  199. package/lib/esm/DisplayStyle.d.ts.map +1 -1
  200. package/lib/esm/DisplayStyle.js +10 -21
  201. package/lib/esm/DisplayStyle.js.map +1 -1
  202. package/lib/esm/EditTxn.d.ts +262 -0
  203. package/lib/esm/EditTxn.d.ts.map +1 -0
  204. package/lib/esm/EditTxn.js +543 -0
  205. package/lib/esm/EditTxn.js.map +1 -0
  206. package/lib/esm/Element.d.ts +74 -5
  207. package/lib/esm/Element.d.ts.map +1 -1
  208. package/lib/esm/Element.js +64 -76
  209. package/lib/esm/Element.js.map +1 -1
  210. package/lib/esm/ElementAspect.d.ts +10 -0
  211. package/lib/esm/ElementAspect.d.ts.map +1 -1
  212. package/lib/esm/ElementAspect.js +22 -13
  213. package/lib/esm/ElementAspect.js.map +1 -1
  214. package/lib/esm/ElementTreeWalker.d.ts +56 -3
  215. package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
  216. package/lib/esm/ElementTreeWalker.js +53 -40
  217. package/lib/esm/ElementTreeWalker.js.map +1 -1
  218. package/lib/esm/ExternalSource.d.ts +11 -2
  219. package/lib/esm/ExternalSource.d.ts.map +1 -1
  220. package/lib/esm/ExternalSource.js +10 -8
  221. package/lib/esm/ExternalSource.js.map +1 -1
  222. package/lib/esm/IModelDb.d.ts +66 -22
  223. package/lib/esm/IModelDb.d.ts.map +1 -1
  224. package/lib/esm/IModelDb.js +177 -291
  225. package/lib/esm/IModelDb.js.map +1 -1
  226. package/lib/esm/IModelHost.d.ts +58 -1
  227. package/lib/esm/IModelHost.d.ts.map +1 -1
  228. package/lib/esm/IModelHost.js +91 -2
  229. package/lib/esm/IModelHost.js.map +1 -1
  230. package/lib/esm/IpcHost.d.ts.map +1 -1
  231. package/lib/esm/IpcHost.js +36 -16
  232. package/lib/esm/IpcHost.js.map +1 -1
  233. package/lib/esm/LineStyle.d.ts +47 -7
  234. package/lib/esm/LineStyle.d.ts.map +1 -1
  235. package/lib/esm/LineStyle.js +38 -33
  236. package/lib/esm/LineStyle.js.map +1 -1
  237. package/lib/esm/LockControl.d.ts +85 -1
  238. package/lib/esm/LockControl.d.ts.map +1 -1
  239. package/lib/esm/LockControl.js.map +1 -1
  240. package/lib/esm/Material.d.ts +8 -1
  241. package/lib/esm/Material.d.ts.map +1 -1
  242. package/lib/esm/Material.js +6 -12
  243. package/lib/esm/Material.js.map +1 -1
  244. package/lib/esm/Model.d.ts +59 -20
  245. package/lib/esm/Model.d.ts.map +1 -1
  246. package/lib/esm/Model.js +39 -81
  247. package/lib/esm/Model.js.map +1 -1
  248. package/lib/esm/Relationship.d.ts +72 -7
  249. package/lib/esm/Relationship.d.ts.map +1 -1
  250. package/lib/esm/Relationship.js +40 -22
  251. package/lib/esm/Relationship.js.map +1 -1
  252. package/lib/esm/SchemaSync.js +5 -5
  253. package/lib/esm/SchemaSync.js.map +1 -1
  254. package/lib/esm/SheetIndex.d.ts +9 -0
  255. package/lib/esm/SheetIndex.d.ts.map +1 -1
  256. package/lib/esm/SheetIndex.js +38 -35
  257. package/lib/esm/SheetIndex.js.map +1 -1
  258. package/lib/esm/StashManager.js +1 -1
  259. package/lib/esm/StashManager.js.map +1 -1
  260. package/lib/esm/Texture.d.ts +6 -0
  261. package/lib/esm/Texture.d.ts.map +1 -1
  262. package/lib/esm/Texture.js +6 -14
  263. package/lib/esm/Texture.js.map +1 -1
  264. package/lib/esm/TxnManager.d.ts +105 -9
  265. package/lib/esm/TxnManager.d.ts.map +1 -1
  266. package/lib/esm/TxnManager.js +194 -15
  267. package/lib/esm/TxnManager.js.map +1 -1
  268. package/lib/esm/ViewDefinition.d.ts +21 -1
  269. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  270. package/lib/esm/ViewDefinition.js +27 -66
  271. package/lib/esm/ViewDefinition.js.map +1 -1
  272. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +14 -6
  273. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  274. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +33 -27
  275. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  276. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  277. package/lib/esm/annotations/TextAnnotationElement.js +6 -5
  278. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  279. package/lib/esm/core-backend.d.ts +1 -0
  280. package/lib/esm/core-backend.d.ts.map +1 -1
  281. package/lib/esm/core-backend.js +1 -0
  282. package/lib/esm/core-backend.js.map +1 -1
  283. package/lib/esm/domains/FunctionalElements.d.ts +6 -2
  284. package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
  285. package/lib/esm/domains/FunctionalElements.js +8 -13
  286. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  287. package/lib/esm/domains/GenericElements.d.ts +11 -4
  288. package/lib/esm/domains/GenericElements.d.ts.map +1 -1
  289. package/lib/esm/domains/GenericElements.js +13 -24
  290. package/lib/esm/domains/GenericElements.js.map +1 -1
  291. package/lib/esm/internal/ChannelAdmin.d.ts +15 -0
  292. package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
  293. package/lib/esm/internal/ChannelAdmin.js +6 -4
  294. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  295. package/lib/esm/internal/HubMock.d.ts +2 -0
  296. package/lib/esm/internal/HubMock.d.ts.map +1 -1
  297. package/lib/esm/internal/HubMock.js +7 -0
  298. package/lib/esm/internal/HubMock.js.map +1 -1
  299. package/lib/esm/internal/NoLocks.d.ts.map +1 -1
  300. package/lib/esm/internal/NoLocks.js +6 -0
  301. package/lib/esm/internal/NoLocks.js.map +1 -1
  302. package/lib/esm/internal/ServerBasedLocks.d.ts +12 -0
  303. package/lib/esm/internal/ServerBasedLocks.d.ts.map +1 -1
  304. package/lib/esm/internal/ServerBasedLocks.js +286 -5
  305. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  306. package/lib/esm/internal/Symbols.d.ts +4 -0
  307. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  308. package/lib/esm/internal/Symbols.js +4 -0
  309. package/lib/esm/internal/Symbols.js.map +1 -1
  310. package/lib/esm/internal/annotations/fields.d.ts +3 -2
  311. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  312. package/lib/esm/internal/annotations/fields.js +7 -6
  313. package/lib/esm/internal/annotations/fields.js.map +1 -1
  314. package/lib/esm/internal/workspace/SettingsEditorImpl.d.ts +18 -3
  315. package/lib/esm/internal/workspace/SettingsEditorImpl.d.ts.map +1 -1
  316. package/lib/esm/internal/workspace/SettingsEditorImpl.js +52 -246
  317. package/lib/esm/internal/workspace/SettingsEditorImpl.js.map +1 -1
  318. package/lib/esm/internal/workspace/SettingsImpl.d.ts.map +1 -1
  319. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  320. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts +0 -1
  321. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  322. package/lib/esm/internal/workspace/WorkspaceImpl.js +71 -41
  323. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  324. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  325. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  326. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  327. package/lib/esm/test/ElementDrivesElement.test.d.ts +20 -19
  328. package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -1
  329. package/lib/esm/test/ElementDrivesElement.test.js +111 -96
  330. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
  331. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  332. package/lib/esm/test/IModelHost.test.js +56 -2
  333. package/lib/esm/test/IModelHost.test.js.map +1 -1
  334. package/lib/esm/test/IModelTestUtils.d.ts +23 -23
  335. package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
  336. package/lib/esm/test/IModelTestUtils.js +466 -449
  337. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  338. package/lib/esm/test/IpcHost.test.js +112 -0
  339. package/lib/esm/test/IpcHost.test.js.map +1 -1
  340. package/lib/esm/test/PropertyDb.test.js +2 -2
  341. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  342. package/lib/esm/test/SquashSchemaAndDataChanges.test.js +27 -18
  343. package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +1 -1
  344. package/lib/esm/test/TestChangeSetUtility.d.ts.map +1 -1
  345. package/lib/esm/test/TestChangeSetUtility.js +11 -7
  346. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  347. package/lib/esm/test/TestEditTxn.d.ts +8 -0
  348. package/lib/esm/test/TestEditTxn.d.ts.map +1 -0
  349. package/lib/esm/test/TestEditTxn.js +34 -0
  350. package/lib/esm/test/TestEditTxn.js.map +1 -0
  351. package/lib/esm/test/TestUtils.d.ts +1 -0
  352. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  353. package/lib/esm/test/TestUtils.js +8 -1
  354. package/lib/esm/test/TestUtils.js.map +1 -1
  355. package/lib/esm/test/annotations/Fields.test.js +82 -90
  356. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  357. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  358. package/lib/esm/test/annotations/TextAnnotation.test.js +156 -99
  359. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  360. package/lib/esm/test/annotations/TextBlock.test.js +5 -3
  361. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  362. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  363. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  364. package/lib/esm/test/categories/Category.test.js +63 -3
  365. package/lib/esm/test/categories/Category.test.js.map +1 -1
  366. package/lib/esm/test/codespec/CodeSpec.test.js +88 -5
  367. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  368. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  369. package/lib/esm/test/ecdb/ECSqlAst.test.js +3 -2
  370. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  371. package/lib/esm/test/ecdb/ECSqlQuery.test.js +2 -2
  372. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  373. package/lib/esm/test/ecdb/ECSqlStatement.test.js +0 -1
  374. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  375. package/lib/esm/test/ecdb/QueryReaders.test.js +17 -14
  376. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
  377. package/lib/esm/test/ecdb/SqliteStatement.test.js +2 -2
  378. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  379. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -1
  380. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +30 -28
  381. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  382. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  383. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  384. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  385. package/lib/esm/test/element/DeleteDefinitionElements.test.js +159 -143
  386. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  387. package/lib/esm/test/element/ElementAspect.test.js +68 -60
  388. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  389. package/lib/esm/test/element/ElementDependencyGraph.test.d.ts.map +1 -1
  390. package/lib/esm/test/element/ElementDependencyGraph.test.js +51 -43
  391. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  392. package/lib/esm/test/element/ElementRoundTrip.test.js +37 -38
  393. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  394. package/lib/esm/test/element/ExcludedElements.test.js +2 -2
  395. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  396. package/lib/esm/test/element/ExternalSource.test.js +40 -38
  397. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  398. package/lib/esm/test/element/NullStructArray.test.js +10 -9
  399. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  400. package/lib/esm/test/element/ProjectInformationRecord.test.js +5 -2
  401. package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
  402. package/lib/esm/test/element/SheetInformationAspect.test.js +43 -11
  403. package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
  404. package/lib/esm/test/element/UrlLink.test.js +2 -2
  405. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  406. package/lib/esm/test/font/IModelDbFonts.test.js +87 -73
  407. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  408. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +164 -125
  409. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  410. package/lib/esm/test/hubaccess/BriefcaseManager.test.js +2 -4
  411. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  412. package/lib/esm/test/hubaccess/Rebase.test.js +313 -247
  413. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  414. package/lib/esm/test/hubaccess/SemanticRebase.test.js +322 -247
  415. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
  416. package/lib/esm/test/imodel/Code.test.js +31 -31
  417. package/lib/esm/test/imodel/Code.test.js.map +1 -1
  418. package/lib/esm/test/imodel/ElementTreeWalker.test.js +57 -48
  419. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  420. package/lib/esm/test/imodel/IModel.test.js +419 -344
  421. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  422. package/lib/esm/test/imodel/ProjectExtents.test.js +2 -2
  423. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  424. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  425. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts.map +1 -1
  426. package/lib/esm/test/incrementalSchemaLocater/TestContext.js +2 -2
  427. package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -1
  428. package/lib/esm/test/index.d.ts +1 -0
  429. package/lib/esm/test/index.d.ts.map +1 -1
  430. package/lib/esm/test/index.js +1 -0
  431. package/lib/esm/test/index.js.map +1 -1
  432. package/lib/esm/test/schema/ClassRegistry.test.js +23 -22
  433. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  434. package/lib/esm/test/schema/FunctionalDomain.test.js +36 -34
  435. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  436. package/lib/esm/test/schema/GenericDomain.test.js +114 -94
  437. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  438. package/lib/esm/test/schema/IModelSchemaContext.test.js +2 -1
  439. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  440. package/lib/esm/test/schema/SchemaImportCallbacks.test.js +207 -192
  441. package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
  442. package/lib/esm/test/sheetindex/SheetIndex.test.d.ts +1 -3
  443. package/lib/esm/test/sheetindex/SheetIndex.test.d.ts.map +1 -1
  444. package/lib/esm/test/sheetindex/SheetIndex.test.js +312 -247
  445. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  446. package/lib/esm/test/standalone/ChangeMerge.test.js +101 -82
  447. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  448. package/lib/esm/test/standalone/ChangesetReader.test.js +114 -85
  449. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  450. package/lib/esm/test/standalone/DisplayStyle.test.js +43 -40
  451. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  452. package/lib/esm/test/standalone/Drawing.test.js +4 -3
  453. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  454. package/lib/esm/test/standalone/EditTxn.test.d.ts +2 -0
  455. package/lib/esm/test/standalone/EditTxn.test.d.ts.map +1 -0
  456. package/lib/esm/test/standalone/EditTxn.test.js +219 -0
  457. package/lib/esm/test/standalone/EditTxn.test.js.map +1 -0
  458. package/lib/esm/test/standalone/ElementMesh.test.js +16 -13
  459. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  460. package/lib/esm/test/standalone/ExportGraphics.test.js +26 -20
  461. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  462. package/lib/esm/test/standalone/GeometryChangeEvents.test.js +11 -15
  463. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  464. package/lib/esm/test/standalone/GeometryStream.test.js +212 -165
  465. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  466. package/lib/esm/test/standalone/HubMock.test.js +31 -25
  467. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  468. package/lib/esm/test/standalone/IModelLimits.test.js +11 -8
  469. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  470. package/lib/esm/test/standalone/IModelWrite.test.d.ts +2 -2
  471. package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -1
  472. package/lib/esm/test/standalone/IModelWrite.test.js +184 -142
  473. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  474. package/lib/esm/test/standalone/ITwinWorkspace.test.d.ts +2 -0
  475. package/lib/esm/test/standalone/ITwinWorkspace.test.d.ts.map +1 -0
  476. package/lib/esm/test/standalone/ITwinWorkspace.test.js +236 -0
  477. package/lib/esm/test/standalone/ITwinWorkspace.test.js.map +1 -0
  478. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js +25 -22
  479. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  480. package/lib/esm/test/standalone/IntegrityCheck.test.js +20 -18
  481. package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
  482. package/lib/esm/test/standalone/MergeConflict.test.d.ts +2 -2
  483. package/lib/esm/test/standalone/MergeConflict.test.d.ts.map +1 -1
  484. package/lib/esm/test/standalone/MergeConflict.test.js +49 -33
  485. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  486. package/lib/esm/test/standalone/RenderMaterialElement.test.js +5 -5
  487. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  488. package/lib/esm/test/standalone/RenderTimeline.test.js +3 -2
  489. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  490. package/lib/esm/test/standalone/SectionDrawing.test.js +7 -7
  491. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  492. package/lib/esm/test/standalone/ServerBasedLocks.test.js +928 -22
  493. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  494. package/lib/esm/test/standalone/Settings.test.js +26 -4
  495. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  496. package/lib/esm/test/standalone/SettingsSchemas.test.js +2 -1
  497. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  498. package/lib/esm/test/standalone/SnapshotDb.test.js +3 -1
  499. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  500. package/lib/esm/test/standalone/StandaloneDb.test.js +7 -6
  501. package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -1
  502. package/lib/esm/test/standalone/Texture.test.js +5 -4
  503. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  504. package/lib/esm/test/standalone/TileCache.test.d.ts.map +1 -1
  505. package/lib/esm/test/standalone/TileCache.test.js +5 -3
  506. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  507. package/lib/esm/test/standalone/TileTree.test.js +35 -31
  508. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  509. package/lib/esm/test/standalone/TxnManager.test.js +700 -653
  510. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  511. package/lib/esm/test/standalone/ViewDefinition.test.js +295 -229
  512. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  513. package/lib/esm/test/standalone/Workspace.test.js +72 -22
  514. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  515. package/lib/esm/test/workspace/SettingsDb.test.js +28 -456
  516. package/lib/esm/test/workspace/SettingsDb.test.js.map +1 -1
  517. package/lib/esm/workspace/Settings.d.ts +11 -5
  518. package/lib/esm/workspace/Settings.d.ts.map +1 -1
  519. package/lib/esm/workspace/Settings.js.map +1 -1
  520. package/lib/esm/workspace/SettingsDb.d.ts +20 -99
  521. package/lib/esm/workspace/SettingsDb.d.ts.map +1 -1
  522. package/lib/esm/workspace/SettingsDb.js +20 -6
  523. package/lib/esm/workspace/SettingsDb.js.map +1 -1
  524. package/lib/esm/workspace/SettingsEditor.d.ts +40 -226
  525. package/lib/esm/workspace/SettingsEditor.d.ts.map +1 -1
  526. package/lib/esm/workspace/SettingsEditor.js +85 -24
  527. package/lib/esm/workspace/SettingsEditor.js.map +1 -1
  528. package/lib/esm/workspace/Workspace.d.ts +7 -11
  529. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  530. package/lib/esm/workspace/Workspace.js.map +1 -1
  531. package/lib/esm/workspace/WorkspaceEditor.d.ts +14 -0
  532. package/lib/esm/workspace/WorkspaceEditor.d.ts.map +1 -1
  533. package/lib/esm/workspace/WorkspaceEditor.js +1 -1
  534. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  535. package/package.json +14 -14
  536. package/lib/cjs/internal/workspace/SettingsDbImpl.d.ts +0 -38
  537. package/lib/cjs/internal/workspace/SettingsDbImpl.d.ts.map +0 -1
  538. package/lib/cjs/internal/workspace/SettingsDbImpl.js +0 -108
  539. package/lib/cjs/internal/workspace/SettingsDbImpl.js.map +0 -1
  540. package/lib/cjs/internal/workspace/SettingsSqliteDb.d.ts +0 -14
  541. package/lib/cjs/internal/workspace/SettingsSqliteDb.d.ts.map +0 -1
  542. package/lib/cjs/internal/workspace/SettingsSqliteDb.js +0 -40
  543. package/lib/cjs/internal/workspace/SettingsSqliteDb.js.map +0 -1
  544. package/lib/esm/internal/workspace/SettingsDbImpl.d.ts +0 -38
  545. package/lib/esm/internal/workspace/SettingsDbImpl.d.ts.map +0 -1
  546. package/lib/esm/internal/workspace/SettingsDbImpl.js +0 -104
  547. package/lib/esm/internal/workspace/SettingsDbImpl.js.map +0 -1
  548. package/lib/esm/internal/workspace/SettingsSqliteDb.d.ts +0 -14
  549. package/lib/esm/internal/workspace/SettingsSqliteDb.d.ts.map +0 -1
  550. package/lib/esm/internal/workspace/SettingsSqliteDb.js +0 -36
  551. package/lib/esm/internal/workspace/SettingsSqliteDb.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAqB,WAAW,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAgB,SAAS,EAAE,MAAM,WAAW,CAAC;AAGpD,SAAS,qBAAqB,CAAC,UAAsB;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,KAAW,mBAAmB,CAuanC;AAvaD,WAAiB,mBAAmB;IAElC,4CAA4C;IAC5C,IAAY,aAaX;IAbD,WAAY,aAAa;QACvB,kEAAkE;QAClE,+DAAe,CAAA;QACf,+DAA+D;QAC/D,yDAAY,CAAA;QACZ,oEAAoE;QACpE,mEAAiB,CAAA;QACjB,kEAAkE;QAClE,+DAAe,CAAA;QACf,wEAAwE;QACxE,yDAAY,CAAA;QACZ,kEA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AA;AACH,CAAC,EAvagB,mBAAmB,KAAnB,mBAAmB,QAuanC","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 { Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\nimport { GeometryPart, LineStyle } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\n\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\n switch (linePixels) {\n case LinePixels.Code1:\n return 1;\n case LinePixels.Code2:\n return 2;\n case LinePixels.Code3:\n return 3;\n case LinePixels.Code4:\n return 4;\n case LinePixels.Code5:\n return 5;\n case LinePixels.Code6:\n return 6;\n case LinePixels.Code7:\n return 7;\n default:\n return -1; // Invalid value...\n }\n}\n\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\n * There are three varieties of line styles:\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\n * - A style that uses a texture.\n *\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\n * by file property id and type and is saved as a dictionary element.\n * @public\n */\nexport namespace LineStyleDefinition {\n\n /** Line style component type identifiers */\n export enum ComponentType {\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\n PointSymbol = 1,\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\n Compound = 2,\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\n StrokePattern = 3,\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\n StrokePoint = 4,\n /** Component type for [[LinePixels]], never saved as a file property */\n Internal = 6,\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\n RasterImage = 7,\n }\n\n /** Mask of values for StrokeMode */\n export enum StrokeMode {\n /** Stroke represents a blank space */\n Gap = 0x00,\n /** Stroke represents a solid dash */\n Dash = 0x01,\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\n Ray = 0x02,\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\n Scale = 0x04,\n /** Invert stroke in first stroke pattern */\n FirstInvert = 0x08,\n /** Invert stroke in last stroke pattern */\n LastInvert = 0x10,\n }\n\n /** Define constant width or tapered strokes with distance specified in meters */\n export enum StrokeWidth {\n /** Stroke draws as one pixel wide line */\n None = 0,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\n Left = 1,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\n Right = 2,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\n Full = 3,\n }\n\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\n * StrokeCap indicates the number of vectors in the arc.\n */\n export enum StrokeCap {\n /** Stroke displays as a closed polygon */\n Closed = 0,\n /** Stroke displays lines at specified width instead of a polygon */\n Open = 1,\n /** Stroke length extended by half the stroke width */\n Extended = 2,\n /** Stroke end cap is a hexagon */\n Hexagon = 3,\n /** Stroke end cap is an octagon */\n Octagon = 4,\n /** Stroke end cap is a decagon */\n Decagon = 5,\n /** Stroke end cap is an arc */\n Arc = 30,\n }\n\n /** A stroke representing either a dash or gap in a stroke pattern */\n export interface StrokeProps {\n /** Length of stroke in meters */\n length: number;\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n orgWidth?: number;\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n endWidth?: number;\n /** Type and behavior of stroke */\n strokeMode?: StrokeMode;\n /** How to apply orgWidth and endWidth to stroke */\n widthMode?: StrokeWidth;\n /** Appearance of stroke end cap */\n capMode?: StrokeCap;\n }\n\n export type Strokes = StrokeProps[];\n\n /** Options to control how stroke pattern is applied to underlying curve */\n export enum StrokePatternOptions {\n /** Use default stroke behavior */\n None = 0x00,\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\n AutoPhase = 0x01,\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\n Iteration = 0x08,\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\n Segment = 0x10,\n /** Center the line style and stretch the ends */\n CenterStretch = 0x20,\n }\n\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\n */\n export interface StrokePatternProps {\n /** Name for this stroke pattern */\n descr: string;\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\n phase?: number;\n /** Options mask for this stroke pattern */\n options?: StrokePatternOptions;\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\n maxIter?: number;\n /** Array of strokes, maximum number that will be used is 32 */\n strokes: Strokes;\n }\n\n /** Flags to identify point symbol behavior */\n export enum PointSymbolFlags {\n /** Default symbol behavior */\n None = 0x0,\n /** Symbol includes 3d geometry */\n Is3d = 0x01,\n /** Symbol does not allow scaling */\n NoScale = 0x02,\n }\n\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\n */\n export interface PointSymbolProps {\n /** GeometryPart Id to use as a pattern symbol */\n geomPartId: Id64String;\n /** GeometryPart.bbox.low.x */\n baseX?: number;\n /** GeometryPart.bbox.low.y */\n baseY?: number;\n /** GeometryPart.bbox.low.z */\n baseZ?: number;\n /** GeometryPart.bbox.high.x */\n sizeX?: number;\n /** GeometryPart.bbox.high.y */\n sizeY?: number;\n /** GeometryPart.bbox.high.z */\n sizeZ?: number;\n /** Symbol behavior flags */\n symFlags?: PointSymbolFlags;\n /** Symbol scale, defaults to 1 */\n scale?: number;\n }\n\n /** Symbol options for location, orientation, and behavior */\n export enum SymbolOptions {\n /** No point symbol */\n None = 0x00,\n /** Symbol at origin of stroke */\n Origin = 0x01,\n /** Symbol at end of stroke */\n End = 0x02,\n /** symbol at center of stroke */\n Center = 0x03,\n /** Symbol at curve start point */\n CurveOrigin = 0x0004,\n /** Symbol at curve end point */\n CurveEnd = 0x0008,\n /** Symbol at each vertex */\n CurveVertex = 0x0010,\n /** Adjust symbol rotation left->right */\n AdjustRotation = 0x0020,\n /** Angle of symbol not relative to stroke direction */\n AbsoluteRotation = 0x0040,\n /** No scale on variable strokes */\n NoScale = 0x0100,\n /** No clip on partial strokes */\n NoClip = 0x0200,\n /** No partial strokes */\n NoPartial = 0x0400,\n /** Project partial origin */\n ProjectOrigin = 0x0800,\n /** Use color from symbol instead of inheriting curve color */\n UseColor = 0x4000,\n /** Use weight from symbol instead of inheriting curve weight */\n UseWeight = 0x8000,\n }\n\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\n export interface SymbolProps {\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\n symId: number;\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\n symType?: ComponentType;\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\n strokeNum?: number;\n /** Symbol x offset distance in meters */\n xOffset?: number;\n /** Symbol y offset distance in meters */\n yOffset?: number;\n /** Symbol rotation in radians */\n angle?: number;\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\n mod1?: SymbolOptions;\n }\n\n export type Symbols = SymbolProps[];\n\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\n */\n export interface StrokePointProps {\n /** Name for this stroke point component */\n descr: string;\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\n lcId: number;\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\n lcType?: ComponentType;\n /** Array of symbols */\n symbols: Symbols;\n }\n\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\n * A raster component identifies a texture for a line style.\n */\n export interface RasterImageProps {\n /** Name for this raster image component */\n descr: string;\n /** Raster width */\n x: number;\n /** Raster height */\n y: number;\n /** True width flag */\n trueWidth?: number;\n /** Raster flags */\n flags?: number;\n /** The file property id of raster image */\n imageId?: number;\n }\n\n /** Identifies a component by file property id and type */\n export interface ComponentProps {\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\n id: number;\n /** The type of component for specified file property id */\n type: ComponentType;\n /** Offset distance for this component, default is 0 */\n offset?: number;\n }\n\n export type Components = ComponentProps[];\n\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\n */\n export interface CompoundProps {\n comps: Components;\n }\n\n /** Flags to describe a style or control style behavior */\n export enum StyleFlags {\n /** Use defaults */\n None = 0x00,\n /** Only snap to center line and not individual strokes and symbols of line style */\n NoSnap = 0x04,\n /** Style represents a continuous line with width (determined by looking at components if not set) */\n Continuous = 0x08,\n /** Style represents physical geometry and should be scaled as such */\n Physical = 0x80,\n }\n\n /** The line style definition element data */\n export interface StyleProps {\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\n compId: number;\n /** The type of component for specified file property id */\n compType: ComponentType;\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\n flags?: StyleFlags;\n /** Style scale, defaults to 1 */\n unitDef?: number;\n }\n\n /** Helper methods for creating and querying line styles */\n export class Utils {\n\n /** Create a file property for a new stroke pattern component. */\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps {\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\n }\n\n /** Create a file property for a new point symbol component.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n */\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined {\n // if part extents weren't supplied, set them up now.\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\n if (!geomPart)\n return undefined;\n\n props.baseX = geomPart.bbox.low.x;\n props.baseY = geomPart.bbox.low.y;\n props.baseZ = geomPart.bbox.low.z;\n\n props.sizeX = geomPart.bbox.high.x;\n props.sizeY = geomPart.bbox.high.y;\n props.sizeZ = geomPart.bbox.high.z;\n }\n\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\n }\n\n /** Create a file property for a new stroke point component. */\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps {\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\n }\n\n /** Create a file property for a new compound component. */\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps {\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.Compound };\n }\n\n /** Create a file property for a new raster image component. */\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\n iModel.saveFileProperty(rasterFileProps, undefined, image);\n props.imageId = rasterFileProps.id;\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n iModel.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\n }\n\n /** Query for an existing line style with the supplied name. */\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\n }\n\n /** Insert a new line style with the supplied name.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n */\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\n if (undefined === props.flags)\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\n\n const lsProps: LineStyleProps = {\n classFullName: \"BisCore:LineStyle\",\n model: scopeModelId,\n code: LineStyle.createCode(imodel, scopeModelId, name),\n data: JSON.stringify(props),\n };\n\n return imodel.elements.insertElement(lsProps);\n }\n\n /** Get the name that can be use to query for an existing continuous line style. */\n public static getContinuousStyleName(width?: number): string {\n if (width === undefined)\n return \"Continuous\";\n\n return `Continuous-${width}`;\n }\n\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\n * There are 2 ways to define a continuous line style:\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\n * - Width is specified in the style.\n * - Defined using a single stroke component that is a long dash.\n *\n * @throws [[IModelError]] if unable to insert the line style definition element.\n */\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number): Id64String {\n const name = this.getContinuousStyleName(width);\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n if (undefined !== lsId)\n return lsId;\n\n if (width === undefined)\n return this.createStyle(imodel, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n\n const strokePatternData = this.createStrokePatternComponent(imodel, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\n if (undefined === strokePatternData)\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\n\n return this.createStyle(imodel, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n }\n\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\n */\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n return undefined;\n\n return `LinePixelsCodeNumber-${lineCode}`;\n }\n\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\n */\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels): Id64String {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\n\n const name = `LinePixelsCodeNumber-${lineCode}`;\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n return (undefined === lsId ? this.createStyle(imodel, scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAqB,WAAW,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAgB,SAAS,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAAS,qBAAqB,CAAC,UAAsB;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;Q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AC,YAAY,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjK,CAAC;KACF;IArMY,yBAAK,QAqMjB,CAAA;AACH,CAAC,EA7dgB,mBAAmB,KAAnB,mBAAmB,QA6dnC","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 { Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\nimport { EditTxn } from \"./EditTxn\";\nimport { GeometryPart, LineStyle } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _implicitTxn } from \"./internal/Symbols\";\n\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\n switch (linePixels) {\n case LinePixels.Code1:\n return 1;\n case LinePixels.Code2:\n return 2;\n case LinePixels.Code3:\n return 3;\n case LinePixels.Code4:\n return 4;\n case LinePixels.Code5:\n return 5;\n case LinePixels.Code6:\n return 6;\n case LinePixels.Code7:\n return 7;\n default:\n return -1; // Invalid value...\n }\n}\n\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\n * There are three varieties of line styles:\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\n * - A style that uses a texture.\n *\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\n * by file property id and type and is saved as a dictionary element.\n * @public\n */\nexport namespace LineStyleDefinition {\n\n /** Line style component type identifiers */\n export enum ComponentType {\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\n PointSymbol = 1,\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\n Compound = 2,\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\n StrokePattern = 3,\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\n StrokePoint = 4,\n /** Component type for [[LinePixels]], never saved as a file property */\n Internal = 6,\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\n RasterImage = 7,\n }\n\n /** Mask of values for StrokeMode */\n export enum StrokeMode {\n /** Stroke represents a blank space */\n Gap = 0x00,\n /** Stroke represents a solid dash */\n Dash = 0x01,\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\n Ray = 0x02,\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\n Scale = 0x04,\n /** Invert stroke in first stroke pattern */\n FirstInvert = 0x08,\n /** Invert stroke in last stroke pattern */\n LastInvert = 0x10,\n }\n\n /** Define constant width or tapered strokes with distance specified in meters */\n export enum StrokeWidth {\n /** Stroke draws as one pixel wide line */\n None = 0,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\n Left = 1,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\n Right = 2,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\n Full = 3,\n }\n\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\n * StrokeCap indicates the number of vectors in the arc.\n */\n export enum StrokeCap {\n /** Stroke displays as a closed polygon */\n Closed = 0,\n /** Stroke displays lines at specified width instead of a polygon */\n Open = 1,\n /** Stroke length extended by half the stroke width */\n Extended = 2,\n /** Stroke end cap is a hexagon */\n Hexagon = 3,\n /** Stroke end cap is an octagon */\n Octagon = 4,\n /** Stroke end cap is a decagon */\n Decagon = 5,\n /** Stroke end cap is an arc */\n Arc = 30,\n }\n\n /** A stroke representing either a dash or gap in a stroke pattern */\n export interface StrokeProps {\n /** Length of stroke in meters */\n length: number;\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n orgWidth?: number;\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n endWidth?: number;\n /** Type and behavior of stroke */\n strokeMode?: StrokeMode;\n /** How to apply orgWidth and endWidth to stroke */\n widthMode?: StrokeWidth;\n /** Appearance of stroke end cap */\n capMode?: StrokeCap;\n }\n\n export type Strokes = StrokeProps[];\n\n /** Options to control how stroke pattern is applied to underlying curve */\n export enum StrokePatternOptions {\n /** Use default stroke behavior */\n None = 0x00,\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\n AutoPhase = 0x01,\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\n Iteration = 0x08,\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\n Segment = 0x10,\n /** Center the line style and stretch the ends */\n CenterStretch = 0x20,\n }\n\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\n */\n export interface StrokePatternProps {\n /** Name for this stroke pattern */\n descr: string;\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\n phase?: number;\n /** Options mask for this stroke pattern */\n options?: StrokePatternOptions;\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\n maxIter?: number;\n /** Array of strokes, maximum number that will be used is 32 */\n strokes: Strokes;\n }\n\n /** Flags to identify point symbol behavior */\n export enum PointSymbolFlags {\n /** Default symbol behavior */\n None = 0x0,\n /** Symbol includes 3d geometry */\n Is3d = 0x01,\n /** Symbol does not allow scaling */\n NoScale = 0x02,\n }\n\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\n */\n export interface PointSymbolProps {\n /** GeometryPart Id to use as a pattern symbol */\n geomPartId: Id64String;\n /** GeometryPart.bbox.low.x */\n baseX?: number;\n /** GeometryPart.bbox.low.y */\n baseY?: number;\n /** GeometryPart.bbox.low.z */\n baseZ?: number;\n /** GeometryPart.bbox.high.x */\n sizeX?: number;\n /** GeometryPart.bbox.high.y */\n sizeY?: number;\n /** GeometryPart.bbox.high.z */\n sizeZ?: number;\n /** Symbol behavior flags */\n symFlags?: PointSymbolFlags;\n /** Symbol scale, defaults to 1 */\n scale?: number;\n }\n\n /** Symbol options for location, orientation, and behavior */\n export enum SymbolOptions {\n /** No point symbol */\n None = 0x00,\n /** Symbol at origin of stroke */\n Origin = 0x01,\n /** Symbol at end of stroke */\n End = 0x02,\n /** symbol at center of stroke */\n Center = 0x03,\n /** Symbol at curve start point */\n CurveOrigin = 0x0004,\n /** Symbol at curve end point */\n CurveEnd = 0x0008,\n /** Symbol at each vertex */\n CurveVertex = 0x0010,\n /** Adjust symbol rotation left->right */\n AdjustRotation = 0x0020,\n /** Angle of symbol not relative to stroke direction */\n AbsoluteRotation = 0x0040,\n /** No scale on variable strokes */\n NoScale = 0x0100,\n /** No clip on partial strokes */\n NoClip = 0x0200,\n /** No partial strokes */\n NoPartial = 0x0400,\n /** Project partial origin */\n ProjectOrigin = 0x0800,\n /** Use color from symbol instead of inheriting curve color */\n UseColor = 0x4000,\n /** Use weight from symbol instead of inheriting curve weight */\n UseWeight = 0x8000,\n }\n\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\n export interface SymbolProps {\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\n symId: number;\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\n symType?: ComponentType;\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\n strokeNum?: number;\n /** Symbol x offset distance in meters */\n xOffset?: number;\n /** Symbol y offset distance in meters */\n yOffset?: number;\n /** Symbol rotation in radians */\n angle?: number;\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\n mod1?: SymbolOptions;\n }\n\n export type Symbols = SymbolProps[];\n\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\n */\n export interface StrokePointProps {\n /** Name for this stroke point component */\n descr: string;\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\n lcId: number;\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\n lcType?: ComponentType;\n /** Array of symbols */\n symbols: Symbols;\n }\n\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\n * A raster component identifies a texture for a line style.\n */\n export interface RasterImageProps {\n /** Name for this raster image component */\n descr: string;\n /** Raster width */\n x: number;\n /** Raster height */\n y: number;\n /** True width flag */\n trueWidth?: number;\n /** Raster flags */\n flags?: number;\n /** The file property id of raster image */\n imageId?: number;\n }\n\n /** Identifies a component by file property id and type */\n export interface ComponentProps {\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\n id: number;\n /** The type of component for specified file property id */\n type: ComponentType;\n /** Offset distance for this component, default is 0 */\n offset?: number;\n }\n\n export type Components = ComponentProps[];\n\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\n */\n export interface CompoundProps {\n comps: Components;\n }\n\n /** Flags to describe a style or control style behavior */\n export enum StyleFlags {\n /** Use defaults */\n None = 0x00,\n /** Only snap to center line and not individual strokes and symbols of line style */\n NoSnap = 0x04,\n /** Style represents a continuous line with width (determined by looking at components if not set) */\n Continuous = 0x08,\n /** Style represents physical geometry and should be scaled as such */\n Physical = 0x80,\n }\n\n /** The line style definition element data */\n export interface StyleProps {\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\n compId: number;\n /** The type of component for specified file property id */\n compType: ComponentType;\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\n flags?: StyleFlags;\n /** Style scale, defaults to 1 */\n unitDef?: number;\n }\n\n /** Helper methods for creating and querying line styles */\n export class Utils {\n /** Create a file property for a new stroke pattern component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;\n /** Create a file property for a new stroke pattern component.\n * @deprecated Use createStrokePatternComponent(txn, ...) instead.\n */\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;\n public static createStrokePatternComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePatternProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\n }\n\n /** Create a file property for a new point symbol component using an explicit EditTxn.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @beta\n */\n public static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;\n /** Create a file property for a new point symbol component.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @deprecated Use createPointSymbolComponent(txn, ...) instead.\n */\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;\n public static createPointSymbolComponent(txnOrIModel: EditTxn | IModelDb, props: PointSymbolProps): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n // if part extents weren't supplied, set them up now.\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\n if (!geomPart)\n return undefined;\n\n props.baseX = geomPart.bbox.low.x;\n props.baseY = geomPart.bbox.low.y;\n props.baseZ = geomPart.bbox.low.z;\n\n props.sizeX = geomPart.bbox.high.x;\n props.sizeY = geomPart.bbox.high.y;\n props.sizeZ = geomPart.bbox.high.z;\n }\n\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\n }\n\n /** Create a file property for a new stroke point component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;\n /** Create a file property for a new stroke point component.\n * @deprecated Use createStrokePointComponent(txn, ...) instead.\n */\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;\n public static createStrokePointComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePointProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\n }\n\n /** Create a file property for a new compound component using an explicit EditTxn.\n * @beta\n */\n public static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;\n /** Create a file property for a new compound component.\n * @deprecated Use createCompoundComponent(txn, ...) instead.\n */\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;\n public static createCompoundComponent(txnOrIModel: EditTxn | IModelDb, props: CompoundProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.Compound };\n }\n\n /** Create a file property for a new raster image component using an explicit EditTxn.\n * @beta\n */\n public static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n /** Create a file property for a new raster image component.\n * @deprecated Use createRasterComponent(txn, ...) instead.\n */\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n public static createRasterComponent(txnOrIModel: EditTxn | IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\n txn.saveFileProperty(rasterFileProps, undefined, image);\n props.imageId = rasterFileProps.id;\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\n }\n\n /** Query for an existing line style with the supplied name. */\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\n }\n\n /** Insert a new line style with the supplied name using an explicit EditTxn.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n /** Insert a new line style with the supplied name.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @deprecated Use createStyle(txn, ...) instead.\n */\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n public static createStyle(txnOrIModel: EditTxn | IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const imodel = txn.iModel;\n if (undefined === props.flags)\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\n\n const lsProps: LineStyleProps = {\n classFullName: \"BisCore:LineStyle\",\n model: scopeModelId,\n code: LineStyle.createCode(imodel, scopeModelId, name),\n data: JSON.stringify(props),\n };\n\n return txn.insertElement(lsProps);\n }\n\n /** Get the name that can be use to query for an existing continuous line style. */\n public static getContinuousStyleName(width?: number): string {\n if (width === undefined)\n return \"Continuous\";\n\n return `Continuous-${width}`;\n }\n\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\n * There are 2 ways to define a continuous line style:\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\n * - Width is specified in the style.\n * - Defined using a single stroke component that is a long dash.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String {\n const writeTxn = txn ?? imodel[_implicitTxn];\n const name = this.getContinuousStyleName(width);\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n if (undefined !== lsId)\n return lsId;\n\n if (width === undefined)\n return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n\n const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\n if (undefined === strokePatternData)\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\n\n return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n }\n\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\n */\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n return undefined;\n\n return `LinePixelsCodeNumber-${lineCode}`;\n }\n\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\n\n const name = `LinePixelsCodeNumber-${lineCode}`;\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\n }\n }\n}\n"]}
@@ -49,6 +49,9 @@ export interface LockControl {
49
49
  * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.
50
50
  * @note Acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will
51
51
  * attempt to acquire all necessary locks for both sets of input ids.
52
+ * @note Calling this method after reversing or reinstating a Txn indicates the start of a brand new Txn with the current Txn ID,
53
+ * making it invalid to call [[abandonLocksForReversedTxn]] or [[acquireLocksForReinstatingTxn]] for previously-reversed
54
+ * Txns with the current ID or greater.
52
55
  */
53
56
  acquireLocks(arg: {
54
57
  /** if present, one or more elements to obtain shared lock */
@@ -56,18 +59,99 @@ export interface LockControl {
56
59
  /** if present, one or more elements to obtain exclusive lock */
57
60
  exclusive?: Id64Arg;
58
61
  }): Promise<void>;
59
- /** Release all locks currently held by this briefcase from the locker server.
62
+ /** Release all locks currently held by this briefcase from the lock server after editing the associated elements.
60
63
  * This is typically done on your behalf by [[BriefcaseDb.pushChanges]].
64
+ * If you are abandoning changes instead of pushing them, you should call [[abandonAllLocks]] instead.
61
65
  * You may want to do it manually when abandoning all of your briefcase's local changes.
62
66
  * You cannot release your locks if your briefcase contains local changes.
63
67
  * @throws Error if the briefcase has local changes, or if any other error occurs while releasing the locks.
64
68
  */
65
69
  releaseAllLocks(): Promise<void>;
70
+ /**
71
+ * Abandons all locks currently held by this briefcase when none of the associated elements have
72
+ * been or will be modified. This is only valid to do when none of the elements protected by
73
+ * the currently-held locks have been edited, or if all edits have been reversed or abandoned without
74
+ * pushing them.
75
+ * @beta
76
+ *
77
+ * The locks are released on the IModelHub, but the changeset associated with the locks is not updated,
78
+ * reflecting the fact that the associated elements were not edited.
79
+ */
80
+ abandonAllLocks(): Promise<void>;
66
81
  /**
67
82
  * Release all locks currently held by this Briefcase from the lock server.
68
83
  * Not possible to release locks unless push or abandon all changes. Should only be called internally.
69
84
  * @internal
70
85
  */
71
86
  [_releaseAllLocks]: () => Promise<void>;
87
+ /**
88
+ * Abandons the locks that were acquired during a given Txn and all later Txns, all of which must already
89
+ * have been reversed.
90
+ * @beta
91
+ *
92
+ * @param txnId The ID of the first Txn whose locks should be abandoned. This must either be a Txn that has
93
+ * already been reversed, or the [[TxnManager.getCurrentTxnId]]. In either case, the current Txn must not
94
+ * have any unsaved changes.
95
+ * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,
96
+ * which may be the case if the Txns did not acquire any locks or if they were already abandoned. The Promise rejects
97
+ * with an ITwinError if the Txn has not been reversed, the current Txn has unsaved changes, or if any other error occurs
98
+ * while releasing the locks.
99
+ * @note This method also implicitly calls [[abandonLocksForCurrentUnsavedTxn]]. Locks acquired in the current,
100
+ * unsaved Txn will be abandoned when calling this method. However, they can not be re-acquired using
101
+ * [[acquireLocksForReinstatingTxn]]. This is because there is no way to recover these unsaved changes after abandoning
102
+ * them, so it is rarely useful to re-acquire the locks associated with irrecoverable changes.
103
+ */
104
+ abandonLocksForReversedTxn(txnId: Id64String): Promise<boolean>;
105
+ /**
106
+ * Abandons the locks that were acquired during the current, unsaved Txn. Any changes in the unsaved Txn must be abandoned
107
+ * before calling this method.
108
+ * @beta
109
+ *
110
+ * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,
111
+ * which may be the case if the current Txn did not acquire any locks or if they were already abandoned. The Promise rejects
112
+ * with an ITwinError if the current Txn has unsaved changes, or if any other error occurs while releasing the locks.
113
+ */
114
+ abandonLocksForCurrentUnsavedTxn(): Promise<boolean>;
115
+ /**
116
+ * Re-acquire the locks that were previously acquired during a given Txn and all previous Txns. These locks are
117
+ * expected to have previously been released with {@link LockControl.abandonLocksForReversedTxn}. This is used
118
+ * just before reinstating a previously-reversed Txn to ensure that the necessary locks are held for the
119
+ * reinstated changes.
120
+ * @beta
121
+ *
122
+ * It is possible that the locks may no longer be available, in which case the returned Promise will reject
123
+ * with an exception.
124
+ *
125
+ * @param txnId The ID of the last Txn whose locks should be re-acquired.
126
+ * @returns A promise that resolves to true if any locks were successfully acquired. False if there were no locks to acquire,
127
+ * which may be the case if the Txn in question did not acquire any locks or if they were already re-acquired. The Promise
128
+ * rejects with an ITwinError if the Txn does not exist, the current Txn has unsaved changes, the locks cannot be acquired,
129
+ * or if any other error occurs while acquiring the locks.
130
+ */
131
+ acquireLocksForReinstatingTxn(txnId: Id64String): Promise<boolean>;
132
+ /**
133
+ * Checks whether the locks originally acquired for a specified reversed Txn, and all earlier Txns, were either not abandoned
134
+ * or have already been re-acquired.
135
+ * @beta
136
+ *
137
+ * If this method returns true, it is safe to reinstate the given Txn with [[TxnManager.reinstateTxn]]. If it returns false,
138
+ * the necessary locks must be acquired first, either by calling [[TxnManager.reinstateTxnAsync]] or by explicitly calling
139
+ * [[acquireLocksForReinstatingTxn]] first.
140
+ *
141
+ * @param txnId The ID of the Txn to check.
142
+ * @returns True if the necessary locks are currently held, false otherwise.
143
+ */
144
+ holdsNecessaryLocksForReinstatingTxn(txnId: Id64String): boolean;
145
+ /**
146
+ * Clears the records of locks acquired for a given Txn and all later Txns from the local lock database. Call this after
147
+ * a Txn becomes unreachable. This allows an ID to potentially be reused for a different Txn in the future.
148
+ * @beta
149
+ *
150
+ * After invoking this method, {@link LockControl.abandonLocksForReversedTxn} and {@link LockControl.acquireLocksForReinstatingTxn} will no
151
+ * longer be able to operate on this Txn or any later Txns.
152
+ *
153
+ * @param txnId The ID of the first Txn whose lock records should be cleared.
154
+ */
155
+ clearTxnLockRecords(txnId: Id64String): void;
72
156
  }
73
157
  //# sourceMappingURL=LockControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LockControl.d.ts","sourceRoot":"","sources":["../../src/LockControl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE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B,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhE;;;;;;;;OAQG;IACH,gCAAgC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;OAeG;IACH,6BAA6B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnE;;;;;;;;;;;OAWG;IACH,oCAAoC,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC;IAEjE;;;;;;;;;OASG;IACH,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"LockControl.js","sourceRoot":"","sources":["../../src/LockControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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 iModels\n */\n\nimport { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport { _close, _elementWasCreated, _implementationProhibited, _releaseAllLocks } from \"./internal/Symbols\";\n\n/**\n * Interface for acquiring element locks to [coordinate simultaneous edits]($docs/learning/backend/ConcurrencyControl.md) from multiple briefcases.\n * @see [[IModelDb.locks]] to access the locks for an iModel.\n * @public\n */\nexport interface LockControl {\n /** @internal*/\n readonly [_implementationProhibited]: unknown;\n\n /**\n * true if this LockControl uses a server-based concurrency approach.\n */\n readonly isServerBased: boolean;\n\n /**\n * Close the local lock control database\n * @internal\n */\n [_close]: () => void;\n\n /**\n * Notification that a new element was just created. Called by [[Element.onInserted]]\n * @internal\n */\n [_elementWasCreated]: (id: Id64String) => void;\n\n /**\n * Throw if locks are required and the exclusive lock is not held on the supplied element.\n * Note: there is no need to check the shared locks on parents/models since an element cannot hold the exclusive lock without first obtaining them.\n * Called by functions like [[Element.onUpdate]], [[Element.onDelete]], etc.\n */\n checkExclusiveLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Throw if locks are required and a shared lock is not held on the supplied element.\n * Called by [[Element.onInsert]] to ensure shared lock is held on the new element's model and parent element.\n */\n checkSharedLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Determine whether the owning iModel currently holds the exclusive lock on the specified element.\n */\n holdsExclusiveLock(id: Id64String): boolean;\n\n /**\n * Determine whether the owning iModel currently holds a shared lock on the specified element.\n */\n holdsSharedLock(id: Id64String): boolean;\n\n /**\n * Acquire locks on one or more elements from the lock server, if required and not already held.\n * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.\n * @note Acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will\n * attempt to acquire all necessary locks for both sets of input ids.\n */\n acquireLocks(arg: {\n /** if present, one or more elements to obtain shared lock */\n shared?: Id64Arg;\n /** if present, one or more elements to obtain exclusive lock */\n exclusive?: Id64Arg;\n }): Promise<void>;\n\n /** Release all locks currently held by this briefcase from the locker server.\n * This is typically done on your behalf by [[BriefcaseDb.pushChanges]].\n * You may want to do it manually when abandoning all of your briefcase's local changes.\n * You cannot release your locks if your briefcase contains local changes.\n * @throws Error if the briefcase has local changes, or if any other error occurs while releasing the locks.\n */\n releaseAllLocks(): Promise<void>;\n\n /**\n * Release all locks currently held by this Briefcase from the lock server.\n * Not possible to release locks unless push or abandon all changes. Should only be called internally.\n * @internal\n */\n [_releaseAllLocks]: () => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"LockControl.js","sourceRoot":"","sources":["../../src/LockControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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 iModels\n */\n\nimport { Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport { _close, _elementWasCreated, _implementationProhibited, _releaseAllLocks } from \"./internal/Symbols\";\n\n/**\n * Interface for acquiring element locks to [coordinate simultaneous edits]($docs/learning/backend/ConcurrencyControl.md) from multiple briefcases.\n * @see [[IModelDb.locks]] to access the locks for an iModel.\n * @public\n */\nexport interface LockControl {\n /** @internal*/\n readonly [_implementationProhibited]: unknown;\n\n /**\n * true if this LockControl uses a server-based concurrency approach.\n */\n readonly isServerBased: boolean;\n\n /**\n * Close the local lock control database\n * @internal\n */\n [_close]: () => void;\n\n /**\n * Notification that a new element was just created. Called by [[Element.onInserted]]\n * @internal\n */\n [_elementWasCreated]: (id: Id64String) => void;\n\n /**\n * Throw if locks are required and the exclusive lock is not held on the supplied element.\n * Note: there is no need to check the shared locks on parents/models since an element cannot hold the exclusive lock without first obtaining them.\n * Called by functions like [[Element.onUpdate]], [[Element.onDelete]], etc.\n */\n checkExclusiveLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Throw if locks are required and a shared lock is not held on the supplied element.\n * Called by [[Element.onInsert]] to ensure shared lock is held on the new element's model and parent element.\n */\n checkSharedLock(id: Id64String, type: string, operation: string): void;\n\n /**\n * Determine whether the owning iModel currently holds the exclusive lock on the specified element.\n */\n holdsExclusiveLock(id: Id64String): boolean;\n\n /**\n * Determine whether the owning iModel currently holds a shared lock on the specified element.\n */\n holdsSharedLock(id: Id64String): boolean;\n\n /**\n * Acquire locks on one or more elements from the lock server, if required and not already held.\n * If any required lock is not available, this method throws an exception and *none* of the requested locks are acquired.\n * @note Acquiring the exclusive lock on an element requires also obtaining a shared lock on all its owner elements. This method will\n * attempt to acquire all necessary locks for both sets of input ids.\n * @note Calling this method after reversing or reinstating a Txn indicates the start of a brand new Txn with the current Txn ID,\n * making it invalid to call [[abandonLocksForReversedTxn]] or [[acquireLocksForReinstatingTxn]] for previously-reversed\n * Txns with the current ID or greater.\n */\n acquireLocks(arg: {\n /** if present, one or more elements to obtain shared lock */\n shared?: Id64Arg;\n /** if present, one or more elements to obtain exclusive lock */\n exclusive?: Id64Arg;\n }): Promise<void>;\n\n /** Release all locks currently held by this briefcase from the lock server after editing the associated elements.\n * This is typically done on your behalf by [[BriefcaseDb.pushChanges]].\n * If you are abandoning changes instead of pushing them, you should call [[abandonAllLocks]] instead.\n * You may want to do it manually when abandoning all of your briefcase's local changes.\n * You cannot release your locks if your briefcase contains local changes.\n * @throws Error if the briefcase has local changes, or if any other error occurs while releasing the locks.\n */\n releaseAllLocks(): Promise<void>;\n\n /**\n * Abandons all locks currently held by this briefcase when none of the associated elements have\n * been or will be modified. This is only valid to do when none of the elements protected by\n * the currently-held locks have been edited, or if all edits have been reversed or abandoned without\n * pushing them.\n * @beta\n *\n * The locks are released on the IModelHub, but the changeset associated with the locks is not updated,\n * reflecting the fact that the associated elements were not edited.\n */\n abandonAllLocks(): Promise<void>;\n\n /**\n * Release all locks currently held by this Briefcase from the lock server.\n * Not possible to release locks unless push or abandon all changes. Should only be called internally.\n * @internal\n */\n [_releaseAllLocks]: () => Promise<void>;\n\n /**\n * Abandons the locks that were acquired during a given Txn and all later Txns, all of which must already\n * have been reversed.\n * @beta\n *\n * @param txnId The ID of the first Txn whose locks should be abandoned. This must either be a Txn that has\n * already been reversed, or the [[TxnManager.getCurrentTxnId]]. In either case, the current Txn must not\n * have any unsaved changes.\n * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,\n * which may be the case if the Txns did not acquire any locks or if they were already abandoned. The Promise rejects\n * with an ITwinError if the Txn has not been reversed, the current Txn has unsaved changes, or if any other error occurs\n * while releasing the locks.\n * @note This method also implicitly calls [[abandonLocksForCurrentUnsavedTxn]]. Locks acquired in the current,\n * unsaved Txn will be abandoned when calling this method. However, they can not be re-acquired using\n * [[acquireLocksForReinstatingTxn]]. This is because there is no way to recover these unsaved changes after abandoning\n * them, so it is rarely useful to re-acquire the locks associated with irrecoverable changes.\n */\n abandonLocksForReversedTxn(txnId: Id64String): Promise<boolean>;\n\n /**\n * Abandons the locks that were acquired during the current, unsaved Txn. Any changes in the unsaved Txn must be abandoned\n * before calling this method.\n * @beta\n *\n * @returns A promise that resolves to true if any locks were successfully abandoned. False if there were no locks to abandon,\n * which may be the case if the current Txn did not acquire any locks or if they were already abandoned. The Promise rejects\n * with an ITwinError if the current Txn has unsaved changes, or if any other error occurs while releasing the locks.\n */\n abandonLocksForCurrentUnsavedTxn(): Promise<boolean>;\n\n /**\n * Re-acquire the locks that were previously acquired during a given Txn and all previous Txns. These locks are\n * expected to have previously been released with {@link LockControl.abandonLocksForReversedTxn}. This is used\n * just before reinstating a previously-reversed Txn to ensure that the necessary locks are held for the\n * reinstated changes.\n * @beta\n *\n * It is possible that the locks may no longer be available, in which case the returned Promise will reject\n * with an exception.\n *\n * @param txnId The ID of the last Txn whose locks should be re-acquired.\n * @returns A promise that resolves to true if any locks were successfully acquired. False if there were no locks to acquire,\n * which may be the case if the Txn in question did not acquire any locks or if they were already re-acquired. The Promise\n * rejects with an ITwinError if the Txn does not exist, the current Txn has unsaved changes, the locks cannot be acquired,\n * or if any other error occurs while acquiring the locks.\n */\n acquireLocksForReinstatingTxn(txnId: Id64String): Promise<boolean>;\n\n /**\n * Checks whether the locks originally acquired for a specified reversed Txn, and all earlier Txns, were either not abandoned\n * or have already been re-acquired.\n * @beta\n *\n * If this method returns true, it is safe to reinstate the given Txn with [[TxnManager.reinstateTxn]]. If it returns false,\n * the necessary locks must be acquired first, either by calling [[TxnManager.reinstateTxnAsync]] or by explicitly calling\n * [[acquireLocksForReinstatingTxn]] first.\n *\n * @param txnId The ID of the Txn to check.\n * @returns True if the necessary locks are currently held, false otherwise.\n */\n holdsNecessaryLocksForReinstatingTxn(txnId: Id64String): boolean;\n\n /**\n * Clears the records of locks acquired for a given Txn and all later Txns from the local lock database. Call this after\n * a Txn becomes unreachable. This allows an ID to potentially be reused for a different Txn in the future.\n * @beta\n *\n * After invoking this method, {@link LockControl.abandonLocksForReversedTxn} and {@link LockControl.acquireLocksForReinstatingTxn} will no\n * longer be able to operate on this Txn or any later Txns.\n *\n * @param txnId The ID of the first Txn whose lock records should be cleared.\n */\n clearTxnLockRecords(txnId: Id64String): void;\n}\n"]}
@@ -4,6 +4,7 @@
4
4
  import { Id64String } from "@itwin/core-bentley";
5
5
  import { Code, CodeScopeProps, ElementProps, NormalMapProps, RenderMaterialProps, RgbFactorProps, TextureMapProps } from "@itwin/core-common";
6
6
  import { DefinitionElement } from "./Element";
7
+ import { EditTxn } from "./EditTxn";
7
8
  import { IModelDb } from "./IModelDb";
8
9
  import { IModelElementCloneContext } from "./IModelElementCloneContext";
9
10
  import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "./Entity";
@@ -76,12 +77,18 @@ export declare class RenderMaterialElement extends DefinitionElement {
76
77
  static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement;
77
78
  /**
78
79
  * Insert a new RenderMaterial into a model.
79
- * @param iModelDb Insert into this iModel
80
+ * @param txn The EditTxn to use
80
81
  * @param definitionModelId Insert the new Texture into this DefinitionModel
81
82
  * @param materialName The name/CodeValue of the RenderMaterial
82
83
  * @param params Parameters object which describes how to construct the RenderMaterial
83
84
  * @returns The Id of the newly inserted RenderMaterial element.
84
85
  * @throws [[IModelError]] if unable to insert the element.
86
+ * @beta
87
+ */
88
+ static insert(txn: EditTxn, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
89
+ /**
90
+ * Insert a new RenderMaterial into a model.
91
+ * @deprecated Use RenderMaterialElement.insert(txn, ...) instead.
85
92
  */
86
93
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
87
94
  /** @beta */
@@ -1 +1 @@
1
- {"version":3,"file":"Material.d.ts","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACQ,IAAI,EAAE,cAAc,EAAoC,YAAY,EAAE,cAAc,EAAgC,mBAAmB,EAAE,cAAc,EAAE,eAAe,EACtL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIlF;;;GAGG;AACH,8BAAsB,gBAAiB,SAAQ,iBAAiB;IAC9D,WAA2B,SAAS,IAAI,MAAM,CAA+B;IAC7E;;;;OAIG;WACW,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIjG;;;;;;OAMG;WACW,MAAM,CAAC,CAAC,SAAS,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CAQzH;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,WAA2B,SAAS,IAAI,MAAM,CAA6B;IAE3E,+EAA+E;IACxE,WAAW,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE5B,OAAO;IAMS,MAAM,IAAI,mBAAmB;IAO7C;;;;OAIG;IACH,0BAAm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jB,mEAAmE;QAC5D,WAAW,EAAE,MAAM,CAAC;QAC3B,qDAAqD;QAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;QAC5B,iHAAiH;QAC1G,KAAK,CAAC,EAAE,cAAc,CAAC;QAC9B,kEAAkE;QAC3D,aAAa,CAAC,EAAE,cAAc,CAAC;QACtC;;WAEG;QACI,MAAM,CAAC,EAAE,MAAM,CAAC;QACvB;;;;WAIG;QACI,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wEAAwE;QACjE,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,yEAAyE;QAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wBAAwB;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,wBAAwB;QACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B;;;WAGG;QACI,UAAU,CAAC,EAAE,eAAe,CAAC;QACpC;;;;WAIG;QACI,SAAS,CAAC,EAAE,cAAc,GAAG;YAClC;;eAEG;YACH,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QAEF,gJAAgJ;oBAC7H,WAAW,EAAE,MAAM;KAGvC;CACF;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB,CAAC,MAAM;CAChF"}
@@ -8,6 +8,8 @@
8
8
  import { Id64, JsonUtils } from "@itwin/core-bentley";
9
9
  import { BisCodeSpec, Code, } from "@itwin/core-common";
10
10
  import { DefinitionElement } from "./Element";
11
+ import { EditTxn } from "./EditTxn";
12
+ import { _implicitTxn } from "./internal/Symbols";
11
13
  /* eslint-disable @typescript-eslint/naming-convention */
12
14
  /** A PhysicalMaterial defines the matter that makes up physical elements.
13
15
  * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.
@@ -178,18 +180,10 @@ export class RenderMaterialElement extends DefinitionElement {
178
180
  };
179
181
  return new RenderMaterialElement(renderMaterialProps, iModelDb);
180
182
  }
181
- /**
182
- * Insert a new RenderMaterial into a model.
183
- * @param iModelDb Insert into this iModel
184
- * @param definitionModelId Insert the new Texture into this DefinitionModel
185
- * @param materialName The name/CodeValue of the RenderMaterial
186
- * @param params Parameters object which describes how to construct the RenderMaterial
187
- * @returns The Id of the newly inserted RenderMaterial element.
188
- * @throws [[IModelError]] if unable to insert the element.
189
- */
190
- static insert(iModelDb, definitionModelId, materialName, params) {
191
- const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);
192
- return iModelDb.elements.insertElement(renderMaterial.toJSON());
183
+ static insert(txnOrDb, definitionModelId, materialName, params) {
184
+ const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];
185
+ const renderMaterial = this.create(txn.iModel, definitionModelId, materialName, params);
186
+ return renderMaterial.insert(txn);
193
187
  }
194
188
  /** @beta */
195
189
  static async onCloned(context, sourceProps, targetProps) {
@@ -1 +1 @@
1
- {"version":3,"file":"Material.js","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,WAAW,EAAE,IAAI,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAK9C,yDAAyD;AAEzD;;;GAGG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,iBAAiB;IACvD,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,MAAgB,EAAE,iBAAiC,EAAE,IAAY;QACxF,MAAM,QAAQ,GAAa,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACpF,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KA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ACrJ,CAAC;IACH,CAAC;;AAGH,cAAc;AACd,WAAiB,qBAAqB;IACpC;;;;OAIG;IACH,MAAa,MAAM;QACjB,mEAAmE;QAC5D,WAAW,CAAS;QAC3B,qDAAqD;QAC9C,WAAW,CAAU;QAC5B,iHAAiH;QAC1G,KAAK,CAAkB;QAC9B,kEAAkE;QAC3D,aAAa,CAAkB;QACtC;;WAEG;QACI,MAAM,CAAU;QACvB;;;;WAIG;QACI,QAAQ,CAAU;QACzB,wEAAwE;QACjE,OAAO,CAAU;QACxB,yEAAyE;QAClE,QAAQ,CAAU;QACzB,wBAAwB;QACjB,OAAO,CAAU;QACxB,wBAAwB;QACjB,YAAY,CAAY;QAC/B;;;WAGG;QACI,UAAU,CAAmB;QACpC;;;;WAIG;QACI,SAAS,CAKd;QAEF,gJAAgJ;QAChJ,YAAmB,WAAmB;YACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACjC,CAAC;KACF;IAhDY,4BAAM,SAgDlB,CAAA;AACH,CAAC,EAvDgB,qBAAqB,KAArB,qBAAqB,QAuDrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, DefinitionElementProps, ElementProps, NormalMapProps, RenderMaterialAssetMapsProps, RenderMaterialProps, RgbFactorProps, TextureMapProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/** A PhysicalMaterial defines the matter that makes up physical elements.\n * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.\n * @public\n */\nexport abstract class PhysicalMaterial extends DefinitionElement {\n public static override get className(): string { return \"PhysicalMaterial\"; }\n /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.physicalMaterial);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n /** Create a PhysicalMaterial\n * @param iModelDb The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n * @returns The newly constructed PhysicalMaterial\n * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial\n */\n public static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T {\n const elementProps: DefinitionElementProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n };\n return iModelDb.elements.createElement(elementProps);\n }\n}\n\n/** Defines a rendering material.\n * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements.\n * @public\n */\nexport class RenderMaterialElement extends DefinitionElement {\n public static override get className(): string { return \"RenderMaterial\"; }\n\n /** The name of a palette that can be used to categorize multiple materials. */\n public paletteName: string;\n /** An optional description of the material. */\n public description?: string;\n\n private constructor(props: RenderMaterialProps, iModel: IModelDb) {\n super(props, iModel);\n this.paletteName = props.paletteName;\n this.description = props.description;\n }\n\n public override toJSON(): RenderMaterialProps {\n const val = super.toJSON() as RenderMaterialProps;\n val.paletteName = this.paletteName;\n val.description = this.description;\n return val;\n }\n\n /**\n * RenderMaterialElement custom HandledProps includes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"paletteName\", source: \"Class\" },\n ];\n\n /**\n * RenderMaterialElement deserializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): RenderMaterialProps {\n const elProps = super.deserialize(props) as RenderMaterialProps;\n const instance = props.row;\n elProps.paletteName = JsonUtils.asString(instance.paletteName);\n return elProps;\n }\n\n /**\n * RenderMaterialElement serializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: RenderMaterialProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n inst.paletteName = props.paletteName;\n return inst;\n }\n\n /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name.\n * @param name The RenderMaterial name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.renderMaterial);\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\n }\n /**\n * Create a RenderMaterial with given parameters.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The newly constructed RenderMaterial element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement {\n let maps: RenderMaterialAssetMapsProps | undefined;\n const pbr_normal = params.normalMap?.scale;\n if (params.patternMap || params.normalMap) {\n // If both normal and pattern map are present, their texture mapping modes, angles, scales, etc are expected to match.\n type TexMap = Omit<TextureMapProps, \"TextureId\">;\n function choose<K extends keyof TexMap>(obj: TexMap, key: K): void {\n const pat = params.patternMap;\n if (pat && undefined !== pat[key])\n obj[key] = pat[key];\n else if (params.normalMap && undefined !== params.normalMap[key])\n obj[key] = params.normalMap[key];\n }\n\n const baseProps: TexMap = {};\n choose(baseProps, \"pattern_angle\");\n choose(baseProps, \"pattern_u_flip\");\n choose(baseProps, \"pattern_flip\");\n choose(baseProps, \"pattern_scale\");\n choose(baseProps, \"pattern_offset\");\n choose(baseProps, \"pattern_scalemode\");\n choose(baseProps, \"pattern_mapping\");\n choose(baseProps, \"pattern_weight\");\n choose(baseProps, \"pattern_useconstantlod\");\n choose(baseProps, \"pattern_constantlod_repetitions\");\n choose(baseProps, \"pattern_constantlod_offset\");\n choose(baseProps, \"pattern_constantlod_mindistanceclamp\");\n choose(baseProps, \"pattern_constantlod_maxdistanceclamp\");\n\n maps = {};\n if (params.patternMap)\n maps.Pattern = { ...params.patternMap, ...baseProps };\n\n if (params.normalMap) {\n maps.Normal = {\n ...params.normalMap,\n ...baseProps,\n };\n\n delete (maps.Normal as any).scale;\n }\n }\n\n const renderMaterialProps: RenderMaterialProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, materialName),\n paletteName: params.paletteName,\n description: params.description,\n jsonProperties: {\n materialAssets: {\n renderMaterial: {\n HasBaseColor: params.color !== undefined,\n color: params.color,\n HasSpecularColor: params.specularColor !== undefined,\n specular_color: params.specularColor,\n HasFinish: params.finish !== undefined,\n finish: params.finish,\n HasTransmit: params.transmit !== undefined ? true : undefined,\n transmit: params.transmit,\n HasDiffuse: params.diffuse !== undefined,\n diffuse: params.diffuse,\n HasSpecular: params.specular !== undefined,\n specular: params.specular,\n HasReflect: params.reflect !== undefined,\n reflect: params.reflect,\n HasReflectColor: params.reflectColor !== undefined,\n reflect_color: params.reflectColor,\n Map: maps,\n pbr_normal,\n },\n },\n },\n model: definitionModelId,\n isPrivate: false,\n };\n\n return new RenderMaterialElement(renderMaterialProps, iModelDb);\n }\n\n /**\n * Insert a new RenderMaterial into a model.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new Texture into this DefinitionModel\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The Id of the newly inserted RenderMaterial element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String {\n const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);\n return iModelDb.elements.insertElement(renderMaterial.toJSON());\n }\n\n /** @beta */\n protected static override async onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps) {\n await super.onCloned(context, sourceProps, targetProps);\n for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {\n if (typeof mapName !== \"string\")\n continue;\n const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];\n // sourceMap could be null/undefined, keep it the same in targetProps\n if (!sourceMap) {\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName] = sourceMap;\n continue;\n }\n if (!Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)\n continue;\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? Id64.invalid);\n }\n }\n}\n\n/** @public */\nexport namespace RenderMaterialElement {\n /** Parameters used to construct a [[RenderMaterial]].\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @deprecated in 3.6 - might be removed in next major version. Because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead.\n */\n export class Params {\n /** A required palette name that categorizes this RenderMaterial */\n public paletteName: string;\n /** An optional description of this RenderMaterial */\n public description?: string;\n /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */\n public color?: RgbFactorProps;\n /** The color to use for specular illumination. Default: black. */\n public specularColor?: RgbFactorProps;\n /** The specular exponent describing the surface's shininess, in the range 0 through 128.\n * Default: 0.\n */\n public finish?: number;\n /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent).\n * If defined, then the material transparency overrides the transparency of whatever surface the material is applied to.\n * If undefined, the material has no effect on surface transparency.\n * Default: undefined.\n */\n public transmit?: number;\n /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */\n public diffuse?: number;\n /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */\n public specular?: number;\n /** Currently unused. */\n public reflect?: number;\n /** Currently unused. */\n public reflectColor?: number[];\n /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public patternMap?: TextureMapProps;\n /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the\n * surface's geometry.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public normalMap?: NormalMapProps & {\n /** A factor by which to multiply the components of the normal vectors read from the texture.\n * Default: 1.\n */\n scale?: number;\n };\n\n /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */\n public constructor(paletteName: string) {\n this.paletteName = paletteName;\n }\n }\n}\n\n/** Parameters used to create a [[RenderMaterial]] element.\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @public\n */\nexport interface RenderMaterialElementParams extends RenderMaterialElement.Params { // eslint-disable-line @typescript-eslint/no-deprecated, @typescript-eslint/no-empty-object-type\n}\n"]}
1
+ {"version":3,"file":"Material.js","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,WAAW,EAAE,IAAI,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,yDAAyD;AAEzD;;;GAGG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,iBAAiB;IACvD,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,MAAgB,EAAE,iBAAiC,EAAE,IAAY;QACxF,MAAM,QAAQ,GAAa,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACpF,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAA6B,QAAkB,EAAE,iBAAiC,EAAE,IAAY;QAClH,MAAM,YAAY,GAA2B;YAC3C,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;SACzD,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;CACF;AAED;;;GAGG;AACH,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yE;QAClE,QAAQ,CAAU;QACzB,wBAAwB;QACjB,OAAO,CAAU;QACxB,wBAAwB;QACjB,YAAY,CAAY;QAC/B;;;WAGG;QACI,UAAU,CAAmB;QACpC;;;;WAIG;QACI,SAAS,CAKd;QAEF,gJAAgJ;QAChJ,YAAmB,WAAmB;YACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACjC,CAAC;KACF;IAhDY,4BAAM,SAgDlB,CAAA;AACH,CAAC,EAvDgB,qBAAqB,KAArB,qBAAqB,QAuDrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, DefinitionElementProps, ElementProps, NormalMapProps, RenderMaterialAssetMapsProps, RenderMaterialProps, RgbFactorProps, TextureMapProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { EditTxn } from \"./EditTxn\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\nimport { _implicitTxn } from \"./internal/Symbols\";\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/** A PhysicalMaterial defines the matter that makes up physical elements.\n * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.\n * @public\n */\nexport abstract class PhysicalMaterial extends DefinitionElement {\n public static override get className(): string { return \"PhysicalMaterial\"; }\n /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.physicalMaterial);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n /** Create a PhysicalMaterial\n * @param iModelDb The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n * @returns The newly constructed PhysicalMaterial\n * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial\n */\n public static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T {\n const elementProps: DefinitionElementProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n };\n return iModelDb.elements.createElement(elementProps);\n }\n}\n\n/** Defines a rendering material.\n * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements.\n * @public\n */\nexport class RenderMaterialElement extends DefinitionElement {\n public static override get className(): string { return \"RenderMaterial\"; }\n\n /** The name of a palette that can be used to categorize multiple materials. */\n public paletteName: string;\n /** An optional description of the material. */\n public description?: string;\n\n private constructor(props: RenderMaterialProps, iModel: IModelDb) {\n super(props, iModel);\n this.paletteName = props.paletteName;\n this.description = props.description;\n }\n\n public override toJSON(): RenderMaterialProps {\n const val = super.toJSON() as RenderMaterialProps;\n val.paletteName = this.paletteName;\n val.description = this.description;\n return val;\n }\n\n /**\n * RenderMaterialElement custom HandledProps includes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"paletteName\", source: \"Class\" },\n ];\n\n /**\n * RenderMaterialElement deserializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): RenderMaterialProps {\n const elProps = super.deserialize(props) as RenderMaterialProps;\n const instance = props.row;\n elProps.paletteName = JsonUtils.asString(instance.paletteName);\n return elProps;\n }\n\n /**\n * RenderMaterialElement serializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: RenderMaterialProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n inst.paletteName = props.paletteName;\n return inst;\n }\n\n /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name.\n * @param name The RenderMaterial name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.renderMaterial);\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\n }\n /**\n * Create a RenderMaterial with given parameters.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The newly constructed RenderMaterial element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement {\n let maps: RenderMaterialAssetMapsProps | undefined;\n const pbr_normal = params.normalMap?.scale;\n if (params.patternMap || params.normalMap) {\n // If both normal and pattern map are present, their texture mapping modes, angles, scales, etc are expected to match.\n type TexMap = Omit<TextureMapProps, \"TextureId\">;\n function choose<K extends keyof TexMap>(obj: TexMap, key: K): void {\n const pat = params.patternMap;\n if (pat && undefined !== pat[key])\n obj[key] = pat[key];\n else if (params.normalMap && undefined !== params.normalMap[key])\n obj[key] = params.normalMap[key];\n }\n\n const baseProps: TexMap = {};\n choose(baseProps, \"pattern_angle\");\n choose(baseProps, \"pattern_u_flip\");\n choose(baseProps, \"pattern_flip\");\n choose(baseProps, \"pattern_scale\");\n choose(baseProps, \"pattern_offset\");\n choose(baseProps, \"pattern_scalemode\");\n choose(baseProps, \"pattern_mapping\");\n choose(baseProps, \"pattern_weight\");\n choose(baseProps, \"pattern_useconstantlod\");\n choose(baseProps, \"pattern_constantlod_repetitions\");\n choose(baseProps, \"pattern_constantlod_offset\");\n choose(baseProps, \"pattern_constantlod_mindistanceclamp\");\n choose(baseProps, \"pattern_constantlod_maxdistanceclamp\");\n\n maps = {};\n if (params.patternMap)\n maps.Pattern = { ...params.patternMap, ...baseProps };\n\n if (params.normalMap) {\n maps.Normal = {\n ...params.normalMap,\n ...baseProps,\n };\n\n delete (maps.Normal as any).scale;\n }\n }\n\n const renderMaterialProps: RenderMaterialProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, materialName),\n paletteName: params.paletteName,\n description: params.description,\n jsonProperties: {\n materialAssets: {\n renderMaterial: {\n HasBaseColor: params.color !== undefined,\n color: params.color,\n HasSpecularColor: params.specularColor !== undefined,\n specular_color: params.specularColor,\n HasFinish: params.finish !== undefined,\n finish: params.finish,\n HasTransmit: params.transmit !== undefined ? true : undefined,\n transmit: params.transmit,\n HasDiffuse: params.diffuse !== undefined,\n diffuse: params.diffuse,\n HasSpecular: params.specular !== undefined,\n specular: params.specular,\n HasReflect: params.reflect !== undefined,\n reflect: params.reflect,\n HasReflectColor: params.reflectColor !== undefined,\n reflect_color: params.reflectColor,\n Map: maps,\n pbr_normal,\n },\n },\n },\n model: definitionModelId,\n isPrivate: false,\n };\n\n return new RenderMaterialElement(renderMaterialProps, iModelDb);\n }\n\n /**\n * Insert a new RenderMaterial into a model.\n * @param txn The EditTxn to use\n * @param definitionModelId Insert the new Texture into this DefinitionModel\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The Id of the newly inserted RenderMaterial element.\n * @throws [[IModelError]] if unable to insert the element.\n * @beta\n */\n public static insert(txn: EditTxn, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;\n /**\n * Insert a new RenderMaterial into a model.\n * @deprecated Use RenderMaterialElement.insert(txn, ...) instead.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String {\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\n const renderMaterial = this.create(txn.iModel, definitionModelId, materialName, params);\n return renderMaterial.insert(txn);\n }\n\n /** @beta */\n protected static override async onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps) {\n await super.onCloned(context, sourceProps, targetProps);\n for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {\n if (typeof mapName !== \"string\")\n continue;\n const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];\n // sourceMap could be null/undefined, keep it the same in targetProps\n if (!sourceMap) {\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName] = sourceMap;\n continue;\n }\n if (!Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)\n continue;\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? Id64.invalid);\n }\n }\n}\n\n/** @public */\nexport namespace RenderMaterialElement {\n /** Parameters used to construct a [[RenderMaterial]].\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @deprecated in 3.6 - might be removed in next major version. Because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead.\n */\n export class Params {\n /** A required palette name that categorizes this RenderMaterial */\n public paletteName: string;\n /** An optional description of this RenderMaterial */\n public description?: string;\n /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */\n public color?: RgbFactorProps;\n /** The color to use for specular illumination. Default: black. */\n public specularColor?: RgbFactorProps;\n /** The specular exponent describing the surface's shininess, in the range 0 through 128.\n * Default: 0.\n */\n public finish?: number;\n /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent).\n * If defined, then the material transparency overrides the transparency of whatever surface the material is applied to.\n * If undefined, the material has no effect on surface transparency.\n * Default: undefined.\n */\n public transmit?: number;\n /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */\n public diffuse?: number;\n /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */\n public specular?: number;\n /** Currently unused. */\n public reflect?: number;\n /** Currently unused. */\n public reflectColor?: number[];\n /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public patternMap?: TextureMapProps;\n /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the\n * surface's geometry.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public normalMap?: NormalMapProps & {\n /** A factor by which to multiply the components of the normal vectors read from the texture.\n * Default: 1.\n */\n scale?: number;\n };\n\n /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */\n public constructor(paletteName: string) {\n this.paletteName = paletteName;\n }\n }\n}\n\n/** Parameters used to create a [[RenderMaterial]] element.\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @public\n */\nexport interface RenderMaterialElementParams extends RenderMaterialElement.Params { // eslint-disable-line @typescript-eslint/no-deprecated, @typescript-eslint/no-empty-object-type\n}\n"]}